bump mam namespace
This commit is contained in:
parent
2665c3a1e0
commit
b90a1fe1db
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.utils.Xmlns;
|
||||
import eu.siacs.conversations.xmpp.forms.Data;
|
||||
import eu.siacs.conversations.xmpp.forms.Field;
|
||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||
|
@ -373,8 +374,7 @@ public class MucOptions {
|
|||
}
|
||||
|
||||
public boolean mamSupport() {
|
||||
// Update with "urn:xmpp:mam:1" once we support it
|
||||
return hasFeature("urn:xmpp:mam:0");
|
||||
return hasFeature(Xmlns.MAM);
|
||||
}
|
||||
|
||||
public boolean nonanonymous() {
|
||||
|
|
|
@ -230,10 +230,10 @@ public class IqGenerator extends AbstractGenerator {
|
|||
|
||||
public IqPacket queryMessageArchiveManagement(final MessageArchiveService.Query mam) {
|
||||
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
||||
final Element query = packet.query("urn:xmpp:mam:0");
|
||||
final Element query = packet.query(Xmlns.MAM);
|
||||
query.setAttribute("queryid", mam.getQueryId());
|
||||
final Data data = new Data();
|
||||
data.setFormType("urn:xmpp:mam:0");
|
||||
data.setFormType(Xmlns.MAM);
|
||||
if (mam.muc()) {
|
||||
packet.setTo(mam.getWith());
|
||||
} else if (mam.getWith()!=null) {
|
||||
|
|
|
@ -300,15 +300,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
final boolean isForwarded;
|
||||
boolean isCarbon = false;
|
||||
String serverMsgId = null;
|
||||
final Element fin = original.findChild("fin", "urn:xmpp:mam:0");
|
||||
if (fin != null) {
|
||||
mXmppConnectionService.getMessageArchiveService().processFin(fin,original.getFrom());
|
||||
return;
|
||||
}
|
||||
final Element result = original.findChild("result","urn:xmpp:mam:0");
|
||||
final Element result = original.findChild("result",Xmlns.MAM);
|
||||
final MessageArchiveService.Query query = result == null ? null : mXmppConnectionService.getMessageArchiveService().findQuery(result.getAttribute("queryid"));
|
||||
if (query != null && query.validFrom(original.getFrom())) {
|
||||
Pair<MessagePacket, Long> f = original.getForwardedMessagePacket("result", "urn:xmpp:mam:0");
|
||||
Pair<MessagePacket, Long> f = original.getForwardedMessagePacket("result", Xmlns.MAM);
|
||||
if (f == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import eu.siacs.conversations.R;
|
|||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.generator.AbstractGenerator;
|
||||
import eu.siacs.conversations.utils.Xmlns;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
|
||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||
|
@ -155,6 +156,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
|||
this.mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
Element fin = packet.findChild("fin", Xmlns.MAM);
|
||||
if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||
synchronized (MessageArchiveService.this.queries) {
|
||||
MessageArchiveService.this.queries.remove(query);
|
||||
|
@ -162,7 +164,9 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
|||
query.callback(false);
|
||||
}
|
||||
}
|
||||
} else if (packet.getType() != IqPacket.TYPE.RESULT) {
|
||||
} else if (packet.getType() == IqPacket.TYPE.RESULT && fin != null) {
|
||||
processFin(fin);
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": error executing mam: " + packet.toString());
|
||||
finalizeQuery(query, true);
|
||||
}
|
||||
|
@ -215,12 +219,9 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
|||
return queryInProgress(conversation, null);
|
||||
}
|
||||
|
||||
public void processFin(Element fin, Jid from) {
|
||||
if (fin == null) {
|
||||
return;
|
||||
}
|
||||
public void processFin(Element fin) {
|
||||
Query query = findQuery(fin.getAttribute("queryid"));
|
||||
if (query == null || !query.validFrom(from)) {
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
boolean complete = fin.getAttributeAsBoolean("complete");
|
||||
|
|
|
@ -3712,11 +3712,11 @@ public class XmppConnectionService extends Service {
|
|||
|
||||
public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) {
|
||||
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||
request.addChild("prefs","urn:xmpp:mam:0");
|
||||
request.addChild("prefs",Xmlns.MAM);
|
||||
sendIqPacket(account, request, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
Element prefs = packet.findChild("prefs","urn:xmpp:mam:0");
|
||||
Element prefs = packet.findChild("prefs",Xmlns.MAM);
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT && prefs != null) {
|
||||
callback.onPreferencesFetched(prefs);
|
||||
} else {
|
||||
|
|
|
@ -7,4 +7,5 @@ public final class Xmlns {
|
|||
public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams";
|
||||
public static final String HTTP_UPLOAD = "urn:xmpp:http:upload";
|
||||
public static final String STANZA_IDS = "urn:xmpp:sid:0";
|
||||
public static final String MAM = "urn:xmpp:mam:1";
|
||||
}
|
||||
|
|
|
@ -1628,8 +1628,7 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
public boolean mam() {
|
||||
return hasDiscoFeature(account.getJid().toBareJid(), "urn:xmpp:mam:0")
|
||||
|| hasDiscoFeature(account.getServer(), "urn:xmpp:mam:0");
|
||||
return hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM);
|
||||
}
|
||||
|
||||
public boolean push() {
|
||||
|
|
Loading…
Reference in New Issue