fix conversation lookup for smp initialization

This commit is contained in:
kosyak 2024-10-29 17:30:57 +07:00
parent 948fd85a43
commit e1e2de8a76

View file

@ -107,7 +107,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
public void askForSecret(SessionID id, InstanceTag instanceTag, String question) {
try {
final Jid jid = OtrJidHelper.fromSessionID(id);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, null);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
if (conversation != null) {
conversation.smp().hint = question;
conversation.smp().status = Conversation.Smp.STATUS_CONTACT_REQUESTED;
@ -187,7 +187,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
MessageGenerator.addMessageHints(packet);
try {
Jid jid = OtrJidHelper.fromSessionID(session);
Conversation conversation = mXmppConnectionService.find(account, jid, null);
Conversation conversation = mXmppConnectionService.find(account, jid, jid);
if (conversation != null && conversation.setOutgoingChatState(Config.DEFAULT_CHAT_STATE)) {
if (mXmppConnectionService.sendChatStates()) {
packet.addChild(ChatState.toElement(conversation.getOutgoingChatState()));
@ -233,7 +233,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
private void setSmpStatus(SessionID id, int status) {
try {
final Jid jid = OtrJidHelper.fromSessionID(id);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, null);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
if (conversation != null) {
conversation.smp().status = status;
mXmppConnectionService.updateConversationUi();
@ -264,7 +264,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
public void sendOtrErrorMessage(SessionID session, String errorText) {
try {
Jid jid = OtrJidHelper.fromSessionID(session);
Conversation conversation = mXmppConnectionService.find(account, jid, null);
Conversation conversation = mXmppConnectionService.find(account, jid, jid);
String id = conversation == null ? null : conversation.getLastReceivedOtrMessageId();
if (id != null) {
MessagePacket packet = mXmppConnectionService.getMessageGenerator()
@ -290,7 +290,7 @@ public class OtrService extends OtrCryptoEngineImpl implements OtrEngineHost {
Log.d(Config.LOGTAG, "OtrService.verify(" + id.toString() + "," + fingerprint + "," + String.valueOf(approved) + ")");
try {
final Jid jid = OtrJidHelper.fromSessionID(id);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, null);
Conversation conversation = this.mXmppConnectionService.find(this.account, jid, jid);
if (conversation != null) {
if (approved) {
conversation.getContact().addOtrFingerprint(fingerprint);