handle error message from MUC correctly. Fixes #9280

This commit is contained in:
Yann Leboulanger 2018-09-23 22:45:05 +02:00 committed by Philipp Hörist
parent 110f742e8a
commit 3ab7f92856
2 changed files with 15 additions and 6 deletions

View File

@ -82,7 +82,7 @@ class Message:
return return
muc_user = stanza.getTag('x', namespace=nbxmpp.NS_MUC_USER) muc_user = stanza.getTag('x', namespace=nbxmpp.NS_MUC_USER)
if muc_user is not None: if muc_user is not None and (stanza.getType() != 'error'):
if muc_user.getChildren(): if muc_user.getChildren():
# Not a PM, handled by MUC module # Not a PM, handled by MUC module
return return
@ -155,8 +155,11 @@ class Message:
if gc_control and jid == fjid: if gc_control and jid == fjid:
if type_ == 'error': if type_ == 'error':
msgtxt = _('error while sending %(message)s ( %(error)s )') % { if msgtxt:
'message': msgtxt, 'error': stanza.getErrorMsg()} msgtxt = _('error while sending %(message)s ( %(error)s )') % {
'message': msgtxt, 'error': stanza.getErrorMsg()}
else:
msgtxt = _('error: %s') % stanza.getErrorMsg()
# TODO: why is this here? # TODO: why is this here?
if stanza.getTag('html'): if stanza.getTag('html'):
stanza.delChild('html') stanza.delChild('html')
@ -245,9 +248,12 @@ class Message:
if event.mtype == 'error': if event.mtype == 'error':
if not event.msgtxt: if not event.msgtxt:
event.msgtxt = _('message') event.msgtxt = _('message')
self._con.dispatch_error_message( if event.gc_control:
event.stanza, event.msgtxt, event.gc_control.print_conversation(event.msgtxt)
event.session, event.fjid, timestamp) else:
self._con.dispatch_error_message(
event.stanza, event.msgtxt,
event.session, event.fjid, timestamp)
return return
if event.mtype == 'groupchat': if event.mtype == 'groupchat':

View File

@ -253,6 +253,9 @@ class MUC:
if muc_user is None: if muc_user is None:
return return
if stanza.getType() == 'error':
return
decline = muc_user.getTag('decline') decline = muc_user.getTag('decline')
if decline is not None: if decline is not None: