Compare commits
	
		
			No commits in common. "7ce6703c5bebdfe101e7c1c23aec39fefdbc4645" and "d8c2ef6f3b3c7aa7147f0d0a4713793d1bc51743" have entirely different histories.
		
	
	
		
			7ce6703c5b
			...
			d8c2ef6f3b
		
	
		
| @ -21,28 +21,23 @@ abstract class XmppManagerBase { | ||||
|   } | ||||
| 
 | ||||
|   /// 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. | ||||
|   /// send. These are run before the stanza is sent. | ||||
|   List<StanzaHandler> getOutgoingPreStanzaHandlers() => []; | ||||
| 
 | ||||
|   /// 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. | ||||
|   /// send. These are run after the stanza is sent. | ||||
|   List<StanzaHandler> getOutgoingPostStanzaHandlers() => []; | ||||
|    | ||||
|   /// 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. | ||||
|   /// receive. | ||||
|   List<StanzaHandler> getIncomingStanzaHandlers() => []; | ||||
| 
 | ||||
|   /// 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. | ||||
|   /// as we have to decrypt the stanza before we do anything else. | ||||
|   List<StanzaHandler> getIncomingPreStanzaHandlers() => []; | ||||
|    | ||||
|   /// Return the NonzaHandlers associated with this manager. The higher the value of the | ||||
|   /// handler's priority, the earlier it is run. | ||||
|   /// Return the NonzaHandlers associated with this manager. | ||||
|   List<NonzaHandler> getNonzaHandlers() => []; | ||||
| 
 | ||||
|   /// Return a list of features that should be included in a disco response. | ||||
|  | ||||
| @ -5,6 +5,7 @@ import 'package:moxxmpp/src/stanza.dart'; | ||||
| import 'package:moxxmpp/src/stringxml.dart'; | ||||
| 
 | ||||
| abstract class Handler { | ||||
| 
 | ||||
|   const Handler(this.matchStanzas, { this.nonzaTag, this.nonzaXmlns }); | ||||
|   final String? nonzaTag; | ||||
|   final String? nonzaXmlns; | ||||
| @ -31,6 +32,7 @@ abstract class Handler { | ||||
| } | ||||
| 
 | ||||
| class NonzaHandler extends Handler { | ||||
| 
 | ||||
|   NonzaHandler({ | ||||
|       required this.callback, | ||||
|       String? nonzaTag, | ||||
| @ -44,6 +46,7 @@ class NonzaHandler extends Handler { | ||||
| } | ||||
| 
 | ||||
| class StanzaHandler extends Handler { | ||||
| 
 | ||||
|   StanzaHandler({ | ||||
|       required this.callback, | ||||
|       this.tagXmlns, | ||||
|  | ||||
| @ -142,7 +142,7 @@ class StreamManagementManager extends XmppManagerBase { | ||||
|   ]; | ||||
| 
 | ||||
|   @override | ||||
|   List<StanzaHandler> getIncomingPreStanzaHandlers() => [ | ||||
|   List<StanzaHandler> getIncomingStanzaHandlers() => [ | ||||
|     StanzaHandler( | ||||
|       callback: _onServerStanzaReceived, | ||||
|       priority: 9999, | ||||
|  | ||||
| @ -4,7 +4,7 @@ import '../helpers/logging.dart'; | ||||
| import '../helpers/xmpp.dart'; | ||||
| 
 | ||||
| Future<void> runIncomingStanzaHandlers(StreamManagementManager man, Stanza stanza) async { | ||||
|   for (final handler in man.getIncomingPreStanzaHandlers()) { | ||||
|   for (final handler in man.getIncomingStanzaHandlers()) { | ||||
|     if (handler.matches(stanza)) await handler.callback(stanza, StanzaHandlerData(false, false, null, stanza)); | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user