summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-02 09:13:22 -0500
committerLance Stout <lancestout@gmail.com>2011-02-02 09:13:22 -0500
commitde6170a13de2dbb3cbcfbf4a74b749f20b0cf061 (patch)
treeb60043234119a3d215e0eca65913dd038167b551 /sleekxmpp/plugins
parent65931bb384aada922c5287a3ad3cc62d04d6e676 (diff)
parent8dbe6f65462ec9b1a0506a00316415996f4d53d8 (diff)
downloadslixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.gz
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.bz2
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.tar.xz
slixmpp-de6170a13de2dbb3cbcfbf4a74b749f20b0cf061.zip
Merge branch 'develop' into roster
Conflicts: sleekxmpp/basexmpp.py
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0030/disco.py29
-rw-r--r--sleekxmpp/plugins/xep_0030/static.py5
-rw-r--r--sleekxmpp/plugins/xep_0045.py1
-rw-r--r--sleekxmpp/plugins/xep_0078.py2
-rw-r--r--sleekxmpp/plugins/xep_0092/version.py2
-rw-r--r--sleekxmpp/plugins/xep_0199.py2
-rw-r--r--sleekxmpp/plugins/xep_0202.py8
7 files changed, 35 insertions, 14 deletions
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py
index 6fd4e85f..a976b988 100644
--- a/sleekxmpp/plugins/xep_0030/disco.py
+++ b/sleekxmpp/plugins/xep_0030/disco.py
@@ -177,7 +177,10 @@ class xep_0030(base_plugin):
elif node is None:
self._handlers[htype]['jid'][jid] = handler
elif jid is None:
- jid = self.xmpp.boundjid.full
+ if self.xmpp.is_component:
+ jid = self.xmpp.boundjid.full
+ else:
+ jid = self.xmpp.boundjid.bare
self._handlers[htype]['node'][(jid, node)] = handler
else:
self._handlers[htype]['node'][(jid, node)] = handler
@@ -342,7 +345,7 @@ class xep_0030(base_plugin):
"""
self._run_node_handler('del_items', jid, node, kwargs)
- def add_item(self, jid=None, name='', node=None, subnode='', ijid=None):
+ def add_item(self, jid='', name='', node=None, subnode='', ijid=None):
"""
Add a new item element to the given JID/node combination.
@@ -356,10 +359,12 @@ class xep_0030(base_plugin):
subnode -- Optional node for the item.
ijid -- The JID to modify.
"""
+ if not jid:
+ jid = self.xmpp.boundjid.full
kwargs = {'ijid': jid,
'name': name,
'inode': subnode}
- self._run_node_handler('add_item', jid, node, kwargs)
+ self._run_node_handler('add_item', ijid, node, kwargs)
def del_item(self, jid=None, node=None, **kwargs):
"""
@@ -500,7 +505,10 @@ class xep_0030(base_plugin):
data -- Optional, custom data to pass to the handler.
"""
if jid is None:
- jid = self.xmpp.boundjid.full
+ if self.xmpp.is_component:
+ jid = self.xmpp.boundjid.full
+ else:
+ jid = self.xmpp.boundjid.bare
if node is None:
node = ''
@@ -526,8 +534,12 @@ class xep_0030(base_plugin):
if iq['type'] == 'get':
log.debug("Received disco info query from " + \
"<%s> to <%s>." % (iq['from'], iq['to']))
+ if self.xmpp.is_component:
+ jid = iq['to'].full
+ else:
+ jid = iq['to'].bare
info = self._run_node_handler('get_info',
- iq['to'].full,
+ jid,
iq['disco_info']['node'],
iq)
iq.reply()
@@ -552,8 +564,12 @@ class xep_0030(base_plugin):
if iq['type'] == 'get':
log.debug("Received disco items query from " + \
"<%s> to <%s>." % (iq['from'], iq['to']))
+ if self.xmpp.is_component:
+ jid = iq['to'].full
+ else:
+ jid = iq['to'].bare
items = self._run_node_handler('get_items',
- iq['to'].full,
+ jid,
iq['disco_items']['node'])
iq.reply()
if items:
@@ -590,3 +606,4 @@ class xep_0030(base_plugin):
"Using default disco#info feature.")
info.add_feature(info.namespace)
return info
+
diff --git a/sleekxmpp/plugins/xep_0030/static.py b/sleekxmpp/plugins/xep_0030/static.py
index eff67f02..f957c84c 100644
--- a/sleekxmpp/plugins/xep_0030/static.py
+++ b/sleekxmpp/plugins/xep_0030/static.py
@@ -247,8 +247,8 @@ class StaticDisco(object):
self.add_node(jid, node)
self.nodes[(jid, node)]['items'].add_item(
data.get('ijid', ''),
- node=data.get('inode', None),
- name=data.get('name', None))
+ node=data.get('inode', ''),
+ name=data.get('name', ''))
def del_item(self, jid, node, data):
"""
@@ -262,3 +262,4 @@ class StaticDisco(object):
self.nodes[(jid, node)]['items'].del_item(
data.get('ijid', ''),
node=data.get('inode', None))
+
diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py
index feec70db..364fbbd9 100644
--- a/sleekxmpp/plugins/xep_0045.py
+++ b/sleekxmpp/plugins/xep_0045.py
@@ -316,6 +316,7 @@ class xep_0045(base.base_plugin):
x = ET.Element('{jabber:x:data}x', type='cancel')
query.append(x)
iq = self.xmpp.makeIqSet(query)
+ iq['to'] = room
iq.send()
def setRoomConfig(self, room, config, ifrom=''):
diff --git a/sleekxmpp/plugins/xep_0078.py b/sleekxmpp/plugins/xep_0078.py
index d2c81b16..bb6a4632 100644
--- a/sleekxmpp/plugins/xep_0078.py
+++ b/sleekxmpp/plugins/xep_0078.py
@@ -36,7 +36,7 @@ class xep_0078(base.base_plugin):
log.debug("Starting jabber:iq:auth Authentication")
auth_request = self.xmpp.makeIqGet()
auth_request_query = ET.Element('{jabber:iq:auth}query')
- auth_request.attrib['to'] = self.xmpp.server
+ auth_request.attrib['to'] = self.xmpp.boundjid.host
username = ET.Element('username')
username.text = self.xmpp.username
auth_request_query.append(username)
diff --git a/sleekxmpp/plugins/xep_0092/version.py b/sleekxmpp/plugins/xep_0092/version.py
index f59f8819..fb3671e4 100644
--- a/sleekxmpp/plugins/xep_0092/version.py
+++ b/sleekxmpp/plugins/xep_0092/version.py
@@ -84,5 +84,5 @@ class xep_0092(base_plugin):
result = iq.send()
if result and result['type'] != 'error':
- return result['software_version']._get_stanza_values()
+ return result['software_version'].values
return False
diff --git a/sleekxmpp/plugins/xep_0199.py b/sleekxmpp/plugins/xep_0199.py
index 2e99ae76..16e79e26 100644
--- a/sleekxmpp/plugins/xep_0199.py
+++ b/sleekxmpp/plugins/xep_0199.py
@@ -33,7 +33,7 @@ class xep_0199(base.base_plugin):
def scheduled_ping(self):
log.debug("pinging...")
- if self.sendPing(self.xmpp.server, self.config.get('timeout', 30)) is False:
+ if self.sendPing(self.xmpp.boundjid.host, self.config.get('timeout', 30)) is False:
log.debug("Did not recieve ping back in time. Requesting Reconnect.")
self.xmpp.reconnect()
diff --git a/sleekxmpp/plugins/xep_0202.py b/sleekxmpp/plugins/xep_0202.py
index fe1191ea..3b31c97a 100644
--- a/sleekxmpp/plugins/xep_0202.py
+++ b/sleekxmpp/plugins/xep_0202.py
@@ -27,10 +27,12 @@ class EntityTime(ElementBase):
interfaces = set(('tzo', 'utc'))
sub_interfaces = set(('tzo', 'utc'))
- #def get_utc(self): # TODO: return a datetime.tzinfo object?
+ #def get_tzo(self):
+ # TODO: Right now it returns a string but maybe it should
+ # return a datetime.tzinfo object or maybe a datetime.timedelta?
#pass
- def set_tzo(self, tzo): # TODO: support datetime.tzinfo objects?
+ def set_tzo(self, tzo):
if isinstance(tzo, tzinfo):
td = datetime.now(tzo).utcoffset() # What if we are faking the time? datetime.now() shouldn't be used here'
seconds = td.seconds + td.days * 24 * 3600
@@ -45,7 +47,7 @@ class EntityTime(ElementBase):
# Returns a datetime object instead the string. Is this a good idea?
value = self._get_sub_text('utc')
if '.' in value:
- return datetime.strptime(value, '%Y-%m-%d.%fT%H:%M:%SZ')
+ return datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%fZ')
else:
return datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')