Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r987ff51 rfa4f9c3  
    132132  OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,
    133133              "send an AIM message",
    134               "aimzwrite <user>",
    135               "Send an aim message to a user.\n"),
     134              "aimwrite <user> [-m <message...>]",
     135              "Send an aim message to a user.\n\n"
     136              "The following options are available:\n\n"
     137              "-m    Specifies a message to send without prompting.\n"),
    136138
    137139  OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE,
     
    280282              "suppressed to be received again.\n\n"
    281283              "SEE ALSO:  zpunt, show zpunts\n"),
     284
     285  OWLCMD_ARGS("punt", owl_command_punt, OWL_CTX_ANY,
     286              "suppress an arbitrary filter",
     287              "punt <filter-name>",
     288              "punt <filter-text (multiple words)>\n"
     289              "The punt command will supress message to the specified\n"
     290              "filter\n\n"
     291              "SEE ALSO:  unpunt, zpunt, show zpunts\n"),
     292
     293  OWLCMD_ARGS("unpunt", owl_command_unpunt, OWL_CTX_ANY,
     294              "remove an entry from the punt list",
     295              "zpunt <filter-name>\n"
     296              "zpunt <filter-text>\n"
     297              "zpunt <number>\n",
     298              "The unpunt command will remove an entry from the puntlist.\n"
     299              "The first two forms correspond to the first two forms of the :punt\n"
     300              "command. The latter allows you to remove a specific entry from the\n"
     301              "the list (see :show zpunts)\n\n"
     302              "SEE ALSO:  punt, zpunt, zunpunt, show zpunts\n"),
    282303
    283304  OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE,
     
    18671888char *owl_command_aimwrite(int argc, char **argv, char *buff)
    18681889{
    1869   char *newbuff;
    1870   int i, j;
     1890  char *newbuff, *recip, **myargv;
     1891  int i, j, myargc;
     1892  owl_message *m;
    18711893 
    18721894  if (!owl_global_is_aimloggedin(&g)) {
     
    18781900    owl_function_makemsg("Not enough arguments to the aimwrite command.");
    18791901    return(NULL);
     1902  }
     1903
     1904  myargv=argv;
     1905  if (argc<0) {
     1906    owl_function_error("Unbalanced quotes in aimwrite");
     1907    return(NULL);
     1908  }
     1909  myargc=argc;
     1910  if (myargc && *(myargv[0])!='-') {
     1911    myargc--;
     1912    myargv++;
     1913  }
     1914  while (myargc) {
     1915    if (!strcmp(myargv[0], "-m")) {
     1916      if (myargc<2) {
     1917        break;
     1918      }
     1919
     1920      /* Once we have -m, gobble up everything else on the line */
     1921      myargv++;
     1922      myargc--;
     1923      newbuff=owl_malloc(1);
     1924      newbuff=owl_strdup("");
     1925      while (myargc) {
     1926        newbuff=realloc(newbuff, strlen(newbuff)+strlen(myargv[0])+5);
     1927        strcat(newbuff, myargv[0]);
     1928        strcat(newbuff, " ");
     1929        myargc--;
     1930        myargv++;
     1931      }
     1932      newbuff[strlen(newbuff)-1]='\0'; /* remove last space */
     1933
     1934      recip=owl_malloc(strlen(argv[0])+5);
     1935      sprintf(recip, "%s ", argv[1]);
     1936      owl_aim_send_im(recip, newbuff);
     1937      m=owl_function_make_outgoing_aim(newbuff, recip);
     1938      if (m) {
     1939          owl_global_messagequeue_addmsg(&g, m);
     1940      } else {
     1941          owl_function_error("Could not create outgoing AIM message");
     1942      }
     1943
     1944      owl_free(recip);
     1945      owl_free(newbuff);
     1946      return(NULL);
     1947    } else {
     1948      /* we don't care */
     1949      myargv++;
     1950      myargc--;
     1951    }
    18801952  }
    18811953
     
    21422214    char *filename;
    21432215   
    2144     filename=owl_sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);
     2216    filename=owl_global_get_startupfile(&g);
    21452217    owl_function_popless_file(filename);
    2146     owl_free(filename);
    21472218  } else if (!strcmp(argv[1], "errors")) {
    21482219    owl_function_showerrs();
     
    22942365  return NULL;
    22952366}
    2296 
    22972367
    22982368void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
     
    23452415}
    23462416
     2417char *owl_command_punt(int argc, char **argv, char *buff)
     2418{
     2419  owl_command_punt_unpunt(argc, argv, buff, 0);
     2420  return NULL;
     2421}
     2422
     2423char *owl_command_unpunt(int argc, char **argv, char *buff)
     2424{
     2425  owl_command_punt_unpunt(argc, argv, buff, 1);
     2426  return NULL;
     2427}
     2428
     2429void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
     2430{
     2431  owl_list * fl;
     2432  owl_filter * f;
     2433  char * text;
     2434  int i;
     2435
     2436  fl = owl_global_get_puntlist(&g);
     2437  if(argc == 1) {
     2438    owl_function_show_zpunts();
     2439  }
     2440
     2441  if(argc == 2) {
     2442    /* Handle :unpunt <number> */
     2443    if(unpunt && (i=atoi(argv[1])) !=0) {
     2444      i--;      /* Accept 1-based indexing */
     2445      if(i < owl_list_get_size(fl)) {
     2446        f = (owl_filter*)owl_list_get_element(fl, i);
     2447        owl_list_remove_element(fl, i);
     2448        owl_filter_free(f);
     2449        return;
     2450      } else {
     2451        owl_function_error("No such filter number: %d", i+1);
     2452      }
     2453    }
     2454    text = owl_sprintf("filter %s", argv[1]);
     2455  } else {
     2456    text = skiptokens(buff, 1);
     2457  }
     2458
     2459  owl_function_punt(text, unpunt);
     2460}
     2461
     2462
    23472463char *owl_command_getview(int argc, char **argv, char *buff)
    23482464{
     
    24692585  owl_message *m;
    24702586  owl_view *v;
     2587  char *cmd;
    24712588
    24722589  v = owl_global_get_current_view(&g);
     
    24872604    return;
    24882605  }
    2489   char * cmd = owl_message_get_attribute_value(m, "yescommand");
     2606  cmd = owl_message_get_attribute_value(m, "yescommand");
    24902607  if(!cmd) {
    24912608    owl_function_error("No yes command!");
     
    25022619  owl_message *m;
    25032620  owl_view *v;
     2621  char *cmd;
    25042622
    25052623  v = owl_global_get_current_view(&g);
     
    25202638    return;
    25212639  }
    2522   char * cmd = owl_message_get_attribute_value(m, "nocommand");
     2640  cmd = owl_message_get_attribute_value(m, "nocommand");
    25232641  if(!cmd) {
    25242642    owl_function_error("No no command!");
Note: See TracChangeset for help on using the changeset viewer.