diff -r e284917fa740 -r 72893d196f1a libpurple/log.c --- a/libpurple/log.c Tue Jul 21 14:21:01 2015 -0400 +++ b/libpurple/log.c Tue Jul 21 14:38:00 2015 -0400 @@ -1284,116 +1284,6 @@ 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, "\n" - "\n"); - - date = purple_utf8_strftime("%Y-%m-%d %H:%M:%S", localtime(&log->time)); - fprintf(log->logger_data, "\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, "%s\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, "%s\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, "\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 ************* ****************************/