stanza: fix circular imports
ew
This commit is contained in:
parent
42ca51e2b1
commit
5c54806578
2 changed files with 12 additions and 9 deletions
|
@ -5,7 +5,6 @@
|
||||||
# See the file LICENSE for copying permission.
|
# See the file LICENSE for copying permission.
|
||||||
from slixmpp.stanza.rootstanza import RootStanza
|
from slixmpp.stanza.rootstanza import RootStanza
|
||||||
from slixmpp.xmlstream import StanzaBase, ET
|
from slixmpp.xmlstream import StanzaBase, ET
|
||||||
from slixmpp.basexmpp import BaseXMPP
|
|
||||||
|
|
||||||
|
|
||||||
ORIGIN_NAME = '{urn:xmpp:sid:0}origin-id'
|
ORIGIN_NAME = '{urn:xmpp:sid:0}origin-id'
|
||||||
|
@ -62,8 +61,10 @@ class Message(RootStanza):
|
||||||
"""
|
"""
|
||||||
StanzaBase.__init__(self, *args, **kwargs)
|
StanzaBase.__init__(self, *args, **kwargs)
|
||||||
if not recv and self['id'] == '':
|
if not recv and self['id'] == '':
|
||||||
if isinstance(self.stream, BaseXMPP) and self.stream.use_message_ids:
|
if self.stream:
|
||||||
self['id'] = self.stream.new_id()
|
use_ids = getattr(self.stream, 'use_message_ids', None)
|
||||||
|
if use_ids:
|
||||||
|
self['id'] = self.stream.new_id()
|
||||||
else:
|
else:
|
||||||
del self['origin_id']
|
del self['origin_id']
|
||||||
|
|
||||||
|
@ -94,8 +95,10 @@ class Message(RootStanza):
|
||||||
|
|
||||||
self.xml.attrib['id'] = value
|
self.xml.attrib['id'] = value
|
||||||
|
|
||||||
if isinstance(self.stream, BaseXMPP) and not self.stream.use_origin_id:
|
if self.stream:
|
||||||
return None
|
use_orig_ids = getattr(self.stream, 'use_origin_id', None)
|
||||||
|
if not use_orig_ids:
|
||||||
|
return None
|
||||||
|
|
||||||
sub = self.xml.find(ORIGIN_NAME)
|
sub = self.xml.find(ORIGIN_NAME)
|
||||||
if sub is not None:
|
if sub is not None:
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
|
|
||||||
# Slixmpp: The Slick XMPP Library
|
# Slixmpp: The Slick XMPP Library
|
||||||
# Copyright (C) 2010 Nathanael C. Fritz
|
# Copyright (C) 2010 Nathanael C. Fritz
|
||||||
# This file is part of Slixmpp.
|
# This file is part of Slixmpp.
|
||||||
# See the file LICENSE for copying permission.
|
# See the file LICENSE for copying permission.
|
||||||
from slixmpp.stanza.rootstanza import RootStanza
|
from slixmpp.stanza.rootstanza import RootStanza
|
||||||
from slixmpp.xmlstream import StanzaBase
|
from slixmpp.xmlstream import StanzaBase
|
||||||
from slixmpp.basexmpp import BaseXMPP
|
|
||||||
|
|
||||||
|
|
||||||
class Presence(RootStanza):
|
class Presence(RootStanza):
|
||||||
|
@ -70,8 +68,10 @@ class Presence(RootStanza):
|
||||||
"""
|
"""
|
||||||
StanzaBase.__init__(self, *args, **kwargs)
|
StanzaBase.__init__(self, *args, **kwargs)
|
||||||
if not recv and self['id'] == '':
|
if not recv and self['id'] == '':
|
||||||
if isinstance(self.stream, BaseXMPP) and self.stream.use_presence_ids:
|
if self.stream:
|
||||||
self['id'] = self.stream.new_id()
|
use_ids = getattr(self.stream, 'use_presence_ids', None)
|
||||||
|
if use_ids:
|
||||||
|
self['id'] = self.stream.new_id()
|
||||||
|
|
||||||
def set_show(self, show: str):
|
def set_show(self, show: str):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue