Index: commands.c
===================================================================
--- commands.c	(revision 03ad7b27d6fd11940f12abb4d57ff2f89e24e9a6)
+++ commands.c	(revision cf83b7a15ef998b48ca0aa69dae69a963b365dc1)
@@ -77,4 +77,9 @@
 	      "start-command [initial-value]",
 	      "Initializes the command field to initial-value."),
+
+  OWLCMD_ARGS("start-question", owl_command_start_question, OWL_CTX_INTERACTIVE,
+	      "prompts the user to enter a response to some question",
+	      "start-command <question>",
+	      ""),
 
   OWLCMD_ARGS("alias", owl_command_alias, OWL_CTX_ANY,
@@ -758,4 +763,9 @@
 		  "", ""),
 
+  OWLCMD_VOID_CTX("editresponse:done", owl_command_editresponse_done, 
+		  OWL_CTX_EDITRESPONSE,
+		  "completes the response to a question",
+		  "", ""),
+
   OWLCMD_VOID_CTX("editmulti:move-up-line", owl_editwin_key_up, 
 		  OWL_CTX_EDITMULTI,
@@ -835,12 +845,15 @@
 };
 
-void owl_command_info() {
+void owl_command_info()
+{
   owl_function_info();
 }
 
-void owl_command_nop() {
-}
-
-char *owl_command_help(int argc, char **argv, char *buff) {
+void owl_command_nop()
+{
+}
+
+char *owl_command_help(int argc, char **argv, char *buff)
+{
   if (argc!=2) {
     owl_help();
@@ -852,5 +865,6 @@
 }
 
-char *owl_command_zlist(int argc, char **argv, char *buff) {
+char *owl_command_zlist(int argc, char **argv, char *buff)
+{
   int elapsed=0, timesort=0;
   char *file=NULL;
@@ -884,24 +898,29 @@
 }
 
-char *owl_command_alist() {
+char *owl_command_alist()
+{
   owl_function_buddylist(1, 0, NULL);
   return(NULL);
 }
 
-char *owl_command_blist() {
+char *owl_command_blist()
+{
   owl_function_buddylist(1, 1, NULL);
   return(NULL);
 }
 
-char *owl_command_toggleoneline() {
+char *owl_command_toggleoneline()
+{
   owl_function_toggleoneline();
   return(NULL);
 }
 
-void owl_command_about() {
+void owl_command_about()
+{
   owl_function_about();
 }
 
-void owl_command_version() {
+void owl_command_version()
+{
   char buff[1024];
 
@@ -1014,5 +1033,6 @@
 }
 
-char *owl_command_dump(int argc, char **argv, char *buff) {
+char *owl_command_dump(int argc, char **argv, char *buff)
+{
   if (argc!=2) {
     owl_function_makemsg("usage: dump <filename>");
@@ -1024,5 +1044,6 @@
 }
 
-char *owl_command_next(int argc, char **argv, char *buff) {
+char *owl_command_next(int argc, char **argv, char *buff)
+{
   char *filter=NULL;
   int skip_deleted=0, last_if_none=0;
@@ -1053,5 +1074,6 @@
 }
 
-char *owl_command_prev(int argc, char **argv, char *buff) {
+char *owl_command_prev(int argc, char **argv, char *buff)
+{
   char *filter=NULL;
   int skip_deleted=0, first_if_none=0;
@@ -1082,5 +1104,6 @@
 }
 
-char *owl_command_smartnarrow(int argc, char **argv, char *buff) {
+char *owl_command_smartnarrow(int argc, char **argv, char *buff)
+{
   char *filtname = NULL;
 
@@ -1099,5 +1122,6 @@
 }
 
-char *owl_command_smartfilter(int argc, char **argv, char *buff) {
+char *owl_command_smartfilter(int argc, char **argv, char *buff)
+{
   char *filtname = NULL;
 
@@ -1112,39 +1136,48 @@
 }
 
-void owl_command_expunge() {
+void owl_command_expunge()
+{
   owl_function_expunge();
 }
 
-void owl_command_first() {
+void owl_command_first()
+{
   owl_global_set_rightshift(&g, 0);
   owl_function_firstmsg();
 }
 
-void owl_command_last() {
+void owl_command_last()
+{
   owl_function_lastmsg();
 }
 
-void owl_command_resize() {
+void owl_command_resize()
+{
   owl_function_resize();
 }
 
-void owl_command_redisplay() {
+void owl_command_redisplay()
+{
   owl_function_full_redisplay();
   owl_global_set_needrefresh(&g);
 }
 
-void owl_command_shift_right() {
+void owl_command_shift_right()
+{
   owl_function_shift_right();
 }
 
-void owl_command_shift_left() {
+void owl_command_shift_left()
+{
   owl_function_shift_left();
 }
 
-void owl_command_unsuball() {
+void owl_command_unsuball()
+{
   owl_function_unsuball();
 }
 
-char *owl_command_loadsubs(int argc, char **argv, char *buff) {
+char *owl_command_loadsubs(int argc, char **argv, char *buff)
+{
   if (argc == 2) {
     owl_function_loadsubs(argv[1]);
@@ -1159,5 +1192,6 @@
 
 
-char *owl_command_loadloginsubs(int argc, char **argv, char *buff) {
+char *owl_command_loadloginsubs(int argc, char **argv, char *buff)
+{
   if (argc == 2) {
     owl_function_loadloginsubs(argv[1]);
@@ -1171,16 +1205,25 @@
 }
 
-void owl_command_suspend() {
+void owl_command_suspend()
+{
   owl_function_suspend();
 }
 
-char *owl_command_start_command(int argc, char **argv, char *buff) {
+char *owl_command_start_command(int argc, char **argv, char *buff)
+{
   buff = skiptokens(buff, 1);
   owl_function_start_command(buff);
-  return NULL;
-}
-
-char *owl_command_zaway(int argc, char **argv, char *buff) {
-  
+  return(NULL);
+}
+
+char *owl_command_start_question(int argc, char **argv, char *buff)
+{
+  buff = skiptokens(buff, 1);
+  owl_function_start_question(buff);
+  return(NULL);
+}
+
+char *owl_command_zaway(int argc, char **argv, char *buff)
+{
   if ((argc==1) ||
       ((argc==2) && !strcmp(argv[1], "on"))) {
@@ -1207,5 +1250,6 @@
 
 
-char *owl_command_set(int argc, char **argv, char *buff) {
+char *owl_command_set(int argc, char **argv, char *buff)
+{
   char *var, *val;
   int  silent=0;
@@ -1237,5 +1281,6 @@
 }
 
-char *owl_command_unset(int argc, char **argv, char *buff) {
+char *owl_command_unset(int argc, char **argv, char *buff)
+{
   char *var, *val;
   int  silent=0;
@@ -1256,5 +1301,6 @@
 }
 
-char *owl_command_print(int argc, char **argv, char *buff) {
+char *owl_command_print(int argc, char **argv, char *buff)
+{
   char *var;
   char valbuff[1024];
@@ -1280,29 +1326,36 @@
 
 
-char *owl_command_exec(int argc, char **argv, char *buff) {
+char *owl_command_exec(int argc, char **argv, char *buff)
+{
   return owl_function_exec(argc, argv, buff, 0);
 }
 
-char *owl_command_pexec(int argc, char **argv, char *buff) {
+char *owl_command_pexec(int argc, char **argv, char *buff)
+{
   return owl_function_exec(argc, argv, buff, 1);
 }
 
-char *owl_command_aexec(int argc, char **argv, char *buff) {
+char *owl_command_aexec(int argc, char **argv, char *buff)
+{
   return owl_function_exec(argc, argv, buff, 2);
 }
 
-char *owl_command_perl(int argc, char **argv, char *buff) {
+char *owl_command_perl(int argc, char **argv, char *buff)
+{
   return owl_function_perl(argc, argv, buff, 0);
 }
 
-char *owl_command_pperl(int argc, char **argv, char *buff) {
+char *owl_command_pperl(int argc, char **argv, char *buff)
+{
   return owl_function_perl(argc, argv, buff, 1);
 }
 
-char *owl_command_aperl(int argc, char **argv, char *buff) {
+char *owl_command_aperl(int argc, char **argv, char *buff)
+{
   return owl_function_perl(argc, argv, buff, 2);
 }
 
-char *owl_command_multi(int argc, char **argv, char *buff) {
+char *owl_command_multi(int argc, char **argv, char *buff)
+{
   char *lastrv = NULL, *newbuff;
   char **commands;
@@ -1338,5 +1391,6 @@
 
 
-char *owl_command_alias(int argc, char **argv, char *buff) {
+char *owl_command_alias(int argc, char **argv, char *buff)
+{
   if (argc < 3) {
     owl_function_makemsg("Invalid arguments to 'alias' command.");
@@ -1349,5 +1403,6 @@
 
 
-char *owl_command_bindkey(int argc, char **argv, char *buff) {
+char *owl_command_bindkey(int argc, char **argv, char *buff)
+{
   owl_keymap *km;
   int ret;
@@ -1372,9 +1427,11 @@
 }
 
-void owl_command_quit() {
+void owl_command_quit()
+{
   owl_function_quit();
 }
 
-char *owl_command_debug(int argc, char **argv, char *buff) {
+char *owl_command_debug(int argc, char **argv, char *buff)
+{
   if (argc<2) {
     owl_function_makemsg("Need at least one argument to debug command");
@@ -1391,5 +1448,6 @@
 }
 
-char *owl_command_term(int argc, char **argv, char *buff) {
+char *owl_command_term(int argc, char **argv, char *buff)
+{
   if (argc<2) {
     owl_function_makemsg("Need at least one argument to the term command");
@@ -1407,5 +1465,6 @@
 }
 
-char *owl_command_zlog(int argc, char **argv, char *buff) {
+char *owl_command_zlog(int argc, char **argv, char *buff)
+{
   if ((argc<2) || (argc>3)) {
     owl_function_makemsg("Wrong number of arguments for zlog command");
@@ -1431,10 +1490,12 @@
 
 
-void owl_command_zlog_out(void) {
+void owl_command_zlog_out(void)
+{
   owl_zephyr_zlog_out();
 }
 
 
-char *owl_command_subscribe(int argc, char **argv, char *buff) {
+char *owl_command_subscribe(int argc, char **argv, char *buff)
+{
   char *recip="";
   int temp=0;
@@ -1476,5 +1537,6 @@
 
 
-char *owl_command_unsubscribe(int argc, char **argv, char *buff) {
+char *owl_command_unsubscribe(int argc, char **argv, char *buff)
+{
   char *recip="";
   int temp=0;
@@ -1515,5 +1577,6 @@
 }
 
-char *owl_command_echo(int argc, char **argv, char *buff) {
+char *owl_command_echo(int argc, char **argv, char *buff)
+{
   buff = skiptokens(buff, 1);
   owl_function_popless_text(buff);
@@ -1521,13 +1584,16 @@
 }
 
-void owl_command_getsubs() {
+void owl_command_getsubs(void)
+{
   owl_function_getsubs();
 }
 
-void owl_command_status() {
+void owl_command_status(void)
+{
   owl_function_status();
 }
 
-char *owl_command_zwrite(int argc, char **argv, char *buff) {
+char *owl_command_zwrite(int argc, char **argv, char *buff)
+{
   owl_zwrite z;
 
@@ -1549,5 +1615,6 @@
 }
 
-char *owl_command_aimwrite(int argc, char **argv, char *buff) {
+char *owl_command_aimwrite(int argc, char **argv, char *buff)
+{
   char *newbuff;
   int i, j;
@@ -1577,5 +1644,6 @@
 }
 
-char *owl_command_zcrypt(int argc, char **argv, char *buff) {
+char *owl_command_zcrypt(int argc, char **argv, char *buff)
+{
   owl_zwrite z;
 
@@ -1598,5 +1666,6 @@
 }
 
-char *owl_command_reply(int argc, char **argv, char *buff) {
+char *owl_command_reply(int argc, char **argv, char *buff)
+{
   int edit=0;
   
@@ -1623,10 +1692,12 @@
 }
 
-char *owl_command_filter(int argc, char **argv, char *buff) {
+char *owl_command_filter(int argc, char **argv, char *buff)
+{
   owl_function_create_filter(argc, argv);
   return NULL;
 }
 
-char *owl_command_zlocate(int argc, char **argv, char *buff) {
+char *owl_command_zlocate(int argc, char **argv, char *buff)
+{
   int auth;
   
@@ -1654,5 +1725,6 @@
 }
 
-char *owl_command_view(int argc, char **argv, char *buff) {
+char *owl_command_view(int argc, char **argv, char *buff)
+{
 
   /* Backwards compatability has made this kind of complicated:
@@ -1738,6 +1810,6 @@
 
 
-char *owl_command_show(int argc, char **argv, char *buff) {
-
+char *owl_command_show(int argc, char **argv, char *buff)
+{
   if (argc<2) {
     owl_function_help_for_command("show");
@@ -1795,5 +1867,6 @@
 }
 
-char *owl_command_viewclass(int argc, char **argv, char *buff) {
+char *owl_command_viewclass(int argc, char **argv, char *buff)
+{
   char *filtname;
   if (argc!=2) {
@@ -1807,5 +1880,6 @@
 }
 
-char *owl_command_viewuser(int argc, char **argv, char *buff) {
+char *owl_command_viewuser(int argc, char **argv, char *buff)
+{
   char *filtname;
   if (argc!=2) {
@@ -1820,13 +1894,16 @@
 
 
-void owl_command_pop_message(void) {
+void owl_command_pop_message(void)
+{
   owl_function_curmsg_to_popwin();
 }
 
-void owl_command_openurl(void) {
+void owl_command_openurl(void)
+{
   owl_function_openurl();
 }
 
-char *owl_command_delete(int argc, char **argv, char *buff) {
+char *owl_command_delete(int argc, char **argv, char *buff)
+{
   int move_after = 1;
 
@@ -1861,5 +1938,6 @@
 }
 
-char *owl_command_undelete(int argc, char **argv, char *buff) {
+char *owl_command_undelete(int argc, char **argv, char *buff)
+{
   int move_after = 1;
 
@@ -1889,9 +1967,11 @@
 }
 
-void owl_command_beep() {
+void owl_command_beep()
+{
   owl_function_beep();
 }
 
-char *owl_command_colorview(int argc, char **argv, char *buff) {
+char *owl_command_colorview(int argc, char **argv, char *buff)
+{
   if (argc!=2) {
     owl_function_makemsg("Wrong number of arguments to colorview command");
@@ -1902,10 +1982,12 @@
 }
 
-char *owl_command_zpunt(int argc, char **argv, char *buff) {
+char *owl_command_zpunt(int argc, char **argv, char *buff)
+{
   owl_command_zpunt_and_zunpunt(argc, argv, 0);
   return NULL;
 }
 
-char *owl_command_zunpunt(int argc, char **argv, char *buff) {
+char *owl_command_zunpunt(int argc, char **argv, char *buff)
+{
   owl_command_zpunt_and_zunpunt(argc, argv, 1);
   return NULL;
@@ -1913,5 +1995,6 @@
 
 
-void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type) {
+void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
+{
   /* if type==0 then zpunt
    * if type==1 then zunpunt
@@ -1949,5 +2032,6 @@
 }
 
-char *owl_command_smartzpunt(int argc, char **argv, char *buff) {
+char *owl_command_smartzpunt(int argc, char **argv, char *buff)
+{
   if (argc == 1) {
     owl_function_smartzpunt(0);
@@ -1960,5 +2044,6 @@
 }
 
-char *owl_command_getview(int argc, char **argv, char *buff) {
+char *owl_command_getview(int argc, char **argv, char *buff)
+{
   char *filtname;
   if (argc != 1) {
@@ -1971,5 +2056,6 @@
 }
 
-char *owl_command_getvar(int argc, char **argv, char *buff) {
+char *owl_command_getvar(int argc, char **argv, char *buff)
+{
   char tmpbuff[1024];
   if (argc != 2) {
@@ -1984,5 +2070,6 @@
 }
 
-char *owl_command_search(int argc, char **argv, char *buff) {
+char *owl_command_search(int argc, char **argv, char *buff)
+{
   int direction;
   char *buffstart;
@@ -2004,5 +2091,6 @@
 }
 
-char *owl_command_aimlogin(int argc, char **argv, char *buff) {
+char *owl_command_aimlogin(int argc, char **argv, char *buff)
+{
   int ret;
   
@@ -2031,5 +2119,6 @@
 }
 
-char *owl_command_aimlogout(int argc, char **argv, char *buff) {
+char *owl_command_aimlogout(int argc, char **argv, char *buff)
+{
   /* clear the buddylist */
   owl_buddylist_clear(owl_global_get_buddylist(&g));
@@ -2043,5 +2132,6 @@
 /*********************************************************************/
 
-void owl_command_edit_cancel(owl_editwin *e) {
+void owl_command_edit_cancel(owl_editwin *e)
+{
   owl_history *hist;
 
@@ -2057,7 +2147,10 @@
   owl_global_set_typwin_inactive(&g);
   owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
-}
-
-void owl_command_edit_history_prev(owl_editwin *e) {
+
+  owl_function_activate_keymap("recv");
+}
+
+void owl_command_edit_history_prev(owl_editwin *e)
+{
   owl_history *hist;
   char *ptr;
@@ -2079,5 +2172,6 @@
 }
 
-void owl_command_edit_history_next(owl_editwin *e) {
+void owl_command_edit_history_next(owl_editwin *e)
+{
   owl_history *hist;
   char *ptr;
@@ -2095,5 +2189,6 @@
 }
 
-char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff) {
+char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff)
+{
   buff = skiptokens(buff, 1);
   owl_editwin_insert_string(e, buff);
@@ -2103,5 +2198,6 @@
 }
 
-void owl_command_editline_done(owl_editwin *e) {
+void owl_command_editline_done(owl_editwin *e)
+{
   owl_history *hist=owl_editwin_get_history(e);
   char *rv, *cmd;
@@ -2124,5 +2220,20 @@
 }
 
-void owl_command_editmulti_done(owl_editwin *e) {
+
+void owl_command_editresponse_done(owl_editwin *e)
+{
+  owl_global_set_response(&g, owl_editwin_get_text(e));
+
+  owl_global_set_typwin_inactive(&g);
+  owl_editwin_fullclear(e);
+  wnoutrefresh(owl_editwin_get_curswin(e));
+  owl_global_set_needrefresh(&g);
+
+  owl_function_makemsg("Thank you");
+}
+
+
+void owl_command_editmulti_done(owl_editwin *e)
+{
   owl_history *hist=owl_editwin_get_history(e);
 
@@ -2138,5 +2249,6 @@
 }
 
-void owl_command_editmulti_done_or_delete(owl_editwin *e) {
+void owl_command_editmulti_done_or_delete(owl_editwin *e)
+{
   if (owl_editwin_is_at_end(e)) {
     owl_command_editmulti_done(e);
@@ -2151,5 +2263,6 @@
 /*********************************************************************/
 
-void owl_command_popless_quit(owl_viewwin *vw) {
+void owl_command_popless_quit(owl_viewwin *vw)
+{
   owl_popwin_close(owl_global_get_popwin(&g));
   owl_viewwin_free(vw);
