Changeset 21c87a7 for irc.c


Ignore:
Timestamp:
2010-04-14T09:27:50Z (10 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d33679e
Parents:
81186cab (diff), 156bbd7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging loads of stuff from mainline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r81186cab r21c87a7  
    105105        s = set_add( &b->set, "default_target", "root", NULL, irc );
    106106        s = set_add( &b->set, "display_namechanges", "false", set_eval_bool, irc );
     107        s = set_add( &b->set, "display_timestamps", "true", set_eval_bool, irc );
    107108        s = set_add( &b->set, "handle_unknown", "root", NULL, irc );
    108109        s = set_add( &b->set, "lcnicks", "true", set_eval_bool, irc );
     
    112113        s = set_add( &b->set, "root_nick", ROOT_NICK, NULL/*set_eval_root_nick*/, irc );
    113114        s = set_add( &b->set, "simulate_netsplit", "true", set_eval_bool, irc );
     115        s = set_add( &b->set, "timezone", "local", set_eval_timezone, irc );
    114116        s = set_add( &b->set, "to_char", ": ", set_eval_to_char, irc );
    115117        s = set_add( &b->set, "typing_notice", "false", set_eval_bool, irc );
     
    747749}
    748750
    749 
    750751static char *set_eval_charset( set_t *set, char *value )
    751752{
    752         irc_t *irc = set->data;
     753        irc_t *irc = (irc_t*) set->data;
     754        char *test;
     755        gsize test_bytes = 0;
    753756        GIConv ic, oc;
    754757
     
    756759                value = g_strdup( "utf-8" );
    757760
     761        if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 )
     762        {
     763                return NULL;
     764        }
     765       
     766        /* Do a test iconv to see if the user picked an IRC-compatible
     767           charset (for example utf-16 goes *horribly* wrong). */
     768        if( ( test = g_convert_with_iconv( " ", 1, oc, NULL, &test_bytes, NULL ) ) == NULL ||
     769            test_bytes > 1 )
     770        {
     771                g_free( test );
     772                g_iconv_close( oc );
     773                irc_usermsg( irc, "Unsupported character set: The IRC protocol "
     774                                  "only supports 8-bit character sets." );
     775                return NULL;
     776        }
     777        g_free( test );
     778       
    758779        if( ( ic = g_iconv_open( "utf-8", value ) ) == (GIConv) -1 )
    759780        {
    760                 return NULL;
    761         }
    762         if( ( oc = g_iconv_open( value, "utf-8" ) ) == (GIConv) -1 )
    763         {
    764                 g_iconv_close( ic );
     781                g_iconv_close( oc );
    765782                return NULL;
    766783        }
Note: See TracChangeset for help on using the changeset viewer.