Changeset 6f0ea57
- Timestamp:
- 2010-07-17T14:37:33Z (14 years ago)
- Branches:
- master
- Children:
- 0d691ea
- Parents:
- 5e98ff0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/misc.xml
r5e98ff0 r6f0ea57 204 204 205 205 <para> 206 One modifier is currently available: %-@variable will remove all characters from the first @ in the string. 207 </para> 208 209 <para> 210 In all cases, invalid characters (like spaces) will be stripped. Depending 211 on your locale settings, characters with accents will be converted to ASCII. 206 Invalid characters (like spaces) will always be stripped. Depending on your 207 locale settings, characters with accents will be converted to ASCII. 208 </para> 209 210 <para> 211 See <emphasis>set nick_format2</emphasis> for some more information. 212 </para> 213 214 </sect1> 215 216 <sect1 id="nick_format2"> 217 <title>Nickname formatting - modifiers</title> 218 219 <para> 220 Two modifiers ares currently available: You can include only the first few 221 characters of a variable by putting a number right after the %. For example, 222 <emphasis>[%3group]%-@nick</emphasis> will include only the first three 223 characters of the group name in the nick. 224 </para> 225 226 <para> 227 Also, you can truncate variables from a certain character using 228 the <emphasis>-</emphasis>modifier. For example, you may want to leave out 229 everything after the @. <emphasis>%-@handle</emphasis> will expand to 230 everything in the handle up to the first @. 212 231 </para> 213 232 -
nick.c
r5e98ff0 r6f0ea57 117 117 { 118 118 char *part, chop = '\0', *asc = NULL; 119 int len = MAX_NICK_LENGTH; 119 120 120 121 if( *fmt != '%' ) … … 135 136 return NULL; 136 137 fmt += 2; 138 } 139 else if( isdigit( *fmt ) ) 140 { 141 len = 0; 142 /* Grab a number. */ 143 while( isdigit( *fmt ) ) 144 len = len * 10 + ( *(fmt++) - '0' ); 137 145 } 138 146 else if( g_strncasecmp( fmt, "nick", 4 ) == 0 ) … … 188 196 g_string_append_c( ret, '_' ); 189 197 190 while( part && *part && *part != chop )198 while( part && *part && *part != chop && len > 0 ) 191 199 { 192 200 if( strchr( nick_lc_chars, *part ) || … … 195 203 196 204 part ++; 205 len --; 197 206 } 198 207 g_free( asc );
Note: See TracChangeset
for help on using the changeset viewer.