Changeset 6a415e9


Ignore:
Timestamp:
Jun 4, 2003, 10:55:13 AM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
65ad073
Parents:
2824f79
Message:
Added the variable 'aim_ingorelogin_timer', which specifies the number
  of seconds after an AIM login for which AIM login notifications should
  be ignored.  Defaults to 0 for now.
Added the timer object to implement the above and to replace other timers
  that have been impelmented by hand.
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    raa5f725 r6a415e9  
    2323     regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
    2424     keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \
    25      aim.c buddylist.c
     25     aim.c buddylist.c timer.c
    2626OWL_SRC = owl.c
    2727TESTER_SRC = tester.c
  • aim.c

    rfd93b41 r6a415e9  
    14091409  va_end(ap);
    14101410
     1411  /* first check that we're not still ignoreing login messages */
     1412  if (!owl_timer_is_expired(owl_global_get_aim_login_timer(&g))) return;
     1413 
    14111414  owl_buddylist_oncoming(owl_global_get_buddylist(&g), userinfo->sn);
    14121415 
  • commands.c

    r38cf544c r6a415e9  
    19311931  if (!ret) {
    19321932    owl_function_makemsg("%s logged in.\n", argv[1]);
     1933
     1934    /* start the ingorelogin timer */
     1935    owl_timer_reset_newstart(owl_global_get_aim_login_timer(&g),
     1936                             owl_global_get_aim_ignorelogin_timer(&g));
     1937   
    19331938    return(NULL);
    19341939  }
  • global.c

    raa5f725 r6a415e9  
    9191  g->aim_screenname=NULL;
    9292  g->aim_loggedin=0;
    93   g->aim_lastnop=0;
    94 
     93  owl_timer_create_countdown(&(g->aim_noop_timer), 30);
     94  owl_timer_create_countdown(&(g->aim_ignorelogin_timer), 0);
    9595  owl_buddylist_init(&(g->buddylist));
    9696}
     
    647647/* AIM stuff */
    648648
    649 int owl_global_is_aimloggedin(owl_global *g) {
     649int owl_global_is_aimloggedin(owl_global *g)
     650{
    650651  if (g->aim_loggedin) return(1);
    651652  return(0);
    652653}
    653654
    654 char *owl_global_get_aim_screenname(owl_global *g) {
     655char *owl_global_get_aim_screenname(owl_global *g)
     656{
    655657  return (g->aim_screenname);
    656658}
    657659
    658 void owl_global_set_aimloggedin(owl_global *g, char *screenname) {
     660void owl_global_set_aimloggedin(owl_global *g, char *screenname)
     661{
    659662  g->aim_loggedin=1;
    660663  if (g->aim_screenname) owl_free(g->aim_screenname);
     
    662665}
    663666
    664 void owl_global_set_aimnologgedin(owl_global *g) {
     667void owl_global_set_aimnologgedin(owl_global *g)
     668{
    665669  g->aim_loggedin=0;
    666670}
    667671
    668 aim_session_t *owl_global_get_aimsess(owl_global *g) {
     672aim_session_t *owl_global_get_aimsess(owl_global *g)
     673{
    669674  return(&(g->aimsess));
    670675}
    671676
    672 aim_conn_t *owl_global_get_waitingconn(owl_global *g) {
     677aim_conn_t *owl_global_get_waitingconn(owl_global *g)
     678{
    673679  return(&(g->waitingconn));
    674680}
    675681
    676 int owl_global_is_aimnop_time(owl_global *g) {
    677   time_t now;
    678 
    679   now=time(NULL);
    680   if (g->aim_lastnop==0) {
    681     g->aim_lastnop=now;
    682     return(0);
    683   }
    684 
    685   if (now-g->aim_lastnop >= 30) {
    686     return(1);
    687   }
    688   return(0);
    689 }
    690 
    691 void owl_global_aimnop_sent(owl_global *g) {
    692   time_t now;
    693 
    694   now=time(NULL);
    695   g->aim_lastnop=now;
     682int owl_global_is_aimnop_time(owl_global *g)
     683{
     684  if (owl_timer_is_expired(&(g->aim_noop_timer))) return(1);
     685  return(0);
     686}
     687
     688void owl_global_aimnop_sent(owl_global *g)
     689{
     690  owl_timer_reset(&(g->aim_noop_timer));
     691}
     692
     693owl_timer *owl_global_get_aim_login_timer(owl_global *g)
     694{
     695  return(&(g->aim_ignorelogin_timer));
    696696}
    697697
    698698/* message queue */
    699699
    700 void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m) {
     700void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
     701{
    701702  owl_list_append_element(&(g->messagequeue), m);
    702703}
     
    706707 * necessary.
    707708 */
    708 owl_message *owl_global_messageuque_popmsg(owl_global *g) {
     709owl_message *owl_global_messageuque_popmsg(owl_global *g)
     710{
    709711  owl_message *out;
    710712
     
    715717}
    716718
    717 int owl_global_messagequeue_pending(owl_global *g) {
     719int owl_global_messagequeue_pending(owl_global *g)
     720{
    718721  if (owl_list_get_size(&(g->messagequeue))==0) return(0);
    719722  return(1);
    720723}
    721724
    722 owl_buddylist *owl_global_get_buddylist(owl_global *g) {
     725owl_buddylist *owl_global_get_buddylist(owl_global *g)
     726{
    723727  return(&(g->buddylist));
    724728}
  • owl.h

    r38cf544c r6a415e9  
    358358} owl_buddylist;
    359359
     360typedef struct _owl_timer {
     361  int direction;
     362  time_t starttime;
     363  int start;
     364} owl_timer;
    360365
    361366typedef struct _owl_global {
     
    408413  aim_session_t aimsess;
    409414  aim_conn_t waitingconn;
    410   time_t aim_lastnop;
     415  owl_timer aim_noop_timer;
     416  owl_timer aim_ignorelogin_timer;
    411417  int aim_loggedin;
    412418  char *aim_screenname;
  • owl_prototypes.h

    r38cf544c r6a415e9  
    495495extern int owl_global_is_aimnop_time(owl_global *g);
    496496extern void owl_global_aimnop_sent(owl_global *g);
     497extern owl_timer *owl_global_get_aim_login_timer(owl_global *g);
    497498extern void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m);
    498499extern owl_message *owl_global_messageuque_popmsg(owl_global *g);
     
    715716extern int owl_text_num_lines(char *in);
    716717extern char *owl_text_htmlstrip(char *in);
     718
     719/* -------------------------------- timer.c -------------------------------- */
     720extern void owl_timer_create_countup(owl_timer *t);
     721extern void owl_timer_create_countdown(owl_timer *t, int start);
     722extern void owl_timer_reset(owl_timer *t);
     723extern void owl_timer_reset_newstart(owl_timer *t, int start);
     724extern int owl_timer_get_time(owl_timer *t);
     725extern int owl_timer_is_expired(owl_timer *t);
    717726
    718727/* -------------------------------- util.c -------------------------------- */
     
    883892extern void owl_global_set_edit_maxwrapcols(owl_global *g, int n);
    884893extern int owl_global_get_edit_maxwrapcols(owl_global *g);
     894extern void owl_global_set_aim_ignorelogin_timer(owl_global *g, int n);
     895extern int owl_global_get_aim_ignorelogin_timer(owl_global *g);
    885896extern void owl_global_set_typwin_lines(owl_global *g, int n);
    886897extern int owl_global_get_typwin_lines(owl_global *g);
  • variable.c

    recd5dc5 r6a415e9  
    219219                 "than 60 columns, as a courtesy to recipients.\n"),
    220220
     221  OWLVAR_INT( "aim_ignorelogin_timer" /* %OwlVarStub */, 0,
     222              "number of seconds after AIM login to ignore login messages",
     223              "This specifies the number of seconds to wait after an\n"
     224              "AIM login before allowing the recipt of AIM login notifications.\n"
     225              "By default this is set to 0 and all login notifications are\n"
     226              "viewed immediately.  If you dislike this behavior try setting\n"
     227              "the value to 20 instead.\n"),
     228
     229             
    221230  OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */,
    222231                   OWL_TYPWIN_SIZE,
Note: See TracChangeset for help on using the changeset viewer.