mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-25 08:58:55 -05:00
rename the Xmlns class to Namespace
This commit is contained in:
parent
ea1e28267b
commit
c740386297
@ -8,7 +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.xml.Namespace;
|
||||||
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;
|
||||||
@ -374,11 +374,11 @@ public class MucOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean mamSupport() {
|
public boolean mamSupport() {
|
||||||
return hasFeature(Xmlns.MAM) || hasFeature(Xmlns.MAM_LEGACY);
|
return hasFeature(Namespace.MAM) || hasFeature(Namespace.MAM_LEGACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mamLegacy() {
|
public boolean mamLegacy() {
|
||||||
return hasFeature(Xmlns.MAM_LEGACY) && !hasFeature(Xmlns.MAM);
|
return hasFeature(Namespace.MAM_LEGACY) && !hasFeature(Namespace.MAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean nonanonymous() {
|
public boolean nonanonymous() {
|
||||||
|
@ -27,7 +27,7 @@ import eu.siacs.conversations.entities.Conversation;
|
|||||||
import eu.siacs.conversations.entities.DownloadableFile;
|
import eu.siacs.conversations.entities.DownloadableFile;
|
||||||
import eu.siacs.conversations.services.MessageArchiveService;
|
import eu.siacs.conversations.services.MessageArchiveService;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.forms.Data;
|
import eu.siacs.conversations.xmpp.forms.Data;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
@ -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_LEGACY : Xmlns.MAM);
|
final Element query = packet.query(mam.isLegacy() ? Namespace.MAM_LEGACY : Namespace.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_LEGACY : Xmlns.MAM);
|
data.setFormType(mam.isLegacy() ? Namespace.MAM_LEGACY : Namespace.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) {
|
||||||
@ -251,14 +251,14 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
}
|
}
|
||||||
public IqPacket generateGetBlockList() {
|
public IqPacket generateGetBlockList() {
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||||
iq.addChild("blocklist", Xmlns.BLOCKING);
|
iq.addChild("blocklist", Namespace.BLOCKING);
|
||||||
|
|
||||||
return iq;
|
return iq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IqPacket generateSetBlockRequest(final Jid jid, boolean reportSpam) {
|
public IqPacket generateSetBlockRequest(final Jid jid, boolean reportSpam) {
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
||||||
final Element block = iq.addChild("block", Xmlns.BLOCKING);
|
final Element block = iq.addChild("block", Namespace.BLOCKING);
|
||||||
final Element item = block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
|
final Element item = block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
|
||||||
if (reportSpam) {
|
if (reportSpam) {
|
||||||
item.addChild("report", "urn:xmpp:reporting:0").addChild("spam");
|
item.addChild("report", "urn:xmpp:reporting:0").addChild("spam");
|
||||||
@ -269,7 +269,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
|
|
||||||
public IqPacket generateSetUnblockRequest(final Jid jid) {
|
public IqPacket generateSetUnblockRequest(final Jid jid) {
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
||||||
final Element block = iq.addChild("unblock", Xmlns.BLOCKING);
|
final Element block = iq.addChild("unblock", Namespace.BLOCKING);
|
||||||
block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
|
block.addChild("item").setAttribute("jid", jid.toBareJid().toString());
|
||||||
return iq;
|
return iq;
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
public IqPacket generateSetPassword(final Account account, final String newPassword) {
|
public IqPacket generateSetPassword(final Account account, final String newPassword) {
|
||||||
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
||||||
packet.setTo(account.getServer());
|
packet.setTo(account.getServer());
|
||||||
final Element query = packet.addChild("query", Xmlns.REGISTER);
|
final Element query = packet.addChild("query", Namespace.REGISTER);
|
||||||
final Jid jid = account.getJid();
|
final Jid jid = account.getJid();
|
||||||
query.addChild("username").setContent(jid.getLocalpart());
|
query.addChild("username").setContent(jid.getLocalpart());
|
||||||
query.addChild("password").setContent(newPassword);
|
query.addChild("password").setContent(newPassword);
|
||||||
@ -316,7 +316,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
public IqPacket requestHttpUploadSlot(Jid host, DownloadableFile file, String mime) {
|
public IqPacket requestHttpUploadSlot(Jid host, DownloadableFile file, String mime) {
|
||||||
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
|
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
|
||||||
packet.setTo(host);
|
packet.setTo(host);
|
||||||
Element request = packet.addChild("request", Xmlns.HTTP_UPLOAD);
|
Element request = packet.addChild("request", Namespace.HTTP_UPLOAD);
|
||||||
request.addChild("filename").setContent(convertFilename(file.getName()));
|
request.addChild("filename").setContent(convertFilename(file.getName()));
|
||||||
request.addChild("size").setContent(String.valueOf(file.getExpectedSize()));
|
request.addChild("size").setContent(String.valueOf(file.getExpectedSize()));
|
||||||
if (mime != null) {
|
if (mime != null) {
|
||||||
|
@ -26,7 +26,7 @@ import eu.siacs.conversations.services.AbstractConnectionManager;
|
|||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.ui.UiCallback;
|
import eu.siacs.conversations.ui.UiCallback;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
@ -117,13 +117,13 @@ public class HttpUploadConnection implements Transferable {
|
|||||||
}
|
}
|
||||||
this.file.setExpectedSize(pair.second);
|
this.file.setExpectedSize(pair.second);
|
||||||
this.mFileInputStream = pair.first;
|
this.mFileInputStream = pair.first;
|
||||||
Jid host = account.getXmppConnection().findDiscoItemByFeature(Xmlns.HTTP_UPLOAD);
|
Jid host = account.getXmppConnection().findDiscoItemByFeature(Namespace.HTTP_UPLOAD);
|
||||||
IqPacket request = mXmppConnectionService.getIqGenerator().requestHttpUploadSlot(host,file,mime);
|
IqPacket request = mXmppConnectionService.getIqGenerator().requestHttpUploadSlot(host,file,mime);
|
||||||
mXmppConnectionService.sendIqPacket(account, request, new OnIqPacketReceived() {
|
mXmppConnectionService.sendIqPacket(account, request, new OnIqPacketReceived() {
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
Element slot = packet.findChild("slot",Xmlns.HTTP_UPLOAD);
|
Element slot = packet.findChild("slot", Namespace.HTTP_UPLOAD);
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
try {
|
try {
|
||||||
mGetUrl = new URL(slot.findChildContent("get"));
|
mGetUrl = new URL(slot.findChildContent("get"));
|
||||||
|
@ -28,7 +28,7 @@ import eu.siacs.conversations.entities.Account;
|
|||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
||||||
@ -287,19 +287,19 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
|
|||||||
final boolean isGet = packet.getType() == IqPacket.TYPE.GET;
|
final boolean isGet = packet.getType() == IqPacket.TYPE.GET;
|
||||||
if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||||
return;
|
return;
|
||||||
} else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) {
|
} else if (packet.hasChild("query", Namespace.ROSTER) && packet.fromServer(account)) {
|
||||||
final Element query = packet.findChild("query");
|
final Element query = packet.findChild("query");
|
||||||
// If this is in response to a query for the whole roster:
|
// If this is in response to a query for the whole roster:
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
account.getRoster().markAllAsNotInRoster();
|
account.getRoster().markAllAsNotInRoster();
|
||||||
}
|
}
|
||||||
this.rosterItems(account, query);
|
this.rosterItems(account, query);
|
||||||
} else if ((packet.hasChild("block", Xmlns.BLOCKING) || packet.hasChild("blocklist", Xmlns.BLOCKING)) &&
|
} else if ((packet.hasChild("block", Namespace.BLOCKING) || packet.hasChild("blocklist", Namespace.BLOCKING)) &&
|
||||||
packet.fromServer(account)) {
|
packet.fromServer(account)) {
|
||||||
// Block list or block push.
|
// Block list or block push.
|
||||||
Log.d(Config.LOGTAG, "Received blocklist update from server");
|
Log.d(Config.LOGTAG, "Received blocklist update from server");
|
||||||
final Element blocklist = packet.findChild("blocklist", Xmlns.BLOCKING);
|
final Element blocklist = packet.findChild("blocklist", Namespace.BLOCKING);
|
||||||
final Element block = packet.findChild("block", Xmlns.BLOCKING);
|
final Element block = packet.findChild("block", Namespace.BLOCKING);
|
||||||
final Collection<Element> items = blocklist != null ? blocklist.getChildren() :
|
final Collection<Element> items = blocklist != null ? blocklist.getChildren() :
|
||||||
(block != null ? block.getChildren() : null);
|
(block != null ? block.getChildren() : null);
|
||||||
// If this is a response to a blocklist query, clear the block list and replace with the new one.
|
// If this is a response to a blocklist query, clear the block list and replace with the new one.
|
||||||
@ -335,10 +335,10 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
|
|||||||
final IqPacket response = packet.generateResponse(IqPacket.TYPE.RESULT);
|
final IqPacket response = packet.generateResponse(IqPacket.TYPE.RESULT);
|
||||||
mXmppConnectionService.sendIqPacket(account, response, null);
|
mXmppConnectionService.sendIqPacket(account, response, null);
|
||||||
}
|
}
|
||||||
} else if (packet.hasChild("unblock", Xmlns.BLOCKING) &&
|
} else if (packet.hasChild("unblock", Namespace.BLOCKING) &&
|
||||||
packet.fromServer(account) && packet.getType() == IqPacket.TYPE.SET) {
|
packet.fromServer(account) && packet.getType() == IqPacket.TYPE.SET) {
|
||||||
Log.d(Config.LOGTAG, "Received unblock update from server");
|
Log.d(Config.LOGTAG, "Received unblock update from server");
|
||||||
final Collection<Element> items = packet.findChild("unblock", Xmlns.BLOCKING).getChildren();
|
final Collection<Element> items = packet.findChild("unblock", Namespace.BLOCKING).getChildren();
|
||||||
if (items.size() == 0) {
|
if (items.size() == 0) {
|
||||||
// No children to unblock == unblock all
|
// No children to unblock == unblock all
|
||||||
account.getBlocklist().clear();
|
account.getBlocklist().clear();
|
||||||
|
@ -31,7 +31,7 @@ import eu.siacs.conversations.http.HttpConnectionManager;
|
|||||||
import eu.siacs.conversations.services.MessageArchiveService;
|
import eu.siacs.conversations.services.MessageArchiveService;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
|
import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||||
@ -215,7 +215,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||||||
private static String extractStanzaId(Element packet, Jid by) {
|
private static String extractStanzaId(Element packet, Jid by) {
|
||||||
for(Element child : packet.getChildren()) {
|
for(Element child : packet.getChildren()) {
|
||||||
if (child.getName().equals("stanza-id")
|
if (child.getName().equals("stanza-id")
|
||||||
&& Xmlns.STANZA_IDS.equals(child.getNamespace())
|
&& Namespace.STANZA_IDS.equals(child.getNamespace())
|
||||||
&& by.equals(child.getAttributeAsJid("by"))) {
|
&& by.equals(child.getAttributeAsJid("by"))) {
|
||||||
return child.getAttribute("id");
|
return child.getAttribute("id");
|
||||||
}
|
}
|
||||||
@ -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_LEGACY);
|
final Element fin = original.findChild("fin", Namespace.MAM_LEGACY);
|
||||||
if (fin != null) {
|
if (fin != null) {
|
||||||
mXmppConnectionService.getMessageArchiveService().processFinLegacy(fin,original.getFrom());
|
mXmppConnectionService.getMessageArchiveService().processFinLegacy(fin,original.getFrom());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final boolean mamLegacy = original.hasChild("result",Xmlns.MAM_LEGACY);
|
final boolean mamLegacy = original.hasChild("result", Namespace.MAM_LEGACY);
|
||||||
final Element result = original.findChild("result",mamLegacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
final Element result = original.findChild("result",mamLegacy ? Namespace.MAM_LEGACY : Namespace.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", mamLegacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
Pair<MessagePacket, Long> f = original.getForwardedMessagePacket("result", mamLegacy ? Namespace.MAM_LEGACY : Namespace.MAM);
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -443,7 +443,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||||||
final boolean safeToExtract;
|
final boolean safeToExtract;
|
||||||
if (isTypeGroupChat) {
|
if (isTypeGroupChat) {
|
||||||
by = conversation.getJid().toBareJid();
|
by = conversation.getJid().toBareJid();
|
||||||
safeToExtract = conversation.getMucOptions().hasFeature(Xmlns.STANZA_IDS);
|
safeToExtract = conversation.getMucOptions().hasFeature(Namespace.STANZA_IDS);
|
||||||
} else {
|
} else {
|
||||||
by = account.getJid().toBareJid();
|
by = account.getJid().toBareJid();
|
||||||
safeToExtract = account.getXmppConnection().getFeatures().stanzaIds();
|
safeToExtract = account.getXmppConnection().getFeatures().stanzaIds();
|
||||||
|
@ -14,7 +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.Namespace;
|
||||||
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;
|
||||||
@ -156,7 +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);
|
Element fin = packet.findChild("fin", Namespace.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);
|
||||||
|
@ -114,7 +114,7 @@ import eu.siacs.conversations.utils.PRNGFixes;
|
|||||||
import eu.siacs.conversations.utils.PhoneHelper;
|
import eu.siacs.conversations.utils.PhoneHelper;
|
||||||
import eu.siacs.conversations.utils.ReplacingSerialSingleThreadExecutor;
|
import eu.siacs.conversations.utils.ReplacingSerialSingleThreadExecutor;
|
||||||
import eu.siacs.conversations.utils.SerialSingleThreadExecutor;
|
import eu.siacs.conversations.utils.SerialSingleThreadExecutor;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnBindListener;
|
import eu.siacs.conversations.xmpp.OnBindListener;
|
||||||
@ -130,7 +130,6 @@ import eu.siacs.conversations.xmpp.Patches;
|
|||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||||
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
import eu.siacs.conversations.xmpp.chatstate.ChatState;
|
||||||
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.jid.InvalidJidException;
|
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
||||||
@ -1385,7 +1384,7 @@ public class XmppConnectionService extends Service {
|
|||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": fetching roster");
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": fetching roster");
|
||||||
}
|
}
|
||||||
iqPacket.query(Xmlns.ROSTER).setAttribute("ver", account.getRosterVersion());
|
iqPacket.query(Namespace.ROSTER).setAttribute("ver", account.getRosterVersion());
|
||||||
sendIqPacket(account, iqPacket, mIqParser);
|
sendIqPacket(account, iqPacket, mIqParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2789,7 +2788,7 @@ public class XmppConnectionService extends Service {
|
|||||||
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)
|
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)
|
||||||
&& contact.getOption(Contact.Options.PREEMPTIVE_GRANT);
|
&& contact.getOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
||||||
iq.query(Xmlns.ROSTER).addChild(contact.asElement());
|
iq.query(Namespace.ROSTER).addChild(contact.asElement());
|
||||||
account.getXmppConnection().sendIqPacket(iq, mDefaultIqHandler);
|
account.getXmppConnection().sendIqPacket(iq, mDefaultIqHandler);
|
||||||
if (sendUpdates) {
|
if (sendUpdates) {
|
||||||
sendPresencePacket(account,
|
sendPresencePacket(account,
|
||||||
@ -3078,7 +3077,7 @@ public class XmppConnectionService extends Service {
|
|||||||
Account account = contact.getAccount();
|
Account account = contact.getAccount();
|
||||||
if (account.getStatus() == Account.State.ONLINE) {
|
if (account.getStatus() == Account.State.ONLINE) {
|
||||||
IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
||||||
Element item = iq.query(Xmlns.ROSTER).addChild("item");
|
Element item = iq.query(Namespace.ROSTER).addChild("item");
|
||||||
item.setAttribute("jid", contact.getJid().toString());
|
item.setAttribute("jid", contact.getJid().toString());
|
||||||
item.setAttribute("subscription", "remove");
|
item.setAttribute("subscription", "remove");
|
||||||
account.getXmppConnection().sendIqPacket(iq, mDefaultIqHandler);
|
account.getXmppConnection().sendIqPacket(iq, mDefaultIqHandler);
|
||||||
@ -3744,11 +3743,11 @@ public class XmppConnectionService extends Service {
|
|||||||
public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) {
|
public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) {
|
||||||
final boolean legacy = 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",legacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
request.addChild("prefs",legacy ? Namespace.MAM_LEGACY : Namespace.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",legacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
Element prefs = packet.findChild("prefs",legacy ? Namespace.MAM_LEGACY : Namespace.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 {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package eu.siacs.conversations.utils;
|
package eu.siacs.conversations.xml;
|
||||||
|
|
||||||
public final class Xmlns {
|
public final class Namespace {
|
||||||
public static final String BLOCKING = "urn:xmpp:blocking";
|
public static final String BLOCKING = "urn:xmpp:blocking";
|
||||||
public static final String ROSTER = "jabber:iq:roster";
|
public static final String ROSTER = "jabber:iq:roster";
|
||||||
public static final String REGISTER = "jabber:iq:register";
|
public static final String REGISTER = "jabber:iq:register";
|
@ -68,11 +68,11 @@ import eu.siacs.conversations.services.XmppConnectionService;
|
|||||||
import eu.siacs.conversations.utils.DNSHelper;
|
import eu.siacs.conversations.utils.DNSHelper;
|
||||||
import eu.siacs.conversations.utils.SSLSocketHelper;
|
import eu.siacs.conversations.utils.SSLSocketHelper;
|
||||||
import eu.siacs.conversations.utils.SocksSocketFactory;
|
import eu.siacs.conversations.utils.SocksSocketFactory;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xml.Tag;
|
import eu.siacs.conversations.xml.Tag;
|
||||||
import eu.siacs.conversations.xml.TagWriter;
|
import eu.siacs.conversations.xml.TagWriter;
|
||||||
import eu.siacs.conversations.xml.XmlReader;
|
import eu.siacs.conversations.xml.XmlReader;
|
||||||
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
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;
|
||||||
@ -1600,7 +1600,7 @@ public class XmppConnection implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean blocking() {
|
public boolean blocking() {
|
||||||
return hasDiscoFeature(account.getServer(), Xmlns.BLOCKING);
|
return hasDiscoFeature(account.getServer(), Namespace.BLOCKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean spamReporting() {
|
public boolean spamReporting() {
|
||||||
@ -1608,7 +1608,7 @@ public class XmppConnection implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean register() {
|
public boolean register() {
|
||||||
return hasDiscoFeature(account.getServer(), Xmlns.REGISTER);
|
return hasDiscoFeature(account.getServer(), Namespace.REGISTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sm() {
|
public boolean sm() {
|
||||||
@ -1635,13 +1635,13 @@ public class XmppConnection implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean mam() {
|
public boolean mam() {
|
||||||
return hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM)
|
return hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM)
|
||||||
|| hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM_LEGACY);
|
|| hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM_LEGACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean mamLegacy() {
|
public boolean mamLegacy() {
|
||||||
return !hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM)
|
return !hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM)
|
||||||
&& hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM_LEGACY);
|
&& hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM_LEGACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean push() {
|
public boolean push() {
|
||||||
@ -1661,10 +1661,10 @@ public class XmppConnection implements Runnable {
|
|||||||
if (Config.DISABLE_HTTP_UPLOAD) {
|
if (Config.DISABLE_HTTP_UPLOAD) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Xmlns.HTTP_UPLOAD);
|
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Namespace.HTTP_UPLOAD);
|
||||||
if (items.size() > 0) {
|
if (items.size() > 0) {
|
||||||
try {
|
try {
|
||||||
long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size"));
|
long maxsize = Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Namespace.HTTP_UPLOAD, "max-file-size"));
|
||||||
if(filesize <= maxsize) {
|
if(filesize <= maxsize) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -1681,10 +1681,10 @@ public class XmppConnection implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getMaxHttpUploadSize() {
|
public long getMaxHttpUploadSize() {
|
||||||
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Xmlns.HTTP_UPLOAD);
|
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Namespace.HTTP_UPLOAD);
|
||||||
if (items.size() > 0) {
|
if (items.size() > 0) {
|
||||||
try {
|
try {
|
||||||
return Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Xmlns.HTTP_UPLOAD, "max-file-size"));
|
return Long.parseLong(items.get(0).getValue().getExtendedDiscoInformation(Namespace.HTTP_UPLOAD, "max-file-size"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1694,7 +1694,7 @@ public class XmppConnection implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean stanzaIds() {
|
public boolean stanzaIds() {
|
||||||
return hasDiscoFeature(account.getJid().toBareJid(),Xmlns.STANZA_IDS);
|
return hasDiscoFeature(account.getJid().toBareJid(), Namespace.STANZA_IDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import eu.siacs.conversations.entities.Message;
|
|||||||
import eu.siacs.conversations.entities.Transferable;
|
import eu.siacs.conversations.entities.Transferable;
|
||||||
import eu.siacs.conversations.services.AbstractConnectionManager;
|
import eu.siacs.conversations.services.AbstractConnectionManager;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
import eu.siacs.conversations.utils.Xmlns;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
@ -88,16 +88,16 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.primaryCandidates.containsKey(account.getJid().toBareJid())) {
|
if (!this.primaryCandidates.containsKey(account.getJid().toBareJid())) {
|
||||||
final Jid proxy = account.getXmppConnection().findDiscoItemByFeature(Xmlns.BYTE_STREAMS);
|
final Jid proxy = account.getXmppConnection().findDiscoItemByFeature(Namespace.BYTE_STREAMS);
|
||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||||
iq.setTo(proxy);
|
iq.setTo(proxy);
|
||||||
iq.query(Xmlns.BYTE_STREAMS);
|
iq.query(Namespace.BYTE_STREAMS);
|
||||||
account.getXmppConnection().sendIqPacket(iq,new OnIqPacketReceived() {
|
account.getXmppConnection().sendIqPacket(iq,new OnIqPacketReceived() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
Element streamhost = packet.query().findChild("streamhost",Xmlns.BYTE_STREAMS);
|
Element streamhost = packet.query().findChild("streamhost", Namespace.BYTE_STREAMS);
|
||||||
final String host = streamhost == null ? null : streamhost.getAttribute("host");
|
final String host = streamhost == null ? null : streamhost.getAttribute("host");
|
||||||
final String port = streamhost == null ? null : streamhost.getAttribute("port");
|
final String port = streamhost == null ? null : streamhost.getAttribute("port");
|
||||||
if (host != null && port != null) {
|
if (host != null && port != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user