Changeset 952bb256


Ignore:
Timestamp:
Dec 22, 2003, 11:25:16 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:
9854278
Parents:
2de4f20
Message:
Added the 'aim search' command.  The popup on callback may be
  dangerous, should switch to an admin msg for results, or add a
  new event queue
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rb0430a6 r952bb256  
    11$Id$
    22
     32.1.1-pre-2
     4        Added the 'aim search' command.  The popup on callback may be
     5          dangerous, should switch to an admin msg for results, or add a
     6          new event queue
     7       
    382.1.1-pre-1
    49        Only print forced AIM logout message once.
  • aim.c

    rc8735aa r952bb256  
    280280}
    281281
     282void owl_aim_search(char *email)
     283{
     284  int ret;
     285
     286  owl_function_debugmsg("owl_aim_search: doing search for %s", email);
     287  ret=aim_search_address(owl_global_get_aimsess(&g),
     288                         aim_getconn_type(owl_global_get_aimsess(&g), AIM_CONN_TYPE_BOS),
     289                         email);
     290
     291  if (ret) owl_function_error("owl_aim_search: aim_search_address returned %i", ret);
     292}
     293
    282294
    283295int owl_aim_set_awaymsg(char *msg)
     
    571583  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE,         faimtest_parse_ratechange, 0);
    572584  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL,               faimtest_parse_evilnotify, 0);
     585
    573586  aim_conn_addhandler(sess, bosconn, 0x000a,         0x0001,                        faimtest_parse_searcherror, 0);
    574587  aim_conn_addhandler(sess, bosconn, 0x000a,         0x0003,                        faimtest_parse_searchreply, 0);
     588
     589  /*
     590  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, faimtest_parse_searcherror, 0);
     591  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, faimtest_parse_searchreply, 0);
     592  */
     593 
    575594  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR,              faimtest_parse_msgerr, 0);
    576595  aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO,           faimtest_parse_userinfo, 0);
     
    18221841  char *address, *SNs;
    18231842  int num, i;
     1843  owl_list list;
    18241844 
    18251845  va_start(ap, fr);
     
    18281848  SNs = va_arg(ap, char *);
    18291849  va_end(ap);
     1850
     1851  owl_list_create(&list);
    18301852 
    18311853  owl_function_debugmsg("faimtest_parse_searchreply: E-Mail Search Results for %s: ", address);
    1832  
    1833   for(i = 0; i < num; i++) {
     1854  for (i=0; i<num; i++) {
    18341855    owl_function_debugmsg("  %s", &SNs[i*(MAXSNLEN+1)]);
    1835   }
    1836  
    1837   return 1;
     1856    owl_list_append_element(&list, &SNs[i*(MAXSNLEN+1)]);
     1857  }
     1858  owl_function_aimsearch_results(address, &list);
     1859  owl_list_free_simple(&list);
     1860  return(1);
    18381861}
    18391862
     
    18461869  address = va_arg(ap, char *);
    18471870  va_end(ap);
    1848  
     1871
     1872  owl_function_error("No results searching for %s", address);
    18491873  owl_function_debugmsg("faimtest_parse_searcherror: E-Mail Search Results for %s: No Results or Invalid Email\n", address);
    18501874 
    1851   return 1;
     1875  return(1);
    18521876}
    18531877
  • commands.c

    r2674412 r952bb256  
    237237              "source <filename>",
    238238              "Execute the owl commands in <filename>.\n"),
     239
     240  OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE,
     241              "AIM specific commands",
     242              "aim search <email>",
     243              ""),
    239244
    240245  OWLCMD_ARGS("addbuddy", owl_command_addbuddy, OWL_CTX_INTERACTIVE,
     
    961966  sprintf(buff, "Owl version %s", OWL_VERSION_STRING);
    962967  owl_function_makemsg(buff);
     968}
     969
     970char *owl_command_aim(int argc, char **argv, char *buff)
     971{
     972  if (argc<2) {
     973    owl_function_makemsg("not enough arguments to aim command");
     974    return(NULL);
     975  }
     976
     977  if (!strcmp(argv[1], "search")) {
     978    if (argc!=3) {
     979      owl_function_makemsg("not enough arguments to aim search command");
     980      return(NULL);
     981    }
     982    owl_aim_search(argv[2]);
     983  } else {
     984    owl_function_makemsg("unknown subcommand '%s' for aim command");
     985    return(NULL);
     986  }
     987  return(NULL);
    963988}
    964989
  • functions.c

    r2de4f20 r952bb256  
    34263426#endif
    34273427}
     3428
     3429void owl_function_aimsearch_results(char *email, owl_list *namelist)
     3430{
     3431  owl_fmtext fm;
     3432  int i, j;
     3433
     3434  owl_fmtext_init_null(&fm);
     3435  owl_fmtext_append_normal(&fm, "AIM screennames associated with ");
     3436  owl_fmtext_append_normal(&fm, email);
     3437  owl_fmtext_append_normal(&fm, ":\n");
     3438
     3439  j=owl_list_get_size(namelist);
     3440  for (i=0; i<j; i++) {
     3441    owl_fmtext_append_normal(&fm, "  ");
     3442    owl_fmtext_append_normal(&fm, owl_list_get_element(namelist, i));
     3443    owl_fmtext_append_normal(&fm, "\n");
     3444  }
     3445
     3446  owl_function_popless_fmtext(&fm);
     3447  owl_fmtext_free(&fm);
     3448}
  • owl.h

    r5a95b69 r952bb256  
    2020static const char owl_h_fileIdent[] = "$Id$";
    2121
    22 #define OWL_VERSION         2.1.1-pre-1
    23 #define OWL_VERSION_STRING "2.1.1-pre-1"
     22#define OWL_VERSION         2.1.1-pre-2
     23#define OWL_VERSION_STRING "2.1.1-pre-2"
    2424
    2525/* Feature that is being tested to redirect stderr through a pipe.
Note: See TracChangeset for help on using the changeset viewer.