Compare commits
No commits in common. "d9e4a3c1d40a83cc5fde26764dbc0873e9794872" and "d1de394cd9e8551b564449c3ea234178283b4fa3" have entirely different histories.
d9e4a3c1d4
...
d1de394cd9
@ -16,10 +16,10 @@ dependencies:
|
||||
version: 0.1.4+1
|
||||
moxxmpp:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: 0.1.6+1
|
||||
version: 0.1.6
|
||||
moxxmpp_socket_tcp:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: 0.1.2+9
|
||||
version: 0.1.2+8
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -1,7 +1,3 @@
|
||||
## 0.1.6+1
|
||||
|
||||
- **FIX**: Fix LMC not working.
|
||||
|
||||
## 0.1.6
|
||||
|
||||
- **FEAT**: Implement XEP-0308.
|
||||
|
@ -59,7 +59,6 @@ export 'package:moxxmpp/src/xeps/xep_0203.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0280.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0297.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0300.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0308.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0333.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0334.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0352.dart';
|
||||
@ -75,7 +74,6 @@ export 'package:moxxmpp/src/xeps/xep_0384/xep_0384.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0385.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0414.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0424.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0444.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0446.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0447.dart';
|
||||
export 'package:moxxmpp/src/xeps/xep_0448.dart';
|
||||
|
@ -9,7 +9,6 @@ import 'package:moxxmpp/src/xeps/xep_0085.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0359.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0385.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0424.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0444.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0446.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0447.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0461.dart';
|
||||
@ -76,7 +75,6 @@ class MessageEvent extends XmppEvent {
|
||||
this.funCancellation,
|
||||
this.messageRetraction,
|
||||
this.messageCorrectionId,
|
||||
this.messageReactions,
|
||||
});
|
||||
final StanzaError? error;
|
||||
final String body;
|
||||
@ -99,7 +97,6 @@ class MessageEvent extends XmppEvent {
|
||||
final bool encrypted;
|
||||
final MessageRetractionData? messageRetraction;
|
||||
final String? messageCorrectionId;
|
||||
final MessageReactions? messageReactions;
|
||||
final Map<String, dynamic> other;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import 'package:moxxmpp/src/xeps/xep_0359.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0380.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0385.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0424.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0444.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0446.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0447.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0461.dart';
|
||||
@ -62,8 +61,6 @@ class StanzaHandlerData with _$StanzaHandlerData {
|
||||
MessageRetractionData? messageRetraction,
|
||||
// If non-null, then the message is a correction for the specified stanza Id
|
||||
String? lastMessageCorrectionSid,
|
||||
// Reactions data
|
||||
MessageReactions? messageReactions,
|
||||
}
|
||||
) = _StanzaHandlerData;
|
||||
}
|
||||
|
@ -59,9 +59,7 @@ mixin _$StanzaHandlerData {
|
||||
// retracted
|
||||
MessageRetractionData? get messageRetraction =>
|
||||
throw _privateConstructorUsedError; // If non-null, then the message is a correction for the specified stanza Id
|
||||
String? get lastMessageCorrectionSid =>
|
||||
throw _privateConstructorUsedError; // Reactions data
|
||||
MessageReactions? get messageReactions => throw _privateConstructorUsedError;
|
||||
String? get lastMessageCorrectionSid => throw _privateConstructorUsedError;
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
$StanzaHandlerDataCopyWith<StanzaHandlerData> get copyWith =>
|
||||
@ -96,8 +94,7 @@ abstract class $StanzaHandlerDataCopyWith<$Res> {
|
||||
DelayedDelivery? delayedDelivery,
|
||||
Map<String, dynamic> other,
|
||||
MessageRetractionData? messageRetraction,
|
||||
String? lastMessageCorrectionSid,
|
||||
MessageReactions? messageReactions});
|
||||
String? lastMessageCorrectionSid});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -134,7 +131,6 @@ class _$StanzaHandlerDataCopyWithImpl<$Res>
|
||||
Object? other = freezed,
|
||||
Object? messageRetraction = freezed,
|
||||
Object? lastMessageCorrectionSid = freezed,
|
||||
Object? messageReactions = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
done: done == freezed
|
||||
@ -229,10 +225,6 @@ class _$StanzaHandlerDataCopyWithImpl<$Res>
|
||||
? _value.lastMessageCorrectionSid
|
||||
: lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
messageReactions: messageReactions == freezed
|
||||
? _value.messageReactions
|
||||
: messageReactions // ignore: cast_nullable_to_non_nullable
|
||||
as MessageReactions?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -267,8 +259,7 @@ abstract class _$$_StanzaHandlerDataCopyWith<$Res>
|
||||
DelayedDelivery? delayedDelivery,
|
||||
Map<String, dynamic> other,
|
||||
MessageRetractionData? messageRetraction,
|
||||
String? lastMessageCorrectionSid,
|
||||
MessageReactions? messageReactions});
|
||||
String? lastMessageCorrectionSid});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -307,7 +298,6 @@ class __$$_StanzaHandlerDataCopyWithImpl<$Res>
|
||||
Object? other = freezed,
|
||||
Object? messageRetraction = freezed,
|
||||
Object? lastMessageCorrectionSid = freezed,
|
||||
Object? messageReactions = freezed,
|
||||
}) {
|
||||
return _then(_$_StanzaHandlerData(
|
||||
done == freezed
|
||||
@ -402,10 +392,6 @@ class __$$_StanzaHandlerDataCopyWithImpl<$Res>
|
||||
? _value.lastMessageCorrectionSid
|
||||
: lastMessageCorrectionSid // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
messageReactions: messageReactions == freezed
|
||||
? _value.messageReactions
|
||||
: messageReactions // ignore: cast_nullable_to_non_nullable
|
||||
as MessageReactions?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -432,8 +418,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
|
||||
this.delayedDelivery,
|
||||
final Map<String, dynamic> other = const <String, dynamic>{},
|
||||
this.messageRetraction,
|
||||
this.lastMessageCorrectionSid,
|
||||
this.messageReactions})
|
||||
this.lastMessageCorrectionSid})
|
||||
: _other = other;
|
||||
|
||||
// Indicates to the runner that processing is now done. This means that all
|
||||
@ -516,13 +501,10 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
|
||||
// If non-null, then the message is a correction for the specified stanza Id
|
||||
@override
|
||||
final String? lastMessageCorrectionSid;
|
||||
// Reactions data
|
||||
@override
|
||||
final MessageReactions? messageReactions;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'StanzaHandlerData(done: $done, cancel: $cancel, cancelReason: $cancelReason, stanza: $stanza, retransmitted: $retransmitted, sims: $sims, sfs: $sfs, oob: $oob, stableId: $stableId, reply: $reply, chatState: $chatState, isCarbon: $isCarbon, deliveryReceiptRequested: $deliveryReceiptRequested, isMarkable: $isMarkable, fun: $fun, funReplacement: $funReplacement, funCancellation: $funCancellation, encrypted: $encrypted, encryptionType: $encryptionType, delayedDelivery: $delayedDelivery, other: $other, messageRetraction: $messageRetraction, lastMessageCorrectionSid: $lastMessageCorrectionSid, messageReactions: $messageReactions)';
|
||||
return 'StanzaHandlerData(done: $done, cancel: $cancel, cancelReason: $cancelReason, stanza: $stanza, retransmitted: $retransmitted, sims: $sims, sfs: $sfs, oob: $oob, stableId: $stableId, reply: $reply, chatState: $chatState, isCarbon: $isCarbon, deliveryReceiptRequested: $deliveryReceiptRequested, isMarkable: $isMarkable, fun: $fun, funReplacement: $funReplacement, funCancellation: $funCancellation, encrypted: $encrypted, encryptionType: $encryptionType, delayedDelivery: $delayedDelivery, other: $other, messageRetraction: $messageRetraction, lastMessageCorrectionSid: $lastMessageCorrectionSid)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -562,9 +544,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.messageRetraction, messageRetraction) &&
|
||||
const DeepCollectionEquality().equals(
|
||||
other.lastMessageCorrectionSid, lastMessageCorrectionSid) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.messageReactions, messageReactions));
|
||||
other.lastMessageCorrectionSid, lastMessageCorrectionSid));
|
||||
}
|
||||
|
||||
@override
|
||||
@ -592,8 +572,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
|
||||
const DeepCollectionEquality().hash(delayedDelivery),
|
||||
const DeepCollectionEquality().hash(_other),
|
||||
const DeepCollectionEquality().hash(messageRetraction),
|
||||
const DeepCollectionEquality().hash(lastMessageCorrectionSid),
|
||||
const DeepCollectionEquality().hash(messageReactions)
|
||||
const DeepCollectionEquality().hash(lastMessageCorrectionSid)
|
||||
]);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@ -624,8 +603,7 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
|
||||
final DelayedDelivery? delayedDelivery,
|
||||
final Map<String, dynamic> other,
|
||||
final MessageRetractionData? messageRetraction,
|
||||
final String? lastMessageCorrectionSid,
|
||||
final MessageReactions? messageReactions}) = _$_StanzaHandlerData;
|
||||
final String? lastMessageCorrectionSid}) = _$_StanzaHandlerData;
|
||||
|
||||
@override // Indicates to the runner that processing is now done. This means that all
|
||||
// pre-processing is done and no other handlers should be consulted.
|
||||
@ -680,8 +658,6 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
|
||||
MessageRetractionData? get messageRetraction;
|
||||
@override // If non-null, then the message is a correction for the specified stanza Id
|
||||
String? get lastMessageCorrectionSid;
|
||||
@override // Reactions data
|
||||
MessageReactions? get messageReactions;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$_StanzaHandlerDataCopyWith<_$_StanzaHandlerData> get copyWith =>
|
||||
|
@ -26,4 +26,3 @@ const cryptographicHashManager = 'org.moxxmpp.cryptographichashmanager';
|
||||
const delayedDeliveryManager = 'org.moxxmpp.delayeddeliverymanager';
|
||||
const messageRetractionManager = 'org.moxxmpp.messageretractionmanager';
|
||||
const lastMessageCorrectionManager = 'org.moxxmpp.lastmessagecorrectionmanager';
|
||||
const messageReactionsManager = 'org.moxxmpp.messagereactionsmanager';
|
||||
|
@ -15,7 +15,6 @@ import 'package:moxxmpp/src/xeps/xep_0308.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0333.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0359.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0424.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0444.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0446.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0447.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0448.dart';
|
||||
@ -39,7 +38,6 @@ class MessageDetails {
|
||||
this.shouldEncrypt = false,
|
||||
this.messageRetraction,
|
||||
this.lastMessageCorrectionId,
|
||||
this.messageReactions,
|
||||
});
|
||||
final String to;
|
||||
final String? body;
|
||||
@ -58,7 +56,6 @@ class MessageDetails {
|
||||
final bool shouldEncrypt;
|
||||
final MessageRetractionData? messageRetraction;
|
||||
final String? lastMessageCorrectionId;
|
||||
final MessageReactions? messageReactions;
|
||||
}
|
||||
|
||||
class MessageManager extends XmppManagerBase {
|
||||
@ -105,7 +102,6 @@ class MessageManager extends XmppManagerBase {
|
||||
encrypted: state.encrypted,
|
||||
messageRetraction: state.messageRetraction,
|
||||
messageCorrectionId: state.lastMessageCorrectionSid,
|
||||
messageReactions: state.messageReactions,
|
||||
other: state.other,
|
||||
error: StanzaError.fromStanza(message),
|
||||
),);
|
||||
@ -265,10 +261,6 @@ class MessageManager extends XmppManagerBase {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (details.messageReactions != null) {
|
||||
stanza.addChild(details.messageReactions!.toXml());
|
||||
}
|
||||
|
||||
getAttributes().sendStanza(stanza, awaitable: false);
|
||||
}
|
||||
|
@ -123,12 +123,9 @@ const fasteningXmlns = 'urn:xmpp:fasten:0';
|
||||
// XEP-0424
|
||||
const messageRetractionXmlns = 'urn:xmpp:message-retract:0';
|
||||
|
||||
// XEP-0428
|
||||
// XEp-0428
|
||||
const fallbackIndicationXmlns = 'urn:xmpp:fallback:0';
|
||||
|
||||
// XEP-0444
|
||||
const messageReactionsXmlns = 'urn:xmpp:reactions:0';
|
||||
|
||||
// XEP-0446
|
||||
const fileMetadataXmlns = 'urn:xmpp:file:metadata:0';
|
||||
|
||||
|
@ -30,8 +30,8 @@ class LastMessageCorrectionManager extends XmppManagerBase {
|
||||
List<StanzaHandler> getIncomingStanzaHandlers() => [
|
||||
StanzaHandler(
|
||||
stanzaTag: 'message',
|
||||
tagName: 'replace',
|
||||
tagXmlns: lmcXmlns,
|
||||
tagName: 'reply',
|
||||
tagXmlns: replyXmlns,
|
||||
callback: _onMessage,
|
||||
// Before the message handler
|
||||
priority: -99,
|
||||
@ -42,7 +42,9 @@ class LastMessageCorrectionManager extends XmppManagerBase {
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
Future<StanzaHandlerData> _onMessage(Stanza stanza, StanzaHandlerData state) async {
|
||||
final edit = stanza.firstTag('replace', xmlns: lmcXmlns)!;
|
||||
final edit = stanza.firstTag('replace', xmlns: lmcXmlns);
|
||||
if (edit == null) return state;
|
||||
|
||||
return state.copyWith(
|
||||
lastMessageCorrectionSid: edit.attributes['id']! as String,
|
||||
);
|
||||
|
@ -1,68 +0,0 @@
|
||||
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/namespaces.dart';
|
||||
import 'package:moxxmpp/src/stanza.dart';
|
||||
import 'package:moxxmpp/src/stringxml.dart';
|
||||
|
||||
class MessageReactions {
|
||||
const MessageReactions(this.messageId, this.emojis);
|
||||
final String messageId;
|
||||
final List<String> emojis;
|
||||
|
||||
XMLNode toXml() {
|
||||
return XMLNode.xmlns(
|
||||
tag: 'reactions',
|
||||
xmlns: messageReactionsXmlns,
|
||||
attributes: <String, String>{
|
||||
'id': messageId,
|
||||
},
|
||||
children: emojis.map((emoji) {
|
||||
return XMLNode(
|
||||
tag: 'reaction',
|
||||
text: emoji,
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MessageReactionsManager extends XmppManagerBase {
|
||||
@override
|
||||
List<String> getDiscoFeatures() => [ messageReactionsXmlns ];
|
||||
|
||||
@override
|
||||
String getName() => 'MessageReactionsManager';
|
||||
|
||||
@override
|
||||
String getId() => messageReactionsManager;
|
||||
|
||||
@override
|
||||
List<StanzaHandler> getIncomingStanzaHandlers() => [
|
||||
StanzaHandler(
|
||||
stanzaTag: 'message',
|
||||
tagName: 'reactions',
|
||||
tagXmlns: messageReactionsXmlns,
|
||||
callback: _onReactionsReceived,
|
||||
// Before the message handler
|
||||
priority: -99,
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
Future<bool> isSupported() async => true;
|
||||
|
||||
Future<StanzaHandlerData> _onReactionsReceived(Stanza message, StanzaHandlerData state) async {
|
||||
final reactionsElement = message.firstTag('reactions', xmlns: messageReactionsXmlns)!;
|
||||
return state.copyWith(
|
||||
messageReactions: MessageReactions(
|
||||
reactionsElement.attributes['id']! as String,
|
||||
reactionsElement.children
|
||||
.where((c) => c.tag == 'reaction')
|
||||
.map((c) => c.innerText())
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
name: moxxmpp
|
||||
description: A pure-Dart XMPP library
|
||||
version: 0.1.6+1
|
||||
version: 0.1.6
|
||||
homepage: https://codeberg.org/moxxy/moxxmpp
|
||||
publish_to: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
|
||||
@ -31,6 +31,6 @@ dev_dependencies:
|
||||
build_runner: ^2.1.11
|
||||
moxxmpp_socket_tcp:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: ^0.1.2+9
|
||||
version: ^0.1.2+8
|
||||
test: ^1.16.0
|
||||
very_good_analysis: ^3.0.1
|
||||
|
@ -1,7 +1,3 @@
|
||||
## 0.1.2+9
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
||||
## 0.1.2+8
|
||||
|
||||
- Update a dependency to the latest release.
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: moxxmpp_socket_tcp
|
||||
description: A socket for moxxmpp using TCP that implements the RFC6120 connection algorithm and XEP-0368
|
||||
version: 0.1.2+9
|
||||
version: 0.1.2+8
|
||||
homepage: https://codeberg.org/moxxy/moxxmpp
|
||||
publish_to: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
|
||||
@ -12,7 +12,7 @@ dependencies:
|
||||
meta: ^1.6.0
|
||||
moxxmpp:
|
||||
hosted: https://git.polynom.me/api/packages/Moxxy/pub
|
||||
version: ^0.1.6+1
|
||||
version: ^0.1.6
|
||||
|
||||
dev_dependencies:
|
||||
lints: ^2.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user