comparison src/core/xmpp.py @ 2543:60758de1c227

plugin XEP-0115: fixed caps initial check
author Goffi <goffi@goffi.org>
date Fri, 30 Mar 2018 17:51:32 +0200
parents a201194fc461
children
comparison
equal deleted inserted replaced
2542:100563768196 2543:60758de1c227
188 self._connected = defer.Deferred() 188 self._connected = defer.Deferred()
189 self._connected.addCallback(self._cleanConnection) 189 self._connected.addCallback(self._cleanConnection)
190 self._connected.addCallback(self._disconnectionCb) 190 self._connected.addCallback(self._disconnectionCb)
191 self._connected.addErrback(self._disconnectionEb) 191 self._connected.addErrback(self._disconnectionEb)
192 192
193 log.info(_("********** [%s] CONNECTED **********") % self.profile) 193 log.info(_(u"********** [{profile}] CONNECTED **********").format(profile=self.profile))
194 self.streamInitialized() 194 self.streamInitialized()
195 self.host_app.bridge.connected(self.profile, unicode(self.jid)) # we send the signal to the clients 195 self.host_app.bridge.connected(self.profile, unicode(self.jid)) # we send the signal to the clients
196 196
197 def _finish_connection(self, dummy): 197 def _finish_connection(self, dummy):
198 self.conn_deferred.callback(None) 198 self.conn_deferred.callback(None)
232 log.debug(_("No keep_alife")) 232 log.debug(_("No keep_alife"))
233 if self._connected is not None: 233 if self._connected is not None:
234 self.host_app.bridge.disconnected(self.profile) # we send the signal to the clients 234 self.host_app.bridge.disconnected(self.profile) # we send the signal to the clients
235 self._connected.callback(None) 235 self._connected.callback(None)
236 self.host_app.purgeEntity(self.profile) # and we remove references to this client 236 self.host_app.purgeEntity(self.profile) # and we remove references to this client
237 log.info(_("********** [%s] DISCONNECTED **********") % self.profile) 237 log.info(_(u"********** [{profile}] DISCONNECTED **********").format(profile=self.profile))
238 if not self.conn_deferred.called: 238 if not self.conn_deferred.called:
239 # FIXME: real error is not gotten here (e.g. if jid is not know by Prosody, 239 # FIXME: real error is not gotten here (e.g. if jid is not know by Prosody,
240 # we should have the real error) 240 # we should have the real error)
241 self.conn_deferred.errback(error.StreamError(u"Server unexpectedly closed the connection")) 241 self.conn_deferred.errback(error.StreamError(u"Server unexpectedly closed the connection"))
242 242
966 def __init__(self, host): 966 def __init__(self, host):
967 xmppim.PresenceClientProtocol.__init__(self) 967 xmppim.PresenceClientProtocol.__init__(self)
968 self.host = host 968 self.host = host
969 969
970 def send(self, obj): 970 def send(self, obj):
971 if not self.host.trigger.point("Presence send", self.parent, obj): 971 presence_d = defer.succeed(None)
972 if not self.host.trigger.point("Presence send", self.parent, obj, presence_d):
972 return 973 return
973 super(SatPresenceProtocol, self).send(obj) 974 presence_d.addCallback(lambda __: super(SatPresenceProtocol, self).send(obj))
974 975
975 def availableReceived(self, entity, show=None, statuses=None, priority=0): 976 def availableReceived(self, entity, show=None, statuses=None, priority=0):
976 log.debug(_(u"presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity': entity, C.PRESENCE_SHOW: show, C.PRESENCE_STATUSES: statuses, C.PRESENCE_PRIORITY: priority}) 977 log.debug(_(u"presence update for [%(entity)s] (available, show=%(show)s statuses=%(statuses)s priority=%(priority)d)") % {'entity': entity, C.PRESENCE_SHOW: show, C.PRESENCE_STATUSES: statuses, C.PRESENCE_PRIORITY: priority})
977 978
978 if not statuses: 979 if not statuses: