def _add_bookmark(self, jid, autojoin, password, method): nick = None if not jid: tab = self.core.tabs.current_tab roomname = tab.name if tab.joined and tab.own_nick != self.core.own_nick: nick = tab.own_nick if password is None and tab.password is not None: password = tab.password elif jid == '*': return self._add_wildcard_bookmarks(method) else: info = safeJID(jid) roomname, nick = info.bare, info.resource if roomname == '': tab = self.core.tabs.current_tab if not isinstance(tab, tabs.MucTab): return roomname = tab.name bookmark = self.core.bookmarks[roomname] if bookmark is None: bookmark = Bookmark(roomname) self.core.bookmarks.append(bookmark) bookmark.method = method bookmark.autojoin = autojoin if nick: bookmark.nick = nick if password: bookmark.password = password self.core.bookmarks.save_local() self.core.bookmarks.save_remote(self.core.xmpp, self.core.handler.on_bookmark_result)
def _add_bookmark(self, jid, autojoin, password, method): nick = None if not jid: tab = self.core.tabs.current_tab roomname = tab.jid.bare if tab.joined and tab.own_nick != self.core.own_nick: nick = tab.own_nick if password is None and tab.password is not None: password = tab.password elif jid == '*': return self._add_wildcard_bookmarks(method) else: info = safeJID(jid) roomname, nick = info.bare, info.resource if roomname == '': tab = self.core.tabs.current_tab if not isinstance(tab, tabs.MucTab): return roomname = tab.jid.bare bookmark = self.core.bookmarks[roomname] if bookmark is None: bookmark = Bookmark(roomname) self.core.bookmarks.append(bookmark) bookmark.method = method bookmark.autojoin = autojoin if nick: bookmark.nick = nick if password: bookmark.password = password self.core.bookmarks.save_local() self.core.bookmarks.save_remote(self.core.xmpp, self.core.handler.on_bookmark_result)
def _add_bookmark(self, jid, autojoin, password, method): nick = None if not jid: tab = self.core.current_tab() roomname = tab.name if tab.joined and tab.own_nick != self.core.own_nick: nick = tab.own_nick if password is None and tab.password is not None: password = tab.password elif jid == '*': return self._add_wildcard_bookmarks(method) else: info = safeJID(jid) roomname, nick = info.bare, info.resource if roomname == '': tab = self.core.current_tab() if not isinstance(tab, tabs.MucTab): return roomname = tab.name bookmark = self.core.bookmarks[roomname] if bookmark is None: bookmark = Bookmark(roomname) self.core.bookmarks.append(bookmark) bookmark.method = method bookmark.autojoin = autojoin if nick: bookmark.nick = nick if password: bookmark.password = password def callback(iq): if iq["type"] != "error": self.core.information('Bookmark added.', 'Info') else: self.core.information("Could not add the bookmarks.", "Info") self.core.bookmarks.save_local() self.core.bookmarks.save_remote(self.core.xmpp, callback)
def _add_bookmark(self, jid, autojoin, password, method): nick = None if not jid: tab = self.core.tabs.current_tab roomname = tab.name if tab.joined and tab.own_nick != self.core.own_nick: nick = tab.own_nick if password is None and tab.password is not None: password = tab.password elif jid == '*': return self._add_wildcard_bookmarks(method) else: info = safeJID(jid) roomname, nick = info.bare, info.resource if roomname == '': tab = self.core.tabs.current_tab if not isinstance(tab, tabs.MucTab): return roomname = tab.name bookmark = self.core.bookmarks[roomname] if bookmark is None: bookmark = Bookmark(roomname) self.core.bookmarks.append(bookmark) bookmark.method = method bookmark.autojoin = autojoin if nick: bookmark.nick = nick if password: bookmark.password = password def callback(iq): if iq["type"] != "error": self.core.information('Bookmark added.', 'Info') else: self.core.information("Could not add the bookmarks.", "Info") self.core.bookmarks.save_local() self.core.bookmarks.save_remote(self.core.xmpp, callback)