Mercurial > pidgin
comparison src/protocols/irc/parse.c @ 6754:47e49e3c00f4
[gaim-migrate @ 7286]
some sort of crazy underline
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Fri, 05 Sep 2003 16:53:18 +0000 |
parents | 37af5dea14d1 |
children | 91df6a6e6567 |
comparison
equal
deleted
inserted
replaced
6753:c3d8e8190d77 | 6754:47e49e3c00f4 |
---|---|
174 char *irc_mirc2html(const char *string) | 174 char *irc_mirc2html(const char *string) |
175 { | 175 { |
176 const char *cur, *end; | 176 const char *cur, *end; |
177 char fg[3] = "\0\0", bg[3] = "\0\0"; | 177 char fg[3] = "\0\0", bg[3] = "\0\0"; |
178 int fgnum, bgnum; | 178 int fgnum, bgnum; |
179 int font = 0, bold = 0; | 179 int font = 0, bold = 0, underline = 0; |
180 GString *decoded = g_string_sized_new(strlen(string)); | 180 GString *decoded = g_string_sized_new(strlen(string)); |
181 | 181 |
182 cur = string; | 182 cur = string; |
183 do { | 183 do { |
184 end = strpbrk(cur, "\002\003\007\017\026"); | 184 end = strpbrk(cur, "\002\003\007\017\026\037"); |
185 | 185 |
186 decoded = g_string_append_len(decoded, cur, end ? end - cur : strlen(cur)); | 186 decoded = g_string_append_len(decoded, cur, end ? end - cur : strlen(cur)); |
187 cur = end ? end : cur + strlen(cur); | 187 cur = end ? end : cur + strlen(cur); |
188 | 188 |
189 switch (*cur) { | 189 switch (*cur) { |
228 g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); | 228 g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); |
229 } | 229 } |
230 decoded = g_string_append_c(decoded, '>'); | 230 decoded = g_string_append_c(decoded, '>'); |
231 } | 231 } |
232 break; | 232 break; |
233 case '\037': | |
234 cur++; | |
235 if (!underline) { | |
236 decoded = g_string_append(decoded, "<U>"); | |
237 underline = TRUE; | |
238 } else { | |
239 decoded = g_string_append(decoded, "</U>"); | |
240 underline = TRUE; | |
241 } | |
242 break; | |
233 case '\007': | 243 case '\007': |
234 case '\026': | 244 case '\026': |
235 cur++; | 245 cur++; |
236 break; | 246 break; |
237 case '\017': | 247 case '\017': |
238 cur++; | 248 cur++; |
239 /* fallthrough */ | 249 /* fallthrough */ |
240 case '\000': | 250 case '\000': |
241 if (bold) | 251 if (bold) |
242 decoded = g_string_append(decoded, "</BOLD>"); | 252 decoded = g_string_append(decoded, "</B>"); |
253 if (underline) | |
254 decoded = g_string_append(decoded, "</U>"); | |
243 if (font) | 255 if (font) |
244 decoded = g_string_append(decoded, "</FONT>"); | 256 decoded = g_string_append(decoded, "</FONT>"); |
245 break; | 257 break; |
246 default: | 258 default: |
247 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); | 259 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); |
255 { | 267 { |
256 GaimConnection *gc; | 268 GaimConnection *gc; |
257 const char *cur = msg + 1; | 269 const char *cur = msg + 1; |
258 char *buf, *ctcp; | 270 char *buf, *ctcp; |
259 time_t timestamp; | 271 time_t timestamp; |
272 | |
273 /* Note that this is NOT correct w.r.t. multiple CTCPs in one | |
274 * message and low-level quoting ... but if you want that crap, | |
275 * use a real IRC client. */ | |
260 | 276 |
261 if (msg[0] != '\001' || msg[strlen(msg) - 1] != '\001') | 277 if (msg[0] != '\001' || msg[strlen(msg) - 1] != '\001') |
262 return g_strdup(msg); | 278 return g_strdup(msg); |
263 | 279 |
264 if (!strncmp(cur, "ACTION ", 7)) { | 280 if (!strncmp(cur, "ACTION ", 7)) { |