summaryrefslogtreecommitdiff
path: root/src/tabs/conversationtab.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-05-15 23:33:51 +0200
committermathieui <mathieui@mathieui.net>2014-05-15 23:33:51 +0200
commit97ef9d7fb90fd4a3a408868f0aa996728ad382cd (patch)
treec901a77993ae90c758cbb915b14c1da36edd975b /src/tabs/conversationtab.py
parent916416a019c398a484b6a436ee908808780263f9 (diff)
downloadpoezio-97ef9d7fb90fd4a3a408868f0aa996728ad382cd.tar.gz
poezio-97ef9d7fb90fd4a3a408868f0aa996728ad382cd.tar.bz2
poezio-97ef9d7fb90fd4a3a408868f0aa996728ad382cd.tar.xz
poezio-97ef9d7fb90fd4a3a408868f0aa996728ad382cd.zip
Make detecting the features supported by the remote entity less awful
no more stalling while waiting for a disco info while sending a message.
Diffstat (limited to 'src/tabs/conversationtab.py')
-rw-r--r--src/tabs/conversationtab.py36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py
index 7480906b..e6324182 100644
--- a/src/tabs/conversationtab.py
+++ b/src/tabs/conversationtab.py
@@ -18,7 +18,7 @@ log = logging.getLogger(__name__)
import curses
-from . import ChatTab, Tab
+from . basetabs import OneToOneTab, Tab
import common
import fixes
@@ -30,7 +30,7 @@ from decorators import refresh_wrapper
from roster import roster
from theming import get_theme, dump_tuple
-class ConversationTab(ChatTab):
+class ConversationTab(OneToOneTab):
"""
The tab containg a normal conversation (not from a MUC)
Must not be instantiated, use Static or Dynamic version only.
@@ -40,7 +40,7 @@ class ConversationTab(ChatTab):
additional_informations = {}
message_type = 'chat'
def __init__(self, jid):
- ChatTab.__init__(self, jid)
+ OneToOneTab.__init__(self, jid)
self.nick = None
self.nick_sent = False
self.state = 'normal'
@@ -49,7 +49,6 @@ class ConversationTab(ChatTab):
self._text_buffer.add_window(self.text_win)
self.upper_bar = windows.ConversationStatusMessageWin()
self.input = windows.MessageInput()
- self.check_attention()
# keys
self.key_func['^I'] = self.completion
# commands
@@ -142,6 +141,8 @@ class ConversationTab(ChatTab):
typ=1)
self.last_sent_message = msg
+ if self.remote_supports_receipts:
+ msg._add_receipt = True
msg.send()
self.cancel_paused_delay()
self.text_win.refresh()
@@ -208,32 +209,6 @@ class ConversationTab(ChatTab):
self._text_buffer.add_message("\x19%(info_col)s}No information available\x19o" % {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)})
return True
-
- def command_attention(self, message=''):
- if message is not '':
- self.command_say(message, attention=True)
- else:
- msg = self.core.xmpp.make_message(self.get_dest_jid())
- msg['type'] = 'chat'
- msg['attention'] = True
- msg.send()
-
- def check_attention(self):
- self.core.xmpp.plugin['xep_0030'].get_info(
- jid=self.get_dest_jid(), block=False, timeout=5,
- callback=self.on_attention_checked)
-
- def on_attention_checked(self, iq):
- if 'urn:xmpp:attention:0' in iq['disco_info'].get_features():
- self.core.information('Attention is supported', 'Info')
- self.remote_supports_attention = True
- self.commands['attention'] = (self.command_attention,
- _('Usage: /attention [message]\nAttention: Require'
- ' the attention of the contact. Can also send a '
- 'message along with the attention.'), None)
- else:
- self.remote_supports_attention = False
-
def command_unquery(self, arg):
self.core.close_tab()
@@ -416,6 +391,7 @@ class DynamicConversationTab(ConversationTab):
self.name,
resource)
self.add_message(message, typ=0)
+ self.check_features()
def unlock_command(self, arg=None):
self.unlock()