Closed Bug 131321 Opened 22 years ago Closed 16 years ago

[SEEN] Wildcards for !seen command

Categories

(Webtools Graveyard :: Mozbot, enhancement, P3)

x86
Linux
enhancement

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ian, Assigned: justdave)

References

Details

Attachments

(3 files, 3 obsolete files)

<honeypea> can the !seen do wildcard stuff?
<honeypea> it couldnt for infobot, unlike eggdrop
<honeypea> oh yes definitely if you can
<honeypea> like "!seen honey*"
<honeypea> VERY popular
Target Milestone: --- → Mozbot 2.6
QA Contact: timeless → kerz
Summary: Wildcards for !seen command → [GREETING] Wildcards for !seen command
Summary: [GREETING] Wildcards for !seen command → [SEEN] Wildcards for !seen command
Target Milestone: Mozbot 2.6 → ---
Attached patch Real patch (obsolete) — Splinter Review
Assignee: ian → justdave
Status: NEW → ASSIGNED
This patch is with diff -w for review purposes, since 90% of the real patch is
an indent shift.
Attachment #141662 - Flags: review?(ian)
Attached patch Real patch v2Splinter Review
oops, previous patch has a fall-through problem if there's no matching nicks.
Attachment #141661 - Attachment is obsolete: true
Attachment #141662 - Attachment is obsolete: true
Attachment #141662 - Flags: review?(ian)
Attachment #141664 - Flags: review?(ian)
Comment on attachment 141664 [details] [diff] [review]
no-whitespace patch v2

>+        my $regexp = quotemeta(lc $who);

There's a sanitizeRegexp (or something) function in the bot API you can use
which will return back a regexp if it is valid and quote it otherwise. Use
that, that way people can use regexps too.

(If you do decide to use this, remove the lc from this call, and put a /i on
the grep regexp later. That way ridiculously geeky people can use perl (?-i) in
their regexp to get case sensitive matches.)


>+        $regexp =~ s/\\\*/.*/g; # replace the escaped * from [...]

This would then fail on regexp patterns like "foo\\*", unfortunately (to catch
users called foo, foo\, foo\\, foo\\\), so maybe not supporting regexps is
fine.

>+        if (10 < @nicksToList) { # if it's more than 10

Use @nicksToList > 10. And make it a configurable number of lines, since
different people have different thresholds of how many lines they want output
to the channel. (10 is quite a bit... default to 4 or 5?)

>+        } elsif (0 < @nicksToList) {

Use @nicksToList > 0.


	    my $n = '';
	    if ($who =~ /^[aeiou]/o) {
		$n = 'n';
	    }
	    $self->say($event, "I've never seen a$n '$who', sorry.");

Change this so it says "I've never seen anyone matching the pattern '$who',
sorry." instead.


Great patch though, these are just minor nits. Note that at some point I want
to split Greeting.bm into Greeting.bm for the fun stuff and Seen.bm for the
!seen stuff. If you feel an urge to do this after you're done with this patch,
I'm not going to stop you. In fact I would sit on the sidelines cheering. :-)
Attachment #141664 - Flags: review?(ian) → review-
I'd love to get this into 2.6.
Target Milestone: --- → Mozbot 2.6
Priority: -- → P3
Attached file Seen.bm (obsolete) —
My Perl skills are a bit rusty, so this may not be the best way to do it. I noticed that nicks are stored in lowercase, so this ignores case and any specified modes. Since this is also a new standalone module, I'll file a new bug on removing the !seen bits from Greeting.bm.
Attachment #225548 - Flags: review?(ian)
Attached file Seen.bm v2
Did I mention my regex-fu stinks as well? ;)
Attachment #225548 - Attachment is obsolete: true
Attachment #225548 - Flags: review?(ian)
QA Contact: kerz → mozbot
Whiteboard: [has-attachment]
Blocks: 341484
Whiteboard: [has-attachment] → [has-attachment][needs testing]
Comment on attachment 226034 [details]
Seen.bm v2

Woo. This would've been much easier to review as a seperate wildcards then a seperate seen out of greeting patch, but oh well.
Looks like the review comments from the previous iteration were addressed (regexp problem, nicksToList being configurable, etc, and testing doesn't reveal any problems.
Attachment #226034 - Flags: review+
mozilla/webtools/mozbot/BotModules/Seen.bm 1.1
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Whiteboard: [has-attachment][needs testing]
Verified Fixed.
Status: RESOLVED → VERIFIED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: