Mercurial > ~mikael > mcabber > hg
diff mcabber/src/histolog.c @ 1058:c0d44a9a99bc
Code cleanup
Cosmetics. Mostly get rid of "jid" variables, as it is a structure pointer
defined in libjabber/jabber.h.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 30 Nov 2006 19:51:09 +0100 |
parents | a833f3d6119a |
children | 8e12137fab20 |
line wrap: on
line diff
--- a/mcabber/src/histolog.c Tue Nov 28 07:14:59 2006 +0100 +++ b/mcabber/src/histolog.c Thu Nov 30 19:51:09 2006 +0100 @@ -40,20 +40,20 @@ static char *RootDir; -// user_histo_file() +// user_histo_file(jid) // Returns history filename for the given jid // Note: the caller *must* free the filename after use (if not null). -static char *user_histo_file(const char *jid) +static char *user_histo_file(const char *bjid) { char *filename; char *lowerid, *p; if (!UseFileLogging && !FileLoadLogs) return NULL; - lowerid = g_strdup(jid); + lowerid = g_strdup(bjid); for (p=lowerid; *p ; p++) *p = tolower(*p); - filename = g_new(char, strlen(RootDir) + strlen(jid) + 1); + filename = g_new(char, strlen(RootDir) + strlen(bjid) + 1); strcpy(filename, RootDir); strcat(filename, lowerid); g_free(lowerid); @@ -62,7 +62,7 @@ // write_histo_line() // Adds a history (multi-)line to the jid's history logfile -static void write_histo_line(const char *jid, +static void write_histo_line(const char *bjid, time_t timestamp, guchar type, guchar info, const char *data) { guint len = 0; @@ -75,7 +75,7 @@ if (!UseFileLogging) return; - filename = user_histo_file(jid); + filename = user_histo_file(bjid); // If timestamp is null, get current date if (timestamp) @@ -119,7 +119,7 @@ // hlog_read_history() // Reads the jid's history logfile -void hlog_read_history(const char *jid, GList **p_buddyhbuf, guint width) +void hlog_read_history(const char *bjid, GList **p_buddyhbuf, guint width) { char *filename; guchar type, info; @@ -136,7 +136,7 @@ if (!FileLoadLogs) return; - if ((roster_gettype(jid) & ROSTER_TYPE_ROOM) && + if ((roster_gettype(bjid) & ROSTER_TYPE_ROOM) && (settings_opt_get_int("load_muc_logs") != 1)) return; @@ -146,7 +146,7 @@ return; } - filename = user_histo_file(jid); + filename = user_histo_file(bjid); fp = fopen(filename, "r"); g_free(filename); @@ -156,7 +156,7 @@ // (it can take a while...) if (!fstat(fileno(fp), &bufstat)) { if (bufstat.st_size > 3145728) - scr_LogPrint(LPRINT_LOGNORM, "Reading <%s> history file...", jid); + scr_LogPrint(LPRINT_LOGNORM, "Reading <%s> history file...", bjid); } starttime = 0; @@ -186,7 +186,7 @@ (data[25] != ' ' && data[26] != ' '))) { if (!err) { scr_LogPrint(LPRINT_LOGNORM, - "Error in history file format (%s), l.%u", jid, ln); + "Error in history file format (%s), l.%u", bjid, ln); err = 1; } continue; @@ -202,7 +202,7 @@ ((type == 'I') && (!strchr("OAIFDN", info)))) { if (!err) { scr_LogPrint(LPRINT_LOGNORM, "Error in history file format (%s), l.%u", - jid, ln); + bjid, ln); err = 1; } continue; @@ -300,18 +300,18 @@ } } -inline void hlog_write_message(const char *jid, time_t timestamp, int sent, +inline void hlog_write_message(const char *bjid, time_t timestamp, int sent, const char *msg) { - write_histo_line(jid, timestamp, 'M', ((sent) ? 'S' : 'R'), msg); + write_histo_line(bjid, timestamp, 'M', ((sent) ? 'S' : 'R'), msg); } -inline void hlog_write_status(const char *jid, time_t timestamp, +inline void hlog_write_status(const char *bjid, time_t timestamp, enum imstatus status, const char *status_msg) { // #1 XXX Check status value? // #2 We could add a user-readable comment - write_histo_line(jid, timestamp, 'S', toupper(imstatus2char[status]), + write_histo_line(bjid, timestamp, 'S', toupper(imstatus2char[status]), status_msg); }