only end otr session if there is more than one contact presence. reset otherwise

iNPUTmice created

Change summary

src/eu/siacs/conversations/services/XmppConnectionService.java | 6 +++
1 file changed, 5 insertions(+), 1 deletion(-)

Detailed changes

src/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -127,7 +127,11 @@ public class XmppConnectionService extends Service {
 		public void onContactStatusChanged(Contact contact, boolean online) {
 			Conversation conversation = find(getConversations(), contact);
 			if (conversation != null) {
-				conversation.endOtrIfNeeded();
+				if (online && contact.getPresences().size() > 1) {
+					conversation.endOtrIfNeeded();
+				} else {
+					conversation.resetOtrSession();
+				}
 				if (online && (contact.getPresences().size() == 1)) {
 					sendUnsendMessages(conversation);
 				}