mcabber/src/jabglue.c
changeset 940 fc30221b952d
parent 939 12fa2ae6445d
child 956 819396bebdf5
equal deleted inserted replaced
939:12fa2ae6445d 940:fc30221b952d
   189   FD_SET(jc->fd, &fds);
   189   FD_SET(jc->fd, &fds);
   190 
   190 
   191   tv.tv_sec = 60;
   191   tv.tv_sec = 60;
   192   tv.tv_usec = 0;
   192   tv.tv_usec = 0;
   193 
   193 
       
   194   time(&now);
       
   195 
   194   if (KeepaliveDelay) {
   196   if (KeepaliveDelay) {
   195     time(&now);
   197     if (now >= LastPingTime + (time_t)KeepaliveDelay) {
   196     if (now > LastPingTime + (time_t)KeepaliveDelay) {
       
   197       tv.tv_sec = 0;
   198       tv.tv_sec = 0;
   198     } else {
   199     } else {
   199       tv.tv_sec = LastPingTime + (time_t)KeepaliveDelay - now;
   200       tv.tv_sec = LastPingTime + (time_t)KeepaliveDelay - now;
   200     }
   201     }
   201   }
   202   }
   202 
   203 
   203   autoaway_timeout = scr_GetAutoAwayTimeout();
   204   autoaway_timeout = scr_GetAutoAwayTimeout(now);
   204   if (tv.tv_sec > autoaway_timeout)
   205   if (tv.tv_sec > autoaway_timeout) {
   205     tv.tv_sec = autoaway_timeout;
   206     tv.tv_sec = autoaway_timeout;
   206 
   207   }
       
   208 
       
   209   if (!tv.tv_sec)
       
   210     tv.tv_usec = 350000;
       
   211 
       
   212   scr_DoUpdate();
   207   if (select(jc->fd + 1, &fds, NULL, NULL, &tv) > 0) {
   213   if (select(jc->fd + 1, &fds, NULL, NULL, &tv) > 0) {
   208     if (FD_ISSET(jc->fd, &fds))
   214     if (FD_ISSET(jc->fd, &fds))
   209       jab_poll(jc, 0);
   215       jab_poll(jc, 0);
   210   }
   216   }
   211 
   217