Breaking change: Split :class:`aioxmpp.xso.AbstractType` into :class:`aioxmpp.xso.AbstractCDataType` (for which the :class:`aioxmpp.xso.AbstractType` was originally intended) and :class:`aioxmpp.xso.AbstractElementType` (which it has become through organic growth). This split serves the maintainability of the code and offers opportunities for better error detection.
Breaking change: :meth:`aioxmpp.BookmarkService.get_bookmarks` now returns a list instead of a :class:`aioxmpp.bookmarks.Storage` and :meth:`aioxmpp.BookmarkService.set_bookmarks` now accepts a list. The list returned by the get method and its elements must not be modified.
Deprecation: The above split also caused a split of :class:`aioxmpp.xso.EnumType` into :class:`aioxmpp.xso.EnumCDataType` and :class:`aioxmpp.xso.EnumElementType`. :func:`aioxmpp.xso.EnumType` is now a function which transparently creates the correct class. Use of that function is deprecated and you should upgrade your code to use one of the two named classes explicitly.
Make :mod:`aioopenssl` a mandatory dependency.
Replace :mod:`orderedset` with :mod:`sortedcollections`.
Make :meth:`aioxmpp.muc.Room.send_message_tracked` a normal method instead of a coroutine (it was never intended to be a coroutine).
Emit :meth:`aioxmpp.im.conversation.AbstractConversation.on_message` for MUC messages sent via :meth:`~aioxmpp.muc.Room.send_message_tracked`.
Add
tracker
argument to :meth:`aioxmpp.im.conversation.AbstractConversation.on_message`. It carries a :class:`aioxmpp.tracking.MessageTracker` for sent messages (including those sent by other resources of the account in the same conversation).Fix (harmless) traceback in logs which could occur when using :meth:`aioxmpp.muc.Room.send_message_tracked`.
Fix :func:`aioxmpp.service.is_depsignal_handler` and :func:`~aioxmpp.service.is_attrsignal_handler` when used with
defer=True
.You can now register custom bookmark classes with :func:`aioxmpp.bookmarks.as_bookmark_class`. The bookmark classes must subclass the ABC :class:`aioxmpp.bookmarks.Bookmark`.
Implement :func:`aioxmpp.callbacks.first_signal`.
Support for passing a function returning an awaitable as callback to :meth:`aioxmpp.stream.StanzaStream.register_iq_request_coro`. In contrast to coroutines, a callback function can exploit the strong ordering guarantee of the XMPP XML Stream.
Support for passing a callback function to :meth:`aioxmpp.stream.StanzaStream.send` which is invoked on responses to an IQ request sent through :meth:`~aioxmpp.stream.StanzaStream.send`. In contrast to awaiting the result of :meth:`~aioxmpp.stream.StanzaStream.send`, the callback can exploit the strong ordering guarantee of the XMPP XML Stream.
Deprecation: The name :meth:`aioxmpp.stream.StanzaStream.register_iq_request_coro` is deprecated in favour of :meth:`~aioxmpp.stream.StanzaStream.register_iq_request_handler`. The old alias persists, but will be removed with the release of 1.0. Using the old alias emits a warning.
Likewise, :meth:`~aioxmpp.stream.StanzaStream.unregister_iq_request_coro` was renamed to :meth:`~aioxmpp.stream.StanzaStream.unregister_iq_request_handler`.
The :func:`aioxmpp.service.iq_handler` decorator function now allows normal functions to be decorated (in addition to coroutine functions).
Specify :meth:`aioxmpp.im.conversation.AbstractConversation.on_enter` and :meth:`~aioxmpp.im.conversation.AbstractConversation.on_failure` events and implement emission of those for the existing conversation implementations.
Specify that :term:`Conversation Services <Conversation Service>` must provide a non-coroutine method to start a conversation. Asynchronous parts have to happen in the background. To await the completion of the initialisation of the conversation, use :func:`aioxmpp.callbacks.first_signal` as described in :meth:`aioxmpp.im.conversation.AbstractConversation.on_enter`.
Make :meth:`aioxmpp.im.p2p.Service.get_conversation` a normal method.
Possibly breaking change: :meth:`aioxmpp.muc.Room.send_message` is not a coroutine anymore, but it returns an awaitable; this means that in most cases, this should not break.
:meth:`~aioxmpp.muc.Room.send_message` was a coroutine by accident; it should never have been that, according to the specification in :meth:`aioxmpp.im.conversation.AbstractConversation.send_message`.
Fixed duplicate emission of :meth:`~aioxmpp.im.conversation.AbstractConversation.on_message` events for untracked (sent through :meth:`aioxmpp.muc.Room.send_message`) MUC messages.
Re-read the nameserver config if :class:`dns.resolver.NoNameservers` is raised during a query using the thread-local global resolver (the default).
The resolver config is only reloaded up to once for each query; any further errors are treated as authoritative / related to the zone.
Add :meth:`aioxmpp.protocol.XMLStream.mute` context manager to suppress debug logging of stream contents.
Exclude authentication information sent during SASL.
The :meth:`aioxmpp.muc.Room.on_message` events fired during :xep:`45` history replay now always have a non-:data:`None` member argument.
Please see the documentation of the event for some caveats of this member argument as well as the rationale.
Note
Prosody ≤ 0.9.12 (for the 0.9 branch) and ≤ 0.10.0 (for the 0.10 branch) are affected by Prosody issue #1053.
This means that by itself, :class:`aioxmpp.muc.Room` cannot detect that history replay is over and will stay in the history replay state forever. However, two workarounds help with that: once the first live message is or the first presence update is received, the :class:`~aioxmpp.muc.Room` will assume a buggy server and transition to :attr:`~aioxmpp.muc.RoomState.ACTIVE` state.
These workarounds are not perfect; in particular it is possible that the first message workaround is defeated if a client includes a
<delay/>
into that message.Until either a fixed version of Prosody is used or the workarounds take effect, the following issues will be observed:
- :attr:`aioxmpp.muc.Occupant.uid` will not be useful in any way (but also not harmful, security-wise).
- :meth:`aioxmpp.muc.Room.on_message` may receive member arguments which are not part of the :attr:`aioxmpp.muc.Room.members` and which may also lack other information (such as bare JIDs).
- :attr:`aioxmpp.muc.Room.muc_state` will not reach the :attr:`aioxmpp.muc.RoomState.ACTIVE` state.
Applications which support e.g. :xep:`85` (Chat State Notifications) may use a chat state notification (for example, active or inactive) to cause a message to be received from the MUC, forcing the transition to :attr:`~aioxmpp.muc.RoomState.ACTIVE` state.
Introduce :attr:`aioxmpp.im.conversation.AbstractConversationMember.uid` attribute which can be used to re-identify entities in conversations across reboots and rejoins.
Breaking change: Since multiple
<delay/>
elements can occur in a stanza, :attr:`aioxmpp.Message.xep0203_delay` is now a list instead of a single :class:`aioxmpp.misc.Delay` object. Sorry for the inconvenience.Possibly breaking change: The type of the value of :class:`aioxmpp.xso.Collector` descriptors was changed from :class:`list` to :class:`lxml.etree.Element`.
Breaking change: Assignment to :class:`aioxmpp.xso.Collector` descriptors is now forbidden.
New erroneous_as_absent argument to :class:`aioxmpp.xso.Attr`, :class:`~aioxmpp.xso.Text` and :class:`~aioxmpp.xso.ChildText`. See the documentation of :class:`~aioxmpp.xso.Attr` for details.
Treat absent
@type
XML attribute on message stanzas as :class:`aioxmpp.MessageType.NORMAL`, as specified in RFC 6121, section 5.2.2.Treat empty
<show/>
XML child on presence stanzas like absent<show/>
. This is not legal as per RFC 6120, but apparently there are some broken implementations out there.Not having this workaround leads to being unable to receive presence stanzas from those entities, which is rather unfortunate.
Breaking change: :meth:`aioxmpp.muc.Room.on_enter` does not receive any arguments anymore to comply with the updated :class:`aioxmpp.im.AbstractConversation` spec. The :meth:`aioxmpp.muc.Room.on_muc_enter` event provides the arguments :meth:`~aioxmpp.muc.Room.on_enter` received before and fires right after :meth:`~aioxmpp.muc.Room.on_enter`.
As a workaround (if you need the arguments), you can test whether the :meth:`~aioxmpp.muc.Room.on_muc_enter` exists on a :class:`~aioxmpp.muc.Room`. If it does, connect to it, otherwise connect to :meth:`~aioxmpp.muc.Room.on_enter`.
If you don’t need the arguments, make your :meth:`~aioxmpp.muc.Room.on_enter` handlers accept
*args
.:func:`aioxmpp.service.iq_handler` now checks that its payload class is in fact registered as IQ payload and raises :class:`ValueError` if not.
Breaking change: :meth:`aioxmpp.AvatarService.get_avatar_metadata` now returns a list instead of a mapping from MIME types to lists of descriptors.
:func:`aioxmpp.node.discover_connectors` will now continue of only one of the two SRV lookups fails with the DNSPython :class:`dns.resolver.NoNameservers` exception; this case might still indicate a configuration issue (so we log it), but since we actually got a useful result on the other query, we can still continue.
:func:`aioxmpp.node.discover_connectors` now uses a proper fully-qualified domain name (including the trailing dot) for DNS queries to avoid improper fallback to locally configured search domains.
Ignore presence stanzas from the bare JID of a joined MUC, even if they contain a MUC user tag. A functional MUC should never emit this.
We now will always attempt STARTTLS negotiation if :attr:`aioxmpp.security_layer.SecurityLayer.tls_required` is true, even if the server does not advertise a STARTTLS stream feature. This is because we have nothing to lose, and it may mitigate some types of STARTTLS stripping attacks.
Compatibility fixes for ejabberd (cf. ejabberd#2287 and ejabberd#2288).
Harden MUC implementation against incomplete presence stanzas.
Support for escaping additional characters as entities when writing XML, see the additional_escapes argument to :class:`aioxmpp.xml.XMPPXMLGenerator`.
Add cb argument to :func:`aioxmpp.protocol.send_and_wait_for` to allow to act synchronously on the response. This is needed for transactional things like stream management.
Fix a race condition where stream management handlers would be installed too late on the XML stream, leading it to be closed with an
unsupported-stanza-type
because :mod:`aioxmpp` failed to interpret SM requests.Move :meth:`aioxmpp.stream.StanzaStream.enqueue` and :meth:`aioxmpp.stream.StanzaStream.send` to the client as :meth:`aioxmpp.Client.enqueue` and :meth:`aioxmpp.Client.send`.
The old names are deprecated, but aliases are provided until version 1.0.
:meth:`aioxmpp.Client.enqueue` now raises :class:`ConnectionError` if the stream of the client is not :attr:`aioxmpp.Client.established` yet.
:meth:`aioxmpp.Client.send` now blocks until the stream of the client is :attr:`aioxmpp.Client.established`.
Support for the new :xep:`45` 1.30 status code for kicks due to errors. See :attr:`aioxmpp.muc.LeaveMode.ERROR`.
Minor compatibility fixes for :xep:`153` vcard-based avatar support.
Add a global IM :meth:`aioxmpp.im.service.Conversation.on_message` event. This aggregates message events from all conversations.
This can be used by applications which want to perform central processing of all IM messages, for example for logging purposes. :class:`aioxmpp.im.service.Conversation` handles the lifecycle of event listeners to the individual conversations, which takes some burden off of the application.
:meth:`aioxmpp.muc.Room.on_message` now always has a non-:data:`None` member argument. If a message is received from an unknown occupant JID, a temporary :class:`aioxmpp.muc.Occupant` object is created. See the :meth:`~aioxmpp.muc.Room.on_message` docs for details.
Support for some parts of the :xep:`60` schema. No support for actually sending or receiving files via the :xep:`60` IQ.
Support for the :xep:`333` schema.
Fix a bug where monkey-patched :class:`aioxmpp.xso.ChildFlag` descriptors would not be picked up by the XSO handling code.
Make sure that the message ID is set before the :attr:`aioxmpp.im.conversation.AbstractConversation.on_message` event is emitted from :class:`aioxmpp.im.p2p.Conversation` objects.
Ensure that all :attr:`aioxmpp.MessageType.CHAT`/:attr:`~aioxmpp.MessageType.NORMAL` messages are forwarded to the respective :class:`aioxmpp.im.p2p.Conversation` if it exists.
(Previously, only messages with a non-empty :attr:`aioxmpp.Message.body` would be forwarded.)
This is needed for e.g. Chat Markers.
Ensure that Message Carbons are re-:meth:`aioxmpp.carbons.CarbonsClient.enable`-d after failed stream resumption. Thanks, Ge0rG.
Fix RFC 6121 violation: the default of the
@subscription
attribute of roster items is"none"
. :mod:`aioxmpp` treated an absent attribute as fatal.Pass pre-stream-features exception down to stream feature listeners. This fixes hangs on errors before the stream features are received. This can happen with misconfigured SRV records or lack of ALPN support in a :xep:`368` setting. Thanks to Travis Burtrum for providing a test setup for hunting this down.
Set ALPN to
xmpp-client
by default. This is useful for :xep:`368` deployments.Fix handling of SRV records with equal priority, weight, hostname and port.
:mod:`aioxmpp.misc` provides XSO definitions for the :xep:`379`
preauth
element.Support for
<optional/>
element in RFC 3921<session/>
negotiation feature; the feature is not needed with modern servers, but since legacy clients require it, they still announce it. The feature introduces a new round-trip for no gain. An rfc-draft by Dave Cridland standardises the<optional/>
element which allows a server to tell the client that it doesn’t require the session negotiation step. :mod:`aioxmpp` now understands this and will skip that step, saving a round-trip with most modern servers.:mod:`aioxmpp.tracking` now allows some state transitions out of the :attr:`aioxmpp.tracking.MessageState.ERROR` state. See the documentation there for details.
Fix a bug in :meth:`aioxmpp.JID.fromstr` which would incorrectly parse and then reject some valid JIDs.
Remove restriction on data form types (not to be confused with
FORM_TYPE
) when instantiating a form with :meth:`aioxmpp.forms.Form.from_xso`.Fix an issue which prevented single-valued form fields from being rendered into XSOs if no value had been set (but a default was given).
Ensure that forms with :attr:`aioxmpp.forms.Form.FORM_TYPE` attribute render a proper :xep:`68`
FORM_TYPE
field.Allow unset field type in data forms. This may seem weird, but unfortunately it is widespread practice. In some data form types, omitting the field type is common (including it is merely a MAY in the XEP), and even in the most strict case it is only a SHOULD.
Relying on the field type to be present is thus a non-starter.
Support for answering requests for voice/role change in MUCs (cf. XEP-0045 §8.6 Approving Voice Requests). See :meth:`aioxmpp.muc.Room.on_muc_role_request` for details.
Support for unwrapped unknown values in :class:`aioxmpp.xso.EnumCDataType`. This can be used with :class:`enum.IntEnum` for fun and profit.
The signals :meth:`aioxmpp.muc.Room.on_muc_enter`, :meth:`~aioxmpp.muc.Room.on_exit`, :meth:`~aioxmpp.muc.Room.on_leave`, :meth:`~aioxmpp.muc.Room.on_join`, :meth:`~aioxmpp.muc.Room.on_muc_role_changed`, and :meth:`~aioxmpp.muc.Room.on_muc_affiliation_changed` now receive the set of status codes which was included in the triggering stanza as keyword argument.
- :mod:`aioxmpp.bookmarks` (:xep:`48`): Support for accessing bookmark storage (currently only from Private XML storage).
- :mod:`aioxmpp.private_xml` (:xep:`49`): Support for accessing a server-side account-private XML storage.
- :mod:`aioxmpp.avatar` (:xep:`84`): Support for retrieving avatars, notifications for changed avatars in contacts and setting the avatar of the account itself.
- :mod:`aioxmpp.pep` (:xep:`163`): Support for making use of the Personal Eventing Protocol, a versatile protocol used to store and publish account-specific information such as Avatars, OMEMO keys, etc. throughout the XMPP network.
- :mod:`aioxmpp.blocking` (:xep:`191`): Support for blocking contacts on the server-side.
- :mod:`aioxmpp.ping` (:xep:`199`): XMPP Ping has been used internally since the very beginning (if Stream Management is not supported), but now there’s also a service for applications to use.
- :mod:`aioxmpp.carbons` (:xep:`280`): Support for receiving carbon-copies of messages sent and received by other resources.
- :mod:`aioxmpp.entitycaps` (:xep:`390`): Support for the new Entity Capabilities 2.0 protocol was added.
Most of these have been contributed by Sebastian Riese. Thanks for that!
:mod:`aioxmpp.im` is a new subpackage which provides Instant Messaging services. It is still highly experimental, and feedback on the API is highly appreciated.
The idea is to provide a unified interface to the different instant messaging transports, such as direct one-on-one chat, Multi-User Chats (:xep:`45`) and the soon-to-come Mediated Information Exchange (:xep:`369`).
Applications shall be able to use the interface without knowing the details of the transport; features such as message delivery receipts and message carbons shall work transparently.
In the course of this (see below), some breaking changes had to be made, but we think that the gain is worth the damage.
For an introduction in those features, read the documentation of the :mod:`aioxmpp.im` subpackage. The examples using IM features have been updated accordingly.
The distribution of received presence and message stanzas has been reworked (to help with :mod:`aioxmpp.im`, which needs a very different model of message distribution than the traditional "register a handler for a sender and type"). The classic registration functions have been deprecated (see below) and were replaced by simple dispatcher services provided in :mod:`aioxmpp.dispatcher`.
carbons_sniffer.py
: Show a log of all messages received and sent by other resources of the same account.set_avatar.py
: Change the avatar of the account.retrieve_avatar.py
: Retrieve the avatar of a member of the XMPP network (sufficient permissions required, normally a roster subscription is enough).
Classes using :func:`aioxmpp.service.message_handler` or :func:`aioxmpp.service.presence_handler` have to declare :class:`aioxmpp.dispatcher.SimpleMessageDispatcher` or :class:`aioxmpp.dispatcher.SimplePresenceDispatcher` (respectively) in their dependencies.
A backward-compatible way to do so is to declare the dependency conditionally:
class FooService(aioxmpp.service.Service): ORDER_AFTER = [] try: import aioxmpp.dispatcher except ImportError: pass else: ORDER_AFTER.append( aioxmpp.dispatcher.SimpleMessageDispatcher )
:class:`aioxmpp.stream.Filter` got renamed to :class:`aioxmpp.callbacks.Filter`. This should normally not affect your code.
Re-write of :mod:`aioxmpp.tracking` for :mod:`aioxmpp.im`. Sorry. But the new API is more clearly defined and more correct. The (ab-)use of :class:`aioxmpp.statemachine.OrderedStateMachine` never really worked anyways.
Re-design of interface to :mod:`aioxmpp.muc`. This is unfortunate, but we did not see a way to reasonably provide backward-compatibility while still allowing for a clean integration with :mod:`aioxmpp.im`.
Re-design of :class:`aioxmpp.entitycaps` to support :xep:`390`. The interface of the :class:`aioxmpp.entitycaps.Cache` class has been redesigned and some internal classes and functions have been renamed.
:attr:`aioxmpp.IQ.payload`, :attr:`aioxmpp.pubsub.xso.Item.registered_payload` and :attr:`aioxmpp.pubsub.xso.EventItem.registered_payload` now strictly check the type of objects assigned. The classes of those objects must be registered with :meth:`aioxmpp.IQ.as_payload_class` or :func:`aioxmpp.pubsub.xso.as_payload_class`, respectively.
Technically, that requirement existed always as soon as one wanted to be able to receive those payloads: otherwise, one would simply not receive the payload, but an exception or empty object instead. By enforcing this requirement also for sending, we hope to improve the debugability of these issues.
The descriptors and decorators for :class:`aioxmpp.service.Service` subclasses are now initialised in the order they are declared.
This should normally not affect you, there are only very specific corner-cases where it makes a difference.
Handle local serialisation issues more gracefully. Instead of sending a half-serialised XSO down the stream and then raising an exception, leaving the stream in an undefined state, XSOs are now serialised into a buffer (which is re-used for performance when possible) and only if serialisation was successful sent down the stream.
Replaced the hack-ish use of generators for :func:`aioxmpp.xml.write_xmlstream` with a proper class, :class:`aioxmpp.xml.XMLStreamWriter`.
The generator blew up when we tried to exfiltrate exceptions from it. For the curious and brave, see the
bug/odd-exception-thing
branch. I actually suspect a CPython bug there, but I was unable to isolate a proper test case. It only blows up in the end-to-end tests.:mod:`aioxmpp.dispatcher`: This is in connection with the :mod:`aioxmpp.im` package
:mod:`aioxmpp.misc` provides XSO definitions for two minor XMPP protocol parts (:xep:`203`, :xep:`297`), which are however reused in some of the protocols implemented in this release.
:mod:`aioxmpp.hashes` (:xep:`300`): Friendly interface to the hash functions and hash function names defined in :xep:`300`.
:xep:`Stream Management <198>` counters now wrap around as unsigned 32 bit integers, as the standard specifies.
:func:`aioxmpp.service.depsignal` now supports connecting to :class:`aioxmpp.stream.StanzaStream` and :class:`aioxmpp.Client` signals.
Unknown and unhandled IQ get/set payloads are now replied to with
<service-unavailable/>
instead of<feature-not-implemented/>
, as the former is actually specified in RFC 6120 section 8.4.The :class:`aioxmpp.protocol.XMLStream` loggers for :class:`aioxmpp.Client` objects are now a child of the client logger itself, and not at
aioxmpp.XMLStream
.Fix bug in :class:`aioxmpp.EntityCapsService` rendering it useless for providing caps hashes to other entities.
Fix :meth:`aioxmpp.callbacks.AdHocSignal.future`, which was entirely unusable before.
:func:`aioxmpp.service.depfilter`: A decorator (similar to the :func:`aioxmpp.service.depsignal` decorator) which allows to add a :class:`aioxmpp.service.Service` method to a :class:`aioxmpp.callbacks.Filter` chain.
Fix :attr:`aioxmpp.RosterClient.groups` not being updated when items are removed during initial roster update.
The two signals :meth:`aioxmpp.RosterClient.on_group_added`, :meth:`~aioxmpp.RosterClient.on_group_removed` were added, which allow to track which groups exist in a roster at all (a group exists if there’s at least one member).
Roster pushes are now accepted also if the :attr:`~.StanzaBase.from_` is the bare local JID instead of missing/empty (those are semantically equivalent).
:class:`aioxmpp.disco.RegisteredFeature` and changes to :class:`aioxmpp.disco.register_feature`. Effectively, attributes described by :class:`~aioxmpp.disco.register_feature` now have an :attr:`~aioxmpp.disco.RegisteredFeature.enabled` attribute which can be used to temporarily or permanently disable the registration of the feature on a service object.
The :meth:`aioxmpp.disco.StaticNode.clone` method allows to copy another :meth:`aioxmpp.disco.Node` as a :class:`aioxmpp.disco.StaticNode`.
The :meth:`aioxmpp.disco.Node.as_info_xso` methdo creates a :class:`aioxmpp.disco.xso.InfoQuery` object containing the features and identities of the node.
The strict argument was added to :class:`aioxmpp.xso.Child`. It allows to enable strict type checking of the objects assigned to the descriptor. Only those objects whose classes have been registered with the descriptor can be assigned.
This helps with debugging issues for "extensible" descriptors such as the :attr:`aioxmpp.IQ.payload` as described in the Breaking Changes section of this release.
:class:`aioxmpp.DiscoClient` now uses :class:`aioxmpp.cache.LRUDict` for its internal caches to prevent memory exhaustion in long running applications and/or with malicious peers.
:meth:`aioxmpp.DiscoClient.query_info` now supports a no_cache argument which prevents caching of the request and response.
:func:`aioxmpp.service.attrsignal`: A decorator (similar to the :func:`aioxmpp.service.depsignal` decorator) which allows to connect to a signal on a descriptor.
The default of XSO descriptors has incorrectly been passed through the validator, despite the documentation saying otherwise. This has been fixed.
:attr:`aioxmpp.Client.resumption_timeout`: Support for specifying the lifetime of a Stream Management (:xep:`198`) session and disabling stream resumption altogether. Thanks to @jomag for bringing up the use-case.
Fix serialisation of :class:`aioxmpp.xso.Collector` descriptors.
Make :class:`aioxmpp.xml.XMPPXMLGenerator` avoid the use of namespace prefixes if a namespace is undeclared if possible.
Attempt to reconnect if generic OpenSSL errors occur. Thanks to @jomag for reporting.
The new :meth:`aioxmpp.stream.StanzaStream.on_message_received`, :meth:`~aioxmpp.stream.StanzaStream.on_presence_received` signals unconditionally fire when a message or presence is received. They are used by the :mod:`aioxmpp.dispatcher` and :mod:`aioxmpp.im` implementations.
The following methods on :class:`aioxmpp.stream.StanzaStream` have been deprecated and will be removed in 1.0:
- :meth:`~.StanzaStream.register_message_callback`
- :meth:`~.StanzaStream.unregister_message_callback`
- :meth:`~.StanzaStream.register_presence_callback`
- :meth:`~.StanzaStream.unregister_presence_callback`
The former two are replaced by the :class:`aioxmpp.dispatcher.SimpleMessageDispatcher` service and the latter two should be replaced by proper use of the :class:`aioxmpp.PresenceClient` or by :class:`aioxmpp.dispatcher.SimplePresenceDispatcher` if the :class:`~aioxmpp.PresenceClient` is not sufficient.
:func:`aioxmpp.stream.stanza_filter` got renamed to :meth:`aioxmpp.callbacks.Filter.context_register`.
Slight Breaking change (yes, I know!) to fix a crucial bug with Python 3.4.6. :func:`aioxmpp.node.discover_connectors` now takes a :class:`str` argument instead of :class:`bytes` for the domain name. Passing a :class:`bytes` will fail.
As this issue prohibited use with Python 3.4.6 under certain circumstances, we had to make a slight breaking change in a minor release. We also consider :func:`~aioxmpp.node.discover_connectors` to be sufficiently rarely useful to warrant breaking compatibility here.
For the same reason, :func:`aioxmpp.network.lookup_srv` now returns :class:`bytes` for hostnames instead of :class:`str`.
Fix issues with different versions of :mod:`pyasn1`.
- :mod:`aioxmpp.adhoc` (:xep:`50`): Support for using Ad-Hoc commands; publishing own Ad-Hoc commands for others to use is not supported yet.
Services (see :mod:`aioxmpp.service`) are now even easier to write, using the new :ref:`api-aioxmpp.service-decorators`. These allow automagically registering methods as handlers or filters for stanzas and other often-used things.
Existing services have been ported to this new system, and we recommend to do the same with your own services!
:mod:`aioxmpp` now supports end-to-end testing using an XMPP server (such as Prosody). For the crude details see :mod:`aioxmpp.e2etest` and the :ref:`dg-end-to-end-tests` section in the Developer Guide. The :mod:`aioxmpp.e2etest` API is still highly experimental and should not be used outside of :mod:`aioxmpp`.
adhoc_browser
: A graphical tool to browse and execute Ad-Hoc Commands. Requires PyQt5. Runmake
in the examples directory and start withpython3 -m adhoc_browser
.entity_items.py
,entity_info.py
: Show service discovery info and items for arbitrary JIDs.list_adhoc_commands.py
: List the Ad-Hoc commands offered by an entity.
Changes to the connection procedure:
- If any of the connection errors encountered in :meth:`aioxmpp.node.connect_xmlstream` is a :class:`aioxmpp.errors.TLSFailure` and all other connection options also failed, the :class:`~.errors.TLSFailure` is re-raised instead of a :class:`aioxmpp.errors.MultiOSError` instance. This helps to prevent masking of configuration problems.
- The change of :meth:`aioxmpp.node.connect_xmlstream` described above also affects the behaviour of :class:`aioxmpp.Client`, as :class:`~.errors.TLSFailure` errors are treated as critical (in contrast to :class:`OSError` subclasses).
Changes in :class:`aioxmpp.Client` (formerly :class:`aioxmpp.AbstractClient`, see in the deprecations below for the name change)
- The number of connection attempts made before the first connection is successful is now bounded, configurable through the new parameter max_initial_attempts. The default is at 4, which gives (together with the default exponential backoff parameters) a minimum time of attempted connections of about 5 seconds.
- :meth:`~.Client.on_stream_suspended` was added (this is not a breaking change, but belongs to the :class:`aioxmpp.Client` changes discussed here).
- :meth:`~.Client.on_stream_destroyed` got a new argument reason which gives the exception which caused the stream to be destroyed.
Other breaking changes:
:attr:`aioxmpp.tracking.MessageState.UNKNOWN` renamed to :attr:`~.MessageState.CLOSED`.
:meth:`aioxmpp.disco.Node.iter_items`, :meth:`~aioxmpp.disco.Node.iter_features` and :meth:`~aioxmpp.disco.Node.iter_identities` now get the request stanza passed as first argument.
:attr:`aioxmpp.Presence.show` now uses the :class:`aioxmpp.PresenceShow` enumeration. The breakage is similar to the breakage in the 0.7 release; if I had thought of it at that time, I would have made the change back then, but it was overlooked.
Again, a utility script (
find-v0.8-type-transitions.sh
) is provided which helps finding locations of code which need changing. See the :ref:`api-changelog-0.7` for details.Presence states with
show
set to :attr:`~.PresenceShow.DND` now order highest (before, :attr:`~.PresenceShow.DND` ordered lowest). The rationale is that if a user indicates :attr:`~.PresenceShow.DND` state at one resource, one should probably respect the Do-Not-Disturb request on all resources.
The following changes are not severe, but may still break code depending on how it is used:
:class:`aioxmpp.disco.Service` was split into :class:`aioxmpp.DiscoClient` and :class:`aioxmpp.DiscoServer`.
If you need to be compatible with old versions, use code like this:
try: from aioxmpp import DiscoClient, DiscoServer except ImportError: import aioxmpp.disco DiscoClient = aioxmpp.disco.Service DiscoServer = aioxmpp.disco.Service
Type coercion in XSO descriptors now behaves differently. Previously, :data:`None` was hard-coded to be exempt from type coercion; this allowed any :class:`~.xso.Text`, :class:`~.xso.ChildText`, :class:`~.xso.Attr` and other scalar descriptor to be assigned :data:`None`, unless a validator which explicitly forbade that was installed. The use case was to have a default, absence-indicating value which is outside the valid value range of the
type_
.This is now handled by exempting the
default
of the descriptor from type coercion and thus allowing assignment of that default by default. The change thus only affects descriptors which have adefault
other than :data:`None` (which includes an unset default).
:class:`aioxmpp.stream.StanzaToken` objects are now :term:`awaitable`.
:meth:`aioxmpp.stream.StanzaStream.send` introduced as method which can be used to send arbitrary stanzas. See the docs there to observe the full awesomeness.
Improvement and fixes to :mod:`aioxmpp.muc`:
- Implemented :meth:`aioxmpp.muc.Room.request_voice`.
- Fix :meth:`aioxmpp.muc.Room.leave_and_wait` never returning.
- Do not emit :meth:`aioxmpp.muc.Room.on_join` when an unavailable presence from an unknown occupant JID is received.
Added context managers for registering a callable as stanza handler or filter temporarily:
The :attr:`aioxmpp.service.Service.dependencies` attribute was added.
Support for ANONYMOUS SASL mechanism. See :meth:`aioxmpp.security_layer.make` for details (requires aiosasl 0.3+).
Get rid of dependency on libxml2 development files. libxml2 itself is still required, both directly and indirectly (through the lxml dependency).
The :class:`aioxmpp.PresenceServer` service was introduced and the :class:`aioxmpp.PresenceManagedClient` was re-implemented on top of that.
Fix :exc:`AttributeError` being raised from
state > None
(and other comparison operators), withstate
being a :class:`aioxmpp.PresenceState` instance.The more correct :exc:`TypeError` is now raised.
The handling of stanzas with unparseable attributes and stanzas originating from the clients bare JID (i.e. from the clients server on behalf on the account) has improved.
The examples now default to
$XDG_CONFIG_HOME/aioxmpp-examples.ini
for configuration if it exists. (thanks, @mcepl).
Several classes were renamed:
- :class:`aioxmpp.node.AbstractClient` → :class:`aioxmpp.Client`
- :class:`aioxmpp.shim.Service` → :class:`aioxmpp.SHIMService`
- :class:`aioxmpp.muc.Service` → :class:`aioxmpp.MUCClient`
- :class:`aioxmpp.presence.Service` → :class:`aioxmpp.PresenceClient`
- :class:`aioxmpp.roster.Service` → :class:`aioxmpp.RosterClient`
- :class:`aioxmpp.entitycaps.Service` → :class:`aioxmpp.EntityCapsService`
- :class:`aioxmpp.pubsub.Service` → :class:`aioxmpp.PubSubClient`
The old names are still available until 1.0.
:meth:`~.StanzaStream.send_and_wait_for_sent` deprecated in favour of :meth:`~.StanzaStream.send`.
:meth:`~.StanzaStream.send_iq_and_wait_for_reply` deprecated in favour of :meth:`~.StanzaStream.send`.
:meth:`~.StanzaStream.enqueue_stanza` is now called :meth:`~aioxmpp.stream.StanzaStream.enqueue`.
The presence argument to the constructor of and the :attr:`~.UseConnected.presence` and :attr:`~.UseConnected.timeout` attributes on :class:`aioxmpp.node.UseConnected` objects are deprecated.
See the respective documentation for details on the deprecation procedure.
License change: As of version 0.7, :mod:`aioxmpp` is distributed under the terms of the GNU Lesser General Public License version 3 or later (LGPLv3+). The exact terms are, as usual, found by taking a look at
COPYING.LESSER
in the source code repository.New XEP implementations:
- :mod:`aioxmpp.forms` (:xep:`4`): An implementation of the Data Forms XEP. Take a look and see where it gets you.
New features in the :mod:`aioxmpp.xso` submodule:
- The new :class:`aioxmpp.xso.ChildFlag` descriptor is a simplification of the :class:`aioxmpp.xso.ChildTag`. It can be used where the presence or absence of a child element only signals a boolean flag.
- The new :class:`aioxmpp.xso.EnumType` type allows using a :mod:`enum` enumeration as XSO descriptor type.
Often-used names have now been moved to the :mod:`aioxmpp` namespace:
- The stanza classes :class:`aioxmpp.IQ`, :class:`aioxmpp.Message`, :class:`aioxmpp.Presence`
- The type enumerations (see below) :class:`aioxmpp.IQType`, :class:`aioxmpp.MessageType`, :class:`aioxmpp.PresenceType`
- Commonly used structures: :class:`aioxmpp.JID`, :class:`aioxmpp.PresenceState`
- Exceptions: :class:`aioxmpp.XMPPCancelError` and its buddies
Horribly Breaking Change in the future: :attr:`aioxmpp.IQ.type_`, :attr:`aioxmpp.Message.type_`, :attr:`aioxmpp.Presence.type_` and :attr:`aioxmpp.stanza.Error.type_` now use :class:`aioxmpp.xso.EnumType`, with corresponding enumerations (see docs of the respective attributes).
This will break about every piece of code ever written for aioxmpp, and it is not trivial to fix automatically. This is why the following fallbacks have been implemented:
- The :attr:`type_` attributes still accept their string (or :data:`None` in the case of :attr:`.Presence.type_`) values when being written. When being read, the attributes always return the actual enumeration value.
- The relevant enumeration members compare equal (and hash equally) to their
values. Thus,
MessageType.CHAT == "chat"
is still true (andMessageType.CHAT != "chat"
is false). - :meth:`~.StanzaStream.register_message_callback`, :meth:`~.StanzaStream.register_presence_callback`, and :meth:`~.StanzaStream.register_iq_request_coro`, as well as their corresponding un-registration methods, all accept the string variants for their arguments, internally mapping them to the actual enumeration values.
Note
As a matter of fact (good news!), with only the fallbacks and no code fixes, the :mod:`aioxmpp` test suite passes. So it is likely that you will not notice any breakage in the 0.7 release, giving you quite some time to react.
These fallbacks will be removed with aioxmpp 1.0, making the legacy use raise :exc:`TypeError` or fail silently. Each of these fallbacks currently produces a :exc:`DeprecationWarning`.
Note
:exc:`DeprecationWarning` warnings are not shown by default in Python 3. To enable them, either run the interpreter with the
-Wd
option, un-filter them explicitly usingwarnings.simplefilter("always")
at the top of your program, or explore other options as documented in :mod:`warnings`.So, now I said I will be breaking all your code, how do you fix it? There are two ways to find affected pieces of code: (1) run it with warnings (see above), which will find all affected pieces of code and (2) use the shell script provided at utils/find-v0.7-type-transitions.sh to find a subset of potentially affected pieces of code automatically. The shell script uses The Silver Searcher (ag) (find it in your distributions package repositories, I know it is there on Fedora, Arch and Debian!) and regular expressions to find common patterns. Example usage:
# find everything in the current subdirectory $ $AIOXMPPPATH/utils/find-v0.7-type-transitions.sh # only search in the foobar/ subdirectory $ $AIOXMPPPATH/utils/find-v0.7-type-transitions.sh foobar/ # only look at the foobar/baz.py file $ $AIOXMPPPATH/utils/find-v0.7-type-transitions.sh foobar/baz.py
The script was built while fixing :mod:`aioxmpp` itself after the bug. It has not found all affected pieces of code, but the vast majority. The others can be found by inspecting :exc:`DeprecationWarning` warnings being emitted.
The :func:`aioxmpp.security_layer.make` makes creating a security layer much less cumbersome than before. It provides a simple interface supporting password authentication, certificate pinning and others.
The interface of this function will be extended in the future when more authentication or certificate verification mechanisms come around.
The two methods :meth:`aioxmpp.muc.Service.get_room_config`, :meth:`aioxmpp.muc.Service.set_room_config` have been implemented, allowing to manage MUC room configurations.
Fix bug in :meth:`aioxmpp.xso.ChildValueMultiMap.to_sax` which rendered XSOs with that descriptor useless.
Fix documentation on :meth:`aioxmpp.PresenceManagedClient.set_presence`.
:class:`aioxmpp.callbacks.AdHocSignal` now logs when coroutines registered with :meth:`aioxmpp.callbacks.AdHocSignal.SPAWN_WITH_LOOP` raise exceptions or return non-:data:`None` values. See the documentation of :meth:`~aioxmpp.callbacks.AdHocSignal.SPAWN_WITH_LOOP` for details.
:func:`aioxmpp.pubsub.xso.as_payload_class` is a decorator (akin to :meth:`aioxmpp.IQ.as_payload_class`) to declare that your :class:`~aioxmpp.xso.XSO` shall be allowed as pubsub payload.
:meth:`~.StanzaStream.register_message_callback` and :meth:`~.StanzaStream.register_presence_callback` now explicitly raise :class:`ValueError` when an attempt to overwrite an existing listener is made, instead of silently replacing the callback.
Fix resource leak which would emit:
task: <Task pending coro=<OrderedStateMachine.wait_for() running at /home/horazont/Projects/python/aioxmpp/aioxmpp/statemachine.py:170> wait_for=<Future pending cb=[Task._wakeup()]> cb=[XMLStream._stream_starts_closing()]>
Improve compatibility of :mod:`aioxmpp.muc` with Prosody 0.9 and below, which misses sending the
110
status code on some presences.Handle inbound message stanzas with empty from attribute. Those are legal as per RFC 6120, but were not handled properly.
New dependencies:
- :mod:`multidict` from :mod:`aiohttp`.
- :mod:`aioopenssl`: This is the former :mod:`aioxmpp.ssl_transport` as a separate package; :mod:`aioxmpp` still ships with a fallback in case that package is not installed.
New XEP implementations:
- partial :mod:`aioxmpp.pubsub` (:xep:`60`): Everything which requires forms is not implemented yet. Publish/Subscribe/Retract and creation/deletion of nodes is verified to work (against Prosody at least).
- :mod:`aioxmpp.shim` (:xep:`131`), used for :mod:`aioxmpp.pubsub`.
- :xep:`368` support was added.
New features in the :mod:`aioxmpp.xso` subpackage:
- :class:`aioxmpp.xso.NumericRange` validator, which can be used to validate the range of any orderable type.
- :mod:`aioxmpp.xso.query`, a module which allows for running queries against XSOs. This is still highly experimental.
- :class:`aioxmpp.xso.ChildValueMultiMap` descriptor, which uses :mod:`multidict` and is used in :mod:`aioxmpp.shim`.
:mod:`aioxmpp.network` was rewritten for 0.5.4
The control over the used DNS resolver is now more sophisticated. Most notably, :mod:`aioxmpp.network` uses a thread-local resolver which is used for all queries by default.
Normally, :func:`aioxmpp.network.repeated_query` will now re-configure the resolver from system-wide resolver configuration after the first timeout occurs.
The resolver can be overridden (disabling the reconfiguration magic) using :func:`aioxmpp.network.set_resolver`.
Breaking change: :class:`aioxmpp.service.Service` does not accept a logger argument anymore; instead, it now accepts a base_logger argument. Refer to the documentation of the class for details.
The base_logger is automatically passed by :meth:`aioxmpp.node.AbstractClient.summon` on construction of the service and is the :attr:`aioxmpp.node.AbstractClient.logger` of the client instance.
Breaking change: :class:`aioxmpp.xso.XSO` subclasses (or more specifically, instances of the :class:`aioxmpp.xso.model.XMLStreamClass` metaclass) now automatically declare a :attr:`__slots__` attribute.
The mechanics are documented in detail on :attr:`aioxmpp.xso.model.XMLStreamClass.__slots__`.
Breaking change: The following functions have been removed:
- :func:`aioxmpp.node.connect_to_xmpp_server`
- :func:`aioxmpp.node.connect_secured_xmlstream`
- :func:`aioxmpp.security_layer.negotiate_stream_security`
Use :func:`aioxmpp.node.connect_xmlstream` instead, but check the docs for the slightly different semantics.
The following functions have been deprecated:
Use :class:`aioxmpp.security_layer.SecurityLayer` instead.
The existing helper function :func:`aioxmpp.security_layer.tls_with_password_based_authentication` is still live and has been modified to use the new code.
Possibly breaking change: The arguments to :meth:`aioxmpp.CertificateVerifier.pre_handshake` are now completely different. But as this method is not documented, this should not be a problem.
Possibly breaking change: Attributes starting with
_xso_
are now also reserved on subclasses of :class:`aioxmpp.xso.XSO` (together with the long-standing reservation of attributes starting withxso_
).Several bugfixes in :mod:`aioxmpp.muc`:
:meth:`aioxmpp.muc.Room.on_message` now receives a proper occupant argument if occupant data is available when the message is received.
MUCs now autorejoin correctly after a disconnect.
Fix crash when using :class:`aioxmpp.tracking.MessageTracker` (e.g. indirectly through :meth:`aioxmpp.muc.Room.send_tracked_message`).
Thanks to @gudvnir over at github for pointing this out (see issue#7).
Several bugfixes related to :class:`aioxmpp.protocol.XMLStream`:
:mod:`asyncio` errors/warnings about pending tasks being destroyed after disconnects should be gone now (:class:`aioxmpp.protocol.XMLStream` now properly cleans up its running coroutines).
The :class:`aioxmpp.protocol.XMLStream` is now closed or aborted by the :class:`aioxmpp.stream.StanzaStream` if the stream fails. This prevents lingering half-open TCP streams.
See :meth:`aioxmpp.stream.StanzaStream.on_failure` for details.
Some behaviour changes in :class:`aioxmpp.stream.StanzaStream`:
When the stream is stopped without SM enabled, the following new behaviour has been introduced:
- :attr:`~aioxmpp.stream.StanzaState.ACTIVE` stanza tokens are set to :attr:`~aioxmpp.stream.StanzaState.DISCONNECTED` state.
- Coroutines which were spawned due to them being registered with :meth:`~aioxmpp.stream.StanzaStream.register_iq_request_coro` are :meth:`asyncio.Task.cancel`-ed.
The same as above holds if the stream is closed, even if SM is enabled (as stream closure is clean and will broadcast unavailable presence server-side).
This provides more fail-safe behaviour while still providing enough feedback.
New method: :meth:`aioxmpp.stream.StanzaStream.send_and_wait_for_sent`. :meth:`~aioxmpp.stream.StanzaStream.send_iq_and_wait_for_reply` now also uses this.
New method :meth:`aioxmpp.PresenceManagedClient.connected` and new class :class:`aioxmpp.node.UseConnected`.
The former uses the latter to provide an asynchronous context manager which starts and stops a :class:`aioxmpp.PresenceManagedClient`. Intended for use in situations where an XMPP client is needed in-line. It saves a lot of boiler plate by taking care of properly waiting for the connection to be established etc.
Fixed incorrect documentation of :meth:`aioxmpp.disco.Service.query_info`. Previously, the docstring incorrectly claimed that the method would return the result of :meth:`aioxmpp.disco.xso.InfoQuery.to_dict`, while it would in fact return the :class:`aioxmpp.disco.xso.InfoQuery` instance.
Added strict arguments to :class:`aioxmpp.JID`. See the class docmuentation for details.
Added strict argument to :class:`aioxmpp.xso.JID` and made it non-strict by default. See the documentation for rationale and details.
Improve robustness against erroneous and malicious stanzas.
All parsing errors on stanzas are now caught and handled by :meth:`aioxmpp.stream._process_incoming_erroneous_stanza`, which at least logs the synopsis of the stanza as parsed. It also makes sure that stream management works correctly, even if some stanzas are not understood.
Additionally, a bug in the :class:`aioxmpp.xml.XMPPXMLProcessor` has been fixed which prevented errors in text content from being caught.
No visible side-effects: Replaced deprecated :meth:`unittest.TestCase.assertRaisesRegexp` with :meth:`unittest.TestCase.assertRaisesRegex` (thanks, Maxim).
Fix generation of IDs when sending stanzas. It has been broken for anything but IQ stanzas for some time.
Send SM acknowledgement when closing down stream. This prevents servers from sending error stanzas for the unacked stanzas ☺.
New callback mode :meth:`aioxmpp.callbacks.AdHocSignal.SPAWN_WITH_LOOP`.
:mod:`aioxmpp.connector` added. This module provides classes which connect and return a :class:`aioxmpp.protocol.XMLStream`. They also handle TLS negotiation, if any.
:class:`aioxmpp.node.AbstractClient` now accepts an override_peer argument, which may be a sequence of connection options as returned by :func:`aioxmpp.node.discover_connectors`. See the class documentation for details.
- Fix :exc:`TypeError` crashes when using :mod:`aioxmpp.entitycaps`, :mod:`aioxmpp.presence` or :mod:`aioxmpp.roster`, arising from the argument change to service classes.
Support for :xep:`0045` multi-user chats is now available in the :mod:`aioxmpp.muc` subpackage.
Mostly transparent support for :xep:`0115` (Entity Capabilities) is now available using the :mod:`aioxmpp.entitycaps` subpackage.
Support for transparent non-scalar attributes, which get mapped to XSOs. Use cases are dicts mapping language tags to strings (such as for message
body
elements) or sets of values which are represented by discrete XML elements.For this, the method :meth:`~aioxmpp.xso.AbstractType.get_formatted_type` was added to :class:`aioxmpp.xso.AbstractType` and two new descriptors, :class:`aioxmpp.xso.ChildValueMap` and :class:`aioxmpp.xso.ChildValueList`, were implemented.
.. autosummary:: ~aioxmpp.xso.ChildValueMap ~aioxmpp.xso.ChildValueList ~aioxmpp.xso.ChildTextMap
Breaking change: The above descriptors are now used at several places, breaking the way these attributes need to be accessed:
Several stability improvements have been made. A race condition during stream management resumption was fixed and :class:`aioxmpp.node.AbstractClient` instances now stop if non-:class:`OSError` exceptions emerge from the stream (as these usually indicate an implementation or user error).
:class:`aioxmpp.callbacks.AdHocSignal` now provides full exception isolation.
Support for capturing the raw XML events used for creating :class:`aioxmpp.xso.XSO` instances from SAX is now provided through :class:`aioxmpp.xso.CapturingXSO`. Helper functions to work with these events are also provided, most notably :func:`aioxmpp.xso.events_to_sax`, which can be used to re-create the original XML from those events.
The main use case is to be able to write out a transcript of received XML data, independent of XSO-level understanding for the data received, provided the parts which are understood are semantically correct (transcripts will be incomplete if parsing fails due to incorrect contents).
.. autosummary:: ~aioxmpp.xso.CapturingXSO ~aioxmpp.xso.capture_events ~aioxmpp.xso.events_to_sax
This feature is already used in :class:`aioxmpp.disco.xso.InfoQuery`, which now inherits from :class:`~aioxmpp.xso.CapturingXSO` and provides its transcript (if available) at :attr:`~aioxmpp.disco.xso.InfoQuery.captured_events`.
The core SASL implementation has been refactored in its own independent package, :mod:`aiosasl`. Only the XMPP specific parts reside in :mod:`aioxmpp.sasl` and :mod:`aioxmpp` now depends on :mod:`aiosasl`.
:meth:`aioxmpp.stream.StanzaStream.register_message_callback` is more clearly specified now, a bug in the documentation has been fixed.
:mod:`aioxmpp.stream_xsos` is now called :mod:`aioxmpp.nonza`, in accordance with :xep:`0360`.
:class:`aioxmpp.xso.Date` and :class:`aioxmpp.xso.Time` are now available to for :xep:`0082` use. In addition, support for the legacy date time format is now provided in :class:`aioxmpp.xso.DateTime`.
.. autosummary:: ~aioxmpp.xso.Date ~aioxmpp.xso.Time ~aioxmpp.xso.DateTime
The Python 3.5 compatibility of the test suite has been improved. In a corner-case, :class:`StopIteration` was emitted from
data_received
, which caused a test to fail with a :class:`RuntimeError` due to implementation of PEP 0479 in Python 3.5. See the issue at github.Helper functions for reading and writing single XSOs (and their children) to binary file-like objects have been introduced.
.. autosummary:: ~aioxmpp.xml.write_single_xso ~aioxmpp.xml.read_xso ~aioxmpp.xml.read_single_xso
In 0.5.4, :mod:`aioxmpp.network` was re-written. More details will follow in the 0.6 changelog. The takeaway is that the network stack now automatically reloads the DNS configuration after the first timeout, to accomodate to changing resolvers.
Documentation change: A simple sphinx extension has been added which auto-detects coroutines and adds a directive to mark up signals.
The latter has been added to relevant places and the former automatically improves the documentations quality.
:class:`aioxmpp.roster.Service` now implements presence subscription management. To track the presence of peers, :mod:`aioxmpp.presence` has been added.
:mod:`aioxmpp.stream` and :mod:`aioxmpp.nonza` are part of the public API now. :mod:`aioxmpp.nonza` has gained the XSOs for SASL (previously in :mod:`aioxmpp.sasl`) and StartTLS (previously in :mod:`aioxmpp.security_layer`).
:class:`aioxmpp.xso.XSO` subclasses now support copying and deepcopying.
:mod:`aioxmpp.protocol` has been moved into the internal API part.
:class:`aioxmpp.Message` specification fixed to have
"normal"
as default for :attr:`~aioxmpp.Message.type_` and relax the unknown child policy.Possibly breaking change: :attr:`aioxmpp.xso.XSO.DECLARE_NS` is now automatically generated by the meta class :class:`aioxmpp.xso.model.XMLStreamClass`. See the documentation for the detailed rules.
To get the old behaviour for your class, you have to put
DECLARE_NS = {}
in its declaration.:class:`aioxmpp.stream.StanzaStream` has a positional, optional argument (local_jid) for ejabberd compatiblity.
Several fixes and workarounds, finally providing ejabberd compatibility:
- :class:`aioxmpp.nonza.StartTLS` declares its namespace prefixless. Otherwise, connections to some versions of ejabberd fail in a very humorous way: client says "I want to start TLS", server says "You have to use TLS" and closes the stream with a policy-violation stream error.
- Most XSOs now declare their namespace prefixless, too.
- Support for legacy (RFC 3921) XMPP session negotiation implemented in :class:`aioxmpp.node.AbstractClient`. See :mod:`aioxmpp.rfc3921`.
- :class:`aioxmpp.stream.StanzaStream` now supports incoming IQs with the bare JID of the local entity as sender, taking them as coming from the server.
Allow pinning of certificates for which no issuer certificate is available, because it is missing in the server-provided chain and not available in the local certificate store. This is, with respect to trust, treated equivalent to a self-signed cert.
Fix stream management state going out-of-sync when an erroneous stanza (unknown payload, type or validator errors on the payload) was received. In addition, IQ replies which cannot be processed raise :class:`aioxmpp.errors.ErroneousStanza` from :meth:`aioxmpp.stream.StanzaStream.send_iq_and_wait_for_reply` and when registering futures for the response using :meth:`aioxmpp.stream.StanzaStream.register_iq_response_future`. See the latter for details on the semantics.
Fixed a bug in :class:`aioxmpp.xml.XMPPXMLGenerator` which would emit elements in the wrong namespace if the meaning of a XML namespace prefix was being changed at the same time an element was emitted using that namespace.
The defaults for unknown child and attribute policies on :class:`aioxmpp.xso.XSO` are now
DROP
and notFAIL
. This is for better compatibility with old implementations and future features.
Breaking change: The required keyword argument on most :mod:`aioxmpp.xso` descriptors has been removed. The semantics of the default keyword argument have been changed.
Before 0.3, the XML elements represented by descriptors were not required by default and had to be marked as required e.g. by setting
required=True
in :class:`.xso.Attr` constructor.Since 0.3, the descriptors are generally required by default. However, the interface on how to change that is different. Attributes and text have a default keyword argument which may be set to a value (which may also be :data:`None`). In that case, that value indicates that the attribute or text is absent: it is used if the attribute or text is missing in the source XML and if the attribute or text is set to the default value, it will not be emitted in XML.
Children do not support default values other than :data:`None`; thus, they are simply controlled by a boolean flag required which needs to be passed to the constructor.
The class attributes :attr:`~aioxmpp.service.Meta.SERVICE_BEFORE` and :attr:`~aioxmpp.service.Meta.SERVICE_AFTER` have been renamed to :attr:`~aioxmpp.service.Meta.ORDER_BEFORE` and :attr:`~aioxmpp.service.Meta.ORDER_AFTER` respectively.
The :class:`aioxmpp.service.Service` class has additional support to handle the old attributes, but will emit a DeprecationWarning if they are used on a class declaration.
See :attr:`aioxmpp.service.Meta.SERVICE_AFTER` for more information on the deprecation cycle of these attributes.