Changes in commands.c [987ff51:fa4f9c3]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r987ff51 rfa4f9c3 132 132 OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE, 133 133 "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"), 136 138 137 139 OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE, … … 280 282 "suppressed to be received again.\n\n" 281 283 "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"), 282 303 283 304 OWLCMD_VOID("info", owl_command_info, OWL_CTX_INTERACTIVE, … … 1867 1888 char *owl_command_aimwrite(int argc, char **argv, char *buff) 1868 1889 { 1869 char *newbuff; 1870 int i, j; 1890 char *newbuff, *recip, **myargv; 1891 int i, j, myargc; 1892 owl_message *m; 1871 1893 1872 1894 if (!owl_global_is_aimloggedin(&g)) { … … 1878 1900 owl_function_makemsg("Not enough arguments to the aimwrite command."); 1879 1901 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 } 1880 1952 } 1881 1953 … … 2142 2214 char *filename; 2143 2215 2144 filename=owl_ sprintf("%s/%s", owl_global_get_homedir(&g), OWL_STARTUP_FILE);2216 filename=owl_global_get_startupfile(&g); 2145 2217 owl_function_popless_file(filename); 2146 owl_free(filename);2147 2218 } else if (!strcmp(argv[1], "errors")) { 2148 2219 owl_function_showerrs(); … … 2294 2365 return NULL; 2295 2366 } 2296 2297 2367 2298 2368 void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type) … … 2345 2415 } 2346 2416 2417 char *owl_command_punt(int argc, char **argv, char *buff) 2418 { 2419 owl_command_punt_unpunt(argc, argv, buff, 0); 2420 return NULL; 2421 } 2422 2423 char *owl_command_unpunt(int argc, char **argv, char *buff) 2424 { 2425 owl_command_punt_unpunt(argc, argv, buff, 1); 2426 return NULL; 2427 } 2428 2429 void 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 2347 2463 char *owl_command_getview(int argc, char **argv, char *buff) 2348 2464 { … … 2469 2585 owl_message *m; 2470 2586 owl_view *v; 2587 char *cmd; 2471 2588 2472 2589 v = owl_global_get_current_view(&g); … … 2487 2604 return; 2488 2605 } 2489 c har * cmd = owl_message_get_attribute_value(m, "yescommand");2606 cmd = owl_message_get_attribute_value(m, "yescommand"); 2490 2607 if(!cmd) { 2491 2608 owl_function_error("No yes command!"); … … 2502 2619 owl_message *m; 2503 2620 owl_view *v; 2621 char *cmd; 2504 2622 2505 2623 v = owl_global_get_current_view(&g); … … 2520 2638 return; 2521 2639 } 2522 c har * cmd = owl_message_get_attribute_value(m, "nocommand");2640 cmd = owl_message_get_attribute_value(m, "nocommand"); 2523 2641 if(!cmd) { 2524 2642 owl_function_error("No no command!");
Note: See TracChangeset
for help on using the changeset viewer.