Use boundjid in plugins instead of the deprecated accessors.

Originally contributed by skinkie, with a few modifications.
This commit is contained in:
Lance Stout 2010-12-16 15:38:00 -05:00
parent e81683beee
commit 67775fb8bd
5 changed files with 21 additions and 21 deletions

View file

@ -143,7 +143,7 @@ class gmail_notify(base.base_plugin):
log.info('Gmail: Searching for emails matching: "%s"' % query) log.info('Gmail: Searching for emails matching: "%s"' % query)
iq = self.xmpp.Iq() iq = self.xmpp.Iq()
iq['type'] = 'get' iq['type'] = 'get'
iq['to'] = self.xmpp.jid iq['to'] = self.xmpp.boundjid.bare
iq['gmail']['q'] = query iq['gmail']['q'] = query
iq['gmail']['newer-than-time'] = newer iq['gmail']['newer-than-time'] = newer
return iq.send() return iq.send()

View file

@ -271,7 +271,7 @@ class xep_0045(base.base_plugin):
def invite(self, room, jid, reason=''): def invite(self, room, jid, reason=''):
""" Invite a jid to a room.""" """ Invite a jid to a room."""
msg = self.xmpp.makeMessage(room) msg = self.xmpp.makeMessage(room)
msg['from'] = self.xmpp.jid msg['from'] = self.xmpp.boundjid.bare
x = ET.Element('{http://jabber.org/protocol/muc#user}x') x = ET.Element('{http://jabber.org/protocol/muc#user}x')
invite = ET.Element('{http://jabber.org/protocol/muc#user}invite', {'to': jid}) invite = ET.Element('{http://jabber.org/protocol/muc#user}invite', {'to': jid})
if reason: if reason:
@ -294,7 +294,7 @@ class xep_0045(base.base_plugin):
def getRoomConfig(self, room): def getRoomConfig(self, room):
iq = self.xmpp.makeIqGet('http://jabber.org/protocol/muc#owner') iq = self.xmpp.makeIqGet('http://jabber.org/protocol/muc#owner')
iq['to'] = room iq['to'] = room
iq['from'] = self.xmpp.jid iq['from'] = self.xmpp.boundjid.bare
result = iq.send() result = iq.send()
if result is None or result['type'] != 'result': if result is None or result['type'] != 'result':
raise ValueError raise ValueError
@ -316,7 +316,7 @@ class xep_0045(base.base_plugin):
query.append(x) query.append(x)
iq = self.xmpp.makeIqSet(query) iq = self.xmpp.makeIqSet(query)
iq['to'] = room iq['to'] = room
iq['from'] = self.xmpp.jid iq['from'] = self.xmpp.boundjid.bare
iq.send() iq.send()
def getJoinedRooms(self): def getJoinedRooms(self):

View file

@ -110,7 +110,7 @@ class xep_0050(base.base_plugin):
if not id: if not id:
id = self.xmpp.getNewId() id = self.xmpp.getNewId()
iq = self.xmpp.makeIqResult(id) iq = self.xmpp.makeIqResult(id)
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
iq.attrib['to'] = to iq.attrib['to'] = to
command = ET.Element('{http://jabber.org/protocol/commands}command') command = ET.Element('{http://jabber.org/protocol/commands}command')
command.attrib['node'] = node command.attrib['node'] = node

View file

