mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Let's respect the server's nicklen and maxchannels parameters.
This commit is contained in:
parent
29a6c92b76
commit
c2a61b2f06
@ -39,6 +39,7 @@ __author__ = 'Jeremy Fincher (jemfinch) <jemfinch@users.sf.net>'
|
|||||||
|
|
||||||
import supybot.fix as fix
|
import supybot.fix as fix
|
||||||
|
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import pprint
|
import pprint
|
||||||
from itertools import imap
|
from itertools import imap
|
||||||
@ -157,6 +158,10 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.error('%r is not a valid channel.' % channel)
|
irc.error('%r is not a valid channel.' % channel)
|
||||||
return
|
return
|
||||||
conf.supybot.channels().add(original)
|
conf.supybot.channels().add(original)
|
||||||
|
maxchannels = irc.state.supported.get('maxchannels', sys.maxint)
|
||||||
|
if len(irc.state.channels) + len(channels) > maxchannels:
|
||||||
|
irc.error('I\'m already too close to maximum number of '
|
||||||
|
'channels for this network.')
|
||||||
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)
|
||||||
@ -222,6 +227,10 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
nick = privmsgs.getArgs(args, required=0, optional=1)
|
nick = privmsgs.getArgs(args, required=0, optional=1)
|
||||||
if nick:
|
if nick:
|
||||||
if ircutils.isNick(nick):
|
if ircutils.isNick(nick):
|
||||||
|
if 'nicklen' in irc.state.supported:
|
||||||
|
if len(nick) > irc.state.supported['nicklen']:
|
||||||
|
irc.error('That nick is too long for this server.')
|
||||||
|
return
|
||||||
conf.supybot.nick.setValue(nick)
|
conf.supybot.nick.setValue(nick)
|
||||||
irc.queueMsg(ircmsgs.nick(nick))
|
irc.queueMsg(ircmsgs.nick(nick))
|
||||||
self.pendingNickChanges[irc.getRealIrc()] = irc
|
self.pendingNickChanges[irc.getRealIrc()] = irc
|
||||||
|
Loading…
Reference in New Issue
Block a user