changeset 1563:075a63180eab

plugin XEP-0085: fixed chatstate blinking following 0632d96f08ad change
author Goffi <goffi@goffi.org>
date Tue, 03 Nov 2015 10:23:08 +0100
parents 7d91dff71067
children 001b62bed67c
files src/plugins/plugin_xep_0085.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py	Mon Nov 02 22:09:13 2015 +0100
+++ b/src/plugins/plugin_xep_0085.py	Tue Nov 03 10:23:08 2015 +0100
@@ -31,6 +31,7 @@
     from wokkel.subprotocols import XMPPHandler
 from twisted.words.xish import domish
 from twisted.internet import reactor
+from twisted.internet import error as internet_error
 
 NS_XMPP_CLIENT = "jabber:client"
 NS_CHAT_STATES = "http://jabber.org/protocol/chatstates"
@@ -372,6 +373,10 @@
                 client.xmlstream.send(mess_data['xml'])
 
         self.state = state
+        try:
+            self.timer.cancel()
+        except (internet_error.AlreadyCalled, AttributeError):
+            pass
 
         if transition["next_state"] and transition["delay"] > 0:
             self.timer = reactor.callLater(transition["delay"], self._onEvent, transition["next_state"])