mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:13:03 +01:00
show pseudo-unique identifier in friend chat windows
This commit is contained in:
parent
4294e39b49
commit
2982dc6ddd
15
src/chat.c
15
src/chat.c
@ -547,9 +547,9 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
self->x = x2;
|
self->x = x2;
|
||||||
|
|
||||||
/* Truncate note if it doesn't fit in statusbar */
|
/* Truncate note if it doesn't fit in statusbar */
|
||||||
uint16_t maxlen = x2 - getcurx(statusbar->topline) - 4;
|
uint16_t maxlen = x2 - getcurx(statusbar->topline) - (KEY_IDENT_DIGITS * 2) - 6;
|
||||||
if (statusbar->statusmsg_len > maxlen) {
|
if (statusbar->statusmsg_len > maxlen) {
|
||||||
statusbar->statusmsg[maxlen] = '\0';
|
statusbar->statusmsg[maxlen-1] = '\0';
|
||||||
statusbar->statusmsg_len = maxlen;
|
statusbar->statusmsg_len = maxlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +559,16 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
wattroff(statusbar->topline, A_BOLD);
|
wattroff(statusbar->topline, A_BOLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
wprintw(statusbar->topline, "\n");
|
wclrtoeol(statusbar->topline);
|
||||||
|
wmove(statusbar->topline, 0, x2 - (KEY_IDENT_DIGITS * 2) - 3);
|
||||||
|
wprintw(statusbar->topline, "{");
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < KEY_IDENT_DIGITS; ++i)
|
||||||
|
wprintw(statusbar->topline, "%x", friends[self->num].pub_key[i] & 0xff);
|
||||||
|
|
||||||
|
wprintw(statusbar->topline, "}\n");
|
||||||
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x2);
|
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ static void friendlist_onFriendAdded(ToxWindow *self, Tox *m, int num, bool sort
|
|||||||
friends[i].online = false;
|
friends[i].online = false;
|
||||||
friends[i].status = TOX_USERSTATUS_NONE;
|
friends[i].status = TOX_USERSTATUS_NONE;
|
||||||
friends[i].namelength = tox_get_name(m, num, friends[i].name);
|
friends[i].namelength = tox_get_name(m, num, friends[i].name);
|
||||||
|
tox_get_client_id(m, num, friends[i].pub_key);
|
||||||
|
|
||||||
if (friends[i].namelength == -1 || friends[i].name[0] == '\0') {
|
if (friends[i].namelength == -1 || friends[i].name[0] == '\0') {
|
||||||
strcpy(friends[i].name, (uint8_t *) UNKNOWN_NAME);
|
strcpy(friends[i].name, (uint8_t *) UNKNOWN_NAME);
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
|
|
||||||
#include "toxic_windows.h"
|
#include "toxic_windows.h"
|
||||||
|
|
||||||
|
#define KEY_IDENT_DIGITS 2
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t name[TOX_MAX_NAME_LENGTH];
|
uint8_t name[TOX_MAX_NAME_LENGTH];
|
||||||
uint16_t namelength;
|
uint16_t namelength;
|
||||||
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH];
|
uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH];
|
||||||
uint16_t statusmsg_len;
|
uint16_t statusmsg_len;
|
||||||
uint8_t pending_groupchat[TOX_CLIENT_ID_SIZE];
|
uint8_t pending_groupchat[TOX_CLIENT_ID_SIZE];
|
||||||
|
uint8_t pub_key[TOX_CLIENT_ID_SIZE];
|
||||||
int num;
|
int num;
|
||||||
int chatwin;
|
int chatwin;
|
||||||
bool active;
|
bool active;
|
||||||
|
@ -470,6 +470,9 @@ int main(int argc, char *argv[])
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
int f_use_ipv4 = 0;
|
int f_use_ipv4 = 0;
|
||||||
|
|
||||||
|
// Make sure all written files are read/writeable only by the current user.
|
||||||
|
umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||||
|
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
if (argv[i] == NULL)
|
if (argv[i] == NULL)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user