Mercurial > pidgin
comparison src/protocols/irc/parse.c @ 12158:d4725469b653
[gaim-migrate @ 14459]
I assume it's ok to bring this into HEAD from oldstatus? :
"Apparently at some point I wrote italic support for IRC and never
committed it" -- Ethan, Aug 26th 2005.
committer: Tailor Script <tailor@pidgin.im>
| author | Stu Tomlinson <stu@nosnilmot.com> |
|---|---|
| date | Sat, 19 Nov 2005 14:07:19 +0000 |
| parents | 39734dd473e0 |
| children | de27f2831309 |
comparison
equal
deleted
inserted
replaced
| 12157:b105009a60ae | 12158:d4725469b653 |
|---|---|
| 282 char *irc_mirc2html(const char *string) | 282 char *irc_mirc2html(const char *string) |
| 283 { | 283 { |
| 284 const char *cur, *end; | 284 const char *cur, *end; |
| 285 char fg[3] = "\0\0", bg[3] = "\0\0"; | 285 char fg[3] = "\0\0", bg[3] = "\0\0"; |
| 286 int fgnum, bgnum; | 286 int fgnum, bgnum; |
| 287 int font = 0, bold = 0, underline = 0; | 287 int font = 0, bold = 0, underline = 0, italic = 0; |
| 288 GString *decoded = g_string_sized_new(strlen(string)); | 288 GString *decoded = g_string_sized_new(strlen(string)); |
| 289 | 289 |
| 290 cur = string; | 290 cur = string; |
| 291 do { | 291 do { |
| 292 end = strpbrk(cur, "\002\003\007\017\026\037"); | 292 end = strpbrk(cur, "\002\003\007\017\026\037"); |
| 336 g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); | 336 g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); |
| 337 } | 337 } |
| 338 decoded = g_string_append_c(decoded, '>'); | 338 decoded = g_string_append_c(decoded, '>'); |
| 339 } | 339 } |
| 340 break; | 340 break; |
| 341 case '\011': | |
| 342 cur++; | |
| 343 if (!italic) { | |
| 344 decoded = g_string_append(decoded, "<I>"); | |
| 345 italic = TRUE; | |
| 346 } else { | |
| 347 decoded = g_string_append(decoded, "</I>"); | |
| 348 italic = FALSE; | |
| 349 } | |
| 350 break; | |
| 341 case '\037': | 351 case '\037': |
| 342 cur++; | 352 cur++; |
| 343 if (!underline) { | 353 if (!underline) { |
| 344 decoded = g_string_append(decoded, "<U>"); | 354 decoded = g_string_append(decoded, "<U>"); |
| 345 underline = TRUE; | 355 underline = TRUE; |
| 356 cur++; | 366 cur++; |
| 357 /* fallthrough */ | 367 /* fallthrough */ |
| 358 case '\000': | 368 case '\000': |
| 359 if (bold) | 369 if (bold) |
| 360 decoded = g_string_append(decoded, "</B>"); | 370 decoded = g_string_append(decoded, "</B>"); |
| 371 if (italic) | |
| 372 decoded = g_string_append(decoded, "</I>"); | |
| 361 if (underline) | 373 if (underline) |
| 362 decoded = g_string_append(decoded, "</U>"); | 374 decoded = g_string_append(decoded, "</U>"); |
| 363 if (font) | 375 if (font) |
| 364 decoded = g_string_append(decoded, "</FONT>"); | 376 decoded = g_string_append(decoded, "</FONT>"); |
| 365 break; | 377 break; |
