show correctly error message and log them in DB. fixes #1802

This commit is contained in:
Yann Leboulanger 2006-04-10 14:00:04 +00:00
parent 87bb1c5551
commit eb8cc5b7ea
3 changed files with 19 additions and 7 deletions

View File

@ -1260,8 +1260,15 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
msgtxt = decmsg
encrypted = True
if mtype == 'error':
self.dispatch('MSGERROR', (frm, msg.getErrorCode(), msg.getError(),
msgtxt, tim))
error_msg = msg.getError()
if not error_msg:
error_msg = msgtxt
msgtxt = None
if self.name not in no_log_for:
gajim.logger.write('error', frm, error_msg, tim = tim,
subject = subject)
self.dispatch('MSGERROR', (frm, msg.getErrorCode(), error_msg, msgtxt,
tim))
elif mtype == 'groupchat':
if subject:
self.dispatch('GC_SUBJECT', (frm, subject, msgtxt))

View File

@ -66,8 +66,9 @@ class Constants:
self.KIND_SINGLE_MSG_RECV,
self.KIND_CHAT_MSG_RECV,
self.KIND_SINGLE_MSG_SENT,
self.KIND_CHAT_MSG_SENT
) = range(7)
self.KIND_CHAT_MSG_SENT,
self.KIND_ERROR
) = range(8)
(
self.SHOW_ONLINE,
@ -170,6 +171,8 @@ class Logger:
kind_col = constants.KIND_CHAT_MSG_RECV
elif kind == 'chat_msg_sent':
kind_col = constants.KIND_CHAT_MSG_SENT
elif kind == 'error':
kind_col = constants.KIND_ERROR
if show == 'online':
show_col = constants.SHOW_ONLINE

View File

@ -648,7 +648,7 @@ class Interface:
ctrl.print_conversation('Error %s: %s' % (array[1], array[2]),
'status')
return
gc_control.print_conversation('Error %s: %s' % (array[1], array[2]))
if gc_control.parent_win.get_active_jid() == jid:
gc_control.set_subject(gc_control.subject)
@ -656,8 +656,10 @@ class Interface:
if gajim.jid_is_transport(jid):
jid = jid.replace('@', '')
self.roster.on_message(jid, _('error while sending') + \
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account, \
msg = array[2]
if array[3]:
msg = _('error while sending %s ( %s )') % (array[3], msg)
self.roster.on_message(jid, msg, array[4], account, \
msg_type='error')
def handle_event_msgsent(self, account, array):