- Timestamp:
- 04/06/10 18:13:32 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
r2397 r2437 6 6 */ 7 7 8 var TROPHYIM_BOSH_SERVICE = "/proxy/ xmpp-httpbind"; //Change to suit8 var TROPHYIM_BOSH_SERVICE = "/proxy/ejabberd"; //Change to suit 9 9 10 10 var TROPHYIM_LOG_LINES = 200; … … 651 651 * 652 652 * Parameters: 653 * (string) jid 653 * (string) jidFrom 654 * (string) jidTo 654 655 * (string) name 655 656 * (string) group 656 657 */ 657 658 658 addContacts : function( jidFrom, jidTo, name, group ) 659 { 660 var newPresence = $pres({from: jidFrom, to: jidTo, type: 'subscribe'}).tree(); 661 659 addContact : function( jidFrom, jidTo, name, group ) 660 { 661 // Set Presence 662 var newPresence = $pres({from: jidFrom, to: jidTo, type: 'subscribe'}).tree(); 663 662 664 TrophyIM.connection.send(newPresence); 663 664 var newContact = $iq({type: 'set', id: 'set1'}); 665 666 // Add Contact 667 var newContact = $iq({type: 'set', id: 'setAddContact'}); 665 668 newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 666 newContact = newContact.c('item').attrs({jid: jid , name: name, ask:'subscribe', subscription :'none'});669 newContact = newContact.c('item').attrs({jid: jidTo, name:name, ask:'subscribe', subscription:'to'}); 667 670 newContact = newContact.c('group').t(group).tree(); 668 671 … … 689 692 }, 690 693 694 /** Function: removeContact 695 * 696 * Parameters: 697 * (string) jidTo 698 */ 699 700 removeContact : function(jidTo) 701 { 702 var divItenContact = null; 703 704 if( ( divItenContact = document.getElementById('itenContact_' + jidTo))) 705 { 706 divItenContact.parentNode.removeChild(divItenContact); 707 708 // Delete Object groups 709 for( var nameGroup in TrophyIM.rosterObj.groups ) 710 for(var Jid in TrophyIM.rosterObj.groups[nameGroup]) 711 if(TrophyIM.rosterObj.groups[nameGroup][Jid] == jidTo ) 712 delete TrophyIM.rosterObj.groups[nameGroup][Jid]; 713 714 // Delete Object roster 715 if( TrophyIM.rosterObj.roster[jidTo] ) 716 delete TrophyIM.rosterObj.roster[jidTo]; 717 718 TrophyIM.rosterObj.save(); 719 720 // Remove Contact 721 var delContact = $iq({type: 'set', id: Date.parse( new Date )}) 722 delContact = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 723 delContact = delContact.c('item').attrs({jid: jidTo, subscription:'remove'});//.tree(); 724 725 TrophyIM.connection.send(delContact); 726 } 727 }, 728 691 729 /** Function: renderRoster 692 730 * … … 911 949 setAutorization : function( jid ) 912 950 { 913 //<presence to='user@example.com' from='contact@example.org' type='subscribed'/>914 //var _autorization = $pres( ).attrs( {to: jid, from: loadIM.getUserCurrent(), type:'subscribed'}).tree();915 916 951 TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree()); 917 952 },
Note: See TracChangeset
for help on using the changeset viewer.