Extensions¶
- class osmxmpp.extensions.abc.XmppExtension¶
Bases:
ABCExtensions are used to implement specific XMPP extensions & etc. They have more wider usecase than features.
- ID¶
The ID of the extension implementation.
- Type:
str
- ID = None¶
Base extensions¶
Omemo¶
- class osmxmpp.extensions.omemo.OmemoExtension(bundle, storage)¶
Bases:
XmppExtensionXEP-0384: OMEMO Encryption implementation.
- ID = 'osmiumnet.omemo'¶
-
REQUIRED_PERMISSIONS:
List[XmppPermission] = [<XmppPermission.GET_JID>, <XmppPermission.SEND_XML>, <XmppPermission.LISTEN_ON_READY>, <XmppPermission.LISTEN_ON_IQ>, <XmppPermission.HOOK_ON_MESSAGE>, <XmppPermission.HOOK_SEND_MESSAGE>]¶
- fetch_bundles(jid)¶
Fetches the bundles from the given JID.
- Parameters:
jid (str | List[str]) – The JID(s) to fetch the bundles from.
Example
>>> client.extensions["osmiumnet.omemo"].fetch_bundles("john@jabber.org")
- publish_bundle_information()¶
Publishes the bundle information.
Example
>>> client.extensions["osmiumnet.omemo"].publish_bundle_information()
Roster subscription¶
- class osmxmpp.extensions.roster.subscription.SubscriptionExtension¶
Bases:
XmppExtensionXEP-0379: Pre-Authenticated Roster Subscription implementation.
- ID = 'osmiumnet.roster.subscription'¶
-
REQUIRED_PERMISSIONS:
List[XmppPermission] = [<XmppPermission.GET_JID>, <XmppPermission.SEND_XML>, <XmppPermission.LISTEN_ON_READY>, <XmppPermission.LISTEN_ON_PRESENCE>, <XmppPermission.LISTEN_ON_IQ>]¶
- check_for_subscriptions()¶
Sends a subscription check request.
Example
>>> client.extensions["osmiumnet.roster.subscription"].check_for_subscriptions()
- ensure_subscription(jid_to)¶
Ensures that the JID is subscribed.
- Parameters:
jid_to (str) – The JID to ensure.
Example
>>> client.extensions["osmiumnet.roster.subscription"].ensure_subscription("john@jabber.org")
- on_check_subscriptions(handler)¶
Registers a handler for the
on_check_subscriptionsevent.Handler will be called when subscriptions are received.
- Parameters:
handler (Callable) – The handler to register.
- Returns:
The handler (unchanged).
- Return type:
Callable
Example
>>> @client.extensions["osmiumnet.roster.subscription"].on_check_subscriptions ... def on_check_subscriptions(iq): ... print(f"Received subscriptions: {iq.body}")
Service discovery¶
- class osmxmpp.extensions.service.discovery.ServiceDiscoveryExtension¶
Bases:
XmppExtensionXEP-0030: Service Discovery implementation.
- ID = 'osmiumnet.service.discovery'¶
-
REQUIRED_PERMISSIONS:
List[XmppPermission] = [<XmppPermission.SEND_XML>]¶
- discover()¶
Sends a service discovery request.
Example
>>> client.extensions["osmiumnet.service.discovery"].discover()