Remove all remote_wants_chatstates logic, keep the stubs.
This commit is contained in:
parent
d9129c9ced
commit
304d1cc1ab
5 changed files with 9 additions and 53 deletions
|
@ -369,11 +369,6 @@ class HandlerCore:
|
|||
jid=jid,
|
||||
typ=1)
|
||||
|
||||
if conversation.remote_wants_chatstates is None and not delayed:
|
||||
if message['chat_state']:
|
||||
conversation.remote_wants_chatstates = True
|
||||
else:
|
||||
conversation.remote_wants_chatstates = False
|
||||
if not own and 'private' in config.get('beep_on').split():
|
||||
if not config.get_by_tabname('disable_beep', conv_jid.bare):
|
||||
curses.beep()
|
||||
|
@ -819,11 +814,6 @@ class HandlerCore:
|
|||
jid=message['from'],
|
||||
typ=1)
|
||||
|
||||
if tab.remote_wants_chatstates is None:
|
||||
if message['chat_state']:
|
||||
tab.remote_wants_chatstates = True
|
||||
else:
|
||||
tab.remote_wants_chatstates = False
|
||||
if 'private' in config.get('beep_on').split():
|
||||
if not config.get_by_tabname('disable_beep', jid.full):
|
||||
curses.beep()
|
||||
|
@ -865,7 +855,6 @@ class HandlerCore:
|
|||
tab = self.core.get_conversation_by_jid(message['from'], False)
|
||||
if not tab:
|
||||
return False
|
||||
tab.remote_wants_chatstates = True
|
||||
self.core.events.trigger('normal_chatstate', message, tab)
|
||||
tab.chatstate = state
|
||||
if state == 'gone' and isinstance(tab, tabs.DynamicConversationTab):
|
||||
|
@ -885,7 +874,6 @@ class HandlerCore:
|
|||
tab = self.core.get_tab_by_name(message['from'].full, tabs.PrivateTab)
|
||||
if not tab:
|
||||
return
|
||||
tab.remote_wants_chatstates = True
|
||||
self.core.events.trigger('private_chatstate', message, tab)
|
||||
tab.chatstate = state
|
||||
if tab == self.core.current_tab():
|
||||
|
@ -1044,8 +1032,6 @@ class HandlerCore:
|
|||
contact.error = presence['error']['type'] + ': ' + presence['error']['condition']
|
||||
# reset chat states status on presence error
|
||||
tab = self.core.get_tab_by_name(jid.full, tabs.ConversationTab)
|
||||
if tab:
|
||||
tab.remote_wants_chatstates = None
|
||||
|
||||
def on_got_offline(self, presence):
|
||||
"""
|
||||
|
|
|
@ -469,7 +469,6 @@ class ChatTab(Tab):
|
|||
Tab.__init__(self, core)
|
||||
self.name = jid
|
||||
self.text_win = None
|
||||
self._remote_wants_chatstates = False
|
||||
self.directed_presence = None
|
||||
self._text_buffer = TextBuffer()
|
||||
self.chatstate = None # can be "active", "composing", "paused", "gone", "inactive"
|
||||
|
@ -514,7 +513,7 @@ class ChatTab(Tab):
|
|||
|
||||
@property
|
||||
def remote_wants_chatstates(self):
|
||||
return self._remote_wants_chatstates
|
||||
return True
|
||||
|
||||
@property
|
||||
def general_jid(self):
|
||||
|
@ -649,8 +648,7 @@ class ChatTab(Tab):
|
|||
if state in ('active', 'inactive',
|
||||
'gone') and self.inactive and not always_send:
|
||||
return
|
||||
if (config.get_by_tabname('send_chat_states', self.general_jid)
|
||||
and self.remote_wants_chatstates is not False):
|
||||
if config.get_by_tabname('send_chat_states', self.general_jid):
|
||||
msg = self.core.xmpp.make_message(self.get_dest_jid())
|
||||
msg['type'] = self.message_type
|
||||
msg['chat_state'] = state
|
||||
|
@ -664,8 +662,7 @@ class ChatTab(Tab):
|
|||
on the the current status of the input
|
||||
"""
|
||||
name = self.general_jid
|
||||
if (config.get_by_tabname('send_chat_states', name)
|
||||
and self.remote_wants_chatstates):
|
||||
if config.get_by_tabname('send_chat_states', name):
|
||||
needed = 'inactive' if self.inactive else 'active'
|
||||
self.cancel_paused_delay()
|
||||
if not empty_after:
|
||||
|
@ -775,10 +772,6 @@ class OneToOneTab(ChatTab):
|
|||
|
||||
# Set to true once the first disco is done
|
||||
self.__initial_disco = False
|
||||
# change this to True or False when
|
||||
# we know that the remote user wants chatstates, or not.
|
||||
# None means we don’t know yet, and we send only "active" chatstates
|
||||
self._remote_wants_chatstates = None
|
||||
self.remote_supports_attention = True
|
||||
self.remote_supports_receipts = True
|
||||
self.check_features()
|
||||
|
@ -816,25 +809,11 @@ class OneToOneTab(ChatTab):
|
|||
|
||||
@property
|
||||
def remote_wants_chatstates(self):
|
||||
return self._remote_wants_chatstates
|
||||
return True
|
||||
|
||||
@remote_wants_chatstates.setter
|
||||
def remote_wants_chatstates(self, value):
|
||||
old_value = self._remote_wants_chatstates
|
||||
self._remote_wants_chatstates = value
|
||||
if (old_value is None and value != None) or \
|
||||
(old_value != value and value != None):
|
||||
ok = get_theme().CHAR_OK
|
||||
nope = get_theme().CHAR_EMPTY
|
||||
support = ok if value else nope
|
||||
if value:
|
||||
msg = '\x19%s}Contact supports chat states [%s].'
|
||||
else:
|
||||
msg = '\x19%s}Contact does not support chat states [%s].'
|
||||
color = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
|
||||
msg = msg % (color, support)
|
||||
self.add_message(msg, typ=0)
|
||||
self.core.refresh_window()
|
||||
pass
|
||||
|
||||
def ack_message(self, msg_id, msg_jid):
|
||||
"""
|
||||
|
@ -863,8 +842,7 @@ class OneToOneTab(ChatTab):
|
|||
message['type'] = 'chat'
|
||||
if self.remote_supports_receipts:
|
||||
message._add_receipt = True
|
||||
if self.remote_wants_chatstates:
|
||||
message['chat_sate'] = 'active'
|
||||
message['chat_sate'] = 'active'
|
||||
message.send()
|
||||
body = xhtml.xhtml_to_poezio_colors(xhtml_data, force=True)
|
||||
self._text_buffer.add_message(
|
||||
|
|
|
@ -140,8 +140,7 @@ class ConversationTab(OneToOneTab):
|
|||
msg.enable('html')
|
||||
msg['html']['body'] = xhtml.poezio_colors_to_html(msg['body'])
|
||||
msg['body'] = xhtml.clean_text(msg['body'])
|
||||
if (config.get_by_tabname('send_chat_states', self.general_jid)
|
||||
and self.remote_wants_chatstates is not False):
|
||||
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:
|
||||
|
|
|
@ -65,10 +65,6 @@ class MucTab(ChatTab):
|
|||
self.privates = []
|
||||
self.topic = ''
|
||||
self.topic_from = ''
|
||||
# We send active, composing and paused states to the MUC because
|
||||
# the chatstate may or may not be filtered by the MUC,
|
||||
# that’s not our problem.
|
||||
self._remote_wants_chatstates = True
|
||||
# Self ping event, so we can cancel it when we leave the room
|
||||
self.self_ping_event = None
|
||||
# UI stuff
|
||||
|
@ -1548,8 +1544,7 @@ class MucTab(ChatTab):
|
|||
msg.enable('html')
|
||||
msg['html']['body'] = xhtml.poezio_colors_to_html(msg['body'])
|
||||
msg['body'] = xhtml.clean_text(msg['body'])
|
||||
if (config.get_by_tabname('send_chat_states', self.general_jid)
|
||||
and self.remote_wants_chatstates is not False):
|
||||
if config.get_by_tabname('send_chat_states', self.general_jid):
|
||||
msg['chat_state'] = needed
|
||||
if correct:
|
||||
msg['replace']['id'] = self.last_sent_message['id']
|
||||
|
|
|
@ -174,8 +174,7 @@ class PrivateTab(OneToOneTab):
|
|||
msg.enable('html')
|
||||
msg['html']['body'] = xhtml.poezio_colors_to_html(msg['body'])
|
||||
msg['body'] = xhtml.clean_text(msg['body'])
|
||||
if (config.get_by_tabname('send_chat_states', self.general_jid)
|
||||
and self.remote_wants_chatstates is not False):
|
||||
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:
|
||||
|
@ -420,7 +419,6 @@ class PrivateTab(OneToOneTab):
|
|||
|
||||
def deactivate(self, reason=None):
|
||||
self.on = False
|
||||
self.remote_wants_chatstates = None
|
||||
if reason:
|
||||
self.add_message(txt=reason, typ=2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue