Changeset e27661d for irc.c


Ignore:
Timestamp:
2006-03-31T17:55:47Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
7d31002
Parents:
d783e48
Message:

Finished the iconv() fix. Instead of doing it every time something goes from
or to the IM-modules, it's now just done with everything that goes between
BitlBee and the user. Incomparably more efficient/reliable. Plus some more
cleanups. It compiles, can't test it for real yet. ;-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    rd783e48 re27661d  
    346346void irc_process( irc_t *irc )
    347347{
    348         char **lines, *temp, **cmd;
     348        char **lines, *temp, **cmd, *cs;
    349349        int i;
    350350
     
    355355                for( i = 0; *lines[i] != '\0'; i ++ )
    356356                {
     357                        /* [WvG] Because irc_tokenize splits at every newline, the lines[] list
     358                            should end with an empty string. This is why this actually works.
     359                            Took me a while to figure out, Maurits. :-P */
    357360                        if( lines[i+1] == NULL )
    358361                        {
     
    362365                                i ++;
    363366                                break;
    364                         }                       
     367                        }
     368                       
     369                        if( ( cs = set_getstr( irc, "charset" ) ) )
     370                        {
     371                                char conv[IRC_MAX_LINE+1];
     372                               
     373                                conv[IRC_MAX_LINE] = 0;
     374                                if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) != -1 )
     375                                        strcpy( lines[i], conv );
     376                        }
    365377                       
    366378                        if( ( cmd = irc_parse_line( lines[i] ) ) == NULL )
     
    388400}
    389401
     402/* Splits a long string into separate lines. The array is NULL-terminated and, unless the string
     403   contains an incomplete line at the end, ends with an empty string. */
    390404char **irc_tokenize( char *buffer )
    391405{
     
    428442}
    429443
     444/* Split an IRC-style line into little parts/arguments. */
    430445char **irc_parse_line( char *line )
    431446{
     
    487502}
    488503
     504/* Converts such an array back into a command string. Mainly used for the IPC code right now. */
    489505char *irc_build_line( char **cmd )
    490506{
Note: See TracChangeset for help on using the changeset viewer.