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
path: root/nbxmpp
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
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')
-rw-r--r--nbxmpp/modules/muc.py13
-rw-r--r--nbxmpp/structs.py2
2 files changed, 15 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):
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py
index b3d670f..0b3482f 100644
--- a/nbxmpp/structs.py
+++ b/nbxmpp/structs.py
@@ -246,6 +246,7 @@ class MessageProperties:
self.http_auth = None
self.nickname = None
self.from_muc = False
+ self.muc_jid = None
self.muc_nickname = None
self.muc_status_codes = None
self.muc_private_message = False
@@ -374,6 +375,7 @@ class PresenceProperties:
self.error = None
self.avatar_sha = None
self.avatar_state = AvatarState.IGNORE
+ self.muc_jid = None
self.muc_status_codes = None
self.muc_user = None
self.muc_nickname = None