Changeset 311 for trunk/instant_messenger/js/jabber.js
- Timestamp:
- 06/10/08 16:41:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/js/jabber.js
r305 r311 5 5 var _window; 6 6 var _ldap; 7 8 var _menu = new ShowHidden(1500); 7 var _menu; 9 8 10 9 var _vcards = []; … … 138 137 var _win = _window.get('chat' + id); 139 138 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 } 141 144 else 142 145 { … … 155 158 _win_contact.bc.style.display = 'none'; 156 159 _win_contact.wm.style.display = 'none'; 160 _win_contact.icon(im_available.src); 157 161 158 162 var _params = { … … 172 176 if ( _contact_list ) 173 177 { 174 _conn.go('$this.Ujabber.setStatus'); 178 _setPresence('unavailable'); 179 _setPresence(); 175 180 _ldap.photo( 176 181 'im_avatar', … … 222 227 var _sub_menu = top.document.getElementById('sub_' + el.getAttribute('jid')); 223 228 _sub_menu.innerHTML = _xtools.parse(_xml, 'options.xsl'); 224 _menu.action('onmouseover', 'onmouseout', _sub_menu); 229 230 _menu.action('onmouseover', 'onmouseout', _sub_menu); 225 231 226 232 _sub_menu = _sub_menu.firstChild; … … 260 266 while ( _contact ) 261 267 { 268 _config(_contact, 'onmouseover', _hover); 269 _config(_contact, 'onmouseout', _hover); 262 270 if ( _contact.getAttribute('jid') ) 263 271 { 264 272 //_config(_contact, 'onmousedown', _click); 265 273 _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 }); 268 297 } 269 298 _contact = _contact.nextSibling; … … 272 301 } 273 302 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 274 333 function _vcard(_pJid) 275 334 { … … 285 344 286 345 _win_vcard = _window.load('vcard_' + _pJid); 287 _win_vcard.title('.:: Informa ções do Contato ::.');346 _win_vcard.title('.:: Informações do Contato ::.'); 288 347 _win_vcard.size(300); 289 348 _win_vcard.position(_win_pos, _win_pos); … … 347 406 _readVCard(pIq); 348 407 break; 408 case 'last_time_user' : 409 _readLastTimeUser(pIq); 410 break; 349 411 default : //alert('readIq : ' + pIq.getAttribute('id')); 350 412 } 413 } 414 415 function _readLastTimeUser(pIq) 416 { 417 if ( pIq.firstChild.getAttribute("seconds") != 0 ) 418 _setPresence(); 351 419 } 352 420 … … 366 434 { 367 435 if ( !_win ) 436 { 368 437 _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 } 369 445 370 446 var _history = _win.wc.firstChild; … … 409 485 var _img_status_contact = top.document.getElementById('contact_' + _from); 410 486 var _mensagem_status_contact = top.document.getElementById('status_' + _from); 487 var _win_chat = _window.get('chat' + _from); 488 411 489 if ( _mensagem_status_contact ) 412 490 { … … 423 501 if ( _img_status_contact ) 424 502 _img_status_contact.style.backgroundImage = 'url(' + eval('im_' + _presence_type + '.src') + ')'; 503 if ( _win_chat ) 504 _win_chat.icon(eval('im_' + _presence_type + '.src')); 425 505 break; 426 506 case 'subscribe' : … … 538 618 if ( _img_status_contact ) 539 619 _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')); 540 622 break; 541 623 case "status" : … … 550 632 if ( _img_status_contact ) 551 633 _img_status_contact.style.backgroundImage = 'url(' + im_available.src + ')'; 634 if ( _win_chat ) 635 _win_chat.icon(im_available.src); 552 636 } 553 637 } … … 610 694 _window = arguments[2]; 611 695 _ldap = arguments[3]; 696 _menu = arguments[4]; 612 697 } 613 698 614 699 Jabber.prototype.action = _action; 700 Jabber.prototype.setPresence = _setPresence; 615 701 window.Jabber = Jabber; 616 702 }
Note: See TracChangeset
for help on using the changeset viewer.