Compare commits
No commits in common. "29a5417b310a800ace4f9b059f6c5d521b8077ef" and "fa2ce7c2d10042246e19249f672ce32f90bab087" have entirely different histories.
29a5417b31
...
fa2ce7c2d1
@ -85,7 +85,6 @@ export 'package:moxxmpp/src/xeps/xep_0388/errors.dart';
|
|||||||
export 'package:moxxmpp/src/xeps/xep_0388/negotiators.dart';
|
export 'package:moxxmpp/src/xeps/xep_0388/negotiators.dart';
|
||||||
export 'package:moxxmpp/src/xeps/xep_0388/user_agent.dart';
|
export 'package:moxxmpp/src/xeps/xep_0388/user_agent.dart';
|
||||||
export 'package:moxxmpp/src/xeps/xep_0388/xep_0388.dart';
|
export 'package:moxxmpp/src/xeps/xep_0388/xep_0388.dart';
|
||||||
export 'package:moxxmpp/src/xeps/xep_0421.dart';
|
|
||||||
export 'package:moxxmpp/src/xeps/xep_0424.dart';
|
export 'package:moxxmpp/src/xeps/xep_0424.dart';
|
||||||
export 'package:moxxmpp/src/xeps/xep_0444.dart';
|
export 'package:moxxmpp/src/xeps/xep_0444.dart';
|
||||||
export 'package:moxxmpp/src/xeps/xep_0446.dart';
|
export 'package:moxxmpp/src/xeps/xep_0446.dart';
|
||||||
|
@ -32,4 +32,3 @@ const messageReactionsManager = 'org.moxxmpp.messagereactionsmanager';
|
|||||||
const stickersManager = 'org.moxxmpp.stickersmanager';
|
const stickersManager = 'org.moxxmpp.stickersmanager';
|
||||||
const entityCapabilitiesManager = 'org.moxxmpp.entitycapabilities';
|
const entityCapabilitiesManager = 'org.moxxmpp.entitycapabilities';
|
||||||
const messageProcessingHintManager = 'org.moxxmpp.messageprocessinghint';
|
const messageProcessingHintManager = 'org.moxxmpp.messageprocessinghint';
|
||||||
const occupantIdManager = 'org.moxxmpp.occupantidmanager';
|
|
||||||
|
@ -123,9 +123,6 @@ const sasl2Xmlns = 'urn:xmpp:sasl:2';
|
|||||||
// XEP-0420
|
// XEP-0420
|
||||||
const sceXmlns = 'urn:xmpp:sce:1';
|
const sceXmlns = 'urn:xmpp:sce:1';
|
||||||
|
|
||||||
// XEP-0421
|
|
||||||
const occupantIdXmlns = 'urn:xmpp:occupant-id:0';
|
|
||||||
|
|
||||||
// XEP-0422
|
// XEP-0422
|
||||||
const fasteningXmlns = 'urn:xmpp:fasten:0';
|
const fasteningXmlns = 'urn:xmpp:fasten:0';
|
||||||
|
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'package:moxxmpp/src/managers/base.dart';
|
|
||||||
import 'package:moxxmpp/src/managers/data.dart';
|
|
||||||
import 'package:moxxmpp/src/managers/handlers.dart';
|
|
||||||
import 'package:moxxmpp/src/managers/namespaces.dart';
|
|
||||||
import 'package:moxxmpp/src/message.dart';
|
|
||||||
import 'package:moxxmpp/src/namespaces.dart';
|
|
||||||
import 'package:moxxmpp/src/stanza.dart';
|
|
||||||
import 'package:moxxmpp/src/stringxml.dart';
|
|
||||||
|
|
||||||
/// Representation of a <occupant-id /> element.
|
|
||||||
class OccupantIdData implements StanzaHandlerExtension {
|
|
||||||
const OccupantIdData(
|
|
||||||
this.id,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// The unique occupant id.
|
|
||||||
final String id;
|
|
||||||
|
|
||||||
XMLNode toXML() {
|
|
||||||
return XMLNode.xmlns(
|
|
||||||
tag: 'occupant-id',
|
|
||||||
xmlns: occupantIdXmlns,
|
|
||||||
attributes: {
|
|
||||||
'id': id,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OccupantIdManager extends XmppManagerBase {
|
|
||||||
OccupantIdManager() : super(occupantIdManager);
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<String> getDiscoFeatures() => [
|
|
||||||
occupantIdXmlns,
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<StanzaHandler> getIncomingStanzaHandlers() => [
|
|
||||||
StanzaHandler(
|
|
||||||
stanzaTag: 'message',
|
|
||||||
tagName: 'occupant-id',
|
|
||||||
tagXmlns: occupantIdXmlns,
|
|
||||||
callback: _onMessage,
|
|
||||||
// Before the MessageManager
|
|
||||||
priority: MessageManager.messageHandlerPriority + 1,
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> isSupported() async => true;
|
|
||||||
|
|
||||||
Future<StanzaHandlerData> _onMessage(
|
|
||||||
Stanza stanza,
|
|
||||||
StanzaHandlerData state,
|
|
||||||
) async {
|
|
||||||
return state
|
|
||||||
..extensions.set(OccupantIdData(stanza.attributes['id']! as String));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user