Ignore:
Timestamp:
06/10/08 16:41:40 (16 years ago)
Author:
niltonneto
Message:

Correções críticas para funcionalidades já existentes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/js/jabber.js

    r305 r311  
    55        var _window; 
    66        var _ldap; 
    7  
    8         var _menu = new ShowHidden(1500); 
     7        var _menu; 
    98 
    109        var _vcards = []; 
     
    138137                var _win = _window.get('chat' + id); 
    139138                if ( !_win ) 
    140                         _chat(id); 
     139                { 
     140                        _win = _chat(id); 
     141                        var _st = el.style.backgroundImage; 
     142                        _win.icon(_st.substr(4, (_st.length - 5))); 
     143                } 
    141144                else 
    142145                { 
     
    155158                        _win_contact.bc.style.display = 'none'; 
    156159                        _win_contact.wm.style.display = 'none'; 
     160                        _win_contact.icon(im_available.src); 
    157161 
    158162                var _params = { 
     
    172176                if ( _contact_list ) 
    173177                { 
    174                         _conn.go('$this.Ujabber.setStatus'); 
     178                        _setPresence('unavailable'); 
     179                        _setPresence(); 
    175180                        _ldap.photo( 
    176181                                'im_avatar', 
     
    222227                                        var _sub_menu = top.document.getElementById('sub_' + el.getAttribute('jid')); 
    223228                                                _sub_menu.innerHTML = _xtools.parse(_xml, 'options.xsl'); 
    224                                                 _menu.action('onmouseover', 'onmouseout', _sub_menu); 
     229 
     230                                        _menu.action('onmouseover', 'onmouseout', _sub_menu); 
    225231 
    226232                                        _sub_menu = _sub_menu.firstChild; 
     
    260266                        while ( _contact ) 
    261267                        { 
     268                                _config(_contact, 'onmouseover', _hover); 
     269                                _config(_contact, 'onmouseout', _hover); 
    262270                                if ( _contact.getAttribute('jid') ) 
    263271                                { 
    264272                                        //_config(_contact, 'onmousedown', _click); 
    265273                                        _config(_contact, 'onmouseup', _click); 
    266                                         _config(_contact, 'onmouseover', _hover); 
    267                                         _config(_contact, 'onmouseout', _hover); 
     274                                } 
     275                                else 
     276                                { 
     277                                        _config(_contact, 'onclick', 
     278                                        function(e) 
     279                                        { 
     280                                                var el = ( e.target ) ? e.target : e.srcElement; 
     281 
     282                                                if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
     283                                                        el.style.backgroundImage = 'url(' + im_group_open.src + ')'; 
     284                                                else 
     285                                                        el.style.backgroundImage = 'url(' + im_group_close.src + ')'; 
     286 
     287                                                el = el.nextSibling; 
     288                                                while ( el.getAttribute('jid') ) 
     289                                                { 
     290                                                        el.style.display = ( el.style.display != 'none' ) ? 
     291                                                                'none' : 'block'; 
     292                                                        el = el.nextSibling; 
     293                                                        if ( el && el.nextSibling ) 
     294                                                                el = el.nextSibling; 
     295                                                } 
     296                                        }); 
    268297                                } 
    269298                                _contact = _contact.nextSibling; 
     
    272301        } 
    273302 
     303        function _setPresence() 
     304        { 
     305                var _presence = false; 
     306                var _pPresence; 
     307                if ( arguments.length == 0 ) 
     308                        _pPresence = 'available'; 
     309                else 
     310                        _pPresence = arguments[0]; 
     311                switch ( _pPresence ) 
     312                { 
     313                        case 'away': 
     314                        case 'dnd': 
     315                        case 'xa': 
     316                                _presence = 'show=' + _pPresence; 
     317                        break; 
     318                        case 'available': 
     319                        case 'unavailable': 
     320                                _presence = 'type=' + _pPresence; 
     321                        break; 
     322                } 
     323 
     324                if ( _presence ) 
     325                { 
     326                        var _status = top.document.getElementById('im_status'); 
     327                        if ( _status ) 
     328                                _status.style.backgroundImage = 'url(' + eval('im_' + _pPresence + '.src') + ')'; 
     329                        _conn.go('$this.Ujabber.setPresence', _presence); 
     330                } 
     331        } 
     332 
    274333        function _vcard(_pJid) 
    275334        { 
     
    285344 
    286345                                _win_vcard = _window.load('vcard_' + _pJid); 
    287                                 _win_vcard.title('.:: Informações do Contato ::.'); 
     346                                _win_vcard.title('.:: Informações do Contato ::.'); 
    288347                                _win_vcard.size(300); 
    289348                                _win_vcard.position(_win_pos, _win_pos); 
     
    347406                                _readVCard(pIq); 
    348407                        break; 
     408                        case 'last_time_user' : 
     409                                _readLastTimeUser(pIq); 
     410                        break; 
    349411                        default : //alert('readIq : ' + pIq.getAttribute('id')); 
    350412                } 
     413        } 
     414 
     415        function _readLastTimeUser(pIq) 
     416        { 
     417                if ( pIq.firstChild.getAttribute("seconds") != 0 ) 
     418                        _setPresence(); 
    351419        } 
    352420 
     
    366434                { 
    367435                        if ( !_win ) 
     436                        { 
    368437                                _win = _chat(_from); 
     438                                var _st = top.document.getElementById('contact_' + _from); 
     439                                if ( _st ) 
     440                                { 
     441                                        _st = _st.style.backgroundImage; 
     442                                        _win.icon(_st.substr(4, (_st.length - 5))); 
     443                                } 
     444                        } 
    369445 
    370446                        var _history = _win.wc.firstChild; 
     
    409485                var _img_status_contact = top.document.getElementById('contact_' + _from); 
    410486                var _mensagem_status_contact = top.document.getElementById('status_' + _from); 
     487                var _win_chat = _window.get('chat' + _from); 
     488 
    411489                if ( _mensagem_status_contact ) 
    412490                { 
     
    423501                                        if ( _img_status_contact ) 
    424502                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _presence_type + '.src') + ')'; 
     503                                        if ( _win_chat ) 
     504                                                _win_chat.icon(eval('im_' + _presence_type + '.src')); 
    425505                                break; 
    426506                                case 'subscribe' : 
     
    538618                                                        if ( _img_status_contact ) 
    539619                                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _node.firstChild.nodeValue + '.src') + ')'; 
     620                                                        if ( _win_chat ) 
     621                                                                _win_chat.icon(eval('im_' + _node.firstChild.nodeValue + '.src')); 
    540622                                                break; 
    541623                                                case "status" : 
     
    550632                                                        if ( _img_status_contact ) 
    551633                                                                _img_status_contact.style.backgroundImage = 'url(' + im_available.src + ')'; 
     634                                                        if ( _win_chat ) 
     635                                                                _win_chat.icon(im_available.src); 
    552636                                        } 
    553637                                } 
     
    610694                _window = arguments[2]; 
    611695                _ldap = arguments[3]; 
     696                _menu = arguments[4]; 
    612697        } 
    613698 
    614699        Jabber.prototype.action = _action; 
     700        Jabber.prototype.setPresence = _setPresence; 
    615701        window.Jabber = Jabber; 
    616702} 
Note: See TracChangeset for help on using the changeset viewer.