Compare commits

..

No commits in common. "edc86a10b3407cae1f63e63aecac9e7461225d1f" and "300a52f9fe2af18eb091adeccbe706afc7e32e12" have entirely different histories.

13 changed files with 15 additions and 173 deletions

View File

@ -16,10 +16,10 @@ dependencies:
version: 0.1.4+1
moxxmpp:
hosted: https://git.polynom.me/api/packages/Moxxy/pub
version: 0.1.3+1
version: 0.1.2+3
moxxmpp_socket_tcp:
hosted: https://git.polynom.me/api/packages/Moxxy/pub
version: 0.1.2+5
version: 0.1.2+3
dev_dependencies:
flutter_test:

View File

@ -1,13 +1,3 @@
## 0.1.3+1
- **FIX**: Expose the error classes.
## 0.1.3
- **REFACTOR**: Replace MayFail by Result.
- **FIX**: Remove the old Results API.
- **FEAT**: Rework how the negotiator system works.
## 0.1.2+3
- **FIX**: SASL SCRAM-SHA-{256,512} should now work.

View File

@ -1,7 +1,6 @@
library moxxmpp;
export 'package:moxxmpp/src/connection.dart';
export 'package:moxxmpp/src/errors.dart';
export 'package:moxxmpp/src/events.dart';
export 'package:moxxmpp/src/iq.dart';
export 'package:moxxmpp/src/jid.dart';
@ -17,7 +16,6 @@ export 'package:moxxmpp/src/negotiators/manager.dart';
export 'package:moxxmpp/src/negotiators/namespaces.dart';
export 'package:moxxmpp/src/negotiators/negotiator.dart';
export 'package:moxxmpp/src/negotiators/resource_binding.dart';
export 'package:moxxmpp/src/negotiators/sasl/errors.dart';
export 'package:moxxmpp/src/negotiators/sasl/negotiator.dart';
export 'package:moxxmpp/src/negotiators/sasl/plain.dart';
export 'package:moxxmpp/src/negotiators/sasl/scram.dart';
@ -73,7 +71,6 @@ export 'package:moxxmpp/src/xeps/xep_0384/types.dart';
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_0446.dart';
export 'package:moxxmpp/src/xeps/xep_0447.dart';
export 'package:moxxmpp/src/xeps/xep_0448.dart';

View File

@ -8,7 +8,6 @@ import 'package:moxxmpp/src/xeps/xep_0066.dart';
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_0446.dart';
import 'package:moxxmpp/src/xeps/xep_0447.dart';
import 'package:moxxmpp/src/xeps/xep_0461.dart';
@ -72,7 +71,6 @@ class MessageEvent extends XmppEvent {
this.fun,
this.funReplacement,
this.funCancellation,
this.messageRetraction,
});
final String body;
final JID fromJid;
@ -92,7 +90,6 @@ class MessageEvent extends XmppEvent {
final String? funReplacement;
final String? funCancellation;
final bool encrypted;
final MessageRetractionData? messageRetraction;
final Map<String, dynamic> other;
}

View File

@ -6,7 +6,6 @@ import 'package:moxxmpp/src/xeps/xep_0203.dart';
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_0446.dart';
import 'package:moxxmpp/src/xeps/xep_0447.dart';
import 'package:moxxmpp/src/xeps/xep_0461.dart';
@ -56,9 +55,6 @@ class StanzaHandlerData with _$StanzaHandlerData {
// This is for stanza handlers that are not part of the XMPP library but still need
// pass data around.
@Default(<String, dynamic>{}) Map<String, dynamic> other,
// If non-null, then it indicates the origin Id of the message that should be
// retracted
MessageRetractionData? messageRetraction,
}
) = _StanzaHandlerData;
}

View File

