mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Issue 26. Only set from address in reply() for components
This commit is contained in:
parent
66e92c6c9f
commit
d70a6e6f32
3 changed files with 635 additions and 628 deletions
|
@ -68,6 +68,7 @@ class ClientXMPP(basexmpp, XMLStream):
|
|||
self.sessionstarted = False
|
||||
self.bound = False
|
||||
self.bindfail = False
|
||||
self.is_component = False
|
||||
self.registerHandler(Callback('Stream Features', MatchXPath('{http://etherx.jabber.org/streams}features'), self._handleStreamFeatures, thread=True))
|
||||
self.registerHandler(Callback('Roster Update', MatchXPath('{%s}iq/{jabber:iq:roster}query' % self.default_ns), self._handleRoster, thread=True))
|
||||
#self.registerHandler(Callback('Roster Update', MatchXMLMask("<presence xmlns='%s' type='subscribe' />" % self.default_ns), self._handlePresenceSubscribe, thread=True))
|
||||
|
|
|
@ -52,6 +52,7 @@ class ComponentXMPP(basexmpp, XMLStream):
|
|||
self.server_port = port
|
||||
self.set_jid(jid)
|
||||
self.secret = secret
|
||||
self.is_component = True
|
||||
self.registerHandler(Callback('Handshake', MatchXPath('{jabber:component:accept}handshake'), self._handleHandshake))
|
||||
|
||||
def __getitem__(self, key):
|
||||
|
|
|
@ -371,7 +371,12 @@ class StanzaBase(ElementBase):
|
|||
return self
|
||||
|
||||
def reply(self):
|
||||
# if it's a component, use from
|
||||
if self.stream and hasattr(self.stream, "is_component") and self.stream.is_component:
|
||||
self['from'], self['to'] = self['to'], self['from']
|
||||
else:
|
||||
self['to'] = self['from']
|
||||
del self['from']
|
||||
self.clear()
|
||||
return self
|
||||
|
||||
|
|
Loading…
Reference in a new issue