From 04929c74d4dc721d393ec2242a0e5c19a40effdd Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 3 Nov 2015 10:23:08 +0100 Subject: [PATCH] plugin XEP-0085: fixed chatstate blinking following 0632d96f08ad change --- src/plugins/plugin_xep_0085.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/plugin_xep_0085.py b/src/plugins/plugin_xep_0085.py index 0431fa02..f37dcc68 100755 --- a/src/plugins/plugin_xep_0085.py +++ b/src/plugins/plugin_xep_0085.py @@ -31,6 +31,7 @@ except ImportError: 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 @@ class ChatStateMachine(object): 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"])