From bbe20b9b301ad29dc81931163746a64272b59140 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 12 Jun 2007 13:02:19 +0000 Subject: [PATCH] Fixed log file when channel name contains "/" (bug #20072) --- ChangeLog | 1 + po/cs.po | 17 +++++---- po/de.po | 17 +++++---- po/es.po | 17 +++++---- po/fr.po | 23 ++++++------ po/hu.po | 17 +++++---- po/ru.po | 17 +++++---- po/weechat.pot | 17 +++++---- src/gui/gui-log.c | 74 ++++++++++++++++++++++++++++++--------- weechat/ChangeLog | 1 + weechat/po/cs.po | 17 +++++---- weechat/po/de.po | 17 +++++---- weechat/po/es.po | 17 +++++---- weechat/po/fr.po | 23 ++++++------ weechat/po/hu.po | 17 +++++---- weechat/po/ru.po | 17 +++++---- weechat/po/weechat.pot | 17 +++++---- weechat/src/gui/gui-log.c | 74 ++++++++++++++++++++++++++++++--------- 18 files changed, 264 insertions(+), 136 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0ad92328..2b2826d80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2007-06-12 Version 0.2.6 (under dev!): + * fixed log file when channel name contains "/" (bug #20072) * command /away allowed when not connected to server (internally stored and AWAY command is sent when connecting to server) (task #7003) * added argument for /upgrade command (path to binary), check that diff --git a/po/cs.po b/po/cs.po index 77261e0db..901b293d7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -2597,19 +2597,22 @@ msgstr "%s nemohu napojit kalávesu \"%s\" (nevalidní jméno funkce: \"%s\")\n" msgid "%s not enough memory for key binding\n" msgstr "%s nedostatek paměti pro klávesovou zkratku\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Nedostatek paměti pro zapsání log sourobru bufferu\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Nemůžu zapsat log soubor bufferu\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Beginning of log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** End of log " diff --git a/po/de.po b/po/de.po index b38fd1a01..f4c87b17e 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -2609,20 +2609,23 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s nicht genügend Speicher für Tastenzuordnung\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" "Nicht genügend Speicher, um das Logfile für einen Puffer zu schreiben\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Kann das Logfile nicht schreiben\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Beginning of log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** End of log " diff --git a/po/es.po b/po/es.po index 75a5c5527..0dffd9c13 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Roberto Gonzlez Cardenete \n" "Language-Team: weechat-dev \n" @@ -2648,20 +2648,23 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s no hay suficiente memoria para atar la clave\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" "No hay suficiente memoria para escribir un fichero de log para un bfer\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "No es posible escribir un fichero de log para un bfer\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Comienzo del log (registro) " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Fin del log " diff --git a/po/fr.po b/po/fr.po index 048cecb94..941319655 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" -"PO-Revision-Date: 2007-06-12 12:13+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" +"PO-Revision-Date: 2007-06-12 15:00+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2623,19 +2623,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s pas assez de mémoire pour la touche\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" -msgstr "Pas assez de mémoire pour écrire un fichier log de tampon\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, c-format +msgid "Not enough memory to write log file \"%s\"\n" +msgstr "Pas assez de mémoire pour écrire le fichier log \"%s\"\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" -msgstr "Impossible d'écrire le fichier log pour un tampon\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, c-format +msgid "Unable to write log file \"%s\"\n" +msgstr "Impossible d'écrire le fichier log \"%s\"\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Début du log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Fin du log " diff --git a/po/hu.po b/po/hu.po index 54bc00738..e5558dd56 100644 --- a/po/hu.po +++ b/po/hu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2608,19 +2608,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s nincs elég memória a billentyűhozzárendeléshez\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Nincs elegendő memória a puffer naplójának írásához\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Nem sikerült naplófájlt írni a puffernek\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Naplófájl kezdete " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Naplófájl vége " diff --git a/po/ru.po b/po/ru.po index 12145d1fe..7158ed901 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -2588,19 +2588,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s недостаточно памяти для установки клавиши\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Недостаточно памяти для записи лог-файла буфера\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Не могу записать журнал буфера\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Начало log-файла" -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Конец log-файла" diff --git a/po/weechat.pot b/po/weechat.pot index 28e94c241..d21627f53 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: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2455,19 +2455,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "" -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "" diff --git a/src/gui/gui-log.c b/src/gui/gui-log.c index 6f805d032..44e1b1450 100644 --- a/src/gui/gui-log.c +++ b/src/gui/gui-log.c @@ -108,46 +108,73 @@ gui_log_start (t_gui_buffer *buffer) { int length; char *log_path, *log_path2; + char *server_name, *channel_name; log_path = weechat_strreplace (cfg_log_path, "~", getenv ("HOME")); log_path2 = weechat_strreplace (log_path, "%h", weechat_home); - if (!log_path || !log_path2) + + if (SERVER(buffer)) + server_name = weechat_strreplace (SERVER(buffer)->name, DIR_SEPARATOR, "_"); + else + server_name = NULL; + if (CHANNEL(buffer)) + channel_name = weechat_strreplace (CHANNEL(buffer)->name, DIR_SEPARATOR, "_"); + else + channel_name = NULL; + + if (!log_path || !log_path2 || (SERVER(buffer) && !server_name) || + (CHANNEL(buffer) && !channel_name)) { - weechat_log_printf (_("Not enough memory to write log file for a buffer\n")); + weechat_log_printf (_("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf_nolog (NULL, _("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); if (log_path) free (log_path); if (log_path2) free (log_path2); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); return; } + length = strlen (log_path2) + 128; if (SERVER(buffer)) - length += strlen (SERVER(buffer)->name); + length += strlen (server_name); if (CHANNEL(buffer)) - length += strlen (CHANNEL(buffer)->name); + length += strlen (channel_name); buffer->log_filename = (char *) malloc (length); if (!buffer->log_filename) { - weechat_log_printf (_("Not enough memory to write log file for a buffer\n")); - if (log_path) - free (log_path); - if (log_path2) - free (log_path2); + weechat_log_printf (_("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf_nolog (NULL, _("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + free (log_path); + free (log_path2); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); return; } strcpy (buffer->log_filename, log_path2); - if (log_path) - free (log_path); - if (log_path2) - free (log_path2); + + free (log_path); + free (log_path2); + if (buffer->log_filename[strlen (buffer->log_filename) - 1] != DIR_SEPARATOR_CHAR) strcat (buffer->log_filename, DIR_SEPARATOR); if (SERVER(buffer)) { - strcat (buffer->log_filename, SERVER(buffer)->name); + strcat (buffer->log_filename, server_name); strcat (buffer->log_filename, "."); } if (CHANNEL(buffer) @@ -157,21 +184,33 @@ gui_log_start (t_gui_buffer *buffer) } if (CHANNEL(buffer)) { - strcat (buffer->log_filename, CHANNEL(buffer)->name); + strcat (buffer->log_filename, channel_name); strcat (buffer->log_filename, "."); } strcat (buffer->log_filename, "weechatlog"); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); + buffer->log_file = fopen (buffer->log_filename, "a"); if (!buffer->log_file) { - weechat_log_printf (_("Unable to write log file for a buffer\n")); + weechat_log_printf (_("Unable to write log file \"%s\"\n"), + buffer->log_filename); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf (NULL, _("Unable to write log file \"%s\"\n"), + buffer->log_filename); free (buffer->log_filename); return; } + gui_log_write (buffer, _("**** Beginning of log ")); gui_log_write_date (buffer); gui_log_write (buffer, "****\n"); + + return; } /* @@ -190,5 +229,8 @@ gui_log_end (t_gui_buffer *buffer) buffer->log_file = NULL; } if (buffer->log_filename) + { free (buffer->log_filename); + buffer->log_filename = NULL; + } } diff --git a/weechat/ChangeLog b/weechat/ChangeLog index e0ad92328..2b2826d80 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2007-06-12 Version 0.2.6 (under dev!): + * fixed log file when channel name contains "/" (bug #20072) * command /away allowed when not connected to server (internally stored and AWAY command is sent when connecting to server) (task #7003) * added argument for /upgrade command (path to binary), check that diff --git a/weechat/po/cs.po b/weechat/po/cs.po index 77261e0db..901b293d7 100644 --- a/weechat/po/cs.po +++ b/weechat/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -2597,19 +2597,22 @@ msgstr "%s nemohu napojit kalávesu \"%s\" (nevalidní jméno funkce: \"%s\")\n" msgid "%s not enough memory for key binding\n" msgstr "%s nedostatek paměti pro klávesovou zkratku\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Nedostatek paměti pro zapsání log sourobru bufferu\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Nemůžu zapsat log soubor bufferu\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Beginning of log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** End of log " diff --git a/weechat/po/de.po b/weechat/po/de.po index b38fd1a01..f4c87b17e 100644 --- a/weechat/po/de.po +++ b/weechat/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -2609,20 +2609,23 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s nicht genügend Speicher für Tastenzuordnung\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" "Nicht genügend Speicher, um das Logfile für einen Puffer zu schreiben\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Kann das Logfile nicht schreiben\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Beginning of log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** End of log " diff --git a/weechat/po/es.po b/weechat/po/es.po index 75a5c5527..0dffd9c13 100644 --- a/weechat/po/es.po +++ b/weechat/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Roberto Gonzlez Cardenete \n" "Language-Team: weechat-dev \n" @@ -2648,20 +2648,23 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s no hay suficiente memoria para atar la clave\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" "No hay suficiente memoria para escribir un fichero de log para un bfer\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "No es posible escribir un fichero de log para un bfer\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Comienzo del log (registro) " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Fin del log " diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 048cecb94..941319655 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" -"PO-Revision-Date: 2007-06-12 12:13+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" +"PO-Revision-Date: 2007-06-12 15:00+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2623,19 +2623,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s pas assez de mémoire pour la touche\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" -msgstr "Pas assez de mémoire pour écrire un fichier log de tampon\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, c-format +msgid "Not enough memory to write log file \"%s\"\n" +msgstr "Pas assez de mémoire pour écrire le fichier log \"%s\"\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" -msgstr "Impossible d'écrire le fichier log pour un tampon\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, c-format +msgid "Unable to write log file \"%s\"\n" +msgstr "Impossible d'écrire le fichier log \"%s\"\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Début du log " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Fin du log " diff --git a/weechat/po/hu.po b/weechat/po/hu.po index 54bc00738..e5558dd56 100644 --- a/weechat/po/hu.po +++ b/weechat/po/hu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2608,19 +2608,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s nincs elég memória a billentyűhozzárendeléshez\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Nincs elegendő memória a puffer naplójának írásához\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Nem sikerült naplófájlt írni a puffernek\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Naplófájl kezdete " -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Naplófájl vége " diff --git a/weechat/po/ru.po b/weechat/po/ru.po index 12145d1fe..7158ed901 100644 --- a/weechat/po/ru.po +++ b/weechat/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.6-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: 2007-06-07 18:02+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -2588,19 +2588,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "%s недостаточно памяти для установки клавиши\n" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, fuzzy, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "Недостаточно памяти для записи лог-файла буфера\n" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, fuzzy, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "Не могу записать журнал буфера\n" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "**** Начало log-файла" -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "**** Конец log-файла" diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot index 28e94c241..d21627f53 100644 --- a/weechat/po/weechat.pot +++ b/weechat/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: 2007-06-12 12:11+0200\n" +"POT-Creation-Date: 2007-06-12 14:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2455,19 +2455,22 @@ msgstr "" msgid "%s not enough memory for key binding\n" msgstr "" -#: src/gui/gui-log.c:116 src/gui/gui-log.c:132 -msgid "Not enough memory to write log file for a buffer\n" +#: src/gui/gui-log.c:128 src/gui/gui-log.c:131 src/gui/gui-log.c:153 +#: src/gui/gui-log.c:156 +#, c-format +msgid "Not enough memory to write log file \"%s\"\n" msgstr "" -#: src/gui/gui-log.c:168 -msgid "Unable to write log file for a buffer\n" +#: src/gui/gui-log.c:200 src/gui/gui-log.c:203 +#, c-format +msgid "Unable to write log file \"%s\"\n" msgstr "" -#: src/gui/gui-log.c:172 +#: src/gui/gui-log.c:209 msgid "**** Beginning of log " msgstr "" -#: src/gui/gui-log.c:186 +#: src/gui/gui-log.c:225 msgid "**** End of log " msgstr "" diff --git a/weechat/src/gui/gui-log.c b/weechat/src/gui/gui-log.c index 6f805d032..44e1b1450 100644 --- a/weechat/src/gui/gui-log.c +++ b/weechat/src/gui/gui-log.c @@ -108,46 +108,73 @@ gui_log_start (t_gui_buffer *buffer) { int length; char *log_path, *log_path2; + char *server_name, *channel_name; log_path = weechat_strreplace (cfg_log_path, "~", getenv ("HOME")); log_path2 = weechat_strreplace (log_path, "%h", weechat_home); - if (!log_path || !log_path2) + + if (SERVER(buffer)) + server_name = weechat_strreplace (SERVER(buffer)->name, DIR_SEPARATOR, "_"); + else + server_name = NULL; + if (CHANNEL(buffer)) + channel_name = weechat_strreplace (CHANNEL(buffer)->name, DIR_SEPARATOR, "_"); + else + channel_name = NULL; + + if (!log_path || !log_path2 || (SERVER(buffer) && !server_name) || + (CHANNEL(buffer) && !channel_name)) { - weechat_log_printf (_("Not enough memory to write log file for a buffer\n")); + weechat_log_printf (_("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf_nolog (NULL, _("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); if (log_path) free (log_path); if (log_path2) free (log_path2); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); return; } + length = strlen (log_path2) + 128; if (SERVER(buffer)) - length += strlen (SERVER(buffer)->name); + length += strlen (server_name); if (CHANNEL(buffer)) - length += strlen (CHANNEL(buffer)->name); + length += strlen (channel_name); buffer->log_filename = (char *) malloc (length); if (!buffer->log_filename) { - weechat_log_printf (_("Not enough memory to write log file for a buffer\n")); - if (log_path) - free (log_path); - if (log_path2) - free (log_path2); + weechat_log_printf (_("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf_nolog (NULL, _("Not enough memory to write log file \"%s\"\n"), + (log_path2) ? log_path2 : ((log_path) ? log_path : cfg_log_path)); + free (log_path); + free (log_path2); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); return; } strcpy (buffer->log_filename, log_path2); - if (log_path) - free (log_path); - if (log_path2) - free (log_path2); + + free (log_path); + free (log_path2); + if (buffer->log_filename[strlen (buffer->log_filename) - 1] != DIR_SEPARATOR_CHAR) strcat (buffer->log_filename, DIR_SEPARATOR); if (SERVER(buffer)) { - strcat (buffer->log_filename, SERVER(buffer)->name); + strcat (buffer->log_filename, server_name); strcat (buffer->log_filename, "."); } if (CHANNEL(buffer) @@ -157,21 +184,33 @@ gui_log_start (t_gui_buffer *buffer) } if (CHANNEL(buffer)) { - strcat (buffer->log_filename, CHANNEL(buffer)->name); + strcat (buffer->log_filename, channel_name); strcat (buffer->log_filename, "."); } strcat (buffer->log_filename, "weechatlog"); + if (server_name) + free (server_name); + if (channel_name) + free (channel_name); + buffer->log_file = fopen (buffer->log_filename, "a"); if (!buffer->log_file) { - weechat_log_printf (_("Unable to write log file for a buffer\n")); + weechat_log_printf (_("Unable to write log file \"%s\"\n"), + buffer->log_filename); + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf (NULL, _("Unable to write log file \"%s\"\n"), + buffer->log_filename); free (buffer->log_filename); return; } + gui_log_write (buffer, _("**** Beginning of log ")); gui_log_write_date (buffer); gui_log_write (buffer, "****\n"); + + return; } /* @@ -190,5 +229,8 @@ gui_log_end (t_gui_buffer *buffer) buffer->log_file = NULL; } if (buffer->log_filename) + { free (buffer->log_filename); + buffer->log_filename = NULL; + } }