Compare commits
No commits in common. "308f7d93f5cfc5c5b46e9eeb4bdb20c9ae02ea5e" and "9cb6346c4d94d8b878330d42af0f9c45e5ce772d" have entirely different histories.
308f7d93f5
...
9cb6346c4d
@ -110,6 +110,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
jid: JID.fromString(jidController.text),
|
||||
password: passwordController.text,
|
||||
useDirectTLS: true,
|
||||
// If `allowPlainAuth` is `false`, connecting to some
|
||||
// servers will cause apps to hang, and never connect.
|
||||
// The hang is a bug that will be fixed, so when it is,
|
||||
// allowPlainAuth should be set to false.
|
||||
allowPlainAuth: true,
|
||||
),
|
||||
);
|
||||
final result = await connection.connect(waitUntilLogin: true);
|
||||
@ -117,14 +122,14 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
connected = result.isType<bool>() && result.get<bool>();
|
||||
loading = false;
|
||||
});
|
||||
if (result.isType<XmppError>()) {
|
||||
logger.severe(result.get<XmppError>());
|
||||
if (result.isType<XmppConnectionError>()) {
|
||||
logger.severe(result.get<XmppConnectionError>());
|
||||
if (context.mounted) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(result.get<XmppError>().toString()),
|
||||
content: Text(result.get<XmppConnectionError>().toString()),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
## 0.3.0
|
||||
|
||||
- **BREAKING**: Removed `connectAwaitable` and merged it with `connect`.
|
||||
- **BREAKING**: Removed `allowPlainAuth` from `ConnectionSettings`. If you don't want to use SASL PLAIN, don't register the negotiator. If you want to only conditionally use SASL PLAIN, extend the `SaslPlainNegotiator` and override its `matchesFeature` method to only call the super method when SASL PLAIN should be used.
|
||||
|
||||
## 0.1.6+1
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
library moxxmpp;
|
||||
|
||||
export 'package:moxxmpp/src/connection.dart';
|
||||
export 'package:moxxmpp/src/connection_errors.dart';
|
||||
export 'package:moxxmpp/src/connectivity.dart';
|
||||
export 'package:moxxmpp/src/errors.dart';
|
||||
export 'package:moxxmpp/src/events.dart';
|
||||
|
@ -395,7 +395,9 @@ class XmppConnection {
|
||||
);
|
||||
_connectionCompleter?.complete(
|
||||
Result(
|
||||
error,
|
||||
StreamFailureError(
|
||||
error,
|
||||
),
|
||||
),
|
||||
);
|
||||
_connectionCompleter = null;
|
||||
@ -873,7 +875,7 @@ class XmppConnection {
|
||||
}
|
||||
|
||||
Future<void> _executeCurrentNegotiator(XMLNode nonza) async {
|
||||
// If we don't have a negotiator, get one
|
||||
// If we don't have a negotiator get one
|
||||
_currentNegotiator ??= getNextNegotiator(_streamFeatures);
|
||||
if (_currentNegotiator == null &&
|
||||
_isMandatoryNegotiationDone(_streamFeatures) &&
|
||||
@ -884,25 +886,6 @@ class XmppConnection {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't have a next negotiator, we have to bail
|
||||
if (_currentNegotiator == null &&
|
||||
!_isMandatoryNegotiationDone(_streamFeatures) &&
|
||||
!_isNegotiationPossible(_streamFeatures)) {
|
||||
// We failed before authenticating
|
||||
if (!_isAuthenticated) {
|
||||
_log.severe('No negotiator could be picked while unauthenticated');
|
||||
await _resetIsConnectionRunning();
|
||||
await handleError(NoMatchingAuthenticationMechanismAvailableError());
|
||||
return;
|
||||
} else {
|
||||
_log.severe(
|
||||
'No negotiator could be picked while negotiations are not done');
|
||||
await _resetIsConnectionRunning();
|
||||
await handleError(NoAuthenticatorAvailableError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final result = await _currentNegotiator!.negotiate(nonza);
|
||||
if (result.isType<NegotiatorError>()) {
|
||||
_log.severe('Negotiator returned an error');
|
||||
|
@ -2,22 +2,16 @@ import 'package:moxxmpp/src/errors.dart';
|
||||
import 'package:moxxmpp/src/negotiators/negotiator.dart';
|
||||
|
||||
/// The reason a call to `XmppConnection.connect` failed.
|
||||
abstract class XmppConnectionError extends XmppError {}
|
||||
abstract class XmppConnectionError {}
|
||||
|
||||
/// Returned by `XmppConnection.connect` when a connection is already active.
|
||||
class ConnectionAlreadyRunningError extends XmppConnectionError {
|
||||
@override
|
||||
bool isRecoverable() => true;
|
||||
}
|
||||
class ConnectionAlreadyRunningError extends XmppConnectionError {}
|
||||
|
||||
/// Returned by `XmppConnection.connect` when a negotiator returned an unrecoverable
|
||||
/// error. Only returned when waitUntilLogin is true.
|
||||
class NegotiatorReturnedError extends XmppConnectionError {
|
||||
NegotiatorReturnedError(this.error);
|
||||
|
||||
@override
|
||||
bool isRecoverable() => error.isRecoverable();
|
||||
|
||||
/// The error returned by the negotiator.
|
||||
final NegotiatorError error;
|
||||
}
|
||||
@ -25,30 +19,10 @@ class NegotiatorReturnedError extends XmppConnectionError {
|
||||
class StreamFailureError extends XmppConnectionError {
|
||||
StreamFailureError(this.error);
|
||||
|
||||
@override
|
||||
bool isRecoverable() => error.isRecoverable();
|
||||
|
||||
/// The error that causes a connection failure.
|
||||
final XmppError error;
|
||||
}
|
||||
|
||||
/// Returned by `XmppConnection.connect` when no connection could
|
||||
/// be established.
|
||||
class NoConnectionPossibleError extends XmppConnectionError {
|
||||
@override
|
||||
bool isRecoverable() => true;
|
||||
}
|
||||
|
||||
/// Returned if no matching authentication mechanism has been presented
|
||||
class NoMatchingAuthenticationMechanismAvailableError
|
||||
extends XmppConnectionError {
|
||||
@override
|
||||
bool isRecoverable() => false;
|
||||
}
|
||||
|
||||
/// Returned if no negotiator was picked, even though negotiations are not done
|
||||
/// yet.
|
||||
class NoAuthenticatorAvailableError extends XmppConnectionError {
|
||||
@override
|
||||
bool isRecoverable() => false;
|
||||
}
|
||||
class NoConnectionPossibleError extends XmppConnectionError {}
|
||||
|
@ -28,6 +28,8 @@ class SaslPlainNegotiator extends SaslNegotiator {
|
||||
|
||||
@override
|
||||
bool matchesFeature(List<XMLNode> features) {
|
||||
if (!attributes.getConnectionSettings().allowPlainAuth) return false;
|
||||
|
||||
if (super.matchesFeature(features)) {
|
||||
if (!attributes.getSocket().isSecure()) {
|
||||
_log.warning(
|
||||
|
@ -5,8 +5,10 @@ class ConnectionSettings {
|
||||
required this.jid,
|
||||
required this.password,
|
||||
required this.useDirectTLS,
|
||||
required this.allowPlainAuth,
|
||||
});
|
||||
final JID jid;
|
||||
final String password;
|
||||
final bool useDirectTLS;
|
||||
final bool allowPlainAuth;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class TestingManagerHolder {
|
||||
jid: jid,
|
||||
password: 'abc123',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
);
|
||||
|
||||
Future<XMLNode> _sendStanza(
|
||||
|
@ -51,8 +51,11 @@ class StanzaExpectation extends ExpectationBase {
|
||||
}
|
||||
}
|
||||
|
||||
/// Use [settings] to build the beginning of a play that can be used with StubTCPSocket. [settings]'s allowPlainAuth must
|
||||
/// be set to true.
|
||||
List<ExpectationBase> buildAuthenticatedPlay(ConnectionSettings settings) {
|
||||
assert(settings.allowPlainAuth, 'SASL PLAIN must be allowed');
|
||||
|
||||
final plain = base64.encode(
|
||||
utf8.encode('\u0000${settings.jid.local}\u0000${settings.password}'),
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ void main() {
|
||||
initLogger();
|
||||
|
||||
final stubSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -74,6 +74,7 @@ void main() {
|
||||
jid: JID.fromString('user@test.server'),
|
||||
password: 'abc123',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
);
|
||||
final features = [
|
||||
|
@ -36,13 +36,13 @@ final scramSha256StreamFeatures = XMLNode(
|
||||
);
|
||||
|
||||
void main() {
|
||||
final fakeSocket = StubTCPSocket([]);
|
||||
final fakeSocket = StubTCPSocket(play: []);
|
||||
test('Test SASL SCRAM-SHA-1', () async {
|
||||
final negotiator = SaslScramNegotiator(0, 'n=user,r=fyko+d2lbbFgONRv9qkxdawL', 'fyko+d2lbbFgONRv9qkxdawL', ScramHashType.sha1);
|
||||
negotiator.register(
|
||||
NegotiatorAttributes(
|
||||
(XMLNode _, {String? redact}) {},
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true, allowPlainAuth: true),
|
||||
(_) async {},
|
||||
getNegotiatorNullStub,
|
||||
getManagerNullStub,
|
||||
@ -106,7 +106,7 @@ void main() {
|
||||
negotiator.register(
|
||||
NegotiatorAttributes(
|
||||
(XMLNode n, {String? redact}) => lastMessage = n.innerText(),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true, allowPlainAuth: true),
|
||||
(_) async {},
|
||||
getNegotiatorNullStub,
|
||||
getManagerNullStub,
|
||||
@ -138,7 +138,7 @@ void main() {
|
||||
negotiator.register(
|
||||
NegotiatorAttributes(
|
||||
(XMLNode _, {String? redact}) {},
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true, allowPlainAuth: true),
|
||||
(_) async {},
|
||||
getNegotiatorNullStub,
|
||||
getManagerNullStub,
|
||||
@ -160,7 +160,7 @@ void main() {
|
||||
negotiator.register(
|
||||
NegotiatorAttributes(
|
||||
(XMLNode _, {String? redact}) {},
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true, allowPlainAuth: true),
|
||||
(_) async {},
|
||||
getNegotiatorNullStub,
|
||||
getManagerNullStub,
|
||||
@ -186,7 +186,7 @@ void main() {
|
||||
negotiator.register(
|
||||
NegotiatorAttributes(
|
||||
(XMLNode _, {String? redact}) {},
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true),
|
||||
() => ConnectionSettings(jid: JID.fromString('user@server'), password: 'pencil', useDirectTLS: true, allowPlainAuth: true),
|
||||
(_) async {},
|
||||
getNegotiatorNullStub,
|
||||
getManagerNullStub,
|
||||
|
@ -10,7 +10,7 @@ void main() {
|
||||
|
||||
test('Test having multiple disco requests for the same JID', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -78,6 +78,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
|
@ -29,11 +29,12 @@ XmppManagerAttributes mkAttributes(void Function(Stanza) callback) {
|
||||
jid: JID.fromString('hallo@example.server'),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('hallo@example.server/uwu'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
getNegotiatorById: getNegotiatorNullStub,
|
||||
);
|
||||
}
|
||||
@ -179,7 +180,7 @@ void main() {
|
||||
|
||||
test('Test counting incoming stanzas for which handlers end early', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -241,6 +242,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
final sm = StreamManagementManager();
|
||||
conn.registerManagers([
|
||||
@ -295,7 +297,7 @@ void main() {
|
||||
|
||||
test('Test counting incoming stanzas that are awaited', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -367,6 +369,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
final sm = StreamManagementManager();
|
||||
conn.registerManagers([
|
||||
@ -464,7 +467,7 @@ void main() {
|
||||
group('Test the negotiator', () {
|
||||
test('Test successful stream enablement', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -526,6 +529,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
@ -555,7 +559,7 @@ void main() {
|
||||
|
||||
test('Test a failed stream resumption', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -621,6 +625,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
@ -659,7 +664,7 @@ void main() {
|
||||
|
||||
test('Test a successful stream resumption', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -716,6 +721,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
|
@ -17,11 +17,12 @@ void main() {
|
||||
jid: JID.fromString('bob@xmpp.example'),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('bob@xmpp.example/uwu'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
getNegotiatorById: getNegotiatorNullStub,
|
||||
);
|
||||
final manager = CarbonsManager();
|
||||
|
@ -43,13 +43,14 @@ void main() {
|
||||
jid: JID.fromString('some.user@example.server'),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
getManagerById: getManagerNullStub,
|
||||
getNegotiatorById: getUnsupportedCSINegotiator,
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('some.user@example.server/aaaaa'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
),
|
||||
);
|
||||
|
||||
@ -71,13 +72,14 @@ void main() {
|
||||
jid: JID.fromString('some.user@example.server'),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
getManagerById: getManagerNullStub,
|
||||
getNegotiatorById: getSupportedCSINegotiator,
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('some.user@example.server/aaaaa'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -1,228 +0,0 @@
|
||||
import 'package:test/test.dart';
|
||||
import 'package:moxxmpp/moxxmpp.dart';
|
||||
|
||||
void main() {
|
||||
test('Test parsing a large sticker pack', () {
|
||||
// Example sticker pack based on the "miho" sticker pack by Movim
|
||||
final rawPack = XMLNode.fromString('''
|
||||
<pack xmlns='urn:xmpp:stickers:0'>
|
||||
<name>Miho</name>
|
||||
<summary>XMPP-chan.</summary>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho no:</desc>
|
||||
<name>no.png</name>
|
||||
<size>32088</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>LmIVPPPfOfmf8JLCCi0UFbjzILuRhJlkgzeN/nKIrm8=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/fd759226e3ec153956f3e941b81ed820614792a6.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho good:</desc>
|
||||
<name>good.png</name>
|
||||
<size>35529</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>Yu8qycCh5e3ZjZGTL5jadHAzni8ufvI+9Y7sKXjFLfE=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/100bdb0e14c557b87ad4d253018b71eb65b80725.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho think:</desc>
|
||||
<name>think.png</name>
|
||||
<size>36045</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>imQS2JiFO6S0e49p090ZVMDUhMK00LNWvRIpZJCF3wE=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/fc0f48df75138fa0f3aec605629226b8ac57c639.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho sorry:</desc>
|
||||
<name>sorry.png</name>
|
||||
<size>29542</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>ypwf+tCDjfHYRWNccIM0mh48IwP9YO/xieCZ5EwIUoY=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/f038ef01f098cae73a727618c0fbf9adf3e96ef6.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho confused:</desc>
|
||||
<name>confused.png</name>
|
||||
<size>35965</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>Za809qdsDuCrDsPxpPAlTrEY4c10Wiap4IXtb+F+dEo=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/eb7d0dd12b283017edee25243c3edacd62033ed0.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho sparkle:</desc>
|
||||
<name>sparkle.png</name>
|
||||
<size>35965</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>PaNrKyVZtSrqf/qLcf3K6h5u9l90h+P803hDU/yrh9M=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/e599dca3de182a821ef2e92234fb2bfca04a325e.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho glad:</desc>
|
||||
<name>glad.png</name>
|
||||
<size>55894</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>EeNaIsEp026KJL/OGCluO0lMuFBcqN/FACUBF52lDDc=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/580999b6110e859e336229913a73ec0ae640ef06.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho shock:</desc>
|
||||
<name>shock.png</name>
|
||||
<size>34478</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>nvoMdblXUoJonvGeMJUgmCOAww17mwNgaQInT1vmi2s=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/c42fc57e5234c4d19a2455178eff2b30bced20ef.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho stare:</desc>
|
||||
<name>stare.png</name>
|
||||
<size>34574</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>VDhOMXWPeLL64rhJ/SBTz/Remt7AWhxb0HzdPYc48tY=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/c069c6deff735fab3e4416ca354594a64a79ae40.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho happy:</desc>
|
||||
<name>happy.png</name>
|
||||
<size>32984</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>P5AvAPByh8n0hOCamrN4YCc9oA7XwdGvSbBHMJf8RBg=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/ae0ba6cdae25fbe512dc53c7e0413d706a9410f8.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho angry:</desc>
|
||||
<name>angry.png</name>
|
||||
<size>37862</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>m/NrSawqkK0qdO6fi6HPiagsizqBJMZWoIhS0g2O3m0=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/a3366676e1aea97dd9425fe7cc45a6ed86288f2e.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho speechless:</desc>
|
||||
<name>speechless.png</name>
|
||||
<size>30721</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>tIxqUrkiXWHRWUC4/Pk/rO/B0EuwyQq8GkawxE/NsF8=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/777e80a69ccc9c9938457844f9723f4debac0653.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho laugh:</desc>
|
||||
<name>laugh.png</name>
|
||||
<size>36209</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>MqH3vXkXJn1k3nZ6YBAT2di6ZhXVxk/StVbgX/nI9/0=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/6bbee3f5bcaeecbaa9fac68ba1aa4656e10a158d.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho surprise:</desc>
|
||||
<name>surprise.png</name>
|
||||
<size>34655</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>3CsvFu1vZNpLVLgHDPPQJ8w9Dm4Hd3VPpuKZn7+wcXc=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/34a406c2212522d7e6b60e888665267b16fc37ba.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho sad:</desc>
|
||||
<name>sad.png</name>
|
||||
<size>32655</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>12pOZSdygnaaaXeDDAN6995LXdLfalKXTRrVbnBxjE0=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/3142d1222d82d9f2dbe48d284c8f189660f418c3.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<item>
|
||||
<file xmlns='urn:xmpp:file:metadata:0'>
|
||||
<media-type>image/png</media-type>
|
||||
<desc>:miho blush:</desc>
|
||||
<name>blush.png</name>
|
||||
<size>30476</size>
|
||||
<dimensions>400x400</dimensions>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>Q8wdGYxHvO5EmMEEqWbwESr99hiKfLlK/LPp4yL8UgY=</hash>
|
||||
</file>
|
||||
<sources xmlns='urn:xmpp:sfs:0'>
|
||||
<url-data xmlns='http://jabber.org/protocol/url-data' target='https://github.com/movim/movim/raw/master/public/stickers/miho/04214b0b967163915432d5406adec8c4017e093b.png' />
|
||||
</sources>
|
||||
</item>
|
||||
<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>Epasa8DHHzFrE4zd+xaNpVb4jbu4s74XtioExNjQzZ0=</hash>
|
||||
</pack>''');
|
||||
final pack = StickerPack.fromXML(
|
||||
'Epasa8DHHzFrE4zd+xaNpVb4jbu4s74XtioExNjQzZ0=',
|
||||
rawPack,
|
||||
);
|
||||
|
||||
expect(pack.stickers.length, 16);
|
||||
});
|
||||
}
|
@ -18,13 +18,14 @@ Future<bool> testRosterManager(String bareJid, String resource, String stanzaStr
|
||||
jid: JID.fromString(bareJid),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
getManagerById: getManagerNullStub,
|
||||
getNegotiatorById: getNegotiatorNullStub,
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('$bareJid/$resource'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
),);
|
||||
|
||||
final stanza = Stanza.fromXMLNode(XMLNode.fromString(stanzaString));
|
||||
@ -40,7 +41,7 @@ void main() {
|
||||
|
||||
test('Test a successful login attempt with no SM', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -120,12 +121,12 @@ void main() {
|
||||
final XmppConnection conn = XmppConnection(
|
||||
TestingReconnectionPolicy(),
|
||||
AlwaysConnectedConnectivityManager(),
|
||||
fakeSocket,
|
||||
);
|
||||
fakeSocket);
|
||||
conn.setConnectionSettings(ConnectionSettings(
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
@ -152,7 +153,7 @@ void main() {
|
||||
|
||||
test('Test a failed SASL auth', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -184,6 +185,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
@ -210,7 +212,7 @@ void main() {
|
||||
|
||||
test('Test another failed SASL auth', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
play: [
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='test.server' xml:lang='en'>",
|
||||
'''
|
||||
@ -242,6 +244,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: true,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
@ -297,6 +300,7 @@ void main() {
|
||||
jid: JID.fromString('polynomdivision@test.server'),
|
||||
password: 'aaaa',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
@ -329,13 +333,14 @@ void main() {
|
||||
jid: JID.fromString('some.user@example.server'),
|
||||
password: 'password',
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
),
|
||||
getManagerById: getManagerNullStub,
|
||||
getNegotiatorById: getNegotiatorNullStub,
|
||||
isFeatureSupported: (_) => false,
|
||||
getFullJID: () => JID.fromString('some.user@example.server/aaaaa'),
|
||||
getSocket: () => StubTCPSocket([]),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket([])),
|
||||
getSocket: () => StubTCPSocket(play: []),
|
||||
getConnection: () => XmppConnection(TestingReconnectionPolicy(), AlwaysConnectedConnectivityManager(), StubTCPSocket(play: [])),
|
||||
),);
|
||||
|
||||
// NOTE: Based on https://gultsch.de/gajim_roster_push_and_message_interception.html
|
||||
@ -360,57 +365,4 @@ void main() {
|
||||
expect(result2, true, reason: 'Roster pushes should be accepted if the bare JIDs are the same');
|
||||
});
|
||||
});
|
||||
|
||||
test('Test failing due to the server only allowing SASL PLAIN', () async {
|
||||
final fakeSocket = StubTCPSocket(
|
||||
[
|
||||
StringExpectation(
|
||||
"<stream:stream xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='example.org' xml:lang='en'>",
|
||||
'''
|
||||
<stream:stream
|
||||
xmlns="jabber:client"
|
||||
version="1.0"
|
||||
xmlns:stream="http://etherx.jabber.org/streams"
|
||||
from="test.server"
|
||||
xml:lang="en">
|
||||
<stream:features xmlns="http://etherx.jabber.org/streams">
|
||||
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
|
||||
<mechanism>PLAIN</mechanism>
|
||||
</mechanisms>
|
||||
</stream:features>''',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final conn = XmppConnection(
|
||||
TestingReconnectionPolicy(),
|
||||
AlwaysConnectedConnectivityManager(),
|
||||
fakeSocket,
|
||||
);
|
||||
conn.registerManagers([
|
||||
PresenceManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager([]),
|
||||
PingManager(),
|
||||
]);
|
||||
conn.registerFeatureNegotiators(
|
||||
[
|
||||
// SaslPlainNegotiator(),
|
||||
ResourceBindingNegotiator(),
|
||||
]
|
||||
);
|
||||
conn.setConnectionSettings(
|
||||
ConnectionSettings(
|
||||
jid: JID.fromString('testuser@example.org'),
|
||||
password: 'abc123',
|
||||
useDirectTLS: false,
|
||||
),
|
||||
);
|
||||
|
||||
final result = await conn.connect(
|
||||
waitUntilLogin: true,
|
||||
);
|
||||
|
||||
expect(result.isType<NoMatchingAuthenticationMechanismAvailableError>(), true);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user