Mercurial > pidgin
diff 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 |
line wrap: on
line diff
--- a/src/conversation.c Sun Jan 28 09:34:22 2001 +0000 +++ b/src/conversation.c Sun Jan 28 23:11:57 2001 +0000 @@ -114,8 +114,12 @@ fd = open_log_file(c->name); if (fd > 0) { - fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", + if (!(general_options & OPT_GEN_STRIP_HTML)) + fprintf(fd, + "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date()); + else + fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); fclose(fd); } else /* do we want to do something here? */ ; @@ -814,7 +818,7 @@ g_free(s); } -static char *html_logize(char *p) +static char *add_br(char *p) { char *temp_p = p; @@ -825,7 +829,7 @@ while (*temp_p != '\0') { char_len++; - if ((*temp_p == '\n') || ((*temp_p == '<') && (*(temp_p + 1) == '!'))) + if (*temp_p == '\n') num_cr++; ++temp_p; } @@ -835,19 +839,15 @@ buffer_start = buffer_p; while (*temp_p != '\0') { + *buffer_p = *temp_p; if (*temp_p == '\n') { *buffer_p++ = '<'; *buffer_p++ = 'B'; *buffer_p++ = 'R'; *buffer_p++ = '>'; - *buffer_p++ = '\n'; - } else if ((*temp_p == '<') && (*(temp_p + 1) == '!')) { - *buffer_p++ = '&'; - *buffer_p++ = 'g'; - *buffer_p++ = 't'; - *buffer_p++ = ';'; - } else - *buffer_p++ = *temp_p; + *buffer_p = '\n'; + } + ++buffer_p; ++temp_p; } *buffer_p = '\0'; @@ -1161,17 +1161,30 @@ gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { + char *t1; char nm[256]; + if (general_options & OPT_GEN_STRIP_HTML) { + t1 = strip_html(what); + } else { + t1 = what; + } if (c->is_chat) g_snprintf(nm, 256, "%s.chat", c->name); else g_snprintf(nm, 256, "%s", c->name); fd = open_log_file(nm); if (fd > 0) { - fprintf(fd, "%s<BR>\n", what); + if (general_options & OPT_GEN_STRIP_HTML) { + fprintf(fd, "%s\n", t1); + } else { + fprintf(fd, "%s<BR>\n", t1); + } fclose(fd); } + if (general_options & OPT_GEN_STRIP_HTML) { + g_free(t1); + } } } else { @@ -1211,8 +1224,11 @@ } } - g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\"><!--(%s) --></FONT>" - "<B>%s</B></FONT> ", colour, date(), str); + if (general_options & OPT_DISP_SHOW_TIME) + g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\">(%s) </FONT>" + "<B>%s</B></FONT> ", colour, date(), str); + else + g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT> ", colour, str); g_free(str); @@ -1223,20 +1239,32 @@ gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { - char *t1; - char nm[256]; + char *t1, *t2; + char *nm = g_malloc(256); if (c->is_chat) g_snprintf(nm, 256, "%s.chat", c->name); else g_snprintf(nm, 256, "%s", c->name); - t1 = html_logize(what); + if (general_options & OPT_GEN_STRIP_HTML) { + t1 = strip_html(buf); + t2 = strip_html(what); + } else { + t1 = add_br(buf); + t2 = add_br(what); + } fd = open_log_file(nm); if (fd > 0) { - fprintf(fd, "%s%s<BR>\n", buf, t1); + if (general_options & OPT_GEN_STRIP_HTML) { + fprintf(fd, "%s%s\n", t1, t2); + } else { + fprintf(fd, "%s%s<BR>\n", t1, t2); + } fclose(fd); } g_free(t1); + g_free(t2); + g_free(nm); } }