Merge branch 'development' of https://github.com/siacs/Conversations into development
This commit is contained in:
commit
9b95b07b97
|
@ -269,6 +269,9 @@ public class Conversation extends AbstractEntity {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
String foreignPresence = this.otrSession.getSessionID().getUserID();
|
String foreignPresence = this.otrSession.getSessionID().getUserID();
|
||||||
|
if (getContact()==null) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
if (!getContact().getPresences().containsKey(foreignPresence)) {
|
if (!getContact().getPresences().containsKey(foreignPresence)) {
|
||||||
this.resetOtrSession();
|
this.resetOtrSession();
|
||||||
return false;
|
return false;
|
||||||
|
@ -276,6 +279,7 @@ public class Conversation extends AbstractEntity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getOtrFingerprint() {
|
public String getOtrFingerprint() {
|
||||||
if (this.otrFingerprint == null) {
|
if (this.otrFingerprint == null) {
|
||||||
|
|
|
@ -112,7 +112,11 @@ public class MessageParser {
|
||||||
}
|
}
|
||||||
String counterPart = fromParts[1];
|
String counterPart = fromParts[1];
|
||||||
if (counterPart.equals(conversation.getMucOptions().getNick())) {
|
if (counterPart.equals(conversation.getMucOptions().getNick())) {
|
||||||
|
if (mXmppConnectionService.markMessage(conversation, packet.getId(), Message.STATUS_SEND)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
status = Message.STATUS_SEND;
|
status = Message.STATUS_SEND;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
status = Message.STATUS_RECIEVED;
|
status = Message.STATUS_RECIEVED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,12 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.openintents.openpgp.OpenPgpError;
|
|
||||||
import org.openintents.openpgp.util.OpenPgpApi;
|
import org.openintents.openpgp.util.OpenPgpApi;
|
||||||
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
||||||
|
|
||||||
import net.java.otr4j.OtrException;
|
import net.java.otr4j.OtrException;
|
||||||
import net.java.otr4j.session.Session;
|
import net.java.otr4j.session.Session;
|
||||||
import net.java.otr4j.session.SessionStatus;
|
import net.java.otr4j.session.SessionStatus;
|
||||||
import eu.siacs.conversations.R;
|
|
||||||
import eu.siacs.conversations.crypto.PgpEngine;
|
import eu.siacs.conversations.crypto.PgpEngine;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
|
@ -47,7 +45,6 @@ import eu.siacs.conversations.xmpp.OnStatusChanged;
|
||||||
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleFile;
|
|
||||||
import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived;
|
import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
||||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||||
|
@ -788,11 +785,11 @@ public class XmppConnectionService extends Service {
|
||||||
// don't encrypt
|
// don't encrypt
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
saveInDb = true;
|
|
||||||
addToConversation = true;
|
|
||||||
}
|
}
|
||||||
packet = prepareMessagePacket(account, message, null);
|
packet = prepareMessagePacket(account, message, null);
|
||||||
send = true;
|
send = true;
|
||||||
|
saveInDb = true;
|
||||||
|
addToConversation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1481,21 +1478,23 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
public boolean markMessage(Account account, String recipient, String uuid,
|
public boolean markMessage(Account account, String recipient, String uuid,
|
||||||
int status) {
|
int status) {
|
||||||
boolean marked = false;
|
|
||||||
for (Conversation conversation : getConversations()) {
|
for (Conversation conversation : getConversations()) {
|
||||||
if (conversation.getContactJid().equals(recipient)
|
if (conversation.getContactJid().equals(recipient)
|
||||||
&& conversation.getAccount().equals(account)) {
|
&& conversation.getAccount().equals(account)) {
|
||||||
|
return markMessage(conversation, uuid, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean markMessage(Conversation conversation, String uuid, int status) {
|
||||||
for (Message message : conversation.getMessages()) {
|
for (Message message : conversation.getMessages()) {
|
||||||
if (message.getUuid().equals(uuid)) {
|
if (message.getUuid().equals(uuid)) {
|
||||||
markMessage(message, status);
|
markMessage(message, status);
|
||||||
marked = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
return marked;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markMessage(Message message, int status) {
|
public void markMessage(Message message, int status) {
|
||||||
|
|
Loading…
Reference in a new issue