comparison src/protocols/zephyr/zephyr.c @ 7070:b794695d7c72

[gaim-migrate @ 7635] Arun A Tharuvai (aat) writes: " The function zephyr_to_html() occasionally interprets some actual text as non-functional formatting code to be ignored. All text between an @ sign (used to start tags), and the first opener (one of '<', '{', '[', or '(' ) for example, From: <foo@bar.com>, <baz@quux.com> was getting munged to From: <foobaz@quux.com> The attached patch checks for the existence of a closer between an @ and an opener, outputting the section verbatim." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 30 Sep 2003 12:54:58 +0000
parents 86ed8b2aa665
children 0909ebf6fb28
comparison
equal deleted inserted replaced
7069:184ec972f0f5 7070:b794695d7c72
193 if (message[cnt] == '@') { 193 if (message[cnt] == '@') {
194 zframe *new_f; 194 zframe *new_f;
195 char *buf; 195 char *buf;
196 int end; 196 int end;
197 for (end=1; (cnt+end) <= len && 197 for (end=1; (cnt+end) <= len &&
198 !IS_OPENER(message[cnt+end]); end++); 198 !IS_OPENER(message[cnt+end]) && !IS_CLOSER(message[cnt+end]); end++);
199 buf = g_new0(char, end); 199 buf = g_new0(char, end);
200 if (end) { 200 if (end) {
201 g_snprintf(buf, end, "%s", message+cnt+1); 201 g_snprintf(buf, end, "%s", message+cnt+1);
202 } 202 }
203 if (!g_ascii_strcasecmp(buf, "italic") || 203 if (!g_ascii_strcasecmp(buf, "italic") ||
241 cnt += end+1; /* cnt points to char after opener */ 241 cnt += end+1; /* cnt points to char after opener */
242 } else { 242 } else {
243 if ((cnt+end) > len) { 243 if ((cnt+end) > len) {
244 g_string_append_c(frames->text, '@'); 244 g_string_append_c(frames->text, '@');
245 cnt++; 245 cnt++;
246 } else { 246 } else if (IS_CLOSER(message[cnt+end])) {
247 /* We have @chars..closer . This is
248 merely a sequence of chars that isn't a formatting tag
249 */
250 int tmp=cnt;
251 while (tmp<=cnt+end) {
252 g_string_append_c(frames->text,message[tmp]);
253 tmp++;
254 }
255 cnt+=end+1;
256 } else {
247 /* unrecognized thingie. act like it's not there, but we 257 /* unrecognized thingie. act like it's not there, but we
248 * still need to take care of the corresponding closer, 258 * still need to take care of the corresponding closer,
249 * make a frame that does nothing. */ 259 * make a frame that does nothing. */
250 new_f = g_new(zframe, 1); 260 new_f = g_new(zframe, 1);
251 new_f->enclosing = frames; 261 new_f->enclosing = frames;