Compare commits
2 Commits
62001c1e29
...
596693c206
Author | SHA1 | Date | |
---|---|---|---|
596693c206 | |||
22aa07c4ba |
@ -13,11 +13,10 @@ import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0297.dart';
|
||||
|
||||
class CarbonsManager extends XmppManagerBase {
|
||||
|
||||
CarbonsManager() : _isEnabled = false, _supported = false, _gotSupported = false, super();
|
||||
bool _isEnabled;
|
||||
bool _supported;
|
||||
bool _gotSupported;
|
||||
CarbonsManager() : super();
|
||||
bool _isEnabled = false;
|
||||
bool _supported = false;
|
||||
bool _gotSupported = false;
|
||||
|
||||
@override
|
||||
String getId() => carbonsManager;
|
||||
@ -159,6 +158,9 @@ class CarbonsManager extends XmppManagerBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// True if Message Carbons are enabled. False, if not.
|
||||
bool get isEnabled => _isEnabled;
|
||||
|
||||
@visibleForTesting
|
||||
void forceEnable() {
|
||||
_isEnabled = true;
|
||||
|
@ -16,6 +16,7 @@ import 'package:moxxmpp/src/xeps/xep_0030/types.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0060/errors.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0060/xep_0060.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0280.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0334.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0380.dart';
|
||||
import 'package:moxxmpp/src/xeps/xep_0384/crypto.dart';
|
||||
@ -337,15 +338,31 @@ abstract class BaseOmemoManager extends XmppManagerBase {
|
||||
}
|
||||
|
||||
logger.finest('Beginning encryption');
|
||||
final carbonsEnabled = getAttributes()
|
||||
.getManagerById<CarbonsManager>(carbonsManager)?.isEnabled ?? false;
|
||||
final om = await getOmemoManager();
|
||||
final result = await om.onOutgoingStanza(
|
||||
OmemoOutgoingStanza(
|
||||
[toJid.toString()],
|
||||
[
|
||||
toJid.toString(),
|
||||
if (carbonsEnabled)
|
||||
getAttributes().getFullJID().toBare().toString(),
|
||||
],
|
||||
_buildEnvelope(toEncrypt, toJid.toString()),
|
||||
),
|
||||
);
|
||||
logger.finest('Encryption done');
|
||||
|
||||
if (!result.isSuccess(2)) {
|
||||
final other = Map<String, dynamic>.from(state.other);
|
||||
other['encryption_error_jids'] = result.jidEncryptionErrors;
|
||||
other['encryption_error_devices'] = result.deviceEncryptionErrors;
|
||||
return state.copyWith(
|
||||
other: other,
|
||||
cancel: true,
|
||||
);
|
||||
}
|
||||
|
||||
final encrypted = _buildEncryptedElement(
|
||||
result,
|
||||
toJid.toString(),
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
||||
version: ^0.1.5
|
||||
omemo_dart:
|
||||
hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub
|
||||
version: ^0.4.0
|
||||
version: ^0.4.1
|
||||
random_string: ^2.3.1
|
||||
saslprep: ^1.0.2
|
||||
synchronized: ^3.0.0+2
|
||||
|
Loading…
Reference in New Issue
Block a user