summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--doc/en/autogen/user/logger_options.txt4
-rw-r--r--doc/en/weechat_plugin_api.en.txt5
-rw-r--r--doc/fr/autogen/user/irc_options.txt4
-rw-r--r--doc/fr/autogen/user/logger_options.txt6
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt5
-rw-r--r--doc/it/autogen/user/logger_options.txt4
-rw-r--r--po/cs.po19
-rw-r--r--po/de.po19
-rw-r--r--po/es.po19
-rw-r--r--po/fr.po30
-rw-r--r--po/hu.po17
-rw-r--r--po/it.po19
-rw-r--r--po/pl.po19
-rw-r--r--po/ru.po17
-rw-r--r--po/weechat.pot16
-rw-r--r--src/core/wee-config.c6
-rw-r--r--src/plugins/logger/logger-buffer.c22
-rw-r--r--src/plugins/logger/logger-buffer.h2
-rw-r--r--src/plugins/logger/logger-config.c36
-rw-r--r--src/plugins/logger/logger.c356
-rw-r--r--src/plugins/logger/logger.h5
22 files changed, 463 insertions, 171 deletions
diff --git a/ChangeLog b/ChangeLog
index 1028e986f..be5b6449f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,16 @@
WeeChat ChangeLog
=================
FlashCode <flashcode@flashtux.org>
-v0.3.2-dev, 2010-01-25
+v0.3.2-dev, 2010-01-26
Version 0.3.2 (under dev!)
--------------------------
+* core: add signal "day_changed"
* api: add missing infos in functions buffer_get_integer / buffer_get_string
and in buffer infolist
* irc: add options irc.look.smart_filter_join and irc.look.smart_filter_quit
+* logger: allow date format in logger options path and mask (task #9430)
Version 0.3.1 (2010-01-23)
--------------------------
diff --git a/doc/en/autogen/user/logger_options.txt b/doc/en/autogen/user/logger_options.txt
index 06a3ea379..dc944f880 100644
--- a/doc/en/autogen/user/logger_options.txt
+++ b/doc/en/autogen/user/logger_options.txt
@@ -9,7 +9,7 @@
** values: on, off (default value: off)
* *logger.file.mask*
-** description: default file name mask for log files (format is "directory/to/file" or "file", without first "/" because "path" option is used to build complete path to file); local buffer variables are permitted
+** description: default file name mask for log files (format is "directory/to/file" or "file", without first "/" because "path" option is used to build complete path to file); local buffer variables are permitted; date specifiers are permitted (see man strftime)
** type: string
** values: any string (default value: "$plugin.$name.weechatlog")
@@ -19,7 +19,7 @@
** values: on, off (default value: on)
* *logger.file.path*
-** description: path for WeeChat log files ("%h" will be replaced by WeeChat home, "~/.weechat" by default)
+** description: path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime)
** type: string
** values: any string (default value: "%h/logs/")
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index 49c8f1ae5..dfc64149d 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -5389,7 +5389,7 @@ Arguments:
* 'signal': signal to catch, can begin or end with "*":
-[width="80%",cols="^1,^3,^3,5",options="header"]
+[width="100%",cols="^1,^3,^4,5",options="header"]
|========================================
| Plugin | Signal | Arguments | Description
@@ -5477,6 +5477,9 @@ Arguments:
| weechat | buffer_type_changed | pointer: buffer |
type of buffer changed
+| weechat | day_changed | string: new date, format: "2010-01-31" |
+ day of system date has changed
+
| weechat | debug_dump | - |
dump request
diff --git a/doc/fr/autogen/user/irc_options.txt b/doc/fr/autogen/user/irc_options.txt
index a8eaa2f5a..8c4c23e17 100644
--- a/doc/fr/autogen/user/irc_options.txt
+++ b/doc/fr/autogen/user/irc_options.txt
@@ -149,12 +149,12 @@
** valeurs: 1 .. 10080 (valeur par défaut: 5)
* *irc.look.smart_filter_join*
-** description: enable smart filter for "join" messages
+** description: activer le filtre intelligent pour les messages "join"
** type: booléen
** valeurs: on, off (valeur par défaut: on)
* *irc.look.smart_filter_quit*
-** description: enable smart filter for "part" and "quit" messages
+** description: activer le filtre intelligent pour les messages "part" et "quit"
** type: booléen
** valeurs: on, off (valeur par défaut: on)
diff --git a/doc/fr/autogen/user/logger_options.txt b/doc/fr/autogen/user/logger_options.txt
index 018db057e..69584d90e 100644
--- a/doc/fr/autogen/user/logger_options.txt
+++ b/doc/fr/autogen/user/logger_options.txt
@@ -9,7 +9,7 @@
** valeurs: on, off (valeur par défaut: off)
* *logger.file.mask*
-** description: masque de fichier par défaut pour les fichiers de log (le format est "repertoire/vers/fichier" ou "fichier", sans le premier "/" car l'option "path" est utilisée pour construire le chemin complet vers le fichier); les variables locales du tampon sont permises
+** description: masque de fichier par défaut pour les fichiers de log (le format est "repertoire/vers/fichier" ou "fichier", sans le premier "/" car l'option "path" est utilisée pour construire le chemin complet vers le fichier); les variables locales du tampon sont permises; les caractères de formatage de date sont autorisés (voir man strftime)
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: "$plugin.$name.weechatlog")
@@ -19,7 +19,7 @@
** valeurs: on, off (valeur par défaut: on)
* *logger.file.path*
-** description: chemin pour les fichiers de log WeeChat ("%h" sera remplacé par le répertoire de base WeeChat, par défaut: "~/.weechat")
+** description: chemin pour les fichiers de log WeeChat; "%h" au début de la chaîne est remplacé par le répertoire de base WeeChat (par défaut: "~/.weechat"); les caractères de formatage de date sont autorisés (voir man strftime)
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: "%h/logs/")
@@ -29,7 +29,7 @@
** valeurs: toute chaîne (valeur par défaut: "_")
* *logger.file.time_format*
-** description: format de date/heure utilisé dans les fichiers log (voir strftime(3) pour le format de date/heure)
+** description: format de date/heure utilisé dans les fichiers log (voir man strftime pour le format de date/heure)
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: "%Y-%m-%d %H:%M:%S")
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 8e01d051c..12c945b1f 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -5462,7 +5462,7 @@ Paramètres :
* 'signal' : signal à intercepter, peut commencer ou se terminer par "*" :
-[width="80%",cols="^1,^3,^3,5",options="header"]
+[width="100%",cols="^1,^3,^4,5",options="header"]
|========================================
| Extension | Signal | Paramètres | Description
@@ -5550,6 +5550,9 @@ Paramètres :
| weechat | buffer_type_changed | pointeur : tampon |
type de tampon changé
+| weechat | day_changed | chaîne : nouvelle date, format : "2010-01-31" |
+ le jour de la date système a changé
+
| weechat | debug_dump | - |
requête de "dump"
diff --git a/doc/it/autogen/user/logger_options.txt b/doc/it/autogen/user/logger_options.txt
index 831a4b7f2..008d61d8d 100644
--- a/doc/it/autogen/user/logger_options.txt
+++ b/doc/it/autogen/user/logger_options.txt
@@ -9,7 +9,7 @@
** valori: on, off (valore predefinito: off)
* *logger.file.mask*
-** descrizione: mask del nome file predefinito per i file di log (il formato è "cartella/per/file" oppure "file", senza la prima "/" perché l'opzione "path" è utilizzata per costruire il percorso completo del file); sono ammesse le variabili dei buffer locali
+** descrizione: default file name mask for log files (format is "directory/to/file" or "file", without first "/" because "path" option is used to build complete path to file); local buffer variables are permitted; date specifiers are permitted (see man strftime)
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: "$plugin.$name.weechatlog")
@@ -19,7 +19,7 @@
** valori: on, off (valore predefinito: on)
* *logger.file.path*
-** descrizione: percorso per i file di log di WeeChat ("%h" verrà sostituito dalla cartella home di WeeChat, predefinita è "~/.weechat)
+** descrizione: path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime)
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: "%h/logs/")
diff --git a/po/cs.po b/po/cs.po
index 03a57d5ad..413db28a7 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:56+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4132,6 +4132,13 @@ msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr "zpoždění pro filtrování zpráv join/part/quit (v minutách)"
+#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "prefix pro zprávy připojení"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -4987,17 +4994,21 @@ msgstr ""
msgid "use only lower case for log filenames"
msgstr "používat pouze malé písmena ve jménech logovacích souborů"
+#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"cesta pro logovací soubory WeeChat (\"%h\" bude nahrazeno domácím adresářem "
"WeeChat, \"~/.weechat\" je výchozí)"
+#, fuzzy
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"výchozí maska jména souboru pro logovací soubory (formát je \"adresář/k/"
"souboru\" nebo \"soubor\", bez úvoního \"/\", protože pro vytvoření celé "
diff --git a/po/de.po b/po/de.po
index 93e9f71a2..fc5f7eb9b 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:56+0100\n"
"Last-Translator: Nils G <weechatter@arcor.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4316,6 +4316,13 @@ msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
"Verzögerung, in Minuten, in denen join/part/quit Nachrichten gefiltert werden"
+#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "Präfix für Join-Nachrichten"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -5183,17 +5190,21 @@ msgstr ""
msgid "use only lower case for log filenames"
msgstr "Benutze ausschließlich Kleinschreibung für Protokoll-Dateien"
+#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"Suchpfad für WeeChat-Protokoll-Dateien (\"%h\" wird durch das WeeChat-"
"Basisverzeichnis ersetzt. Voreingestellt ist \"~/.weechat\")"
+#, fuzzy
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"Standard-Maske für Protokoll-Dateien (Format: \"Verzeichnis/zu/Datei\" oder "
"\"Datei\", ohne führendes \"/\" da die \"Verzeichnis\" Option genutzt wird "
diff --git a/po/es.po b/po/es.po
index 5e31ae784..f320ec4ed 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:56+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4224,6 +4224,13 @@ msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
"tiempo de espera para filtrar mensajes de unión/abandono/salida (en minutos)"
+#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "prefijo para mensajes de unión"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -5088,17 +5095,21 @@ msgstr ""
msgid "use only lower case for log filenames"
msgstr "usar solamente minúsculas para el nombre de los archivos"
+#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"ruta para los registros de WeeChat (\"%h\" será reemplazado por el "
"directorio raíz de WeeChat, \"~/.weechat\" por defecto)"
+#, fuzzy
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"máscara para nombre del archivo de registro por defecto (el formato es "
"\"directorio/al/archivo\" o \"archivo\", sin el primer \"/\" porque la "
diff --git a/po/fr.po b/po/fr.po
index 96f299618..90b0f42c8 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
-"PO-Revision-Date: 2010-01-23 11:56+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
+"PO-Revision-Date: 2010-01-26 16:02+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -4251,6 +4251,12 @@ msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr "délai pour filtrer les messages join/part/quit (en minutes)"
+msgid "enable smart filter for \"join\" messages"
+msgstr "activer le filtre intelligent pour les messages \"join\""
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr "activer le filtre intelligent pour les messages \"part\" et \"quit\""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -5109,21 +5115,25 @@ msgid "use only lower case for log filenames"
msgstr "utiliser seulement des minuscules dans le nom des fichiers de log"
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
-"chemin pour les fichiers de log WeeChat (\"%h\" sera remplacé par le "
-"répertoire de base WeeChat, par défaut: \"~/.weechat\")"
+"chemin pour les fichiers de log WeeChat; \"%h\" au début de la chaîne est "
+"remplacé par le répertoire de base WeeChat (par défaut: \"~/.weechat\"); les "
+"caractères de formatage de date sont autorisés (voir man strftime)"
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"masque de fichier par défaut pour les fichiers de log (le format est "
"\"repertoire/vers/fichier\" ou \"fichier\", sans le premier \"/\" car "
"l'option \"path\" est utilisée pour construire le chemin complet vers le "
-"fichier); les variables locales du tampon sont permises"
+"fichier); les variables locales du tampon sont permises; les caractères de "
+"formatage de date sont autorisés (voir man strftime)"
msgid ""
"replacement char for special chars in filename built with mask (like "
@@ -5139,8 +5149,8 @@ msgstr ""
msgid "timestamp used in log files (see man strftime for date/time specifiers)"
msgstr ""
-"format de date/heure utilisé dans les fichiers log (voir strftime(3) pour le "
-"format de date/heure)"
+"format de date/heure utilisé dans les fichiers log (voir man strftime pour "
+"le format de date/heure)"
msgid "list of logger buffers"
msgstr "liste des enregistreurs de tampons (loggers)"
diff --git a/po/hu.po b/po/hu.po
index 74e09c278..d8232c644 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:57+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4073,6 +4073,13 @@ msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "új üzenetet tartalmazó ablak színe"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
+#, fuzzy
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr "figyelmeztetések privát üzenetként való mutatása"
@@ -4889,8 +4896,9 @@ msgstr ""
#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"modulok elérési útvonala ('%h' helyére automatikusan a WeeChat saját "
"könyvtára, alapértelmezésben ~/.weechat, kerül)"
@@ -4898,7 +4906,8 @@ msgstr ""
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
msgid ""
diff --git a/po/it.po b/po/it.po
index 5dbd047a3..2c62f99ec 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Weechat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:57+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4225,6 +4225,13 @@ msgstr ""
"ritardo per il filtraggio dei messaggi di entrata/uscita/abbandono (in "
"minuti)"
+#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "prefisso per i messaggi di entrata"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -5080,17 +5087,21 @@ msgstr ""
msgid "use only lower case for log filenames"
msgstr "utilizzare solo lettere minuscole per i nomi dei file di log"
+#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"percorso per i file di log di WeeChat (\"%h\" verrà sostituito dalla "
"cartella home di WeeChat, predefinita è \"~/.weechat)"
+#, fuzzy
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"mask del nome file predefinito per i file di log (il formato è \"cartella/"
"per/file\" oppure \"file\", senza la prima \"/\" perché l'opzione \"path\" è "
diff --git a/po/pl.po b/po/pl.po
index 1a40d5579..397557441 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:57+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: Polish\n"
@@ -4205,6 +4205,13 @@ msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
"odstęp dla filtrowania wiadomości wejścia/opuszczenia/wyjścia (w minutach)"
+#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "przedrostek indormacji o wejsciu na kanał"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -5056,17 +5063,21 @@ msgstr ""
msgid "use only lower case for log filenames"
msgstr "używaj tylko małych liter dla nazw plików z logami"
+#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"ścieżka do plików z logami WeeChat (\"%h\" zostanie zastąpione przez katalog "
"domowy WeeChat, domyślnie \".weechat\")"
+#, fuzzy
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
"domyślna maska nazw plików z logami (format to \"ścieżka/do/pliku\" lub "
"\"plik\", bez pierwszego \"/\" ponieważ opcja \"path\" jest użyta do "
diff --git a/po/ru.po b/po/ru.po
index 68a91f456..39cd324dc 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: 2010-01-23 11:57+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4074,6 +4074,13 @@ msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
#, fuzzy
+msgid "enable smart filter for \"join\" messages"
+msgstr "цвет текущего окна с сообщениями"
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
+#, fuzzy
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr "отображать notice'ы в виде личных сообщений"
@@ -4893,8 +4900,9 @@ msgstr ""
#, fuzzy
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
"путь поиска pluginов ('%h' заменяется на домашний каталог WeeChat, по "
"умолчанию - ~/.weechat)"
@@ -4902,7 +4910,8 @@ msgstr ""
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
msgid ""
diff --git a/po/weechat.pot b/po/weechat.pot
index cb1983aa2..79a36825f 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-01-18 10:29+0100\n"
+"POT-Creation-Date: 2010-01-26 16:02+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3469,6 +3469,12 @@ msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr ""
+msgid "enable smart filter for \"join\" messages"
+msgstr ""
+
+msgid "enable smart filter for \"part\" and \"quit\" messages"
+msgstr ""
+
msgid ""
"display notices as private messages (if auto, use private buffer if found)"
msgstr ""
@@ -4230,14 +4236,16 @@ msgid "use only lower case for log filenames"
msgstr ""
msgid ""
-"path for WeeChat log files (\"%h\" will be replaced by WeeChat home, \"~/."
-"weechat\" by default)"
+"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
+"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
+"man strftime)"
msgstr ""
msgid ""
"default file name mask for log files (format is \"directory/to/file\" or "
"\"file\", without first \"/\" because \"path\" option is used to build "
-"complete path to file); local buffer variables are permitted"
+"complete path to file); local buffer variables are permitted; date "
+"specifiers are permitted (see man strftime)"
msgstr ""
msgid ""
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index f63fac17c..384e42e69 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -344,7 +344,7 @@ config_day_change_timer_cb (void *data, int remaining_calls)
{
struct timeval tv_time;
struct tm *local_time;
- char text_time[1024], *text_time2;
+ char text_time[256], *text_time2;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
@@ -374,6 +374,10 @@ config_day_change_timer_cb (void *data, int remaining_calls)
if (text_time2)
free (text_time2);
gui_add_hotlist = 1;
+
+ /* send signal "day_changed" */
+ strftime (text_time, sizeof (text_time), "%Y-%m-%d", local_time);
+ hook_signal_send ("day_changed", WEECHAT_HOOK_SIGNAL_STRING, text_time);
}
config_day_change_old_day = local_time->tm_mday;
diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c
index 665c7e5af..038d8e765 100644
--- a/src/plugins/logger/logger-buffer.c
+++ b/src/plugins/logger/logger-buffer.c
@@ -89,6 +89,7 @@ logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
new_logger_buffer->log_file = NULL;
new_logger_buffer->log_enabled = 1;
new_logger_buffer->log_level = log_level;
+ new_logger_buffer->write_start_info_line = 1;
new_logger_buffer->prev_buffer = last_logger_buffer;
new_logger_buffer->next_buffer = NULL;
@@ -156,14 +157,9 @@ void
logger_buffer_free (struct t_logger_buffer *logger_buffer)
{
struct t_logger_buffer *new_logger_buffers;
+ struct t_gui_buffer *ptr_buffer;
- if (weechat_logger_plugin->debug)
- {
- weechat_printf (NULL,
- "%s: stop logging for buffer \"%s\"",
- LOGGER_PLUGIN_NAME,
- weechat_buffer_get_string (logger_buffer->buffer, "name"));
- }
+ ptr_buffer = logger_buffer->buffer;
/* remove logger buffer */
if (last_logger_buffer == logger_buffer)
@@ -182,10 +178,20 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer)
/* free data */
if (logger_buffer->log_filename)
free (logger_buffer->log_filename);
+ if (logger_buffer->log_file)
+ fclose (logger_buffer->log_file);
free (logger_buffer);
logger_buffers = new_logger_buffers;
+
+ if (weechat_logger_plugin->debug)
+ {
+ weechat_printf (NULL,
+ "%s: stop logging for buffer \"%s\"",
+ LOGGER_PLUGIN_NAME,
+ weechat_buffer_get_string (ptr_buffer, "name"));
+ }
}
/*
@@ -216,6 +222,8 @@ logger_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "log_level", logger_buffer->log_level))
return 0;
+ if (!weechat_infolist_new_var_integer (ptr_item, "write_start_info_line", logger_buffer->write_start_info_line))
+ return 0;
return 1;
}
diff --git a/src/plugins/logger/logger-buffer.h b/src/plugins/logger/logger-buffer.h
index 519ae978f..a64f7fde4 100644
--- a/src/plugins/logger/logger-buffer.h
+++ b/src/plugins/logger/logger-buffer.h
@@ -29,6 +29,8 @@ struct t_logger_buffer
FILE *log_file; /* log file */
int log_enabled; /* log enabled ? */
int log_level; /* log level (0..9) */
+ int write_start_info_line; /* 1 if start info line must be */
+ /* written in file */
struct t_logger_buffer *prev_buffer; /* link to previous buffer */
struct t_logger_buffer *next_buffer; /* link to next buffer */
};
diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c
index 3a5deacce..dc61e5239 100644
--- a/src/plugins/logger/logger-config.c
+++ b/src/plugins/logger/logger-config.c
@@ -63,10 +63,7 @@ logger_config_change_file_option_restart_log (void *data,
(void) option;
if (!logger_config_loading)
- {
- logger_stop_all ();
- logger_start_buffer_all ();
- }
+ logger_adjust_log_filenames ();
}
/*
@@ -80,9 +77,9 @@ logger_config_level_change (void *data,
/* make C compiler happy */
(void) data;
(void) option;
-
+
if (!logger_config_loading)
- logger_start_buffer_all ();
+ logger_start_buffer_all (1);
}
/*
@@ -102,7 +99,7 @@ logger_config_level_delete_option (void *data,
weechat_config_option_free (option);
- logger_start_buffer_all ();
+ logger_start_buffer_all (1);
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -161,7 +158,7 @@ logger_config_level_create_option (void *data,
}
if (!logger_config_loading)
- logger_start_buffer_all ();
+ logger_start_buffer_all (1);
return rc;
}
@@ -205,10 +202,7 @@ logger_config_mask_change (void *data,
(void) option;
if (!logger_config_loading)
- {
- logger_stop_all ();
- logger_start_buffer_all ();
- }
+ logger_adjust_log_filenames ();
}
/*
@@ -228,8 +222,7 @@ logger_config_mask_delete_option (void *data,
weechat_config_option_free (option);
- logger_stop_all ();
- logger_start_buffer_all ();
+ logger_adjust_log_filenames ();
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
@@ -286,12 +279,9 @@ logger_config_mask_create_option (void *data,
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
-
+
if (!logger_config_loading)
- {
- logger_stop_all ();
- logger_start_buffer_all ();
- }
+ logger_adjust_log_filenames ();
return rc;
}
@@ -369,8 +359,9 @@ logger_config_init ()
logger_config_file_path = weechat_config_new_option (
logger_config_file, ptr_section,
"path", "string",
- N_("path for WeeChat log files (\"%h\" will be replaced by WeeChat "
- "home, \"~/.weechat\" by default)"),
+ N_("path for WeeChat log files; \"%h\" at beginning of string is "
+ "replaced by WeeChat home (\"~/.weechat\" by default); date "
+ "specifiers are permitted (see man strftime)"),
NULL, 0, 0, "%h/logs/", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_mask = weechat_config_new_option (
@@ -379,7 +370,8 @@ logger_config_init ()
N_("default file name mask for log files (format is "
"\"directory/to/file\" or \"file\", without first \"/\" because "
"\"path\" option is used to build complete path to file); local "
- "buffer variables are permitted"),
+ "buffer variables are permitted; date specifiers are permitted "
+ "(see man strftime)"),
NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_replacement_char = weechat_config_new_option (
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index 243be1515..246f37b4d 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -55,6 +55,76 @@ char *logger_buf_write = NULL; /* buffer for writing a line */
/*
+ * logger_get_file_path: get logger file path option, special vars are replaced:
+ * - "%h" (at beginning of string): WeeChat home
+ * - "~": user home
+ * - date/time specifiers (see man strftime)
+ * note: returned value has to be free() after use
+ */
+
+char *
+logger_get_file_path ()
+{
+ char *file_path, *file_path2, *file_path3;
+ const char *weechat_dir;
+ int length;
+ time_t seconds;
+ struct tm *date_tmp;
+
+ file_path = NULL;
+ file_path2 = NULL;
+ file_path3 = NULL;
+
+ weechat_dir = weechat_info_get ("weechat_dir", "");
+ if (!weechat_dir)
+ goto end;
+
+ /* replace "~" with user home */
+ file_path = weechat_string_replace (weechat_config_string (logger_config_file_path),
+ "~", getenv ("HOME"));
+ if (!file_path)
+ goto end;
+
+ /* replace "%h" with WeeChat home (at beginning of string only) */
+ if (strncmp (file_path, "%h", 2) == 0)
+ {
+ length = strlen (weechat_dir) + strlen (file_path + 2) + 1;
+ file_path2 = malloc (length);
+ if (file_path2)
+ snprintf (file_path2, length, "%s%s", weechat_dir, file_path + 2);
+ }
+ else
+ file_path2 = strdup (file_path);
+ if (!file_path2)
+ goto end;
+
+ /* replace date/time specifiers in path */
+ length = strlen (file_path2) + 256 + 1;
+ file_path3 = malloc (length);
+ if (!file_path3)
+ goto end;
+ seconds = time (NULL);
+ date_tmp = localtime (&seconds);
+ file_path3[0] = '\0';
+ strftime (file_path3, length - 1, file_path2, date_tmp);
+
+ if (weechat_logger_plugin->debug)
+ {
+ weechat_printf (NULL,
+ "%s: file path = \"%s\"",
+ LOGGER_PLUGIN_NAME, file_path3);
+ }
+
+end:
+ if (file_path)
+ free (file_path);
+ if (file_path2)
+ free (file_path2);
+
+ return file_path3;
+}
+
+/*
* logger_create_directory: create logger directory
* return 1 if success (directory created or already
* exists), 0 if failed
@@ -64,32 +134,16 @@ int
logger_create_directory ()
{
int rc;
- char *dir1, *dir2;
- const char *weechat_dir;
+ char *file_path;
rc = 1;
-
- dir1 = weechat_string_replace (weechat_config_string (logger_config_file_path),
- "~", getenv ("HOME"));
- if (dir1)
+
+ file_path = logger_get_file_path ();
+ if (file_path)
{
- weechat_dir = weechat_info_get ("weechat_dir", "");
- if (weechat_dir)
- {
- dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
- if (dir2)
- {
- if (!weechat_mkdir_parents (dir2, 0700))
- rc = 0;
-
- free (dir2);
- }
- else
- rc = 0;
- }
- else
+ if (!weechat_mkdir_parents (file_path, 0700))
rc = 0;
- free (dir1);
+ free (file_path);
}
else
rc = 0;
@@ -238,41 +292,35 @@ logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
}
/*
- * logger_get_filename: build log filename for a buffer
+ * logger_get_mask_expanded: get expanded mask for a buffer, special vars are
+ * replaced:
+ * - local variables of buffer ($plugin, $name, ..)
+ * - date/time specifiers (see man strftime)
+ * note: returned value has to be free() after use
*/
char *
-logger_get_filename (struct t_gui_buffer *buffer)
+logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
{
- char *res, *mask2, *mask_decoded, *mask_decoded2, *mask_decoded3;
- const char *mask;
- const char *dir_separator, *weechat_dir;
- char *log_path, *log_path2, *pos_last_sep;
+ char *mask2, *mask_decoded, *mask_decoded2, *mask_decoded3, *mask_decoded4;
+ const char *dir_separator;
int length;
+ time_t seconds;
+ struct tm *date_tmp;
- res = NULL;
mask2 = NULL;
mask_decoded = NULL;
mask_decoded2 = NULL;
mask_decoded3 = NULL;
- log_path = NULL;
- log_path2 = NULL;
-
+ mask_decoded4 = NULL;
+
dir_separator = weechat_info_get ("dir_separator", "");
- weechat_dir = weechat_info_get ("weechat_dir", "");
-
- /* get filename mask for buffer */
- mask = logger_get_mask_for_buffer (buffer);
- if (!mask)
- {
- weechat_printf (NULL,
- _("%s%s: unable to find filename mask for buffer "
- "\"%s\", logging is disabled for this buffer"),
- weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
- weechat_buffer_get_string (buffer, "name"));
+ if (!dir_separator)
return NULL;
- }
+ /* we first replace directory separator (commonly '/') by \01 because
+ buffer mask can contain this char, and will be replaced by replacement
+ char ('_' by default) */
mask2 = weechat_string_replace (mask, dir_separator, "\01");
if (!mask2)
goto end;
@@ -287,11 +335,26 @@ logger_get_filename (struct t_gui_buffer *buffer)
if (!mask_decoded2)
goto end;
+ /* restore directory separator */
mask_decoded3 = weechat_string_replace (mask_decoded2,
"\01", dir_separator);
if (!mask_decoded3)
goto end;
+ /* replace date/time specifiers in mask */
+ length = strlen (mask_decoded3) + 256 + 1;
+ mask_decoded4 = malloc (length);
+ if (!mask_decoded4)
+ goto end;
+ seconds = time (NULL);
+ date_tmp = localtime (&seconds);
+ mask_decoded4[0] = '\0';
+ strftime (mask_decoded4, length - 1, mask_decoded3, date_tmp);
+
+ /* convert to lower case? */
+ if (weechat_config_boolean (logger_config_file_name_lower_case))
+ weechat_string_tolower (mask_decoded4);
+
if (weechat_logger_plugin->debug)
{
weechat_printf (NULL,
@@ -299,37 +362,10 @@ logger_get_filename (struct t_gui_buffer *buffer)
"decoded mask = \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"),
- mask, mask_decoded3);
+ mask, mask_decoded4);
}
- if (weechat_config_boolean (logger_config_file_name_lower_case))
- weechat_string_tolower (mask_decoded3);
-
- log_path = weechat_string_replace (weechat_config_string (logger_config_file_path),
- "~", getenv ("HOME"));
- log_path2 = weechat_string_replace (log_path, "%h", weechat_dir);
-
- if (dir_separator && weechat_dir && log_path && log_path2)
- {
- length = strlen (log_path2) + strlen (mask_decoded3) + 1;
- res = malloc (length);
- if (res)
- {
- snprintf (res, length, "%s%s", log_path2, mask_decoded3);
- pos_last_sep = strrchr (res, dir_separator[0]);
- if (pos_last_sep)
- pos_last_sep[0] = '\0';
- weechat_mkdir_parents (res, 0700);
- if (pos_last_sep)
- pos_last_sep[0] = dir_separator[0];
- }
- }
-
end:
- if (log_path)
- free (log_path);
- if (log_path2)
- free (log_path2);
if (mask2)
free (mask2);
if (mask_decoded)
@@ -339,6 +375,70 @@ end:
if (mask_decoded3)
free (mask_decoded3);
+ return mask_decoded4;
+}
+
+/*
+ * logger_get_filename: build log filename for a buffer
+ */
+
+char *
+logger_get_filename (struct t_gui_buffer *buffer)
+{
+ char *res, *mask_expanded, *file_path;
+ const char *mask;
+ const char *dir_separator, *weechat_dir;
+ int length;
+
+ res = NULL;
+ mask_expanded = NULL;
+ file_path = NULL;
+
+ dir_separator = weechat_info_get ("dir_separator", "");
+ if (!dir_separator)
+ return NULL;
+ weechat_dir = weechat_info_get ("weechat_dir", "");
+ if (!weechat_dir)
+ return NULL;
+
+ /* get filename mask for buffer */
+ mask = logger_get_mask_for_buffer (buffer);
+ if (!mask)
+ {
+ weechat_printf (NULL,
+ _("%s%s: unable to find filename mask for buffer "
+ "\"%s\", logging is disabled for this buffer"),
+ weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
+ weechat_buffer_get_string (buffer, "name"));
+ return NULL;
+ }
+
+ mask_expanded = logger_get_mask_expanded (buffer, mask);
+ if (!mask_expanded)
+ goto end;
+
+ file_path = logger_get_file_path ();
+ if (!file_path)
+ goto end;
+
+ /* build string with path + mask */
+ length = strlen (file_path) + strlen (dir_separator) +
+ strlen (mask_expanded) + 1;
+ res = malloc (length);
+ if (res)
+ {
+ snprintf (res, length, "%s%s%s",
+ file_path,
+ (file_path[strlen (file_path) - 1] == dir_separator[0]) ? "" : dir_separator,
+ mask_expanded);
+ }
+
+end:
+ if (mask_expanded)
+ free (mask_expanded);
+ if (file_path)
+ free (file_path);
+
return res;
}
@@ -349,9 +449,11 @@ end:
void
logger_set_log_filename (struct t_logger_buffer *logger_buffer)
{
- char *log_filename;
+ char *log_filename, *pos_last_sep;
+ const char *dir_separator;
struct t_logger_buffer *ptr_logger_buffer;
+ /* get log filename for buffer */
log_filename = logger_get_filename (logger_buffer->buffer);
if (!log_filename)
{
@@ -362,6 +464,7 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
return;
}
+ /* log file is already used by another buffer? */
ptr_logger_buffer = logger_buffer_search_log_filename (log_filename);
if (ptr_logger_buffer)
{
@@ -377,6 +480,20 @@ logger_set_log_filename (struct t_logger_buffer *logger_buffer)
return;
}
+ /* create directory for path in "log_filename" */
+ dir_separator = weechat_info_get ("dir_separator", "");
+ if (dir_separator)
+ {
+ pos_last_sep = strrchr (log_filename, dir_separator[0]);
+ if (pos_last_sep)
+ {
+ pos_last_sep[0] = '\0';
+ weechat_mkdir_parents (log_filename, 0700);
+ pos_last_sep[0] = dir_separator[0];
+ }
+ }
+
+ /* set log filename */
logger_buffer->log_filename = log_filename;
}
@@ -422,7 +539,6 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
}
if (!logger_buffer->log_filename)
logger_set_log_filename (logger_buffer);
-
if (!logger_buffer->log_filename)
{
logger_buffer_free (logger_buffer);
@@ -441,15 +557,18 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
return;
}
- if (weechat_config_boolean (logger_config_file_info_lines))
+ if (weechat_config_boolean (logger_config_file_info_lines)
+ && logger_buffer->write_start_info_line)
{
seconds = time (NULL);
date_tmp = localtime (&seconds);
buf_time[0] = '\0';
if (date_tmp)
+ {
strftime (buf_time, sizeof (buf_time) - 1,
weechat_config_string (logger_config_file_time_format),
date_tmp);
+ }
snprintf (logger_buf_write, LOGGER_BUF_WRITE_SIZE,
_("%s\t**** Beginning of log ****"),
buf_time);
@@ -460,6 +579,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
if (message)
free (message);
}
+ logger_buffer->write_start_info_line = 0;
}
va_start (argptr, format);
@@ -498,9 +618,11 @@ logger_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
date_tmp = localtime (&seconds);
buf_time[0] = '\0';
if (date_tmp)
+ {
strftime (buf_time, sizeof (buf_time) - 1,
weechat_config_string (logger_config_file_time_format),
date_tmp);
+ }
logger_write_line (logger_buffer,
_("%s\t**** End of log ****"),
buf_time);
@@ -516,11 +638,11 @@ logger_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
*/
void
-logger_stop_all ()
+logger_stop_all (int write_info_line)
{
while (logger_buffers)
{
- logger_stop (logger_buffers, 1);
+ logger_stop (logger_buffers, write_info_line);
}
}
@@ -529,7 +651,7 @@ logger_stop_all ()
*/
void
-logger_start_buffer (struct t_gui_buffer *buffer)
+logger_start_buffer (struct t_gui_buffer *buffer, int write_info_line)
{
struct t_logger_buffer *ptr_logger_buffer;
int log_level, log_enabled;
@@ -571,6 +693,8 @@ logger_start_buffer (struct t_gui_buffer *buffer)
}
}
}
+ if (ptr_logger_buffer)
+ ptr_logger_buffer->write_start_info_line = write_info_line;
}
}
@@ -579,7 +703,7 @@ logger_start_buffer (struct t_gui_buffer *buffer)
*/
void
-logger_start_buffer_all ()
+logger_start_buffer_all (int write_info_line)
{
struct t_infolist *ptr_infolist;
@@ -589,7 +713,8 @@ logger_start_buffer_all ()
while (weechat_infolist_next (ptr_infolist))
{
logger_start_buffer (weechat_infolist_pointer (ptr_infolist,
- "pointer"));
+ "pointer"),
+ write_info_line);
}
weechat_infolist_free (ptr_infolist);
}
@@ -730,7 +855,7 @@ logger_buffer_opened_signal_cb (void *data, const char *signal,
(void) signal;
(void) type_data;
- logger_start_buffer (signal_data);
+ logger_start_buffer (signal_data, 1);
return WEECHAT_RC_OK;
}
@@ -767,7 +892,7 @@ logger_buffer_renamed_signal_cb (void *data, const char *signal,
(void) type_data;
logger_stop (logger_buffer_search_buffer (signal_data), 1);
- logger_start_buffer (signal_data);
+ logger_start_buffer (signal_data, 1);
return WEECHAT_RC_OK;
}
@@ -888,7 +1013,7 @@ logger_start_signal_cb (void *data, const char *signal, const char *type_data,
(void) signal;
(void) type_data;
- logger_start_buffer (signal_data);
+ logger_start_buffer (signal_data, 1);
return WEECHAT_RC_OK;
}
@@ -916,6 +1041,66 @@ logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
}
/*
+ * logger_adjust_log_filenames: adjust log filenames for all buffers
+ * filename can change if config option is changed,
+ * or if day of system date has changed
+ */
+
+void
+logger_adjust_log_filenames ()
+{
+ struct t_infolist *ptr_infolist;
+ struct t_logger_buffer *ptr_logger_buffer;
+ struct t_gui_buffer *ptr_buffer;
+ char *log_filename;
+
+ ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
+ if (ptr_infolist)
+ {
+ while (weechat_infolist_next (ptr_infolist))
+ {
+ ptr_buffer = weechat_infolist_pointer (ptr_infolist, "pointer");
+ ptr_logger_buffer = logger_buffer_search_buffer (ptr_buffer);
+ if (ptr_logger_buffer && ptr_logger_buffer->log_filename)
+ {
+ log_filename = logger_get_filename (ptr_logger_buffer->buffer);
+ if (log_filename)
+ {
+ if (strcmp (log_filename, ptr_logger_buffer->log_filename) != 0)
+ {
+ /* log filename has changed (probably due to day change),
+ then we'll use new filename */
+ logger_stop (ptr_logger_buffer, 1);
+ logger_start_buffer (ptr_buffer, 1);
+ }
+ free (log_filename);
+ }
+ }
+ }
+ weechat_infolist_free (ptr_infolist);
+ }
+}
+
+/*
+ * logger_day_changed_signal_cb: callback for "day_changed" signal
+ */
+
+int
+logger_day_changed_signal_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) signal;
+ (void) type_data;
+ (void) signal_data;
+
+ logger_adjust_log_filenames ();
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* logger_line_log_level: get log level for a line (with its tags)
*/
@@ -1040,7 +1225,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" || disable",
&logger_command_cb, NULL);
- logger_start_buffer_all ();
+ logger_start_buffer_all (1);
weechat_hook_signal ("buffer_opened", &logger_buffer_opened_signal_cb, NULL);
weechat_hook_signal ("buffer_closing", &logger_buffer_closing_signal_cb, NULL);
@@ -1048,6 +1233,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_signal ("logger_backlog", &logger_backlog_signal_cb, NULL);
weechat_hook_signal ("logger_start", &logger_start_signal_cb, NULL);
weechat_hook_signal ("logger_stop", &logger_stop_signal_cb, NULL);
+ weechat_hook_signal ("day_changed", &logger_day_changed_signal_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL);
@@ -1068,7 +1254,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
logger_config_write ();
- logger_stop_all ();
+ logger_stop_all (1);
logger_config_free ();
diff --git a/src/plugins/logger/logger.h b/src/plugins/logger/logger.h
index 43ccc6ff2..1ce937bca 100644
--- a/src/plugins/logger/logger.h
+++ b/src/plugins/logger/logger.h
@@ -28,7 +28,8 @@
extern struct t_weechat_plugin *weechat_logger_plugin;
-extern void logger_start_buffer_all ();
-extern void logger_stop_all ();
+extern void logger_start_buffer_all (int write_info_line);
+extern void logger_stop_all (int write_info_line);
+extern void logger_adjust_log_filenames ();
#endif /* logger.h */