Mercurial > xib
comparison participant.py @ 4:012593ed4e12
Prevent bot from trying to connect on IRC with a nickname containing one or more white space character(s)
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 16 Aug 2009 17:42:56 +0200 |
parents | 3f651f4fdb4f |
children | cb0daec4b778 |
comparison
equal
deleted
inserted
replaced
3:3f651f4fdb4f | 4:012593ed4e12 |
---|---|
56 self.muc.join(self.xmpp_c, self.nickname, status='From IRC', callback=self._xmpp_join_callback) | 56 self.muc.join(self.xmpp_c, self.nickname, status='From IRC', callback=self._xmpp_join_callback) |
57 | 57 |
58 | 58 |
59 def createDuplicateOnIRC(self): | 59 def createDuplicateOnIRC(self): |
60 if self.irc_connection != None or self.xmpp_c != None or self.protocol == 'both' or self.bridge.mode != 'normal': | 60 if self.irc_connection != None or self.xmpp_c != None or self.protocol == 'both' or self.bridge.mode != 'normal': |
61 return | |
62 if ' ' in self.nickname: | |
63 self.bridge.bot.error('===> Debug: "'+self.nickname+'" contains a white space character, duplicate cannot be created on the IRC chan of bridge "'+str(self.bridge)+'"', debug=True) | |
64 self.bridge.say('[Warning] The nickname "'+self.nickname+'" contains a white space character, duplicate cannot be created on IRC, please avoid that if possible') | |
65 if self.irc_connection: | |
66 self.irc_connection.close() | |
67 self.irc_connection = None | |
61 return | 68 return |
62 sleep(1) # try to prevent "reconnecting too fast" shit | 69 sleep(1) # try to prevent "reconnecting too fast" shit |
63 self.irc_connection = self.bridge.bot.irc.server() | 70 self.irc_connection = self.bridge.bot.irc.server() |
64 self.irc_connection.bridge = self.bridge | 71 self.irc_connection.bridge = self.bridge |
65 self.irc_connection.nick_callback = self._irc_nick_callback | 72 self.irc_connection.nick_callback = self._irc_nick_callback |