From: <ro...@us...> - 2006-06-18 20:13:07
|
Revision: 16275 Author: roast Date: 2006-06-18 13:12:53 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16275&view=rev Log Message: ----------- xml logger flushes a well-formed xml file Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-06-18 02:03:08 UTC (rev 16274) +++ branches/soc-2006-file-loggers/src/log.c 2006-06-18 20:12:53 UTC (rev 16275) @@ -1056,11 +1056,21 @@ } g_free(msg_fixed); - fflush(data->file); - // TODO: haven't written end of file and seeked back - // TODO: this is to keep a valid XML document out of the user space buffer + // append suffix to file and seek back to keep a valid XML document out of the user space buffer + { + int tail = 0; + const char *date = gaim_utf8_strftime("%F %T%z", localtime(NULL)); + tail += fprintf(data->file, "\t<event time=\"%s\" type=\"logEnd\" />\n", date); + tail += fprintf(data->file, "</chat>\n"); + + if (fseek(data->file, -1*tail, SEEK_CUR) != 0) { + gaim_debug_error("log", "Could not seek backwards in logfile."); + } + } + + fflush(data->file); return written; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |