aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-24 00:22:51 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-24 00:22:51 +0100
commitb9af38464e971e21a78f5c99d20d37fea73cc67e (patch)
treee648bd533b10c8d6940ce3423783052f73a8e121 /src/main/java
parented3d76bcf61080589dc1da65a4eec33bb5a0e44b (diff)
fixed mam to work with muc
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/generator/IqGenerator.java4
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/MessageArchiveService.java21
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java5
4 files changed, 21 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
index d0965821..290e0d60 100644
--- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
+++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java
@@ -107,7 +107,9 @@ public class IqGenerator extends AbstractGenerator {
query.setAttribute("queryid",mam.getQueryId());
final Data data = new Data();
data.setFormType("urn:xmpp:mam:0");
- if (mam.getWith()!=null) {
+ if (mam.muc()) {
+ packet.setTo(mam.getWith());
+ } else if (mam.getWith()!=null) {
data.put("with", mam.getWith().toString());
}
data.put("start",getTimestamp(mam.getStart()));
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index a15be622..4d102c3a 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -8,7 +8,6 @@ import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions;
-import eu.siacs.conversations.http.HttpConnection;
import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.services.XmppConnectionService;
@@ -142,6 +141,7 @@ public class MessageParser extends AbstractParser implements
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, from.toBareJid(), true);
if (packet.hasChild("subject")) {
+ conversation.setHasMessagesLeftOnServer(true);
conversation.getMucOptions().setSubject(packet.findChild("subject").getContent());
mXmppConnectionService.updateConversationUi();
return null;
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
index 5fb50f90..f97077c4 100644
--- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
+++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
@@ -225,7 +225,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
private int messageCount = 0;
private long start;
private long end;
- private Jid with = null;
private String queryId;
private String reference = null;
private Account account;
@@ -237,7 +236,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
public Query(Conversation conversation, long start, long end) {
this(conversation.getAccount(), start, end);
this.conversation = conversation;
- this.with = conversation.getJid().toBareJid();
}
public Query(Conversation conversation, long start, long end, PagingOrder order) {
@@ -256,7 +254,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
Query query = new Query(this.account,this.start,this.end);
query.reference = reference;
query.conversation = conversation;
- query.with = with;
query.totalCount = totalCount;
query.callback = callback;
return query;
@@ -287,7 +284,11 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
public Jid getWith() {
- return with;
+ return conversation == null ? null : conversation.getJid().toBareJid();
+ }
+
+ public boolean muc() {
+ return conversation != null && conversation.getMode() == Conversation.MODE_MULTI;
}
public long getStart() {
@@ -338,11 +339,15 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
- builder.append("with=");
- if (this.with==null) {
- builder.append("*");
+ if (this.muc()) {
+ builder.append("to="+this.getWith().toString());
} else {
- builder.append(with.toString());
+ builder.append("with=");
+ if (this.getWith() == null) {
+ builder.append("*");
+ } else {
+ builder.append(getWith().toString());
+ }
}
builder.append(", start=");
builder.append(AbstractGenerator.getTimestamp(this.start));
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index d4f40fec..ca80fa84 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1022,7 +1022,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
this.databaseBackend.createConversation(conversation);
}
- if (account.getXmppConnection() != null && account.getXmppConnection().getFeatures().mam()) {
+ if (account.getXmppConnection() != null
+ && account.getXmppConnection().getFeatures().mam()
+ && !muc) {
if (query == null) {
this.mMessageArchiveService.query(conversation);
} else {
@@ -1314,6 +1316,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
conversation.setContactJid(joinJid);
databaseBackend.updateConversation(conversation);
}
+ conversation.setHasMessagesLeftOnServer(false);
} else {
account.pendingConferenceJoins.add(conversation);
}