From 81125be971f0b611f297a24514c75842c8c7ad33 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 24 Apr 2014 23:25:38 -0400 Subject: [PATCH] show selected friend's ID at bottom of friendlist --- src/friendlist.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/friendlist.c b/src/friendlist.c index 398b9f8..ebeb04d 100644 --- a/src/friendlist.c +++ b/src/friendlist.c @@ -369,7 +369,7 @@ static void friendlist_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr) } } -#define FLIST_OFST 4 /* Accounts for the lines at top */ +#define FLIST_OFST 6 /* Accounts for space at top and bottom */ static void friendlist_onDraw(ToxWindow *self, Tox *m) { @@ -407,6 +407,8 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m) if ((y2 - FLIST_OFST) <= 0) /* don't allow division by zero */ return; + int selected_num = 0; + /* Determine which portion of friendlist to draw based on current position */ int page = num_selected / (y2 - FLIST_OFST); int start = (y2 - FLIST_OFST) * page; @@ -423,6 +425,7 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m) wattron(self->window, A_BOLD); wprintw(self->window, " > "); wattroff(self->window, A_BOLD); + selected_num = f; f_selected = true; } else { wprintw(self->window, " "); @@ -534,6 +537,19 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m) self->x = x2; wrefresh(self->window); draw_popup(self, m); + + if (num_friends) { + wmove(self->window, y2 - 1, 1); + + wattron(self->window, A_BOLD); + wprintw(self->window, " ID: "); + wattroff(self->window, A_BOLD); + + int i; + + for (i = 0; i < TOX_CLIENT_ID_SIZE; ++i) + wprintw(self->window, "%02X", friends[selected_num].pub_key[i] & 0xff); + } } void disable_chatwin(int32_t f_num)