Ignore:
Timestamp:
04/06/10 18:13:32 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Adicao de contatos com resultados da busca do ldap e exclusao de contatos da lista.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2397 r2437  
    66 */ 
    77 
    8 var TROPHYIM_BOSH_SERVICE       = "/proxy/xmpp-httpbind";  //Change to suit 
     8var TROPHYIM_BOSH_SERVICE       = "/proxy/ejabberd";  //Change to suit 
    99 
    1010var TROPHYIM_LOG_LINES          = 200; 
     
    651651         *  
    652652         *  Parameters: 
    653          *      (string) jid  
     653         *              (string) jidFrom          
     654         *      (string) jidTo  
    654655         *              (string) name 
    655656         *              (string) group    
    656657         */ 
    657658         
    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                         
    662664                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'}); 
    665668                        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'}); 
    667670                        newContact = newContact.c('group').t(group).tree(); 
    668671 
     
    689692    }, 
    690693         
     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     
    691729    /** Function: renderRoster 
    692730     * 
     
    911949        setAutorization : function( jid ) 
    912950        { 
    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                  
    916951           TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree()); 
    917952        }, 
Note: See TracChangeset for help on using the changeset viewer.