comparison src/plugins/plugin_xep_0085.py @ 1970:200cd707a46d

plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass): - bridge methods/signals now all start with "muc" to follow new convention - internal method use client instead of profile to follow new convention - removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added - cleaned/simplified several part of the code. checkClient removed as it is not needed anymore - self.clients map removed, muc data are now stored directly in client - getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane. /!\ This break all room game plugins for the moment - use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
author Goffi <goffi@goffi.org>
date Mon, 27 Jun 2016 21:45:11 +0200
parents 633b5c21aefd
children 19b9d3f8a6c7
comparison
equal deleted inserted replaced
1969:5fbe09b9b568 1970:200cd707a46d
307 307
308 @param to_jid_s (str): contact full JID as a string 308 @param to_jid_s (str): contact full JID as a string
309 @param profile_key (str): %(doc_profile_key)s 309 @param profile_key (str): %(doc_profile_key)s
310 """ 310 """
311 # TODO: try to optimize this method which is called often 311 # TODO: try to optimize this method which is called often
312 profile = self.host.memory.getProfileName(profile_key) 312 client = self.host.getClient(profile_key)
313 if profile is None:
314 raise exceptions.ProfileUnknownError
315 to_jid = JID(to_jid_s) 313 to_jid = JID(to_jid_s)
316 if self._isMUC(to_jid, profile): 314 if self._isMUC(to_jid, client.profile):
317 to_jid = to_jid.userhostJID() 315 to_jid = to_jid.userhostJID()
318 elif not to_jid.resource: 316 elif not to_jid.resource:
319 to_jid.resource = self.host.memory.getMainResource(to_jid, profile) 317 to_jid.resource = self.host.memory.getMainResource(client, to_jid)
320 if not self._checkActivation(to_jid, forceEntityData=False, profile=profile): 318 if not self._checkActivation(to_jid, forceEntityData=False, profile=client.profile):
321 return 319 return
322 try: 320 try:
323 self.map[profile][to_jid]._onEvent("composing") 321 self.map[client.profile][to_jid]._onEvent("composing")
324 except (KeyError, AttributeError): 322 except (KeyError, AttributeError):
325 # no message has been sent/received since the notifications 323 # no message has been sent/received since the notifications
326 # have been enabled, it's better to wait for a first one 324 # have been enabled, it's better to wait for a first one
327 pass 325 pass
328 326