summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0054/vcard_temp.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0054/vcard_temp.py')
-rw-r--r--sleekxmpp/plugins/xep_0054/vcard_temp.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/sleekxmpp/plugins/xep_0054/vcard_temp.py b/sleekxmpp/plugins/xep_0054/vcard_temp.py
index 83cbccf8..97da8c7c 100644
--- a/sleekxmpp/plugins/xep_0054/vcard_temp.py
+++ b/sleekxmpp/plugins/xep_0054/vcard_temp.py
@@ -8,7 +8,7 @@
import logging
-from sleekxmpp import Iq
+from sleekxmpp import JID, Iq
from sleekxmpp.exceptions import XMPPError
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream.handler import Callback
@@ -59,10 +59,20 @@ class XEP_0054(BasePlugin):
def make_vcard(self):
return VCardTemp()
- def get_vcard(self, jid=None, ifrom=None, local=False, cached=False,
+ def get_vcard(self, jid=None, ifrom=None, local=None, cached=False,
block=True, callback=None, timeout=None):
- if self.xmpp.is_component and jid.domain == self.xmpp.boundjid.domain:
- local = True
+ if local is None:
+ if jid is not None and not isinstance(jid, JID):
+ jid = JID(jid)
+ if self.xmpp.is_component:
+ if jid.domain == self.xmpp.boundjid.domain:
+ local = True
+ else:
+ if str(jid) == str(self.xmpp.boundjid):
+ local = True
+ jid = jid.full
+ elif jid in (None, ''):
+ local = True
if local:
vcard = self.api['get_vcard'](jid, None, ifrom)
@@ -97,8 +107,8 @@ class XEP_0054(BasePlugin):
def publish_vcard(self, vcard=None, jid=None, block=True, ifrom=None,
callback=None, timeout=None):
+ self.api['set_vcard'](jid, None, ifrom, vcard)
if self.xmpp.is_component:
- self.api['set_vcard'](jid, None, ifrom, vcard)
return
iq = self.xmpp.Iq()