Mercurial > pidgin
comparison src/conversation.c @ 1434:348a70e15f07
[gaim-migrate @ 1444]
no more option to strip html. it didn't work anyway.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 28 Jan 2001 09:09:18 +0000 |
parents | 0137bacd63c8 |
children | 1f0660a2c893 |
comparison
equal
deleted
inserted
replaced
1433:f2f45486d656 | 1434:348a70e15f07 |
---|---|
112 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | 112 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { |
113 FILE *fd; | 113 FILE *fd; |
114 | 114 |
115 fd = open_log_file(c->name); | 115 fd = open_log_file(c->name); |
116 if (fd > 0) { | 116 if (fd > 0) { |
117 if (!(general_options & OPT_GEN_STRIP_HTML)) | 117 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", |
118 fprintf(fd, | |
119 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", | |
120 full_date()); | 118 full_date()); |
121 else | |
122 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); | |
123 fclose(fd); | 119 fclose(fd); |
124 } else | 120 } else |
125 /* do we want to do something here? */ ; | 121 /* do we want to do something here? */ ; |
126 } | 122 } |
127 | 123 |
816 } | 812 } |
817 } | 813 } |
818 g_free(s); | 814 g_free(s); |
819 } | 815 } |
820 | 816 |
821 static char *add_br(char *p) | 817 static char *html_logize(char *p) |
822 { | 818 { |
823 | 819 |
824 char *temp_p = p; | 820 char *temp_p = p; |
825 char *buffer_p; | 821 char *buffer_p; |
826 char *buffer_start; | 822 char *buffer_start; |
827 int num_cr = 0; | 823 int num_cr = 0; |
828 int char_len = 0; | 824 int char_len = 0; |
829 | 825 |
830 while (*temp_p != '\0') { | 826 while (*temp_p != '\0') { |
831 char_len++; | 827 char_len++; |
832 if (*temp_p == '\n') | 828 if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!'))) |
833 num_cr++; | 829 num_cr++; |
834 ++temp_p; | 830 ++temp_p; |
835 } | 831 } |
836 | 832 |
837 temp_p = p; | 833 temp_p = p; |
838 buffer_p = g_malloc(char_len + (4 * num_cr) + 1); | 834 buffer_p = g_malloc(char_len + (4 * num_cr) + 1); |
839 buffer_start = buffer_p; | 835 buffer_start = buffer_p; |
840 | 836 |
841 while (*temp_p != '\0') { | 837 while (*temp_p != '\0') { |
842 *buffer_p = *temp_p; | |
843 if (*temp_p == '\n') { | 838 if (*temp_p == '\n') { |
844 *buffer_p++ = '<'; | 839 *buffer_p++ = '<'; |
845 *buffer_p++ = 'B'; | 840 *buffer_p++ = 'B'; |
846 *buffer_p++ = 'R'; | 841 *buffer_p++ = 'R'; |
847 *buffer_p++ = '>'; | 842 *buffer_p++ = '>'; |
848 *buffer_p = '\n'; | 843 *buffer_p++ = '\n'; |
849 } | 844 } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) { |
850 ++buffer_p; | 845 *buffer_p++ = '&'; |
846 *buffer_p++ = 'g'; | |
847 *buffer_p++ = 't'; | |
848 *buffer_p++ = ';'; | |
849 } else | |
850 *buffer_p++ = *temp_p; | |
851 ++temp_p; | 851 ++temp_p; |
852 } | 852 } |
853 *buffer_p = '\0'; | 853 *buffer_p = '\0'; |
854 | 854 |
855 return buffer_start; | 855 return buffer_start; |
1159 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0); | 1159 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0); |
1160 | 1160 |
1161 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); | 1161 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); |
1162 | 1162 |
1163 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | 1163 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { |
1164 char *t1; | |
1165 char nm[256]; | 1164 char nm[256]; |
1166 | 1165 |
1167 if (general_options & OPT_GEN_STRIP_HTML) { | |
1168 t1 = strip_html(what); | |
1169 } else { | |
1170 t1 = what; | |
1171 } | |
1172 if (c->is_chat) | 1166 if (c->is_chat) |
1173 g_snprintf(nm, 256, "%s.chat", c->name); | 1167 g_snprintf(nm, 256, "%s.chat", c->name); |
1174 else | 1168 else |
1175 g_snprintf(nm, 256, "%s", c->name); | 1169 g_snprintf(nm, 256, "%s", c->name); |
1176 fd = open_log_file(nm); | 1170 fd = open_log_file(nm); |
1177 if (fd > 0) { | 1171 if (fd > 0) { |
1178 if (general_options & OPT_GEN_STRIP_HTML) { | 1172 fprintf(fd, "%s<BR>\n", what); |
1179 fprintf(fd, "%s\n", t1); | |
1180 } else { | |
1181 fprintf(fd, "%s<BR>\n", t1); | |
1182 } | |
1183 fclose(fd); | 1173 fclose(fd); |
1184 } | |
1185 if (general_options & OPT_GEN_STRIP_HTML) { | |
1186 g_free(t1); | |
1187 } | 1174 } |
1188 } | 1175 } |
1189 | 1176 |
1190 } else { | 1177 } else { |
1191 if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) { | 1178 if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) { |
1234 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options); | 1221 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options); |
1235 | 1222 |
1236 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); | 1223 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); |
1237 | 1224 |
1238 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { | 1225 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { |
1239 char *t1, *t2; | 1226 char *t1; |
1240 char *nm = g_malloc(256); | 1227 char nm[256]; |
1241 if (c->is_chat) | 1228 if (c->is_chat) |
1242 g_snprintf(nm, 256, "%s.chat", c->name); | 1229 g_snprintf(nm, 256, "%s.chat", c->name); |
1243 else | 1230 else |
1244 g_snprintf(nm, 256, "%s", c->name); | 1231 g_snprintf(nm, 256, "%s", c->name); |
1245 | 1232 |
1246 if (general_options & OPT_GEN_STRIP_HTML) { | 1233 t1 = html_logize(what); |
1247 t1 = strip_html(buf); | |
1248 t2 = strip_html(what); | |
1249 } else { | |
1250 t1 = add_br(buf); | |
1251 t2 = add_br(what); | |
1252 } | |
1253 fd = open_log_file(nm); | 1234 fd = open_log_file(nm); |
1254 if (fd > 0) { | 1235 if (fd > 0) { |
1255 if (general_options & OPT_GEN_STRIP_HTML) { | 1236 fprintf(fd, "%s%s<BR>\n", buf, t1); |
1256 fprintf(fd, "%s%s\n", t1, t2); | |
1257 } else { | |
1258 fprintf(fd, "%s%s<BR>\n", t1, t2); | |
1259 } | |
1260 fclose(fd); | 1237 fclose(fd); |
1261 } | 1238 } |
1262 g_free(t1); | 1239 g_free(t1); |
1263 g_free(t2); | |
1264 g_free(nm); | |
1265 } | 1240 } |
1266 } | 1241 } |
1267 | 1242 |
1268 /* if (!GTK_WIDGET_MAPPED(c->window)) { | 1243 /* if (!GTK_WIDGET_MAPPED(c->window)) { |
1269 | 1244 |