@ -51,7 +51,7 @@ class xep_0060(base.base_plugin):
pubsub.append(configure) pubsub.append(configure)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is False or result is None or result['type'] == 'error': return False if result is False or result is None or result['type'] == 'error': return False
@ -63,15 +63,15 @@ class xep_0060(base.base_plugin):
subscribe.attrib['node'] = node subscribe.attrib['node'] = node
if subscribee is None: if subscribee is None:
if bare: if bare:
subscribe.attrib['jid'] = self.xmpp.jid subscribe.attrib['jid'] = self.xmpp.boundjid.bare
else: else:
subscribe.attrib['jid'] = self.xmpp.fulljid subscribe.attrib['jid'] = self.xmpp.boundjid.full
else: else:
subscribe.attrib['jid'] = subscribee subscribe.attrib['jid'] = subscribee
pubsub.append(subscribe) pubsub.append(subscribe)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is False or result is None or result['type'] == 'error': return False if result is False or result is None or result['type'] == 'error': return False
@ -83,15 +83,15 @@ class xep_0060(base.base_plugin):
unsubscribe.attrib['node'] = node unsubscribe.attrib['node'] = node
if subscribee is None: if subscribee is None:
if bare: if bare:
unsubscribe.attrib['jid'] = self.xmpp.jid unsubscribe.attrib['jid'] = self.xmpp.boundjid.bare
else: else:
unsubscribe.attrib['jid'] = self.xmpp.fulljid unsubscribe.attrib['jid'] = self.xmpp.boundjid.full
else: else:
unsubscribe.attrib['jid'] = subscribee unsubscribe.attrib['jid'] = subscribee
pubsub.append(unsubscribe) pubsub.append(unsubscribe)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is False or result is None or result['type'] == 'error': return False if result is False or result is None or result['type'] == 'error': return False
@ -109,7 +109,7 @@ class xep_0060(base.base_plugin):
iq = self.xmpp.makeIqGet() iq = self.xmpp.makeIqGet()
iq.append(pubsub) iq.append(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
#self.xmpp.add_handler("<iq id='%s'/>" % id, self.handlerCreateNodeResponse) #self.xmpp.add_handler("<iq id='%s'/>" % id, self.handlerCreateNodeResponse)
result = iq.send() result = iq.send()
@ -133,7 +133,7 @@ class xep_0060(base.base_plugin):
iq = self.xmpp.makeIqGet() iq = self.xmpp.makeIqGet()
iq.append(pubsub) iq.append(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result == False or result['type'] == 'error': if result is None or result == False or result['type'] == 'error':
@ -156,7 +156,7 @@ class xep_0060(base.base_plugin):
iq = self.xmpp.makeIqGet() iq = self.xmpp.makeIqGet()
iq.append(pubsub) iq.append(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result == False or result['type'] == 'error': if result is None or result == False or result['type'] == 'error':
@ -179,7 +179,7 @@ class xep_0060(base.base_plugin):
pubsub.append(delete) pubsub.append(delete)
iq.append(pubsub) iq.append(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
result = iq.send() result = iq.send()
if result is not None and result is not False and result['type'] != 'error': if result is not None and result is not False and result['type'] != 'error':
return True return True
@ -196,7 +196,7 @@ class xep_0060(base.base_plugin):
pubsub.append(configure) pubsub.append(configure)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result['type'] == 'error': if result is None or result['type'] == 'error':
@ -217,7 +217,7 @@ class xep_0060(base.base_plugin):
pubsub.append(publish) pubsub.append(publish)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result is False or result['type'] == 'error': return False if result is None or result is False or result['type'] == 'error': return False
@ -236,7 +236,7 @@ class xep_0060(base.base_plugin):
pubsub.append(retract) pubsub.append(retract)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result is False or result['type'] == 'error': return False if result is None or result is False or result['type'] == 'error': return False
@ -287,7 +287,7 @@ class xep_0060(base.base_plugin):
pubsub.append(affs) pubsub.append(affs)
iq = self.xmpp.makeIqSet(pubsub) iq = self.xmpp.makeIqSet(pubsub)
iq.attrib['to'] = ps_jid iq.attrib['to'] = ps_jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq['id'] id = iq['id']
result = iq.send() result = iq.send()
if result is None or result is False or result['type'] == 'error': if result is None or result is False or result['type'] == 'error':

View file

@ -42,7 +42,7 @@ class xep_0092(base.base_plugin):
query = ET.Element('{jabber:iq:version}query') query = ET.Element('{jabber:iq:version}query')
iq.append(query) iq.append(query)
iq.attrib['to'] = jid iq.attrib['to'] = jid
iq.attrib['from'] = self.xmpp.fulljid iq.attrib['from'] = self.xmpp.boundjid.full
id = iq.get('id') id = iq.get('id')
result = iq.send() result = iq.send()
if result and result is not None and result.get('type', 'error') != 'error': if result and result is not None and result.get('type', 'error') != 'error':