comparison participant.py @ 259:3b318108e9e0

(muc) created "state" attribute to replace the "connected" one Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Thu, 11 Mar 2010 14:15:31 +0100
parents 3b930e2fad43
children 9a2302e8382b
comparison
equal deleted inserted replaced
258:3b4826e14642 259:3b318108e9e0
319 else: 319 else:
320 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.') 320 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.')
321 321
322 322
323 def say_on_xmpp(self, message, action=False): 323 def say_on_xmpp(self, message, action=False):
324 if isinstance(self.muc, xmpp.muc) and self.muc.connected: 324 if isinstance(self.muc, xmpp.muc) and self.muc.state == self.muc.JOINED:
325 self.muc.say(message, action=action) 325 self.muc.say(message, action=action)
326 elif not isinstance(self.irc_connection, ServerConnection): 326 elif not isinstance(self.irc_connection, ServerConnection):
327 self.bridge.say_on_behalf(self.nickname, message, 'xmpp', action=action) 327 self.bridge.say_on_behalf(self.nickname, message, 'xmpp', action=action)
328 328
329 329
330 def say_on_xmpp_to(self, to, message, action=False): 330 def say_on_xmpp_to(self, to, message, action=False):
331 if isinstance(self.muc, xmpp.muc) and self.muc.connected: 331 if isinstance(self.muc, xmpp.muc) and self.muc.state == self.muc.JOINED:
332 self.muc.say_to(to, message, action=action) 332 self.muc.say_to(to, message, action=action)
333 elif not isinstance(self.irc_connection, ServerConnection): 333 elif not isinstance(self.irc_connection, ServerConnection):
334 if self.bridge.mode not in ['normal', 'bypass']: 334 if self.bridge.mode not in ['normal', 'bypass']:
335 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') 335 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.')
336 else: 336 else:
365 def __str__(self): 365 def __str__(self):
366 r = 'self.protocol='+str(self.protocol)+'\n'+'self.nickname='+str(self.nickname) 366 r = 'self.protocol='+str(self.protocol)+'\n'+'self.nickname='+str(self.nickname)
367 if isinstance(self.irc_connection, ServerConnection): 367 if isinstance(self.irc_connection, ServerConnection):
368 r += '\nself.irc_connection='+str(self.irc_connection)+'\n'+'self.irc_connection.logged_in='+str(self.irc_connection.logged_in) 368 r += '\nself.irc_connection='+str(self.irc_connection)+'\n'+'self.irc_connection.logged_in='+str(self.irc_connection.logged_in)
369 if isinstance(self.muc, xmpp.muc): 369 if isinstance(self.muc, xmpp.muc):
370 r += '\nself.muc.connected='+str(self.muc.connected) 370 r += '\nself.muc.state='+str(self.muc.state)
371 return r 371 return r
372 372
373 373
374 def __del__(self): 374 def __del__(self):
375 self.leave('') 375 self.leave('')