add an INFORMATION event from connection to gui

This commit is contained in:
Yann Leboulanger 2005-06-24 16:46:45 +00:00
parent 0342329e0f
commit c19e0f0bd4
2 changed files with 16 additions and 11 deletions

View File

@ -111,14 +111,14 @@ class Connection:
"""Connection class"""
def __init__(self, name):
# dict of function to be called for each event
self.handlers = {'ROSTER': [], 'WARNING': [], 'ERROR': [], 'STATUS': [],
'NOTIFY': [], 'MSG': [], 'MSGERROR': [], 'MSGSENT': [] ,
'SUBSCRIBED': [], 'UNSUBSCRIBED': [], 'SUBSCRIBE': [],
'AGENT_INFO': [], 'REGISTER_AGENT_INFO': [], 'AGENT_INFO_ITEMS': [],
'AGENT_INFO_INFO': [], 'QUIT': [], 'ACC_OK': [], 'MYVCARD': [],
'OS_INFO': [], 'VCARD': [], 'GC_MSG': [], 'GC_SUBJECT': [],
'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 'ROSTER_INFO': [],
'ERROR_ANSWER': [], 'BOOKMARKS': [],}
self.handlers = {'ROSTER': [], 'WARNING': [], 'ERROR': [],
'INFORMATION': [], 'STATUS': [], 'NOTIFY': [], 'MSG': [],
'MSGERROR': [], 'MSGSENT': [] , 'SUBSCRIBED': [], 'UNSUBSCRIBED': [],
'SUBSCRIBE': [], 'AGENT_INFO': [], 'REGISTER_AGENT_INFO': [],
'AGENT_INFO_ITEMS': [], 'AGENT_INFO_INFO': [], 'QUIT': [],
'ACC_OK': [], 'MYVCARD': [], 'OS_INFO': [], 'VCARD': [], 'GC_MSG': [],
'GC_SUBJECT': [], 'GC_CONFIG': [], 'BAD_PASSPHRASE': [],
'ROSTER_INFO': [], 'ERROR_ANSWER': [], 'BOOKMARKS': [],}
self.name = name
self.connected = 0 # offline
self.connection = None # xmpppy instance

View File

@ -173,15 +173,19 @@ class Interface:
#('ROSTER', account, array)
self.roster.mklists(data, account)
self.roster.draw_roster()
def handle_event_warning(self, unused, data):
#('WARNING', account, (title_text, section_text))
dialogs.WarningDialog(data[0], data[1]).get_response()
def handle_event_error(self, unused, data):
#('ERROR', account, (title_text, section_text))
dialogs.ErrorDialog(data[0], data[1]).get_response()
def handle_event_information(self, unused, data):
#('INFORMATION', account, (title_text, section_text))
dialogs.InformationDialog(data[0], data[1]).get_response()
def handle_event_error_answer(self, account, array):
#('ERROR_ANSWER', account, (jid_from. errmsg, errcode))
jid_from = array[0]
@ -722,6 +726,7 @@ class Interface:
conn.register_handler('ROSTER', self.handle_event_roster)
conn.register_handler('WARNING', self.handle_event_warning)
conn.register_handler('ERROR', self.handle_event_error)
conn.register_handler('INFORMATION', self.handle_event_information)
conn.register_handler('ERROR_ANSWER', self.handle_event_error_answer)
conn.register_handler('STATUS', self.handle_event_status)
conn.register_handler('NOTIFY', self.handle_event_notify)