Changeset 2527615


Ignore:
Timestamp:
Oct 12, 2002, 11:14:41 AM (19 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:
b12c219
Parents:
d023c25
Message:
The 'zlocate' command can now handle multiple users
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rd023c25 r2527615  
    44        Outgoing messages now go through the config for formatting
    55        Zaway now makes an outgoing message, instead of an admin message
     6        The 'zlocate' command can now handle multiple users
    67       
    781.2.6
  • commands.c

    r2adaf1d r2527615  
    366366  OWLCMD_ARGS("zlocate", owl_command_zlocate, OWL_CTX_INTERACTIVE,
    367367              "locate a user",
    368               "zlocate [-d] <user>",
    369               "Performs a zlocate on a user and puts the result into\n"
    370               "a popwin.  If -d is specified, does not authenticate\n"
     368              "zlocate [-d] <user> ...",
     369              "Performs a zlocate on one ore more users and puts the result\n"
     370              "int a popwin.  If -d is specified, does not authenticate\n"
    371371              "the lookup request.\n"),
    372372 
     
    13351335
    13361336char *owl_command_zlocate(int argc, char **argv, char *buff) {
    1337   if (argc==2) {
    1338     owl_function_zlocate(argv[1], 1);
    1339   } else if (argc==3) {
    1340     if (!strcmp(argv[1], "-d")) {
    1341       owl_function_zlocate(argv[2], 0);
     1337  int auth;
     1338 
     1339  if (argc<2) {
     1340    owl_function_makemsg("Too few arguments for zlocate command");
     1341    return NULL;
     1342  }
     1343
     1344  auth=1;
     1345  if (!strcmp(argv[1], "-d")) {
     1346    if (argc>2) {
     1347      auth=0;
     1348      argc--;
     1349      argv++;
    13421350    } else {
    1343       owl_function_makemsg("Invalid option to the zlocate command");
     1351      owl_function_makemsg("Missing arguments for zlocate command");
    13441352      return NULL;
    13451353    }
    1346   } else {
    1347     owl_function_makemsg("Wrong number of arguments for zlocate command");
    1348     return NULL;
    1349   }
     1354  }
     1355
     1356  argc--;
     1357  argv++;
     1358  owl_function_zlocate(argc, argv, auth);
    13501359  return NULL;
    13511360}
  • functions.c

    rb45293f r2527615  
    15881588}
    15891589
    1590 void owl_function_zlocate(char *user, int auth) {
    1591   char buff[LINE], myuser[LINE];
    1592   char *ptr;
    1593 
    1594   strcpy(myuser, user);
    1595   ptr=strchr(myuser, '@');
    1596   if (!ptr) {
    1597     strcat(myuser, "@");
    1598     strcat(myuser, ZGetRealm());
    1599   }
    1600 
    1601   owl_zephyr_zlocate(myuser, buff, auth);
    1602   owl_function_popless_text(buff);
     1590void owl_function_zlocate(int argc, char **argv, int auth) {
     1591  owl_fmtext fm;
     1592  char *ptr, buff[LINE];
     1593  int i;
     1594
     1595  owl_fmtext_init_null(&fm);
     1596
     1597  for (i=0; i<argc; i++) {
     1598    ptr=long_zuser(argv[i]);
     1599    owl_zephyr_zlocate(ptr, buff, auth);
     1600    owl_fmtext_append_normal(&fm, buff);
     1601    owl_free(ptr);
     1602  }
     1603
     1604  owl_function_popless_fmtext(&fm);
     1605  owl_fmtext_free(&fm);
    16031606}
    16041607
  • zephyr.c

    rd023c25 r2527615  
    384384
    385385  if (numlocs==0) {
    386     strcpy(out, "Hidden or not logged-in\n");
     386    myuser=short_zuser(user);
     387    sprintf(out, "%s: Hidden or not logged-in\n", myuser);
     388    owl_free(myuser);
    387389    return;
    388390  }
Note: See TracChangeset for help on using the changeset viewer.