]> git.mxchange.org Git - friendica-addons.git/commitdiff
jappixmini: no multiple 'Friendica' groups in roster
authorLeberwurscht <leberwurscht@hoegners.de>
Tue, 17 Apr 2012 21:38:27 +0000 (23:38 +0200)
committerLeberwurscht <leberwurscht@hoegners.de>
Tue, 17 Apr 2012 21:38:27 +0000 (23:38 +0200)
jappixmini/lib.js

index 6c47f590f3b2a2782daf3489233f6f2d1b91fcf2..deeb8b466794b785690fe2d18bb8fa1a66018bff 100644 (file)
@@ -164,13 +164,17 @@ function jappixmini_manage_roster(contacts, contacts_hash, autoapprove, autosubs
 
                        // add to Friendica group or change name if necessary
                        var groups = [];
+                       var group_missing = false;
                        node.find('group').each(function() {
                                var group_text = $(this).text();
                                if (group_text) groups.push(group_text);
                        });
-
-                       if ($.inArray("Friendica", groups)==-1 || name!=contacts[xid]) {
+                       if ($.inArray("Friendica", groups)==-1) {
+                               group_missing = true;
                                groups.push("Friendica");
+                       }
+
+                       if (group_missing || name!=contacts[xid]) {
                                sendRoster(xid, null, contacts[xid], groups);
                                console.log("Added "+xid+" to Friendica group and set name to "+contacts[xid]+".");
                        }