chore(all): Bump moxxmpp
This commit is contained in:
parent
7d70a96533
commit
19fd079436
@ -47,6 +47,7 @@ class XmppService {
|
|||||||
XmppService() {
|
XmppService() {
|
||||||
_eventHandler.addMatchers([
|
_eventHandler.addMatchers([
|
||||||
EventTypeMatcher<ConnectionStateChangedEvent>(_onConnectionStateChanged),
|
EventTypeMatcher<ConnectionStateChangedEvent>(_onConnectionStateChanged),
|
||||||
|
EventTypeMatcher<StreamNegotiationsDoneEvent>(_onStreamNegotiationsDone),
|
||||||
EventTypeMatcher<ResourceBoundEvent>(_onResourceBound),
|
EventTypeMatcher<ResourceBoundEvent>(_onResourceBound),
|
||||||
EventTypeMatcher<SubscriptionRequestReceivedEvent>(
|
EventTypeMatcher<SubscriptionRequestReceivedEvent>(
|
||||||
_onSubscriptionRequestReceived,
|
_onSubscriptionRequestReceived,
|
||||||
@ -732,6 +733,74 @@ class XmppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _onStreamNegotiationsDone(
|
||||||
|
StreamNegotiationsDoneEvent event, {
|
||||||
|
dynamic extra,
|
||||||
|
}) async {
|
||||||
|
final connection = GetIt.I.get<XmppConnection>();
|
||||||
|
|
||||||
|
// TODO(Unknown): Maybe have something better
|
||||||
|
final settings = connection.connectionSettings;
|
||||||
|
await GetIt.I.get<XmppStateService>().modifyXmppState(
|
||||||
|
(state) => state.copyWith(
|
||||||
|
jid: settings.jid.toString(),
|
||||||
|
password: settings.password,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
_log.finest('Connection connected. Is resumed? ${event.resumed}');
|
||||||
|
unawaited(_initializeOmemoService(settings.jid.toString()));
|
||||||
|
|
||||||
|
if (!event.resumed) {
|
||||||
|
// Reset the blocking service's cache
|
||||||
|
GetIt.I.get<BlocklistService>().onNewConnection();
|
||||||
|
|
||||||
|
// Reset the OMEMO cache
|
||||||
|
GetIt.I.get<OmemoService>().onNewConnection();
|
||||||
|
|
||||||
|
// Enable carbons
|
||||||
|
final carbonsResult = await connection
|
||||||
|
.getManagerById<CarbonsManager>(carbonsManager)!
|
||||||
|
.enableCarbons();
|
||||||
|
if (!carbonsResult) {
|
||||||
|
_log.warning('Failed to enable carbons');
|
||||||
|
}
|
||||||
|
|
||||||
|
// In section 5 of XEP-0198 it says that a client should not request the roster
|
||||||
|
// in case of a stream resumption.
|
||||||
|
await connection
|
||||||
|
.getManagerById<RosterManager>(rosterManager)!
|
||||||
|
.requestRoster();
|
||||||
|
|
||||||
|
// TODO(Unknown): Once groupchats come into the equation, this gets trickier
|
||||||
|
final roster = await GetIt.I.get<RosterService>().getRoster();
|
||||||
|
for (final item in roster) {
|
||||||
|
await GetIt.I
|
||||||
|
.get<AvatarService>()
|
||||||
|
.fetchAndUpdateAvatarForJid(item.jid, item.avatarHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
await GetIt.I.get<BlocklistService>().getBlocklist();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we display our own avatar correctly.
|
||||||
|
// Note that this only requests the avatar if its hash differs from the locally cached avatar's.
|
||||||
|
// TODO(Unknown): Maybe don't do this on mobile Internet
|
||||||
|
unawaited(GetIt.I.get<AvatarService>().requestOwnAvatar());
|
||||||
|
|
||||||
|
if (_loginTriggeredFromUI) {
|
||||||
|
// TODO(Unknown): Trigger another event so the UI can see this aswell
|
||||||
|
await GetIt.I.get<XmppStateService>().modifyXmppState(
|
||||||
|
(state) => state.copyWith(
|
||||||
|
jid: connection.connectionSettings.jid.toString(),
|
||||||
|
displayName: connection.connectionSettings.jid.local,
|
||||||
|
avatarUrl: '',
|
||||||
|
avatarHash: '',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _onConnectionStateChanged(
|
Future<void> _onConnectionStateChanged(
|
||||||
ConnectionStateChangedEvent event, {
|
ConnectionStateChangedEvent event, {
|
||||||
dynamic extra,
|
dynamic extra,
|
||||||
@ -742,71 +811,6 @@ class XmppService {
|
|||||||
event.before,
|
event.before,
|
||||||
event.state,
|
event.state,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (event.state == XmppConnectionState.connected) {
|
|
||||||
final connection = GetIt.I.get<XmppConnection>();
|
|
||||||
|
|
||||||
// TODO(Unknown): Maybe have something better
|
|
||||||
final settings = connection.connectionSettings;
|
|
||||||
await GetIt.I.get<XmppStateService>().modifyXmppState(
|
|
||||||
(state) => state.copyWith(
|
|
||||||
jid: settings.jid.toString(),
|
|
||||||
password: settings.password,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
_log.finest('Connection connected. Is resumed? ${event.resumed}');
|
|
||||||
unawaited(_initializeOmemoService(settings.jid.toString()));
|
|
||||||
|
|
||||||
if (!event.resumed) {
|
|
||||||
// Reset the blocking service's cache
|
|
||||||
GetIt.I.get<BlocklistService>().onNewConnection();
|
|
||||||
|
|
||||||
// Reset the OMEMO cache
|
|
||||||
GetIt.I.get<OmemoService>().onNewConnection();
|
|
||||||
|
|
||||||
// Enable carbons
|
|
||||||
final carbonsResult = await connection
|
|
||||||
.getManagerById<CarbonsManager>(carbonsManager)!
|
|
||||||
.enableCarbons();
|
|
||||||
if (!carbonsResult) {
|
|
||||||
_log.warning('Failed to enable carbons');
|
|
||||||
}
|
|
||||||
|
|
||||||
// In section 5 of XEP-0198 it says that a client should not request the roster
|
|
||||||
// in case of a stream resumption.
|
|
||||||
await connection
|
|
||||||
.getManagerById<RosterManager>(rosterManager)!
|
|
||||||
.requestRoster();
|
|
||||||
|
|
||||||
// TODO(Unknown): Once groupchats come into the equation, this gets trickier
|
|
||||||
final roster = await GetIt.I.get<RosterService>().getRoster();
|
|
||||||
for (final item in roster) {
|
|
||||||
await GetIt.I
|
|
||||||
.get<AvatarService>()
|
|
||||||
.fetchAndUpdateAvatarForJid(item.jid, item.avatarHash);
|
|
||||||
}
|
|
||||||
|
|
||||||
await GetIt.I.get<BlocklistService>().getBlocklist();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we display our own avatar correctly.
|
|
||||||
// Note that this only requests the avatar if its hash differs from the locally cached avatar's.
|
|
||||||
// TODO(Unknown): Maybe don't do this on mobile Internet
|
|
||||||
unawaited(GetIt.I.get<AvatarService>().requestOwnAvatar());
|
|
||||||
|
|
||||||
if (_loginTriggeredFromUI) {
|
|
||||||
// TODO(Unknown): Trigger another event so the UI can see this aswell
|
|
||||||
await GetIt.I.get<XmppStateService>().modifyXmppState(
|
|
||||||
(state) => state.copyWith(
|
|
||||||
jid: connection.connectionSettings.jid.toString(),
|
|
||||||
displayName: connection.connectionSettings.jid.local,
|
|
||||||
avatarUrl: '',
|
|
||||||
avatarHash: '',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onResourceBound(
|
Future<void> _onResourceBound(
|
||||||
|
@ -955,9 +955,11 @@ packages:
|
|||||||
moxxmpp:
|
moxxmpp:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../moxxmpp/packages/moxxmpp"
|
path: "packages/moxxmpp"
|
||||||
relative: true
|
ref: HEAD
|
||||||
source: path
|
resolved-ref: c6552968d53aaf4382360c7414b248a3f09ce0aa
|
||||||
|
url: "https://codeberg.org/moxxy/moxxmpp.git"
|
||||||
|
source: git
|
||||||
version: "0.3.2"
|
version: "0.3.2"
|
||||||
moxxmpp_socket_tcp:
|
moxxmpp_socket_tcp:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
|
14
pubspec.yaml
14
pubspec.yaml
@ -143,18 +143,18 @@ dependency_overrides:
|
|||||||
version: 0.0.4
|
version: 0.0.4
|
||||||
|
|
||||||
# NOTE: Leave here for development purposes
|
# NOTE: Leave here for development purposes
|
||||||
moxxmpp:
|
# moxxmpp:
|
||||||
path: ../moxxmpp/packages/moxxmpp
|
# path: ../moxxmpp/packages/moxxmpp
|
||||||
# moxxmpp_socket_tcp:
|
# moxxmpp_socket_tcp:
|
||||||
# path: ../moxxmpp/packages/moxxmpp_socket_tcp
|
# path: ../moxxmpp/packages/moxxmpp_socket_tcp
|
||||||
# omemo_dart:
|
# omemo_dart:
|
||||||
# path: ../../Personal/omemo_dart
|
# path: ../../Personal/omemo_dart
|
||||||
|
|
||||||
# moxxmpp:
|
moxxmpp:
|
||||||
# git:
|
git:
|
||||||
# url: https://codeberg.org/moxxy/moxxmpp.git
|
url: https://codeberg.org/moxxy/moxxmpp.git
|
||||||
# rev: 47b679d168431fb8eda243adaea249932c7176c7
|
rev: c6552968d53aaf4382360c7414b248a3f09ce0aa
|
||||||
# path: packages/moxxmpp
|
path: packages/moxxmpp
|
||||||
|
|
||||||
extra_licenses:
|
extra_licenses:
|
||||||
- name: undraw.co
|
- name: undraw.co
|
||||||
|
Loading…
Reference in New Issue
Block a user