Changeset 323 for trunk/instant_messenger
- Timestamp:
- 06/20/08 15:16:25 (16 years ago)
- Location:
- trunk/instant_messenger
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/inc/Jabberd2.abstract.php
r311 r323 171 171 } 172 172 173 final function get_last_access_user($pUser )173 final function get_last_access_user($pUser = array("jid" => "this")) 174 174 { 175 175 $id = "last_time_user"; -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r318 r323 59 59 return "disconnected"; 60 60 61 $this->get_last_access_user(array("jid" => "this"));62 63 61 if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) 64 62 { … … 76 74 $buffer = ''; 77 75 78 while ( ( connection_aborted() === 0 ) && time() - $init < 30 )76 while ( ( connection_aborted() === 0 ) && time() - $init < 50 ) 79 77 { 80 78 # read from server and write in the client … … 106 104 } 107 105 106 public final function checkConnection() 107 { 108 $this->get_last_access_user(); 109 return $this->isConnected(); 110 } 111 108 112 public final function Composing($pJid) 109 113 { -
trunk/instant_messenger/inc/controller.xml
r318 r323 58 58 <item ref="composing" class="Ujabber" method="composing" prefix="class." suffix=".inc.php" /> 59 59 <item ref="paused" class="Ujabber" method="paused" prefix="class." suffix=".inc.php" /> 60 <item ref="checkConnection" class="Ujabber" method="checkConnection" prefix="class." suffix=".inc.php" /> 60 61 </php> 61 62 <xml></xml> -
trunk/instant_messenger/js/client.js
r321 r323 149 149 if ( !_disconnected ) 150 150 { 151 _conn.go('$this.Ujabber.getContacts', 152 function(data) 153 { 154 if ( data == 'disconnected' ) 155 setTimeout(_contacts, 3000); 156 } 157 ); 151 _conn.go('$this.Ujabber.getContacts'); 158 152 setTimeout(function() 159 153 { … … 294 288 } 295 289 290 function _check_connection() 291 { 292 if ( !_disconnected ) 293 _conn.go('t.checkConnection'); 294 } 295 296 296 function Client() 297 297 { 298 298 _request(); 299 299 setTimeout(_contacts, 3000); 300 window.setInterval(_check_connection, 20000); 300 301 } 301 302 -
trunk/instant_messenger/js/jabber.js
r321 r323 381 381 _pPresence = arguments[0]; 382 382 383 _cookies.set('IM_presence', _pPresence); 383 if ( _pPresence == 'auto' ) 384 { 385 if ( _cookies.get('IM_presence') == 'available' ) 386 _pPresence = 'xa'; 387 } 388 else 389 _cookies.set('IM_presence', _pPresence); 384 390 385 391 switch ( _pPresence ) … … 812 818 Jabber.prototype.setPresence = _setPresence; 813 819 window.Jabber = Jabber; 820 window.InstantMessengerPresence = _setPresence; 814 821 } 815 822 )(); -
trunk/instant_messenger/js/preferences.js
r318 r323 7 7 var _window = new Windows(_xtools, _im_content); 8 8 var _cookies = new IMCookies; 9 var idTimeout = "";10 9 var Timeout = ""; 11 10 … … 37 36 _win_preferences.bx.style.display = 'none'; 38 37 _win_preferences.wc.style.padding = '5px'; 39 38 40 39 var _params = { 41 40 'lang1':imGetLang('Options'), … … 76 75 var preferences = arguments[0].split(';'); 77 76 preferences.pop(); 78 77 79 78 for(var i in preferences) 80 79 { … … 94 93 else 95 94 { 96 Timeout = ( parseInt(value) > 0 ) ? value : "1"; 95 Timeout = ( parseInt(value) > 0 ) ? value : "1"; 97 96 if( top.document.getElementById(field) ) 98 97 top.document.getElementById(field).value = Timeout; … … 104 103 { 105 104 var preferences = ""; 106 105 107 106 if((preferences = _cookies.get('preferences_im'))) 108 107 _preferences(preferences); … … 114 113 { 115 114 _win_preferences = _window.get('preferences_window'); 116 115 117 116 var preferences = ""; 118 117 var numbers = /^\d+$/; 119 118 120 119 // Offline 121 120 if (top.document.getElementById('ch_offline').checked) … … 129 128 _cookies.set('IM_unavailable', 'hidden'); 130 129 } 131 130 132 131 // TimeOut 133 132 if(numbers.test(top.document.getElementById('time_xa_im').value) && top.document.getElementById('time_xa_im').value != "0") … … 141 140 Timeout = 1; 142 141 } 143 142 144 143 // New Message 145 144 if(top.document.getElementById('rd_nm').checked) … … 150 149 else 151 150 preferences += 'rd_nm:false;'; 152 151 153 152 if(top.document.getElementById('rd_ch').checked) 154 153 { … … 175 174 } 176 175 177 function _setPresence() 178 { 179 var _presence = false; 180 var _pPresence; 181 if ( arguments.length == 0 ) 182 { 183 if ( !(_pPresence = _cookies.get('IM_presence')) ) 184 _pPresence = 'available'; 185 } 186 else 187 _pPresence = arguments[0]; 188 189 _cookies.set('IM_presence', _pPresence); 190 191 switch ( _pPresence ) 192 { 193 case 'away': 194 case 'dnd': 195 case 'xa': 196 _presence = 'show=' + _pPresence; 197 break; 198 case 'available': 199 case 'unavailable': 200 _presence = 'type=' + _pPresence; 201 break; 202 } 203 204 if ( _presence ) 205 { 206 var _img_status = eval('im_' + _pPresence + '.src'); 207 208 var _status = top.document.getElementById('im_status'); 209 if ( _status ) 210 _status.style.backgroundImage = 'url(' + _img_status + ')'; 211 212 var _win_contacts = _window.get('contact_list'); 213 if ( _win_contacts ) 214 _win_contacts.icon(_img_status); 215 216 _conn.go('$this.Ujabber.setPresence', _presence); 217 } 218 } 219 176 var _changed = false; 177 var _id_timeout = ""; 220 178 function _setTimeOut() 221 179 { 222 _ setPresence('xa');223 idTimeout = setTimeout('top.window.im_preferences.timeOut();', parseInt(Timeout) * 60000);180 _changed = true; 181 InstantMessengerPresence('auto'); 224 182 } 225 183 226 184 function _timeOut() 227 185 { 228 if (idTimeout)229 {230 clearTimeout(idTimeout); 231 var _status = '';232 233 if((_status = _cookies.get('IM_presence')) === 'xa')234 _setPresence('available');235 } 236 237 idTimeout = setTimeout('top.window.im_preferences._setTimeOut("xa");', parseInt(Timeout) * 60000);186 if ( _id_timeout ) 187 clearTimeout(_id_timeout); 188 189 if ( _changed ) 190 { 191 _changed = false; 192 InstantMessengerPresence(); 193 } 194 195 _id_timeout = setTimeout(_setTimeOut, parseInt(Timeout) * 60000); 238 196 } 239 197 … … 243 201 _timeOut(); 244 202 } 245 203 246 204 Preferences.prototype._setTimeOut = _setTimeOut; 247 205 Preferences.prototype.timeOut = _timeOut; … … 249 207 Preferences.prototype.getfocus = focus_select; 250 208 top.window.im_preferences = new Preferences; 251 top.window.document.onmousemove = _timeOut;209 _config(top.window.document, 'onmousemove', _timeOut); 252 210 253 211 })();
Note: See TracChangeset
for help on using the changeset viewer.