Ignore:
Timestamp:
06/24/08 17:09:46 (16 years ago)
Author:
niltonneto
Message:
 
Location:
trunk/instant_messenger/js
Files:
4 edited

Legend:

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

    r323 r327  
    149149                        if ( !_disconnected ) 
    150150                        { 
    151                                 _conn.go('$this.Ujabber.getContacts'); 
     151                                _conn.go('t.update'); 
     152 
    152153                                setTimeout(function() 
    153154                                { 
     
    189190 
    190191                var local; 
    191                 if ( (local = top.document.getElementById('user_info')) ) 
    192                 { 
    193                         local.firstChild.style.marginLeft = '30px'; 
     192                if ( (local = top.document.getElementById('divStatusBar')) ) 
     193                { 
     194                        // tentando colocar os icones em local que não seja mexido. 
     195                        // VERIFICAR 
     196                        var _div = top.document.createElement('div'); 
     197                        _div.appendChild(local.parentNode.removeChild(local.previousSibling)); 
     198                        local.parentNode.insertBefore(_div, local); 
     199                        //_div.appendChild(local); 
     200 
     201                        //local = _div; 
     202 
     203                        local.style.paddingLeft = '30px'; 
    194204 
    195205                        var _status = top.document.createElement('div'); 
    196206                                _status.setAttribute('id', 'im_status'); 
    197                                 _status.style.height = '15px'; 
    198                                 _status.style.margin = '0 0 0 10px'; 
    199                                 _status.style.padding = '0px'; 
    200                                 _status.style.width = '15px'; 
    201207                                _status.style.background = 'no-repeat'; 
    202208                                _status.style.backgroundImage = 'url(' + im_unavailable.src + ')'; 
    203209                                _status.style.float = 'left'; 
     210                                _status.style.height = '15px'; 
     211                                _status.style.left = '20px'; 
     212                                _status.style.margin = '0 0 0 10px'; 
     213                                _status.style.padding = '0px'; 
    204214                                _status.style.position = 'absolute'; 
     215                                _status.style.width = '15px'; 
    205216 
    206217                        local.insertBefore(_status, local.firstChild); 
     
    221232                                _menu_img.style.background = 'no-repeat'; 
    222233                                _menu_img.style.backgroundImage = 'url(' + im_fast_menu.src + ')'; 
     234                                _menu_img.style.float = 'left'; 
    223235                                _menu_img.style.height = '10px'; 
     236                                _menu_img.style.left = '23px'; 
    224237                                _menu_img.style.margin = '0px'; 
    225238                                _menu_img.style.padding = '0px'; 
    226239                                _menu_img.style.position = 'absolute'; 
    227240                                _menu_img.style.width = '10px'; 
    228                                 _menu_img.style.float = 'left'; 
    229241                        local.insertBefore(_menu_img, local.firstChild); 
    230242 
     
    288300                } 
    289301 
    290                 function _check_connection() 
    291                 { 
    292                         if ( !_disconnected ) 
    293                                 _conn.go('t.checkConnection'); 
    294                 } 
    295  
    296302                function Client() 
    297303                { 
    298304                        _request(); 
    299305                        setTimeout(_contacts, 3000); 
    300                         window.setInterval(_check_connection, 20000); 
    301306                } 
    302307 
  • trunk/instant_messenger/js/connector.js

    r318 r327  
    7171                                                        catch(_e) 
    7272                                                        { 
    73                                                                 alert("#stream\n\n" + _e + "\n\n" + _e.description); 
     73                                                                //alert("#stream\n\n" + _e + "\n\n" + _e.description); 
    7474                                                        } 
    7575 
     
    103103                                                                        catch(_e) 
    104104                                                                        { 
    105                                                                                 alert("#request\n\n" + _e + "\n\n" + _e.description); 
     105                                                                                //alert("#request\n\n" + _e + "\n\n" + _e.description); 
    106106                                                                        } 
    107107 
  • trunk/instant_messenger/js/jabber.js

    r323 r327  
    185185                        _win = _chat(id); 
    186186                        _win.title(el.getAttribute('idname')); 
    187                         _win.icon(eval('im_' + el.getAttribute('status') + '.src')); 
     187                        if ( el.getAttribute('status') ) 
     188                                _win.icon(eval('im_' + el.getAttribute('status') + '.src')); 
    188189                } 
    189190                else 
     
    225226                if ( _contact_list ) 
    226227                { 
    227                         _conn.go('$this.Ujabber.setPresence', 'type=unavailable'); 
    228                         _setPresence(); 
    229                         _ldap.photo( 
    230                                 'im_avatar', 
    231                                 _win_contact.wc.firstChild 
    232                         ); 
    233                         _conn.go('$this.Ujabber.getVcard','jid=this'); 
     228                        var _presence; 
     229                        if ( !(_presence = _cookies.get('IM_presence')) ) 
     230                                _presence = 'available'; 
     231 
     232                        var _img_status = eval('im_' + _presence + '.src'); 
     233 
     234                        if ( _img_status ) 
     235                        { 
     236                                _win_contact.icon(_img_status); 
     237 
     238                                var _status = top.document.getElementById('im_status'); 
     239                                if ( _status ) 
     240                                        _status.style.backgroundImage = 'url(' + _img_status + ')'; 
     241                        } 
     242 
     243                        _ldap.photo('im_avatar', _win_contact.wc.firstChild); 
     244 
    234245                        function _click(e) 
    235246                        { 
    236247                                var el = ( e.target ) ? e.target : e.srcElement; 
    237                                 //alert(e.button); 
    238248                                if ( (e.button == 0 && !document.all) || (e.button == 1 && document.all) ) 
    239249                                        _openChat(el); 
     
    307317                                } 
    308318                        } 
     319                        function _show_hidden_group(e) 
     320                        { 
     321                                var el = ( e.target ) ? e.target : e.srcElement; 
     322                                var _display = "none"; 
     323                                var _image = im_group_close.src; 
     324 
     325                                if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
     326                                { 
     327                                        _display = "block"; 
     328                                        _image = im_group_open.src; 
     329                                } 
     330 
     331                                el.style.backgroundImage = 'url(' + _image + ')'; 
     332 
     333                                el = el.nextSibling; 
     334                                while ( el.getAttribute('jid') ) 
     335                                { 
     336                                        if ( _display == 'block' ) 
     337                                        { 
     338                                                var _show_all = _cookies.get('IM_unavailable'); 
     339                                                if ( (el.style.backgroundImage.indexOf('unavailable') > -1) && (_show_all == 'hidden') ) 
     340                                                        _display = 'none'; 
     341                                        } 
     342                                        el.style.display = _display; 
     343                                        el = el.nextSibling; 
     344                                        if ( el && el.nextSibling ) 
     345                                                el = el.nextSibling; 
     346                                } 
     347                        } 
    309348                        function _hover(e) 
    310349                        { 
     
    323362                                        _config(_contact, 'onmouseover', _hover); 
    324363                                        _config(_contact, 'onmouseout', _hover); 
    325                                         if ( _contact.getAttribute('jid') ) 
    326                                         { 
    327                                                 if ( _show_all == 'hidden' ) 
    328                                                         _contact.style.display = 'none'; 
    329                                                 //_config(_contact, 'onmousedown', _click); 
     364                                        // it is a group 
     365                                        if ( !(_contact.getAttribute('jid')) ) 
     366                                                _config(_contact, 'onclick', _show_hidden_group); 
     367                                        // it is a contact 
     368                                        else 
     369                                        { 
     370                                                if ( _show_all != 'hidden' ) 
     371                                                        _contact.style.display = 'block'; 
    330372                                                _config(_contact, 'onmouseup', _click); 
    331                                         } 
    332                                         else 
    333                                         { 
    334                                                 _config(_contact, 'onclick', 
    335                                                 function(e) 
    336                                                 { 
    337                                                         var el = ( e.target ) ? e.target : e.srcElement; 
    338                                                         var _display = "none"; 
    339                                                         var _image = im_group_close.src; 
    340  
    341                                                         if ( el.style.backgroundImage.indexOf('group_open') < 0 ) 
    342                                                         { 
    343                                                                 _display = "block"; 
    344                                                                 _image = im_group_open.src; 
    345                                                         } 
    346  
    347                                                         el.style.backgroundImage = 'url(' + _image + ')'; 
    348  
    349                                                         el = el.nextSibling; 
    350                                                         while ( el.getAttribute('jid') ) 
    351                                                         { 
    352                                                                 if ( _display == 'block' ) 
    353                                                                 { 
    354                                                                         var _show_all = _cookies.get('IM_unavailable'); 
    355                                                                         if ( (el.style.backgroundImage.indexOf('unavailable') > -1) && (_show_all == 'hidden') ) 
    356                                                                                 _display = 'none'; 
    357                                                                 } 
    358                                                                 el.style.display = _display; 
    359                                                                 el = el.nextSibling; 
    360                                                                 if ( el && el.nextSibling ) 
    361                                                                         el = el.nextSibling; 
    362                                                         } 
    363                                                 }); 
    364373                                        } 
    365374                                } 
     
    371380        function _setPresence() 
    372381        { 
     382                if ( !(_cookies) ) 
     383                        return false; 
     384 
    373385                var _presence = false; 
    374386                var _pPresence; 
     
    506518        { 
    507519                if ( pIq.firstChild.getAttribute("seconds") != 0 ) 
    508                         _conn.go('$this.Ujabber.getContacts'); 
     520                        _conn.go('t.update'); 
    509521        } 
    510522 
     
    523535                { 
    524536                        _contact_list.style.backgroundImage = 'url(' + im_composing.src + ')'; 
    525                         setTimeout(function(){_contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')';}, 10000); 
     537                        setTimeout(function() 
     538                        { 
     539                                _contact_list.style.backgroundImage = 'url(' + eval('im_' + _contact_list.getAttribute('status') + '.src') + ')'; 
     540                        }, 10000); 
    526541                } 
    527542 
     
    593608                var _win_chat = _window.get('chat' + _from); 
    594609 
    595                 _img_status_contact.setAttribute('status', _presence_type); 
    596  
    597610                if ( _mensagem_status_contact ) 
    598611                { 
     
    607620                                case 'available' : 
    608621                                case 'unavailable' : 
     622                                        _img_status_contact.setAttribute('status', _presence_type); 
     623 
    609624                                        if ( _img_status_contact ) 
    610625                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _presence_type + '.src') + ')'; 
     
    733748                                        { 
    734749                                                case "show" : 
     750                                                        var _show = _node.firstChild.nodeValue; 
     751                                                        _img_status_contact.setAttribute('status', _show); 
    735752                                                        if ( _img_status_contact ) 
    736                                                                 _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _node.firstChild.nodeValue + '.src') + ')'; 
     753                                                                _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _show + '.src') + ')'; 
    737754                                                        if ( _win_chat ) 
    738                                                                 _win_chat.icon(eval('im_' + _node.firstChild.nodeValue + '.src')); 
     755                                                                _win_chat.icon(eval('im_' + _show + '.src')); 
    739756                                                break; 
    740757                                                case "status" : 
     
    747764                                                break; 
    748765                                                default : 
     766                                                        _img_status_contact.setAttribute('status', 'available'); 
    749767                                                        if ( _img_status_contact ) 
    750768                                                                _img_status_contact.style.backgroundImage = 'url(' + im_available.src + ')'; 
  • trunk/instant_messenger/js/preferences.js

    r323 r327  
    142142 
    143143                // New Message 
     144                /* 
    144145                if(top.document.getElementById('rd_nm').checked) 
    145146                { 
     
    157158                else 
    158159                        preferences += 'rd_ch:false;'; 
     160                */ 
    159161 
    160162                // Write Cookie 
     
    196198        } 
    197199 
     200        function _show_hidden_group() 
     201        { 
     202                if ( !(arguments[0]) ) 
     203                        return false; 
     204 
     205                var show = 'block'; 
     206                if ( !(arguments[0].checked) ) 
     207                        show = 'none'; 
     208 
     209                var el = top.document.getElementById('im_contact_list'); 
     210                if ( el && (el = el.firstChild) ) 
     211                        while ( el ) 
     212                        { 
     213                                // it is a contact 
     214                                if ( (el.nodeName.toLowerCase() == 'div') && el.getAttribute('jid') ) 
     215                                        if ( el.style.backgroundImage.indexOf('unavailable') > -1 ) 
     216                                                el.style.display = show; 
     217                                el = el.nextSibling; 
     218                        } 
     219        } 
     220 
    198221        function Preferences() 
    199222        { 
     
    206229        Preferences.prototype.load                       = _load_window; 
    207230        Preferences.prototype.getfocus           = focus_select; 
     231 
     232        Preferences.prototype.showHiddenGroup = _show_hidden_group; 
     233 
    208234        top.window.im_preferences                        = new Preferences; 
    209235        _config(top.window.document, 'onmousemove', _timeOut); 
Note: See TracChangeset for help on using the changeset viewer.