summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-09 22:34:16 +0100
committermathieui <mathieui@mathieui.net>2011-11-09 22:34:16 +0100
commitf55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae (patch)
tree474abb583d0de139c255d3adc309852a1783cafc /src/tabs.py
parent7f322e7d8885c33540b33b2147a02333a252673d (diff)
downloadpoezio-f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae.tar.gz
poezio-f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae.tar.bz2
poezio-f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae.tar.xz
poezio-f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae.zip
Do not send chatstates when the contact is offline
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 6ba94c50..7639f54f 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1975,17 +1975,31 @@ class ConversationTab(ChatTab):
return False
def on_lose_focus(self):
+ contact = roster.get_contact_by_jid(self.get_name())
+ jid = JID(self.get_name())
+ if jid.resource:
+ resource = contact.get_resource_by_fulljid(jid.full)
+ else:
+ resource = contact.get_highest_priority_resource()
self.state = 'normal'
self.text_win.remove_line_separator()
self.text_win.add_line_separator()
if config.get('send_chat_states', 'true') == 'true' and not self.input.get_text() or not self.input.get_text().startswith('//'):
- self.send_chat_state('inactive')
+ if resource:
+ self.send_chat_state('inactive')
def on_gain_focus(self):
+ contact = roster.get_contact_by_jid(self.get_name())
+ jid = JID(self.get_name())
+ if jid.resource:
+ resource = contact.get_resource_by_fulljid(jid.full)
+ else:
+ resource = contact.get_highest_priority_resource()
self.state = 'current'
curses.curs_set(1)
if config.get('send_chat_states', 'true') == 'true' and not self.input.get_text() or not self.input.get_text().startswith('//'):
- self.send_chat_state('active')
+ if resource:
+ self.send_chat_state('active')
def on_scroll_up(self):
self.text_win.scroll_up(self.text_win.height-1)