Compare commits

..

No commits in common. "596693c2067bc3fe73250f07cd88e7040a285537" and "62001c1e29b644fcf7fe12618d77571853fd073e" have entirely different histories.

3 changed files with 7 additions and 26 deletions

View File

@ -13,10 +13,11 @@ import 'package:moxxmpp/src/xeps/xep_0030/xep_0030.dart';
import 'package:moxxmpp/src/xeps/xep_0297.dart'; import 'package:moxxmpp/src/xeps/xep_0297.dart';
class CarbonsManager extends XmppManagerBase { class CarbonsManager extends XmppManagerBase {
CarbonsManager() : super();
bool _isEnabled = false; CarbonsManager() : _isEnabled = false, _supported = false, _gotSupported = false, super();
bool _supported = false; bool _isEnabled;
bool _gotSupported = false; bool _supported;
bool _gotSupported;
@override @override
String getId() => carbonsManager; String getId() => carbonsManager;
@ -158,9 +159,6 @@ class CarbonsManager extends XmppManagerBase {
return true; return true;
} }
/// True if Message Carbons are enabled. False, if not.
bool get isEnabled => _isEnabled;
@visibleForTesting @visibleForTesting
void forceEnable() { void forceEnable() {
_isEnabled = true; _isEnabled = true;

View File

@ -16,7 +16,6 @@ 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_0030/xep_0030.dart';
import 'package:moxxmpp/src/xeps/xep_0060/errors.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_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_0334.dart';
import 'package:moxxmpp/src/xeps/xep_0380.dart'; import 'package:moxxmpp/src/xeps/xep_0380.dart';
import 'package:moxxmpp/src/xeps/xep_0384/crypto.dart'; import 'package:moxxmpp/src/xeps/xep_0384/crypto.dart';
@ -338,31 +337,15 @@ abstract class BaseOmemoManager extends XmppManagerBase {
} }
logger.finest('Beginning encryption'); logger.finest('Beginning encryption');
final carbonsEnabled = getAttributes()
.getManagerById<CarbonsManager>(carbonsManager)?.isEnabled ?? false;
final om = await getOmemoManager(); final om = await getOmemoManager();
final result = await om.onOutgoingStanza( final result = await om.onOutgoingStanza(
OmemoOutgoingStanza( OmemoOutgoingStanza(
[ [toJid.toString()],
toJid.toString(),
if (carbonsEnabled)
getAttributes().getFullJID().toBare().toString(),
],
_buildEnvelope(toEncrypt, toJid.toString()), _buildEnvelope(toEncrypt, toJid.toString()),
), ),
); );
logger.finest('Encryption done'); 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( final encrypted = _buildEncryptedElement(
result, result,
toJid.toString(), toJid.toString(),

View File

@ -20,7 +20,7 @@ dependencies:
version: ^0.1.5 version: ^0.1.5
omemo_dart: omemo_dart:
hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub hosted: https://git.polynom.me/api/packages/PapaTutuWawa/pub
version: ^0.4.1 version: ^0.4.0
random_string: ^2.3.1 random_string: ^2.3.1
saslprep: ^1.0.2 saslprep: ^1.0.2
synchronized: ^3.0.0+2 synchronized: ^3.0.0+2