comparison src/util.c @ 8538:848dfa9fe9d4

[gaim-migrate @ 9279] fix the single quote link thing the right way committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 31 Mar 2004 22:56:09 +0000
parents 389e2b9dae6a
children 2d4ccd94e298
comparison
equal deleted inserted replaced
8537:dc818b62379e 8538:848dfa9fe9d4
1148 gaim_markup_linkify(const char *text) 1148 gaim_markup_linkify(const char *text)
1149 { 1149 {
1150 const char *c, *t, *q = NULL; 1150 const char *c, *t, *q = NULL;
1151 char *tmp; 1151 char *tmp;
1152 char url_buf[BUF_LEN * 4]; 1152 char url_buf[BUF_LEN * 4];
1153 gboolean inside_html = FALSE;
1153 GString *ret = g_string_new(""); 1154 GString *ret = g_string_new("");
1154 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ 1155 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
1155 1156
1156 c = text; 1157 c = text;
1157 while (*c) { 1158 while (*c) {
1158 if(!q && (*c == '\"' || *c == '\'')) { 1159 if(inside_html) {
1159 q = c; 1160 if(*c == '>') {
1161 inside_html = FALSE;
1162 } else if(!q && (*c == '\"' || *c == '\'')) {
1163 q = c;
1164 } else if(q) {
1165 if(*c == *q)
1166 q = NULL;
1167 }
1168 } else if(*c == '<') {
1169 inside_html = TRUE;
1160 } else if (!g_ascii_strncasecmp(c, "<A", 2)) { 1170 } else if (!g_ascii_strncasecmp(c, "<A", 2)) {
1161 while (1) { 1171 while (1) {
1162 if (!g_ascii_strncasecmp(c, "/A>", 3)) { 1172 if (!g_ascii_strncasecmp(c, "/A>", 3)) {
1163 break; 1173 break;
1164 } 1174 }
1334 url_buf[len] = 0; 1344 url_buf[len] = 0;
1335 } 1345 }
1336 1346
1337 t++; 1347 t++;
1338 } 1348 }
1339 } else if(q) {
1340 if(*c == *q)
1341 q = NULL;
1342 } 1349 }
1343 1350
1344 if (*c == 0) 1351 if (*c == 0)
1345 break; 1352 break;
1346 1353