Changeset aa5f725


Ignore:
Timestamp:
Jun 3, 2003, 3:40:28 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:
fd93b41
Parents:
651560f
Message:
added buddylists
added the 'alist' command to print logged in aimusers
added the 'blist' command which prints buddies logged in from all
  protocols.
'l' is now bound to 'blist' by default
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r0ff8fb57 raa5f725  
    2222     readconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \
    2323     regex.c history.c view.c dict.c variable.c filterelement.c pair.c \
    24      keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c aim.c
     24     keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \
     25     aim.c buddylist.c
    2526OWL_SRC = owl.c
    2627TESTER_SRC = tester.c
  • aim.c

    r651560f raa5f725  
    367367  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0);
    368368
    369   aim_conn_addhandler(sess, bosconn, 0x0013, 0x0003, ssirights, 0);
    370   aim_conn_addhandler(sess, bosconn, 0x0013, 0x0006, ssidata, 0);
    371   aim_conn_addhandler(sess, bosconn, 0x0013, 0x000f, ssidatanochange, 0);
    372   aim_conn_addhandler(sess, bosconn, 0x0008, 0x0002, handlepopup, 0);
    373   aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, faimtest_bosrights, 0);
    374   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, faimtest_handleredirect, 0);
    375   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL, faimtest_reportinterval, 0);
    376   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, faimtest_parse_buddyrights, 0);
    377   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, faimtest_parse_motd, 0);
    378   aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, faimtest_icbmparaminfo, 0);
    379   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, faimtest_parse_connerr, 0);
    380   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, faimtest_locrights, 0);
    381   aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, faimtest_memrequest, 0);
    382   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, faimtest_parse_oncoming, 0);
    383   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, faimtest_parse_offgoing, 0);
    384   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, faimtest_parse_incoming_im, 0);
    385   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, faimtest_parse_locerr, 0);
    386   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, faimtest_parse_misses, 0);
    387   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, faimtest_parse_ratechange, 0);
    388   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, faimtest_parse_evilnotify, 0);
    389   aim_conn_addhandler(sess, bosconn, 0x000a, 0x0001, faimtest_parse_searcherror, 0);
    390   aim_conn_addhandler(sess, bosconn, 0x000a, 0x0003, faimtest_parse_searchreply, 0);
    391   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, faimtest_parse_msgerr, 0);
    392   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, faimtest_parse_userinfo, 0);
    393   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, faimtest_parse_msgack, 0);
    394 
    395   aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, faimtest_parse_genericerr, 0);
    396   aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, faimtest_parse_genericerr, 0);
    397   aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, faimtest_parse_genericerr, 0);
    398   aim_conn_addhandler(sess, bosconn, 0x0001, 0x000b, serverpause, 0);
    399   aim_conn_addhandler(sess, bosconn, 0x0001, 0x0012, migrate, 0);
    400   aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, offlinemsg, 0);
     369  aim_conn_addhandler(sess, bosconn, 0x0013,         0x0003,                        ssirights, 0);
     370  aim_conn_addhandler(sess, bosconn, 0x0013,         0x0006,                        ssidata, 0);
     371  aim_conn_addhandler(sess, bosconn, 0x0013,         0x000f,                        ssidatanochange, 0);
     372  aim_conn_addhandler(sess, bosconn, 0x0008,         0x0002,                        handlepopup, 0);
     373  aim_conn_addhandler(sess, bosconn, 0x0009,         0x0003,                        faimtest_bosrights, 0);
     374  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT,           faimtest_handleredirect, 0);
     375  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_STS, AIM_CB_STS_SETREPORTINTERVAL,  faimtest_reportinterval, 0);
     376  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO,         faimtest_parse_buddyrights, 0);
     377  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD,               faimtest_parse_motd, 0);
     378  aim_conn_addhandler(sess, bosconn, 0x0004,         0x0005,                        faimtest_icbmparaminfo, 0);
     379  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR,    faimtest_parse_connerr, 0);
     380  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO,         faimtest_locrights, 0);
     381  aim_conn_addhandler(sess, bosconn, 0x0001,         0x001f,                        faimtest_memrequest, 0);
     382  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING,           faimtest_parse_oncoming, 0);
     383  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING,           faimtest_parse_offgoing, 0);
     384  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING,           faimtest_parse_incoming_im, 0);
     385  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR,              faimtest_parse_locerr, 0);
     386  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL,         faimtest_parse_misses, 0);
     387  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE,         faimtest_parse_ratechange, 0);
     388  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL,               faimtest_parse_evilnotify, 0);
     389  aim_conn_addhandler(sess, bosconn, 0x000a,         0x0001,                        faimtest_parse_searcherror, 0);
     390  aim_conn_addhandler(sess, bosconn, 0x000a,         0x0003,                        faimtest_parse_searchreply, 0);
     391  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR,              faimtest_parse_msgerr, 0);
     392  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO,           faimtest_parse_userinfo, 0);
     393  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK,                faimtest_parse_msgack, 0);
     394
     395  aim_conn_addhandler(sess, bosconn, 0x0001,         0x0001,                        faimtest_parse_genericerr, 0);
     396  aim_conn_addhandler(sess, bosconn, 0x0003,         0x0001,                        faimtest_parse_genericerr, 0);
     397  aim_conn_addhandler(sess, bosconn, 0x0009,         0x0001,                        faimtest_parse_genericerr, 0);
     398  aim_conn_addhandler(sess, bosconn, 0x0001,         0x000b,                        serverpause, 0);
     399  aim_conn_addhandler(sess, bosconn, 0x0001,         0x0012,                        migrate, 0);
     400  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG,         offlinemsg, 0);
    401401  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, offlinemsgdone, 0);
    402402
    403403  #ifdef MID_REWROTE_ALL_THE_CRAP
    404   aim_conn_addhandler(sess, bosconn, 0xffff, 0xffff, faimtest_parse_unknown, 0);
     404  aim_conn_addhandler(sess, bosconn, 0xffff,         0xffff,                        faimtest_parse_unknown, 0);
    405405  #endif
    406406
     
    421421
    422422  /*
    423   snprintf(buddies, sizeof(buddies), "jagworks&jkretch76&");
     423  snprintf(buddies, sizeof(buddies), "Buddy1&Buddy2&");
    424424  snprintf(profile, sizeof(profile), "Hello.<br>This is a test");
    425425  */
     
    13871387{
    13881388  aim_userinfo_t *userinfo;
    1389  
     1389
    13901390  va_list ap;
    13911391  va_start(ap, fr);
    13921392  userinfo = va_arg(ap, aim_userinfo_t *);
    13931393  va_end(ap);
     1394
     1395  owl_buddylist_oncoming(owl_global_get_buddylist(&g), userinfo->sn);
     1396 
    13941397  /*
    13951398    printf("%ld  %s is now online (flags: %04x = %s%s%s%s%s%s%s%s) (caps = %s = 0x%08lx)\n",
     
    14071410    userinfo->capabilities);
    14081411  */
    1409   return 1;
     1412  return(1);
    14101413}
    14111414
     
    14181421  userinfo = va_arg(ap, aim_userinfo_t *);
    14191422  va_end(ap);
     1423
     1424  owl_buddylist_offgoing(owl_global_get_buddylist(&g), userinfo->sn);
    14201425
    14211426  /*
     
    24682473  }
    24692474}
     2475
     2476
     2477/****************************************/
     2478
     2479/*
     2480static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
     2481        struct gaim_connection *gc = sess->aux_data;
     2482        struct oscar_data *od = gc->proto_data;
     2483        aim_userinfo_t *info;
     2484        time_t time_idle = 0, signon = 0;
     2485        int type = 0;
     2486        int caps = 0;
     2487        char *tmp;
     2488
     2489        va_list ap;
     2490        va_start(ap, fr);
     2491        info = va_arg(ap, aim_userinfo_t *);
     2492        va_end(ap);
     2493
     2494        if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
     2495                caps = info->capabilities;
     2496        if (info->flags & AIM_FLAG_ACTIVEBUDDY)
     2497                type |= UC_AB;
     2498
     2499        if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
     2500                        if (info->flags & AIM_FLAG_UNCONFIRMED)
     2501                                type |= UC_UNCONFIRMED;
     2502                        if (info->flags & AIM_FLAG_ADMINISTRATOR)
     2503                                type |= UC_ADMIN;
     2504                        if (info->flags & AIM_FLAG_AOL)
     2505                                type |= UC_AOL;
     2506                        if (info->flags & AIM_FLAG_FREE)
     2507                                type |= UC_NORMAL;
     2508                        if (info->flags & AIM_FLAG_AWAY)
     2509                                type |= UC_UNAVAILABLE;
     2510                        if (info->flags & AIM_FLAG_WIRELESS)
     2511                                type |= UC_WIRELESS;
     2512        }
     2513        if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
     2514                type = (info->icqinfo.status << 16);
     2515                if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
     2516                      (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
     2517                        type |= UC_UNAVAILABLE;
     2518                }
     2519        }
     2520
     2521        if (caps & AIM_CAPS_ICQ)
     2522                caps ^= AIM_CAPS_ICQ;
     2523
     2524        if (info->present & AIM_USERINFO_PRESENT_IDLE) {
     2525                time(&time_idle);
     2526                time_idle -= info->idletime*60;
     2527        }
     2528
     2529        if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
     2530                signon = time(NULL) - info->sessionlen;
     2531
     2532        tmp = g_strdup(normalize(gc->username));
     2533        if (!strcmp(tmp, normalize(info->sn)))
     2534                g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn);
     2535        g_free(tmp);
     2536
     2537        serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon,
     2538                        time_idle, type, caps);
     2539
     2540        return 1;
     2541}
     2542*/
  • commands.c

    r651560f raa5f725  
    233233              "znol [-f file]",
    234234              "Print a znol-style listing of users logged in"),
    235  
     235
     236  OWLCMD_ARGS("alist", owl_command_alist, OWL_CTX_INTERACTIVE,
     237              "List AIM users logged in",
     238              "alist",
     239              "Print a listing of AIM users logged in"),
     240
     241  OWLCMD_ARGS("blist", owl_command_blist, OWL_CTX_INTERACTIVE,
     242              "List all buddies logged in",
     243              "alist",
     244              "Print a listing of buddies logged in, regardless of protocol."),
     245
    236246  OWLCMD_VOID("recv:shiftleft", owl_command_shift_left, OWL_CTX_INTERACTIVE,
    237247              "scrolls receive window to the left", "", ""),
     
    818828    }
    819829  }
    820   owl_function_zlist(file, elapsed, timesort);
     830  owl_function_buddylist(0, 1, file);
     831  return(NULL);
     832}
     833
     834char *owl_command_alist() {
     835  owl_function_buddylist(1, 0, NULL);
     836  return(NULL);
     837}
     838
     839char *owl_command_blist() {
     840  owl_function_buddylist(1, 1, NULL);
    821841  return(NULL);
    822842}
     
    13781398  char *tmpbuff;
    13791399
     1400  if (!owl_global_is_aimloggedin(&g)) {
     1401    owl_function_makemsg("You are not logged in to AIM.");
     1402    return(NULL);
     1403  }
     1404
    13801405  if (argc < 2) {
    13811406    owl_function_makemsg("Not enough arguments to the aimwrite command.");
    1382   } else {
    1383     tmpbuff=owl_strdup(buff);
    1384     owl_function_aimwrite_setup(tmpbuff);
    1385     owl_global_set_buffercommand(&g, tmpbuff);
    1386     owl_free(tmpbuff);
    1387   }
    1388   return NULL;
     1407    return(NULL);
     1408  }
     1409
     1410  tmpbuff=owl_strdup(buff);
     1411  owl_function_aimwrite_setup(tmpbuff);
     1412  owl_global_set_buffercommand(&g, tmpbuff);
     1413  owl_free(tmpbuff);
     1414  return(NULL);
    13891415}
    13901416
     
    17721798char *owl_command_aimlogin(int argc, char **argv, char *buff) {
    17731799  int ret;
    1774 
     1800 
    17751801  if (argc!=3) {
    17761802    owl_function_makemsg("Wrong number of arguments to aimlogin command");
    17771803    return(NULL);
    17781804  }
     1805
     1806  /* clear the buddylist */
     1807  owl_buddylist_clear(owl_global_get_buddylist(&g));
     1808
     1809  /* try to login */
    17791810  ret=owl_aim_login(argv[1], argv[2]);
    17801811  if (!ret) {
     
    17881819
    17891820char *owl_command_aimlogout(int argc, char **argv, char *buff) {
     1821  /* clear the buddylist */
     1822  owl_buddylist_clear(owl_global_get_buddylist(&g));
     1823
    17901824  owl_aim_logout();
    17911825  return(NULL);
  • functions.c

    r3abf28b raa5f725  
    125125}
    126126
    127 void owl_function_make_outgoing_aim(char *body, char *to)
     127int owl_function_make_outgoing_aim(char *body, char *to)
    128128{
    129129  owl_message *m;
    130130  int followlast;
     131
     132
     133  if (!owl_global_is_aimloggedin(&g)) {
     134    return(-1);
     135  }
    131136 
    132137  followlast=owl_global_should_followlast(&g);
     
    149154  wnoutrefresh(owl_global_get_curs_recwin(&g));
    150155  owl_global_set_needrefresh(&g);
     156  return(0);
    151157}
    152158
     
    26892695}
    26902696
    2691 /* popup a znol listing.  If file is NULL use the default .anyone */
    2692 /* this doesn't obey 'elapsed' or 'timesort' yet */
    2693 void owl_function_zlist(char *file, int elapsed, int timesort)
     2697/* Popup a buddylisting.  If file is NULL use the default .anyone */
     2698void owl_function_buddylist(int aim, int zephyr, char *file)
    26942699{
    26952700  char *ourfile, *tmp, buff[LINE], *line;
    26962701  FILE *f;
    2697   int numlocs, ret, i;
     2702  int numlocs, ret, i, j;
    26982703  ZLocations_t location[200];
    26992704  owl_fmtext fm;
    2700 
    2701   if (file==NULL) {
    2702     tmp=owl_global_get_homedir(&g);
    2703     if (!tmp) {
    2704       owl_function_makemsg("Could not determine home directory");
     2705  owl_buddylist *b;
     2706
     2707  owl_fmtext_init_null(&fm);
     2708
     2709  if (aim && owl_global_is_aimloggedin(&g)) {
     2710    b=owl_global_get_buddylist(&g);
     2711
     2712    owl_fmtext_append_bold(&fm, "AIM users logged in:\n");
     2713    j=owl_buddylist_get_size(b);
     2714    for (i=0; i<j; i++) {
     2715      owl_fmtext_append_normal(&fm, "  ");
     2716      owl_fmtext_append_normal(&fm, owl_buddylist_get_buddy(b, i));
     2717      owl_fmtext_append_normal(&fm, "\n");
     2718    }
     2719  }
     2720
     2721  if (zephyr) {
     2722    if (file==NULL) {
     2723      tmp=owl_global_get_homedir(&g);
     2724      if (!tmp) {
     2725        owl_function_makemsg("Could not determine home directory");
     2726        return;
     2727      }
     2728      ourfile=owl_malloc(strlen(tmp)+50);
     2729      sprintf(ourfile, "%s/.anyone", owl_global_get_homedir(&g));
     2730    } else {
     2731      ourfile=owl_strdup(file);
     2732    }
     2733   
     2734    f=fopen(ourfile, "r");
     2735    if (!f) {
     2736      owl_function_makemsg("Error opening file %s: %s",
     2737                           ourfile,
     2738                           strerror(errno) ? strerror(errno) : "");
    27052739      return;
    27062740    }
    2707     ourfile=owl_malloc(strlen(tmp)+50);
    2708     sprintf(ourfile, "%s/.anyone", owl_global_get_homedir(&g));
    2709   } else {
    2710     ourfile=owl_strdup(file);
    2711   }
    2712 
    2713   f=fopen(ourfile, "r");
    2714   if (!f) {
    2715     owl_function_makemsg("Error opening file %s: %s",
    2716                          ourfile,
    2717                          strerror(errno) ? strerror(errno) : "");
    2718     return;
    2719   }
    2720 
    2721   owl_fmtext_init_null(&fm);
    27222741   
    2723   while (fgets(buff, LINE, f)!=NULL) {
    2724     /* ignore comments, blank lines etc. */
    2725     if (buff[0]=='#') continue;
    2726     if (buff[0]=='\n') continue;
    2727     if (buff[0]=='\0') continue;
    2728 
    2729     /* strip the \n */
    2730     buff[strlen(buff)-1]='\0';
    2731 
    2732     /* ingore from # on */
    2733     tmp=strchr(buff, '#');
    2734     if (tmp) tmp[0]='\0';
    2735 
    2736     /* ingore from SPC */
    2737     tmp=strchr(buff, ' ');
    2738     if (tmp) tmp[0]='\0';
    2739 
    2740     /* stick on the local realm. */
    2741     if (!strchr(buff, '@')) {
    2742       strcat(buff, "@");
    2743       strcat(buff, ZGetRealm());
    2744     }
    2745 
    2746     ret=ZLocateUser(buff, &numlocs, ZAUTH);
    2747     if (ret!=ZERR_NONE) {
    2748       owl_function_makemsg("Error getting location for %s", buff);
    2749       continue;
    2750     }
    2751 
    2752     numlocs=200;
    2753     ret=ZGetLocations(location, &numlocs);
    2754     if (ret==0) {
    2755       for (i=0; i<numlocs; i++) {
    2756         line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
    2757         tmp=short_zuser(buff);
    2758         sprintf(line, "%-10.10s %-24.24s %-12.12s  %20.20s\n",
    2759                 tmp,
    2760                 location[i].host,
    2761                 location[i].tty,
    2762                 location[i].time);
    2763         owl_fmtext_append_normal(&fm, line);
    2764         owl_free(tmp);
     2742    owl_fmtext_append_bold(&fm, "Zephyr users logged in:\n");
     2743   
     2744    while (fgets(buff, LINE, f)!=NULL) {
     2745      /* ignore comments, blank lines etc. */
     2746      if (buff[0]=='#') continue;
     2747      if (buff[0]=='\n') continue;
     2748      if (buff[0]=='\0') continue;
     2749     
     2750      /* strip the \n */
     2751      buff[strlen(buff)-1]='\0';
     2752     
     2753      /* ingore from # on */
     2754      tmp=strchr(buff, '#');
     2755      if (tmp) tmp[0]='\0';
     2756     
     2757      /* ingore from SPC */
     2758      tmp=strchr(buff, ' ');
     2759      if (tmp) tmp[0]='\0';
     2760     
     2761      /* stick on the local realm. */
     2762      if (!strchr(buff, '@')) {
     2763        strcat(buff, "@");
     2764        strcat(buff, ZGetRealm());
    27652765      }
    2766       if (numlocs>=200) {
    2767         owl_fmtext_append_normal(&fm, "Too many locations found for this user, truncating.\n");
     2766     
     2767      ret=ZLocateUser(buff, &numlocs, ZAUTH);
     2768      if (ret!=ZERR_NONE) {
     2769        owl_function_makemsg("Error getting location for %s", buff);
     2770        continue;
    27682771      }
    2769     }
    2770   }
    2771   fclose(f);
    2772 
     2772     
     2773      numlocs=200;
     2774      ret=ZGetLocations(location, &numlocs);
     2775      if (ret==0) {
     2776        for (i=0; i<numlocs; i++) {
     2777          line=malloc(strlen(location[i].host)+strlen(location[i].time)+strlen(location[i].tty)+100);
     2778          tmp=short_zuser(buff);
     2779          sprintf(line, "  %-10.10s %-24.24s %-12.12s  %20.20s\n",
     2780                  tmp,
     2781                  location[i].host,
     2782                  location[i].tty,
     2783                  location[i].time);
     2784          owl_fmtext_append_normal(&fm, line);
     2785          owl_free(tmp);
     2786        }
     2787        if (numlocs>=200) {
     2788          owl_fmtext_append_normal(&fm, "  Too many locations found for this user, truncating.\n");
     2789        }
     2790      }
     2791    }
     2792    fclose(f);
     2793    owl_free(ourfile);
     2794  }
     2795 
    27732796  owl_function_popless_fmtext(&fm);
    27742797  owl_fmtext_free(&fm);
    2775 
    2776   owl_free(ourfile);
    27772798}
    27782799
  • global.c

    rd09e5a1 raa5f725  
    9292  g->aim_loggedin=0;
    9393  g->aim_lastnop=0;
     94
     95  owl_buddylist_init(&(g->buddylist));
    9496}
    9597
     
    717719  return(1);
    718720}
     721
     722owl_buddylist *owl_global_get_buddylist(owl_global *g) {
     723  return(&(g->buddylist));
     724}
     725 
  • keys.c

    r440ce01 raa5f725  
    241241
    242242  BIND_CMD("i",   "info",             "");
    243   BIND_CMD("l",   "zlist",            "");
     243  BIND_CMD("l",   "blist",            "");
    244244  BIND_CMD("M",   "pop-message",      "");
    245245  BIND_CMD("T",   "delete trash",     "mark all 'trash' messages for deletion");
  • message.c

    r3abf28b raa5f725  
    579579 
    580580  owl_free(indent);
     581}
     582
     583/* For login direction == 0
     584 * For logout direction == 1
     585 */
     586void owl_message_create_aim_login(owl_message *m, int direction, char *screenname)
     587{
     588  owl_message_init(m);
     589  owl_message_set_body(m, "");
     590  owl_message_set_sender(m, screenname);
     591  owl_message_set_recipient(m, owl_global_get_aim_screenname(&g));
     592  owl_message_set_type_aim(m);
     593  owl_message_set_direction_in(m);
     594
     595  owl_fmtext_init_null(&(m->fmtext));
     596  owl_fmtext_append_normal(&(m->fmtext), OWL_TABSTR);
     597  if (direction==0) {
     598    owl_fmtext_append_bold(&(m->fmtext), "AIM LOGIN");
     599  } else if (direction==1) {
     600    owl_fmtext_append_bold(&(m->fmtext), "AIM LOGOUT");
     601  }
     602  owl_fmtext_append_normal(&(m->fmtext), " for ");
     603  owl_fmtext_append_normal(&(m->fmtext), screenname);
     604  owl_fmtext_append_normal(&(m->fmtext), "\n");
    581605}
    582606
  • owl.h

    rd09e5a1 raa5f725  
    350350  int       kpstackpos;         /* location in stack (-1 = none) */
    351351} owl_keyhandler;
     352
     353typedef struct _owl_buddylist {
     354  owl_list buddies;
     355} owl_buddylist;
     356
    352357
    353358typedef struct _owl_global {
     
    403408  int aim_loggedin;
    404409  char *aim_screenname;
     410  owl_buddylist buddylist;
    405411  owl_list messagequeue; /* for queueing up aim and other messages */
    406412} owl_global;
  • owl_prototypes.h

    r651560f raa5f725  
    2222extern void directim_requested(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args);
    2323
     24/* -------------------------------- buddylist.c -------------------------------- */
     25extern void owl_buddylist_init(owl_buddylist *b);
     26extern void owl_buddylist_oncoming(owl_buddylist *b, char *screenname);
     27extern void owl_buddylist_offgoing(owl_buddylist *b, char *screenname);
     28extern int owl_buddylist_get_size(owl_buddylist *b);
     29extern char *owl_buddylist_get_buddy(owl_buddylist *b, int n);
     30extern void owl_buddylist_clear(owl_buddylist *b);
     31
    2432/* -------------------------------- cmd.c -------------------------------- */
    2533extern int owl_cmddict_setup(owl_cmddict *cd);
     
    4553extern char *owl_command_help(int argc, char **argv, char *buff);
    4654extern char *owl_command_zlist(int argc, char **argv, char *buff);
     55extern char *owl_command_alist();
     56extern char *owl_command_blist();
    4757extern void owl_command_about();
    4858extern void owl_command_version();
     
    280290extern void owl_function_adminmsg(char *header, char *body);
    281291extern void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig);
    282 extern void owl_function_make_outgoing_aim(char *body, char *to);
     292extern int owl_function_make_outgoing_aim(char *body, char *to);
    283293extern void owl_function_zwrite_setup(char *line);
    284294extern void owl_function_aimwrite_setup(char *line);
     
    376386extern void owl_function_search_helper(int mode, int direction);
    377387extern char *owl_function_ztext_stylestrip(char *zt);
    378 extern void owl_function_zlist(char *file, int elapsed, int timesort);
     388extern void owl_function_buddylist(int aim, int zephyr, char *file);
    379389extern void owl_function_dump(char *filename);
    380390extern void owl_function_do_newmsgproc(void);
     
    479489extern owl_message *owl_global_messageuque_popmsg(owl_global *g);
    480490extern int owl_global_messagequeue_pending(owl_global *g);
     491extern owl_buddylist *owl_global_get_buddylist(owl_global *g);
    481492
    482493/* -------------------------------- help.c -------------------------------- */
     
    614625extern void owl_message_create_incoming_aim(owl_message *m, char *sender, char *recipient, char *text);
    615626extern void owl_message_create_outgoing_aim(owl_message *m, char *sender, char *recipient, char *text);
     627extern void owl_message_create_aim_login(owl_message *m, int direction, char *screenname);
    616628extern void owl_message_create_admin(owl_message *m, char *header, char *text);
    617629extern void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n);
Note: See TracChangeset for help on using the changeset viewer.