Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/utils.c @ 1897:efd7c4c34ff2
Display mcabber version when starting a trace log
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 12 Apr 2010 22:22:22 +0200 |
parents | a20701a2840c |
children | 3695266e16c7 |
comparison
equal
deleted
inserted
replaced
1896:c5ab9cf3819a | 1897:efd7c4c34ff2 |
---|---|
50 #include <ctype.h> | 50 #include <ctype.h> |
51 | 51 |
52 #include "utils.h" | 52 #include "utils.h" |
53 #include "logprint.h" | 53 #include "logprint.h" |
54 #include "settings.h" | 54 #include "settings.h" |
55 #include "main.h" | |
55 | 56 |
56 static int DebugEnabled; | 57 static int DebugEnabled; |
57 static char *FName; | 58 static char *FName; |
58 | 59 |
59 // jidtodisp(jid) | 60 // jidtodisp(jid) |
158 static gboolean tracelog_create(void) | 159 static gboolean tracelog_create(void) |
159 { | 160 { |
160 FILE *fp; | 161 FILE *fp; |
161 struct stat buf; | 162 struct stat buf; |
162 int err; | 163 int err; |
164 char *v; | |
163 | 165 |
164 fp = fopen(FName, "a"); | 166 fp = fopen(FName, "a"); |
165 if (!fp) { | 167 if (!fp) { |
166 scr_LogPrint(LPRINT_NORMAL, "ERROR: Cannot open tracelog file: %s!", | 168 scr_LogPrint(LPRINT_NORMAL, "ERROR: Cannot open tracelog file: %s!", |
167 strerror(errno)); | 169 strerror(errno)); |
178 scr_LogPrint(LPRINT_NORMAL, "ERROR: tracelog file does not belong to you!"); | 180 scr_LogPrint(LPRINT_NORMAL, "ERROR: tracelog file does not belong to you!"); |
179 return FALSE; | 181 return FALSE; |
180 } | 182 } |
181 fchmod(fileno(fp), S_IRUSR|S_IWUSR); | 183 fchmod(fileno(fp), S_IRUSR|S_IWUSR); |
182 | 184 |
183 fputs("New trace log started.\n----------------------\n", fp); | 185 v = mcabber_version(); |
186 fprintf(fp, "New trace log started. MCabber version %s\n" | |
187 "----------------------\n", v); | |
188 g_free(v); | |
184 fclose(fp); | 189 fclose(fp); |
185 | |
186 return TRUE; | 190 return TRUE; |
187 } | 191 } |
188 | 192 |
189 static gchar *tracelog_level_guard(const gchar *key, const gchar *new_value) | 193 static gchar *tracelog_level_guard(const gchar *key, const gchar *new_value) |
190 { | 194 { |