don't show more than one error dialog for a given groupchat. Fixes #5753
This commit is contained in:
parent
469d496dcb
commit
493dbce89d
4 changed files with 51 additions and 24 deletions
|
@ -1784,33 +1784,39 @@ ConnectionCaps, ConnectionHandlersBase, ConnectionJingle):
|
|||
elif (errcode == '503'):
|
||||
if gc_control is None or gc_control.autorejoin is None:
|
||||
# maximum user number reached
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('Maximum number of users for %s has been reached') % \
|
||||
room_jid))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('Maximum number of users for %s has been '
|
||||
'reached') % room_jid))
|
||||
elif (errcode == '401') or (errcon == 'not-authorized'):
|
||||
# password required to join
|
||||
self.dispatch('GC_PASSWORD_REQUIRED', (room_jid, nick))
|
||||
elif (errcode == '403') or (errcon == 'forbidden'):
|
||||
# we are banned
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('You are banned from group chat %s.') % room_jid))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('You are banned from group chat %s.') % room_jid))
|
||||
elif (errcode == '404') or (errcon in ('item-not-found',
|
||||
'remote-server-not-found')):
|
||||
if gc_control is None or gc_control.autorejoin is None:
|
||||
# group chat does not exist
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('Group chat %s does not exist.') % room_jid))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('Group chat %s does not exist.') % room_jid))
|
||||
elif (errcode == '405') or (errcon == 'not-allowed'):
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('Group chat creation is restricted.')))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('Group chat creation is restricted.')))
|
||||
elif (errcode == '406') or (errcon == 'not-acceptable'):
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('Your registered nickname must be used in group chat %s.') \
|
||||
% room_jid))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('Your registered nickname must be used in group chat '
|
||||
'%s.') % room_jid))
|
||||
elif (errcode == '407') or (errcon == 'registration-required'):
|
||||
self.dispatch('ERROR', (_('Unable to join group chat'),
|
||||
_('You are not in the members list in groupchat %s.') % \
|
||||
room_jid))
|
||||
self.dispatch('GC_ERROR', (gc_control,
|
||||
_('Unable to join group chat'),
|
||||
_('You are not in the members list in groupchat %s.') %\
|
||||
room_jid))
|
||||
elif (errcode == '409') or (errcon == 'conflict'):
|
||||
# nick conflict
|
||||
room_jid = gajim.get_room_from_fjid(who)
|
||||
|
|
|
@ -1242,8 +1242,9 @@ class AboutDialog:
|
|||
|
||||
class Dialog(gtk.Dialog):
|
||||
def __init__(self, parent, title, buttons, default=None,
|
||||
on_response_ok=None, on_response_cancel=None):
|
||||
gtk.Dialog.__init__(self, title, parent, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR)
|
||||
on_response_ok=None, on_response_cancel=None):
|
||||
gtk.Dialog.__init__(self, title, parent,
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR)
|
||||
|
||||
self.user_response_ok = on_response_ok
|
||||
self.user_response_cancel = on_response_cancel
|
||||
|
@ -1480,8 +1481,8 @@ class InformationDialog(HigDialog):
|
|||
"""
|
||||
|
||||
def __init__(self, pritext, sectext=''):
|
||||
HigDialog.__init__(self, None,
|
||||
gtk.MESSAGE_INFO, gtk.BUTTONS_OK, pritext, sectext)
|
||||
HigDialog.__init__(self, None, gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
|
||||
pritext, sectext)
|
||||
self.set_modal(False)
|
||||
self.set_transient_for(gajim.interface.roster.window)
|
||||
self.popup()
|
||||
|
@ -1491,9 +1492,11 @@ class ErrorDialog(HigDialog):
|
|||
HIG compliant error dialog
|
||||
"""
|
||||
|
||||
def __init__(self, pritext, sectext=''):
|
||||
HigDialog.__init__( self, None,
|
||||
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, pritext, sectext)
|
||||
def __init__(self, pritext, sectext='', on_response_ok=None,
|
||||
on_response_cancel=None):
|
||||
HigDialog.__init__( self, None, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
|
||||
pritext, sectext, on_response_ok=on_response_ok,
|
||||
on_response_cancel=on_response_cancel)
|
||||
self.popup()
|
||||
|
||||
class YesNoDialog(HigDialog):
|
||||
|
|
|
@ -216,6 +216,9 @@ class GroupchatControl(ChatControlBase):
|
|||
# state in got_connected()).
|
||||
self.autorejoin = None
|
||||
|
||||
# Keep error dialog instance to be sure to have only once at a time
|
||||
self.error_dialog = None
|
||||
|
||||
self.actions_button = self.xml.get_object('muc_window_actions_button')
|
||||
id_ = self.actions_button.connect('clicked',
|
||||
self.on_actions_button_clicked)
|
||||
|
@ -1263,8 +1266,8 @@ class GroupchatControl(ChatControlBase):
|
|||
'%(reason)s') % { 'nick': nick, 'who': actor,
|
||||
'reason': reason }
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
if nick == self.nick:
|
||||
self.autorejoin = False
|
||||
# if nick == self.nick:
|
||||
# self.autorejoin = False
|
||||
elif '303' in statusCode: # Someone changed his or her nick
|
||||
if new_nick == self.new_nick or nick == self.nick:
|
||||
# We changed our nick
|
||||
|
|
|
@ -1151,6 +1151,20 @@ class Interface:
|
|||
notify.popup(event_type, jid, account, 'gc-invitation', path,
|
||||
event_type, room_jid)
|
||||
|
||||
def handle_event_gc_error(self, account, data):
|
||||
#('ERROR', account, (gc_control, title_text, section_text))
|
||||
gc_control, pritext, sectext = data
|
||||
if gc_control:
|
||||
if gc_control.error_dialog:
|
||||
gc_control.error_dialog.destroy()
|
||||
def on_close(dummy):
|
||||
gc_control.error_dialog.destroy()
|
||||
gc_control.error_dialog = None
|
||||
gc_control.error_dialog = dialogs.ErrorDialog(pritext, sectext,
|
||||
on_response_ok=on_close, on_response_cancel=on_close)
|
||||
else:
|
||||
dialogs.ErrorDialog(pritext, sectext)
|
||||
|
||||
def forget_gpg_passphrase(self, keyid):
|
||||
if keyid in self.gpg_passphrase:
|
||||
del self.gpg_passphrase[keyid]
|
||||
|
@ -2126,6 +2140,7 @@ class Interface:
|
|||
'GC_INVITATION': [self.handle_event_gc_invitation],
|
||||
'GC_AFFILIATION': [self.handle_event_gc_affiliation],
|
||||
'GC_PASSWORD_REQUIRED': [self.handle_event_gc_password_required],
|
||||
'GC_ERROR': [self.handle_event_gc_error],
|
||||
'BAD_PASSPHRASE': [self.handle_event_bad_passphrase],
|
||||
'ROSTER_INFO': [self.handle_event_roster_info],
|
||||
'BOOKMARKS': [self.handle_event_bookmarks],
|
||||
|
|
Loading…
Add table
Reference in a new issue