diff 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
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0085.py	Fri Jun 24 22:41:28 2016 +0200
+++ b/src/plugins/plugin_xep_0085.py	Mon Jun 27 21:45:11 2016 +0200
@@ -309,18 +309,16 @@
         @param profile_key (str): %(doc_profile_key)s
         """
         # TODO: try to optimize this method which is called often
-        profile = self.host.memory.getProfileName(profile_key)
-        if profile is None:
-            raise exceptions.ProfileUnknownError
+        client = self.host.getClient(profile_key)
         to_jid = JID(to_jid_s)
-        if self._isMUC(to_jid, profile):
+        if self._isMUC(to_jid, client.profile):
             to_jid = to_jid.userhostJID()
         elif not to_jid.resource:
-            to_jid.resource = self.host.memory.getMainResource(to_jid, profile)
-        if not self._checkActivation(to_jid, forceEntityData=False, profile=profile):
+            to_jid.resource = self.host.memory.getMainResource(client, to_jid)
+        if not self._checkActivation(to_jid, forceEntityData=False, profile=client.profile):
             return
         try:
-            self.map[profile][to_jid]._onEvent("composing")
+            self.map[client.profile][to_jid]._onEvent("composing")
         except (KeyError, AttributeError):
             # no message has been sent/received since the notifications
             # have been enabled, it's better to wait for a first one