Mercurial > hg
comparison mcabber/src/histolog.c @ 1155:3b9bbf6c4c93
Added hlog_get_log_jid(): returns the value of a symlinked history file or NULL if it isn't symlinked
author | Frank Zschockelt |
---|---|
date | Wed, 14 Feb 2007 13:24:53 +0100 |
parents | b8f5fe2d666a |
children | 9726c78a91f3 |
comparison
equal
deleted
inserted
replaced
1154:f746d91c5d3b | 1155:3b9bbf6c4c93 |
---|---|
59 filename = g_strdup_printf("%s%s", RootDir, lowerid); | 59 filename = g_strdup_printf("%s%s", RootDir, lowerid); |
60 g_free(lowerid); | 60 g_free(lowerid); |
61 return filename; | 61 return filename; |
62 } | 62 } |
63 | 63 |
64 char *hlog_get_log_jid(const char *bjid) | |
65 { | |
66 struct stat bufstat; | |
67 char *path; | |
68 char *log_jid = NULL; | |
69 | |
70 path = user_histo_file(bjid); | |
71 do { | |
72 /*scr_LogPrint(LPRINT_NORMAL, "path=%s", path);*/ | |
73 if(lstat(path, &bufstat) != 0) | |
74 break; | |
75 if(S_ISLNK(bufstat.st_mode)) { | |
76 g_free(log_jid); | |
77 log_jid = g_new(char, bufstat.st_size+1); | |
78 readlink(path, log_jid, bufstat.st_size); | |
79 g_free(path); | |
80 log_jid[bufstat.st_size] = '\0'; | |
81 path = user_histo_file(log_jid); | |
82 } else { | |
83 g_free(path); | |
84 path = NULL; | |
85 } | |
86 } while( path ); | |
87 | |
88 return log_jid; | |
89 } | |
90 | |
64 // write_histo_line() | 91 // write_histo_line() |
65 // Adds a history (multi-)line to the jid's history logfile | 92 // Adds a history (multi-)line to the jid's history logfile |
66 static void write_histo_line(const char *bjid, | 93 static void write_histo_line(const char *bjid, |
67 time_t timestamp, guchar type, guchar info, const char *data) | 94 time_t timestamp, guchar type, guchar info, const char *data) |
68 { | 95 { |