Fix destroying a MUC
- Only close the tab if we initiated the destruction
This commit is contained in:
parent
31d9b39744
commit
4670760668
|
@ -286,6 +286,9 @@ class Bookmarks(AbstractPEPModule):
|
|||
else:
|
||||
self._private_store(storage_node)
|
||||
|
||||
app.nec.push_incoming_event(
|
||||
NetworkEvent('bookmarks-received', account=self._account))
|
||||
|
||||
def _pubsub_store(self, storage_node: nbxmpp.Node) -> None:
|
||||
self._con.get_module('PubSub').send_pb_publish(
|
||||
'', 'storage:bookmarks', storage_node, 'current',
|
||||
|
@ -344,8 +347,12 @@ class Bookmarks(AbstractPEPModule):
|
|||
}
|
||||
|
||||
self.store_bookmarks()
|
||||
app.nec.push_incoming_event(
|
||||
NetworkEvent('bookmarks-received', account=self._account))
|
||||
|
||||
def remove(self, jid: str, publish: bool = True) -> None:
|
||||
if self.bookmarks.pop(jid, None) is None:
|
||||
return
|
||||
if publish:
|
||||
self.store_bookmarks()
|
||||
|
||||
def get_name_from_bookmark(self, jid: str) -> str:
|
||||
fallback = jid.split('@')[0]
|
||||
|
@ -354,6 +361,9 @@ class Bookmarks(AbstractPEPModule):
|
|||
except KeyError:
|
||||
return fallback
|
||||
|
||||
def is_bookmark(self, jid: str) -> bool:
|
||||
return jid in self.bookmarks
|
||||
|
||||
def purge_pubsub_bookmarks(self) -> None:
|
||||
log.info('Purge/Delete Bookmarks on PubSub, '
|
||||
'because publish options are not available')
|
||||
|
|
|
@ -84,7 +84,7 @@ class MUC:
|
|||
'cancel_config',
|
||||
'send_captcha',
|
||||
'decline',
|
||||
'request_voice'
|
||||
'request_voice',
|
||||
'destroy',
|
||||
]
|
||||
|
||||
|
|
|
@ -182,6 +182,9 @@ class GroupchatControl(ChatControlBase):
|
|||
# if True, the room has mentioned us
|
||||
self.attention_flag = False
|
||||
|
||||
# True if we initiated room destruction
|
||||
self._wait_for_destruction = False
|
||||
|
||||
# sorted list of nicks who mentioned us (last at the end)
|
||||
self.attention_list = []
|
||||
self.nick_hits = []
|
||||
|
@ -651,14 +654,10 @@ class GroupchatControl(ChatControlBase):
|
|||
_('Invalid group chat JID'),
|
||||
_('The group chat JID has not allowed characters.'))
|
||||
return
|
||||
|
||||
self._wait_for_destruction = True
|
||||
con = app.connections[self.account]
|
||||
con.get_module('MUC').destroy(self.room_jid, reason, jid)
|
||||
con.get_module('Bookmarks').bookmarks.pop(self.room_jid, None)
|
||||
con.get_module('Bookmarks').store_bookmarks()
|
||||
gui_menu_builder.build_bookmark_menu(self.account)
|
||||
self.force_non_minimizable = True
|
||||
self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND)
|
||||
self.force_non_minimizable = False
|
||||
|
||||
# Ask for a reason
|
||||
DoubleInputDialog(_('Destroying %s') % '\u200E' + \
|
||||
|
@ -2227,6 +2226,14 @@ class GroupchatControl(ChatControlBase):
|
|||
self.autorejoin = False
|
||||
self.got_disconnected()
|
||||
|
||||
con = app.connections[self.account]
|
||||
con.get_module('Bookmarks').remove(self.room_jid)
|
||||
|
||||
if self._wait_for_destruction:
|
||||
self.force_non_minimizable = True
|
||||
self.parent_win.remove_tab(self, self.parent_win.CLOSE_COMMAND)
|
||||
self.force_non_minimizable = False
|
||||
|
||||
def get_role_iter(self, role: str) -> Optional[Gtk.TreeIter]:
|
||||
try:
|
||||
ref = self._role_refs[role]
|
||||
|
|
|
@ -21,8 +21,6 @@ from gajim.common import app
|
|||
from gajim.common import helpers
|
||||
from gajim.common.i18n import _
|
||||
|
||||
from gajim import gui_menu_builder
|
||||
|
||||
from gajim.gtk.dialogs import ErrorDialog
|
||||
from gajim.gtk.util import get_builder
|
||||
|
||||
|
@ -207,7 +205,6 @@ class ManageBookmarksWindow:
|
|||
con.get_module('Bookmarks').bookmarks[jid] = bmdict
|
||||
|
||||
con.get_module('Bookmarks').store_bookmarks()
|
||||
gui_menu_builder.build_bookmark_menu(acct)
|
||||
self.window.destroy()
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
|
|
Loading…
Reference in New Issue