From 11404240ce24ab751c551b507e4f6086336f19fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Arg=C3=BCelles?= Date: Wed, 21 Aug 2013 16:24:33 -0500 Subject: [PATCH] Remove fix_name() function With unicode support this function is not longer valid. --- chat.c | 7 +------ friendlist.c | 17 ----------------- friendlist.h | 1 - 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/chat.c b/chat.c index 3e34285..c7a0f98 100644 --- a/chat.c +++ b/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); 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); diff --git a/friendlist.c b/friendlist.c index 72b1da9..8fa3b47 100644 --- a/friendlist.c +++ b/friendlist.c @@ -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) diff --git a/friendlist.h b/friendlist.h index 91b917f..6f045d4 100644 --- a/friendlist.h +++ b/friendlist.h @@ -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 */