mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +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))
|
irc.queueMsg(ircmsgs.joins(channels, keys))
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
self.joins[channel] = (irc, msg)
|
self.joins[channel] = (irc, msg)
|
||||||
if channel not in irc.state.channels:
|
|
||||||
irc.queueMsg(ircmsgs.who(channel))
|
|
||||||
|
|
||||||
def channels(self, irc, msg, args):
|
def channels(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
@ -349,10 +349,26 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
chan.voices.discard(value)
|
chan.voices.discard(value)
|
||||||
elif mode == '+v':
|
elif mode == '+v':
|
||||||
chan.voices.add(value)
|
chan.voices.add(value)
|
||||||
elif mode == '+i':
|
elif mode[-1] in 'beq':
|
||||||
chan.setMode('i')
|
pass # We don't need this right now.
|
||||||
elif mode == '-i':
|
else:
|
||||||
chan.unsetMode('i')
|
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):
|
def do353(self, irc, msg):
|
||||||
(_, _, channel, users) = msg.args
|
(_, _, channel, users) = msg.args
|
||||||
@ -577,6 +593,12 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.sendMsg(ircmsgs.nick(newNick))
|
self.sendMsg(ircmsgs.nick(newNick))
|
||||||
do432 = do433
|
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):
|
def doError(self, msg):
|
||||||
"""Handles ERROR messages."""
|
"""Handles ERROR messages."""
|
||||||
log.info('Error message from %s: %s', self.server, msg.args[0])
|
log.info('Error message from %s: %s', self.server, msg.args[0])
|
||||||
@ -677,6 +699,9 @@ class Irc(IrcCommandDispatcher):
|
|||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return id(self) == id(other)
|
return id(self) == id(other)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not (self == other)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Irc object for server %s' % self.server
|
return 'Irc object for server %s' % self.server
|
||||||
|
|
||||||
|
@ -543,6 +543,13 @@ def whois(nick, mask='', prefix=''):
|
|||||||
assert isNick(nick), repr(nick)
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command='WHOIS', args=(nick, mask))
|
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=''):
|
def invite(nick, channel, prefix=''):
|
||||||
"""Returns an INVITE for nick."""
|
"""Returns an INVITE for nick."""
|
||||||
assert isNick(nick), repr(nick)
|
assert isNick(nick), repr(nick)
|
||||||
|
Loading…
Reference in New Issue
Block a user