DiscoManager class

This manager implements XEP-0030 by providing a way of performing disco#info and disco#items requests and answering those requests. A caching mechanism is also provided.

Inheritance

Constructors

DiscoManager(List<Identity> identities)
identities is a list of disco identities that should be added by default to a disco#info response.

Properties

features List<String>
The list of disco features that are registered.
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
Return the Id (akin to xmlns) of this manager.
finalinherited
identities List<Identity>
The list of identities that are registered.
no setter
infoTracker → WaitForTracker<DiscoCacheKey, Result<StanzaError, DiscoInfo>>
no setter
initialized bool
Flag indicating that the post registration callback has been called once.
getter/setter pairinherited
logger Logger
Return the logger for this manager.
no setterinherited
name String
The name of the manager.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addCachedDiscoInfo(MapEntry<DiscoCacheKey, DiscoInfo> discoInfoEntry) Future<void>
Add a DiscoCacheKey-DiscoInfo pair discoInfoEntry to the internal cache.
addFeatures(List<String> features) → void
Adds a list of features to the possible disco info response. This function only adds features that are not already present in the disco features.
addIdentities(List<Identity> identities) → void
Adds a list of identities to the possible disco info response. This function only adds features that are not already present in the disco features.
discoInfoQuery(JID entity, {String? node, bool shouldEncrypt = false, bool shouldCache = true}) Future<Result<StanzaError, DiscoInfo>>
Send a disco#info query to entity. If node is specified, then the disco#info request will be directed against that one node of entity.
discoItemsQuery(JID entity, {String? node, bool shouldEncrypt = false}) Future<Result<StanzaError, List<DiscoItem>>>
Sends a disco items query to the (full) jid entity, optionally with node=node.
getAttributes() XmppManagerAttributes
Returns the attributes that are registered with the manager. Must only be called after register has been called on it.
inherited
getDiscoFeatures() List<String>
Return a list of features that should be included in a disco response.
override
getDiscoIdentities() List<Identity>
Return a list of identities that should be included in a disco response.
inherited
getDiscoInfo(String? node) DiscoInfo
Returns the DiscoInfo object that would be used as the response to a disco#info query against our bare JID with no node. The results node attribute is set to node.
getIncomingPreStanzaHandlers() List<StanzaHandler>
Return the StanzaHandlers associated with this manager that deal with stanza handlers that have to run before the main ones run. This is useful, for example, for OMEMO as we have to decrypt the stanza before we do anything else. The higher the value of the handler's priority, the earlier it is run.
inherited
getIncomingStanzaHandlers() List<StanzaHandler>
Return the StanzaHandlers associated with this manager that deal with stanzas we receive. The higher the value of the handler's priority, the earlier it is run.
override
getNonzaHandlers() List<NonzaHandler>
Return the NonzaHandlers associated with this manager. The higher the value of the handler's priority, the earlier it is run.
inherited
getOutgoingPostStanzaHandlers() List<StanzaHandler>
Return the StanzaHandlers associated with this manager that deal with stanzas we send. These are run after the stanza is sent. The higher the value of the handler's priority, the earlier it is run.
inherited
getOutgoingPreStanzaHandlers() List<StanzaHandler>
Return the StanzaHandlers associated with this manager that deal with stanzas we send. These are run before the stanza is sent. The higher the value of the handler's priority, the earlier it is run.
inherited
isFeatureSupported(String xmlns) Future<bool>
Resolves to true when the server supports the disco feature xmlns. Resolves to false when either the disco request fails or the server does not support xmlns. Note that this function requires a registered DiscoManager.
inherited
isNewStream() Future<bool>
Returns true, if the current stream negotiations resulted in a new stream. Useful for plugins to reset their cache in case of a new stream. The value only makes sense after receiving a StreamNegotiationsDoneEvent.
inherited
isSupported() Future<bool>
Returns true if the XEP is supported on the server. If not, returns false
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onData() Future<void>
Whenever the socket receives data, this method is called, if it is non-null.
inherited
onXmppEvent(XmppEvent event) Future<void>
Called when XmppConnection triggers an event
override
performDiscoSweep() Future<Result<DiscoError, List<DiscoInfo>>>
postRegisterCallback() Future<void>
Called after the registration of all managers against the XmppConnection is done. This method is only called once during the entire lifetime of it.
inherited
register(XmppManagerAttributes attributes) → void
Registers the callbacks from XmppConnection with the manager
inherited
registerInfoCallback(String node, DiscoInfoRequestCallback callback) → void
Register a callback callback for a disco#info query on node.
registerItemsCallback(String node, DiscoItemsRequestCallback callback) → void
Register a callback callback for a disco#items query on node.
reply(StanzaHandlerData data, String type, List<XMLNode> children) Future<void>
Sends a reply of the stanza in data with type. Replaces the original stanza's children with children.
inherited
runNonzaHandlers(XMLNode nonza) Future<bool>
Runs all NonzaHandlers of this Manager which match the nonza. Resolves to true if the nonza has been handled by one of the handlers. Resolves to false otherwise.
inherited
supportsFeature(JID entity, String feature) Future<bool>
A wrapper function around discoInfoQuery: Returns true if the entity with JID entity supports the disco feature feature. If not, returns false.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited