diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/toxic/chat.c | 7 | ||||
-rw-r--r-- | testing/toxic/friendlist.c | 17 | ||||
-rw-r--r-- | testing/toxic/friendlist.h | 1 |
3 files changed, 1 insertions, 24 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index 3e342858..c7a0f98e 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -50,7 +50,6 @@ static void chat_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *msg, | |||
50 | getname(m, num, (uint8_t *) &nick); | 50 | getname(m, num, (uint8_t *) &nick); |
51 | msg[len - 1] = '\0'; | 51 | msg[len - 1] = '\0'; |
52 | nick[MAX_NAME_LENGTH - 1] = '\0'; | 52 | nick[MAX_NAME_LENGTH - 1] = '\0'; |
53 | fix_name(nick); | ||
54 | 53 | ||
55 | wattron(ctx->history, COLOR_PAIR(2)); | 54 | wattron(ctx->history, COLOR_PAIR(2)); |
56 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); | 55 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); |
@@ -73,7 +72,6 @@ static void chat_onAction(ToxWindow *self, Messenger *m, int num, uint8_t *actio | |||
73 | return; | 72 | return; |
74 | 73 | ||
75 | action[len - 1] = '\0'; | 74 | action[len - 1] = '\0'; |
76 | fix_name(action); | ||
77 | 75 | ||
78 | wattron(ctx->history, COLOR_PAIR(2)); | 76 | wattron(ctx->history, COLOR_PAIR(2)); |
79 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); | 77 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); |
@@ -100,7 +98,6 @@ static void chat_onNickChange(ToxWindow *self, int num, uint8_t *nick, uint16_t | |||
100 | wattroff(ctx->history, COLOR_PAIR(2)); | 98 | wattroff(ctx->history, COLOR_PAIR(2)); |
101 | 99 | ||
102 | nick[len - 1] = '\0'; | 100 | nick[len - 1] = '\0'; |
103 | fix_name(nick); | ||
104 | snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num); | 101 | snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num); |
105 | 102 | ||
106 | wattron(ctx->history, COLOR_PAIR(3)); | 103 | wattron(ctx->history, COLOR_PAIR(3)); |
@@ -121,7 +118,7 @@ static void chat_onStatusChange(ToxWindow *self, int num, uint8_t *status, uint1 | |||
121 | wattroff(ctx->history, COLOR_PAIR(2)); | 118 | wattroff(ctx->history, COLOR_PAIR(2)); |
122 | 119 | ||
123 | status[len - 1] = '\0'; | 120 | status[len - 1] = '\0'; |
124 | fix_name(status); | 121 | snprintf(self->title, sizeof(self->title), "[%s (%d)]", status, num); |
125 | 122 | ||
126 | wattron(ctx->history, COLOR_PAIR(3)); | 123 | wattron(ctx->history, COLOR_PAIR(3)); |
127 | wprintw(ctx->history, "* Your partner changed status to '%s'\n", status); | 124 | wprintw(ctx->history, "* Your partner changed status to '%s'\n", status); |
@@ -219,7 +216,6 @@ static void chat_onKey(ToxWindow *self, Messenger *m, wint_t key) | |||
219 | if (!string_is_empty(line)) { | 216 | if (!string_is_empty(line)) { |
220 | uint8_t selfname[MAX_NAME_LENGTH]; | 217 | uint8_t selfname[MAX_NAME_LENGTH]; |
221 | getself_name(m, selfname, sizeof(selfname)); | 218 | getself_name(m, selfname, sizeof(selfname)); |
222 | fix_name(selfname); | ||
223 | 219 | ||
224 | wattron(ctx->history, COLOR_PAIR(2)); | 220 | wattron(ctx->history, COLOR_PAIR(2)); |
225 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); | 221 | wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); |
@@ -435,7 +431,6 @@ ToxWindow new_chat(Messenger *m, int friendnum) | |||
435 | 431 | ||
436 | uint8_t nick[MAX_NAME_LENGTH] = {0}; | 432 | uint8_t nick[MAX_NAME_LENGTH] = {0}; |
437 | getname(m, friendnum, (uint8_t *) &nick); | 433 | getname(m, friendnum, (uint8_t *) &nick); |
438 | fix_name(nick); | ||
439 | 434 | ||
440 | snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum); | 435 | snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum); |
441 | 436 | ||
diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c index 72b1da9d..8fa3b473 100644 --- a/testing/toxic/friendlist.c +++ b/testing/toxic/friendlist.c | |||
@@ -24,21 +24,6 @@ static friend_t friends[MAX_FRIENDS_NUM]; | |||
24 | static int num_friends = 0; | 24 | static int num_friends = 0; |
25 | static int num_selected = 0; | 25 | static int num_selected = 0; |
26 | 26 | ||
27 | void fix_name(uint8_t *name) | ||
28 | { | ||
29 | /* Remove all non alphanumeric characters */ | ||
30 | uint8_t *p = name; | ||
31 | uint8_t *q = name; | ||
32 | |||
33 | while (*p != 0) { | ||
34 | if (isprint(*p)) | ||
35 | *q++ = *p; | ||
36 | |||
37 | p++; | ||
38 | } | ||
39 | |||
40 | *q = 0; | ||
41 | } | ||
42 | 27 | ||
43 | void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str, uint16_t len) | 28 | void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str, uint16_t len) |
44 | { | 29 | { |
@@ -57,7 +42,6 @@ void friendlist_onNickChange(ToxWindow *self, int num, uint8_t *str, uint16_t le | |||
57 | 42 | ||
58 | memcpy((char *) &friends[num].name, (char *) str, len); | 43 | memcpy((char *) &friends[num].name, (char *) str, len); |
59 | friends[num].name[len] = 0; | 44 | friends[num].name[len] = 0; |
60 | fix_name(friends[num].name); | ||
61 | } | 45 | } |
62 | 46 | ||
63 | void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) | 47 | void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len) |
@@ -67,7 +51,6 @@ void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t | |||
67 | 51 | ||
68 | memcpy((char *) &friends[num].status, (char *) str, len); | 52 | memcpy((char *) &friends[num].status, (char *) str, len); |
69 | friends[num].status[len] = 0; | 53 | friends[num].status[len] = 0; |
70 | fix_name(friends[num].status); | ||
71 | } | 54 | } |
72 | 55 | ||
73 | int friendlist_onFriendAdded(Messenger *m, int num) | 56 | int friendlist_onFriendAdded(Messenger *m, int num) |
diff --git a/testing/toxic/friendlist.h b/testing/toxic/friendlist.h index 91b917fd..6f045d4a 100644 --- a/testing/toxic/friendlist.h +++ b/testing/toxic/friendlist.h | |||
@@ -7,6 +7,5 @@ | |||
7 | ToxWindow new_friendlist(); | 7 | ToxWindow new_friendlist(); |
8 | int friendlist_onFriendAdded(Messenger *m, int num); | 8 | int friendlist_onFriendAdded(Messenger *m, int num); |
9 | void disable_chatwin(int f_num); | 9 | void disable_chatwin(int f_num); |
10 | void fix_name(uint8_t *name); | ||
11 | 10 | ||
12 | #endif /* end of include guard: FRIENDLIST_H_53I41IM */ | 11 | #endif /* end of include guard: FRIENDLIST_H_53I41IM */ |