summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-10 01:07:59 +0200
committermathieui <mathieui@mathieui.net>2012-05-10 01:07:59 +0200
commit70a724c1270c98607023d251787d1f727a4d07a3 (patch)
tree7465bbfc514f369f0a163b6ea348c3c2db1367ea
parent089d94e6dbe757fb8309ec6c2179a71dbae79c34 (diff)
downloadpoezio-70a724c1270c98607023d251787d1f727a4d07a3.tar.gz
poezio-70a724c1270c98607023d251787d1f727a4d07a3.tar.bz2
poezio-70a724c1270c98607023d251787d1f727a4d07a3.tar.xz
poezio-70a724c1270c98607023d251787d1f727a4d07a3.zip
Add new status & bookmarks actions
-rw-r--r--doc/en/keys.txt35
-rw-r--r--src/core.py17
2 files changed, 48 insertions, 4 deletions
diff --git a/doc/en/keys.txt b/doc/en/keys.txt
index 428e3ca4..b823c619 100644
--- a/doc/en/keys.txt
+++ b/doc/en/keys.txt
@@ -255,6 +255,14 @@ NOTE: Even if some of these actions are labelled as similar to other
keystrokes, remapping the keystrokes will not remap the actions defined here.
[horizontal]
+*_bookmark*:: Bookmarks the current room.
+
+ Similar to /bookmark.
+
+*_bookmark_local*:: Bookmarks the current room, locally.
+
+ Similar to /bookmark_local
+
*_close_tab*:: Closes the current tab.
This is the same as /close. The first tab (the roster) can not be closed.
@@ -277,6 +285,10 @@ keystrokes, remapping the keystrokes will not remap the actions defined here.
Similar to /theme.
+*_remove_bookmark*:: Removes the bookmark on the current room.
+
+ Similar to /remove_bookmark.
+
*_room_left*:: Goes to the room on the left.
Similar to Ctrl-p.
@@ -334,6 +346,29 @@ keystrokes, remapping the keystrokes will not remap the actions defined here.
Similar to F4.
+Status actions
+~~~~~~~~~~~~~~
+
+[horizontal]
+*_available*:: Sets the status to _available_.
+
+ Similar to /status available.
+
+*_away*:: Sets the status to _away_.
+
+ Similar to /status away.
+
+*_chat*:: Sets the status to _chat_.
+
+ Similar to /status chat.
+
+*_dnd*:: Sets the status to _dnd_.
+
+ Similar to /status dnd.
+
+*_xa*:: Sets the status to _xa_.
+
+ Similar to /status xa.
Example
~~~~~~~
diff --git a/src/core.py b/src/core.py
index 60f167f4..07d1f8ea 100644
--- a/src/core.py
+++ b/src/core.py
@@ -202,12 +202,15 @@ class Core(object):
'M-d': self.scroll_info_up,
'M-c': self.scroll_info_down,
######## actions mappings ##########
+ '_bookmark': self.command_bookmark,
+ '_bookmark_local': self.command_bookmark_local,
'_close_tab': self.close_tab,
'_disconnect': self.disconnect,
'_quit': self.command_quit,
'_reconnect': self.command_reconnect,
'_redraw_screen': self.full_screen_redraw,
'_reload_theme': self.command_theme,
+ '_remove_bookmark': self.command_remove_bookmark,
'_room_left': self.rotate_rooms_left,
'_room_right': self.rotate_rooms_right,
'_show_roster': self.go_to_roster,
@@ -222,7 +225,13 @@ class Core(object):
'_show_plugins': self.command_plugins,
'_show_xmltab': self.command_xml_tab,
'_toggle_pane': self.toggle_left_pane,
- }
+ ###### status actions ######
+ '_available': lambda: self.command_status('available'),
+ '_away': lambda: self.command_status('away'),
+ '_chat': lambda: self.command_status('chat'),
+ '_dnd': lambda: self.command_status('dnd'),
+ '_xa': lambda: self.command_status('xa'),
+ }
# Add handlers
self.xmpp.add_event_handler('connected', self.on_connected)
@@ -1889,7 +1898,7 @@ class Core(object):
return bm.nick
return self.own_nick
- def command_bookmark_local(self, arg):
+ def command_bookmark_local(self, arg=''):
"""
/bookmark_local [room][/nick]
"""
@@ -1939,7 +1948,7 @@ class Core(object):
self.information(_('Your local bookmarks are now: %s') %
[b for b in bookmark.bookmarks if b.method == 'local'], 'Info')
- def command_bookmark(self, arg):
+ def command_bookmark(self, arg=''):
"""
/bookmark [room][/nick] [autojoin] [password]
"""
@@ -2016,7 +2025,7 @@ 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):
+ def command_remove_bookmark(self, arg=''):
"""/remove_bookmark [jid]"""
args = common.shell_split(arg)
if not args: