basexmpp: make_iq no longer defaults to id="0"
having a hardcoded default ID in make_iq is a bad idea, particularly since it will overwrite the (good) id produced byt Iq() when a stream is available. This is arguably a breaking change, but I certainly hope it is not breaking anything in the real world.
This commit is contained in:
parent
2e736bc715
commit
1482bcc395
@ -315,13 +315,12 @@ class BaseXMPP(XMLStream):
|
||||
pres['lang'] = self.default_lang
|
||||
return pres
|
||||
|
||||
def make_iq(self, id: str = "0", ifrom: OptJidStr = None,
|
||||
def make_iq(self, id: Optional[str] = None, ifrom: OptJidStr = None,
|
||||
ito: OptJidStr = None, itype: Optional[IqTypes] = None,
|
||||
iquery: Optional[str] = None) -> stanza.Iq:
|
||||
"""Create a new :class:`~.Iq` stanza with a given Id and from JID.
|
||||
|
||||
:param id: An ideally unique ID value for this stanza thread.
|
||||
Defaults to 0.
|
||||
:param ifrom: The from :class:`~.JID`
|
||||
to use for this stanza.
|
||||
:param ito: The destination :class:`~.JID`
|
||||
@ -332,6 +331,7 @@ class BaseXMPP(XMLStream):
|
||||
:param iquery: Optional namespace for adding a query element.
|
||||
"""
|
||||
iq = self.Iq()
|
||||
if id is not None:
|
||||
iq['id'] = str(id)
|
||||
iq['to'] = ito
|
||||
iq['from'] = ifrom
|
||||
|
Loading…
x
Reference in New Issue
Block a user