@ -54,11 +54,7 @@ mixin _$StanzaHandlerData {
DelayedDelivery? get delayedDelivery =>
throw _privateConstructorUsedError; // This is for stanza handlers that are not part of the XMPP library but still need
// pass data around.
Map<String, dynamic> get other =>
throw _privateConstructorUsedError; // If non-null, then it indicates the origin Id of the message that should be
// retracted
MessageRetractionData? get messageRetraction =>
throw _privateConstructorUsedError;
Map<String, dynamic> get other => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$StanzaHandlerDataCopyWith<StanzaHandlerData> get copyWith =>
@ -91,8 +87,7 @@ abstract class $StanzaHandlerDataCopyWith<$Res> {
bool encrypted,
ExplicitEncryptionType? encryptionType,
DelayedDelivery? delayedDelivery,
Map<String, dynamic> other,
MessageRetractionData? messageRetraction});
Map<String, dynamic> other});
}
/// @nodoc
@ -127,7 +122,6 @@ class _$StanzaHandlerDataCopyWithImpl<$Res>
Object? encryptionType = freezed,
Object? delayedDelivery = freezed,
Object? other = freezed,
Object? messageRetraction = freezed,
}) {
return _then(_value.copyWith(
done: done == freezed
@ -214,10 +208,6 @@ class _$StanzaHandlerDataCopyWithImpl<$Res>
? _value.other
: other // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
messageRetraction: messageRetraction == freezed
? _value.messageRetraction
: messageRetraction // ignore: cast_nullable_to_non_nullable
as MessageRetractionData?,
));
}
}
@ -250,8 +240,7 @@ abstract class _$$_StanzaHandlerDataCopyWith<$Res>
bool encrypted,
ExplicitEncryptionType? encryptionType,
DelayedDelivery? delayedDelivery,
Map<String, dynamic> other,
MessageRetractionData? messageRetraction});
Map<String, dynamic> other});
}
/// @nodoc
@ -288,7 +277,6 @@ class __$$_StanzaHandlerDataCopyWithImpl<$Res>
Object? encryptionType = freezed,
Object? delayedDelivery = freezed,
Object? other = freezed,
Object? messageRetraction = freezed,
}) {
return _then(_$_StanzaHandlerData(
done == freezed
@ -375,10 +363,6 @@ class __$$_StanzaHandlerDataCopyWithImpl<$Res>
? _value._other
: other // ignore: cast_nullable_to_non_nullable
as Map<String, dynamic>,
messageRetraction: messageRetraction == freezed
? _value.messageRetraction
: messageRetraction // ignore: cast_nullable_to_non_nullable
as MessageRetractionData?,
));
}
}
@ -403,8 +387,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
this.encrypted = false,
this.encryptionType,
this.delayedDelivery,
final Map<String, dynamic> other = const <String, dynamic>{},
this.messageRetraction})
final Map<String, dynamic> other = const <String, dynamic>{}})
: _other = other;
// Indicates to the runner that processing is now done. This means that all
@ -480,14 +463,9 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
return EqualUnmodifiableMapView(_other);
}
// If non-null, then it indicates the origin Id of the message that should be
// retracted
@override
final MessageRetractionData? messageRetraction;
@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)';
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)';
}
@override
@ -523,9 +501,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
.equals(other.encryptionType, encryptionType) &&
const DeepCollectionEquality()
.equals(other.delayedDelivery, delayedDelivery) &&
const DeepCollectionEquality().equals(other._other, this._other) &&
const DeepCollectionEquality()
.equals(other.messageRetraction, messageRetraction));
const DeepCollectionEquality().equals(other._other, this._other));
}
@override
@ -551,8 +527,7 @@ class _$_StanzaHandlerData implements _StanzaHandlerData {
const DeepCollectionEquality().hash(encrypted),
const DeepCollectionEquality().hash(encryptionType),
const DeepCollectionEquality().hash(delayedDelivery),
const DeepCollectionEquality().hash(_other),
const DeepCollectionEquality().hash(messageRetraction)
const DeepCollectionEquality().hash(_other)
]);
@JsonKey(ignore: true)
@ -581,8 +556,7 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
final bool encrypted,
final ExplicitEncryptionType? encryptionType,
final DelayedDelivery? delayedDelivery,
final Map<String, dynamic> other,
final MessageRetractionData? messageRetraction}) = _$_StanzaHandlerData;
final Map<String, dynamic> other}) = _$_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.
@ -632,9 +606,6 @@ abstract class _StanzaHandlerData implements StanzaHandlerData {
@override // This is for stanza handlers that are not part of the XMPP library but still need
// pass data around.
Map<String, dynamic> get other;
@override // If non-null, then it indicates the origin Id of the message that should be
// retracted
MessageRetractionData? get messageRetraction;
@override
@JsonKey(ignore: true)
_$$_StanzaHandlerDataCopyWith<_$_StanzaHandlerData> get copyWith =>

View File

@ -24,4 +24,3 @@ const omemoManager = 'org.moxxmpp.omemomanager';
const emeManager = 'org.moxxmpp.ememanager';
const cryptographicHashManager = 'org.moxxmpp.cryptographichashmanager';
const delayedDeliveryManager = 'org.moxxmpp.delayeddeliverymanager';
const messageRetractionManager = 'org.moxxmpp.messageretractionmanager';

View File

@ -13,12 +13,12 @@ import 'package:moxxmpp/src/xeps/xep_0085.dart';
import 'package:moxxmpp/src/xeps/xep_0184.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_0446.dart';
import 'package:moxxmpp/src/xeps/xep_0447.dart';
import 'package:moxxmpp/src/xeps/xep_0448.dart';
class MessageDetails {
const MessageDetails({
required this.to,
this.body,
@ -35,7 +35,6 @@ class MessageDetails {
this.funReplacement,
this.funCancellation,
this.shouldEncrypt = false,
this.messageRetraction,
});
final String to;
final String? body;
@ -52,7 +51,6 @@ class MessageDetails {
final String? funReplacement;
final String? funCancellation;
final bool shouldEncrypt;
final MessageRetractionData? messageRetraction;
}
class MessageManager extends XmppManagerBase {
@ -97,7 +95,6 @@ class MessageManager extends XmppManagerBase {
funReplacement: state.funReplacement,
funCancellation: state.funCancellation,
encrypted: state.encrypted,
messageRetraction: state.messageRetraction,
other: state.other,
),);
@ -162,8 +159,6 @@ class MessageManager extends XmppManagerBase {
} else if (firstSource is StatelessFileSharingEncryptedSource) {
body = firstSource.source.url;
}
} else if (details.messageRetraction?.fallback != null) {
body = details.messageRetraction!.fallback;
}
stanza.addChild(
@ -222,33 +217,6 @@ class MessageManager extends XmppManagerBase {
);
}
if (details.messageRetraction != null) {
stanza.addChild(
XMLNode.xmlns(
tag: 'apply-to',
xmlns: fasteningXmlns,
attributes: <String, String>{
'id': details.messageRetraction!.id,
},
children: [
XMLNode.xmlns(
tag: 'retract',
xmlns: messageRetractionXmlns,
),
],
),
);
if (details.messageRetraction!.fallback != null) {
stanza.addChild(
XMLNode.xmlns(
tag: 'fallback',
xmlns: fallbackIndicationXmlns,
),
);
}
}
getAttributes().sendStanza(stanza, awaitable: false);
}
}

