Compare commits
2 Commits
c3088f9046
...
5bd2466c54
Author | SHA1 | Date | |
---|---|---|---|
5bd2466c54 | |||
14b62cef96 |
@ -13,6 +13,7 @@ const subscriptionPreApprovalXmlns = 'urn:xmpp:features:pre-approval';
|
||||
|
||||
// XEP-0004
|
||||
const dataFormsXmlns = 'jabber:x:data';
|
||||
const formVarFormType = 'FORM_TYPE';
|
||||
|
||||
// XEP-0030
|
||||
const discoInfoXmlns = 'http://jabber.org/protocol/disco#info';
|
||||
@ -23,6 +24,7 @@ const extendedAddressingXmlns = 'http://jabber.org/protocol/address';
|
||||
|
||||
// XEP-0045
|
||||
const mucXmlns = 'http://jabber.org/protocol/muc';
|
||||
const roomInfoFormType = 'http://jabber.org/protocol/muc#roominfo';
|
||||
|
||||
// XEP-0054
|
||||
const vCardTempXmlns = 'vcard-temp';
|
||||
|
@ -1,4 +1,7 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:moxxmpp/src/jid.dart';
|
||||
import 'package:moxxmpp/src/namespaces.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0004.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
|
||||
|
||||
class RoomInformation {
|
||||
@ -7,6 +10,7 @@ class RoomInformation {
|
||||
required this.jid,
|
||||
required this.features,
|
||||
required this.name,
|
||||
this.roomInfo,
|
||||
});
|
||||
|
||||
/// Constructs a [RoomInformation] object from a [DiscoInfo] object.
|
||||
@ -21,6 +25,11 @@ class RoomInformation {
|
||||
name: discoInfo.identities
|
||||
.firstWhere((i) => i.category == 'conference')
|
||||
.name!,
|
||||
roomInfo: discoInfo.extendedInfo.firstWhereOrNull((form) {
|
||||
final field = form.getFieldByVar(formVarFormType);
|
||||
return field?.type == 'hidden' &&
|
||||
field?.values.first == roomInfoFormType;
|
||||
}),
|
||||
);
|
||||
|
||||
/// The JID of the Multi-User Chat (MUC) room.
|
||||
@ -31,6 +40,9 @@ class RoomInformation {
|
||||
|
||||
/// The name or title of the Multi-User Chat (MUC) room.
|
||||
final String name;
|
||||
|
||||
/// The data form containing room information.
|
||||
final DataForm? roomInfo;
|
||||
}
|
||||
|
||||
/// The used message-id and an optional origin-id.
|
||||
|
@ -282,6 +282,9 @@ class MUCManager extends XmppManagerBase {
|
||||
}
|
||||
|
||||
// Check if this is the message reflection.
|
||||
if (message.id == null) {
|
||||
return state;
|
||||
}
|
||||
final pending =
|
||||
(message.id!, state.extensions.get<StableIdData>()?.originId);
|
||||
if (fromJid.resource == roomState.nick &&
|
||||
|
Loading…
Reference in New Issue
Block a user