comparison src/util.c @ 5093:89c0c811befa

[gaim-migrate @ 5455] jabber XHTML support. since people tend to not like to write valid XHTML all of the time, we now have html_to_xhtml() which does its best to figure out what you meant. i'm tired, hope this works for everyone committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 10 Apr 2003 06:09:26 +0000
parents a96653493416
children 381da05cb5ed
comparison
equal deleted inserted replaced
5092:a4ad609ee6b3 5093:89c0c811befa
137 return ret; 137 return ret;
138 } 138 }
139 139
140 gint linkify_text(char *text) 140 gint linkify_text(char *text)
141 { 141 {
142 char *c, *t; 142 char *c, *t, *q = NULL;
143 char *cpy = g_malloc(strlen(text) * 3 + 1); 143 char *cpy = g_malloc(strlen(text) * 3 + 1);
144 char url_buf[BUF_LEN * 4]; 144 char url_buf[BUF_LEN * 4];
145 int cnt = 0; 145 int cnt = 0;
146 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ 146 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
147 147
148 strncpy(cpy, text, strlen(text)); 148 strncpy(cpy, text, strlen(text));
149 cpy[strlen(text)] = 0; 149 cpy[strlen(text)] = 0;
150 c = cpy; 150 c = cpy;
151 while (*c) { 151 while (*c) {
152 if (!g_ascii_strncasecmp(c, "<A", 2)) { 152 if(!q && (*c == '\"' || *c == '\'')) {
153 q = c;
154 } else if(q) {
155 if(*c == *q)
156 q = NULL;
157 } else if (!g_ascii_strncasecmp(c, "<A", 2)) {
153 while (1) { 158 while (1) {
154 if (!g_ascii_strncasecmp(c, "/A>", 3)) { 159 if (!g_ascii_strncasecmp(c, "/A>", 3)) {
155 break; 160 break;
156 } 161 }
157 text[cnt++] = *c; 162 text[cnt++] = *c;