comparison sat/plugins/plugin_xep_0352.py @ 2882:0c54970d8e6e

plugin android: fixed csi_timer reset in setActive + crash on call of isActive before session initialisation
author Goffi <goffi@goffi.org>
date Fri, 05 Apr 2019 21:22:03 +0200
parents 9a019db21f3c
children ab2696e34d29
comparison
equal deleted inserted replaced
2881:13e0a260e7b8 2882:0c54970d8e6e
45 log.info(_(u"Client State Indication plugin initialization")) 45 log.info(_(u"Client State Indication plugin initialization"))
46 self.host = host 46 self.host = host
47 host.registerNamespace(u"csi", NS_CSI) 47 host.registerNamespace(u"csi", NS_CSI)
48 48
49 def isActive(self, client): 49 def isActive(self, client):
50 if not client._xep_0352_enabled: 50 try:
51 if not client._xep_0352_enabled:
52 return True
53 return client._xep_0352_active
54 except AttributeError:
55 # _xep_0352_active can not be set if isActive is called before
56 # profileConnected has been called
57 log.debug(u"isActive called when XEP-0352 plugin has not yet set the "
58 u"attributes")
51 return True 59 return True
52 return client._xep_0352_active
53 60
54 def profileConnected(self, client): 61 def profileConnected(self, client):
55 if (NS_CSI, u'csi') in client.xmlstream.features: 62 if (NS_CSI, u'csi') in client.xmlstream.features:
56 log.info(_(u"Client State Indication is available on this server")) 63 log.info(_(u"Client State Indication is available on this server"))
57 client._xep_0352_enabled = True 64 client._xep_0352_enabled = True