Mercurial > ~mikael > mcabber > hg
diff 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 |
line wrap: on
line diff
--- a/mcabber/src/histolog.c Tue Feb 13 21:48:17 2007 +0100 +++ b/mcabber/src/histolog.c Wed Feb 14 13:24:53 2007 +0100 @@ -61,6 +61,33 @@ return filename; } +char *hlog_get_log_jid(const char *bjid) +{ + struct stat bufstat; + char *path; + char *log_jid = NULL; + + path = user_histo_file(bjid); + do { + /*scr_LogPrint(LPRINT_NORMAL, "path=%s", path);*/ + if(lstat(path, &bufstat) != 0) + break; + if(S_ISLNK(bufstat.st_mode)) { + g_free(log_jid); + log_jid = g_new(char, bufstat.st_size+1); + readlink(path, log_jid, bufstat.st_size); + g_free(path); + log_jid[bufstat.st_size] = '\0'; + path = user_histo_file(log_jid); + } else { + g_free(path); + path = NULL; + } + } while( path ); + + return log_jid; +} + // write_histo_line() // Adds a history (multi-)line to the jid's history logfile static void write_histo_line(const char *bjid,