Permalink
Browse files

store bookmarks in pep if conversion xep is running

  • Loading branch information...
iNPUTmice committed Aug 18, 2018
1 parent 46574d6 commit dc5e7e5d95e30b8220a0f2d0ada969a3006c3437
@@ -36,6 +36,7 @@
"http://jabber.org/protocol/disco#info",
"urn:xmpp:avatar:metadata+notify",
"http://jabber.org/protocol/nick+notify",
Namespace.BOOKMARKS+"+notify",
"urn:xmpp:ping",
"jabber:iq:version",
"http://jabber.org/protocol/chatstates"
@@ -50,20 +51,17 @@
private final String[] PRIVACY_SENSITIVE = {
"urn:xmpp:time" //XEP-0202: Entity Time leaks time zone
};
private final String[] OTR = {
"urn:xmpp:otr:0"
};
private String mVersion = null;

private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);

protected XmppConnectionService mXmppConnectionService;

protected AbstractGenerator(XmppConnectionService service) {
AbstractGenerator(XmppConnectionService service) {
this.mXmppConnectionService = service;
}

protected String getIdentityVersion() {
String getIdentityVersion() {
if (mVersion == null) {
this.mVersion = PhoneHelper.getVersionName(mXmppConnectionService);
}
@@ -24,6 +24,7 @@
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Bookmark;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.services.MessageArchiveService;
@@ -138,6 +139,13 @@ public IqPacket publishAvatar(Avatar avatar) {
return publish("urn:xmpp:avatar:data", item);
}

public IqPacket publishElement(final String namespace,final Element element, final Bundle options) {
final Element item = new Element("item");
item.setAttribute("id","current");
item.addChild(element);
return publish(namespace, item, options);
}

public IqPacket publishAvatarMetadata(final Avatar avatar) {
final Element item = new Element("item");
item.setAttribute("id", avatar.sha1sum);
@@ -212,14 +212,21 @@ private void parseEvent(final Element event, final Jid from, final Account accou
AxolotlService axolotlService = account.getAxolotlService();
axolotlService.registerDevices(from, deviceIds);
mXmppConnectionService.updateAccountUi();
} else if (Namespace.BOOKMARKS.equals(node)) {
Log.d(Config.LOGTAG,"received bookmarks from "+from);
if (account.getJid().asBareJid().equals(from)) {
final Element i = items.findChild("item");
final Element storage = i == null ? null : i.findChild("storage", Namespace.BOOKMARKS);
mXmppConnectionService.processBookmarks(account,storage);
}
}
}

private boolean handleErrorMessage(Account account, MessagePacket packet) {
if (packet.getType() == MessagePacket.TYPE_ERROR) {
Jid from = packet.getFrom();
if (from != null) {
Message message = mXmppConnectionService.markMessage(account,
mXmppConnectionService.markMessage(account,
from.asBareJid(),
packet.getId(),
Message.STATUS_SEND_FAILED,
Oops, something went wrong.

0 comments on commit dc5e7e5

Please sign in to comment.