AmendHub

Download:

jcs

/

subtext

/

amendments

/

251

session: Add 'b' as a shortcut to first board, 'n' to mail->new

These letter->function assignments really need to be made dynamic
so main menu changes don't require source code changes.

jcs made amendment 251 over 2 years ago
--- mail.c Mon Aug 1 16:10:36 2022 +++ mail.c Thu Sep 15 16:03:43 2022 @@ -122,7 +122,7 @@ mail_menu(struct session *s) { '<', "<", "Previous page of messages" }, { 'l', "Ll", "List mail messages" }, { '>', ">", "Next page of messages" }, - { 'm', "MmCc", "Compose new mail message" }, + { 'm', "MmNn", "Compose new mail message" }, { 'q', "QqXx", "Return to main menu" }, { '?', "?", "Show this help menu" }, }; @@ -247,6 +247,13 @@ mail_compose(struct session *s, char *initial_to, char struct mail_message msg = { 0 }; char *to_username = NULL, *tmp; char c; + + if (!s->user) { + session_printf(s, "Mail is not available to guests.\r\n" + "Please create an account first.\r\n"); + session_flush(s); + return; + } if (initial_to) to_username = xstrdup(initial_to, "mail_compose"); --- session.c Wed Sep 14 16:26:26 2022 +++ session.c Thu Sep 15 16:05:30 2022 @@ -227,6 +227,11 @@ get_another_char: /* TODO: make letter->command dynamic from a resource */ switch (c) { + case 'b': + case 'B': + /* first (or only) board */ + board_show(s, 1); + break; case 'c': case 'C': /* chat */ @@ -252,6 +257,11 @@ get_another_char: case 'm': case 'M': mail_menu(s); + break; + case 'n': + case 'N': + /* send mail */ + mail_compose(s, NULL, NULL, NULL); break; case 'o': case 'O':