summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/en/usage.txt3
-rw-r--r--src/core.py26
2 files changed, 29 insertions, 0 deletions
diff --git a/doc/en/usage.txt b/doc/en/usage.txt
index 8c7acf3b..5f220fd4 100644
--- a/doc/en/usage.txt
+++ b/doc/en/usage.txt
@@ -215,6 +215,9 @@ These commands work in *any* tab.
with this command will be stored locally. They have priority over the ones
stored online.
+*/remove_bookmark [room_jid]*:: Remove the bookmark on _room_jid_ or the one on
+ the current tab, if any.
+
*/bookmarks*:: Show the current bookmarks.
*/set <option> [value]*:: Set the value to the option in your configuration
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]