- Timestamp:
- 04/12/10 15:50:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2471 r2491 615 615 var jid_lower = barejid.toLowerCase(); 616 616 var contact = ""; 617 617 contact = barejid.toLowerCase(); 618 contact = contact.substring(0, contact.indexOf('@')); 619 618 620 if( TrophyIM.rosterObj.roster[barejid] ) 619 621 { … … 623 625 } 624 626 } 625 else 626 { 627 contact = barejid.toLowerCase(); 628 contact = contact.substring(0, contact.indexOf('@')); 629 } 630 627 631 628 var message = 632 629 { … … 670 667 { 671 668 titleWindow = barejid.toLowerCase(); 672 titleWindow = contact.substring(0, contact.indexOf('@'));669 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 673 670 } 674 671 … … 721 718 722 719 // Add Contact 723 var _id = TrophyIM.connection.getUniqueId( );720 var _id = TrophyIM.connection.getUniqueId('add'); 724 721 var newContact = $iq({type: 'set', id: _id }); 725 722 newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); … … 755 752 */ 756 753 757 removeContact : function(jidTo )754 removeContact : function(jidTo, indexTo) 758 755 { 759 var divItenContact = null; 756 var divItenContact = null; 757 var spanShow = null; 760 758 761 if( ( divItenContact = document.getElementById('itenContact_' + jidTo )))759 if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo ))) 762 760 { 761 spanShow = document.getElementById('span_show_itenContact_' + jidTo + '_' + indexTo ) 762 763 spanShow.parentNode.removeChild(spanShow); 764 763 765 loadIM.removeGroup( divItenContact.parentNode ); 764 766 … … 766 768 767 769 // Remove Contact 768 var _id = TrophyIM.connection.getUniqueId( );770 var _id = TrophyIM.connection.getUniqueId('del'); 769 771 var delContact = $iq({type: 'set', id: _id}) 770 772 delContact = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); … … 808 810 } 809 811 810 if( !flagGeral )812 if( !flagGeral && users.length > 0 ) 811 813 groups[groups.length] = "Geral"; 812 814 … … 889 891 var element = arguments[2]; 890 892 var index = arguments[3]; 891 893 892 894 var itensJid = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index ); 893 895 … … 934 936 'presence' : presence, 935 937 'status' : status, 936 'statusDisplay' : statusDisplay 938 'statusDisplay' : statusDisplay, 939 'subscription' : objContact.contact.subscription 937 940 } 938 941 … … 966 969 for ( var resource in objContact.presence ) 967 970 { 968 presence = objContact.presence[resource].show; 969 971 if( objContact.presence[resource].show != 'invisible' ) 972 presence = objContact.presence[resource].show; 973 970 974 if( objContact.presence[resource].status ) 971 975 { … … 990 994 itensJid.style.background = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif')no-repeat center left"; 991 995 } 992 993 996 } 994 997 } … … 1032 1035 */ 1033 1036 1034 setAutorization : function( jid ) 1035 { 1036 TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree()); 1037 setAutorization : function( jidTo, jidFrom, _typeSubscription ) 1038 { 1039 var _id = TrophyIM.connection.getUniqueId(); 1040 1041 TrophyIM.connection.send($pres( ).attrs( {to: jidTo, from: jidFrom, type: _typeSubscription, id: _id}).tree()); 1037 1042 }, 1038 1043 … … 1268 1273 var groups = this.roster[ jid ].contact.groups; 1269 1274 1270 for ( var i = 0; i < groups.length; i++ ) 1271 { 1272 delete this.groups[ groups[ i ] ][ jid ]; 1273 } 1274 1275 for ( var i = 0; i < groups.length; i++ ) 1276 { 1277 var contacts = 0; 1278 for ( var contact in this.groups[ groups[ i ] ] ) 1279 contacts++; 1280 1281 if ( ! contacts ) 1282 delete this.groups[ groups[ i ] ]; 1275 if( groups ) 1276 { 1277 1278 for ( var i = 0; i < groups.length; i++ ) 1279 { 1280 delete this.groups[ groups[ i ] ][ jid ]; 1281 } 1282 1283 for ( var i = 0; i < groups.length; i++ ) 1284 { 1285 var contacts = 0; 1286 for ( var contact in this.groups[ groups[ i ] ] ) 1287 contacts++; 1288 1289 if ( ! contacts ) 1290 delete this.groups[ groups[ i ] ]; 1291 } 1283 1292 } 1284 1293
Note: See TracChangeset
for help on using the changeset viewer.