Changeset 77beb3c for commands.c


Ignore:
Timestamp:
Aug 5, 2017, 11:21:53 PM (7 years ago)
Author:
Jason Gross <jasongross9@gmail.com>
Branches:
master
Children:
e6f21ea
Parents:
ec36247
git-author:
Jason Gross <jgross@mit.edu> (05/26/13 12:50:13)
git-committer:
Jason Gross <jasongross9@gmail.com> (08/05/17 23:21:53)
Message:
Add a -f flag to :flush-logs

This allows us to bypass any troublesome messages in the queue.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rec36247 r77beb3c  
    488488              "SEE ALSO: aaway, zaway"),
    489489
    490   OWLCMD_VOID("flush-logs", owl_command_flushlogs, OWL_CTX_ANY,
     490  OWLCMD_ARGS("flush-logs", owl_command_flushlogs, OWL_CTX_ANY,
    491491              "flush the queue of messages waiting to be logged",
    492               "",
     492              "flush-logs [-f | --force]",
    493493              "If BarnOwl failed to log a file, this command tells\n"
    494494              "BarnOwl to try logging the messages that have since\n"
    495               "come in, and to resume logging normally."),
     495              "come in, and to resume logging normally.\n"
     496              "\n"
     497              "Normally, if logging any of these messages fails,\n"
     498              "that message is added to the queue of messages waiting\n"
     499              "to be logged, and any new messages are deferred until\n"
     500              "the next :flush-logs.  If the --force flag is passed,\n"
     501              "any messages on the queue which cannot successfully be\n"
     502              "logged are dropped, and BarnOwl will resume logging\n"
     503              "normally."),
    496504
    497505  OWLCMD_ARGS("load-subs", owl_command_loadsubs, OWL_CTX_ANY,
     
    14441452}
    14451453
    1446 void owl_command_flushlogs(void)
    1447 {
    1448   owl_log_flush_logs();
     1454char *owl_command_flushlogs(int argc, const char *const *argv, const char *buff)
     1455{
     1456  if (argc == 1) {
     1457    owl_log_flush_logs(false);
     1458  } else if (argc == 2) {
     1459    if (!strcmp(argv[1], "-f") || !strcmp(argv[1], "--force")) {
     1460      owl_log_flush_logs(true);
     1461    } else {
     1462      owl_function_makemsg("Invalid flag to flush-logs: %s", argv[1]);
     1463    }
     1464  } else {
     1465    owl_function_makemsg("Wrong number of arguments for flush-logs.");
     1466  }
     1467  return NULL;
    14491468}
    14501469
Note: See TracChangeset for help on using the changeset viewer.