1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-03 16:27:46 +02:00

Remove fix_name() function

With unicode support this function is not longer valid.
This commit is contained in:
Manuel Argüelles 2013-08-21 16:24:33 -05:00
parent 422a89d32d
commit 11404240ce
3 changed files with 1 additions and 24 deletions

7
chat.c
View File

@ -50,7 +50,6 @@ static void chat_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *msg,
getname(m, num, (uint8_t *) &nick);
msg[len - 1] = '\0';
nick[MAX_NAME_LENGTH - 1] = '\0';
fix_name(nick);
wattron(ctx->history, COLOR_PAIR(2));
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;
action[len - 1] = '\0';
fix_name(action);
wattron(ctx->history, COLOR_PAIR(2));
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));
nick[len - 1] = '\0';
fix_name(nick);
snprintf(self->title, sizeof(self->title), "[%s (%d)]", nick, num);
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));
status[len - 1] = '\0';
fix_name(status);
snprintf(self->title, sizeof(self->title), "[%s (%d)]", status, num);
wattron(ctx->history, COLOR_PAIR(3));
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)) {
uint8_t selfname[MAX_NAME_LENGTH];
getself_name(m, selfname, sizeof(selfname));
fix_name(selfname);
wattron(ctx->history, COLOR_PAIR(2));
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};
getname(m, friendnum, (uint8_t *) &nick);
fix_name(nick);
snprintf(ret.title, sizeof(ret.title), "[%s (%d)]", nick, friendnum);

View File

@ -24,21 +24,6 @@ static friend_t friends[MAX_FRIENDS_NUM];
static int num_friends = 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)
{
@ -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);
friends[num].name[len] = 0;
fix_name(friends[num].name);
}
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);
friends[num].status[len] = 0;
fix_name(friends[num].status);
}
int friendlist_onFriendAdded(Messenger *m, int num)

View File

@ -7,6 +7,5 @@
ToxWindow new_friendlist();
int friendlist_onFriendAdded(Messenger *m, int num);
void disable_chatwin(int f_num);
void fix_name(uint8_t *name);
#endif /* end of include guard: FRIENDLIST_H_53I41IM */