+//
+// Copyright 2012 "Leberwurscht" <leberwurscht@hoegners.de>
+//
+// This file is dual-licensed under the MIT license (see MIT.txt) and the AGPL license (see jappix/COPYING).
+//
+
function jappixmini_addon_xor(str1, str2) {
if (str1.length != str2.length) throw "not same length";
var div = document.getElementById("#jappixmini-password-query-div");
if (!div) {
- div = $('<div id="jappixmini-password-query-div" style="position:fixed;padding:1em;background-color:#F00;color:#fff;top:50px;left:50px;">Retype your Friendica password for chatting:<br></div>');
+ div = $('<div id="jappixmini-password-query-div" style="position:fixed;padding:1em;background-color:#F00;color:#fff;top:50px;left:650px;">Retype your Friendica password for chatting:<br></div>');
var input = $('<input type="password" id="jappixmini-password-query-input">')
div.append(input);
// ignore accounts that are not in the list
if (contacts[xid]===undefined) return;
- // add to Friendica group if necessary
+ // 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) {
+ group_missing = true;
groups.push("Friendica");
- sendRoster(xid, null, null, groups);
- console.log("Added "+xid+" to Friendica group.");
+ }
+
+ 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]+".");
}
// authorize if necessary
sendSubscribe(xid, "subscribe");
}
-function jappixmini_addon_start(server, username, proxy, bosh, encrypted, password, nickname, contacts, contacts_hash, autoapprove, autosubscribe) {
+function jappixmini_addon_start(server, username, proxy, bosh, encrypted, password, nickname, contacts, contacts_hash, autoapprove, autosubscribe, groupchats) {
var handler = function(password){
// check if settings have changed, reinitialize jappix mini if this is the case
var settings_identifier = str_sha1(server);
HOST_BOSH = bosh;
// start jappix mini
+ MINI_GROUPCHATS = groupchats;
MINI_NICKNAME = nickname;
LOCK_HOST = "off";
launchMini(true, false, server, username, password);