From 0164bdf11e1dd8ca2b89955a1c390057858e3f8e Mon Sep 17 00:00:00 2001 From: Leberwurscht Date: Tue, 17 Apr 2012 00:41:22 +0200 Subject: [PATCH] jappixmini: add to Friendica group and authorize --- jappixmini/lib.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/jappixmini/lib.js b/jappixmini/lib.js index dd2d79553..bbbc7e34e 100644 --- a/jappixmini/lib.js +++ b/jappixmini/lib.js @@ -147,9 +147,24 @@ function jappixmini_manage_roster(contacts, autoapprove, autosubscribe) { // ignore accounts not in the list if (contacts[xid]===undefined) return; - // TODO: add to Friendica group + // add to Friendica group if necessary + groups = []; + $(this).find('group').each(function() { + var group_text = $(this).text(); + if(group_text) groups.push(group_text); + }); - // TODO: unblock and authorize if necessary + if ($.inArray("Friendica", groups)==-1) { + console.log("Add "+xid+" to Friendica group."); + groups.push("Friendica"); + sendRoster(xid, null, null, groups); + console.log("Added "+xid+" to Friendica group."); + } + + // authorize if necessary + if (subscription=="to") { + sendSubscribe(xid, 'subscribed'); + } // remove from list delete contacts[xid];