aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkruks23 <scardenas@openmailbox.org>2014-05-16 22:49:52 +0200
committerkruks23 <scardenas@openmailbox.org>2014-05-16 22:49:52 +0200
commit9b95b07b97c8c51bc0388059704a503e0b11a0d3 (patch)
tree6226065050f9864a90fd4290f11652cf250a4c3e
parente50f0090044ddbb11b83e6cc049c29a30f890878 (diff)
parentcd1afbd39aade757c592e756ff1a1d2df27f1442 (diff)
Merge branch 'development' of https://github.com/siacs/Conversations into development
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java12
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java6
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java29
3 files changed, 27 insertions, 20 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 20c70d29..88d6279e 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -269,11 +269,15 @@ public class Conversation extends AbstractEntity {
return false;
} else {
String foreignPresence = this.otrSession.getSessionID().getUserID();
- if (!getContact().getPresences().containsKey(foreignPresence)) {
- this.resetOtrSession();
- return false;
+ if (getContact()==null) {
+ return true;
+ } else {
+ if (!getContact().getPresences().containsKey(foreignPresence)) {
+ this.resetOtrSession();
+ return false;
+ }
+ return true;
}
- return true;
}
}
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 26078073..3733767f 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -112,7 +112,11 @@ public class MessageParser {
}
String counterPart = fromParts[1];
if (counterPart.equals(conversation.getMucOptions().getNick())) {
- status = Message.STATUS_SEND;
+ if (mXmppConnectionService.markMessage(conversation, packet.getId(), Message.STATUS_SEND)) {
+ return null;
+ } else {
+ status = Message.STATUS_SEND;
+ }
} else {
status = Message.STATUS_RECIEVED;
}
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 197eebc1..5a7a44b1 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -10,14 +10,12 @@ import java.util.List;
import java.util.Locale;
import java.util.Random;
-import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
import net.java.otr4j.OtrException;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
-import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account;
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.XmppConnection;
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.stanzas.JinglePacket;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
@@ -788,11 +785,11 @@ public class XmppConnectionService extends Service {
// don't encrypt
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
message.setStatus(Message.STATUS_SEND);
- saveInDb = true;
- addToConversation = true;
}
packet = prepareMessagePacket(account, message, null);
send = true;
+ saveInDb = true;
+ addToConversation = true;
}
}
} else {
@@ -1481,21 +1478,23 @@ public class XmppConnectionService extends Service {
public boolean markMessage(Account account, String recipient, String uuid,
int status) {
- boolean marked = false;
for (Conversation conversation : getConversations()) {
if (conversation.getContactJid().equals(recipient)
&& conversation.getAccount().equals(account)) {
- for (Message message : conversation.getMessages()) {
- if (message.getUuid().equals(uuid)) {
- markMessage(message, status);
- marked = true;
- break;
- }
- }
- break;
+ return markMessage(conversation, uuid, status);
+ }
+ }
+ return false;
+ }
+
+ public boolean markMessage(Conversation conversation, String uuid, int status) {
+ for (Message message : conversation.getMessages()) {
+ if (message.getUuid().equals(uuid)) {
+ markMessage(message, status);
+ return true;
}
}
- return marked;
+ return false;
}
public void markMessage(Message message, int status) {