Changeset 72 for trunk/instant_messenger/js/im_functions.js
- Timestamp:
- 09/24/07 10:22:29 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/js/im_functions.js
r70 r72 1 1 function IM() 2 2 { 3 this._listen = true;4 3 this.vcards = false; 5 4 this.labelVcard = []; … … 31 30 IM.prototype.listen = function() 32 31 { 33 if ( !this._listen )34 return false;35 36 32 var _this = this; 37 var handler = function( data)33 var handler = function(XMLdata) 38 34 { 39 35 try … … 45 41 } 46 42 47 _this.getContacts( data);48 _this.getPresence( data);49 _this.getComposing( data);50 _this.getMessages( data);51 _this.getVcard( data);43 _this.getContacts(XMLdata); 44 _this.getPresence(XMLdata); 45 _this.getComposing(XMLdata); 46 _this.getMessages(XMLdata); 47 _this.getVcard(XMLdata); 52 48 53 49 if(!_this.vcards) … … 56 52 _this.vcards = true; 57 53 } 54 58 55 }catch(e){} 59 56 60 _this._listen = true;61 57 setTimeout('IM.listen()', 3000); 62 58 }; … … 801 797 }; 802 798 803 IM.prototype.setStatus = function(pStatus) 804 { 805 try 806 { 807 var handler = function() 808 { 809 }; 810 im_menu_action.menu('fast_menu_im', null); 811 812 if ( pStatus == 'custom' ) 813 { 814 pStatus = prompt('Personalize seu Status : '); 815 pStatus = 'show=' + statusFlag + '&status=' + pStatus; 816 } 817 else 818 { 819 if ( pStatus == 'unavailable' ) 820 { 821 this.ImgStatus(pStatus); 822 pStatus = 'type=' + pStatus; 823 } 824 else 825 { 826 try 827 { 828 this.ImgStatus(pStatus); 829 pStatus = 'show=' + pStatus; 830 }catch(e){} 831 } 832 } 833 XMLTools.request('$this.Ujabber.setPresence', 'POST', handler, pStatus); 834 } 835 catch(e){} 836 }; 799 IM.prototype.setStatus = function(pStatus) 800 { 801 try 802 { 803 var handler = function() 804 { 805 }; 806 807 if ( func.byId('fast_menu_im').style.display == 'block' ) 808 im_menu_action.menu('fast_menu_im', null); 809 810 if ( pStatus == 'custom' ) 811 { 812 pStatus = prompt('Personalize seu Status : '); 813 pStatus = 'show=' + statusFlag + '&status=' + pStatus; 814 } 815 else 816 { 817 if ( pStatus == 'unavailable' ) 818 { 819 this.ImgStatus(pStatus); 820 pStatus = 'type=' + pStatus; 821 } 822 else 823 { 824 try 825 { 826 this.ImgStatus(pStatus); 827 pStatus = 'show=' + pStatus; 828 } 829 catch(e) 830 {} 831 } 832 } 833 XMLTools.request('$this.Ujabber.setPresence', 'POST', handler, pStatus); 834 } 835 catch(e) 836 {} 837 }; 837 838 838 839 IM.prototype.ImgStatus = function(pStatus) … … 845 846 IM.prototype.setAway = function() 846 847 { 847 if ( statusFlag != 'available' )848 if ( statusFlag != 'available' || this._listen > 0 ) 848 849 return false; 849 850 … … 860 861 }; 861 862 862 IM.prototype.infoContact = function(pUid) 863 { 864 var info = false; 865 var div_allg = document.getElementById('all_groups'); 866 var elements = div_allg.firstChild; 867 while ( elements ) 868 { 869 var childs = elements.firstChild; 870 while( childs ) 871 { 872 if(childs.tagName == "DIV" && childs.id.indexOf(pUid) === 0 ) 873 { 874 info = {'jid':childs.id, 'src':childs.firstChild.src}; 875 break; 876 } 877 childs = childs.nextSibling; 878 } 879 if ( !info ) 880 elements = elements.nextSibling; 881 else 882 break; 883 } 884 return info; 885 }; 863 IM.prototype.infoContact = function(pUid) 864 { 865 try 866 { 867 var info = false; 868 var div_allg = document.getElementById('all_groups'); 869 var elements = div_allg.firstChild; 870 while ( elements ) 871 { 872 var childs = elements.firstChild; 873 while( childs ) 874 { 875 if(childs.tagName == "DIV" && childs.id.indexOf(pUid) === 0 ) 876 { 877 info = {'jid':childs.id, 'src':childs.firstChild.src}; 878 break; 879 } 880 childs = childs.nextSibling; 881 } 882 if ( !info ) 883 elements = elements.nextSibling; 884 else 885 break; 886 } 887 return info; 888 } 889 catch(e) 890 { 891 return false; 892 } 893 }; 886 894 887 895 var IM = new IM();
Note: See TracChangeset
for help on using the changeset viewer.