// Instant Messenger
// im_functions.js
function IM()
{
this.array_lang_im = [];
this.user_not_aut = [];
this.vcard_contacts = [];
this.vcard_user = [];
this.load_photo = false;
}
/*
* Load Contatos
*/
IM.prototype.load_im = function()
{
var force = ( arguments.length ) ? true : false;
var _this = this;
Sincro.count = 0;
var handler_contacts = function(data)
{
if ( data[1] )
{
_this.vcard_contacts.splice(0,_this.vcard_contacts.length);
_this.vcard_user.splice(0,_this.vcard_user.length);
_this.user_not_aut.splice(0,_this.user_not_aut.length);
_this.mount_list(data);
}
_this.conf_VcardUser(data[0]);
}
if ( force || this.getWinContactsState() )
cIM.cExecute("$this.Ujabber.list_user",handler_contacts);
}
/*
* Update Contatos
*/
IM.prototype.UpdateContacts = function()
{
var _this = this;
_this.load_im();
}
IM.prototype.showContacts = function()
{
if ( this.getWinContactsState() )
im_win.windowClose('contacts_im');
else
{
im_win.windowMaximizeRestore('contacts_im');
this.load_im();
}
}
IM.prototype.getWinContactsState = function()
{
try
{
var win_state = false;
win_state = ( windowItems['contacts'].state == WINDOW_STATE_REGULAR ) ? true : false;
win_state = ( win_state ) ? win_state : ( windowItems['contacts'].state == WINDOW_STATE_MAXIMIZED ) ? true : false;
return win_state;
}
catch(e)
{
return false;
}
}
/*
* Monta Lista de Contatos
*/
IM.prototype.mount_list = function(pList)
{
var _this = this;
var div = document.getElementById("div_contacts");
div.innerHTML = "";
var groups = ""+_this.get_lang("list of contacts")+" - 0
";
if(pList.length > 0){
var name_group = "";
groups = "" +
""+_this.get_lang("list of contacts")+" - " + ( pList.length - 1 ) + "
"+
"