print all errors in gc

This commit is contained in:
Yann Leboulanger 2005-05-10 16:53:28 +00:00
parent 4237e17f54
commit 87f19fb638
2 changed files with 17 additions and 1 deletions

View File

@ -109,7 +109,8 @@ class Connection:
'AGENT_INFO': [], 'REGISTER_AGENT_INFO': [], 'AGENT_INFO_ITEMS': [], 'AGENT_INFO': [], 'REGISTER_AGENT_INFO': [], 'AGENT_INFO_ITEMS': [],
'AGENT_INFO_INFO': [], 'QUIT': [], 'ACC_OK': [], 'MYVCARD': [], 'AGENT_INFO_INFO': [], 'QUIT': [], 'ACC_OK': [], 'MYVCARD': [],
'OS_INFO': [], 'VCARD': [], 'GC_MSG': [], 'GC_SUBJECT': [], 'OS_INFO': [], 'VCARD': [], 'GC_MSG': [], 'GC_SUBJECT': [],
'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 'ROSTER_INFO': []} 'GC_CONFIG': [], 'BAD_PASSPHRASE': [], 'ROSTER_INFO': [],
'ERROR_ANSWER': []}
self.name = name self.name = name
self.connected = 0 # offline self.connected = 0 # offline
self.connection = None # xmpppy instance self.connection = None # xmpppy instance
@ -500,6 +501,12 @@ class Connection:
del roster[name + '@' + hostname] del roster[name + '@' + hostname]
self.dispatch('ROSTER', roster) self.dispatch('ROSTER', roster)
def _ErrorCB(self, con, iq_obj):
errmsg = iq_obj.getError()
errcode = iq_obj.getErrorCode()
jid_from = str(iq_obj.getFrom())
self.dispatch('ERROR_ANSWER', (jid_from, errmsg, errcode))
def connect(self): def connect(self):
"""Connect and authentificate to the Jabber server""" """Connect and authentificate to the Jabber server"""
name = gajim.config.get_per('accounts', self.name, 'name') name = gajim.config.get_per('accounts', self.name, 'name')
@ -561,6 +568,7 @@ class Connection:
common.xmpp.NS_MUC_OWNER) common.xmpp.NS_MUC_OWNER)
con.RegisterHandler('iq', self._getRosterCB, 'result',\ con.RegisterHandler('iq', self._getRosterCB, 'result',\
common.xmpp.NS_ROSTER) common.xmpp.NS_ROSTER)
con.RegisterHandler('iq', self._ErrorCB, 'error')
gajim.log.debug('Connected to server') gajim.log.debug('Connected to server')

View File

@ -147,6 +147,13 @@ class Interface:
def handle_event_error(self, unused, msg): def handle_event_error(self, unused, msg):
dialogs.Error_dialog(msg) dialogs.Error_dialog(msg)
def handle_event_error_answer(self, account, array):
#('ERROR_ANSWER', account, (jid_from. errmsg, errcode))
jid_from = array[0]
if jid_from in self.windows[account]['gc']:
self.windows[account]['gc'][jid_from].print_conversation(
'Error %s: %s' % (array[2], array[1]), jid_from)
def handle_event_status(self, account, status): # OUR status def handle_event_status(self, account, status): # OUR status
#('STATUS', account, status) #('STATUS', account, status)
self.roster.on_status_changed(account, status) self.roster.on_status_changed(account, status)
@ -602,6 +609,7 @@ class Interface:
conn.register_handler('ROSTER', self.handle_event_roster) conn.register_handler('ROSTER', self.handle_event_roster)
conn.register_handler('WARNING', self.handle_event_warning) conn.register_handler('WARNING', self.handle_event_warning)
conn.register_handler('ERROR', self.handle_event_error) conn.register_handler('ERROR', self.handle_event_error)
conn.register_handler('ERROR_ANSWER', self.handle_event_error_answer)
conn.register_handler('STATUS', self.handle_event_status) conn.register_handler('STATUS', self.handle_event_status)
conn.register_handler('NOTIFY', self.handle_event_notify) conn.register_handler('NOTIFY', self.handle_event_notify)
conn.register_handler('MSG', self.handle_event_msg) conn.register_handler('MSG', self.handle_event_msg)