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 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.Field;
|
||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||
|
@ -374,11 +374,11 @@ public class MucOptions {
|
|||
}
|
||||
|
||||
public boolean mamSupport() {
|
||||
return hasFeature(Xmlns.MAM) || hasFeature(Xmlns.MAM_LEGACY);
|
||||
return hasFeature(Namespace.MAM) || hasFeature(Namespace.MAM_LEGACY);
|
||||
}
|
||||
|
||||
public boolean mamLegacy() {
|
||||
return hasFeature(Xmlns.MAM_LEGACY) && !hasFeature(Xmlns.MAM);
|
||||
return hasFeature(Namespace.MAM_LEGACY) && !hasFeature(Namespace.MAM);
|
||||
}
|
||||
|
||||
public boolean nonanonymous() {
|
||||
|
|
|
@ -27,7 +27,7 @@ import eu.siacs.conversations.entities.Conversation;
|
|||
import eu.siacs.conversations.entities.DownloadableFile;
|
||||
import eu.siacs.conversations.services.MessageArchiveService;
|
||||
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.xmpp.forms.Data;
|
||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||
|
@ -229,10 +229,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(mam.isLegacy() ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
||||
final Element query = packet.query(mam.isLegacy() ? Namespace.MAM_LEGACY : Namespace.MAM);
|
||||
query.setAttribute("queryid", mam.getQueryId());
|
||||
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()) {
|
||||
packet.setTo(mam.getWith());
|
||||
} else if (mam.getWith()!=null) {
|
||||
|
@ -251,14 +251,14 @@ public class IqGenerator extends AbstractGenerator {
|
|||
}
|
||||
public IqPacket generateGetBlockList() {
|
||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||
iq.addChild("blocklist", Xmlns.BLOCKING);
|
||||
iq.addChild("blocklist", Namespace.BLOCKING);
|
||||
|
||||
return iq;
|
||||
}
|
||||
|
||||
public IqPacket generateSetBlockRequest(final Jid jid, boolean reportSpam) {
|
||||
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());
|
||||
if (reportSpam) {
|
||||
item.addChild("report", "urn:xmpp:reporting:0").addChild("spam");
|
||||
|
@ -269,7 +269,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||
|
||||
public IqPacket generateSetUnblockRequest(final Jid jid) {
|
||||
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());
|
||||
return iq;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||
public IqPacket generateSetPassword(final Account account, final String newPassword) {
|
||||
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
||||
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();
|
||||
query.addChild("username").setContent(jid.getLocalpart());
|
||||
query.addChild("password").setContent(newPassword);
|
||||
|
@ -316,7 +316,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||
public IqPacket requestHttpUploadSlot(Jid host, DownloadableFile file, String mime) {
|
||||
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
|
||||
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("size").setContent(String.valueOf(file.getExpectedSize()));
|
||||
if (mime != null) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import eu.siacs.conversations.services.AbstractConnectionManager;
|
|||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.ui.UiCallback;
|
||||
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.xmpp.OnIqPacketReceived;
|
||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||
|
@ -117,13 +117,13 @@ public class HttpUploadConnection implements Transferable {
|
|||
}
|
||||
this.file.setExpectedSize(pair.second);
|
||||
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);
|
||||
mXmppConnectionService.sendIqPacket(account, request, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
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) {
|
||||
try {
|
||||
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.Conversation;
|
||||
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.xmpp.OnIqPacketReceived;
|
||||
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;
|
||||
if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||
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");
|
||||
// If this is in response to a query for the whole roster:
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
account.getRoster().markAllAsNotInRoster();
|
||||
}
|
||||
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)) {
|
||||
// Block list or block push.
|
||||
Log.d(Config.LOGTAG, "Received blocklist update from server");
|
||||
final Element blocklist = packet.findChild("blocklist", Xmlns.BLOCKING);
|
||||
final Element block = packet.findChild("block", Xmlns.BLOCKING);
|
||||
final Element blocklist = packet.findChild("blocklist", Namespace.BLOCKING);
|
||||
final Element block = packet.findChild("block", Namespace.BLOCKING);
|
||||
final Collection<Element> items = blocklist != null ? blocklist.getChildren() :
|
||||
(block != null ? block.getChildren() : null);
|
||||
// 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);
|
||||
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) {
|
||||
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) {
|
||||
// No children to unblock == unblock all
|
||||
account.getBlocklist().clear();
|
||||
|
|
|
@ -31,7 +31,7 @@ import eu.siacs.conversations.http.HttpConnectionManager;
|
|||
import eu.siacs.conversations.services.MessageArchiveService;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
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.xmpp.OnMessagePacketReceived;
|
||||
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) {
|
||||
for(Element child : packet.getChildren()) {
|
||||
if (child.getName().equals("stanza-id")
|
||||
&& Xmlns.STANZA_IDS.equals(child.getNamespace())
|
||||
&& Namespace.STANZA_IDS.equals(child.getNamespace())
|
||||
&& by.equals(child.getAttributeAsJid("by"))) {
|
||||
return child.getAttribute("id");
|
||||
}
|
||||
|
@ -300,16 +300,16 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
final boolean isForwarded;
|
||||
boolean isCarbon = false;
|
||||
String serverMsgId = null;
|
||||
final Element fin = original.findChild("fin", Xmlns.MAM_LEGACY);
|
||||
final Element fin = original.findChild("fin", Namespace.MAM_LEGACY);
|
||||
if (fin != null) {
|
||||
mXmppConnectionService.getMessageArchiveService().processFinLegacy(fin,original.getFrom());
|
||||
return;
|
||||
}
|
||||
final boolean mamLegacy = original.hasChild("result",Xmlns.MAM_LEGACY);
|
||||
final Element result = original.findChild("result",mamLegacy ? Xmlns.MAM_LEGACY : Xmlns.MAM);
|
||||
final boolean mamLegacy = original.hasChild("result", Namespace.MAM_LEGACY);
|
||||
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"));
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
|||
final boolean safeToExtract;
|
||||
if (isTypeGroupChat) {
|
||||
by = conversation.getJid().toBareJid();
|
||||
safeToExtract = conversation.getMucOptions().hasFeature(Xmlns.STANZA_IDS);
|
||||
safeToExtract = conversation.getMucOptions().hasFeature(Namespace.STANZA_IDS);
|
||||
} else {
|
||||
by = account.getJid().toBareJid();
|
||||
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.Conversation;
|
||||
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.xmpp.OnAdvancedStreamFeaturesLoaded;
|
||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||
|
@ -156,7 +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);
|
||||
Element fin = packet.findChild("fin", Namespace.MAM);
|
||||
if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||
synchronized (MessageArchiveService.this.queries) {
|
||||
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.ReplacingSerialSingleThreadExecutor;
|
||||
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.xml.Element;
|
||||
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.chatstate.ChatState;
|
||||
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.Jid;
|
||||
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
|
||||
|
@ -1385,7 +1384,7 @@ public class XmppConnectionService extends Service {
|
|||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2789,7 +2788,7 @@ public class XmppConnectionService extends Service {
|
|||
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)
|
||||
&& contact.getOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||
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);
|
||||
if (sendUpdates) {
|
||||
sendPresencePacket(account,
|
||||
|
@ -3078,7 +3077,7 @@ public class XmppConnectionService extends Service {
|
|||
Account account = contact.getAccount();
|
||||
if (account.getStatus() == Account.State.ONLINE) {
|
||||
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("subscription", "remove");
|
||||
account.getXmppConnection().sendIqPacket(iq, mDefaultIqHandler);
|
||||
|
@ -3744,11 +3743,11 @@ public class XmppConnectionService extends Service {
|
|||
public void fetchMamPreferences(Account account, final OnMamPreferencesFetched callback) {
|
||||
final boolean legacy = account.getXmppConnection().getFeatures().mamLegacy();
|
||||
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() {
|
||||
@Override
|
||||
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) {
|
||||
callback.onPreferencesFetched(prefs);
|
||||
} 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 ROSTER = "jabber:iq:roster";
|
||||
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.SSLSocketHelper;
|
||||
import eu.siacs.conversations.utils.SocksSocketFactory;
|
||||
import eu.siacs.conversations.utils.Xmlns;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xml.Tag;
|
||||
import eu.siacs.conversations.xml.TagWriter;
|
||||
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.Field;
|
||||
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
|
||||
|
@ -1600,7 +1600,7 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
public boolean blocking() {
|
||||
return hasDiscoFeature(account.getServer(), Xmlns.BLOCKING);
|
||||
return hasDiscoFeature(account.getServer(), Namespace.BLOCKING);
|
||||
}
|
||||
|
||||
public boolean spamReporting() {
|
||||
|
@ -1608,7 +1608,7 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
public boolean register() {
|
||||
return hasDiscoFeature(account.getServer(), Xmlns.REGISTER);
|
||||
return hasDiscoFeature(account.getServer(), Namespace.REGISTER);
|
||||
}
|
||||
|
||||
public boolean sm() {
|
||||
|
@ -1635,13 +1635,13 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
public boolean mam() {
|
||||
return hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM)
|
||||
|| hasDiscoFeature(account.getJid().toBareJid(), Xmlns.MAM_LEGACY);
|
||||
return hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM)
|
||||
|| hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM_LEGACY);
|
||||
}
|
||||
|
||||
public boolean mamLegacy() {
|
||||
return !hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM)
|
||||
&& hasDiscoFeature(account.getJid().toBareJid(),Xmlns.MAM_LEGACY);
|
||||
return !hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM)
|
||||
&& hasDiscoFeature(account.getJid().toBareJid(), Namespace.MAM_LEGACY);
|
||||
}
|
||||
|
||||
public boolean push() {
|
||||
|
@ -1661,10 +1661,10 @@ public class XmppConnection implements Runnable {
|
|||
if (Config.DISABLE_HTTP_UPLOAD) {
|
||||
return false;
|
||||
} else {
|
||||
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Xmlns.HTTP_UPLOAD);
|
||||
List<Entry<Jid, ServiceDiscoveryResult>> items = findDiscoItemsByFeature(Namespace.HTTP_UPLOAD);
|
||||
if (items.size() > 0) {
|
||||
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) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1681,10 +1681,10 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1694,7 +1694,7 @@ public class XmppConnection implements Runnable {
|
|||
}
|
||||
|
||||
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.services.AbstractConnectionManager;
|
||||
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.xmpp.OnIqPacketReceived;
|
||||
import eu.siacs.conversations.xmpp.jid.Jid;
|
||||
|
@ -88,16 +88,16 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
|||
return;
|
||||
}
|
||||
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) {
|
||||
IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||
iq.setTo(proxy);
|
||||
iq.query(Xmlns.BYTE_STREAMS);
|
||||
iq.query(Namespace.BYTE_STREAMS);
|
||||
account.getXmppConnection().sendIqPacket(iq,new OnIqPacketReceived() {
|
||||
|
||||
@Override
|
||||
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 port = streamhost == null ? null : streamhost.getAttribute("port");
|
||||
if (host != null && port != null) {
|
||||
|
|
Loading…
Reference in a new issue