Mercurial > pidgin
comparison src/conversation.c @ 2918:4df759d607f3
[gaim-migrate @ 2931]
this was a bad hack.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 22 Dec 2001 08:08:37 +0000 |
parents | 4254491c722b |
children | dd71bb88bc58 |
comparison
equal
deleted
inserted
replaced
2917:93e2c99ccf50 | 2918:4df759d607f3 |
---|---|
1149 } | 1149 } |
1150 } | 1150 } |
1151 g_free(s); | 1151 g_free(s); |
1152 } | 1152 } |
1153 | 1153 |
1154 static char *escape_html(char *w, int *l) | |
1155 { | |
1156 int c = 0; | |
1157 char *r; | |
1158 int i, x = 0; | |
1159 if (*l == -1) { | |
1160 *l = strlen(w); | |
1161 x = 1; | |
1162 } | |
1163 r = g_malloc(*l * 5 + 1); | |
1164 | |
1165 for (i = 0; i < *l; i++) { | |
1166 if (w[i] == '<') { | |
1167 r[c++] = '&'; | |
1168 r[c++] = 'l'; | |
1169 r[c++] = 't'; | |
1170 r[c++] = ';'; | |
1171 } else if (w[i] == '&') { | |
1172 r[c++] = '&'; | |
1173 r[c++] = 'a'; | |
1174 r[c++] = 'm'; | |
1175 r[c++] = 'p'; | |
1176 r[c++] = ';'; | |
1177 } else { | |
1178 r[c++] = w[i]; | |
1179 } | |
1180 } | |
1181 r[c] = 0; | |
1182 | |
1183 r = g_realloc(r, c + 1); | |
1184 if (x) | |
1185 *l = -1; | |
1186 else | |
1187 *l = c; | |
1188 return r; | |
1189 } | |
1190 | |
1191 static char *html_logize(char *p) | 1154 static char *html_logize(char *p) |
1192 { | 1155 { |
1193 | 1156 |
1194 char *temp_p = p; | 1157 char *temp_p = p; |
1195 char *buffer_p; | 1158 char *buffer_p; |
1590 } | 1553 } |
1591 } else if (flags & WFLAG_NOLOG) { | 1554 } else if (flags & WFLAG_NOLOG) { |
1592 g_snprintf(buf, BUF_LONG, "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", what); | 1555 g_snprintf(buf, BUF_LONG, "<B><FONT COLOR=\"#777777\">%s</FONT></B><BR>", what); |
1593 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, -1, 0); | 1556 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, -1, 0); |
1594 } else { | 1557 } else { |
1595 if (c->gc->flags & OPT_CONN_SHOW_HTML) | |
1596 what = g_memdup(what, length == -1 ? strlen(what) + 1 : length); | |
1597 else | |
1598 what = escape_html(what, &length); | |
1599 if (flags & WFLAG_WHISPER) { | 1558 if (flags & WFLAG_WHISPER) { |
1600 /* if we're whispering, it's not an autoresponse */ | 1559 /* if we're whispering, it's not an autoresponse */ |
1601 if (meify(what, length)) { | 1560 if (meify(what, length)) { |
1602 str = g_malloc(1024); | 1561 str = g_malloc(1024); |
1603 g_snprintf(str, 1024, "***%s", who); | 1562 g_snprintf(str, 1024, "***%s", who); |
1700 } | 1659 } |
1701 g_free(t1); | 1660 g_free(t1); |
1702 g_free(t2); | 1661 g_free(t2); |
1703 g_free(nm); | 1662 g_free(nm); |
1704 } | 1663 } |
1705 | |
1706 g_free(what); | |
1707 } | 1664 } |
1708 | 1665 |
1709 if ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || | 1666 if ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || |
1710 (!c->is_chat && (im_options & OPT_IM_POPUP))) | 1667 (!c->is_chat && (im_options & OPT_IM_POPUP))) |
1711 gdk_window_show(c->window->window); | 1668 gdk_window_show(c->window->window); |