Changeset 738 for branches


Ignore:
Timestamp:
05/30/06 21:45:47 (6 years ago)
Author:
wd
Message:

Fix color stripping to properly handle the single digit foreground color
case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/addons/cmode_strip.c

    r707 r738  
    6060} 
    6161 
    62 #define ANSI_CHAR        '\033' 
    63 #define BLINK_CHAR        '\006' 
    64 #define BOLD_CHAR        '\002' 
    65 #define COLOR_CHAR        '\003' 
    66 #define INVERSE_CHAR        '\026' 
    67 #define UNDERLINE_CHAR        '\037' 
     62#define ANSI_CHAR       '\033' 
     63#define BLINK_CHAR      '\006' 
     64#define BOLD_CHAR       '\002' 
     65#define COLOR_CHAR      '\003' 
     66#define INVERSE_CHAR    '\026' 
     67#define UNDERLINE_CHAR  '\037' 
    6868 
    6969HOOK_FUNCTION(strip_conf_hook) { 
     
    117117 
    118118    if (chanmode_isset(ccap->chan, chanmode_strip)) { 
    119         char *from, *to; 
    120         from = to = ccap->extra; 
     119        unsigned char *from, *to; 
     120        from = to = (unsigned char *)ccap->extra; 
    121121 
    122122        while (*from != '\0') { 
    123             if (strip_chars[(unsigned char)*from]) { 
     123            if (strip_chars[*from]) { 
     124                /* We will always skip the character here, it just may not 
     125                 * match COLOR_CHAR in which case we simply continue on */ 
    124126                if (*from++ == COLOR_CHAR) { 
    125127                    if (isdigit(*from)) { 
    126                         if (isdigit(*++from)) { 
    127                             if (*++from == ',') { 
    128                                 if (isdigit(*++from)) { 
    129                                     if (isdigit(*from)) 
    130                                         from++; 
    131                                 } 
    132                             } 
     128                        if (isdigit(*++from)) 
     129                            from++; /* skip second digit which is optional */ 
     130 
     131                        if (*from == ',' && isdigit(*(from + 1))) { 
     132                            /* background color specified ... */ 
     133                            from += 2; 
     134                            if (isdigit(*from)) 
     135                                from++; 
    133136                        } 
    134137                    } 
    135138                } 
    136                 continue; 
    137             } 
    138             *to++ = *from++; 
     139            } else 
     140                *to++ = *from++; 
    139141        } 
    140142    } 
Note: See TracChangeset for help on using the changeset viewer.