Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2019-07-05 23:43:58 +0300
committerPhilipp Hörist <philipp@hoerist.com>2019-07-05 23:43:58 +0300
commit1795473b5d699be0b95b511b0b7d03a8ca0ec348 (patch)
tree92423db9f2032266fcfbef687c10dcaee1858114 /nbxmpp/modules
parentf39d00575910ec270f1d668e1f80edcc48cc5734 (diff)
Add muc_jid attribute to Message and Presence
Attribute contains a bare JID object if the Message or Presence is from a MUC
Diffstat (limited to 'nbxmpp/modules')
-rw-r--r--nbxmpp/modules/muc.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nbxmpp/modules/muc.py b/nbxmpp/modules/muc.py
index a4f35be..3516287 100644
--- a/nbxmpp/modules/muc.py
+++ b/nbxmpp/modules/muc.py
@@ -97,6 +97,8 @@ class MUC:
if muc is None:
return
properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
properties.muc_nickname = properties.jid.getResource()
def _process_muc_user_presence(self, _con, stanza, properties):
@@ -104,6 +106,8 @@ class MUC:
if muc_user is None:
return
properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
destroy = muc_user.getTag('destroy')
if destroy is not None:
@@ -158,6 +162,8 @@ class MUC:
def _process_groupchat_message(self, _con, stanza, properties):
properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
properties.muc_nickname = properties.jid.getResource() or None
muc_user = stanza.getTag('x', namespace=NS_MUC_USER)
@@ -185,6 +191,8 @@ class MUC:
return
properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
if not properties.jid.isBare:
return
@@ -249,6 +257,8 @@ class MUC:
return
properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
data = {}
@@ -291,6 +301,9 @@ class MUC:
return
properties.voice_request = VoiceRequest(form=data_form)
+ properties.from_muc = True
+ properties.muc_jid = properties.jid.copy()
+ properties.muc_jid.setBare()
@call_on_response('_affiliation_received')
def get_affiliation(self, jid, affiliation):