messenger-cli

Command-line user interface for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 04b106bf09b8ef90418811ed583d1c4ebd5fdaf5
parent 4db85b1a2178004a5f54ae798b6776a723145974
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Fri, 19 Aug 2022 00:35:09 +0200

Added ability to switch directly to a contacts chat from member list

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Msrc/ui/members.c | 18++++++++++++------
Msrc/ui/members.h | 6+++---
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/ui/members.c b/src/ui/members.c @@ -50,13 +50,19 @@ members_event(UI_MEMBERS_Handle *members, app->chat.show_members = FALSE; break; case '\n': - case KEY_ENTER: - if (members->selected) - { - // TODO - } + case KEY_ENTER: { + struct GNUNET_CHAT_Context *context; + if (!(members->selected)) + break; + + context = GNUNET_CHAT_contact_get_context(members->selected); + GNUNET_CHAT_context_request(context); + + app->chat.show_members = FALSE; + app->chat.context = context; break; + } default: break; } @@ -128,7 +134,7 @@ members_clear(UI_MEMBERS_Handle *members) bool members_add(UI_MEMBERS_Handle *members, - const struct GNUNET_CHAT_Contact *contact) + struct GNUNET_CHAT_Contact *contact) { UI_MEMBERS_List *element = members->head; while (element) diff --git a/src/ui/members.h b/src/ui/members.h @@ -37,7 +37,7 @@ struct MESSENGER_Application; typedef struct UI_MEMBERS_List { - const struct GNUNET_CHAT_Contact *contact; + struct GNUNET_CHAT_Contact *contact; struct UI_MEMBERS_List *prev; struct UI_MEMBERS_List *next; @@ -54,7 +54,7 @@ typedef struct UI_MEMBERS_Handle int line_offset; int line_selected; - const struct GNUNET_CHAT_Contact *selected; + struct GNUNET_CHAT_Contact *selected; } UI_MEMBERS_Handle; #define UI_MEMBERS_COLS_MIN 30 @@ -72,7 +72,7 @@ members_clear(UI_MEMBERS_Handle *members); bool members_add(UI_MEMBERS_Handle *members, - const struct GNUNET_CHAT_Contact *contact); + struct GNUNET_CHAT_Contact *contact); void members_remove(UI_MEMBERS_Handle *members,