mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Added mode, and made sure to send one after joining a channel.
This commit is contained in:
parent
e609d5dfd7
commit
99926fd170
@ -162,8 +162,6 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
||||
irc.queueMsg(ircmsgs.joins(channels, keys))
|
||||
for channel in channels:
|
||||
self.joins[channel] = (irc, msg)
|
||||
if channel not in irc.state.channels:
|
||||
irc.queueMsg(ircmsgs.who(channel))
|
||||
|
||||
def channels(self, irc, msg, args):
|
||||
"""takes no arguments
|
||||
|
@ -349,10 +349,26 @@ class IrcState(IrcCommandDispatcher):
|
||||
chan.voices.discard(value)
|
||||
elif mode == '+v':
|
||||
chan.voices.add(value)
|
||||
elif mode == '+i':
|
||||
chan.setMode('i')
|
||||
elif mode == '-i':
|
||||
chan.unsetMode('i')
|
||||
elif mode[-1] in 'beq':
|
||||
pass # We don't need this right now.
|
||||
else:
|
||||
modeChar = mode[1]
|
||||
if mode[0] == '+':
|
||||
chan.setMode(modeChar, value)
|
||||
else:
|
||||
assert mode[0] == '-'
|
||||
chan.unsetMode(modeChar)
|
||||
|
||||
def do324(self, irc, msg):
|
||||
channel = msg.args[1]
|
||||
chan = self.channels[channel]
|
||||
for (mode, value) in ircutils.separateModes(msg.args[2:]):
|
||||
modeChar = mode[1]
|
||||
if mode[0] == '+':
|
||||
chan.setMode(modeChar, value)
|
||||
else:
|
||||
assert mode[0] == '-'
|
||||
chan.unsetMode(modeChar)
|
||||
|
||||
def do353(self, irc, msg):
|
||||
(_, _, channel, users) = msg.args
|
||||
@ -577,6 +593,12 @@ class Irc(IrcCommandDispatcher):
|
||||
self.sendMsg(ircmsgs.nick(newNick))
|
||||
do432 = do433
|
||||
|
||||
def doJoin(self, msg):
|
||||
if msg.nick == self.nick:
|
||||
channel = msg.args[0]
|
||||
self.queueMsg(ircmsgs.who(channel))
|
||||
self.queueMsg(ircmsgs.mode(channel))
|
||||
|
||||
def doError(self, msg):
|
||||
"""Handles ERROR messages."""
|
||||
log.info('Error message from %s: %s', self.server, msg.args[0])
|
||||
@ -677,6 +699,9 @@ class Irc(IrcCommandDispatcher):
|
||||
def __eq__(self, other):
|
||||
return id(self) == id(other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
|
||||
def __str__(self):
|
||||
return 'Irc object for server %s' % self.server
|
||||
|
||||
|
@ -543,6 +543,13 @@ def whois(nick, mask='', prefix=''):
|
||||
assert isNick(nick), repr(nick)
|
||||
return IrcMsg(prefix=prefix, command='WHOIS', args=(nick, mask))
|
||||
|
||||
def mode(channel, args=None, prefix=''):
|
||||
if args is None:
|
||||
args = ()
|
||||
else:
|
||||
args = tuple(args)
|
||||
return IrcMsg(prefix=prefix, command='MODE', args=(channel,)+args)
|
||||
|
||||
def invite(nick, channel, prefix=''):
|
||||
"""Returns an INVITE for nick."""
|
||||
assert isNick(nick), repr(nick)
|
||||
|
Loading…
Reference in New Issue
Block a user