Changeset cf83b7a for commands.c


Ignore:
Timestamp:
Jun 30, 2003, 6:12:40 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:
453bd70
Parents:
c9334b1
Message:
Started adding code to do question/response stuff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r03ad7b2 rcf83b7a  
    7777              "start-command [initial-value]",
    7878              "Initializes the command field to initial-value."),
     79
     80  OWLCMD_ARGS("start-question", owl_command_start_question, OWL_CTX_INTERACTIVE,
     81              "prompts the user to enter a response to some question",
     82              "start-command <question>",
     83              ""),
    7984
    8085  OWLCMD_ARGS("alias", owl_command_alias, OWL_CTX_ANY,
     
    758763                  "", ""),
    759764
     765  OWLCMD_VOID_CTX("editresponse:done", owl_command_editresponse_done,
     766                  OWL_CTX_EDITRESPONSE,
     767                  "completes the response to a question",
     768                  "", ""),
     769
    760770  OWLCMD_VOID_CTX("editmulti:move-up-line", owl_editwin_key_up,
    761771                  OWL_CTX_EDITMULTI,
     
    835845};
    836846
    837 void owl_command_info() {
     847void owl_command_info()
     848{
    838849  owl_function_info();
    839850}
    840851
    841 void owl_command_nop() {
    842 }
    843 
    844 char *owl_command_help(int argc, char **argv, char *buff) {
     852void owl_command_nop()
     853{
     854}
     855
     856char *owl_command_help(int argc, char **argv, char *buff)
     857{
    845858  if (argc!=2) {
    846859    owl_help();
     
    852865}
    853866
    854 char *owl_command_zlist(int argc, char **argv, char *buff) {
     867char *owl_command_zlist(int argc, char **argv, char *buff)
     868{
    855869  int elapsed=0, timesort=0;
    856870  char *file=NULL;
     
    884898}
    885899
    886 char *owl_command_alist() {
     900char *owl_command_alist()
     901{
    887902  owl_function_buddylist(1, 0, NULL);
    888903  return(NULL);
    889904}
    890905
    891 char *owl_command_blist() {
     906char *owl_command_blist()
     907{
    892908  owl_function_buddylist(1, 1, NULL);
    893909  return(NULL);
    894910}
    895911
    896 char *owl_command_toggleoneline() {
     912char *owl_command_toggleoneline()
     913{
    897914  owl_function_toggleoneline();
    898915  return(NULL);
    899916}
    900917
    901 void owl_command_about() {
     918void owl_command_about()
     919{
    902920  owl_function_about();
    903921}
    904922
    905 void owl_command_version() {
     923void owl_command_version()
     924{
    906925  char buff[1024];
    907926
     
    10141033}
    10151034
    1016 char *owl_command_dump(int argc, char **argv, char *buff) {
     1035char *owl_command_dump(int argc, char **argv, char *buff)
     1036{
    10171037  if (argc!=2) {
    10181038    owl_function_makemsg("usage: dump <filename>");
     
    10241044}
    10251045
    1026 char *owl_command_next(int argc, char **argv, char *buff) {
     1046char *owl_command_next(int argc, char **argv, char *buff)
     1047{
    10271048  char *filter=NULL;
    10281049  int skip_deleted=0, last_if_none=0;
     
    10531074}
    10541075
    1055 char *owl_command_prev(int argc, char **argv, char *buff) {
     1076char *owl_command_prev(int argc, char **argv, char *buff)
     1077{
    10561078  char *filter=NULL;
    10571079  int skip_deleted=0, first_if_none=0;
     
    10821104}
    10831105
    1084 char *owl_command_smartnarrow(int argc, char **argv, char *buff) {
     1106char *owl_command_smartnarrow(int argc, char **argv, char *buff)
     1107{
    10851108  char *filtname = NULL;
    10861109
     
    10991122}
    11001123
    1101 char *owl_command_smartfilter(int argc, char **argv, char *buff) {
     1124char *owl_command_smartfilter(int argc, char **argv, char *buff)
     1125{
    11021126  char *filtname = NULL;
    11031127
     
    11121136}
    11131137
    1114 void owl_command_expunge() {
     1138void owl_command_expunge()
     1139{
    11151140  owl_function_expunge();
    11161141}
    11171142
    1118 void owl_command_first() {
     1143void owl_command_first()
     1144{
    11191145  owl_global_set_rightshift(&g, 0);
    11201146  owl_function_firstmsg();
    11211147}
    11221148
    1123 void owl_command_last() {
     1149void owl_command_last()
     1150{
    11241151  owl_function_lastmsg();
    11251152}
    11261153
    1127 void owl_command_resize() {
     1154void owl_command_resize()
     1155{
    11281156  owl_function_resize();
    11291157}
    11301158
    1131 void owl_command_redisplay() {
     1159void owl_command_redisplay()
     1160{
    11321161  owl_function_full_redisplay();
    11331162  owl_global_set_needrefresh(&g);
    11341163}
    11351164
    1136 void owl_command_shift_right() {
     1165void owl_command_shift_right()
     1166{
    11371167  owl_function_shift_right();
    11381168}
    11391169
    1140 void owl_command_shift_left() {
     1170void owl_command_shift_left()
     1171{
    11411172  owl_function_shift_left();
    11421173}
    11431174
    1144 void owl_command_unsuball() {
     1175void owl_command_unsuball()
     1176{
    11451177  owl_function_unsuball();
    11461178}
    11471179
    1148 char *owl_command_loadsubs(int argc, char **argv, char *buff) {
     1180char *owl_command_loadsubs(int argc, char **argv, char *buff)
     1181{
    11491182  if (argc == 2) {
    11501183    owl_function_loadsubs(argv[1]);
     
    11591192
    11601193
    1161 char *owl_command_loadloginsubs(int argc, char **argv, char *buff) {
     1194char *owl_command_loadloginsubs(int argc, char **argv, char *buff)
     1195{
    11621196  if (argc == 2) {
    11631197    owl_function_loadloginsubs(argv[1]);
     
    11711205}
    11721206
    1173 void owl_command_suspend() {
     1207void owl_command_suspend()
     1208{
    11741209  owl_function_suspend();
    11751210}
    11761211
    1177 char *owl_command_start_command(int argc, char **argv, char *buff) {
     1212char *owl_command_start_command(int argc, char **argv, char *buff)
     1213{
    11781214  buff = skiptokens(buff, 1);
    11791215  owl_function_start_command(buff);
    1180   return NULL;
    1181 }
    1182 
    1183 char *owl_command_zaway(int argc, char **argv, char *buff) {
    1184  
     1216  return(NULL);
     1217}
     1218
     1219char *owl_command_start_question(int argc, char **argv, char *buff)
     1220{
     1221  buff = skiptokens(buff, 1);
     1222  owl_function_start_question(buff);
     1223  return(NULL);
     1224}
     1225
     1226char *owl_command_zaway(int argc, char **argv, char *buff)
     1227{
    11851228  if ((argc==1) ||
    11861229      ((argc==2) && !strcmp(argv[1], "on"))) {
     
    12071250
    12081251
    1209 char *owl_command_set(int argc, char **argv, char *buff) {
     1252char *owl_command_set(int argc, char **argv, char *buff)
     1253{
    12101254  char *var, *val;
    12111255  int  silent=0;
     
    12371281}
    12381282
    1239 char *owl_command_unset(int argc, char **argv, char *buff) {
     1283char *owl_command_unset(int argc, char **argv, char *buff)
     1284{
    12401285  char *var, *val;
    12411286  int  silent=0;
     
    12561301}
    12571302
    1258 char *owl_command_print(int argc, char **argv, char *buff) {
     1303char *owl_command_print(int argc, char **argv, char *buff)
     1304{
    12591305  char *var;
    12601306  char valbuff[1024];
     
    12801326
    12811327
    1282 char *owl_command_exec(int argc, char **argv, char *buff) {
     1328char *owl_command_exec(int argc, char **argv, char *buff)
     1329{
    12831330  return owl_function_exec(argc, argv, buff, 0);
    12841331}
    12851332
    1286 char *owl_command_pexec(int argc, char **argv, char *buff) {
     1333char *owl_command_pexec(int argc, char **argv, char *buff)
     1334{
    12871335  return owl_function_exec(argc, argv, buff, 1);
    12881336}
    12891337
    1290 char *owl_command_aexec(int argc, char **argv, char *buff) {
     1338char *owl_command_aexec(int argc, char **argv, char *buff)
     1339{
    12911340  return owl_function_exec(argc, argv, buff, 2);
    12921341}
    12931342
    1294 char *owl_command_perl(int argc, char **argv, char *buff) {
     1343char *owl_command_perl(int argc, char **argv, char *buff)
     1344{
    12951345  return owl_function_perl(argc, argv, buff, 0);
    12961346}
    12971347
    1298 char *owl_command_pperl(int argc, char **argv, char *buff) {
     1348char *owl_command_pperl(int argc, char **argv, char *buff)
     1349{
    12991350  return owl_function_perl(argc, argv, buff, 1);
    13001351}
    13011352
    1302 char *owl_command_aperl(int argc, char **argv, char *buff) {
     1353char *owl_command_aperl(int argc, char **argv, char *buff)
     1354{
    13031355  return owl_function_perl(argc, argv, buff, 2);
    13041356}
    13051357
    1306 char *owl_command_multi(int argc, char **argv, char *buff) {
     1358char *owl_command_multi(int argc, char **argv, char *buff)
     1359{
    13071360  char *lastrv = NULL, *newbuff;
    13081361  char **commands;
     
    13381391
    13391392
    1340 char *owl_command_alias(int argc, char **argv, char *buff) {
     1393char *owl_command_alias(int argc, char **argv, char *buff)
     1394{
    13411395  if (argc < 3) {
    13421396    owl_function_makemsg("Invalid arguments to 'alias' command.");
     
    13491403
    13501404
    1351 char *owl_command_bindkey(int argc, char **argv, char *buff) {
     1405char *owl_command_bindkey(int argc, char **argv, char *buff)
     1406{
    13521407  owl_keymap *km;
    13531408  int ret;
     
    13721427}
    13731428
    1374 void owl_command_quit() {
     1429void owl_command_quit()
     1430{
    13751431  owl_function_quit();
    13761432}
    13771433
    1378 char *owl_command_debug(int argc, char **argv, char *buff) {
     1434char *owl_command_debug(int argc, char **argv, char *buff)
     1435{
    13791436  if (argc<2) {
    13801437    owl_function_makemsg("Need at least one argument to debug command");
     
    13911448}
    13921449
    1393 char *owl_command_term(int argc, char **argv, char *buff) {
     1450char *owl_command_term(int argc, char **argv, char *buff)
     1451{
    13941452  if (argc<2) {
    13951453    owl_function_makemsg("Need at least one argument to the term command");
     
    14071465}
    14081466
    1409 char *owl_command_zlog(int argc, char **argv, char *buff) {
     1467char *owl_command_zlog(int argc, char **argv, char *buff)
     1468{
    14101469  if ((argc<2) || (argc>3)) {
    14111470    owl_function_makemsg("Wrong number of arguments for zlog command");
     
    14311490
    14321491
    1433 void owl_command_zlog_out(void) {
     1492void owl_command_zlog_out(void)
     1493{
    14341494  owl_zephyr_zlog_out();
    14351495}
    14361496
    14371497
    1438 char *owl_command_subscribe(int argc, char **argv, char *buff) {
     1498char *owl_command_subscribe(int argc, char **argv, char *buff)
     1499{
    14391500  char *recip="";
    14401501  int temp=0;
     
    14761537
    14771538
    1478 char *owl_command_unsubscribe(int argc, char **argv, char *buff) {
     1539char *owl_command_unsubscribe(int argc, char **argv, char *buff)
     1540{
    14791541  char *recip="";
    14801542  int temp=0;
     
    15151577}
    15161578
    1517 char *owl_command_echo(int argc, char **argv, char *buff) {
     1579char *owl_command_echo(int argc, char **argv, char *buff)
     1580{
    15181581  buff = skiptokens(buff, 1);
    15191582  owl_function_popless_text(buff);
     
    15211584}
    15221585
    1523 void owl_command_getsubs() {
     1586void owl_command_getsubs(void)
     1587{
    15241588  owl_function_getsubs();
    15251589}
    15261590
    1527 void owl_command_status() {
     1591void owl_command_status(void)
     1592{
    15281593  owl_function_status();
    15291594}
    15301595
    1531 char *owl_command_zwrite(int argc, char **argv, char *buff) {
     1596char *owl_command_zwrite(int argc, char **argv, char *buff)
     1597{
    15321598  owl_zwrite z;
    15331599
     
    15491615}
    15501616
    1551 char *owl_command_aimwrite(int argc, char **argv, char *buff) {
     1617char *owl_command_aimwrite(int argc, char **argv, char *buff)
     1618{
    15521619  char *newbuff;
    15531620  int i, j;
     
    15771644}
    15781645
    1579 char *owl_command_zcrypt(int argc, char **argv, char *buff) {
     1646char *owl_command_zcrypt(int argc, char **argv, char *buff)
     1647{
    15801648  owl_zwrite z;
    15811649
     
    15981666}
    15991667
    1600 char *owl_command_reply(int argc, char **argv, char *buff) {
     1668char *owl_command_reply(int argc, char **argv, char *buff)
     1669{
    16011670  int edit=0;
    16021671 
     
    16231692}
    16241693
    1625 char *owl_command_filter(int argc, char **argv, char *buff) {
     1694char *owl_command_filter(int argc, char **argv, char *buff)
     1695{
    16261696  owl_function_create_filter(argc, argv);
    16271697  return NULL;
    16281698}
    16291699
    1630 char *owl_command_zlocate(int argc, char **argv, char *buff) {
     1700char *owl_command_zlocate(int argc, char **argv, char *buff)
     1701{
    16311702  int auth;
    16321703 
     
    16541725}
    16551726
    1656 char *owl_command_view(int argc, char **argv, char *buff) {
     1727char *owl_command_view(int argc, char **argv, char *buff)
     1728{
    16571729
    16581730  /* Backwards compatability has made this kind of complicated:
     
    17381810
    17391811
    1740 char *owl_command_show(int argc, char **argv, char *buff) {
    1741 
     1812char *owl_command_show(int argc, char **argv, char *buff)
     1813{
    17421814  if (argc<2) {
    17431815    owl_function_help_for_command("show");
     
    17951867}
    17961868
    1797 char *owl_command_viewclass(int argc, char **argv, char *buff) {
     1869char *owl_command_viewclass(int argc, char **argv, char *buff)
     1870{
    17981871  char *filtname;
    17991872  if (argc!=2) {
     
    18071880}
    18081881
    1809 char *owl_command_viewuser(int argc, char **argv, char *buff) {
     1882char *owl_command_viewuser(int argc, char **argv, char *buff)
     1883{
    18101884  char *filtname;
    18111885  if (argc!=2) {
     
    18201894
    18211895
    1822 void owl_command_pop_message(void) {
     1896void owl_command_pop_message(void)
     1897{
    18231898  owl_function_curmsg_to_popwin();
    18241899}
    18251900
    1826 void owl_command_openurl(void) {
     1901void owl_command_openurl(void)
     1902{
    18271903  owl_function_openurl();
    18281904}
    18291905
    1830 char *owl_command_delete(int argc, char **argv, char *buff) {
     1906char *owl_command_delete(int argc, char **argv, char *buff)
     1907{
    18311908  int move_after = 1;
    18321909
     
    18611938}
    18621939
    1863 char *owl_command_undelete(int argc, char **argv, char *buff) {
     1940char *owl_command_undelete(int argc, char **argv, char *buff)
     1941{
    18641942  int move_after = 1;
    18651943
     
    18891967}
    18901968
    1891 void owl_command_beep() {
     1969void owl_command_beep()
     1970{
    18921971  owl_function_beep();
    18931972}
    18941973
    1895 char *owl_command_colorview(int argc, char **argv, char *buff) {
     1974char *owl_command_colorview(int argc, char **argv, char *buff)
     1975{
    18961976  if (argc!=2) {
    18971977    owl_function_makemsg("Wrong number of arguments to colorview command");
     
    19021982}
    19031983
    1904 char *owl_command_zpunt(int argc, char **argv, char *buff) {
     1984char *owl_command_zpunt(int argc, char **argv, char *buff)
     1985{
    19051986  owl_command_zpunt_and_zunpunt(argc, argv, 0);
    19061987  return NULL;
    19071988}
    19081989
    1909 char *owl_command_zunpunt(int argc, char **argv, char *buff) {
     1990char *owl_command_zunpunt(int argc, char **argv, char *buff)
     1991{
    19101992  owl_command_zpunt_and_zunpunt(argc, argv, 1);
    19111993  return NULL;
     
    19131995
    19141996
    1915 void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type) {
     1997void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
     1998{
    19161999  /* if type==0 then zpunt
    19172000   * if type==1 then zunpunt
     
    19492032}
    19502033
    1951 char *owl_command_smartzpunt(int argc, char **argv, char *buff) {
     2034char *owl_command_smartzpunt(int argc, char **argv, char *buff)
     2035{
    19522036  if (argc == 1) {
    19532037    owl_function_smartzpunt(0);
     
    19602044}
    19612045
    1962 char *owl_command_getview(int argc, char **argv, char *buff) {
     2046char *owl_command_getview(int argc, char **argv, char *buff)
     2047{
    19632048  char *filtname;
    19642049  if (argc != 1) {
     
    19712056}
    19722057
    1973 char *owl_command_getvar(int argc, char **argv, char *buff) {
     2058char *owl_command_getvar(int argc, char **argv, char *buff)
     2059{
    19742060  char tmpbuff[1024];
    19752061  if (argc != 2) {
     
    19842070}
    19852071
    1986 char *owl_command_search(int argc, char **argv, char *buff) {
     2072char *owl_command_search(int argc, char **argv, char *buff)
     2073{
    19872074  int direction;
    19882075  char *buffstart;
     
    20042091}
    20052092
    2006 char *owl_command_aimlogin(int argc, char **argv, char *buff) {
     2093char *owl_command_aimlogin(int argc, char **argv, char *buff)
     2094{
    20072095  int ret;
    20082096 
     
    20312119}
    20322120
    2033 char *owl_command_aimlogout(int argc, char **argv, char *buff) {
     2121char *owl_command_aimlogout(int argc, char **argv, char *buff)
     2122{
    20342123  /* clear the buddylist */
    20352124  owl_buddylist_clear(owl_global_get_buddylist(&g));
     
    20432132/*********************************************************************/
    20442133
    2045 void owl_command_edit_cancel(owl_editwin *e) {
     2134void owl_command_edit_cancel(owl_editwin *e)
     2135{
    20462136  owl_history *hist;
    20472137
     
    20572147  owl_global_set_typwin_inactive(&g);
    20582148  owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
    2059 }
    2060 
    2061 void owl_command_edit_history_prev(owl_editwin *e) {
     2149
     2150  owl_function_activate_keymap("recv");
     2151}
     2152
     2153void owl_command_edit_history_prev(owl_editwin *e)
     2154{
    20622155  owl_history *hist;
    20632156  char *ptr;
     
    20792172}
    20802173
    2081 void owl_command_edit_history_next(owl_editwin *e) {
     2174void owl_command_edit_history_next(owl_editwin *e)
     2175{
    20822176  owl_history *hist;
    20832177  char *ptr;
     
    20952189}
    20962190
    2097 char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff) {
     2191char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff)
     2192{
    20982193  buff = skiptokens(buff, 1);
    20992194  owl_editwin_insert_string(e, buff);
     
    21032198}
    21042199
    2105 void owl_command_editline_done(owl_editwin *e) {
     2200void owl_command_editline_done(owl_editwin *e)
     2201{
    21062202  owl_history *hist=owl_editwin_get_history(e);
    21072203  char *rv, *cmd;
     
    21242220}
    21252221
    2126 void owl_command_editmulti_done(owl_editwin *e) {
     2222
     2223void owl_command_editresponse_done(owl_editwin *e)
     2224{
     2225  owl_global_set_response(&g, owl_editwin_get_text(e));
     2226
     2227  owl_global_set_typwin_inactive(&g);
     2228  owl_editwin_fullclear(e);
     2229  wnoutrefresh(owl_editwin_get_curswin(e));
     2230  owl_global_set_needrefresh(&g);
     2231
     2232  owl_function_makemsg("Thank you");
     2233}
     2234
     2235
     2236void owl_command_editmulti_done(owl_editwin *e)
     2237{
    21272238  owl_history *hist=owl_editwin_get_history(e);
    21282239
     
    21382249}
    21392250
    2140 void owl_command_editmulti_done_or_delete(owl_editwin *e) {
     2251void owl_command_editmulti_done_or_delete(owl_editwin *e)
     2252{
    21412253  if (owl_editwin_is_at_end(e)) {
    21422254    owl_command_editmulti_done(e);
     
    21512263/*********************************************************************/
    21522264
    2153 void owl_command_popless_quit(owl_viewwin *vw) {
     2265void owl_command_popless_quit(owl_viewwin *vw)
     2266{
    21542267  owl_popwin_close(owl_global_get_popwin(&g));
    21552268  owl_viewwin_free(vw);
Note: See TracChangeset for help on using the changeset viewer.