# HG changeset patch # User Frank Zschockelt # Date 1171455893 -3600 # Node ID 3b9bbf6c4c93ce87c8103a7407981560530cdf10 # Parent f746d91c5d3b4b7764c8ca7d1e1af8260b9673aa Added hlog_get_log_jid(): returns the value of a symlinked history file or NULL if it isn't symlinked diff -r f746d91c5d3b -r 3b9bbf6c4c93 mcabber/src/histolog.c --- 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, diff -r f746d91c5d3b -r 3b9bbf6c4c93 mcabber/src/histolog.h --- a/mcabber/src/histolog.h Tue Feb 13 21:48:17 2007 +0100 +++ b/mcabber/src/histolog.h Wed Feb 14 13:24:53 2007 +0100 @@ -6,6 +6,7 @@ #include "jabglue.h" void hlog_enable(guint enable, const char *root_dir, guint loadfile); +char *hlog_get_log_jid(const char *bjid); void hlog_read_history(const char *bjid, GList **p_buddyhbuf, guint width); inline void hlog_write_message(const char *bjid, time_t timestamp, int sent, const char *msg);