aboutsummaryrefslogtreecommitdiffstats
path: root/irc_im.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_im.c')
-rw-r--r--irc_im.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/irc_im.c b/irc_im.c
index d71c9ee9..2a956c44 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -697,7 +697,8 @@ static gboolean bee_irc_chat_name_hint(bee_t *bee, struct groupchat *c, const ch
{
irc_t *irc = bee->ui_data;
irc_channel_t *ic = c->ui_data, *oic;
- char stripped[MAX_NICK_LENGTH + 1], *full_name;
+ char *stripped, *full_name;
+ gsize bytes_written;
if (ic == NULL) {
return FALSE;
@@ -708,18 +709,23 @@ static gboolean bee_irc_chat_name_hint(bee_t *bee, struct groupchat *c, const ch
return FALSE;
}
- strncpy(stripped, name, MAX_NICK_LENGTH);
- stripped[MAX_NICK_LENGTH] = '\0';
+ stripped = g_convert_with_fallback(name, -1, "ASCII//TRANSLIT", "UTF-8", "", NULL, &bytes_written, NULL);
+ if (bytes_written > MAX_NICK_LENGTH) {
+ stripped[MAX_NICK_LENGTH] = '\0';
+ }
+
irc_channel_name_strip(stripped);
if (set_getbool(&bee->set, "lcnicks")) {
nick_lc(irc, stripped);
}
if (stripped[0] == '\0') {
+ g_free(stripped);
return FALSE;
}
full_name = g_strdup_printf("#%s", stripped);
+ g_free(stripped);
if ((oic = irc_channel_by_name(irc, full_name))) {
char *type, *chat_type;