/soc/2015/mmcc/main: 9f94cdfa8db2: remove XML logging, which was...
Michael McConville <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: 9f94cdfa8db2841ecbee45c2cbd4c0edf9091a1b Author: Michael McConville <[email protected]> Date: 2015-06-24 19:50 -0400 Branch: default URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/9f94cdfa8db2 Description: remove XML logging, which was disabled in 2003 diffstat: libpurple/log.c | 110 -------------------------------------------------------- 1 files changed, 0 insertions(+), 110 deletions(-) diffs (120 lines): diff --git a/libpurple/log.c b/libpurple/log.c --- a/libpurple/log.c +++ b/libpurple/log.c @@ -1284,116 +1284,6 @@ static char *process_txt_log(char *txt, return txt; } -#if 0 /* Maybe some other time. */ -/**************** - ** XML LOGGER ** - ****************/ - -static const char *str_from_msg_type (PurpleMessageFlags type) -{ - - return ""; - -} - -static void xml_logger_write(PurpleLog *log, - PurpleMessageFlags type, - const char *from, time_t time, const char *message) -{ - char *xhtml = NULL; - - if (!log->logger_data) { - /* This log is new. We could use the loggers 'new' function, but - * creating a new file there would result in empty files in the case - * that you open a convo with someone, but don't say anything. - */ - struct tm *tm; - const char *tz; - const char *date; - char *dir = purple_log_get_log_dir(log->type, log->name, log->account); - char *name; - char *filename; - - if (dir == NULL) - return; - - tm = localtime(&log->time); - tz = purple_escape_filename(purple_utf8_strftime("%Z", tm); - date = purple_utf8_strftime("%Y-%m-%d.%H%M%S%z", tm); - - name = g_strdup_printf("%s%s%s", date, tz, ext ? ext : ""); - - purple_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR); - - filename = g_build_filename(dir, name, NULL); - g_free(dir); - g_free(name); - - log->logger_data = g_fopen(filename, "a"); - if (!log->logger_data) { - purple_debug(PURPLE_DEBUG_ERROR, "log", "Could not create log file %s\n", filename); - g_free(filename); - return; - } - g_free(filename); - fprintf(log->logger_data, "<?xml version='1.0' encoding='UTF-8' ?>\n" - "<?xml-stylesheet href='file:///usr/src/web/htdocs/log-stylesheet.xsl' type='text/xml' ?>\n"); - - date = purple_utf8_strftime("%Y-%m-%d %H:%M:%S", localtime(&log->time)); - fprintf(log->logger_data, "<conversation time='%s' screenname='%s' protocol='%s'>\n", - date, log->name, protocol); - } - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return; - - date = log_get_timestamp(log, time); - - purple_markup_html_to_xhtml(message, &xhtml, NULL); - if (from) - fprintf(log->logger_data, "<message %s %s from='%s' time='%s'>%s</message>\n", - str_from_msg_type(type), - type & PURPLE_MESSAGE_SEND ? "direction='sent'" : - type & PURPLE_MESSAGE_RECV ? "direction='received'" : "", - from, date, xhtml); - else - fprintf(log->logger_data, "<message %s %s time='%s'>%s</message>\n", - str_from_msg_type(type), - type & PURPLE_MESSAGE_SEND ? "direction='sent'" : - type & PURPLE_MESSAGE_RECV ? "direction='received'" : "", - date, xhtml): - fflush(log->logger_data); - g_free(date); - g_free(xhtml); -} - - static void xml_logger_finalize(PurpleLog *log) -{ - if (log->logger_data) { - fprintf(log->logger_data, "</conversation>\n"); - fclose(log->logger_data); - log->logger_data = NULL; - } -} - -static GList *xml_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - return purple_log_common_lister(type, sn, account, ".xml", &xml_logger); -} - -static PurpleLogLogger xml_logger = { - N_("XML"), "xml", - NULL, - xml_logger_write, - xml_logger_finalize, - xml_logger_list, - NULL, - NULL, - NULL -}; -#endif - /**************************** ** HTML LOGGER ************* ****************************/ _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits