Mercurial > xib
changeset 30:c0fb916cb0a0
Fixed IRC leaving events handling.
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Fri, 21 Aug 2009 17:03:20 +0200 |
parents | a694ffe6a973 |
children | 5afa22125334 |
files | bot.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/bot.py +++ b/bot.py @@ -317,9 +317,16 @@ class bot(Thread): # Leaving events - if event.eventtype() == 'quit' or event.eventtype() == 'part' and event.target() == bridge.irc_room: - if from_.protocol == 'irc': - bridge.removeParticipant('irc', from_.nickname, event.arguments()[0]) + if connection.server == bridge.irc_server and (event.eventtype() == 'quit' or event.eventtype() == 'part' and event.target() == bridge.irc_room): + if len(event.arguments()) > 0: + leave_message = event.arguments()[0] + elif event.eventtype() == 'quit': + leave_message = 'Left server.' + elif event.eventtype() == 'part': + leave_message = 'Left channel.' + else: + leave_message = '' + bridge.removeParticipant('irc', from_.nickname, leave_message) continue