|
|
@ -14,9 +14,6 @@ |
|
|
$scope.contacts = []; |
|
|
$scope.contacts = []; |
|
|
$scope.groups = []; |
|
|
$scope.groups = []; |
|
|
|
|
|
|
|
|
//this.ressourcesCount = 0;
|
|
|
|
|
|
//$scope.presenceCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Dictionaries */ |
|
|
/* Dictionaries */ |
|
|
$scope.lookupgroups = {}; |
|
|
$scope.lookupgroups = {}; |
|
|
$scope.lookupjid = {}; |
|
|
$scope.lookupjid = {}; |
|
|
@ -48,13 +45,10 @@ |
|
|
} |
|
|
} |
|
|
/* New ressource (can't just push the whole set of same jid because there is no set) */ |
|
|
/* New ressource (can't just push the whole set of same jid because there is no set) */ |
|
|
if(!$scope.isInJidItems(list[i].jid, list[i].ressource)){ |
|
|
if(!$scope.isInJidItems(list[i].jid, list[i].ressource)){ |
|
|
//this.ressourcesCount ++;
|
|
|
|
|
|
$scope.pushInPlace(list[i], $scope.lookupjid[list[i].jid].ajiditems, ressourceCompare); |
|
|
$scope.pushInPlace(list[i], $scope.lookupjid[list[i].jid].ajiditems, ressourceCompare); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/*console.log("LOADED"); |
|
|
|
|
|
if(this.ressourcesCount == $scope.lookup.length) |
|
|
|
|
|
localStorage.setObject("rosterLoaded", true);*/ |
|
|
|
|
|
|
|
|
|
|
|
$scope.$apply(); |
|
|
$scope.$apply(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -118,6 +112,7 @@ |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
$scope.updateContact = function(list){ |
|
|
$scope.updateContact = function(list){ |
|
|
|
|
|
console.log("updateContact"); |
|
|
if($scope.contacts === null) $scope.contacts = []; |
|
|
if($scope.contacts === null) $scope.contacts = []; |
|
|
/* Group change */ |
|
|
/* Group change */ |
|
|
if((list[0].jid in $scope.lookupjid) |
|
|
if((list[0].jid in $scope.lookupjid) |
|
|
@ -143,7 +138,6 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Jid is in the list */ |
|
|
/* Jid is in the list */ |
|
|
//if(var gi = isInGroupItems(list[0].groupname, list[0].jid) !=== false){
|
|
|
|
|
|
if(list[0].jid in $scope.lookupjid){ |
|
|
if(list[0].jid in $scope.lookupjid){ |
|
|
//$scope.lookupgroups[list[0].groupname].agroupitems[gi].ajiditems = list
|
|
|
//$scope.lookupgroups[list[0].groupname].agroupitems[gi].ajiditems = list
|
|
|
//var gi = $scope.isInGroupItems(list[0].groupname, list[0].jid);
|
|
|
//var gi = $scope.isInGroupItems(list[0].groupname, list[0].jid);
|
|
|
@ -217,13 +211,6 @@ |
|
|
return liclass; |
|
|
return liclass; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.getContactClient = function(c){ |
|
|
|
|
|
liclass = ""; |
|
|
|
|
|
if(c.rosterview.client) |
|
|
|
|
|
liclass = "client " + c.rosterview.client; |
|
|
|
|
|
return liclass; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.getJidStatusRessource = function(c){ |
|
|
this.getJidStatusRessource = function(c){ |
|
|
lititle = c.jid; |
|
|
lititle = c.jid; |
|
|
if(c.status != '') lititle += " - " + c.status; |
|
|
if(c.status != '') lititle += " - " + c.status; |
|
|
@ -240,46 +227,29 @@ |
|
|
})(); |
|
|
})(); |
|
|
|
|
|
|
|
|
window.onunload = window.onbeforeunload = function(e){ |
|
|
window.onunload = window.onbeforeunload = function(e){ |
|
|
|
|
|
|
|
|
/*console.log(localStorage.getObject("rosterLoaded")); |
|
|
|
|
|
if(localStorage.getObject("rosterLoaded") === true){ |
|
|
|
|
|
//console.log("target it");
|
|
|
|
|
|
//console.log(e);
|
|
|
|
|
|
localStorage.setObject('rosterContacts', angular.element(roster).scope().contacts); |
|
|
localStorage.setObject('rosterContacts', angular.element(roster).scope().contacts); |
|
|
localStorage.setObject('lookupjid', angular.element(roster).scope().lookupjid); |
|
|
localStorage.setObject('lookupjid', angular.element(roster).scope().lookupjid); |
|
|
localStorage.setObject('lookupgroups', angular.element(roster).scope().lookupgroups); |
|
|
localStorage.setObject('lookupgroups', angular.element(roster).scope().lookupgroups); |
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
console.log("NOPE"); |
|
|
|
|
|
}*/ |
|
|
|
|
|
//return "poet pouet la";
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Functions to call angular inner functions */ |
|
|
/* Functions to call angular inner functions */ |
|
|
function initContacts(tab){ |
|
|
function initContacts(tab){ |
|
|
//console.log(localStorage.getObject("rosterLoaded"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if(localStorage.getObject("rosterLoaded") === null){ |
|
|
|
|
|
localStorage.setObject("rosterLoaded", false); |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("HELLO"); |
|
|
if(tab.length == 0) |
|
|
if(tab.length == 0) |
|
|
angular.element(roster).scope().contacts = null; |
|
|
angular.element(roster).scope().contacts = null; |
|
|
else{ |
|
|
else{ |
|
|
/*console.log("rosterLoaded"); |
|
|
|
|
|
console.log(localStorage.getObject("rosterLoaded")); |
|
|
|
|
|
if(localStorage.getObject("rosterLoaded") === true){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(localStorage.getObject("rosterContacts")); |
|
|
|
|
|
if(localStorage.getObject("rosterContacts") !== null){ |
|
|
angular.element(roster).scope().contacts = localStorage.getObject('rosterContacts'); |
|
|
angular.element(roster).scope().contacts = localStorage.getObject('rosterContacts'); |
|
|
angular.element(roster).scope().lookupjid = localStorage.getObject('lookupjid'); |
|
|
angular.element(roster).scope().lookupjid = localStorage.getObject('lookupjid'); |
|
|
console.log(angular.element(roster).scope().lookupjid); |
|
|
|
|
|
angular.element(roster).scope().lookupgroups = localStorage.getObject('lookupgroups'); |
|
|
angular.element(roster).scope().lookupgroups = localStorage.getObject('lookupgroups'); |
|
|
|
|
|
|
|
|
|
|
|
//console.log(angular.element(roster).scope().lookupjid);
|
|
|
} |
|
|
} |
|
|
else{*/ |
|
|
|
|
|
|
|
|
else{ |
|
|
angular.element(roster).scope().initContacts(JSON.parse(tab)); |
|
|
angular.element(roster).scope().initContacts(JSON.parse(tab)); |
|
|
//}
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|