mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:53:02 +01:00
Remove fix_name() function
With unicode support this function is not longer valid.
This commit is contained in:
parent
422a89d32d
commit
11404240ce
7
chat.c
7
chat.c
@ -50,7 +50,6 @@ static void chat_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *msg,
|
|||||||
getname(m, num, (uint8_t *) &nick);
|
getname(m, num, (uint8_t *) &nick);
|
||||||
msg[len - 1] = '\0';
|
msg[len - 1] = '\0';
|
||||||
nick[MAX_NAME_LENGTH - 1] = '\0';
|
nick[MAX_NAME_LENGTH - 1] = '\0';
|
||||||
fix_name(nick);
|
|
||||||
|
|
||||||
wattron(ctx->history, COLOR_PAIR(2));
|
wattron(ctx->history, COLOR_PAIR(2));
|
||||||
wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
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
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
action[len - 1] = '\0';
|
action[len - 1] = '\0';
|
||||||
fix_name(action);
|
|
||||||
|
|
||||||
wattron(ctx->history, COLOR_PAIR(2));
|
wattron(ctx->history, COLOR_PAIR(2));
|
||||||
wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
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
|
|||||||
wattroff(ctx->history, COLOR_PAIR(2));
|
wattroff(ctx->history, COLOR_PAIR(2));
|
||||||
|
|
||||||
nick[len - 1] = '\0';
|
nick[len - 1] = '\0';
|
||||||
fix_name(nick);
|
|
||||||
snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num);
|
snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num);
|
||||||
|
|
||||||
wattron(ctx->history, COLOR_PAIR(3));
|
wattron(ctx->history, COLOR_PAIR(3));
|
||||||
@ -121,7 +118,7 @@ static void chat_onStatusChange(ToxWindow *self, int num, uint8_t *status, uint1
|
|||||||
wattroff(ctx->history, COLOR_PAIR(2));
|
wattroff(ctx->history, COLOR_PAIR(2));
|
||||||
|
|
||||||
status[len - 1] = '\0';
|
status[len - 1] = '\0';
|
||||||
fix_name(status);
|
snprintf(self->title, sizeof(self->title), "[%s (%d)]", status, num);
|
||||||
|
|
||||||
wattron(ctx->history, COLOR_PAIR(3));
|
wattron(ctx->history, COLOR_PAIR(3));
|
||||||
wprintw(ctx->history, "* Your partner changed status to '%s'\n", status);
|
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)
|
|||||||
if (!string_is_empty(line)) {
|
if (!string_is_empty(line)) {
|
||||||
uint8_t selfname[MAX_NAME_LENGTH];
|
uint8_t selfname[MAX_NAME_LENGTH];
|
||||||
getself_name(m, selfname, sizeof(selfname));
|
getself_name(m, selfname, sizeof(selfname));
|
||||||
fix_name(selfname);
|
|
||||||
|
|
||||||
wattron(ctx->history, COLOR_PAIR(2));
|
wattron(ctx->history, COLOR_PAIR(2));
|
||||||
wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
|
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)
|
|||||||
|
|
||||||
uint8_t nick[MAX_NAME_LENGTH] = {0};
|
uint8_t nick[MAX_NAME_LENGTH] = {0};
|
||||||
getname(m, friendnum, (uint8_t *) &nick);
|
getname(m, friendnum, (uint8_t *) &nick);
|
||||||
fix_name(nick);
|
|
||||||
|
|
||||||
snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum);
|
snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum);
|
||||||
|
|
||||||
|
17
friendlist.c
17
friendlist.c
@ -24,21 +24,6 @@ static friend_t friends[MAX_FRIENDS_NUM];
|
|||||||
static int num_friends = 0;
|
static int num_friends = 0;
|
||||||
static int num_selected = 0;
|
static int num_selected = 0;
|
||||||
|
|
||||||
void fix_name(uint8_t *name)
|
|
||||||
{
|
|
||||||
/* Remove all non alphanumeric characters */
|
|
||||||
uint8_t *p = name;
|
|
||||||
uint8_t *q = name;
|
|
||||||
|
|
||||||
while (*p != 0) {
|
|
||||||
if (isprint(*p))
|
|
||||||
*q++ = *p;
|
|
||||||
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*q = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str, uint16_t len)
|
void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str, uint16_t len)
|
||||||
{
|
{
|
||||||
@ -57,7 +42,6 @@ void friendlist_onNickChange(ToxWindow *self, int num, uint8_t *str, uint16_t le
|
|||||||
|
|
||||||
memcpy((char *) &friends[num].name, (char *) str, len);
|
memcpy((char *) &friends[num].name, (char *) str, len);
|
||||||
friends[num].name[len] = 0;
|
friends[num].name[len] = 0;
|
||||||
fix_name(friends[num].name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void friendlist_onStatusChange(ToxWindow *self, int num, uint8_t *str, uint16_t len)
|
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
|
|||||||
|
|
||||||
memcpy((char *) &friends[num].status, (char *) str, len);
|
memcpy((char *) &friends[num].status, (char *) str, len);
|
||||||
friends[num].status[len] = 0;
|
friends[num].status[len] = 0;
|
||||||
fix_name(friends[num].status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int friendlist_onFriendAdded(Messenger *m, int num)
|
int friendlist_onFriendAdded(Messenger *m, int num)
|
||||||
|
@ -7,6 +7,5 @@
|
|||||||
ToxWindow new_friendlist();
|
ToxWindow new_friendlist();
|
||||||
int friendlist_onFriendAdded(Messenger *m, int num);
|
int friendlist_onFriendAdded(Messenger *m, int num);
|
||||||
void disable_chatwin(int f_num);
|
void disable_chatwin(int f_num);
|
||||||
void fix_name(uint8_t *name);
|
|
||||||
|
|
||||||
#endif /* end of include guard: FRIENDLIST_H_53I41IM */
|
#endif /* end of include guard: FRIENDLIST_H_53I41IM */
|
||||||
|
Loading…
Reference in New Issue
Block a user