Changeset a0a5179


Ignore:
Timestamp:
Nov 19, 2003, 11:19:03 PM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f1645da
Parents:
52f3507
Message:
blist works for AIM even if the zephyr .anyone can't be read
AIM Buddy debugging
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rcb78880 ra0a5179  
    11$Id$
    22
     32.0.13
     4        Changed startup message for new mailing list
     5       
    362.0.12
    47        Command history now doesn't allow the last entry
  • aim.c

    r1db061d ra0a5179  
    116116
    117117  /* an experiment to expose idle time */
    118   aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400);
     118  /* aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400); */
    119119}
    120120
     
    136136  aim_tx_setenqueue(owl_global_get_aimsess(&g), AIM_TX_IMMEDIATE, NULL);
    137137 
    138   /* login */
     138  /* request a login */
    139139  ret=login(owl_global_get_aimsess(&g), priv->screenname, priv->password);
    140140  if (ret) {
     
    143143    return(-1);
    144144  }
     145
     146  /* start processing AIM events */
    145147  owl_global_set_doaimevents(&g);
    146148
    147149  return(0);
    148150}
    149 
    150 #if 0
    151 static void oscar_login(GaimAccount *account)
    152 {
    153   aim_session_t *sess;
    154   aim_conn_t *conn;
    155   char buf[256];
    156   GaimConnection *gc = gaim_account_get_connection(account);
    157   struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1);
    158 
    159   gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc);
    160 
    161   if (isdigit(*(gaim_account_get_username(account)))) {
    162     od->icq = TRUE;
    163   } else {
    164     gc->flags |= GAIM_CONNECTION_HTML;
    165     gc->flags |= GAIM_CONNECTION_AUTO_RESP;
    166   }
    167   od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo);
    168 
    169   sess = g_new0(aim_session_t, 1);
    170 
    171   aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0);
    172   aim_setdebuggingcb(sess, oscar_debug);
    173 
    174   /* we need an immediate queue because we don't use a while-loop to
    175    * see if things need to be sent. */
    176   aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL);
    177   od->sess = sess;
    178   sess->aux_data = gc;
    179 
    180   conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
    181   if (conn == NULL) {
    182     gaim_debug(GAIM_DEBUG_ERROR, "oscar",
    183                "internal connection error\n");
    184     gaim_connection_error(gc, _("Unable to login to AIM"));
    185     return;
    186   }
    187 
    188   g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account));
    189   gaim_connection_update_progress(gc, buf, 2, 5);
    190 
    191   aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0);
    192   aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0);
    193   aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0);
    194 
    195   conn->status |= AIM_CONN_STATUS_INPROGRESS;
    196   if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER),
    197                          gaim_account_get_int(account, "port", FAIM_LOGIN_PORT),
    198                          oscar_login_connect, gc) < 0) {
    199     gaim_connection_error(gc, _("Couldn't connect to host"));
    200     return;
    201   }
    202   aim_request_login(sess, conn, gaim_account_get_username(account));
    203 }
    204 #endif
    205 
    206151
    207152/* stuff to run once login has been successful */
     
    269214void owl_aim_addbuddy(char *name)
    270215{
     216
    271217  aim_ssi_addbuddy(owl_global_get_aimsess(&g), name, "Buddies", NULL, NULL, NULL, 0);
     218
     219  /*
     220  aim_ssi_addbuddy(owl_global_get_aimsess(&g),
     221                   name,
     222                   "Buddies",
     223                   NULL, NULL, NULL,
     224                   aim_ssi_waitingforauth(owl_global_get_aimsess(&g)->ssi.local, "Buddies", name));
     225  */
    272226}
    273227
     
    566520  aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */
    567521
    568   /* aim_bos_setprofile(owl_global_get_aimsess(&g), fr->conn, NULL, NULL, 0, NULL, NULL, 0, AIM_CAPS_CHAT); */
     522  /* aim_bos_setprofile(owl_global_get_aimsess(&g), fr->conn, NULL, NULL, 0, NULL, NULL, 0, AIM_CAPS_EMPTY); */
    569523
    570524#ifdef NOSSI
     
    588542
    589543  if (!priv->screenname || !priv->password) {
    590     /* printf("need SN and password\n"); */
     544    owl_function_error("Internal error: aim login called without screenname or password");
    591545    return(-1);
    592546  }
    593547
    594548  if (!(authconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, priv->server ? priv->server : FAIM_LOGIN_SERVER))) {
    595     /* printf("internal connection error during login\n"); */
     549    owl_function_error("Internal error: connection error during AIM login\n");
    596550    return (-1);
    597551  } else if (authconn->fd == -1) {
    598552    if (authconn->status & AIM_CONN_STATUS_RESOLVERR) {
    599       /* printf("could not resolve authorizer name\n");*/
     553      owl_function_error("AIM: could not resolve authorize name");
    600554    } else if (authconn->status & AIM_CONN_STATUS_CONNERR) {
    601       /* printf("could not connect to authorizer\n"); */
     555      owl_function_error("AIM: could not connect to authorizer");
    602556    }
    603557    aim_conn_kill(sess, &authconn);
     
    612566  /* If the connection is in progress, this will just be queued */
    613567  aim_request_login(sess, authconn, priv->screenname);
    614 
    615   /* printf("login request sent\n"); */
     568  owl_function_debugmsg("AIM login request sent for %s", priv->screenname);
     569
    616570  return(0);
    617571}
     
    621575{
    622576  aim_clientready(sess, fr->conn);
    623   /* printf("initialization done for admin connection\n"); */
     577  owl_function_debugmsg("conninitdone_admin: initializtion done for admin connection");
    624578  return(1);
    625579}
     
    629583  aim_session_kill(sess);
    630584  owl_aim_init();
    631  
    632   /* kretch
     585
     586  owl_function_debugmsg("libfaim logout called");
     587  /*
    633588  if (faimtest_init() == -1)
    634589    printf("faimtest_init failed\n");
     
    770725 
    771726  /* printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); */
     727  owl_function_debugmsg("in faimtest_parse_buddyrights");
    772728 
    773729  /* aim_ssi_reqrights(sess, fr->conn); */
     
    802758  maxsiglen = va_arg(ap, int);
    803759  va_end(ap);
     760
     761  owl_function_debugmsg("in faimtest_parse_locrights");
    804762
    805763  /* printf("locate rights: max signature length = %d\n", maxsiglen); */
  • fmtext.c

    r252a5c2 ra0a5179  
    157157  for (i=0; i<nspaces; i++) {
    158158    owl_fmtext_append_normal(f, " ");
    159   }
    160 }
    161 
    162 /* requires that the list values are strings or NULL.
    163  * joins the elements together with join_with.
    164  * If format_fn is specified, passes it the list element value
    165  * and it will return a string which this needs to free. */
    166 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(void*))
    167 {
    168   int i, size;
    169   void *elem;
    170   char *text;
    171 
    172   size = owl_list_get_size(l);
    173   for (i=0; i<size; i++) {
    174     elem = (char*)owl_list_get_element(l,i);
    175     if (elem && format_fn) {
    176       text = format_fn(elem);
    177       if (text) {
    178         owl_fmtext_append_normal(f, text);
    179         owl_free(text);
    180       }
    181     } else if (elem) {
    182       owl_fmtext_append_normal(f, elem);
    183     }
    184     if ((i < size-1) && join_with) {
    185       owl_fmtext_append_normal(f, join_with);
    186     }
    187159  }
    188160}
     
    362334}
    363335
     336/* set the charater at 'index' to be 'char'.  If index is out of
     337 * bounds don't do anything */
    364338void owl_fmtext_set_char(owl_fmtext *f, int index, int ch)
    365339{
    366   /* set the charater at 'index' to be 'char'.  If index is out of
    367    * bounds don't do anything */
    368340  if ((index < 0) || (index > f->textlen-1)) return;
    369341  f->textbuff[index]=ch;
    370 }
    371 
    372 /* Free all memory allocated by the object */
    373 void owl_fmtext_free(owl_fmtext *f)
    374 {
    375   if (f->textbuff) owl_free(f->textbuff);
    376   if (f->fmbuff) owl_free(f->fmbuff);
    377   if (f->colorbuff) owl_free(f->colorbuff);
    378342}
    379343
     
    623587  }
    624588}
     589
     590/* requires that the list values are strings or NULL.
     591 * joins the elements together with join_with.
     592 * If format_fn is specified, passes it the list element value
     593 * and it will return a string which this needs to free. */
     594void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(void*))
     595{
     596  int i, size;
     597  void *elem;
     598  char *text;
     599
     600  size = owl_list_get_size(l);
     601  for (i=0; i<size; i++) {
     602    elem = (char*)owl_list_get_element(l,i);
     603    if (elem && format_fn) {
     604      text = format_fn(elem);
     605      if (text) {
     606        owl_fmtext_append_normal(f, text);
     607        owl_free(text);
     608      }
     609    } else if (elem) {
     610      owl_fmtext_append_normal(f, elem);
     611    }
     612    if ((i < size-1) && join_with) {
     613      owl_fmtext_append_normal(f, join_with);
     614    }
     615  }
     616}
     617
     618/* Free all memory allocated by the object */
     619void owl_fmtext_free(owl_fmtext *f)
     620{
     621  if (f->textbuff) owl_free(f->textbuff);
     622  if (f->fmbuff) owl_free(f->fmbuff);
     623  if (f->colorbuff) owl_free(f->colorbuff);
     624}
     625
  • functions.c

    rcee1f25 ra0a5179  
    30003000  owl_fmtext_init_null(&fm);
    30013001
     3002  /* AIM first */
    30023003  if (aim && owl_global_is_aimloggedin(&g)) {
    30033004    bl=owl_global_get_buddylist(&g);
     
    30143015        timestr=owl_strdup("");
    30153016      }
    3016       foo=owl_sprintf("  %-20.20s %-12.12s\n",
    3017                       owl_buddy_get_name(b),
    3018                       timestr);
     3017      foo=owl_sprintf("  %-20.20s %-12.12s\n", owl_buddy_get_name(b), timestr);
    30193018      owl_fmtext_append_normal(&fm, foo);
    30203019      owl_free(timestr);
     
    30273026    if (file==NULL) {
    30283027      tmp=owl_global_get_homedir(&g);
    3029       if (!tmp) {
    3030         owl_function_error("Could not determine home directory");
    3031         return;
    3032       }
    3033       ourfile=owl_malloc(strlen(tmp)+50);
    3034       sprintf(ourfile, "%s/.anyone", owl_global_get_homedir(&g));
     3028      ourfile=owl_sprintf("%s/.anyone", owl_global_get_homedir(&g));
    30353029    } else {
    30363030      ourfile=owl_strdup(file);
    30373031    }
    3038    
     3032
     3033    owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
    30393034    f=fopen(ourfile, "r");
    30403035    if (!f) {
    3041       owl_function_error("Error opening file %s: %s",
    3042                            ourfile,
    3043                            strerror(errno) ? strerror(errno) : "");
    3044       return;
    3045     }
    3046 
    3047     owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
    3048    
    3049     while (fgets(buff, LINE, f)!=NULL) {
    3050       /* ignore comments, blank lines etc. */
    3051       if (buff[0]=='#') continue;
    3052       if (buff[0]=='\n') continue;
    3053       if (buff[0]=='\0') continue;
    3054      
    3055       /* strip the \n */
    3056       buff[strlen(buff)-1]='\0';
    3057      
    3058       /* ingore from # on */
    3059       tmp=strchr(buff, '#');
    3060       if (tmp) tmp[0]='\0';
    3061      
    3062       /* ingore from SPC */
    3063       tmp=strchr(buff, ' ');
    3064       if (tmp) tmp[0]='\0';
    3065      
    3066       /* stick on the local realm. */
    3067       if (!strchr(buff, '@')) {
    3068         strcat(buff, "@");
    3069         strcat(buff, ZGetRealm());
    3070       }
    3071      
    3072       ret=ZLocateUser(buff, &numlocs, ZAUTH);
    3073       if (ret!=ZERR_NONE) {
    3074         owl_function_error("Error getting location for %s", buff);
    3075         continue;
    3076       }
    3077      
    3078       numlocs=200;
    3079       ret=ZGetLocations(location, &numlocs);
    3080       if (ret==0) {
    3081         for (i=0; i<numlocs; i++) {
    3082           line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
    3083           tmp=short_zuser(buff);
    3084           sprintf(line, "  %-10.10s %-24.24s %-12.12s  %20.20s\n",
    3085                   tmp,
    3086                   location[i].host,
    3087                   location[i].tty,
    3088                   location[i].time);
    3089           owl_fmtext_append_normal(&fm, line);
    3090           owl_free(tmp);
     3036      owl_fmtext_append_normal(&fm, "  Error opening file ");
     3037      owl_fmtext_append_normal(&fm, ourfile);
     3038      owl_fmtext_append_normal(&fm, "\n");
     3039      owl_function_error("Error opening file %s: %s", ourfile, strerror(errno) ? strerror(errno) : "");
     3040    } else {
     3041      while (fgets(buff, LINE, f)!=NULL) {
     3042        /* ignore comments, blank lines etc. */
     3043        if (buff[0]=='#') continue;
     3044        if (buff[0]=='\n') continue;
     3045        if (buff[0]=='\0') continue;
     3046       
     3047        /* strip the \n */
     3048        buff[strlen(buff)-1]='\0';
     3049       
     3050        /* ingore from # on */
     3051        tmp=strchr(buff, '#');
     3052        if (tmp) tmp[0]='\0';
     3053       
     3054        /* ingore from SPC */
     3055        tmp=strchr(buff, ' ');
     3056        if (tmp) tmp[0]='\0';
     3057       
     3058        /* stick on the local realm. */
     3059        if (!strchr(buff, '@')) {
     3060          strcat(buff, "@");
     3061          strcat(buff, ZGetRealm());
    30913062        }
    3092         if (numlocs>=200) {
    3093           owl_fmtext_append_normal(&fm, "  Too many locations found for this user, truncating.\n");
     3063       
     3064        ret=ZLocateUser(buff, &numlocs, ZAUTH);
     3065        if (ret!=ZERR_NONE) {
     3066          owl_function_error("Error getting location for %s", buff);
     3067          continue;
     3068        }
     3069       
     3070        numlocs=200;
     3071        ret=ZGetLocations(location, &numlocs);
     3072        if (ret==0) {
     3073          for (i=0; i<numlocs; i++) {
     3074            line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
     3075            tmp=short_zuser(buff);
     3076            sprintf(line, "  %-10.10s %-24.24s %-12.12s  %20.20s\n",
     3077                    tmp,
     3078                    location[i].host,
     3079                    location[i].tty,
     3080                    location[i].time);
     3081            owl_fmtext_append_normal(&fm, line);
     3082            owl_free(tmp);
     3083          }
     3084          if (numlocs>=200) {
     3085            owl_fmtext_append_normal(&fm, "  Too many locations found for this user, truncating.\n");
     3086          }
    30943087        }
    30953088      }
    3096     }
    3097     fclose(f);
     3089      fclose(f);
     3090    }
    30983091    owl_free(ourfile);
    30993092  }
  • libfaim/aim_cbtypes.h

    re374dee ra0a5179  
    212212#define AIM_CB_SSI_REQDATA 0x0004
    213213#define AIM_CB_SSI_REQIFCHANGED 0x0005
     214#define AIM_CB_SSI_REQLIST 0x0005
    214215#define AIM_CB_SSI_LIST 0x0006
    215216#define AIM_CB_SSI_ACTIVATE 0x0007
  • libfaim/ssi.c

    ra053de8 ra0a5179  
    4141  int newlen;
    4242  struct aim_ssi_item *cur, *group;
    43  
    44   if (!list)
    45     return NULL;
     43
     44  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: in for group %s", name?name:"NULL");
     45 
     46  if (!list) return(NULL);
    4647 
    4748  /* Find the group */
    48   if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP)))
    49     return NULL;
     49  if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) return(NULL);
    5050 
    5151  /* Free the old data */
     
    6464        newlen += 2;
    6565  }
     66  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: newlen is %i", newlen);
    6667 
    6768  /* Build the new TLV list */
     
    6970    fu8_t *newdata;
    7071   
    71     if (!(newdata = (fu8_t *)malloc((newlen)*sizeof(fu8_t))))
    72       return NULL;
     72    if (!(newdata = (fu8_t *)malloc((newlen)*sizeof(fu8_t)))) return NULL;
    7373    newlen = 0;
    7474    if (group->gid == 0x0000) {
     
    8585    free(newdata);
    8686  }
    87  
     87
     88  owl_function_debugmsg("aim_ssi_itemlist_rebuildgroup: exiting");
    8889  return group;
    8990}
     
    177178  if (!list || !(*list) || !del) return -EINVAL;
    178179
     180  owl_function_debugmsg("aim_ssi_itemlist_del: in");
    179181  /* Remove the item from the list */
    180182  if (*list == del) {
    181183    *list = (*list)->next;
     184    owl_function_debugmsg("aim_ssi_itemlist_del: deleted %s from beginning of list", del->name);
    182185  } else {
    183186    struct aim_ssi_item *cur;
    184187    for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next);
    185188    if (cur->next) cur->next=cur->next->next;
     189    owl_function_debugmsg("aim_ssi_itemlist_del: deleted %s from middle of list", del->name);
    186190  }
    187191
    188192  /* Free the deleted item */
     193  owl_function_debugmsg("aim_ssi_itemlist_del: freeing");
    189194  free(del->name);
    190195  aim_freetlvchain(&del->data);
     
    450455  struct aim_ssi_item *cur1, *cur2;
    451456  struct aim_ssi_tmp *cur, *new;
    452  
    453   if (!sess)
    454     return -EINVAL;
    455  
     457
     458  owl_function_debugmsg("aim_ssi_sync: beginning");
     459 
     460  if (!sess) return (-EINVAL);
     461
    456462  /* If we're waiting for an ack, we shouldn't do anything else */
    457   if (sess->ssi.waiting_for_ack)
     463  if (sess->ssi.waiting_for_ack) {
     464    owl_function_debugmsg("Aborting aim_ssi_sync, waiting for ack");
    458465    return 0;
     466  }
    459467 
    460468  /*
     
    466474   * buddy ID#s, which makes things more efficient.  I think.
    467475   */
    468  
     476
    469477  /* Additions */
    470478  if (!sess->ssi.pending) {
    471479    for (cur1=sess->ssi.local; cur1; cur1=cur1->next) {
    472480      if (!aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid)) {
     481        owl_function_debugmsg("aim_ssi_sync: doing addition");
    473482        new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
    474483        new->action = AIM_CB_SSI_ADD;
     
    490499    for (cur1=sess->ssi.official; cur1; cur1=cur1->next) {
    491500      if (!aim_ssi_itemlist_find(sess->ssi.local, cur1->gid, cur1->bid)) {
     501        owl_function_debugmsg("aim_ssi_sync: doing deletion");
    492502        new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
    493503        new->action = AIM_CB_SSI_DEL;
     
    510520      cur2 = aim_ssi_itemlist_find(sess->ssi.official, cur1->gid, cur1->bid);
    511521      if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) {
     522        owl_function_debugmsg("aim_ssi_sync: doing modification");
    512523        new = (struct aim_ssi_tmp *)malloc(sizeof(struct aim_ssi_tmp));
    513524        new->action = AIM_CB_SSI_MOD;
     
    527538  /* We're out of stuff to do, so tell the AIM servers we're done and exit */
    528539  if (!sess->ssi.pending) {
     540    owl_function_debugmsg("aim_ssi_sync: telling server we're done modifying SSI data.");
    529541    aim_ssi_modend(sess);
    530542    return 0;
     
    533545  /* Make sure we don't send anything else between now
    534546   * and when we receive the ack for the following operation */
     547  owl_function_debugmsg("aim_ssi_sync: setting SSI waiting_for_ack");
    535548  sess->ssi.waiting_for_ack = 1;
    536549 
    537550  /* Now go mail off our data and wait 4 to 6 weeks */
     551  owl_function_debugmsg("aim_ssi_sync: about to call addmoddel to send SNACs to server");
    538552  aim_ssi_addmoddel(sess);
    539553 
     
    789803  /* Remove the item from the list */
    790804  aim_ssi_itemlist_del(&sess->ssi.local, del);
    791  
     805
    792806  /* Modify the parent group */
    793807  aim_ssi_itemlist_rebuildgroup(sess->ssi.local, group);
     
    807821 
    808822  /* Sync our local list with the server list */
     823  owl_function_debugmsg("aim_ssi_delbuddy: about to sync");
    809824  aim_ssi_sync(sess);
    810825 
     
    12611276  struct aim_ssi_tmp *cur;
    12621277 
    1263   if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sess->ssi.pending || !sess->ssi.pending->item)
     1278  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)) || !sess->ssi.pending || !sess->ssi.pending->item) {
     1279    owl_function_debugmsg("aim_ssi_addmoddel: aborting early");
    12641280    return -EINVAL;
     1281  }
    12651282 
    12661283  /* Calculate total SNAC size */
     
    12681285  for (cur=sess->ssi.pending; cur; cur=cur->next) {
    12691286    snaclen += 10; /* For length, GID, BID, type, and length */
    1270     if (cur->item->name)
    1271       snaclen += strlen(cur->item->name);
    1272     if (cur->item->data)
    1273       snaclen += aim_sizetlvchain(&cur->item->data);
    1274   }
    1275  
    1276   if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen)))
    1277     return -ENOMEM;
     1287    if (cur->item->name) snaclen += strlen(cur->item->name);
     1288    if (cur->item->data) snaclen += aim_sizetlvchain(&cur->item->data);
     1289  }
     1290 
     1291  if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) return (-ENOMEM);
    12781292 
    12791293  snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, sess->ssi.pending->action, 0x0000, NULL, 0);
     
    12821296  for (cur=sess->ssi.pending; cur; cur=cur->next) {
    12831297    aimbs_put16(&fr->data, cur->item->name ? strlen(cur->item->name) : 0);
    1284     if (cur->item->name)
    1285       aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name));
     1298    if (cur->item->name) aimbs_putraw(&fr->data, cur->item->name, strlen(cur->item->name));
    12861299    aimbs_put16(&fr->data, cur->item->gid);
    12871300    aimbs_put16(&fr->data, cur->item->bid);
    12881301    aimbs_put16(&fr->data, cur->item->type);
    12891302    aimbs_put16(&fr->data, cur->item->data ? aim_sizetlvchain(&cur->item->data) : 0);
    1290     if (cur->item->data)
    1291       aim_writetlvchain(&fr->data, &cur->item->data);
     1303    if (cur->item->data) aim_writetlvchain(&fr->data, &cur->item->data);
    12921304  }
    12931305 
    12941306  aim_tx_enqueue(sess, fr);
    1295  
     1307
     1308  owl_function_debugmsg("aim_ssi_addmoddel: exiting normally");
    12961309  return 0;
    12971310}
     
    14411454  aim_rxcallback_t userfunc;
    14421455  struct aim_ssi_tmp *cur, *del;
     1456
     1457  owl_function_debugmsg("Handling SNAC SSI ACK");
    14431458 
    14441459  /* Read in the success/failure flags from the ack SNAC */
     
    14551470   */
    14561471  for (cur=sess->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) {
     1472    owl_function_debugmsg("parseack: processing a change");
    14571473    if (cur->item) {
    14581474      if (cur->ack) {
    14591475        /* Our action was unsuccessful, so change the local list back to how it was */
    14601476        if (cur->action == AIM_CB_SSI_ADD) {
     1477          owl_function_debugmsg("parseack: unsuccesful add, reverting");
    14611478          /* Remove the item from the local list */
    14621479          /* Make sure cur->item is still valid memory */
     
    14721489        } else if (cur->action == AIM_CB_SSI_MOD) {
    14731490          /* Replace the local item with the item from the official list */
     1491          owl_function_debugmsg("parseack: unsuccesful modify, reverting");
    14741492          if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
    14751493            struct aim_ssi_item *cur1;
     
    14891507        } else if (cur->action == AIM_CB_SSI_DEL) {
    14901508          /* Add the item back into the local list */
     1509          owl_function_debugmsg("parseack: unsuccesful delete, reverting");
    14911510          if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item)) {
    14921511            aim_ssi_itemlist_add(&sess->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data);
     
    14991518        if (cur->action == AIM_CB_SSI_ADD) {
    15001519          /* Add the local item to the official list */
     1520          owl_function_debugmsg("parseack: succesful add");
    15011521          if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
    15021522            aim_ssi_itemlist_add(&sess->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data);
     
    15061526        } else if (cur->action == AIM_CB_SSI_MOD) {
    15071527          /* Replace the official item with the item from the local list */
     1528          owl_function_debugmsg("parseack: succesful modify");
    15081529          if (aim_ssi_itemlist_valid(sess->ssi.local, cur->item)) {
    15091530            struct aim_ssi_item *cur1;
     
    15231544        } else if (cur->action == AIM_CB_SSI_DEL) {
    15241545          /* Remove the item from the official list */
     1546          owl_function_debugmsg("parseack: succesful delete");
    15251547          if (aim_ssi_itemlist_valid(sess->ssi.official, cur->item))
    15261548            aim_ssi_itemlist_del(&sess->ssi.official, cur->item);
     
    15461568 
    15471569  /* If we're not waiting for any more acks, then send more SNACs */
     1570
    15481571  if (!sess->ssi.pending) {
    15491572    sess->ssi.pending = NULL;
    15501573    sess->ssi.waiting_for_ack = 0;
     1574    owl_function_debugmsg("parseack: Clearing SSI waiting_for_ack");
    15511575    aim_ssi_sync(sess);
    15521576  }
     1577
     1578  owl_function_debugmsg("parseack: returning with %i", ret);
    15531579 
    15541580  return ret;
     
    16011627  aim_conn_t *conn;
    16021628 
    1603   if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI)))
    1604     return -EINVAL;
     1629  if (!sess || !(conn = aim_conn_findbygroup(sess, AIM_CB_FAM_SSI))) return -EINVAL;
    16051630 
    16061631  return aim_genericreq_n(sess, conn, AIM_CB_FAM_SSI, AIM_CB_SSI_EDITSTOP);
  • owl.c

    r52f3507 ra0a5179  
    5757#endif
    5858
     59  owl_function_debugmsg("startup: it's the very best place to start");
     60
     61  owl_function_debugmsg("startup: processing command line arguments");
    5962  argcsave=argc;
    6063  argvsave=argv;
     
    106109#ifdef HAVE_LIBZEPHYR
    107110  /* zephyr init */
     111  owl_function_debugmsg("startup: initializing zephyr");
    108112  ret=owl_zephyr_initialize();
    109113  if (ret) {
     
    113117 
    114118  /* signal handler */
     119  owl_function_debugmsg("startup: setting up signal handler");
    115120  sigact.sa_handler=sig_handler;
    116121  sigemptyset(&sigact.sa_mask);
     
    120125
    121126  /* screen init */
     127  owl_function_debugmsg("startup: initializing screen");
    122128  sprintf(buff, "TERMINFO=%s", TERMINFO);
    123129  putenv(buff);
     
    143149
    144150  /* owl global init */
     151  owl_function_debugmsg("startup: doing owl global initialization");
    145152  owl_global_init(&g);
    146153  if (debug) owl_global_set_debug_on(&g);
     
    152159
    153160#if OWL_STDERR_REDIR
    154   /* Do this only after we've started curses up... */ 
     161  /* Do this only after we've started curses up... */
     162  owl_function_debugmsg("startup: doing stderr redirection");
    155163  newstderr = stderr_replace();
    156164#endif   
    157165
    158166  /* create the owl directory, in case it does not exist */
     167  owl_function_debugmsg("startup: creating owl directory, if not present");
    159168  dir=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_CONFIG_DIR);
    160169  mkdir(dir, S_IRWXU);
     
    162171
    163172  /* set the tty, either from the command line, or by figuring it out */
     173  owl_function_debugmsg("startup: setting tty name");
    164174  if (tty) {
    165175    owl_global_set_tty(&g, tty);
     
    169179
    170180  /* setup the built-in styles */
     181  owl_function_debugmsg("startup: creating built-in styles");
    171182  s=owl_malloc(sizeof(owl_style));
    172183  owl_style_create_internal(s, "default", &owl_stylefunc_default,
     
    192203  /* the personal filter will need to change again when AIM chat's are
    193204   *  included.  Also, there should be an %aimme% */
     205  owl_function_debugmsg("startup: creating default filters");
    194206  f=owl_malloc(sizeof(owl_filter));
    195207  owl_filter_init_fromstring(f, "personal", "( type ^zephyr$ "
     
    240252
    241253  /* set the current view */
     254  owl_function_debugmsg("startup: setting the current view");
    242255  owl_view_create(owl_global_get_current_view(&g), "main", f, owl_global_get_style_by_name(&g, "default"));
    243256
    244257  /* AIM init */
     258  owl_function_debugmsg("startup: doing AIM initialization");
    245259  owl_aim_init();
    246260
    247261  /* process the startup file */
     262  owl_function_debugmsg("startup: processing startup file");
    248263  owl_function_source(NULL);
    249264
    250265  /* read the config file */
     266  owl_function_debugmsg("startup: processing config file");
    251267  owl_context_set_readconfig(owl_global_get_context(&g));
    252268  perlerr=owl_perlconfig_readconfig(configfile);
     
    269285
    270286  /* execute the startup function in the configfile */
     287  owl_function_debugmsg("startup: executing perl startup, if applicable");
    271288  perlout = owl_perlconfig_execute("owl::startup();");
    272289  if (perlout) owl_free(perlout);
    273   owl_function_debugmsg("-- Owl Startup --");
    274290 
    275291  /* hold on to the window names for convenience */
     
    281297
    282298  /* welcome message */
     299  owl_function_debugmsg("startup: creating splash message");
    283300  strcpy(startupmsg, "-----------------------------------------------------------------------\n");
    284301  sprintf(buff,      "Welcome to Owl version %s.  Press 'h' for on-line help. \n", OWL_VERSION_STRING);
     
    298315  /* load zephyr subs */
    299316  if (initialsubs) {
     317    owl_function_debugmsg("startup: loading initial zephyr subs");
    300318    /* load normal subscriptions */
    301319    ret=owl_zephyr_loadsubs(NULL);
     
    312330    /* load login subscriptions */
    313331    if (owl_global_is_loginsubs(&g)) {
     332      owl_function_debugmsg("startup: loading login subs");
    314333      owl_function_loadloginsubs(NULL);
    315334    }
     
    318337  /* set the startup and default style, based on userclue and presence of a
    319338   * formatting function */
     339  owl_function_debugmsg("startup: setting startup and default style");
    320340  if (0 != strcmp(owl_global_get_default_style(&g), "__unspecified__")) {
    321341    /* the style was set by the user: leave it alone */
     
    330350  /* zlog in if we need to */
    331351  if (owl_global_is_startuplogin(&g)) {
     352    owl_function_debugmsg("startup: doing zlog in");
    332353    owl_zephyr_zlog_in();
    333354  }
    334355
     356  owl_function_debugmsg("startup: set style for the view");
    335357  owl_view_set_style(owl_global_get_current_view(&g),
    336358                     owl_global_get_style_by_name(&g, owl_global_get_default_style(&g)));   
    337  
     359
     360  owl_function_debugmsg("startup: setting context interactive");
    338361  owl_context_set_interactive(owl_global_get_context(&g));
    339362
     
    341364  nexttime=time(NULL);
    342365
     366  owl_function_debugmsg("startup: entering main loop");
    343367  /* main loop */
    344368  while (1) {
Note: See TracChangeset for help on using the changeset viewer.