Changeset 6a415e9 for global.c


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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.