Merge branch 'master' of github.com:siacs/Conversations

This commit is contained in:
Daniel Gultsch 2017-02-24 20:00:54 +01:00
commit c7ec82679f
7 changed files with 16 additions and 16 deletions

View File

@ -374,11 +374,11 @@ public class MucOptions {
} }
public boolean mamSupport() { public boolean mamSupport() {
return hasFeature(Xmlns.MAM) || hasFeature(Xmlns.MAM_LAGECY); return hasFeature(Xmlns.MAM) || hasFeature(Xmlns.MAM_LEGACY);
} }
public boolean mamLegacy() { public boolean mamLegacy() {
return hasFeature(Xmlns.MAM_LAGECY) && !hasFeature(Xmlns.MAM); return hasFeature(Xmlns.MAM_LEGACY) && !hasFeature(Xmlns.MAM);
} }
public boolean nonanonymous() { public boolean nonanonymous() {

View File

@ -229,10 +229,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(mam.isLegacy() ? Xmlns.MAM_LAGECY : Xmlns.MAM); final Element query = packet.query(mam.isLegacy() ? Xmlns.MAM_LEGACY : Xmlns.MAM);
query.setAttribute("queryid", mam.getQueryId()); query.setAttribute("queryid", mam.getQueryId());
final Data data = new Data(); final Data data = new Data();
data.setFormType(mam.isLegacy() ? Xmlns.MAM_LAGECY : Xmlns.MAM); data.setFormType(mam.isLegacy() ? Xmlns.MAM_LEGACY : 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) {

View File

@ -300,16 +300,16 @@ 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", Xmlns.MAM_LAGECY); final Element fin = original.findChild("fin", Xmlns.MAM_LEGACY);
if (fin != null) { if (fin != null) {
mXmppConnectionService.getMessageArchiveService().processFinLagecy(fin,original.getFrom()); mXmppConnectionService.getMessageArchiveService().processFinLegacy(fin,original.getFrom());
return; return;
} }
final boolean mamLagecy = original.hasChild("result",Xmlns.MAM_LAGECY); final boolean mamLegacy = original.hasChild("result",Xmlns.MAM_LEGACY);
final Element result = original.findChild("result",mamLagecy ? Xmlns.MAM_LAGECY : Xmlns.MAM); final Element result = original.findChild("result",mamLegacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
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", mamLagecy ? Xmlns.MAM_LAGECY : Xmlns.MAM); Pair<MessagePacket, Long> f = original.getForwardedMessagePacket("result", mamLegacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
if (f == null) { if (f == null) {
return; return;
} }

View File

@ -221,7 +221,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
return queryInProgress(conversation, null); return queryInProgress(conversation, null);
} }
public void processFinLagecy(Element fin, Jid from) { public void processFinLegacy(Element fin, Jid from) {
Query query = findQuery(fin.getAttribute("queryid")); Query query = findQuery(fin.getAttribute("queryid"));
if (query != null && query.validFrom(from)) { if (query != null && query.validFrom(from)) {
processFin(fin); processFin(fin);

View File

@ -3742,13 +3742,13 @@ public class XmppConnectionService extends Service {
} }
public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) { public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) {
final boolean lagecy = account.getXmppConnection().getFeatures().mamLegacy(); final boolean legacy = account.getXmppConnection().getFeatures().mamLegacy();
IqPacket request = new IqPacket(IqPacket.TYPE.GET); IqPacket request = new IqPacket(IqPacket.TYPE.GET);
request.addChild("prefs",lagecy ? Xmlns.MAM_LAGECY : Xmlns.MAM); request.addChild("prefs",legacy ? Xmlns.MAM_LEGACY : 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",lagecy ? Xmlns.MAM_LAGECY : Xmlns.MAM); Element prefs = packet.findChild("prefs",legacy ? Xmlns.MAM_LEGACY : 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 {

View File

@ -8,5 +8,5 @@ public final class Xmlns {
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"; public static final String MAM = "urn:xmpp:mam:1";
public static final String MAM_LAGECY = "urn:xmpp:mam:0"; public static final String MAM_LEGACY = "urn:xmpp:mam:0";
} }

View File

@ -1636,12 +1636,12 @@ public class XmppConnection implements Runnable {
public boolean mam() { public boolean mam() {
return hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM) return hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM)
|| hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM_LAGECY); || hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM_LEGACY);
} }
public boolean mamLegacy() { public boolean mamLegacy() {
return !hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM) return !hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM)
&& hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM_LAGECY); && hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM_LEGACY);
} }
public boolean push() { public boolean push() {