Changeset b7bb454 for aim.c


Ignore:
Timestamp:
Dec 6, 2008, 5:39:49 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
7ce4003
Parents:
3ea31b6
git-author:
Nelson Elhage <nelhage@mit.edu> (12/06/08 17:36:19)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/06/08 17:39:49)
Message:
Make owl_timer have a callback and integrate into the select() loop.

Soon we should add support for registering timers from perl, and then
we can eventually remove the perl mainloop hook.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • aim.c

    r554a2b8 rb7bb454  
    130130}
    131131
     132void owl_aim_send_nop(owl_timer *t, void *data) {
     133    if(owl_global_is_doaimevents(&g)) {
     134        aim_session_t *sess = owl_global_get_aimsess(&g);
     135        aim_flap_nop(sess, aim_getconn_type(sess, AIM_CONN_TYPE_BOS));
     136    }
     137}
     138
    132139
    133140int owl_aim_login(char *screenname, char *password)
     
    194201  owl_function_debugmsg("owl_aim_login: connecting");
    195202
     203  g.aim_nop_timer = owl_select_add_timer(30, 30, owl_aim_send_nop, NULL);
     204
    196205  return(0);
     206}
     207
     208void owl_aim_unset_ignorelogin(owl_timer *t, void *data) {      /* noproto */
     209    owl_global_unset_ignore_aimlogin(&g);
    197210}
    198211
     
    212225
    213226  /* start the ingorelogin timer */
    214   owl_timer_reset_newstart(owl_global_get_aim_login_timer(&g),
    215                            owl_global_get_aim_ignorelogin_timer(&g));
    216 
    217  
     227  owl_global_set_ignore_aimlogin(&g);
     228  owl_select_add_timer(owl_global_get_aim_ignorelogin_timer(&g),
     229                       0, owl_aim_unset_ignorelogin, NULL);
     230
    218231  /* aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400); */
    219232  /* aim_bos_setidle(owl_global_get_aimsess(&g), owl_global_get_bosconn(&g), 5000); */
     
    228241  owl_global_set_aimnologgedin(&g);
    229242  owl_global_set_no_doaimevents(&g);
     243  owl_select_remove_timer(g.aim_nop_timer);
    230244}
    231245
     
    246260  owl_global_set_aimnologgedin(&g);
    247261  owl_global_set_no_doaimevents(&g);
     262  owl_select_remove_timer(g.aim_nop_timer);
    248263}
    249264
     
    422437  tv.tv_usec = 0;
    423438  waitingconn = aim_select(aimsess, &tv, &selstat);
    424 
    425   if (owl_global_is_aimnop_time(&g)) {
    426     aim_flap_nop(aimsess, aim_getconn_type(aimsess, AIM_CONN_TYPE_BOS));
    427     owl_global_aimnop_sent(&g);
    428   }
    429439
    430440  if (selstat == -1) {
     
    23152325  if (owl_global_is_doaimevents(&g)) {
    23162326    owl_aim_process_events();
    2317 
    2318     if (owl_global_is_aimloggedin(&g)) {
    2319       if (owl_timer_is_expired(owl_global_get_aim_buddyinfo_timer(&g))) {
    2320         /* owl_buddylist_request_idletimes(owl_global_get_buddylist(&g)); */
    2321         owl_timer_reset(owl_global_get_aim_buddyinfo_timer(&g));
    2322       }
    2323     }
    23242327  }
    23252328}
Note: See TracChangeset for help on using the changeset viewer.