fix for otr problems
This commit is contained in:
parent
d943e218a4
commit
848fb2ec24
|
@ -31,14 +31,16 @@ public class MessageParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Message parseOtrChat(MessagePacket packet, Account account, XmppConnectionService service) {
|
public static Message parseOtrChat(MessagePacket packet, Account account, XmppConnectionService service) {
|
||||||
|
Log.d(LOGTAG,"otr message received: "+packet.toString());
|
||||||
String[] fromParts = packet.getFrom().split("/");
|
String[] fromParts = packet.getFrom().split("/");
|
||||||
Conversation conversation = service.findOrCreateConversation(account, fromParts[0],false);
|
Conversation conversation = service.findOrCreateConversation(account, fromParts[0],false);
|
||||||
String body = packet.getBody();
|
String body = packet.getBody();
|
||||||
if (!conversation.hasValidOtrSession()) {
|
if (!conversation.hasValidOtrSession()) {
|
||||||
conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
|
conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
|
||||||
} else {
|
} else {
|
||||||
if (body.startsWith("?OTRv")) {
|
String foreignPresence = conversation.getOtrSession().getSessionID().getUserID();
|
||||||
Log.d("xmppService","new otr during existing otr session requested. ending old one");
|
if (!foreignPresence.equals(fromParts[1])) {
|
||||||
|
Log.d(LOGTAG,"new otr during existing otr session requested. ending old one");
|
||||||
try {
|
try {
|
||||||
conversation.getOtrSession().endSession();
|
conversation.getOtrSession().endSession();
|
||||||
} catch (OtrException e) {
|
} catch (OtrException e) {
|
||||||
|
|
Loading…
Reference in New Issue