changeset ab8fe4739898 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=ab8fe4739898
description: make /status /away and /back commands apply to connected and 
synchronized accounts. Fixes #7070

diffstat:

 src/command_system/implementation/standard.py |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 3aca86886964 -r ab8fe4739898 
src/command_system/implementation/standard.py
--- a/src/command_system/implementation/standard.py     Thu Jan 05 13:50:15 
2012 +0100
+++ b/src/command_system/implementation/standard.py     Thu Jan 05 20:09:33 
2012 +0100
@@ -125,6 +125,17 @@
 
             self.echo(formatted)
 
+    def _get_connected_accounts(self):
+        conns = []
+        for conn in gajim.connections.itervalues():
+            if not gajim.config.get_per('accounts', conn.name,
+            'sync_with_global_status'):
+                continue
+            if conn.connected <= 2:
+                continue
+            conns.append(conn)
+        return conns
+
     @command(raw=True, empty=True)
     @doc(_("""
     Set current the status
@@ -135,7 +146,7 @@
     def status(self, status, message):
         if status not in ('online', 'away', 'chat', 'xa', 'dnd'):
             raise CommandError("Invalid status given")
-        for connection in gajim.connections.itervalues():
+        for connection in self._get_connected_accounts():
             connection.change_status(status, message)
 
     @command(raw=True, empty=True)
@@ -143,7 +154,7 @@
     def away(self, message):
         if not message:
             message = _("Away")
-        for connection in gajim.connections.itervalues():
+        for connection in self._get_connected_accounts():
             connection.change_status('away', message)
 
     @command('back', raw=True, empty=True)
@@ -151,7 +162,7 @@
     def online(self, message):
         if not message:
             message = _("Available")
-        for connection in gajim.connections.itervalues():
+        for connection in self._get_connected_accounts():
             connection.change_status('online', message)
 
 class StandardCommonChatCommands(CommandContainer):
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to