[/trunk] Changeset 189 by mikael
* Add a "load_logs" variable to enable logs reading.
(Actual reading is not implemented yet...)
--- a/mcabber/mcabberrc.example Thu May 05 08:52:40 2005 +0000
+++ b/mcabber/mcabberrc.example Thu May 05 08:53:49 2005 +0000
@@ -25,8 +25,10 @@
# History logging
# You can save the messages history: set logging = 1
+# You can load (read) the messages history: set load_logs = 1
# Default logging directory (logging_dir) is $HOME/.mcabber/histo/
logging = 1
+#load_logs = 1
#logging_dir = /home/mikael/.mcabber/histo/
# External command for events
--- a/mcabber/src/TODO Thu May 05 08:52:40 2005 +0000
+++ b/mcabber/src/TODO Thu May 05 08:53:49 2005 +0000
@@ -17,6 +17,7 @@
* Add a function in hbuf ~previous_persistent(hbuf *top) (to avoid loosing the
top variable on a resize).
* Show number of online contacts in folded groups
+* Add a cfg_read_int() function
* Commands! :-)
- /roster <hide_offline|show_offline|top|bottom>
--- a/mcabber/src/histolog.c Thu May 05 08:52:40 2005 +0000
+++ b/mcabber/src/histolog.c Thu May 05 08:53:49 2005 +0000
@@ -32,6 +32,7 @@
#include "screen.h"
static guint UseFileLogging;
+static guint FileLoadLogs;
static char *RootDir;
@@ -96,11 +97,13 @@
// hlog_enable()
// Enable logging to files. If root_dir is NULL, then $HOME/.mcabber is used.
-void hlog_enable(guint enable, char *root_dir)
+// If loadfiles is TRUE, we will try to load buddies history logs from file.
+void hlog_enable(guint enable, char *root_dir, guint loadfiles)
{
UseFileLogging = enable;
+ FileLoadLogs = loadfiles;
- if (enable) {
+ if (enable || loadfiles) {
if (root_dir) {
int l = strlen(root_dir);
if (l < 1) {
--- a/mcabber/src/histolog.h Thu May 05 08:52:40 2005 +0000
+++ b/mcabber/src/histolog.h Thu May 05 08:53:49 2005 +0000
@@ -5,7 +5,7 @@
#include "jabglue.h"
-void hlog_enable(guint enable, char *root_dir);
+void hlog_enable(guint enable, char *root_dir, guint loadfile);
inline void hlog_write_message(const char *jid, time_t timestamp, int sent,
const char *msg);
inline void hlog_write_status(const char *jid, time_t timestamp,
--- a/mcabber/src/main.c Thu May 05 08:52:40 2005 +0000
+++ b/mcabber/src/main.c Thu May 05 08:53:49 2005 +0000
@@ -90,7 +90,8 @@
char *username, *password, *resource;
char *servername, *portstring;
char *jid;
- char *optstring;
+ char *optstring, *optstring2;
+ int optval, optval2;
int key;
unsigned int port;
unsigned int ping;
@@ -167,9 +168,12 @@
ut_WriteLog("Drawing main window...\n");
scr_DrawMainWindow(TRUE);
- optstring = cfg_read("logging");
- if (optstring && (atoi(optstring) > 0))
- hlog_enable(TRUE, cfg_read("logging_dir"));
+ optstring = cfg_read("logging");
+ optstring2 = cfg_read("load_logs");
+ optval = (optstring && (atoi(optstring) > 0));
+ optval2 = (optstring2 && (atoi(optstring2) > 0));
+ if (optval || optval2)
+ hlog_enable(optval, cfg_read("logging_dir"), optval2);
if ((optstring = cfg_read("events_command")) != NULL)
hk_ext_cmd_init(optstring);