View File

@ -114,15 +114,6 @@ const simsXmlns = 'urn:xmpp:sims:1';
// XEP-0420
const sceXmlns = 'urn:xmpp:sce:1';
// XEP-0422
const fasteningXmlns = 'urn:xmpp:fasten:0';
// XEP-0424
const messageRetractionXmlns = 'urn:xmpp:message-retract:0';
// XEp-0428
const fallbackIndicationXmlns = 'urn:xmpp:fallback:0';
// XEP-0446
const fileMetadataXmlns = 'urn:xmpp:file:metadata:0';

View File

@ -1,59 +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';
class MessageRetractionData {
MessageRetractionData(this.id, this.fallback);
final String? fallback;
final String id;
}
class MessageRetractionManager extends XmppManagerBase {
@override
String getName() => 'MessageRetractionManager';
@override
String getId() => messageRetractionManager;
@override
List<String> getDiscoFeatures() => [ messageRetractionXmlns ];
@override
List<StanzaHandler> getIncomingStanzaHandlers() => [
StanzaHandler(
stanzaTag: 'message',
callback: _onMessage,
// Before the MessageManager
priority: -99,
)
];
@override
Future<bool> isSupported() async => true;
Future<StanzaHandlerData> _onMessage(Stanza message, StanzaHandlerData state) async {
final applyTo = message.firstTag('apply-to', xmlns: fasteningXmlns);
if (applyTo == null) {
return state;
}
final retract = applyTo.firstTag('retract', xmlns: messageRetractionXmlns);
if (retract == null) {
return state;
}
final isFallbackBody = message.firstTag('fallback', xmlns: fallbackIndicationXmlns) != null;
return state.copyWith(
messageRetraction: MessageRetractionData(
applyTo.attributes['id']! as String,
isFallbackBody ?
message.firstTag('body')?.innerText() :
null,
),
);
}
}

View File

@ -1,6 +1,6 @@
name: moxxmpp
description: A pure-Dart XMPP library
version: 0.1.3+1
version: 0.1.2+3
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+5
version: ^0.1.2+3
test: ^1.16.0
very_good_analysis: ^3.0.1

View File

@ -1,11 +1,3 @@
## 0.1.2+5
- Update a dependency to the latest release.
## 0.1.2+4
- Update a dependency to the latest release.
## 0.1.2+3
- Update a dependency to the latest release.

View File

@ -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+5
version: 0.1.2+3
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.3+1
version: ^0.1.2+3
dev_dependencies:
lints: ^2.0.0