comparison src/gtkimhtml.c @ 1703:acce65ffdc80

[gaim-migrate @ 1713] better quote handling in tags? committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 12 Apr 2001 19:29:24 +0000
parents d802b115800f
children bcd7f80f0086
comparison
equal deleted inserted replaced
1702:70f9d7cdb127 1703:acce65ffdc80
2157 const gchar *text, 2157 const gchar *text,
2158 GtkIMHtmlOptions options) 2158 GtkIMHtmlOptions options)
2159 { 2159 {
2160 const gchar *c; 2160 const gchar *c;
2161 gboolean intag = FALSE; 2161 gboolean intag = FALSE;
2162 gboolean tagquote = FALSE; 2162 gint tagquote = 0;
2163 gboolean incomment = FALSE; 2163 gboolean incomment = FALSE;
2164 gchar *ws; 2164 gchar *ws;
2165 gchar *tag; 2165 gchar *tag;
2166 gint wpos = 0; 2166 gint wpos = 0;
2167 gint tpos = 0; 2167 gint tpos = 0;
2203 2203
2204 ws [0] = '\0'; 2204 ws [0] = '\0';
2205 2205
2206 while (*c) { 2206 while (*c) {
2207 if (*c == '<') { 2207 if (*c == '<') {
2208 if (intag && !tagquote) { 2208 if (intag && (tagquote != 1)) {
2209 char *d; 2209 char *d;
2210 tag [tpos] = 0; 2210 tag [tpos] = 0;
2211 d = tag; 2211 d = tag;
2212 while (*d) { 2212 while (*d) {
2213 if ((smilelen = gtk_imhtml_is_smiley (imhtml, d)) != 0) { 2213 if ((smilelen = gtk_imhtml_is_smiley (imhtml, d)) != 0) {
2262 continue; 2262 continue;
2263 } 2263 }
2264 2264
2265 tag [tpos++] = *c++; 2265 tag [tpos++] = *c++;
2266 intag = TRUE; 2266 intag = TRUE;
2267 tagquote = 0;
2267 } else if (incomment && (*c == '-') && !g_strncasecmp (c, "-->", strlen ("-->"))) { 2268 } else if (incomment && (*c == '-') && !g_strncasecmp (c, "-->", strlen ("-->"))) {
2268 gchar *tmp; 2269 gchar *tmp;
2269 ws [wpos] = 0; 2270 ws [wpos] = 0;
2270 wpos = 0; 2271 wpos = 0;
2271 tmp = g_strdup (ws); 2272 tmp = g_strdup (ws);
2276 strcat (ws, tmp + strlen ("<!--")); 2277 strcat (ws, tmp + strlen ("<!--"));
2277 g_free (tmp); 2278 g_free (tmp);
2278 NEW_BIT (NEW_COMMENT_BIT); 2279 NEW_BIT (NEW_COMMENT_BIT);
2279 incomment = FALSE; 2280 incomment = FALSE;
2280 c += strlen ("-->"); 2281 c += strlen ("-->");
2281 } else if (*c == '>' && intag && !tagquote) { 2282 } else if (*c == '>' && intag && (tagquote != 1)) {
2282 gboolean got_tag = FALSE; 2283 gboolean got_tag = FALSE;
2283 tag [tpos++] = *c++; 2284 tag [tpos++] = *c++;
2284 tag [tpos] = 0; 2285 tag [tpos] = 0;
2285 ws [wpos] = 0; 2286 ws [wpos] = 0;
2286 2287
2820 } else { 2821 } else {
2821 ws [wpos++] = *c++; 2822 ws [wpos++] = *c++;
2822 } 2823 }
2823 } else if (intag) { 2824 } else if (intag) {
2824 if (*c == '\"') 2825 if (*c == '\"')
2825 tagquote = !tagquote; 2826 tagquote++;
2826 tag [tpos++] = *c++; 2827 tag [tpos++] = *c++;
2827 } else if (incomment) { 2828 } else if (incomment) {
2828 ws [wpos++] = *c++; 2829 ws [wpos++] = *c++;
2829 } else if (((smilelen = gtk_imhtml_is_smiley (imhtml, c)) != 0)) { 2830 } else if (((smilelen = gtk_imhtml_is_smiley (imhtml, c)) != 0)) {
2830 ws [wpos] = 0; 2831 ws [wpos] = 0;