From 3f08e235a11ccc201e672e306fa7543437a589c0 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Sat, 5 Nov 2011 21:10:16 +0100
Subject: Fix some chat states problems (e.g. /dnd sending inactive)

---
 src/core.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/core.py b/src/core.py
index d107e86c..87f27e17 100644
--- a/src/core.py
+++ b/src/core.py
@@ -1114,12 +1114,14 @@ class Core(object):
         pres['type'] = show
         pres.send()
         current = self.current_tab()
-        if isinstance(current, tabs.MucTab) and current.get_room().joined:
+        if isinstance(current, tabs.MucTab) and current.get_room().joined and show in ('away', 'xa'):
             current.send_chat_state('inactive')
         for tab in self.tabs:
             if isinstance(tab, tabs.MucTab) and tab.get_room().joined:
                 muc.change_show(self.xmpp, tab.get_room().name, tab.get_room().own_nick, show, msg)
         self.set_status(show, msg)
+        if isinstance(current, tabs.MucTab) and current.get_room().joined and show not in ('away', 'xa'):
+            current.send_chat_state('active')
 
     def completion_status(self, the_input):
         return the_input.auto_completion([status for status in possible_show], ' ')
-- 
cgit v1.2.3