comparison participant.py @ 64:8fc496eaa17b

Handle IRC "nickcollision" event Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 30 Aug 2009 01:18:34 +0200
parents 71508f22edb4
children 75604669fcd9
comparison
equal deleted inserted replaced
63:71508f22edb4 64:8fc496eaa17b
80 else: 80 else:
81 if error == 'nicknameinuse': 81 if error == 'nicknameinuse':
82 self.bridge.bot.error('===> Debug: "'+self.nickname+'" is already used in the IRC chan of bridge "'+str(self.bridge)+'"', debug=True) 82 self.bridge.bot.error('===> Debug: "'+self.nickname+'" is already used in the IRC chan of bridge "'+str(self.bridge)+'"', debug=True)
83 self.bridge.say('[Warning] The nickname "'+self.nickname+'" is used on both rooms or reserved on the IRC server, please avoid that if possible') 83 self.bridge.say('[Warning] The nickname "'+self.nickname+'" is used on both rooms or reserved on the IRC server, please avoid that if possible')
84 if self.irc_connection != None: 84 if self.irc_connection != None:
85 self.irc_connection.close('', volontary=True) 85 self.irc_connection.close('')
86 self.irc_connection = None
87 elif error == 'nickcollision':
88 self.bridge.bot.error('===> Debug: "'+self.nickname+'" is already used or reserved on the IRC server of bridge "'+str(self.bridge)+'"', debug=True)
89 self.bridge.say('[Warning] The nickname "'+self.nickname+'" is already used or reserved on the IRC server, please avoid that if possible')
90 if self.irc_connection != None:
91 self.irc_connection.close('')
86 self.irc_connection = None 92 self.irc_connection = None
87 elif error == 'erroneusnickname': 93 elif error == 'erroneusnickname':
88 self.bridge.bot.error('===> Debug: "'+self.nickname+'" got "erroneusnickname" on bridge "'+str(self.bridge)+'"', debug=True) 94 self.bridge.bot.error('===> Debug: "'+self.nickname+'" got "erroneusnickname" on bridge "'+str(self.bridge)+'"', debug=True)
89 self.bridge.say('[Warning] The nickname "'+self.nickname+'" contains unauthorized characters and cannot be used in the IRC channel, please avoid that if possible') 95 self.bridge.say('[Warning] The nickname "'+self.nickname+'" contains unauthorized characters and cannot be used in the IRC channel, please avoid that if possible')
90 if self.irc_connection != None: 96 if self.irc_connection != None:
91 self.irc_connection.close('', volontary=True) 97 self.irc_connection.close('')
92 self.irc_connection = None 98 self.irc_connection = None
93 elif error == 'nicknametoolong': 99 elif error == 'nicknametoolong':
94 self.bridge.bot.error('===> Debug: "'+self.nickname+'" got "nicknametoolong" on bridge "'+str(self.bridge)+'"', debug=True) 100 self.bridge.bot.error('===> Debug: "'+self.nickname+'" got "nicknametoolong" on bridge "'+str(self.bridge)+'"', debug=True)
95 self.bridge.say('[Warning] The nickname "'+self.nickname+'" is too long (limit seems to be '+str(arguments[0])+') and cannot be used in the IRC channel, please avoid that if possible') 101 self.bridge.say('[Warning] The nickname "'+self.nickname+'" is too long (limit seems to be '+str(arguments[0])+') and cannot be used in the IRC channel, please avoid that if possible')
96 if self.irc_connection != None: 102 if self.irc_connection != None:
97 self.irc_connection.close('', volontary=True) 103 self.irc_connection.close('')
98 self.irc_connection = None 104 self.irc_connection = None
99 105
100 106
101 def changeNickname(self, newnick, on_protocol): 107 def changeNickname(self, newnick, on_protocol):
102 """Change participant's nickname.""" 108 """Change participant's nickname."""
193 self.muc.leave(message) 199 self.muc.leave(message)
194 self.bridge.bot.close_xmpp_connection(self.nickname) 200 self.bridge.bot.close_xmpp_connection(self.nickname)
195 if self.irc_connection != None: 201 if self.irc_connection != None:
196 self.irc_connection.used_by -= 1 202 self.irc_connection.used_by -= 1
197 if self.irc_connection.used_by < 1: 203 if self.irc_connection.used_by < 1:
198 self.irc_connection.close(message, volontary=True) 204 self.irc_connection.close(message)
199 self.irc_connection = None 205 self.irc_connection = None
200 self.nickname = None 206 self.nickname = None
201 207
202 208
203 def __del__(self): 209 def __del__(self):