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