Opened 12 years ago

Closed 12 years ago

#3148 defect closed fixed (fixed)

Incorrect docstring in irc.py

Reported by: Ezio Melotti Owned by:
Priority: low Milestone: Twisted-8.2
Component: words Keywords: irc IRCClient modeChanged
Cc: Branch:
Author: Wolf

Description

In the irc.py module, on the line 702 (http://twistedmatrix.com/trac/browser/trunk/twisted/words/protocols/irc.py#L702), there's written "Called when a channel's modes are changed" but the method is called even if the modes of a user are changed:

class MyClient(irc.IRCClient):
    def modeChanged(self, user, channel, set, modes, args):
        print 'Mode changed:', user, channel, set, modes, args

# Output:
# just after the connection to the server
Mode changed: mynick mynick True ix ()
# when someone ops me
Mode changed: opper!~x@foobarbaz #chan True o ('mynick',)
# when someone deops someone else
Mode changed: deopper!~x@foobarbaz #chan False o ('deopped',)
# when someone sets +c on a channel
Mode changed: someone!~x@foobarbaz #chan True c ()

Only in the last of these 4 examples the change is relative to a channel. In the 2nd and 3rd examples, the changes are relative to a user in a channel and in the 1st to a user.

If is not possible to have a method for the user modes and another method for the channel modes, the docstring should be corrected in order to warn the user that modeChanged handles *all* the changes and not only the ones relative to the channel.

Change History (3)

comment:1 Changed 12 years ago by Jean-Paul Calderone

Milestone: Words-8.0.0+1Twisted-8.2

Milestone Words-8.0.0+1 deleted

comment:2 Changed 12 years ago by therve

Resolution: fixed
Status: newclosed

It has been closed in r23671 with #3230.

comment:3 Changed 9 years ago by <automation>

Owner: Jean-Paul Calderone deleted
Note: See TracTickets for help on using tickets.