WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
81101
sheriffbot should also be addressable with a comma in addition to colon
https://bugs.webkit.org/show_bug.cgi?id=81101
Summary
sheriffbot should also be addressable with a comma in addition to colon
Gustavo Noronha (kov)
Reported
2012-03-14 06:24:48 PDT
sheriffbot should also be addressable with a comma in addition to colon
Attachments
Patch
(2.05 KB, patch)
2012-03-14 06:28 PDT
,
Gustavo Noronha (kov)
no flags
Details
Formatted Diff
Diff
Patch
(2.09 KB, patch)
2012-03-14 15:40 PDT
,
Gustavo Noronha (kov)
abarth
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Gustavo Noronha (kov)
Comment 1
2012-03-14 06:28:30 PDT
Created
attachment 131836
[details]
Patch
Gustavo Noronha (kov)
Comment 2
2012-03-14 06:30:21 PDT
The IRC client I use adds a comma after the nickname, when tab-completing, instead of a :. sheriffbot ignores those messages, would be good to allow both.
Adam Barth
Comment 3
2012-03-14 15:00:49 PDT
Comment on
attachment 131836
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=131836&action=review
> Tools/Scripts/webkitpy/common/net/irc/ircbot.py:79 > + if not irclib.irc_lower(request[:nickname_length]).startswith(irclib.irc_lower(self.connection.get_nickname())):
What's the point of trimming request to nickname_length if you're going to use startswith anyway?
> Tools/Scripts/webkitpy/common/net/irc/ircbot.py:84 > + if request[nickname_length] == ':':
Won't this crash if len(request) == nickname_length ?
> Tools/Scripts/webkitpy/common/net/irc/ircbot.py:85 > + request = request.split(':')
Also, don't we need to use split(":", 1) to avoid breaking in cases like: sheriffbot: some message with a : character ?
Gustavo Noronha (kov)
Comment 4
2012-03-14 15:40:12 PDT
Created
attachment 131941
[details]
Patch
Gustavo Noronha (kov)
Comment 5
2012-03-14 15:41:59 PDT
(In reply to
comment #3
)
> > Tools/Scripts/webkitpy/common/net/irc/ircbot.py:79 > > + if not irclib.irc_lower(request[:nickname_length]).startswith(irclib.irc_lower(self.connection.get_nickname())): > > What's the point of trimming request to nickname_length if you're going to use startswith anyway?
The idea was to only apply irc_lower on what was needed for the test, but it's probably a worthless micro-optimization anyway.
> > Tools/Scripts/webkitpy/common/net/irc/ircbot.py:85 > > + request = request.split(':') > > Also, don't we need to use split(":", 1) to avoid breaking in cases like: > > sheriffbot: some message with a : character
And the original code even did it, properly =). Thanks for the review!
Adam Barth
Comment 6
2012-03-14 15:53:12 PDT
Comment on
attachment 131941
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=131941&action=review
> Tools/Scripts/webkitpy/common/net/irc/ircbot.py:86 > + # Some IRC clients, like xchat-gnome, default to using a comma > + # when addressing someone. > + try: > + vocative_separator = request[len(connection.get_nickname())] > + except IndexError: > + return
This patch is fine, but you don't really need to use a try-catch block here. A simple length test should work fine. :)
Gustavo Noronha (kov)
Comment 7
2012-03-15 05:50:43 PDT
Committed
r110837
: <
http://trac.webkit.org/changeset/110837
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug