summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-28 16:28:44 +0100
committermathieui <mathieui@mathieui.net>2011-11-28 16:28:44 +0100
commit0954c12a075da8cb4bc403b475f04a4d84f57dc5 (patch)
tree552da79320b4b7828f0146c3fbe263c49119398b /src/core.py
parent5abf8ab3ae3e2be3fc92d6fb5f2db86aa1e7af94 (diff)
downloadpoezio-0954c12a075da8cb4bc403b475f04a4d84f57dc5.tar.gz
poezio-0954c12a075da8cb4bc403b475f04a4d84f57dc5.tar.bz2
poezio-0954c12a075da8cb4bc403b475f04a4d84f57dc5.tar.xz
poezio-0954c12a075da8cb4bc403b475f04a4d84f57dc5.zip
Add a /remove_bookmark command
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core.py b/src/core.py
index 5ab0abfb..8704563c 100644
--- a/src/core.py
+++ b/src/core.py
@@ -141,6 +141,7 @@ class Core(object):
'invite': (self.command_invite, _("Usage: /invite <jid> <room> [reason]\nInvite: Invite jid in room with reason."), self.completion_invite),
'decline': (self.command_decline, _("Usage: /decline <room> [reason]\nDecline: Decline the invitation to room with or without reason."), self.completion_decline),
'bookmarks': (self.command_bookmarks, _("Usage: /bookmarks\nBookmarks: Show the current bookmarks."), None),
+ 'remove_bookmark': (self.command_remove_bookmark, _("Usage: /remove_bookmark [jid]\nRemove Bookmark: Remove the specified bookmark, or the bookmark on the current tab, if any."), self.completion_remove_bookmark),
}
self.key_func = {
@@ -1773,6 +1774,31 @@ class Core(object):
self.information(_('Your local bookmarks are: %s') %
[b for b in bookmark.bookmarks if b.method is 'local'], 'Info')
+ def command_remove_bookmark(self, arg):
+ """/remove_bookmark [jid]"""
+ args = common.shell_split(arg)
+ if not args:
+ tab = self.current_tab()
+ if isinstance(tab, tabs.MucTab) and bookmark.get_by_jid(tab.get_name()):
+ bookmark.remove(tab.get_name())
+ bookmark.save(self.xmpp)
+ if bookmark.save(self.xmpp):
+ self.core.information('Bookmark deleted', 'Info')
+ else:
+ self.information('No bookmark to remove', 'Info')
+ else:
+ if bookmark.get_by_jid(args[0]):
+ bookmark.remove(args[0])
+ if bookmark.save(self.xmpp):
+ self.core.information('Bookmark deleted', 'Info')
+
+ else:
+ self.information('No bookmark to remove', 'Info')
+
+ def completion_remove_bookmark(self,the_input):
+ """Completion for /remove_bookmark"""
+ return the_input.auto_completion([bm.jid for bm in bookmark.bookmarks], '')
+
def command_set(self, arg):
"""
/set <option> [value]