comparison src/conversation.c @ 1437:1f0660a2c893

[gaim-migrate @ 1447] i'm in a fucking bad mood committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 28 Jan 2001 23:11:57 +0000
parents 348a70e15f07
children 7688db14c6dc
comparison
equal deleted inserted replaced
1436:f6a9bd50fd19 1437:1f0660a2c893
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 fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", 117 if (!(general_options & OPT_GEN_STRIP_HTML))
118 fprintf(fd,
119 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
118 full_date()); 120 full_date());
121 else
122 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
119 fclose(fd); 123 fclose(fd);
120 } else 124 } else
121 /* do we want to do something here? */ ; 125 /* do we want to do something here? */ ;
122 } 126 }
123 127
812 } 816 }
813 } 817 }
814 g_free(s); 818 g_free(s);
815 } 819 }
816 820
817 static char *html_logize(char *p) 821 static char *add_br(char *p)
818 { 822 {
819 823
820 char *temp_p = p; 824 char *temp_p = p;
821 char *buffer_p; 825 char *buffer_p;
822 char *buffer_start; 826 char *buffer_start;
823 int num_cr = 0; 827 int num_cr = 0;
824 int char_len = 0; 828 int char_len = 0;
825 829
826 while (*temp_p != '\0') { 830 while (*temp_p != '\0') {
827 char_len++; 831 char_len++;
828 if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!'))) 832 if (*temp_p == '\n')
829 num_cr++; 833 num_cr++;
830 ++temp_p; 834 ++temp_p;
831 } 835 }
832 836
833 temp_p = p; 837 temp_p = p;
834 buffer_p = g_malloc(char_len + (4 * num_cr) + 1); 838 buffer_p = g_malloc(char_len + (4 * num_cr) + 1);
835 buffer_start = buffer_p; 839 buffer_start = buffer_p;
836 840
837 while (*temp_p != '\0') { 841 while (*temp_p != '\0') {
842 *buffer_p = *temp_p;
838 if (*temp_p == '\n') { 843 if (*temp_p == '\n') {
839 *buffer_p++ = '<'; 844 *buffer_p++ = '<';
840 *buffer_p++ = 'B'; 845 *buffer_p++ = 'B';
841 *buffer_p++ = 'R'; 846 *buffer_p++ = 'R';
842 *buffer_p++ = '>'; 847 *buffer_p++ = '>';
843 *buffer_p++ = '\n'; 848 *buffer_p = '\n';
844 } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) { 849 }
845 *buffer_p++ = '&'; 850 ++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;
1164 char nm[256]; 1165 char nm[256];
1165 1166
1167 if (general_options & OPT_GEN_STRIP_HTML) {
1168 t1 = strip_html(what);
1169 } else {
1170 t1 = what;
1171 }
1166 if (c->is_chat) 1172 if (c->is_chat)
1167 g_snprintf(nm, 256, "%s.chat", c->name); 1173 g_snprintf(nm, 256, "%s.chat", c->name);
1168 else 1174 else
1169 g_snprintf(nm, 256, "%s", c->name); 1175 g_snprintf(nm, 256, "%s", c->name);
1170 fd = open_log_file(nm); 1176 fd = open_log_file(nm);
1171 if (fd > 0) { 1177 if (fd > 0) {
1172 fprintf(fd, "%s<BR>\n", what); 1178 if (general_options & OPT_GEN_STRIP_HTML) {
1179 fprintf(fd, "%s\n", t1);
1180 } else {
1181 fprintf(fd, "%s<BR>\n", t1);
1182 }
1173 fclose(fd); 1183 fclose(fd);
1184 }
1185 if (general_options & OPT_GEN_STRIP_HTML) {
1186 g_free(t1);
1174 } 1187 }
1175 } 1188 }
1176 1189
1177 } else { 1190 } else {
1178 if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) { 1191 if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) {
1209 else if (flags & WFLAG_SEND) 1222 else if (flags & WFLAG_SEND)
1210 strcpy(colour, "#0000ff"); 1223 strcpy(colour, "#0000ff");
1211 } 1224 }
1212 } 1225 }
1213 1226
1214 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\"><!--(%s) --></FONT>" 1227 if (general_options & OPT_DISP_SHOW_TIME)
1215 "<B>%s</B></FONT> ", colour, date(), str); 1228 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\">(%s) </FONT>"
1229 "<B>%s</B></FONT> ", colour, date(), str);
1230 else
1231 g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT> ", colour, str);
1216 1232
1217 g_free(str); 1233 g_free(str);
1218 1234
1219 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, 0); 1235 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf, 0);
1220 1236
1221 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options); 1237 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options);
1222 1238
1223 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); 1239 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
1224 1240
1225 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { 1241 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) {
1226 char *t1; 1242 char *t1, *t2;
1227 char nm[256]; 1243 char *nm = g_malloc(256);
1228 if (c->is_chat) 1244 if (c->is_chat)
1229 g_snprintf(nm, 256, "%s.chat", c->name); 1245 g_snprintf(nm, 256, "%s.chat", c->name);
1230 else 1246 else
1231 g_snprintf(nm, 256, "%s", c->name); 1247 g_snprintf(nm, 256, "%s", c->name);
1232 1248
1233 t1 = html_logize(what); 1249 if (general_options & OPT_GEN_STRIP_HTML) {
1250 t1 = strip_html(buf);
1251 t2 = strip_html(what);
1252 } else {
1253 t1 = add_br(buf);
1254 t2 = add_br(what);
1255 }
1234 fd = open_log_file(nm); 1256 fd = open_log_file(nm);
1235 if (fd > 0) { 1257 if (fd > 0) {
1236 fprintf(fd, "%s%s<BR>\n", buf, t1); 1258 if (general_options & OPT_GEN_STRIP_HTML) {
1259 fprintf(fd, "%s%s\n", t1, t2);
1260 } else {
1261 fprintf(fd, "%s%s<BR>\n", t1, t2);
1262 }
1237 fclose(fd); 1263 fclose(fd);
1238 } 1264 }
1239 g_free(t1); 1265 g_free(t1);
1266 g_free(t2);
1267 g_free(nm);
1240 } 1268 }
1241 } 1269 }
1242 1270
1243 /* if (!GTK_WIDGET_MAPPED(c->window)) { 1271 /* if (!GTK_WIDGET_MAPPED(c->window)) {
1244 1272