+
+
Index: sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js (revision 2471)
+++ sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js (revision 2491)
@@ -32,5 +32,5 @@
var e = window.event;
- ( ( e.target ) ? e.target : e.srcElement ).oncontextmenu = function(e)
+ ( ( e.target ) ? e.target : e.srcElement ).parentNode.oncontextmenu = function(e)
{
return false;
@@ -40,5 +40,8 @@
optionsItensContact(jid, index);
else
- TrophyIM.rosterClick(jid);
+ {
+ if ( e.target.id )
+ TrophyIM.rosterClick(jid);
+ }
}
}
@@ -299,5 +302,4 @@
}
-
function optionsItensContact()
{
@@ -312,6 +314,6 @@
var _options = [
- ['Autorizar', 'TrophyIM.setAutorization(\''+jid+'\')'],
- ['Remover', 'loadIM.removeContact(\''+jid+'\')'],
+ ['Autorizar', 'loadIM.setAutorization(\''+jid+'\',\''+index+'\')'],
+ ['Remover', 'loadIM.removeContact(\''+jid+'\',\''+index+'\')'],
['Renomear', 'Renomear : ' + jid],
['Trocar grupo', 'Trocar grupo : ' + jid],
@@ -323,22 +325,20 @@
{
_itens += '
';
- _itens += '
';
+ _itens += '';
_itens += _options[i][0] + '
';
}
var _optionsItens = document.createElement("div");
- _optionsItens.setAttribute("style", "margin: -5px 0px 0px 20px;");
+ _optionsItens.setAttribute("style", "margin: -10px 0px 0px 20px;");
_optionsItens.className = "x-menu";
_optionsItens.style.zIndex = '99999';
_optionsItens.innerHTML = _itens;
- _optionsItens.onclick = function(){ showhidden.hiddenObject(false); };
+ _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); };
+ _optionsItens.onmouseover = function(){ showhidden.hiddenObject(true); };
showhidden.action('onmouseover', 'onmouseout', _optionsItens);
- element.onmouseout = function(){ showhidden.hiddenObject(false); };
- element.onmouseover = function(){ showhidden.hiddenObject(true); };
- element.appendChild( _optionsItens );
- }
-
+ element.appendChild(_optionsItens);
+ }
}
@@ -352,11 +352,11 @@
}
- function removeContact(jid)
+ function removeContact(jid, index)
{
setTimeout(function()
{
- TrophyIM.removeContact(jid);
-
- }, 500);
+ TrophyIM.removeContact(jid, index);
+
+ },300);
}
@@ -367,5 +367,4 @@
if( _parent.childNodes.length <= 2 )
_parent.parentNode.removeChild(_parent);
-
}
@@ -407,8 +406,23 @@
}
- function setSelectEditable(element)
- {
- if( document.getElementById('selectBox0') == null )
- selectEditable.create(element);
+ function setAutorization(jidTo, indexTo)
+ {
+ var divItenContact = null;
+
+ if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo )))
+ {
+ var subscription = divItenContact.getAttribute('subscription');
+
+ switch(subscription)
+ {
+ case 'from':
+ case 'not-in-roster':
+ TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe');
+ break;
+ case 'to' :
+ TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed');
+ break;
+ }
+ }
}
@@ -452,5 +466,11 @@
}
}
-
+
+ function setSelectEditable(element)
+ {
+ if( document.getElementById('selectBox0') == null )
+ selectEditable.create(element);
+ }
+
function setStatusJabber()
{
@@ -538,4 +558,5 @@
loadIM.prototype.parse = parse;
loadIM.prototype.searchUser = searchUser
+ loadIM.prototype.setAutorization = setAutorization;
loadIM.prototype.setPresence = setPresence;
loadIM.prototype.setStatusJabber = setStatusJabber;
Index: sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js (revision 2471)
+++ sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js (revision 2491)
@@ -615,5 +615,7 @@
var jid_lower = barejid.toLowerCase();
var contact = "";
-
+ contact = barejid.toLowerCase();
+ contact = contact.substring(0, contact.indexOf('@'));
+
if( TrophyIM.rosterObj.roster[barejid] )
{
@@ -623,10 +625,5 @@
}
}
- else
- {
- contact = barejid.toLowerCase();
- contact = contact.substring(0, contact.indexOf('@'));
- }
-
+
var message =
{
@@ -670,5 +667,5 @@
{
titleWindow = barejid.toLowerCase();
- titleWindow = contact.substring(0, contact.indexOf('@'));
+ titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));
}
@@ -721,5 +718,5 @@
// Add Contact
- var _id = TrophyIM.connection.getUniqueId();
+ var _id = TrophyIM.connection.getUniqueId('add');
var newContact = $iq({type: 'set', id: _id });
newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'});
@@ -755,10 +752,15 @@
*/
- removeContact : function(jidTo)
+ removeContact : function(jidTo, indexTo)
{
- var divItenContact = null;
+ var divItenContact = null;
+ var spanShow = null;
- if( ( divItenContact = document.getElementById('itenContact_' + jidTo)))
+ if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo )))
{
+ spanShow = document.getElementById('span_show_itenContact_' + jidTo + '_' + indexTo )
+
+ spanShow.parentNode.removeChild(spanShow);
+
loadIM.removeGroup( divItenContact.parentNode );
@@ -766,5 +768,5 @@
// Remove Contact
- var _id = TrophyIM.connection.getUniqueId();
+ var _id = TrophyIM.connection.getUniqueId('del');
var delContact = $iq({type: 'set', id: _id})
delContact = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'});
@@ -808,5 +810,5 @@
}
- if( !flagGeral )
+ if( !flagGeral && users.length > 0 )
groups[groups.length] = "Geral";
@@ -889,5 +891,5 @@
var element = arguments[2];
var index = arguments[3];
-
+
var itensJid = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index );
@@ -934,5 +936,6 @@
'presence' : presence,
'status' : status,
- 'statusDisplay' : statusDisplay
+ 'statusDisplay' : statusDisplay,
+ 'subscription' : objContact.contact.subscription
}
@@ -966,6 +969,7 @@
for ( var resource in objContact.presence )
{
- presence = objContact.presence[resource].show;
-
+ if( objContact.presence[resource].show != 'invisible' )
+ presence = objContact.presence[resource].show;
+
if( objContact.presence[resource].status )
{
@@ -990,5 +994,4 @@
itensJid.style.background = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif')no-repeat center left";
}
-
}
}
@@ -1032,7 +1035,9 @@
*/
- setAutorization : function( jid )
- {
- TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree());
+ setAutorization : function( jidTo, jidFrom, _typeSubscription )
+ {
+ var _id = TrophyIM.connection.getUniqueId();
+
+ TrophyIM.connection.send($pres( ).attrs( {to: jidTo, from: jidFrom, type: _typeSubscription, id: _id}).tree());
},
@@ -1268,17 +1273,21 @@
var groups = this.roster[ jid ].contact.groups;
- for ( var i = 0; i < groups.length; i++ )
- {
- delete this.groups[ groups[ i ] ][ jid ];
- }
-
- for ( var i = 0; i < groups.length; i++ )
- {
- var contacts = 0;
- for ( var contact in this.groups[ groups[ i ] ] )
- contacts++;
-
- if ( ! contacts )
- delete this.groups[ groups[ i ] ];
+ if( groups )
+ {
+
+ for ( var i = 0; i < groups.length; i++ )
+ {
+ delete this.groups[ groups[ i ] ][ jid ];
+ }
+
+ for ( var i = 0; i < groups.length; i++ )
+ {
+ var contacts = 0;
+ for ( var contact in this.groups[ groups[ i ] ] )
+ contacts++;
+
+ if ( ! contacts )
+ delete this.groups[ groups[ i ] ];
+ }
}