summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-11-24 03:28:02 +0000
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-11-24 03:28:02 +0000
commit1edabb0c77227c32d04478f00b0539b7d1418915 (patch)
treee4a1e282096e6e0141d363598b11d8bf9af9f1c6
parent068aa591e3bf01d1f052db5b87b1771772b51c9e (diff)
downloadpoezio-1edabb0c77227c32d04478f00b0539b7d1418915.tar.gz
poezio-1edabb0c77227c32d04478f00b0539b7d1418915.tar.bz2
poezio-1edabb0c77227c32d04478f00b0539b7d1418915.tar.xz
poezio-1edabb0c77227c32d04478f00b0539b7d1418915.zip
Remove bogus checks for resource features.
-rw-r--r--poezio/tabs/basetabs.py76
-rw-r--r--poezio/tabs/conversationtab.py5
-rw-r--r--poezio/tabs/privatetab.py5
3 files changed, 11 insertions, 75 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 6ea3b18b..5680d1e1 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -772,13 +772,17 @@ class OneToOneTab(ChatTab):
# Set to true once the first disco is done
self.__initial_disco = False
- self.remote_supports_attention = True
- self.remote_supports_receipts = True
self.check_features()
self.register_command(
'unquery', self.command_unquery, shortdesc='Close the tab.')
self.register_command(
'close', self.command_unquery, shortdesc='Close the tab.')
+ self.register_command(
+ 'attention', self.command_attention,
+ usage='[message]',
+ shortdesc='Request the attention.',
+ desc='Attention: Request the attention of the contact. Can also '
+ 'send a message along with the attention.')
def remote_user_color(self):
return dump_tuple(get_theme().COLOR_REMOTE_USER)
@@ -840,8 +844,7 @@ class OneToOneTab(ChatTab):
message = self.generate_xhtml_message(xhtml_data)
if message:
message['type'] = 'chat'
- if self.remote_supports_receipts:
- message._add_receipt = True
+ message._add_receipt = True
message['chat_sate'] = 'active'
message.send()
body = xhtml.xhtml_to_poezio_colors(xhtml_data, force=True)
@@ -897,71 +900,6 @@ class OneToOneTab(ChatTab):
self.core.information(msg, 'Info')
return True
- def _feature_attention(self, features):
- "Check for the 'attention' features"
- if 'urn:xmpp:attention:0' in features:
- self.remote_supports_attention = True
- self.register_command(
- 'attention',
- self.command_attention,
- usage='[message]',
- shortdesc='Request the attention.',
- desc='Attention: Request the attention of '
- 'the contact. Can also send a message'
- ' along with the attention.')
- else:
- self.remote_supports_attention = False
- return self.remote_supports_attention
-
- def _feature_correct(self, features):
- "Check for the 'correction' feature"
- if 'urn:xmpp:message-correct:0' not in features:
- if 'correct' in self.commands:
- del self.commands['correct']
- elif 'correct' not in self.commands:
- self.register_command(
- 'correct',
- self.command_correct,
- desc='Fix the last message with whatever you want.',
- shortdesc='Correct the last message.',
- completion=self.completion_correct)
- return 'correct' in self.commands
-
- def _feature_receipts(self, features):
- "Check for the 'receipts' feature"
- if 'urn:xmpp:receipts' in features:
- self.remote_supports_receipts = True
- else:
- self.remote_supports_receipts = False
- return self.remote_supports_receipts
-
def features_checked(self, iq):
"Features check callback"
features = iq['disco_info'].get_features() or []
- before = ('correct' in self.commands, self.remote_supports_attention,
- self.remote_supports_receipts)
- correct = self._feature_correct(features)
- attention = self._feature_attention(features)
- receipts = self._feature_receipts(features)
-
- if (correct, attention, receipts) == before and self.__initial_disco:
- return
- else:
- self.__initial_disco = True
-
- if not (correct or attention or receipts):
- return # don’t display anything
-
- ok = get_theme().CHAR_OK
- nope = get_theme().CHAR_EMPTY
-
- correct = ok if correct else nope
- attention = ok if attention else nope
- receipts = ok if receipts else nope
-
- msg = ('\x19%s}Contact supports: correction [%s], '
- 'attention [%s], receipts [%s].')
- color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
- msg = msg % (color, correct, attention, receipts)
- self.add_message(msg, typ=0)
- self.core.refresh_window()
diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py
index f99938fc..20180f73 100644
--- a/poezio/tabs/conversationtab.py
+++ b/poezio/tabs/conversationtab.py
@@ -143,7 +143,7 @@ class ConversationTab(OneToOneTab):
if config.get_by_tabname('send_chat_states', self.general_jid):
needed = 'inactive' if self.inactive else 'active'
msg['chat_state'] = needed
- if attention and self.remote_supports_attention:
+ if attention:
msg['attention'] = True
self.core.events.trigger('conversation_say_after', msg, self)
if not msg['body']:
@@ -161,8 +161,7 @@ class ConversationTab(OneToOneTab):
typ=1)
self.last_sent_message = msg
- if self.remote_supports_receipts:
- msg._add_receipt = True
+ msg._add_receipt = True
msg.send()
self.cancel_paused_delay()
self.text_win.refresh()
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index ca5e85ea..96c68562 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -177,7 +177,7 @@ class PrivateTab(OneToOneTab):
if config.get_by_tabname('send_chat_states', self.general_jid):
needed = 'inactive' if self.inactive else 'active'
msg['chat_state'] = needed
- if attention and self.remote_supports_attention:
+ if attention:
msg['attention'] = True
self.core.events.trigger('private_say_after', msg, self)
if not msg['body']:
@@ -196,8 +196,7 @@ class PrivateTab(OneToOneTab):
typ=1)
self.last_sent_message = msg
- if self.remote_supports_receipts:
- msg._add_receipt = True
+ msg._add_receipt = True
msg.send()
self.cancel_paused_delay()
self.text_win.refresh()