Changeset b950088 for commands.c


Ignore:
Timestamp:
Jun 29, 2002, 11:55:06 AM (18 years ago)
Author:
Erik Nygren <nygren@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:
855ebe7
Parents:
61d27fb
Message:
* Added --no-move option to delete command.
        In particular, delete-and-always-move-down may now
	be implemented with
	'( delete --no-move ; next --skip-deleted )'.
* Folded the nextmsg and prevmsg commands and functions together into
        one command which takes arguments.
	Added '--filter <name>' option (eg, for next_personal),
	'--skip-deleted' option, and
	'--last-if-none'/'--first-if-none' options.
	Help updated accordingly.
	In particular, the 'personal' view is now used
	for 'next personal'.
* Updated examples/owlconf.erik with the above.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r1aee7d9 rb950088  
    193193              "Scrolls up if <numlines> is negative, else scrolls down.\n"),
    194194
    195   OWLCMD_VOID("next", owl_command_next, OWL_CTX_INTERACTIVE,
    196               "move the pointer to the next message", "", ""),
     195  OWLCMD_ARGS("next", owl_command_next, OWL_CTX_INTERACTIVE,
     196              "move the pointer to the next message",
     197              "recv:next [ --filter <name> ] [ --skip-deleted ] [ --last-if-none ]",
     198              "Moves the pointer to the next message in the current view.\n"
     199              "If --filter is specified, will only consider messages in\n"
     200              "the filter <name>.\n"
     201              "If --skip-deleted is specified, deleted messages will\n"
     202              "be skipped.\n"
     203              "If --last-if-none is specified, will stop at last message\n"
     204              "in the view if no other suitable messages are found.\n"),
    197205  OWLCMD_ALIAS("recv:next", "next"),
    198206
    199   OWLCMD_VOID("prev", owl_command_prev, OWL_CTX_INTERACTIVE,
    200               "move the pointer to the previous message", "", ""),
     207  OWLCMD_ARGS("prev", owl_command_prev, OWL_CTX_INTERACTIVE,
     208              "move the pointer to the previous message",
     209              "recv:prev [ --filter <name> ] [ --skip-deleted ] [ --first-if-none ]",
     210              "Moves the pointer to the next message in the current view.\n"
     211              "If --filter is specified, will only consider messages in\n"
     212              "the filter <name>.\n"
     213              "If --skip-deleted is specified, deleted messages will\n"
     214              "be skipped.\n"
     215              "If --first-if-none is specified, will stop at first message\n"
     216              "in the view if no other suitable messages are found.\n"),
    201217  OWLCMD_ALIAS("recv:prev", "prev"),
    202218
    203   OWLCMD_VOID("next-notdel", owl_command_next_notdeleted, OWL_CTX_INTERACTIVE,
    204               "move the pointer to the next non-deleted message", "", ""),
    205   OWLCMD_ALIAS("recv:next-notdel", "next-notdel"),
    206 
    207   OWLCMD_VOID("prev-notdel", owl_command_prev_notdeleted, OWL_CTX_INTERACTIVE,
    208               "move the pointer to the previous non-deleted message", "", ""),
    209   OWLCMD_ALIAS("recv:prev-notdel", "prev-notdel"),
    210 
    211   OWLCMD_VOID("recv:next-personal", owl_function_next_personal,
    212               OWL_CTX_INTERACTIVE,
    213               "move the pointer to the next personal message", "", ""),
    214 
    215   OWLCMD_VOID("recv:prev-personal", owl_function_prev_personal,
    216               OWL_CTX_INTERACTIVE,
    217               "move the pointer to the previous personal message", "", ""),
     219  OWLCMD_ALIAS("recv:next-notdel", "recv:next --skip-deleted --last-if-none"),
     220  OWLCMD_ALIAS("next-notdel",      "recv:next --skip-deleted --last-if-none"),
     221
     222  OWLCMD_ALIAS("recv:prev-notdel", "recv:prev --skip-deleted --first-if-none"),
     223  OWLCMD_ALIAS("prev-notdel",      "recv:prev --skip-deleted --first-if-none"),
     224
     225  OWLCMD_ALIAS("recv:next-personal", "recv:next --filter personal"),
     226
     227  OWLCMD_ALIAS("recv:prev-personal", "recv:prev --filter personal"),
    218228
    219229  OWLCMD_VOID("first", owl_command_first, OWL_CTX_INTERACTIVE,
     
    417427  OWLCMD_ARGS("delete", owl_command_delete, OWL_CTX_INTERACTIVE,
    418428              "mark a message for deletion",
    419               "delete [ -id msgid ]\n"
     429              "delete [ -id msgid ] [ --no-move ]\n"
    420430              "delete view\n"
    421431              "delete trash",
     
    423433              "for deletion.  Otherwise the message with the given message\n"
    424434              "id is marked for deltion.\n"
     435              "If '--no-move' is specified, don't move after deletion.\n"
    425436              "If 'trash' is specified, deletes all trash/auto messages\n"
    426437              "in the current view.\n"
     
    431442  OWLCMD_ARGS("undelete", owl_command_undelete, OWL_CTX_INTERACTIVE,
    432443              "unmark a message for deletion",
    433               "undelete [ -id msgid ]\n"
     444              "undelete [ -id msgid ] [ --no-move ]\n"
    434445              "undelete view",
    435446              "If no message id is specified the current message is\n"
    436447              "unmarked for deletion.  Otherwise the message with the\n"
    437448              "given message id is marked for undeltion.\n"
     449              "If '--no-move' is specified, don't move after deletion.\n"
    438450              "If 'view' is specified, undeletes all messages\n"
    439451              "in the current view.\n"),
     
    649661}
    650662
    651 void owl_command_next() {
    652   owl_function_nextmsg();
    653 }
    654 
    655 void owl_command_prev() {
    656   owl_function_prevmsg();
    657 }
    658 
    659 void owl_command_next_notdeleted() {
    660   owl_function_nextmsg_notdeleted();
    661 }
    662 
    663 void owl_command_prev_notdeleted() {
    664   owl_function_prevmsg_notdeleted();
     663char *owl_command_next(int argc, char **argv, char *buff) {
     664  char *filter=NULL;
     665  int skip_deleted=0, last_if_none=0;
     666  while (argc>1) {
     667    if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) {
     668      skip_deleted=1;
     669      argc-=1; argv+=1;
     670    } else if (argc>=1 && !strcmp(argv[1], "--last-if-none")) {
     671      last_if_none=1;
     672      argc-=1; argv+=1;
     673    } else if (argc>=2 && !strcmp(argv[1], "--filter")) {
     674      filter = argv[2];
     675      argc-=2; argv+=2;
     676    } else {
     677      owl_function_makemsg("Invalid arguments to command 'next'.");
     678      return(NULL);
     679    }
     680  }
     681  owl_function_nextmsg_full(filter, skip_deleted, last_if_none);
     682  return(NULL);
     683}
     684
     685char *owl_command_prev(int argc, char **argv, char *buff) {
     686  char *filter=NULL;
     687  int skip_deleted=0, first_if_none=0;
     688  while (argc>1) {
     689    if (argc>=1 && !strcmp(argv[1], "--skip-deleted")) {
     690      skip_deleted=1;
     691      argc-=1; argv+=1;
     692    } else if (argc>=1 && !strcmp(argv[1], "--first-if-none")) {
     693      first_if_none=1;
     694      argc-=1; argv+=1;
     695    } else if (argc>=2 && !strcmp(argv[1], "--filter")) {
     696      filter = argv[2];
     697      argc-=2; argv+=2;
     698    } else {
     699      owl_function_makemsg("Invalid arguments to command 'prev'.");
     700      return(NULL);
     701    }
     702  }
     703  owl_function_prevmsg_full(filter, skip_deleted, first_if_none);
     704  return(NULL);
    665705}
    666706
     
    11701210
    11711211char *owl_command_delete(int argc, char **argv, char *buff) {
     1212  int move_after = 1;
     1213
     1214  if (!strcmp(argv[1], "--no-move")) {
     1215    move_after = 0;
     1216    argc--;
     1217    argv++;
     1218  }
     1219
    11721220  if (argc==1) {
    1173     owl_function_deletecur();
     1221    owl_function_deletecur(move_after);
    11741222    return NULL;
    11751223  }
     
    11951243
    11961244char *owl_command_undelete(int argc, char **argv, char *buff) {
     1245  int move_after = 1;
     1246
     1247  if (!strcmp(argv[1], "--no-move")) {
     1248    move_after = 0;
     1249    argc--;
     1250    argv++;
     1251  }
     1252
    11971253  if (argc==1) {
    1198     owl_function_undeletecur();
     1254    owl_function_undeletecur(move_after);
    11991255    return NULL;
    12001256  }
Note: See TracChangeset for help on using the changeset viewer.