Changeset d09e5a1 for owl.c


Ignore:
Timestamp:
May 31, 2003, 3:33:42 PM (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:
5e53c4a
Parents:
c86a35c
Message:
Added libfaim
Added basic AIM support, including the "aimlogin", "aimwrite" and
   "aimlogout" commands
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rac70242 rd09e5a1  
    3131  owl_popwin *pw;
    3232  int j, ret, initialsubs, debug, argcsave, followlast;
    33   int newzephyrs, zpendcount, nexttimediff;
     33  int newmsgs, zpendcount, nexttimediff;
    3434  struct sigaction sigact;
    3535  char *configfile, *tty, *perlout, **argvsave, buff[LINE], startupmsg[LINE];
     
    214214    owl_function_zlog_in();
    215215  }
     216
     217  /* AIM init */
     218  owl_aim_init();
    216219
    217220  /* welcome message */
     
    264267
    265268    /* grab incoming zephyrs */
    266     newzephyrs=0;
     269    newmsgs=0;
    267270    zpendcount=0;
    268     while(ZPending()) {
     271    while(ZPending() || owl_global_messagequeue_pending(&g)) {
    269272      ZNotice_t notice;
    270273      struct sockaddr_in from;
     
    272275      owl_filter *f;
    273276
    274       /* grab a notice, but if we've done 20 without stopping, take
    275          a break to process keystrokes etc. */
    276       if (zpendcount>20) break;
    277       ZReceiveNotice(&notice, &from);
    278       zpendcount++;
    279 
    280       /* is this an ack from a zephyr we sent? */
    281       if (owl_zephyr_notice_is_ack(&notice)) {
    282         owl_zephyr_handle_ack(&notice);
    283         continue;
    284       }
    285      
    286       /* if it's a ping and we're not viewing pings then skip it */
    287       if (!owl_global_is_rxping(&g) && !strcasecmp(notice.z_opcode, "ping")) {
    288         continue;
    289       }
    290 
    291       /* create the new message */
    292       m=owl_malloc(sizeof(owl_message));
    293       owl_message_create_from_znotice(m, &notice);
     277      if (ZPending()) {
     278        /* grab a zephyr notice, but if we've done 20 without stopping,
     279           take a break to process keystrokes etc. */
     280        if (zpendcount>20) break;
     281        ZReceiveNotice(&notice, &from);
     282        zpendcount++;
     283       
     284        /* is this an ack from a zephyr we sent? */
     285        if (owl_zephyr_notice_is_ack(&notice)) {
     286          owl_zephyr_handle_ack(&notice);
     287          continue;
     288        }
     289       
     290        /* if it's a ping and we're not viewing pings then skip it */
     291        if (!owl_global_is_rxping(&g) && !strcasecmp(notice.z_opcode, "ping")) {
     292          continue;
     293        }
     294
     295        /* create the new message */
     296        m=owl_malloc(sizeof(owl_message));
     297        owl_message_create_from_znotice(m, &notice);
     298      } else if (owl_global_messagequeue_pending(&g)) {
     299        m=owl_global_messageuque_popmsg(&g);
     300      }
    294301     
    295302      /* if it's on the puntlist then, nuke it and continue */
     
    301308      /* otherwise add it to the global list */
    302309      owl_messagelist_append_element(owl_global_get_msglist(&g), m);
    303       newzephyrs=1;
     310      newmsgs=1;
    304311
    305312      /* let the config know the new message has been received */
     
    324331        owl_function_command(owl_global_get_alert_action(&g));
    325332      }
    326 
    327          
    328333
    329334      /* check for burning ears message */
     
    338343      }
    339344
    340       /* log the zephyr if we need to */
     345      /* log the message if we need to */
    341346      if (owl_global_is_logging(&g) || owl_global_is_classlogging(&g)) {
    342347        owl_log_incoming(m);
     
    344349    }
    345350
     351    /* If we're logged into AIM, do AIM stuff */
     352    if (owl_global_is_aimloggedin(&g)) {
     353      owl_function_debugmsg("Doing aim processing");
     354      owl_aim_process_events();
     355    }
     356
    346357    /* follow the last message if we're supposed to */
    347     if (newzephyrs && followlast) {
     358    if (newmsgs && followlast) {
    348359      owl_function_lastmsg_noredisplay();
    349360    }
    350361
    351362    /* do the newmsgproc thing */
    352     if (newzephyrs) {
     363    if (newmsgs) {
    353364      owl_function_do_newmsgproc();
    354365    }
    355366   
    356367    /* redisplay if necessary */
    357     /* maybe this should be optimized to not even run if
    358        the zephyr won't be displayed */
    359     if (newzephyrs) {
     368    /* this should be optimized to not run if the new messages won't be displayed */
     369    if (newmsgs) {
    360370      owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    361371      sepbar(NULL);
     
    394404    }
    395405
    396     /* handle all keypresses */
     406    /* Handle all keypresses.
     407     * If no key has been pressed sleep for a little bit, but
     408     * otherwise do not, this lets input be grabbed as quickly
     409     * as possbile */
    397410    j=wgetch(typwin);
    398411    if (j==ERR) {
     
    426439    }
    427440  }
    428 
    429441}
    430442
Note: See TracChangeset for help on using the changeset viewer.