Changeset b3ebb3a for irc_channel.c


Ignore:
Timestamp:
2015-04-06T11:56:29Z (10 years ago)
Author:
dequis <dx@…>
Children:
0fb32dd
Parents:
d16e951
Message:

another attempt at g_convert_with_fallback in irc_channel_name_gen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    rd16e951 rb3ebb3a  
    589589{
    590590        char name[MAX_NICK_LENGTH + 1] = { 0 };
     591        char *translit_name;
     592        gsize bytes_written;
     593
     594        translit_name = g_convert_with_fallback(hint, -1, "ASCII//TRANSLIT", "UTF-8", "", NULL, &bytes_written, NULL);
     595        if (bytes_written > MAX_NICK_LENGTH) {
     596                translit_name[MAX_NICK_LENGTH] = '\0';
     597        }
    591598
    592599        name[0] = '#';
    593         strncpy(name + 1, hint, MAX_NICK_LENGTH - 1);
     600        strncpy(name + 1, translit_name, MAX_NICK_LENGTH - 1);
    594601        name[MAX_NICK_LENGTH] = '\0';
     602
     603        g_free(translit_name);
    595604
    596605        irc_channel_name_strip(name);
Note: See TracChangeset for help on using the changeset viewer.