v0.0.3 - Update main menu bindings: DM on M and Todo on D
This commit is contained in:
24
src/main.c
24
src/main.c
@@ -10,8 +10,8 @@
|
||||
*/
|
||||
#define NT_VERSION_MAJOR 0
|
||||
#define NT_VERSION_MINOR 0
|
||||
#define NT_VERSION_PATCH 2
|
||||
#define NT_VERSION "v0.0.2"
|
||||
#define NT_VERSION_PATCH 3
|
||||
#define NT_VERSION "v0.0.3"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -88,11 +88,11 @@ void menu_main(void) {
|
||||
tui_print("^_F^:ollows");
|
||||
tui_print("^_K^:ind/event dump");
|
||||
tui_print("^_N^:otifications");
|
||||
tui_print("P^_o^:sts");
|
||||
tui_print("Li^_v^:e feeds");
|
||||
tui_print("Direct ^_m^:essage");
|
||||
tui_print("To^_d^:o");
|
||||
tui_print("D^_i^:ary");
|
||||
tui_print("^_B^:logs/posts");
|
||||
tui_print("^_L^:ive feeds");
|
||||
tui_print("^_M^:essage");
|
||||
tui_print("^_D^:odo");
|
||||
tui_print("^_J^:ournal");
|
||||
tui_print("^_A^:i");
|
||||
tui_print("^_E^:cash");
|
||||
tui_print("^_Q^:uit.");
|
||||
@@ -113,10 +113,6 @@ void menu_main(void) {
|
||||
}
|
||||
|
||||
switch (input[0]) {
|
||||
case 'l':
|
||||
case 'L':
|
||||
menu_login();
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
menu_write();
|
||||
@@ -145,10 +141,14 @@ void menu_main(void) {
|
||||
case 'K':
|
||||
menu_show_loaded_events();
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
case 'o':
|
||||
case 'O':
|
||||
menu_posts();
|
||||
break;
|
||||
case 'l':
|
||||
case 'L':
|
||||
case 'v':
|
||||
case 'V':
|
||||
menu_live();
|
||||
@@ -161,6 +161,8 @@ void menu_main(void) {
|
||||
case 'D':
|
||||
menu_todo();
|
||||
break;
|
||||
case 'j':
|
||||
case 'J':
|
||||
case 'i':
|
||||
case 'I':
|
||||
menu_diary();
|
||||
|
||||
@@ -605,22 +605,24 @@ void menu_ai(void) {
|
||||
tui_print("AI\n");
|
||||
tui_print("Model: %s", prefs.model ? prefs.model : "");
|
||||
tui_print("Endpoint: %s", prefs.endpoint ? prefs.endpoint : "");
|
||||
tui_print("1 - Chat");
|
||||
tui_print("2 - Choose model");
|
||||
tui_print("3 - Settings");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_C^:hat");
|
||||
tui_print("^_M^:odel");
|
||||
tui_print("^_S^:ettings");
|
||||
tui_print("^_B^:ack");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'b' || input[0] == 'B' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 'c' || input[0] == 'C') {
|
||||
ai_chat(&prefs);
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'm' || input[0] == 'M') {
|
||||
ai_choose_model(&prefs);
|
||||
} else if (input[0] == '3') {
|
||||
} else if (input[0] == 's' || input[0] == 'S') {
|
||||
ai_settings(&prefs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,17 +424,18 @@ void menu_diary(void) {
|
||||
tui_print("DIARY\n");
|
||||
tui_print("Today: %s", today_d);
|
||||
tui_print("Existing entry: %s", existing ? "yes" : "no");
|
||||
tui_print("1 - Edit today's entry");
|
||||
tui_print("2 - Browse past entries");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_E^:dit today's entry");
|
||||
tui_print("^_B^:rowse past entries");
|
||||
tui_print("^_Q^:uit");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'q' || input[0] == 'Q' ||
|
||||
input[0] == 'x' || input[0] == 'X') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 'e' || input[0] == 'E') {
|
||||
edited = editor_launch(existing ? existing : "");
|
||||
if (!edited) {
|
||||
tui_print("Edit canceled.");
|
||||
@@ -448,7 +449,7 @@ void menu_diary(void) {
|
||||
}
|
||||
free(edited);
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'b' || input[0] == 'B') {
|
||||
diary_browse_past();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,19 +459,21 @@ void menu_dm(void) {
|
||||
while (1) {
|
||||
tui_clear_screen();
|
||||
tui_print("DIRECT MESSAGE\n");
|
||||
tui_print("1 - Send DM (NIP-17)");
|
||||
tui_print("2 - Read inbox (kind 1059 + kind 4)");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_S^:end DM (NIP-17)");
|
||||
tui_print("^_R^:ead inbox (kind 1059 + kind 4)");
|
||||
tui_print("^_B^:ack");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'b' || input[0] == 'B' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 's' || input[0] == 'S') {
|
||||
menu_dm_send();
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'r' || input[0] == 'R') {
|
||||
menu_dm_read_inbox();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,28 +773,29 @@ void menu_ecash(void) {
|
||||
tui_print("ECASH WALLET\n");
|
||||
tui_print("Mints: %d", wallet.mint_count);
|
||||
tui_print("Proofs: %d", wallet.proof_count);
|
||||
tui_print("1 - Balance");
|
||||
tui_print("2 - Add mint");
|
||||
tui_print("3 - Remove mint");
|
||||
tui_print("4 - Receive token");
|
||||
tui_print("5 - Send token");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_B^:alance");
|
||||
tui_print("^_A^:dd mint");
|
||||
tui_print("^_R^:emove mint");
|
||||
tui_print("^_I^:mport token");
|
||||
tui_print("^_S^:end token");
|
||||
tui_print("^_X^:xit");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 'b' || input[0] == 'B') {
|
||||
ecash_show_balance(&wallet);
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'a' || input[0] == 'A') {
|
||||
ecash_add_mint_menu(&wallet);
|
||||
} else if (input[0] == '3') {
|
||||
} else if (input[0] == 'r' || input[0] == 'R') {
|
||||
ecash_remove_mint_menu(&wallet);
|
||||
} else if (input[0] == '4') {
|
||||
} else if (input[0] == 'i' || input[0] == 'I') {
|
||||
ecash_receive_token_menu(&wallet);
|
||||
} else if (input[0] == '5') {
|
||||
} else if (input[0] == 's' || input[0] == 'S') {
|
||||
ecash_send_token_menu(&wallet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ void menu_follows(void) {
|
||||
}
|
||||
|
||||
tui_print("\n\n");
|
||||
tui_print("P^_r^:ofile");
|
||||
tui_print("^_R^:efresh profile");
|
||||
tui_print("^_A^:dd follow");
|
||||
tui_print("^_D^:elete follow");
|
||||
tui_print("^_P^:ost changes and exit.");
|
||||
tui_print("E^_x^:it without saving");
|
||||
tui_print("^_X^:xit without saving");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
@@ -261,7 +261,8 @@ void menu_follows(void) {
|
||||
}
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
break;
|
||||
} else if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
} else if (input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,18 +253,20 @@ void menu_live(void) {
|
||||
while (1) {
|
||||
tui_clear_screen();
|
||||
tui_print("LIVE FEEDS\n");
|
||||
tui_print("1 - Follows feed");
|
||||
tui_print("2 - Mentions");
|
||||
tui_print("3 - Firehose");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_F^:ollows feed");
|
||||
tui_print("^_M^:entions");
|
||||
tui_print("^_G^:lobal firehose");
|
||||
tui_print("^_B^:ack");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'b' || input[0] == 'B' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 'f' || input[0] == 'F') {
|
||||
char **authors = NULL;
|
||||
int authors_count = 0;
|
||||
cJSON *filter_arr = NULL;
|
||||
@@ -312,14 +314,14 @@ void menu_live(void) {
|
||||
|
||||
cJSON_Delete(filter_arr);
|
||||
live_free_authors(authors, authors_count);
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'm' || input[0] == 'M') {
|
||||
char filter[512];
|
||||
snprintf(filter,
|
||||
sizeof(filter),
|
||||
"[{\"kinds\":[1],\"#p\":[\"%s\"],\"limit\":500}]",
|
||||
g_state.npub_hex);
|
||||
menu_live_run_filter("MENTIONS", filter);
|
||||
} else if (input[0] == '3') {
|
||||
} else if (input[0] == 'g' || input[0] == 'G') {
|
||||
char filter[128];
|
||||
snprintf(filter, sizeof(filter), "[{\"kinds\":[1],\"limit\":500}]");
|
||||
menu_live_run_filter("FIREHOSE", filter);
|
||||
|
||||
@@ -517,10 +517,15 @@ static void posts_kind_menu(const char *title, const char *filter_json) {
|
||||
}
|
||||
|
||||
tui_print("");
|
||||
tui_print("Commands: v <n> (view), e <n> (edit), d <n> (delete), x (back)");
|
||||
tui_print("^_V^:iew <n>");
|
||||
tui_print("^_E^:dit <n>");
|
||||
tui_print("^_D^:elete <n>");
|
||||
tui_print("^_B^:ack");
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'b' || input[0] == 'B' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -553,37 +558,39 @@ void menu_posts(void) {
|
||||
while (1) {
|
||||
tui_clear_screen();
|
||||
tui_print("POSTS\n");
|
||||
tui_print("1 - Private blog (kind 30024)");
|
||||
tui_print("2 - Public blog (kind 30023)");
|
||||
tui_print("3 - Encrypted data (kind 30078)");
|
||||
tui_print("4 - All posts");
|
||||
tui_print("x - Back");
|
||||
tui_print("^_S^:ecret blog (kind 30024)");
|
||||
tui_print("^_P^:ublic blog (kind 30023)");
|
||||
tui_print("^_E^:ncrypted data (kind 30078)");
|
||||
tui_print("^_A^:ll posts");
|
||||
tui_print("^_B^:ack");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'b' || input[0] == 'B' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input[0] == '1') {
|
||||
if (input[0] == 's' || input[0] == 'S') {
|
||||
snprintf(filter,
|
||||
sizeof(filter),
|
||||
"{\"authors\":[\"%s\"],\"kinds\":[30024],\"limit\":200}",
|
||||
g_state.npub_hex);
|
||||
posts_kind_menu("PRIVATE BLOG", filter);
|
||||
} else if (input[0] == '2') {
|
||||
} else if (input[0] == 'p' || input[0] == 'P') {
|
||||
snprintf(filter,
|
||||
sizeof(filter),
|
||||
"{\"authors\":[\"%s\"],\"kinds\":[30023],\"limit\":200}",
|
||||
g_state.npub_hex);
|
||||
posts_kind_menu("PUBLIC BLOG", filter);
|
||||
} else if (input[0] == '3') {
|
||||
} else if (input[0] == 'e' || input[0] == 'E') {
|
||||
snprintf(filter,
|
||||
sizeof(filter),
|
||||
"{\"authors\":[\"%s\"],\"kinds\":[30078],\"limit\":200}",
|
||||
g_state.npub_hex);
|
||||
posts_kind_menu("ENCRYPTED DATA", filter);
|
||||
} else if (input[0] == '4') {
|
||||
} else if (input[0] == 'a' || input[0] == 'A') {
|
||||
snprintf(filter,
|
||||
sizeof(filter),
|
||||
"{\"authors\":[\"%s\"],\"kinds\":[30023,30024,30078],\"limit\":300}",
|
||||
|
||||
@@ -45,7 +45,7 @@ void menu_profile(void) {
|
||||
tui_print("\n");
|
||||
tui_print("^_M^:odify account");
|
||||
tui_print("^_P^:ost changes and exit.");
|
||||
tui_print("E^_x^:it without saving");
|
||||
tui_print("^_X^:xit without saving");
|
||||
|
||||
tui_get_line(">", menu_sel, (int)sizeof(menu_sel));
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ void menu_relays(void) {
|
||||
tui_print("^_D^:elete relay");
|
||||
tui_print("^_M^:odify relay");
|
||||
tui_print("^_P^:ost changes and exit.");
|
||||
tui_print("E^_x^:it without saving");
|
||||
tui_print("^_X^:xit without saving");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
@@ -257,7 +257,8 @@ void menu_relays(void) {
|
||||
}
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
break;
|
||||
} else if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
} else if (input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,16 +452,17 @@ void menu_todo(void) {
|
||||
while (1) {
|
||||
tui_clear_screen();
|
||||
todo_show_list(items, count);
|
||||
tui_print("a - Add item");
|
||||
tui_print("c - Complete/toggle item");
|
||||
tui_print("d - Delete item");
|
||||
tui_print("r - Reorder (swap two)");
|
||||
tui_print("p - Post/save changes");
|
||||
tui_print("x - Exit without saving");
|
||||
tui_print("^_A^:dd item");
|
||||
tui_print("^_C^:omplete/toggle item");
|
||||
tui_print("^_D^:elete item");
|
||||
tui_print("^_R^:eorder (swap two)");
|
||||
tui_print("^_P^:ost/save changes");
|
||||
tui_print("^_X^:xit without saving");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
if (input[0] == 'x' || input[0] == 'X' || input[0] == 'q' || input[0] == 'Q') {
|
||||
if (input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void menu_write(void) {
|
||||
tui_print("^_T^:weet it");
|
||||
tui_print("^_B^:log post (kind 30023)");
|
||||
tui_print("^_D^:iary entry (kind 30024)");
|
||||
tui_print("^_X^: discard");
|
||||
tui_print("^_C^:ancel/discard");
|
||||
|
||||
tui_get_line(">", input, (int)sizeof(input));
|
||||
|
||||
@@ -122,6 +122,10 @@ void menu_write(void) {
|
||||
tui_print("Diary publish failed.");
|
||||
}
|
||||
}
|
||||
} else if (input[0] == 'c' || input[0] == 'C' ||
|
||||
input[0] == 'x' || input[0] == 'X' ||
|
||||
input[0] == 'q' || input[0] == 'Q') {
|
||||
tui_print("Discarded.");
|
||||
} else {
|
||||
tui_print("Discarded.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user