Changeset b95d03b


Ignore:
Timestamp:
2015-03-25T18:50:07Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
3dcc878
Parents:
098a75b
git-author:
Antoine Pietri <antoine.pietri@…> (11-03-15 10:49:15)
git-committer:
dequis <dx@…> (25-03-15 18:50:07)
Message:

chat_name_hint: normalize utf8 with fallback from the channel name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r098a75b rb95d03b  
    698698        irc_t *irc = bee->ui_data;
    699699        irc_channel_t *ic = c->ui_data, *oic;
    700         char stripped[MAX_NICK_LENGTH + 1], *full_name;
     700        char *stripped, *full_name;
     701        gsize bytes_written;
    701702
    702703        if (ic == NULL) {
     
    709710        }
    710711
    711         strncpy(stripped, name, MAX_NICK_LENGTH);
    712         stripped[MAX_NICK_LENGTH] = '\0';
     712        stripped = g_convert_with_fallback(name, -1, "ASCII//TRANSLIT", "UTF-8", "", NULL, &bytes_written, NULL);
     713        if (bytes_written > MAX_NICK_LENGTH) {
     714                stripped[MAX_NICK_LENGTH] = '\0';
     715        }
     716
    713717        irc_channel_name_strip(stripped);
    714718        if (set_getbool(&bee->set, "lcnicks")) {
     
    717721
    718722        if (stripped[0] == '\0') {
     723                g_free(stripped);
    719724                return FALSE;
    720725        }
    721726
    722727        full_name = g_strdup_printf("#%s", stripped);
     728        g_free(stripped);
    723729        if ((oic = irc_channel_by_name(irc, full_name))) {
    724730                char *type, *chat_type;
Note: See TracChangeset for help on using the changeset viewer.