Skip to content

Commit

Permalink
store bookmarks in pep if conversion xep is running
Browse files Browse the repository at this point in the history
  • Loading branch information
iNPUTmice committed Aug 18, 2018
1 parent 46574d6 commit dc5e7e5
Show file tree
Hide file tree
Showing 7 changed files with 1,292 additions and 1,211 deletions.
Expand Up @@ -36,6 +36,7 @@ public abstract class AbstractGenerator {
"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"
Expand All @@ -50,20 +51,17 @@ public abstract class AbstractGenerator {
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);
}
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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,
Expand Down

0 comments on commit dc5e7e5

Please sign in to comment.