Groupchat shutdown with per room ignore options, see:
http://www.jabber.no/gajim@conference.jabber.no/2006/1/7.html
This commit is contained in:
parent
f52afdcbe8
commit
f66c5c5b95
2 changed files with 27 additions and 31 deletions
|
@ -137,6 +137,7 @@ class Config:
|
||||||
'autodetect_browser_mailer': [opt_bool, True],
|
'autodetect_browser_mailer': [opt_bool, True],
|
||||||
'print_ichat_every_foo_minutes': [opt_int, 5],
|
'print_ichat_every_foo_minutes': [opt_int, 5],
|
||||||
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
|
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
|
||||||
|
'noconfirm_close_muc_rooms': [opt_str, '', _('A list of rooms that do not require confirmation before closing')],
|
||||||
'notify_on_file_complete': [opt_bool, True], # notif. on file complete
|
'notify_on_file_complete': [opt_bool, True], # notif. on file complete
|
||||||
'file_transfers_port': [opt_int, 28011], # port, used for file transfers
|
'file_transfers_port': [opt_int, 28011], # port, used for file transfers
|
||||||
'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')],
|
'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')],
|
||||||
|
|
|
@ -123,7 +123,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
# connect the menuitems to their respective functions
|
# connect the menuitems to their respective functions
|
||||||
xm = gtk.glade.XML(GTKGUI_GLADE, 'gc_control_popup_menu', APP)
|
xm = gtk.glade.XML(GTKGUI_GLADE, 'gc_control_popup_menu', APP)
|
||||||
xm.signal_autoconnect(self)
|
xm.signal_autoconnect(self)
|
||||||
self.gc_popup_menu = xm.get_widget('gc_popup_menu')
|
self.gc_popup_menu = xm.get_widget('gc_control_popup_menu')
|
||||||
|
|
||||||
self.name_label = self.xml.get_widget('banner_name_label')
|
self.name_label = self.xml.get_widget('banner_name_label')
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
iter = self.add_contact_to_roster(nick, show, role,
|
iter = self.add_contact_to_roster(nick, show, role,
|
||||||
affiliation, status, jid)
|
affiliation, status, jid)
|
||||||
if statusCode == '201': # We just created the room
|
if statusCode == '201': # We just created the room
|
||||||
gajim.connections[self.account].request_gc_config(room_jid)
|
gajim.connections[self.account].request_gc_config(self.room_jid)
|
||||||
else:
|
else:
|
||||||
actual_role = self.get_role(nick)
|
actual_role = self.get_role(nick)
|
||||||
if role != actual_role:
|
if role != actual_role:
|
||||||
|
@ -879,7 +879,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
reason = 'offline'
|
reason = 'offline'
|
||||||
if len(message_array):
|
if len(message_array):
|
||||||
reason = message_array.pop(0)
|
reason = message_array.pop(0)
|
||||||
self.remove_tab(reason)
|
gajim.connections[self.account].send_gc_status(self.nick, self.room_jid,
|
||||||
|
show='offline', status=reason)
|
||||||
|
self.parent_win.remove_tab(self.contact)
|
||||||
return True
|
return True
|
||||||
elif command == 'ban':
|
elif command == 'ban':
|
||||||
if len(message_array):
|
if len(message_array):
|
||||||
|
@ -1022,42 +1024,35 @@ class GroupchatControl(ChatControlBase):
|
||||||
gajim.connections[self.account].change_gc_nick(self.room_jid, nick)
|
gajim.connections[self.account].change_gc_nick(self.room_jid, nick)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
gajim.connections[self.account].send_gc_status(self.nick, self.room_jid,
|
|
||||||
show='offline', status=reason)
|
|
||||||
# They can already be removed by the destroy function
|
# They can already be removed by the destroy function
|
||||||
if self.room_jid in gajim.contacts.get_gc_list(self.account):
|
if self.room_jid in gajim.contacts.get_gc_list(self.account):
|
||||||
gajim.contacts.remove_room(self.account, self.room_jid)
|
gajim.contacts.remove_room(self.account, self.room_jid)
|
||||||
del gajim.gc_connected[self.account][self.room_jid]
|
del gajim.gc_connected[self.account][self.room_jid]
|
||||||
|
|
||||||
def allow_shutdown(self):
|
def allow_shutdown(self):
|
||||||
# FIXME:
|
retval = True
|
||||||
# whether to ask for comfirmation before closing muc
|
# whether to ask for comfirmation before closing muc
|
||||||
if gajim.config.get('confirm_close_muc'):
|
if not gajim.config.get('confirm_close_muc'):
|
||||||
names = []
|
gajim.config.set('noconfirm_close_muc_rooms', '')
|
||||||
if not room_jid:
|
|
||||||
for r_jid in self.xmls:
|
|
||||||
if gajim.gc_connected[self.account][r_jid]:
|
|
||||||
names.append(gajim.get_nick_from_jid(r_jid))
|
|
||||||
else:
|
else:
|
||||||
names = [room_jid]
|
excludes = gajim.config.get('noconfirm_close_muc_rooms')
|
||||||
|
excludes = excludes.split(' ')
|
||||||
|
if self.room_jid not in excludes:
|
||||||
|
pritext = _('Are you sure you want to leave room "%s"?') % self.name
|
||||||
|
sectext = _('If you close this window, you will be disconnected '
|
||||||
|
'from this room.')
|
||||||
|
|
||||||
rooms_no = len(names)
|
|
||||||
if rooms_no >= 2: # if we are in many rooms
|
|
||||||
pritext = _('Are you sure you want to leave rooms "%s"?') % ', '.join(names)
|
|
||||||
sectext = _('If you close this window, you will be disconnected from these rooms.')
|
|
||||||
|
|
||||||
elif rooms_no == 1: # just in one room
|
|
||||||
pritext = _('Are you sure you want to leave room "%s"?') % names[0]
|
|
||||||
sectext = _('If you close this window, you will be disconnected from this room.')
|
|
||||||
|
|
||||||
if rooms_no > 0:
|
|
||||||
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
dialog = dialogs.ConfirmationDialogCheck(pritext, sectext,
|
||||||
_('Do _not ask me again'))
|
_('Do _not ask me about closing "%s" again' %\
|
||||||
|
self.name))
|
||||||
if dialog.is_checked():
|
|
||||||
gajim.config.set('confirm_close_muc', False)
|
|
||||||
dialog.destroy()
|
|
||||||
|
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
return False
|
retval = False
|
||||||
return True
|
|
||||||
|
if dialog.is_checked():
|
||||||
|
excludes = gajim.config.get('noconfirm_close_muc_rooms')
|
||||||
|
excludes += ' %s' % self.room_jid
|
||||||
|
gajim.config.set('noconfirm_close_muc_rooms', excludes)
|
||||||
|
dialog.destroy()
|
||||||
|
|
||||||
|
return retval
|
||||||
|
|
Loading…
Add table
Reference in a new issue