feat: Make defining managers better

This commit is contained in:
PapaTutuWawa 2023-01-27 21:54:16 +01:00
parent 47337540f5
commit 6da3342f22
34 changed files with 85 additions and 224 deletions

View File

@ -226,7 +226,7 @@ class XmppConnection {
/// Registers a list of [XmppManagerBase] sub-classes as managers on this connection. /// Registers a list of [XmppManagerBase] sub-classes as managers on this connection.
Future<void> registerManagers(List<XmppManagerBase> managers) async { Future<void> registerManagers(List<XmppManagerBase> managers) async {
for (final manager in managers) { for (final manager in managers) {
_log.finest('Registering ${manager.getId()}'); _log.finest('Registering ${manager.id}');
manager.register( manager.register(
XmppManagerAttributes( XmppManagerAttributes(
sendStanza: sendStanza, sendStanza: sendStanza,
@ -242,8 +242,7 @@ class XmppConnection {
), ),
); );
final id = manager.getId(); _xmppManagers[manager.id] = manager;
_xmppManagers[id] = manager;
_incomingStanzaHandlers.addAll(manager.getIncomingStanzaHandlers()); _incomingStanzaHandlers.addAll(manager.getIncomingStanzaHandlers());
_incomingPreStanzaHandlers.addAll(manager.getIncomingPreStanzaHandlers()); _incomingPreStanzaHandlers.addAll(manager.getIncomingPreStanzaHandlers());
@ -260,7 +259,7 @@ class XmppConnection {
// Run the post register callbacks // Run the post register callbacks
for (final manager in _xmppManagers.values) { for (final manager in _xmppManagers.values) {
if (!manager.initialized) { if (!manager.initialized) {
_log.finest('Running post-registration callback for ${manager.getName()}'); _log.finest('Running post-registration callback for ${manager.name}');
await manager.postRegisterCallback(); await manager.postRegisterCallback();
} }
} }

View File

@ -10,6 +10,8 @@ import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart'; import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
abstract class XmppManagerBase { abstract class XmppManagerBase {
XmppManagerBase(this.id);
late final XmppManagerAttributes _managerAttributes; late final XmppManagerAttributes _managerAttributes;
late final Logger _log; late final Logger _log;
@ -19,7 +21,7 @@ abstract class XmppManagerBase {
/// Registers the callbacks from XmppConnection with the manager /// Registers the callbacks from XmppConnection with the manager
void register(XmppManagerAttributes attributes) { void register(XmppManagerAttributes attributes) {
_managerAttributes = attributes; _managerAttributes = attributes;
_log = Logger(getName()); _log = Logger(name);
} }
/// Returns the attributes that are registered with the manager. /// Returns the attributes that are registered with the manager.
@ -60,10 +62,10 @@ abstract class XmppManagerBase {
List<Identity> getDiscoIdentities() => []; List<Identity> getDiscoIdentities() => [];
/// Return the Id (akin to xmlns) of this manager. /// Return the Id (akin to xmlns) of this manager.
String getId(); final String id;
/// Return a name that will be used for logging. /// The name of the manager.
String getName(); String get name => toString();
/// Return the logger for this manager. /// Return the logger for this manager.
Logger get logger => _log; Logger get logger => _log;

View File

@ -76,11 +76,7 @@ class MessageDetails {
} }
class MessageManager extends XmppManagerBase { class MessageManager extends XmppManagerBase {
@override MessageManager() : super(messageManager);
String getId() => messageManager;
@override
String getName() => 'MessageManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -4,11 +4,7 @@ import 'package:moxxmpp/src/managers/namespaces.dart';
import 'package:moxxmpp/src/xeps/xep_0198/xep_0198.dart'; import 'package:moxxmpp/src/xeps/xep_0198/xep_0198.dart';
class PingManager extends XmppManagerBase { class PingManager extends XmppManagerBase {
@override PingManager() : super(pingManager);
String getId() => pingManager;
@override
String getName() => 'PingManager';
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;

View File

@ -17,17 +17,11 @@ typedef PresencePreSendCallback = Future<List<XMLNode>> Function();
/// A mandatory manager that handles initial presence sending, sending of subscription /// A mandatory manager that handles initial presence sending, sending of subscription
/// request management requests and triggers events for incoming presence stanzas. /// request management requests and triggers events for incoming presence stanzas.
class PresenceManager extends XmppManagerBase { class PresenceManager extends XmppManagerBase {
PresenceManager() : super(); PresenceManager() : super(presenceManager);
/// The list of pre-send callbacks. /// The list of pre-send callbacks.
final List<PresencePreSendCallback> _presenceCallbacks = List.empty(growable: true); final List<PresencePreSendCallback> _presenceCallbacks = List.empty(growable: true);
@override
String getId() => presenceManager;
@override
String getName() => 'PresenceManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -93,7 +93,7 @@ class RosterFeatureNegotiator extends XmppFeatureNegotiatorBase {
/// This manager requires a RosterFeatureNegotiator to be registered. /// This manager requires a RosterFeatureNegotiator to be registered.
class RosterManager extends XmppManagerBase { class RosterManager extends XmppManagerBase {
RosterManager(this._stateManager) : super(); RosterManager(this._stateManager) : super(rosterManager);
/// The class managing the entire roster state. /// The class managing the entire roster state.
final BaseRosterStateManager _stateManager; final BaseRosterStateManager _stateManager;
@ -104,12 +104,6 @@ class RosterManager extends XmppManagerBase {
_stateManager.register(attributes.sendEvent); _stateManager.register(attributes.sendEvent);
} }
@override
String getId() => rosterManager;
@override
String getName() => 'RosterManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -11,13 +11,7 @@ import 'package:moxxmpp/src/xeps/xep_0446.dart';
const fileUploadNotificationXmlns = 'proto:urn:xmpp:fun:0'; const fileUploadNotificationXmlns = 'proto:urn:xmpp:fun:0';
class FileUploadNotificationManager extends XmppManagerBase { class FileUploadNotificationManager extends XmppManagerBase {
FileUploadNotificationManager() : super(); FileUploadNotificationManager() : super(fileUploadNotificationManager);
@override
String getId() => fileUploadNotificationManager;
@override
String getName() => 'FileUploadNotificationManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -33,7 +33,7 @@ class DiscoManager extends XmppManagerBase {
/// to a disco#info response. /// to a disco#info response.
DiscoManager(List<Identity> identities) DiscoManager(List<Identity> identities)
: _identities = List<Identity>.from(identities), : _identities = List<Identity>.from(identities),
super(); super(discoManager);
/// Our features /// Our features
final List<String> _features = List.empty(growable: true); final List<String> _features = List.empty(growable: true);
@ -90,12 +90,6 @@ class DiscoManager extends XmppManagerBase {
), ),
]; ];
@override
String getId() => discoManager;
@override
String getName() => 'DiscoManager';
@override @override
List<String> getDiscoFeatures() => [ discoInfoXmlns, discoItemsXmlns ]; List<String> getDiscoFeatures() => [ discoInfoXmlns, discoItemsXmlns ];

View File

@ -28,14 +28,8 @@ class VCard {
} }
class VCardManager extends XmppManagerBase { class VCardManager extends XmppManagerBase {
VCardManager() : _lastHash = {}, super(); VCardManager() : super(vcardManager);
final Map<String, String> _lastHash; final Map<String, String> _lastHash = {};
@override
String getId() => vcardManager;
@override
String getName() => 'vCardManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -69,11 +69,7 @@ class PubSubItem {
} }
class PubSubManager extends XmppManagerBase { class PubSubManager extends XmppManagerBase {
@override PubSubManager() : super(pubsubManager);
String getId() => pubsubManager;
@override
String getName() => 'PubsubManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -8,7 +8,6 @@ import 'package:moxxmpp/src/stringxml.dart';
/// A data class representing the jabber:x:oob tag. /// A data class representing the jabber:x:oob tag.
class OOBData { class OOBData {
const OOBData({ this.url, this.desc }); const OOBData({ this.url, this.desc });
final String? url; final String? url;
final String? desc; final String? desc;
@ -32,11 +31,7 @@ XMLNode constructOOBNode(OOBData data) {
} }
class OOBManager extends XmppManagerBase { class OOBManager extends XmppManagerBase {
@override OOBManager() : super(oobManager);
String getName() => 'OOBName';
@override
String getId() => oobManager;
@override @override
List<String> getDiscoFeatures() => [ oobDataXmlns ]; List<String> getDiscoFeatures() => [ oobDataXmlns ];

View File

@ -28,24 +28,24 @@ class UserAvatarMetadata {
this.height, this.height,
this.mime, this.mime,
); );
/// The amount of bytes in the file /// The amount of bytes in the file
final int length; final int length;
/// The identifier of the avatar /// The identifier of the avatar
final String id; final String id;
/// Image proportions /// Image proportions
final int width; final int width;
final int height; final int height;
/// The MIME type of the avatar /// The MIME type of the avatar
final String mime; final String mime;
} }
/// NOTE: This class requires a PubSubManager /// NOTE: This class requires a PubSubManager
class UserAvatarManager extends XmppManagerBase { class UserAvatarManager extends XmppManagerBase {
@override UserAvatarManager() : super(userAvatarManager);
String getId() => userAvatarManager;
@override
String getName() => 'UserAvatarManager';
PubSubManager _getPubSubManager() => getAttributes().getManagerById(pubsubManager)! as PubSubManager; PubSubManager _getPubSubManager() => getAttributes().getManagerById(pubsubManager)! as PubSubManager;

View File

@ -39,15 +39,11 @@ ChatState chatStateFromString(String raw) {
String chatStateToString(ChatState state) => state.toString().split('.').last; String chatStateToString(ChatState state) => state.toString().split('.').last;
class ChatStateManager extends XmppManagerBase { class ChatStateManager extends XmppManagerBase {
ChatStateManager() : super(chatStateManager);
@override @override
List<String> getDiscoFeatures() => [ chatStateXmlns ]; List<String> getDiscoFeatures() => [ chatStateXmlns ];
@override
String getName() => 'ChatStateManager';
@override
String getId() => chatStateManager;
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -71,7 +71,7 @@ Future<String> calculateCapabilityHash(DiscoInfo info, HashAlgorithm algorithm)
/// the DiscoManager. /// the DiscoManager.
/// NOTE: This manager requires that the DiscoManager is also registered. /// NOTE: This manager requires that the DiscoManager is also registered.
class EntityCapabilitiesManager extends XmppManagerBase { class EntityCapabilitiesManager extends XmppManagerBase {
EntityCapabilitiesManager(this._capabilityHashBase) : super(); EntityCapabilitiesManager(this._capabilityHashBase) : super(entityCapabilitiesManager);
/// The string that is both the node under which we advertise the disco info /// The string that is both the node under which we advertise the disco info
/// and the base for the actual node on which we respond to disco#info requests. /// and the base for the actual node on which we respond to disco#info requests.
@ -80,19 +80,11 @@ class EntityCapabilitiesManager extends XmppManagerBase {
/// The cached capability hash. /// The cached capability hash.
String? _capabilityHash; String? _capabilityHash;
@override
String getName() => 'EntityCapabilitiesManager';
@override
String getId() => entityCapabilitiesManager;
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;
@override @override
List<String> getDiscoFeatures() => [ List<String> getDiscoFeatures() => [ capsXmlns ];
capsXmlns,
];
/// Computes, if required, the capability hash of the data provided by /// Computes, if required, the capability hash of the data provided by
/// the DiscoManager. /// the DiscoManager.

View File

@ -24,15 +24,11 @@ XMLNode makeMessageDeliveryResponse(String id) {
} }
class MessageDeliveryReceiptManager extends XmppManagerBase { class MessageDeliveryReceiptManager extends XmppManagerBase {
MessageDeliveryReceiptManager() : super(messageDeliveryReceiptManager);
@override @override
List<String> getDiscoFeatures() => [ deliveryXmlns ]; List<String> getDiscoFeatures() => [ deliveryXmlns ];
@override
String getName() => 'MessageDeliveryReceiptManager';
@override
String getId() => messageDeliveryReceiptManager;
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -9,16 +9,10 @@ import 'package:moxxmpp/src/stringxml.dart';
import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart'; import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
class BlockingManager extends XmppManagerBase { class BlockingManager extends XmppManagerBase {
BlockingManager() : _supported = false, _gotSupported = false, super(); BlockingManager() : super(blockingManager);
bool _supported; bool _supported = false;
bool _gotSupported; bool _gotSupported = false;
@override
String getId() => blockingManager;
@override
String getName() => 'BlockingManager';
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -21,40 +21,41 @@ const xmlUintMax = 4294967296; // 2**32
typedef StanzaAckedCallback = bool Function(Stanza stanza); typedef StanzaAckedCallback = bool Function(Stanza stanza);
class StreamManagementManager extends XmppManagerBase { class StreamManagementManager extends XmppManagerBase {
StreamManagementManager({ StreamManagementManager({
this.ackTimeout = const Duration(seconds: 30), this.ackTimeout = const Duration(seconds: 30),
}) }) : super(smManager);
: _state = StreamManagementState(0, 0),
_unackedStanzas = {},
_stateLock = Lock(),
_streamManagementEnabled = false,
_lastAckTimestamp = -1,
_pendingAcks = 0,
_streamResumed = false,
_ackLock = Lock();
/// The queue of stanzas that are not (yet) acked /// The queue of stanzas that are not (yet) acked
final Map<int, Stanza> _unackedStanzas; final Map<int, Stanza> _unackedStanzas = {};
/// Commitable state of the StreamManagementManager /// Commitable state of the StreamManagementManager
StreamManagementState _state; StreamManagementState _state = StreamManagementState(0, 0);
/// Mutex lock for _state /// Mutex lock for _state
final Lock _stateLock; final Lock _stateLock = Lock();
/// If the have enabled SM on the stream yet /// If the have enabled SM on the stream yet
bool _streamManagementEnabled; bool _streamManagementEnabled = false;
/// If the current stream has been resumed; /// If the current stream has been resumed;
bool _streamResumed; bool _streamResumed = false;
/// The time in which the response to an ack is still valid. Counts as a timeout /// The time in which the response to an ack is still valid. Counts as a timeout
/// otherwise /// otherwise
@internal @internal
final Duration ackTimeout; final Duration ackTimeout;
/// The time at which the last ack has been sent /// The time at which the last ack has been sent
int _lastAckTimestamp; int _lastAckTimestamp = -1;
/// The timer to see if we timed the connection out /// The timer to see if we timed the connection out
Timer? _ackTimer; Timer? _ackTimer;
/// Counts how many acks we're waiting for /// Counts how many acks we're waiting for
int _pendingAcks; int _pendingAcks = 0;
/// Lock for both [_lastAckTimestamp] and [_pendingAcks]. /// Lock for both [_lastAckTimestamp] and [_pendingAcks].
final Lock _ackLock; final Lock _ackLock = Lock();
/// Functions for testing /// Functions for testing
@visibleForTesting @visibleForTesting
@ -121,12 +122,6 @@ class StreamManagementManager extends XmppManagerBase {
bool get streamResumed => _streamResumed; bool get streamResumed => _streamResumed;
@override
String getId() => smManager;
@override
String getName() => 'StreamManagementManager';
@override @override
List<NonzaHandler> getNonzaHandlers() => [ List<NonzaHandler> getNonzaHandlers() => [
NonzaHandler( NonzaHandler(

View File

@ -14,11 +14,7 @@ class DelayedDelivery {
} }
class DelayedDeliveryManager extends XmppManagerBase { class DelayedDeliveryManager extends XmppManagerBase {
@override DelayedDeliveryManager() : super(delayedDeliveryManager);
String getId() => delayedDeliveryManager;
@override
String getName() => 'DelayedDeliveryManager';
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;

View File

@ -14,7 +14,7 @@ import 'package:moxxmpp/src/xeps/xep_0297.dart';
/// This manager class implements support for XEP-0280. /// This manager class implements support for XEP-0280.
class CarbonsManager extends XmppManagerBase { class CarbonsManager extends XmppManagerBase {
CarbonsManager() : super(); CarbonsManager() : super(carbonsManager);
/// Indicates that message carbons are enabled. /// Indicates that message carbons are enabled.
bool _isEnabled = false; bool _isEnabled = false;
@ -25,12 +25,6 @@ class CarbonsManager extends XmppManagerBase {
/// Indicates that we know that [CarbonsManager._supported] is accurate. /// Indicates that we know that [CarbonsManager._supported] is accurate.
bool _gotSupported = false; bool _gotSupported = false;
@override
String getId() => carbonsManager;
@override
String getName() => 'CarbonsManager';
@override @override
List<StanzaHandler> getIncomingPreStanzaHandlers() => [ List<StanzaHandler> getIncomingPreStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -61,11 +61,7 @@ HashFunction hashFunctionFromName(String name) {
} }
class CryptographicHashManager extends XmppManagerBase { class CryptographicHashManager extends XmppManagerBase {
@override CryptographicHashManager() : super(cryptographicHashManager);
String getId() => cryptographicHashManager;
@override
String getName() => 'CryptographicHashManager';
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;
@ -81,7 +77,7 @@ class CryptographicHashManager extends XmppManagerBase {
]; ];
static Future<List<int>> hashFromData(List<int> data, HashFunction function) async { static Future<List<int>> hashFromData(List<int> data, HashFunction function) async {
// TODO(PapaTutuWawa): Implemen the others as well // TODO(PapaTutuWawa): Implement the others as well
HashAlgorithm algo; HashAlgorithm algo;
switch (function) { switch (function) {
case HashFunction.sha256: case HashFunction.sha256:

View File

@ -17,11 +17,7 @@ XMLNode makeLastMessageCorrectionEdit(String id) {
} }
class LastMessageCorrectionManager extends XmppManagerBase { class LastMessageCorrectionManager extends XmppManagerBase {
@override LastMessageCorrectionManager() : super(lastMessageCorrectionManager);
String getName() => 'LastMessageCorrectionManager';
@override
String getId() => lastMessageCorrectionManager;
@override @override
List<String> getDiscoFeatures() => [ lmcXmlns ]; List<String> getDiscoFeatures() => [ lmcXmlns ];

View File

@ -25,11 +25,7 @@ XMLNode makeChatMarker(String tag, String id) {
} }
class ChatMarkerManager extends XmppManagerBase { class ChatMarkerManager extends XmppManagerBase {
@override ChatMarkerManager() : super(chatMarkerManager);
String getName() => 'ChatMarkerManager';
@override
String getId() => chatMarkerManager;
@override @override
List<String> getDiscoFeatures() => [ chatMarkersXmlns ]; List<String> getDiscoFeatures() => [ chatMarkersXmlns ];

View File

@ -26,10 +26,10 @@ class CSIInactiveNonza extends XMLNode {
/// A Stub negotiator that is just for "intercepting" the stream feature. /// A Stub negotiator that is just for "intercepting" the stream feature.
class CSINegotiator extends XmppFeatureNegotiatorBase { class CSINegotiator extends XmppFeatureNegotiatorBase {
CSINegotiator() : _supported = false, super(11, false, csiXmlns, csiNegotiator); CSINegotiator() : super(11, false, csiXmlns, csiNegotiator);
/// True if CSI is supported. False otherwise. /// True if CSI is supported. False otherwise.
bool _supported; bool _supported = false;
bool get isSupported => _supported; bool get isSupported => _supported;
@override @override
@ -50,15 +50,9 @@ class CSINegotiator extends XmppFeatureNegotiatorBase {
/// The manager requires a CSINegotiator to be registered as a feature negotiator. /// The manager requires a CSINegotiator to be registered as a feature negotiator.
class CSIManager extends XmppManagerBase { class CSIManager extends XmppManagerBase {
CSIManager() : super(csiManager);
CSIManager() : _isActive = true, super(); bool _isActive = true;
bool _isActive;
@override
String getId() => csiManager;
@override
String getName() => 'CSIManager';
@override @override
Future<bool> isSupported() async { Future<bool> isSupported() async {

View File

@ -13,7 +13,6 @@ import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
/// NOTE: [StableStanzaId.stanzaId] must not be confused with the actual id attribute of /// NOTE: [StableStanzaId.stanzaId] must not be confused with the actual id attribute of
/// the message stanza. /// the message stanza.
class StableStanzaId { class StableStanzaId {
const StableStanzaId({ this.originId, this.stanzaId, this.stanzaIdBy }); const StableStanzaId({ this.originId, this.stanzaId, this.stanzaIdBy });
final String? originId; final String? originId;
final String? stanzaId; final String? stanzaId;
@ -29,11 +28,7 @@ XMLNode makeOriginIdElement(String id) {
} }
class StableIdManager extends XmppManagerBase { class StableIdManager extends XmppManagerBase {
@override StableIdManager() : super(stableIdManager);
String getName() => 'StableIdManager';
@override
String getId() => stableIdManager;
@override @override
List<String> getDiscoFeatures() => [ stableIdXmlns ]; List<String> getDiscoFeatures() => [ stableIdXmlns ];

View File

@ -41,17 +41,19 @@ Map<String, String> prepareHeaders(Map<String, String> headers) {
} }
class HttpFileUploadManager extends XmppManagerBase { class HttpFileUploadManager extends XmppManagerBase {
HttpFileUploadManager() : _gotSupported = false, _supported = false, super(); HttpFileUploadManager() : super(httpFileUploadManager);
/// The entity that we will request file uploads from, if discovered.
JID? _entityJid; JID? _entityJid;
/// The maximum file upload file size, if advertised and discovered.
int? _maxUploadSize; int? _maxUploadSize;
bool _gotSupported;
bool _supported;
@override /// Flag, if we every tried to discover the upload entity.
String getId() => httpFileUploadManager; bool _gotSupported = false;
@override /// Flag, if we can use HTTP File Upload
String getName() => 'HttpFileUploadManager'; bool _supported = false;
/// Returns whether the entity provided an identity that tells us that we can ask it /// Returns whether the entity provided an identity that tells us that we can ask it
/// for an HTTP upload slot. /// for an HTTP upload slot.

View File

@ -53,15 +53,7 @@ XMLNode buildEmeElement(ExplicitEncryptionType type) {
} }
class EmeManager extends XmppManagerBase { class EmeManager extends XmppManagerBase {
EmeManager() : super(emeManager);
EmeManager() : super();
@override
String getId() => emeManager;
@override
String getName() => 'EmeManager';
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;

View File

@ -42,12 +42,9 @@ const _doNotEncryptList = [
DoNotEncrypt('stanza-id', stableIdXmlns), DoNotEncrypt('stanza-id', stableIdXmlns),
]; ];
@mustCallSuper
abstract class BaseOmemoManager extends XmppManagerBase { abstract class BaseOmemoManager extends XmppManagerBase {
@override BaseOmemoManager() : super(omemoManager);
String getId() => omemoManager;
@override
String getName() => 'OmemoManager';
// TODO(Unknown): Technically, this is not always true // TODO(Unknown): Technically, this is not always true
@override @override

View File

@ -8,7 +8,6 @@ import 'package:moxxmpp/src/stringxml.dart';
import 'package:moxxmpp/src/xeps/staging/extensible_file_thumbnails.dart'; import 'package:moxxmpp/src/xeps/staging/extensible_file_thumbnails.dart';
class StatelessMediaSharingData { class StatelessMediaSharingData {
const StatelessMediaSharingData({ required this.mediaType, required this.size, required this.description, required this.hashes, required this.url, required this.thumbnails }); const StatelessMediaSharingData({ required this.mediaType, required this.size, required this.description, required this.hashes, required this.url, required this.thumbnails });
final String mediaType; final String mediaType;
final int size; final int size;
@ -63,11 +62,7 @@ StatelessMediaSharingData parseSIMSElement(XMLNode node) {
} }
class SIMSManager extends XmppManagerBase { class SIMSManager extends XmppManagerBase {
@override SIMSManager() : super(simsManager);
String getName() => 'SIMSManager';
@override
String getId() => simsManager;
@override @override
List<String> getDiscoFeatures() => [ simsXmlns ]; List<String> getDiscoFeatures() => [ simsXmlns ];

View File

@ -12,11 +12,7 @@ class MessageRetractionData {
} }
class MessageRetractionManager extends XmppManagerBase { class MessageRetractionManager extends XmppManagerBase {
@override MessageRetractionManager() : super(messageRetractionManager);
String getName() => 'MessageRetractionManager';
@override
String getId() => messageRetractionManager;
@override @override
List<String> getDiscoFeatures() => [ messageRetractionXmlns ]; List<String> getDiscoFeatures() => [ messageRetractionXmlns ];

View File

@ -29,15 +29,11 @@ class MessageReactions {
} }
class MessageReactionsManager extends XmppManagerBase { class MessageReactionsManager extends XmppManagerBase {
MessageReactionsManager() : super(messageReactionsManager);
@override @override
List<String> getDiscoFeatures() => [ messageReactionsXmlns ]; List<String> getDiscoFeatures() => [ messageReactionsXmlns ];
@override
String getName() => 'MessageReactionsManager';
@override
String getId() => messageReactionsManager;
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler( StanzaHandler(

View File

@ -105,11 +105,7 @@ class StatelessFileSharingData {
} }
class SFSManager extends XmppManagerBase { class SFSManager extends XmppManagerBase {
@override SFSManager() : super(sfsManager);
String getName() => 'SFSManager';
@override
String getId() => sfsManager;
@override @override
List<StanzaHandler> getIncomingStanzaHandlers() => [ List<StanzaHandler> getIncomingStanzaHandlers() => [

View File

@ -225,11 +225,7 @@ class StickerPack {
} }
class StickersManager extends XmppManagerBase { class StickersManager extends XmppManagerBase {
@override StickersManager() : super(stickersManager);
String getId() => stickersManager;
@override
String getName() => 'StickersManager';
@override @override
Future<bool> isSupported() async => true; Future<bool> isSupported() async => true;

View File

@ -66,11 +66,7 @@ class QuoteData {
/// A manager implementing support for parsing XEP-0461 metadata. The /// A manager implementing support for parsing XEP-0461 metadata. The
/// MessageRepliesManager itself does not modify the body of the message. /// MessageRepliesManager itself does not modify the body of the message.
class MessageRepliesManager extends XmppManagerBase { class MessageRepliesManager extends XmppManagerBase {
@override MessageRepliesManager() : super(messageRepliesManager);
String getName() => 'MessageRepliesManager';
@override
String getId() => messageRepliesManager;
@override @override
List<String> getDiscoFeatures() => [ List<String> getDiscoFeatures() => [

View File

@ -1,4 +1,5 @@
import 'package:moxxmpp/moxxmpp.dart'; import 'package:moxxmpp/moxxmpp.dart';
import 'package:moxxmpp/src/xeps/xep_0030/cache.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import '../helpers/logging.dart'; import '../helpers/logging.dart';