1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

Add new features to logger plugin (command /logger, log level, level by buffer, mask by buffer, ..), fix some bugs

New features:
- new command /logger
- log level, to log only some messages, according to importance (task #8592)
- level by buffer: custom level for some buffers (or group of buffers)
- log filename mask by buffer (or group of buffers)
- marker line is added after display of backlog
- add "delete" callback for config file sections
- add "mkdir_parents" function to plugin API
- remove old log options in IRC plugin

Bug fix:
- marker line is set only when user switches buffer (not when a plugin force
  switch, like IRC plugin does when opening server or channel buffer)
- backlog fixed (sometimes lines were not properly displayed)
This commit is contained in:
Sebastien Helleu
2008-10-30 17:18:28 +01:00
parent 2f68ec7f36
commit 6f442bbfc1
61 changed files with 3203 additions and 1190 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2008-10-25
ChangeLog - 2008-10-30
Version 0.2.7 (under dev!):
@@ -39,7 +39,9 @@ Version 0.2.7 (under dev!):
fails), nicks are now set with one option "nicks" (task #6088)
* fix bug when switching window, scrollback is now preserved (task #7680)
* add group support in nicklist
* add "backlog" and "name_lower_case" options in logger plugin (bug #19522)
* new logger plugin with new features: backlog, level for messages to log,
level by buffer (task #8592), filename mask by buffer, option
"name_lower_case" (bug #19522)
* improve main loop: higher timout in select(), less CPU usage
* add /reload command to reload WeeChat and plugins config files
(signal SIGHUP is catched to reload config files)
+141 -49
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -44,8 +44,7 @@ msgid ""
" about possible options)\n"
msgstr ""
" -a, --no-connect vypne automatické připojení k serverům při startu\n"
" -d, --dir <path> nastaví domovský adresář WeeChat (výchozí: ~/."
"weechat)\n"
" -d, --dir <path> nastaví domovský adresář WeeChat (výchozí: ~/.weechat)\n"
" -h, --help tato nápověda\n"
" -k, --keys zobrazí výchozí klávesy WeeChat\n"
" -l, --license zobrazí licenci WeeChat\n"
@@ -54,9 +53,10 @@ msgstr ""
" plugin:option volba pluginu\n"
" například irc plugin se může připojit\n"
" k serveru pomocí url jako:\n"
" irc[6][s]://[přezdívka[:heslo]@]irc.example.org[/port]"
"[//#kanál][,#kanál2[...]]\n"
" (více informací o možných volbách v dokumentacích pluginů)\n"
" irc[6][s]://[přezdívka[:heslo]@]irc.example.org[/port][//"
"#kanál][,#kanál2[...]]\n"
" (více informací o možných volbách v dokumentacích "
"pluginů)\n"
#. TRANSLATORS: %s is "weechat"
#, c-format
@@ -77,9 +77,9 @@ msgstr "Chyba: nedostatek paměti pro domácí adresář\n"
msgid "Error: home (%s) is not a directory\n"
msgstr "Chyba: domovský adresář (%s) není adresářem\n"
#, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgstr "Chyba: nemohu vytvořit adresář \"%s\"\n"
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nemohu vytvořit adresář \"%s\"\n"
#, c-format
msgid "%sWelcome to %s%s%s, %s"
@@ -96,8 +96,8 @@ msgid ""
" %s%s%s: %s%s%s (cond: %s), %s, filling: %s(top/bottom)/%s(left/right), %s: "
"%s"
msgstr ""
" %s%s%s: %s%s%s (podmínka: %s), %s, vyplňuje: %s(nahoře/dole)/%s(vlevo/vpravo), %s: "
"%s"
" %s%s%s: %s%s%s (podmínka: %s), %s, vyplňuje: %s(nahoře/dole)/%s(vlevo/"
"vpravo), %s: %s"
msgid "(hidden)"
msgstr "(skrytý)"
@@ -361,7 +361,8 @@ msgstr "Výchozí klávesové zkratky obnoveny"
#, c-format
msgid "%sError: \"-yes\" argument is required for keys reset (security reason)"
msgstr ""
"%sChyba: \"-yes\" argument je požadován pro reset kaláves (bezpečnostní opatření)"
"%sChyba: \"-yes\" argument je požadován pro reset kaláves (bezpečnostní "
"opatření)"
#, c-format
msgid "Key \"%s\" unbound"
@@ -387,7 +388,8 @@ msgstr "list: id: %d, rodič: %d, plugin: \"%s\", buffer: \"%s\""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
msgstr "uzel: id: %d, rodič: %d, potomek1: %d, potomek2: %d, velikost: %d%% (%s)"
msgstr ""
"uzel: id: %d, rodič: %d, potomek1: %d, potomek2: %d, velikost: %d%% (%s)"
msgid "horizontal split"
msgstr "horizontální rozdělení"
@@ -1153,7 +1155,9 @@ msgid "time format for \"time\" bar item"
msgstr "formát času pro \"time\" položu pole"
msgid "display nicklist (on buffers with nicklist enabled)"
msgstr "zobrazit okno se seznamem přezdívek (pro buffery s povoleným seznamem přezdívek)"
msgstr ""
"zobrazit okno se seznamem přezdívek (pro buffery s povoleným seznamem "
"přezdívek)"
#, fuzzy
msgid ""
@@ -1215,7 +1219,9 @@ msgid "string displayed after prefix"
msgstr "řetězec zobrazený za prefixem"
msgid "use a marker (line or char) on buffers to show first unread line"
msgstr "použít značku (řádek nebo znak) v bufferech pro zobrazení první nepřečtené řádky"
msgstr ""
"použít značku (řádek nebo znak) v bufferech pro zobrazení první nepřečtené "
"řádky"
msgid "save configuration file on exit"
msgstr "uložit soubor s nastavením při ukončení"
@@ -1230,8 +1236,8 @@ msgid ""
"percent of screen to scroll when scrolling one page up or down (for example "
"100 means one page, 50 half-page)"
msgstr ""
"procenta obrazovky, o které posunout, při posunutí o stránku nahoru nebo dolů "
"(například 100 znamená jedna stránka, 50 půl stránky)"
"procenta obrazovky, o které posunout, při posunutí o stránku nahoru nebo "
"dolů (například 100 znamená jedna stránka, 50 půl stránky)"
msgid "set title for window (terminal for Curses GUI) with name and version"
msgstr "nastaví titulek okna (terminálu pro Cruses GUI) s jménem a verzí"
@@ -1809,10 +1815,6 @@ msgid ""
"version)"
msgstr ""
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nemohu vytvořit adresář \"%s\"\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminál ztracen, ukončuji WeeChat..."
@@ -2025,7 +2027,7 @@ msgid "%s: debug disabled"
msgstr "%s: ladění vypnuto"
#, fuzzy, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr "Alias \"%s\" odebrán\n"
#. TRANSLATORS: %s is "aspell"
@@ -2115,7 +2117,7 @@ msgid "global encoding charset"
msgstr "globální znaková sada pro kódování"
#, fuzzy, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" odebrán\n"
#, fuzzy, c-format
@@ -3301,11 +3303,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%s špatné parametry pro příkaz \"%s\"\n"
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating server \"%s\""
msgstr "%s nedostatek paměti pro infobar zprávu\n"
@@ -3413,6 +3410,9 @@ msgstr "zobrazit zprávu, když označen/odznačen jako nepřítomen"
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr "schovat heslo zobrazené nickservem"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3425,7 +3425,7 @@ msgstr "zobrazit vzdálený zprávu o nepřítomnosti pouze jednou v soukromém
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -3489,18 +3489,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "poslat neznámý příkaz na IRC server"
msgid "automatically log server messages"
msgstr "automati logovat zprávy server"
msgid "automatically log channel chats"
msgstr "automaticky logovat rozhovory kanálu"
msgid "automatically log private chats"
msgstr "automaticky logovat soukromé rozhovory"
msgid "hide password displayed by nickserv"
msgstr "schovat heslo zobrazené nickservem"
#, fuzzy
msgid "IRC debug messages"
msgstr "vypsat debug zprávy"
@@ -4018,6 +4006,18 @@ msgstr "%s: Připojuji se znovu k serveru...\n"
msgid "%s%s: disconnected from server"
msgstr "Odpojen od serveru!\n"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s nemohu vytvořit server \"%s\"\n"
@@ -4034,10 +4034,76 @@ msgstr "**** Beginning of log "
msgid "%s\t**** End of log ****"
msgstr "**** End of log "
#, fuzzy
msgid "Logging on buffers:"
msgstr "Seznam pro aliasy:\n"
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
#, fuzzy
msgid "log not started"
msgstr "Nebylo uloženo žádné rozložení"
#, fuzzy, c-format
msgid "%s: \"%s\" => level %d"
msgstr "Alias \"%s\" odebrán\n"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr "===\t========== Konec zpětného logu (%d řádků) =========="
#, fuzzy
msgid "logger plugin configuration"
msgstr "Ukládám konfiguraci na disk\n"
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
#, fuzzy
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
@@ -4059,6 +4125,12 @@ msgstr ""
"cesta pro hledání pluginů ('%h' bude nahrazeno domácím adresářem WeeChat, ~/."
"weechat je výchozí)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -4077,14 +4149,6 @@ msgstr "notify: debug: nastavit notifikaci pro buffer %s na %d (%s)"
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nedostatek paměti pro infobar zprávu\n"
#, fuzzy, c-format
msgid "Notify level: %s => %s"
msgstr "Level upozornění:"
#, fuzzy, c-format
msgid "Notify level: %s: removed"
msgstr "Level upozornění:"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s neznámá klávesová funkce \"%s\"\n"
@@ -4851,6 +4915,34 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s chybí argument pro volbu \"%s\"\n"
#~ msgid "automatically log server messages"
#~ msgstr "automati logovat zprávy server"
#~ msgid "automatically log channel chats"
#~ msgstr "automaticky logovat rozhovory kanálu"
#~ msgid "automatically log private chats"
#~ msgstr "automaticky logovat soukromé rozhovory"
#, fuzzy
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "Lokální proměnné pro buffer \"%s\":"
#, fuzzy
#~ msgid " %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s"
#~ msgstr "%s%s %s(%s%s%s)%s skončil"
#, fuzzy
#~ msgid "Notify level: %s => %s"
#~ msgstr "Level upozornění:"
#, fuzzy
#~ msgid "Notify level: %s: removed"
#~ msgstr "Level upozornění:"
#~ msgid "Error: unable to create \"%s\" directory\n"
#~ msgstr "Chyba: nemohu vytvořit adresář \"%s\"\n"
#, fuzzy
#~ msgid "%sError: filter not \"%s\" found"
#~ msgstr "%s plugin \"%s\" nenalezen\n"
+120 -34
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -84,7 +84,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr "%s HOME (%s) ist kein Verzeichnis\n"
#, fuzzy, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s kann das Verzeichnis \"%s\" nicht anlegen\n"
#, fuzzy, c-format
@@ -1836,10 +1836,6 @@ msgid ""
"version)"
msgstr ""
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s kann das Verzeichnis \"%s\" nicht anlegen\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@@ -2047,7 +2043,7 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr "Alias \"%s\" entfernt\n"
#. TRANSLATORS: %s is "aspell"
@@ -2137,7 +2133,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" entfernt\n"
#, fuzzy, c-format
@@ -3289,11 +3285,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating server \"%s\""
msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
@@ -3404,6 +3395,9 @@ msgstr "bei Abwesenheit und Rückkehr eine Nachricht anzeigen"
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr "Von NickServ angezeigte Passwörter verstecken"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3415,7 +3409,7 @@ msgstr ""
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -3479,18 +3473,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "sende unbekannte Befehle an den IRC-Server"
msgid "automatically log server messages"
msgstr "Automatisches Logging von Servermessages"
msgid "automatically log channel chats"
msgstr "Automatisches Logging von Channels"
msgid "automatically log private chats"
msgstr "Automatisches Logging von Queries"
msgid "hide password displayed by nickserv"
msgstr "Von NickServ angezeigte Passwörter verstecken"
#, fuzzy
msgid "IRC debug messages"
msgstr "Debugging-Nachricht ausgeben"
@@ -4002,6 +3984,18 @@ msgstr "%s: Neuverbinden zum Server...\n"
msgid "%s%s: disconnected from server"
msgstr "Vom Server getrennt!\n"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s kann den Server nicht anlegen\n"
@@ -4018,10 +4012,75 @@ msgstr "**** Beginning of log "
msgid "%s\t**** End of log ****"
msgstr "**** End of log "
#, fuzzy
msgid "Logging on buffers:"
msgstr "Liste der Aliases:\n"
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
msgid "log not started"
msgstr ""
#, fuzzy, c-format
msgid "%s: \"%s\" => level %d"
msgstr "Alias \"%s\" entfernt\n"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr ""
#, fuzzy
msgid "logger plugin configuration"
msgstr "Konfiguration wird gespeichert\n"
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
#, fuzzy
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
@@ -4043,6 +4102,12 @@ msgstr ""
"Suchpfad für WeeChat-Plugins ('%h' wird durch das WeeChat-Basisiverzeichnis "
"ersetzt, voreingestellt ist ~/.weechat)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -4061,14 +4126,6 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
#, fuzzy, c-format
msgid "Notify level: %s => %s"
msgstr "Notify-Ebenen:"
#, fuzzy, c-format
msgid "Notify level: %s: removed"
msgstr "Notify-Ebenen:"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s unbekannte Tasten-Funktion \"%s\"\n"
@@ -4825,6 +4882,35 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s fehlende Argumente für die \"--dir\"-Option\n"
#~ msgid "automatically log server messages"
#~ msgstr "Automatisches Logging von Servermessages"
#~ msgid "automatically log channel chats"
#~ msgstr "Automatisches Logging von Channels"
#~ msgid "automatically log private chats"
#~ msgstr "Automatisches Logging von Queries"
#, fuzzy
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "Timestamp für Puffer"
#, fuzzy
#~ msgid " %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s"
#~ msgstr "%s%s %s(%s%s%s)%s hat das IRC verlassen"
#, fuzzy
#~ msgid "Notify level: %s => %s"
#~ msgstr "Notify-Ebenen:"
#, fuzzy
#~ msgid "Notify level: %s: removed"
#~ msgstr "Notify-Ebenen:"
#, fuzzy
#~ msgid "Error: unable to create \"%s\" directory\n"
#~ msgstr "%s kann das Verzeichnis \"%s\" nicht anlegen\n"
#, fuzzy
#~ msgid "%sError: filter not \"%s\" found"
#~ msgstr "%s Plugin \"%s\" nicht gefunden\n"
+120 -34
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -81,7 +81,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr ""
#, fuzzy, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s no es posible crear el directorio \"%s\"\n"
#, fuzzy, c-format
@@ -1817,10 +1817,6 @@ msgid ""
"version)"
msgstr ""
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s no es posible crear el directorio \"%s\"\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@@ -2021,7 +2017,7 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr "Alias \"%s\" eliminado\n"
#. TRANSLATORS: %s is "aspell"
@@ -2113,7 +2109,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" eliminado\n"
#, fuzzy, c-format
@@ -3282,11 +3278,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating server \"%s\""
msgstr ""
@@ -3395,6 +3386,9 @@ msgstr "mostrar mensaje cuando se marque/desmarque como ausente"
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr "ocultar contraseña mostrada por nickserv"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3406,7 +3400,7 @@ msgstr ""
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -3472,18 +3466,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "nombre de usuario para el servidor IRC"
msgid "automatically log server messages"
msgstr "registrar automáticamente los mensajes de servidor"
msgid "automatically log channel chats"
msgstr "registrar automáticamente las conversaciones de canal"
msgid "automatically log private chats"
msgstr "registrar automáticamente las conversaciones privadas"
msgid "hide password displayed by nickserv"
msgstr "ocultar contraseña mostrada por nickserv"
#, fuzzy
msgid "IRC debug messages"
msgstr "imprime mensajes de depuración"
@@ -4000,6 +3982,18 @@ msgstr "%s: Reconectando al servidor...\n"
msgid "%s%s: disconnected from server"
msgstr "¡Desconectado del servidor!\n"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s no es posible crear el servidor\n"
@@ -4016,10 +4010,75 @@ msgstr "**** Comienzo del log (registro) "
msgid "%s\t**** End of log ****"
msgstr "**** Fin del log "
#, fuzzy
msgid "Logging on buffers:"
msgstr "Lista de alias:\n"
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
msgid "log not started"
msgstr ""
#, fuzzy, c-format
msgid "%s: \"%s\" => level %d"
msgstr "Alias \"%s\" eliminado\n"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr ""
#, fuzzy
msgid "logger plugin configuration"
msgstr "Guardar configuración a disco\n"
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
#, fuzzy
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
@@ -4042,6 +4101,12 @@ msgstr ""
"ruta para encontrar plugins ('%h' será reemplazado por el directorio raíz "
"de Weechat, ~/.weechat por defecto)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -4061,14 +4126,6 @@ msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
"No hay suficiente memoria para el mensaje de la barra de información\n"
#, fuzzy, c-format
msgid "Notify level: %s => %s"
msgstr "Niveles de notificación:"
#, fuzzy, c-format
msgid "Notify level: %s: removed"
msgstr "Niveles de notificación:"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s opción desconocida para el comando \"%s\"\n"
@@ -4830,6 +4887,35 @@ msgstr "%s no es posible crear el servidor\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s falta un argumento para la opción --dir\n"
#~ msgid "automatically log server messages"
#~ msgstr "registrar automáticamente los mensajes de servidor"
#~ msgid "automatically log channel chats"
#~ msgstr "registrar automáticamente las conversaciones de canal"
#~ msgid "automatically log private chats"
#~ msgstr "registrar automáticamente las conversaciones privadas"
#, fuzzy
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "fecha y hora para las búfers"
#, fuzzy
#~ msgid " %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s"
#~ msgstr "%s%s %s(%s%s%s)%s ha salido"
#, fuzzy
#~ msgid "Notify level: %s => %s"
#~ msgstr "Niveles de notificación:"
#, fuzzy
#~ msgid "Notify level: %s: removed"
#~ msgstr "Niveles de notificación:"
#, fuzzy
#~ msgid "Error: unable to create \"%s\" directory\n"
#~ msgstr "%s no es posible crear el directorio \"%s\"\n"
#, fuzzy
#~ msgid "%sError: filter not \"%s\" found"
#~ msgstr "%s plugin \"%s\" no encontrado\n"
+162 -40
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"PO-Revision-Date: 2008-10-26 17:43+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2008-10-30 16:52+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -80,7 +80,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr "Erreur: la base (%s) n'est pas un répertoire\n"
#, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erreur: impossible de créer le répertoire \"%s\"\n"
#, c-format
@@ -1838,10 +1838,6 @@ msgstr ""
"lecture - mauvaise signature (le format de fichier upgrade a peut-être "
"changé depuis la dernière version)"
#, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erreur: impossible de créer le répertoire \"%s\"\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal perdu, sortie de WeeChat..."
@@ -2040,8 +2036,8 @@ msgid "%s: debug disabled"
msgstr "%s: debug désactivé"
#, c-format
msgid "%s: %s: removed"
msgstr "%s: %s: supprimé"
msgid "%s: \"%s\" removed"
msgstr "%s: \"%s\" supprimé"
#. TRANSLATORS: %s is "aspell"
#, c-format
@@ -2151,8 +2147,8 @@ msgid "global encoding charset"
msgstr "charset d'encodage global"
#, c-format
msgid "%s: %s, %s: removed"
msgstr "%s: %s, %s: supprimé"
msgid "%s: %s, \"%s\": removed"
msgstr "%s: %s, \"%s\": supprimé"
#, c-format
msgid "%s%s: missing parameters"
@@ -3346,13 +3342,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%sirc: pas assez de paramètres pour la commande \"%s\""
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
"Vous devriez maintenant créer un filtre sur le tag \"irc_smart_filter\" avec "
"la commande /filter."
#, c-format
msgid "%s%s: error creating server \"%s\""
msgstr "%s%s: erreur de création du serveur \"%s\""
@@ -3462,6 +3451,9 @@ msgstr "affiche un message pour l'absence/le retour"
msgid "display channel modes in \"buffer_name\" bar item"
msgstr "affiche les modes du canal dans l'objet de barre \"buffer_name\""
msgid "hide password displayed by nickserv"
msgstr "masquer le mot de passe affiché par nickserv"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3475,10 +3467,11 @@ msgstr "voir le message d'absence distant une seule fois en privé"
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
"filtrer les messages join/part/quit pour un pseudo s'il n'a pas parlé "
"pendant quelques minutes sur le canal"
"pendant quelques minutes sur le canal (vous devez créer un filtre sur le tag "
"\"irc_smart_filter\")"
msgid "delay for filtering join/part/quit messages (in minutes)"
msgstr "délai pour filtrer les messages join/part/quit (en minutes)"
@@ -3541,18 +3534,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "envoie les commandes inconnues au serveur IRC"
msgid "automatically log server messages"
msgstr "enregistrer automatiquement les messages du serveur"
msgid "automatically log channel chats"
msgstr "enregistrer automatiquement les conversations des canaux"
msgid "automatically log private chats"
msgstr "enregistrer automatiquement les conversations privées"
msgid "hide password displayed by nickserv"
msgstr "masquer le mot de passe affiché par nickserv"
msgid "IRC debug messages"
msgstr "Messages de debug IRC"
@@ -4070,6 +4051,23 @@ msgstr "%s%s: reconnexion au serveur..."
msgid "%s%s: disconnected from server"
msgstr "%s%s: déconnecté du serveur"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
"%s%s: impossible de trouver le masque de nom de fichier pour le tampon \"%s"
"\", l'enregistrement est désactivé pour ce tampon"
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
"%s%s: impossible de démarrer l'enregistrement pour le tampon \"%s\": le nom "
"de fichier \"%s\" est déjà utilisé par un autre tampon (vérifiez vos options "
"d'enregistrement)"
#, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s%s: impossible de créer le répertoire pour les logs (\"%s\")"
@@ -4086,10 +4084,106 @@ msgstr "%s\t**** Début du log ****"
msgid "%s\t**** End of log ****"
msgstr "%s\t**** Fin du log ****"
msgid "Logging on buffers:"
msgstr "Enregistrement des tampons :"
#, c-format
msgid "logging (level: %d)"
msgstr "enregistrement (niveau: %d)"
#, c-format
msgid "not logging"
msgstr "pas d'enregistrement"
msgid "log not started"
msgstr "enregistrement non démarré"
#, c-format
msgid "%s: \"%s\" => level %d"
msgstr "%s: \"%s\" => niveau %d"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr "===\t========== Fin de l'historique (%d lignes) =========="
msgid "logger plugin configuration"
msgstr "configuration de l'extension logger"
msgid "[list | set level | disable]"
msgstr "[list | set niveau | disable]"
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
" list: afficher le statut d'enregistrement pour les tampons ouverts\n"
" set: définir le niveau d'enregistrement pour le tampon courant\n"
" niveau: niveau pour les messages à enregistrer (0 = pas d'enregistrement, 1 "
"= quelques messages (les plus importants) .. 9 = tous les messages)\n"
"disable: désactiver l'enregistrement pour le tampon courant (définir le "
"niveau à 0)\n"
"\n"
"Les options \"logger.level.*\" et \"logger.mask.*\" peuvent être utilisées "
"pour définir le niveau ou le masque de nom de fichier pour un tampon, ou "
"plusieurs tampons commençant par un nom.\n"
"\n"
"Exemples :\n"
" définir le niveau d'enregistrement à 5 pour le tampon courant :\n"
" /logger set 5\n"
" désactiver l'enregistrement pour le tampon courant :\n"
" /logger disable\n"
" définir le niveau à 3 pour les tampons IRC :\n"
" /set logger.level.irc = 3\n"
" désactiver l'enregistrement pour le tampon principal de WeeChat :\n"
" /set logger.level.core.weechat = 0\n"
" utiliser un répertoire par serveur IRC et un fichier par canal dedans :\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Niveaux de log utilisés par l'extension IRC :\n"
" 1: message d'utilisateur, notice, privé\n"
" 2: changement de pseudo\n"
" 3: message du serveur\n"
" 4: join/part/quit\n"
" 9: tous les autres messages"
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
"niveau d'enregistrement log pour ce tampon (0 = pas d'enregistrement, 1 = "
"quelques messages (les plus importants) .. 9 = tous les messages)"
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
"masque de fichier pour le fichier de log; les variables locales du tampon "
"sont permises"
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
"= no backlog)"
@@ -4113,6 +4207,16 @@ msgstr ""
"chemin pour les fichiers de log WeeChat ('%h' sera remplacé par le "
"répertoire de base WeeChat, par défaut: ~/.weechat)"
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"
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"
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
"écrire une ligne d'information dans le fichier log quand le log démarre ou "
@@ -4135,14 +4239,6 @@ msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
"%s%s: impossible de positionner le niveau de notification \"%s\" => \"%s\""
#, c-format
msgid "Notify level: %s => %s"
msgstr "Niveau de notification: %s => %s"
#, c-format
msgid "Notify level: %s: removed"
msgstr "Niveau de notification: %s: supprimé"
#, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s%s: niveau de notification inconnu \"%s\""
@@ -4877,3 +4973,29 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket"
#, c-format
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s"
#~ msgid "automatically log server messages"
#~ msgstr "enregistrer automatiquement les messages du serveur"
#~ msgid "automatically log channel chats"
#~ msgstr "enregistrer automatiquement les conversations des canaux"
#~ msgid "automatically log private chats"
#~ msgstr "enregistrer automatiquement les conversations privées"
#~ msgid ""
#~ " list: show logging status for open buffers\n"
#~ " set: set logging level on current buffer\n"
#~ " level: level for messages to be logged (0 = logging disabled, 1 = a few "
#~ "messages (most important) .. 9 = all messages)\n"
#~ "disable: disable logging on current buffer (set level to 0)"
#~ msgstr ""
#~ " list: afficher le statut d'enregistrement pour les tampons ouverts\n"
#~ " set: définir le niveau d'enregistrement pour le tampon courant\n"
#~ " niveau: niveau des messages qui doivent être enregistrés (0 = pas "
#~ "d'enregistrement, 1 = quelques messages (les plus importants) .. 9 = tous "
#~ "les messages)\n"
#~ "disable: désactiver l'enregistrement du tampon courant"
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "Le nouveau niveau pour le tampon \"%s\" est %d"
+120 -34
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -85,7 +85,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr ""
#, fuzzy, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nem sikerült a \"%s\" könyvtárat létrehozni\n"
#, fuzzy, c-format
@@ -1844,10 +1844,6 @@ msgid ""
"version)"
msgstr ""
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nem sikerült a \"%s\" könyvtárat létrehozni\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@@ -2053,7 +2049,7 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr "A \"%s\" aliasz eltávolítva\n"
#. TRANSLATORS: %s is "aspell"
@@ -2143,7 +2139,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr "A \"%s\" aliasz eltávolítva\n"
#, fuzzy, c-format
@@ -3326,11 +3322,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating server \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
@@ -3437,6 +3428,9 @@ msgstr "üzenet mutatása távollétkor/visszatéréskor"
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr "a nickserv által mutatott jelszó elrejtése"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3447,7 +3441,7 @@ msgstr "privát beszélgetésben a másik fél távollétét csak egyszer jelezz
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -3505,18 +3499,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "ismeretlen parancsok küldése az IRC szervernek"
msgid "automatically log server messages"
msgstr "szerverüzenetek automatikus naplózása"
msgid "automatically log channel chats"
msgstr "szobabeszélgetések automatikus naplózása"
msgid "automatically log private chats"
msgstr "személyes beszélgetése automatikus naplózása"
msgid "hide password displayed by nickserv"
msgstr "a nickserv által mutatott jelszó elrejtése"
#, fuzzy
msgid "IRC debug messages"
msgstr "hibakereső üzenetek megjelenítése"
@@ -4029,6 +4011,18 @@ msgstr "%s: Újracsatlakozás a szerverhez...\n"
msgid "%s%s: disconnected from server"
msgstr "Lekapcsolódott a szerverről!\n"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s nem sikerült a szervert létrehozni\n"
@@ -4045,10 +4039,75 @@ msgstr "**** Naplófájl kezdete "
msgid "%s\t**** End of log ****"
msgstr "**** Naplófájl vége "
#, fuzzy
msgid "Logging on buffers:"
msgstr "Aliaszok listája:\n"
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
msgid "log not started"
msgstr ""
#, fuzzy, c-format
msgid "%s: \"%s\" => level %d"
msgstr "A \"%s\" aliasz eltávolítva\n"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr ""
#, fuzzy
msgid "logger plugin configuration"
msgstr "Beállítások mentése a lemezre\n"
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
#, fuzzy
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
@@ -4071,6 +4130,12 @@ msgstr ""
"modulok elérési útvonala ('%h' helyére automatikusan a WeeChat saját "
"könyvtára, alapértelmezésben ~/.weechat, kerül)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -4089,14 +4154,6 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
#, fuzzy, c-format
msgid "Notify level: %s => %s"
msgstr "Értesítési szintek:"
#, fuzzy, c-format
msgid "Notify level: %s: removed"
msgstr "Értesítési szintek:"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s ismeretlen billentyűparancs \"%s\"\n"
@@ -4848,6 +4905,35 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
#~ msgid "automatically log server messages"
#~ msgstr "szerverüzenetek automatikus naplózása"
#~ msgid "automatically log channel chats"
#~ msgstr "szobabeszélgetések automatikus naplózása"
#~ msgid "automatically log private chats"
#~ msgstr "személyes beszélgetése automatikus naplózása"
#, fuzzy
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "a pufferek időbélyege"
#, fuzzy
#~ msgid " %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s"
#~ msgstr "%s%s %s(%s%s%s)%s kilépett"
#, fuzzy
#~ msgid "Notify level: %s => %s"
#~ msgstr "Értesítési szintek:"
#, fuzzy
#~ msgid "Notify level: %s: removed"
#~ msgstr "Értesítési szintek:"
#, fuzzy
#~ msgid "Error: unable to create \"%s\" directory\n"
#~ msgstr "%s nem sikerült a \"%s\" könyvtárat létrehozni\n"
#, fuzzy
#~ msgid "%sError: filter not \"%s\" found"
#~ msgstr "%s a \"%s\" modul nem található\n"
+120 -34
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -81,7 +81,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr "%s домашний каталог (%s) не является директорией\n"
#, fuzzy, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s не могу создать директорию \"%s\"\n"
#, fuzzy, c-format
@@ -1846,10 +1846,6 @@ msgid ""
"version)"
msgstr ""
#, fuzzy, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s не могу создать директорию \"%s\"\n"
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@@ -2057,7 +2053,7 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr "Сокращение \"%s\" удалено\n"
#. TRANSLATORS: %s is "aspell"
@@ -2147,7 +2143,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr "Сокращение \"%s\" удалено\n"
#, fuzzy, c-format
@@ -3320,11 +3316,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr "%s некорректные аргументы команды \"%s\"\n"
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating server \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
@@ -3431,6 +3422,9 @@ msgstr "показывать сообщение во все каналы при
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr "скрывать пароль, отображаемый nickserv'ом"
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -3441,7 +3435,7 @@ msgstr "отображать уведомление об отсутствии е
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -3499,18 +3493,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr "отсылать неизвестные команды IRC серверу"
msgid "automatically log server messages"
msgstr "автоматически журналировать сообщения сервера"
msgid "automatically log channel chats"
msgstr "автоматически журналировать сообщения с каналов"
msgid "automatically log private chats"
msgstr "автоматически журналировать приваты"
msgid "hide password displayed by nickserv"
msgstr "скрывать пароль, отображаемый nickserv'ом"
#, fuzzy
msgid "IRC debug messages"
msgstr "выводить отладочные сообщения"
@@ -4017,6 +3999,18 @@ msgstr "%s: Повторное соединение...\n"
msgid "%s%s: disconnected from server"
msgstr "Отключен от сервера!\n"
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr "%s не могу создать сервер \"%s\"\n"
@@ -4033,10 +4027,75 @@ msgstr "**** Начало log-файла"
msgid "%s\t**** End of log ****"
msgstr "**** Конец log-файла"
#, fuzzy
msgid "Logging on buffers:"
msgstr "Список сокращений:\n"
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
msgid "log not started"
msgstr ""
#, fuzzy, c-format
msgid "%s: \"%s\" => level %d"
msgstr "Сокращение \"%s\" удалено\n"
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr ""
#, fuzzy
msgid "logger plugin configuration"
msgstr "Сохраняю конфигурацию\n"
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
#, fuzzy
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
@@ -4058,6 +4117,12 @@ msgstr ""
"путь поиска pluginов ('%h' заменяется на домашний каталог WeeChat, по "
"умолчанию - ~/.weechat)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -4076,14 +4141,6 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
#, fuzzy, c-format
msgid "Notify level: %s => %s"
msgstr "Уровни уведомления:"
#, fuzzy, c-format
msgid "Notify level: %s: removed"
msgstr "Уровни уведомления:"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s неизвестная функция клавиши \"%s\"\n"
@@ -4830,6 +4887,35 @@ msgstr "%s DCC: не могу установить неблокирующий р
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s нет аргумента для параметра \"%s\"\n"
#~ msgid "automatically log server messages"
#~ msgstr "автоматически журналировать сообщения сервера"
#~ msgid "automatically log channel chats"
#~ msgstr "автоматически журналировать сообщения с каналов"
#~ msgid "automatically log private chats"
#~ msgstr "автоматически журналировать приваты"
#, fuzzy
#~ msgid "New level for buffer \"%s\" is %d"
#~ msgstr "время в буферах"
#, fuzzy
#~ msgid " %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s"
#~ msgstr "%s%s %s(%s%s%s)%s вышел"
#, fuzzy
#~ msgid "Notify level: %s => %s"
#~ msgstr "Уровни уведомления:"
#, fuzzy
#~ msgid "Notify level: %s: removed"
#~ msgstr "Уровни уведомления:"
#, fuzzy
#~ msgid "Error: unable to create \"%s\" directory\n"
#~ msgstr "%s не могу создать директорию \"%s\"\n"
#, fuzzy
#~ msgid "%sError: filter not \"%s\" found"
#~ msgstr "%s plugin \"%s\" не найден\n"
+89 -34
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-10-26 17:42+0100\n"
"POT-Creation-Date: 2008-10-30 17:11+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"
@@ -63,7 +63,7 @@ msgid "Error: home (%s) is not a directory\n"
msgstr ""
#, c-format
msgid "Error: unable to create \"%s\" directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr ""
#, c-format
@@ -1543,10 +1543,6 @@ msgid ""
"version)"
msgstr ""
#, c-format
msgid "Error: cannot create directory \"%s\"\n"
msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
@@ -1723,7 +1719,7 @@ msgid "%s: debug disabled"
msgstr ""
#, c-format
msgid "%s: %s: removed"
msgid "%s: \"%s\" removed"
msgstr ""
#. TRANSLATORS: %s is "aspell"
@@ -1812,7 +1808,7 @@ msgid "global encoding charset"
msgstr ""
#, c-format
msgid "%s: %s, %s: removed"
msgid "%s: %s, \"%s\": removed"
msgstr ""
#, c-format
@@ -2806,11 +2802,6 @@ msgstr ""
msgid "%sirc: too few arguments for \"%s\" command"
msgstr ""
msgid ""
"You should now create filter on tag \"irc_smart_filter\" with command /"
"filter."
msgstr ""
#, c-format
msgid "%s%s: error creating server \"%s\""
msgstr ""
@@ -2904,6 +2895,9 @@ msgstr ""
msgid "display channel modes in \"buffer_name\" bar item"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr ""
msgid ""
"comma separated list of tags for messages that may produce highlight "
"(usually any message from another user, not server messages,..)"
@@ -2914,7 +2908,7 @@ msgstr ""
msgid ""
"filter join/part/quit messages for a nick if not speaking for some minutes "
"on channel"
"on channel (you must create a filter on tag \"irc_smart_filter\")"
msgstr ""
msgid "delay for filtering join/part/quit messages (in minutes)"
@@ -2963,18 +2957,6 @@ msgstr ""
msgid "send unknown commands to IRC server"
msgstr ""
msgid "automatically log server messages"
msgstr ""
msgid "automatically log channel chats"
msgstr ""
msgid "automatically log private chats"
msgstr ""
msgid "hide password displayed by nickserv"
msgstr ""
msgid "IRC debug messages"
msgstr ""
@@ -3465,6 +3447,18 @@ msgstr ""
msgid "%s%s: disconnected from server"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to find filename mask for buffer \"%s\", logging is disabled "
"for this buffer"
msgstr ""
#, c-format
msgid ""
"%s%s: unable to start logging for buffer \"%s\": filename \"%s\" is already "
"user by another buffer (check your log settings)"
msgstr ""
#, c-format
msgid "%s%s: unable to create directory for logs (\"%s\")"
msgstr ""
@@ -3481,10 +3475,73 @@ msgstr ""
msgid "%s\t**** End of log ****"
msgstr ""
msgid "Logging on buffers:"
msgstr ""
#, c-format
msgid "logging (level: %d)"
msgstr ""
#, c-format
msgid "not logging"
msgstr ""
msgid "log not started"
msgstr ""
#, c-format
msgid "%s: \"%s\" => level %d"
msgstr ""
#, c-format
msgid "===\t========== End of backlog (%d lines) =========="
msgstr ""
msgid "logger plugin configuration"
msgstr ""
msgid "[list | set level | disable]"
msgstr ""
msgid ""
" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = logging disabled, 1 = a few "
"messages (most important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set level to 0)\n"
"\n"
"Options \"logger.level.*\" and \"logger.mask.*\" can be used to set level or "
"mask for a buffer, or buffers beginning with name.\n"
"\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n"
"\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n"
"\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"
msgstr ""
msgid ""
"logging level for this buffer (0 = logging disabled, 1 = a few messages "
"(most important) .. 9 = all messages)"
msgstr ""
msgid "file mask for log file; local buffer variables are permitted"
msgstr ""
msgid ""
"maximum number of lines to display from log file when creating new buffer (0 "
"= no backlog)"
@@ -3502,6 +3559,12 @@ msgid ""
"weechat by default)"
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"
msgstr ""
msgid "write information line in log file when log starts or ends for a buffer"
msgstr ""
@@ -3519,14 +3582,6 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
#, c-format
msgid "Notify level: %s => %s"
msgstr ""
#, c-format
msgid "Notify level: %s: removed"
msgstr ""
#, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr ""
+6 -4
View File
@@ -497,14 +497,17 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
ptr_buffer = ptr_buffer->next_buffer)
{
gui_chat_printf (NULL,
" %s[%s%d%s]%s (%s) %s",
" %s[%s%d%s]%s (%s) %s%s%s (notify: %d)",
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT),
ptr_buffer->number,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT),
plugin_get_name (ptr_buffer->plugin),
ptr_buffer->name);
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
ptr_buffer->name,
GUI_COLOR(GUI_COLOR_CHAT),
ptr_buffer->notify);
}
return WEECHAT_RC_OK;
@@ -708,8 +711,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
ptr_buffer = gui_buffer_search_by_partial_name (NULL, argv_eol[1]);
if (ptr_buffer)
{
gui_window_switch_to_buffer (gui_current_window,
ptr_buffer);
gui_window_switch_to_buffer (gui_current_window, ptr_buffer, 1);
}
}
+33 -5
View File
@@ -177,7 +177,12 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
struct t_config_section *section,
const char *option_name,
const char *value),
void *callback_create_option_data)
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
void *callback_delete_option_data)
{
struct t_config_section *new_section;
@@ -201,6 +206,8 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
new_section->callback_write_default_data = callback_write_default_data;
new_section->callback_create_option = callback_create_option;
new_section->callback_create_option_data = callback_create_option_data;
new_section->callback_delete_option = callback_delete_option;
new_section->callback_delete_option_data = callback_delete_option_data;
new_section->options = NULL;
new_section->last_option = NULL;
@@ -458,12 +465,20 @@ config_file_new_option (struct t_config_file *config_file,
number = strtol (default_value, &error, 10);
if (!error || error[0])
number = 0;
if (number < min)
number = min;
else if (number > max)
number = max;
new_option->default_value = malloc (sizeof (int));
*((int *)new_option->default_value) = number;
error = NULL;
number = strtol (value, &error, 10);
if (!error || error[0])
number = 0;
if (number < min)
number = min;
else if (number > max)
number = max;
new_option->value = malloc (sizeof (int));
*((int *)new_option->value) = number;
}
@@ -1166,9 +1181,20 @@ config_file_option_unset (struct t_config_option *option)
}
option_full_name = config_file_option_full_name (option);
config_file_option_free (option);
rc = WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
if (option->section->callback_delete_option)
{
rc = (int)(option->section->callback_delete_option)
(option->section->callback_delete_option_data,
option->config_file,
option->section,
option);
}
else
{
config_file_option_free (option);
rc = WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
if (option_full_name)
{
@@ -2224,7 +2250,7 @@ config_file_add_to_infolist (struct t_infolist *infolist,
free (option_full_name);
return 0;
}
string_values = string_build_with_exploded (ptr_option->string_values,
string_values = string_build_with_exploded ((const char **)ptr_option->string_values,
"|");
if (!infolist_new_var_string (ptr_item,
"string_values",
@@ -2528,6 +2554,8 @@ config_file_print_log ()
log_printf (" callback_write_default_data: 0x%x", ptr_section->callback_write_default_data);
log_printf (" callback_create_option. . .: 0x%x", ptr_section->callback_create_option);
log_printf (" callback_create_option_data: 0x%x", ptr_section->callback_create_option_data);
log_printf (" callback_delete_option. . .: 0x%x", ptr_section->callback_delete_option);
log_printf (" callback_delete_option_data: 0x%x", ptr_section->callback_delete_option_data);
log_printf (" options. . . . . . . . . . : 0x%x", ptr_section->options);
log_printf (" last_option. . . . . . . . : 0x%x", ptr_section->last_option);
log_printf (" prev_section . . . . . . . : 0x%x", ptr_section->prev_section);
+14 -1
View File
@@ -38,6 +38,8 @@
struct t_weelist;
struct t_infolist;
struct t_config_option;
struct t_config_file
{
struct t_weechat_plugin *plugin; /* plugin which created this cfg */
@@ -84,6 +86,12 @@ struct t_config_section
const char *option_name,
const char *value);
void *callback_create_option_data; /* data sent to create callback */
int (*callback_delete_option) /* called to delete option in */
(void *data, /* section */
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option);
void *callback_delete_option_data; /* data sent to delete callback */
struct t_config_option *options; /* options in section */
struct t_config_option *last_option; /* last option in section */
struct t_config_section *prev_section; /* link to previous section */
@@ -163,7 +171,12 @@ extern struct t_config_section *config_file_new_section (struct t_config_file *c
struct t_config_section *section,
const char *option_name,
const char *value),
void *callback_create_option_data);
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
void *callback_delete_option_data);
extern struct t_config_section *config_file_search_section (struct t_config_file *config_file,
const char *section_name);
extern int config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
+11 -13
View File
@@ -825,7 +825,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "startup",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -862,7 +862,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1074,7 +1074,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "color",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1502,7 +1502,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "completion",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1557,7 +1557,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "history",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1587,7 +1587,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "proxy",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1634,7 +1634,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "plugin",
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1683,8 +1683,7 @@ config_weechat_init ()
ptr_section = config_file_new_section (weechat_config_file, "bar",
0, 0,
&config_weechat_bar_read, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
@@ -1699,8 +1698,7 @@ config_weechat_init ()
0, 0,
&config_weechat_layout_read, NULL,
&config_weechat_layout_write, NULL,
NULL, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1713,7 +1711,7 @@ config_weechat_init ()
&config_weechat_filter_read, NULL,
&config_weechat_filter_write, NULL,
&config_weechat_filter_write, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
@@ -1726,7 +1724,7 @@ config_weechat_init ()
&config_weechat_key_read, NULL,
&config_weechat_key_write, NULL,
&config_weechat_key_write, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
+2 -1
View File
@@ -921,7 +921,8 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
void
hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
char **tags_array, const char *prefix, const char *message)
const char **tags_array, const char *prefix,
const char *message)
{
struct t_hook *ptr_hook, *next_hook;
char *prefix_no_color, *message_no_color;
+2 -2
View File
@@ -142,7 +142,7 @@ struct t_hook_connect
typedef int (t_hook_callback_print)(void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count,
char **tags, const char *prefix,
const char **tags, const char *prefix,
const char *message);
struct t_hook_print
@@ -267,7 +267,7 @@ extern struct t_hook *hook_print (struct t_weechat_plugin *plugin,
void *callback_data);
extern void hook_print_exec (struct t_gui_buffer *buffer,
time_t date, int tags_count,
char **tags_array, const char *prefix,
const char **tags_array, const char *prefix,
const char *message);
extern struct t_hook *hook_signal (struct t_weechat_plugin *plugin,
const char *signal,
+1 -1
View File
@@ -854,7 +854,7 @@ string_free_exploded (char **exploded_string)
*/
char *
string_build_with_exploded (char **exploded_string, const char *separator)
string_build_with_exploded (const char **exploded_string, const char *separator)
{
int i, length, length_separator;
char *result;
+1 -1
View File
@@ -44,7 +44,7 @@ extern int string_has_highlight (const char *string,
extern char **string_explode (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
extern void string_free_exploded (char **exploded_string);
extern char *string_build_with_exploded (char **exploded_string,
extern char *string_build_with_exploded (const char **exploded_string,
const char *separator);
extern char **string_split_command (const char *command, char separator);
extern void string_free_splitted_command (char **splitted_command);
+3 -1
View File
@@ -491,8 +491,10 @@ upgrade_weechat_load ()
gui_hotlist_clear ();
if (upgrade_set_current_buffer)
{
gui_window_switch_to_buffer (gui_current_window,
upgrade_set_current_buffer);
upgrade_set_current_buffer, 0);
}
return rc;
}
+98 -12
View File
@@ -28,6 +28,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <signal.h>
#include <ctype.h>
@@ -138,28 +139,113 @@ util_catch_signal (int signum, void (*handler)(int))
}
/*
* util_create_dir: create a directory
* return: 1 if ok (or directory already exists)
* 0 if error
* util_mkdir_home: create a directory in WeeChat home
* return 1 if ok, 0 if error
*/
int
util_create_dir (const char *directory, int permissions)
util_mkdir_home (const char *directory, int mode)
{
if (mkdir (directory, 0755) < 0)
char *dir_name;
int dir_length;
if (!directory)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (directory) + 2;
dir_name = malloc (dir_length);
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, directory);
if (mkdir (dir_name, mode) < 0)
{
/* exit if error (except if directory already exists) */
if (errno != EEXIST)
{
string_iconv_fprintf (stderr,
_("Error: cannot create directory \"%s\"\n"),
directory);
free (dir_name);
return 0;
}
return 1;
}
if ((permissions != 0) && (strcmp (directory, getenv ("HOME")) != 0))
chmod (directory, permissions);
free (dir_name);
return 1;
}
/*
* util_mkdir: create a directory
* return 1 if ok, 0 if error
*/
int
util_mkdir (const char *directory, int mode)
{
if (!directory)
return 0;
if (mkdir (directory, mode) < 0)
{
if (errno != EEXIST)
return 0;
}
return 1;
}
/*
* util_mkdir_parents: create a directory and make parent directories as needed
* return 1 if ok, 0 if error
*/
int
util_mkdir_parents (const char *directory, int mode)
{
char *string, *ptr_string, *pos_sep;
struct stat buf;
int rc;
if (!directory)
return 0;
string = strdup (directory);
if (!string)
return 0;
ptr_string = string;
while (ptr_string[0] == DIR_SEPARATOR_CHAR)
{
ptr_string++;
}
while (ptr_string && ptr_string[0])
{
pos_sep = strchr (ptr_string, DIR_SEPARATOR_CHAR);
if (pos_sep)
pos_sep[0] = '\0';
rc = stat (string, &buf);
if ((rc < 0) || !S_ISDIR(buf.st_mode))
{
/* try to create directory */
if (!util_mkdir (string, mode))
{
free (string);
return 0;
}
}
if (pos_sep)
{
pos_sep[0] = DIR_SEPARATOR_CHAR;
ptr_string = pos_sep + 1;
}
else
ptr_string = NULL;
}
free (string);
return 1;
}
+3 -1
View File
@@ -25,7 +25,9 @@ extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2);
extern void util_timeval_add (struct timeval *tv, long interval);
extern int util_get_time_length (const char *time_format);
extern void util_catch_signal (int signum, void (*handler)(int));
extern int util_create_dir (const char *directory, int permissions);
extern int util_mkdir_home (const char *directory, int mode);
extern int util_mkdir (const char *directory, int mode);
extern int util_mkdir_parents (const char *directory, int mode);
extern void util_exec_on_files (const char *directory, void *data,
void (*callback)(void *data,
const char *filename));
+2 -2
View File
@@ -256,10 +256,10 @@ weechat_create_home_dirs ()
}
/* create home directory; error is fatal */
if (!util_create_dir (weechat_home, 0))
if (!util_mkdir (weechat_home, 0755))
{
string_iconv_fprintf (stderr,
_("Error: unable to create \"%s\" directory\n"),
_("Error: cannot create directory \"%s\"\n"),
weechat_home);
weechat_shutdown (EXIT_FAILURE, 0);
}
+1 -1
View File
@@ -264,7 +264,7 @@ gui_main_loop ()
{
if (ptr_win->refresh_needed)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer, 0);
gui_window_redraw_buffer (ptr_win->buffer);
ptr_win->refresh_needed = 0;
}
+16 -12
View File
@@ -450,7 +450,8 @@ gui_window_redraw_all_buffers ()
void
gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer)
struct t_gui_buffer *buffer,
int set_last_read)
{
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_buffer *old_buffer;
@@ -467,11 +468,14 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
{
window->start_line = NULL;
window->start_line_pos = 0;
if (window->buffer->num_displayed == 0)
window->buffer->last_read_line = window->buffer->last_line;
if (buffer->last_read_line == buffer->last_line)
buffer->last_read_line = NULL;
gui_previous_buffer = window->buffer;
if (set_last_read)
{
if (window->buffer->num_displayed == 0)
window->buffer->last_read_line = window->buffer->last_line;
if (buffer->last_read_line == buffer->last_line)
buffer->last_read_line = NULL;
}
}
window->buffer = buffer;
@@ -547,12 +551,12 @@ gui_window_switch (struct t_gui_window *window)
{
gui_current_window = old_window;
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_current_window->buffer, 1);
gui_current_window = window;
}
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_current_window->buffer, 1);
gui_current_window->refresh_needed = 1;
}
@@ -936,7 +940,7 @@ gui_window_refresh_windows ()
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer, 0);
gui_window_draw_separator (ptr_win);
ptr_win->refresh_needed = 0;
}
@@ -986,7 +990,7 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
new_window->buffer = window->buffer;
new_window->buffer->num_displayed++;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_window_switch (new_window);
}
@@ -1030,7 +1034,7 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
new_window->buffer = window->buffer;
new_window->buffer->num_displayed++;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_window_switch (new_window);
@@ -1121,7 +1125,7 @@ gui_window_merge (struct t_gui_window *window)
gui_window_free (sister->window);
gui_window_tree_node_to_leaf (parent, window);
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
window->refresh_needed = 1;
return 1;
}
@@ -1166,7 +1170,7 @@ gui_window_merge_all (struct t_gui_window *window)
window->win_height_pct = 100;
gui_current_window = window;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
window->refresh_needed = 1;
}
}
+23 -14
View File
@@ -183,7 +183,7 @@ gui_window_switch (struct t_gui_window *window)
gui_current_window = window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
}
@@ -193,7 +193,9 @@ gui_window_switch (struct t_gui_window *window)
*/
void
gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *buffer)
gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer,
int set_last_read)
{
GtkTextIter start, end;
@@ -202,9 +204,16 @@ gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *b
if (window->buffer != buffer)
{
window->buffer->last_read_line = window->buffer->last_line;
if (buffer->last_read_line == buffer->last_line)
buffer->last_read_line = NULL;
window->start_line = NULL;
window->start_line_pos = 0;
gui_previous_buffer = window->buffer;
if (set_last_read)
{
if (window->buffer->num_displayed == 0)
window->buffer->last_read_line = window->buffer->last_line;
if (buffer->last_read_line == buffer->last_line)
buffer->last_read_line = NULL;
}
}
window->buffer = buffer;
@@ -490,10 +499,10 @@ gui_window_split_horiz (struct t_gui_window *window, int percentage)
new_window->buffer = window->buffer;
new_window->buffer->num_displayed++;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_current_window = new_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
@@ -535,10 +544,10 @@ gui_window_split_vertic (struct t_gui_window *window, int percentage)
new_window->buffer = window->buffer;
new_window->buffer->num_displayed++;
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_current_window = new_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
/* create & draw separator */
@@ -599,7 +608,7 @@ gui_window_merge (struct t_gui_window *window)
gui_window_free (sister->window);
gui_window_tree_node_to_leaf (parent, window);
gui_window_switch_to_buffer (window, window->buffer);
gui_window_switch_to_buffer (window, window->buffer, 1);
gui_window_redraw_buffer (window->buffer);
return 1;
}
@@ -688,7 +697,7 @@ gui_window_switch_up (struct t_gui_window *window)
(gui_window_side_by_side (window, ptr_win) == 1))
{
gui_current_window = ptr_win;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
return;
}
@@ -711,7 +720,7 @@ gui_window_switch_down (struct t_gui_window *window)
(gui_window_side_by_side (window, ptr_win) == 3))
{
gui_current_window = ptr_win;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
return;
}
@@ -734,7 +743,7 @@ gui_window_switch_left (struct t_gui_window *window)
(gui_window_side_by_side (window, ptr_win) == 4))
{
gui_current_window = ptr_win;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
return;
}
@@ -757,7 +766,7 @@ gui_window_switch_right (struct t_gui_window *window)
(gui_window_side_by_side (window, ptr_win) == 2))
{
gui_current_window = ptr_win;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
return;
}
+136 -129
View File
@@ -86,6 +86,119 @@ gui_buffer_find_pos (struct t_gui_buffer *buffer)
return NULL;
}
/*
* gui_buffer_local_var_search: search a local variable with name
*/
struct t_gui_buffer_local_var *
gui_buffer_local_var_search (struct t_gui_buffer *buffer, const char *name)
{
struct t_gui_buffer_local_var *ptr_local_var;
if (!buffer || !name)
return NULL;
for (ptr_local_var = buffer->local_variables; ptr_local_var;
ptr_local_var = ptr_local_var->next_var)
{
if (strcmp (ptr_local_var->name, name) == 0)
return ptr_local_var;
}
/* local variable not found */
return NULL;
}
/*
* gui_buffer_local_var_add: add a new local variable to a buffer
*/
struct t_gui_buffer_local_var *
gui_buffer_local_var_add (struct t_gui_buffer *buffer, const char *name,
const char *value)
{
struct t_gui_buffer_local_var *new_local_var;
if (!buffer || !name || !value)
return NULL;
new_local_var = gui_buffer_local_var_search (buffer, name);
if (new_local_var)
{
if (new_local_var->name)
free (new_local_var->name);
if (new_local_var->value)
free (new_local_var->value);
new_local_var->name = strdup (name);
new_local_var->value = strdup (value);
}
else
{
new_local_var = malloc (sizeof (*new_local_var));
if (new_local_var)
{
new_local_var->name = strdup (name);
new_local_var->value = strdup (value);
new_local_var->prev_var = buffer->last_local_var;
new_local_var->next_var = NULL;
if (buffer->local_variables)
buffer->last_local_var->next_var = new_local_var;
else
buffer->local_variables = new_local_var;
buffer->last_local_var = new_local_var;
}
}
return new_local_var;
}
/*
* gui_buffer_local_var_remove: remove a local variable in a buffer
*/
void
gui_buffer_local_var_remove (struct t_gui_buffer *buffer,
struct t_gui_buffer_local_var *local_var)
{
if (!buffer || !local_var)
return;
/* free data */
if (local_var->name)
free (local_var->name);
if (local_var->value)
free (local_var->value);
/* remove local variable from list */
if (local_var->prev_var)
(local_var->prev_var)->next_var = local_var->next_var;
if (local_var->next_var)
(local_var->next_var)->prev_var = local_var->prev_var;
if (buffer->local_variables == local_var)
buffer->local_variables = local_var->next_var;
if (buffer->last_local_var == local_var)
buffer->last_local_var = local_var->prev_var;
free (local_var);
}
/*
* gui_buffer_local_var_remove_all: remove all local variables in a buffer
*/
void
gui_buffer_local_var_remove_all (struct t_gui_buffer *buffer)
{
if (buffer)
{
while (buffer->local_variables)
{
gui_buffer_local_var_remove (buffer, buffer->local_variables);
}
}
}
/*
* gui_buffer_insert: insert buffer in good position in list of buffers
*/
@@ -245,6 +358,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
/* local variables */
new_buffer->local_variables = NULL;
new_buffer->last_local_var = NULL;
gui_buffer_local_var_add (new_buffer, "plugin", plugin_get_name (plugin));
gui_buffer_local_var_add (new_buffer, "name", name);
/* add buffer to buffers list */
gui_buffer_insert (new_buffer);
@@ -257,7 +372,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
gui_current_window->start_line = NULL;
gui_current_window->start_line_pos = 0;
gui_window_calculate_pos_size (gui_current_window);
gui_window_switch_to_buffer (gui_current_window, new_buffer);
gui_window_switch_to_buffer (gui_current_window, new_buffer, 0);
}
/* check if this buffer should be assigned to a window,
@@ -299,120 +414,6 @@ gui_buffer_valid (struct t_gui_buffer *buffer)
return 0;
}
/*
* gui_buffer_local_var_search: search a local variable with name
*/
struct t_gui_buffer_local_var *
gui_buffer_local_var_search (struct t_gui_buffer *buffer, const char *name)
{
struct t_gui_buffer_local_var *ptr_local_var;
if (!buffer || !name)
return NULL;
for (ptr_local_var = buffer->local_variables; ptr_local_var;
ptr_local_var = ptr_local_var->next_var)
{
if (strcmp (ptr_local_var->name, name) == 0)
return ptr_local_var;
}
/* local variable not found */
return NULL;
}
/*
* gui_buffer_local_var_add: add a new local variable to a buffer
*/
struct t_gui_buffer_local_var *
gui_buffer_local_var_add (struct t_gui_buffer *buffer, const char *name,
const char *value)
{
struct t_gui_buffer_local_var *new_local_var;
if (!buffer || !name || !value)
return NULL;
new_local_var = gui_buffer_local_var_search (buffer, name);
if (new_local_var)
{
if (new_local_var->name)
free (new_local_var->name);
if (new_local_var->value)
free (new_local_var->value);
new_local_var->name = strdup (name);
new_local_var->value = strdup (value);
}
else
{
new_local_var = malloc (sizeof (*new_local_var));
if (new_local_var)
{
new_local_var->name = strdup (name);
new_local_var->value = strdup (value);
new_local_var->prev_var = buffer->last_local_var;
new_local_var->next_var = NULL;
if (buffer->local_variables)
buffer->last_local_var->next_var = new_local_var;
else
buffer->local_variables = new_local_var;
buffer->last_local_var = new_local_var;
}
}
return new_local_var;
}
/*
* gui_buffer_local_var_remove: remove a local variable in a buffer
*/
void
gui_buffer_local_var_remove (struct t_gui_buffer *buffer,
struct t_gui_buffer_local_var *local_var)
{
if (!buffer || !local_var)
return;
/* free data */
if (local_var->name)
free (local_var->name);
if (local_var->value)
free (local_var->value);
/* remove local variable from list */
if (local_var->prev_var)
(local_var->prev_var)->next_var = local_var->next_var;
if (local_var->next_var)
(local_var->next_var)->prev_var = local_var->prev_var;
if (buffer->local_variables == local_var)
buffer->local_variables = local_var->next_var;
if (buffer->last_local_var == local_var)
buffer->last_local_var = local_var->prev_var;
free (local_var);
}
/*
* gui_buffer_local_var_remove_all: remove all local variables in a buffer
*/
void
gui_buffer_local_var_remove_all (struct t_gui_buffer *buffer)
{
if (buffer)
{
while (buffer->local_variables)
{
gui_buffer_local_var_remove (buffer, buffer->local_variables);
}
}
}
/*
* gui_buffer_string_replace_local_var: replace local variables ($var) in a
* string, using value of local variables
@@ -615,6 +616,8 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
free (buffer->name);
buffer->name = strdup (name);
gui_buffer_local_var_add (buffer, "name", name);
hook_signal_send ("buffer_renamed",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
@@ -798,18 +801,18 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
gui_hotlist_add (buffer, number, NULL, 1);
}
}
else if (string_strcasecmp (property, "unread") == 0)
{
gui_buffer_set_unread (buffer);
}
if (!buffer)
return;
/* properties that need a buffer */
if (string_strcasecmp (property, "display") == 0)
if (string_strcasecmp (property, "unread") == 0)
{
gui_window_switch_to_buffer (gui_current_window, buffer);
gui_buffer_set_unread (buffer);
}
else if (string_strcasecmp (property, "display") == 0)
{
gui_window_switch_to_buffer (gui_current_window, buffer, 0);
}
else if (string_strcasecmp (property, "name") == 0)
{
@@ -1280,9 +1283,9 @@ gui_buffer_switch_previous (struct t_gui_window *window)
return;
if (window->buffer->prev_buffer)
gui_window_switch_to_buffer (window, window->buffer->prev_buffer);
gui_window_switch_to_buffer (window, window->buffer->prev_buffer, 1);
else
gui_window_switch_to_buffer (window, last_gui_buffer);
gui_window_switch_to_buffer (window, last_gui_buffer, 1);
}
/*
@@ -1300,9 +1303,9 @@ gui_buffer_switch_next (struct t_gui_window *window)
return;
if (window->buffer->next_buffer)
gui_window_switch_to_buffer (window, window->buffer->next_buffer);
gui_window_switch_to_buffer (window, window->buffer->next_buffer, 1);
else
gui_window_switch_to_buffer (window, gui_buffers);
gui_window_switch_to_buffer (window, gui_buffers, 1);
}
/*
@@ -1327,7 +1330,7 @@ gui_buffer_switch_by_number (struct t_gui_window *window, int number)
{
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
{
gui_window_switch_to_buffer (window, ptr_buffer);
gui_window_switch_to_buffer (window, ptr_buffer, 1);
return;
}
}
@@ -1595,7 +1598,7 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
int num_line, msg_pos;
char *message_without_colors;
char *message_without_colors, *tags;
char hexa[(16 * 3) + 1], ascii[(16 * 2) + 1];
int hexa_pos, ascii_pos;
@@ -1613,7 +1616,11 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
message_without_colors : "(null)");
if (message_without_colors)
free (message_without_colors);
tags = string_build_with_exploded ((const char **)ptr_line->tags_array, ",");
log_printf (" tags: %s", (tags) ? tags : "(none)");
if (tags)
free (tags);
/* display raw message for line */
if (ptr_line->message)
{
@@ -1766,7 +1773,7 @@ gui_buffer_print_log ()
while (ptr_line)
{
num--;
tags = string_build_with_exploded (ptr_line->tags_array, ",");
tags = string_build_with_exploded ((const char **)ptr_line->tags_array, ",");
log_printf (" line N-%05d: y:%d, str_time:'%s', tags:'%s', "
"displayed:%d, highlight:%d, refresh_needed:%d, prefix:'%s'",
num, ptr_line->y, ptr_line->str_time,
+1 -1
View File
@@ -1036,7 +1036,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
{
hook_print_exec (buffer, buffer->last_line->date,
buffer->last_line->tags_count,
buffer->last_line->tags_array,
(const char **)buffer->last_line->tags_array,
buffer->last_line->prefix,
buffer->last_line->message);
}
+2 -2
View File
@@ -1140,7 +1140,7 @@ gui_input_jump_smart ()
if (!gui_hotlist_initial_buffer)
gui_hotlist_initial_buffer = gui_current_window->buffer;
gui_window_switch_to_buffer (gui_current_window,
gui_hotlist->buffer);
gui_hotlist->buffer, 1);
gui_window_scroll_bottom (gui_current_window);
}
else
@@ -1148,7 +1148,7 @@ gui_input_jump_smart ()
if (gui_hotlist_initial_buffer)
{
gui_window_switch_to_buffer (gui_current_window,
gui_hotlist_initial_buffer);
gui_hotlist_initial_buffer, 1);
gui_window_scroll_bottom (gui_current_window);
gui_hotlist_initial_buffer = NULL;
}
+2 -2
View File
@@ -419,7 +419,7 @@ gui_layout_window_check_buffer (struct t_gui_buffer *buffer)
if ((strcmp (ptr_win->layout_plugin_name, plugin_name) == 0)
&& (strcmp (ptr_win->layout_buffer_name, buffer->name) == 0))
{
gui_window_switch_to_buffer (ptr_win, buffer);
gui_window_switch_to_buffer (ptr_win, buffer, 0);
}
}
}
@@ -450,7 +450,7 @@ gui_layout_window_check_all_buffers ()
if ((strcmp (ptr_win->layout_plugin_name, plugin_name) == 0)
&& (strcmp (ptr_win->layout_buffer_name, ptr_buffer->name) == 0))
{
gui_window_switch_to_buffer (ptr_win, ptr_buffer);
gui_window_switch_to_buffer (ptr_win, ptr_buffer, 0);
break;
}
}
+2 -1
View File
@@ -139,7 +139,8 @@ extern void gui_window_objects_free (struct t_gui_window *window,
int free_bar_windows);
extern void gui_window_calculate_pos_size (struct t_gui_window *window);
extern void gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer);
struct t_gui_buffer *buffer,
int set_last_read);
extern void gui_window_switch (struct t_gui_window *window);
extern void gui_window_page_up (struct t_gui_window *window);
extern void gui_window_page_down (struct t_gui_window *window);
+2 -1
View File
@@ -677,7 +677,8 @@ alias_config_init ()
NULL, NULL,
NULL, NULL,
&alias_config_write_default, NULL,
&alias_config_create_option, NULL);
&alias_config_create_option, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (alias_config_file);
+57 -15
View File
@@ -111,15 +111,51 @@ weechat_aspell_config_change_default_dict (void *data,
}
/*
* weechat_aspell_config_create_option: set a dictionary for a buffer
* weechat_aspell_config_dict_change: called when a dictionary is changed
*/
void
weechat_aspell_config_dict_change (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_aspell_create_spellers (weechat_current_buffer);
}
/*
* weechat_aspell_config_dict_delete_option: delete option in "dict" section
*/
int
weechat_aspell_config_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
weechat_aspell_config_dict_delete_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
weechat_config_option_free (option);
weechat_aspell_create_spellers (weechat_current_buffer);
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
/*
* weechat_aspell_config_dict_create_option: create option in "dict" section
*/
int
weechat_aspell_config_dict_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
int rc;
@@ -154,7 +190,9 @@ weechat_aspell_config_create_option (void *data,
config_file, section,
option_name, "string",
_("comma separated list of dictionaries to use on this buffer"),
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "", value, NULL, NULL,
&weechat_aspell_config_dict_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -195,11 +233,11 @@ weechat_aspell_config_get_dict (const char *name)
int
weechat_aspell_config_set_dict (const char *name, const char *value)
{
return weechat_aspell_config_create_option (NULL,
weechat_aspell_config_file,
weechat_aspell_config_section_dict,
name,
value);
return weechat_aspell_config_dict_create_option (NULL,
weechat_aspell_config_file,
weechat_aspell_config_section_dict,
name,
value);
}
/*
@@ -221,7 +259,8 @@ weechat_aspell_config_init ()
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -238,7 +277,8 @@ weechat_aspell_config_init ()
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -269,12 +309,14 @@ weechat_aspell_config_init ()
"words)"),
NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* dict */
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
1, 1,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&weechat_aspell_config_create_option, NULL);
&weechat_aspell_config_dict_create_option, NULL,
&weechat_aspell_config_dict_delete_option, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
+4 -2
View File
@@ -257,6 +257,8 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer)
if (ptr_option)
return weechat_config_string (ptr_option);
}
else
free (name);
/* nothing found => return default dictionary (if set) */
if (weechat_config_string (weechat_aspell_config_check_default_dict)
@@ -283,10 +285,10 @@ weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value)
if (weechat_aspell_config_set_dict (name, value) > 0)
{
if (value && value[0])
weechat_printf (NULL, "%s: %s => %s",
weechat_printf (NULL, "%s: \"%s\" => %s",
ASPELL_PLUGIN_NAME, name, value);
else
weechat_printf (NULL, _("%s: %s: removed"),
weechat_printf (NULL, _("%s: \"%s\" removed"),
ASPELL_PLUGIN_NAME, name);
}
+10 -11
View File
@@ -181,9 +181,8 @@ charset_config_init ()
ptr_section = weechat_config_new_section (charset_config_file, "default",
0, 0,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
@@ -210,10 +209,10 @@ charset_config_init ()
ptr_section = weechat_config_new_section (charset_config_file, "decode",
1, 1,
NULL, NULL, NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&charset_config_create_option, NULL);
&charset_config_create_option, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
@@ -224,10 +223,10 @@ charset_config_init ()
ptr_section = weechat_config_new_section (charset_config_file, "encode",
1, 1,
NULL, NULL, NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
&charset_config_create_option, NULL);
&charset_config_create_option, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
@@ -407,10 +406,10 @@ charset_set (struct t_config_section *section, const char *type,
value) > 0)
{
if (value && value[0])
weechat_printf (NULL, "%s: %s, %s => %s",
weechat_printf (NULL, "%s: %s, \"%s\" => %s",
CHARSET_PLUGIN_NAME, type, name, value);
else
weechat_printf (NULL, _("%s: %s, %s: removed"),
weechat_printf (NULL, _("%s: %s, \"%s\": removed"),
CHARSET_PLUGIN_NAME, type, name);
}
}
+1 -1
View File
@@ -2067,7 +2067,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
{
msg_pwd_hidden = strdup (argv_eol[2]);
if (msg_pwd_hidden
&& (weechat_config_boolean (irc_config_log_hide_nickserv_pwd)))
&& (weechat_config_boolean (irc_config_look_hide_nickserv_pwd)))
irc_display_hide_password (msg_pwd_hidden, 0);
string = irc_color_decode (
(msg_pwd_hidden) ? msg_pwd_hidden : argv_eol[2],
+18 -121
View File
@@ -57,6 +57,7 @@ struct t_config_option *irc_config_look_nick_suffix;
struct t_config_option *irc_config_look_nick_completion_smart;
struct t_config_option *irc_config_look_display_away;
struct t_config_option *irc_config_look_display_channel_modes;
struct t_config_option *irc_config_look_hide_nickserv_pwd;
struct t_config_option *irc_config_look_highlight_tags;
struct t_config_option *irc_config_look_show_away_once;
struct t_config_option *irc_config_look_smart_filter;
@@ -77,13 +78,6 @@ struct t_config_option *irc_config_network_colors_receive;
struct t_config_option *irc_config_network_colors_send;
struct t_config_option *irc_config_network_send_unknown_commands;
/* IRC config, log section */
struct t_config_option *irc_config_log_auto_log_server;
struct t_config_option *irc_config_log_auto_log_channel;
struct t_config_option *irc_config_log_auto_log_private;
struct t_config_option *irc_config_log_hide_nickserv_pwd;
/* IRC config, server section */
struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS];
@@ -175,27 +169,6 @@ irc_config_change_display_channel_modes (void *data,
weechat_bar_item_update ("buffer_name");
}
/*
* irc_config_change_smart_filter: called when the "smart_filter" option is
* changed
*/
void
irc_config_change_smart_filter (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
if (weechat_config_boolean (irc_config_look_smart_filter))
{
weechat_printf (NULL,
_("You should now create filter on tag "
"\"irc_smart_filter\" with command /filter."));
}
}
/*
* irc_config_change_away_check: called when away check is changed
*/
@@ -227,60 +200,6 @@ irc_config_change_away_check (void *data,
}
}
/*
* irc_config_change_log: called when log settings are changed
* (for server/channel/private logging)
*/
void
irc_config_change_log (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
/*t_gui_buffer *ptr_buffer;
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->protocol == irc_protocol)
{
ptr_server = irc_server_search (ptr_buffer->category);
ptr_channel = irc_channel_search (ptr_server, ptr_buffer->name);
if (ptr_server && !ptr_channel)
{
if (irc_config_log_auto_server && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
else if (!irc_config_log_auto_server && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
if (ptr_server && ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
if (irc_config_log_auto_channel && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
else if (!irc_config_log_auto_channel && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
else
{
if (irc_config_log_auto_private && !ptr_buffer->log_file)
gui_log_start (ptr_buffer);
else if (!irc_config_log_auto_private && ptr_buffer->log_file)
gui_log_end (ptr_buffer);
}
}
}
}
*/
}
/*
* irc_config_server_default_change_cb: callback called when a default server
* option is modified
@@ -1014,7 +933,8 @@ irc_config_init ()
ptr_section = weechat_config_new_section (irc_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -1056,6 +976,11 @@ irc_config_init ()
"display_channel_modes", "boolean",
N_("display channel modes in \"buffer_name\" bar item"),
NULL, 0, 0, "on", NULL, NULL, NULL, &irc_config_change_display_channel_modes, NULL, NULL, NULL);
irc_config_look_hide_nickserv_pwd = weechat_config_new_option (
irc_config_file, ptr_section,
"hide_nickserv_pwd", "boolean",
N_("hide password displayed by nickserv"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_tags = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_tags", "string",
@@ -1072,8 +997,9 @@ irc_config_init ()
irc_config_file, ptr_section,
"smart_filter", "boolean",
N_("filter join/part/quit messages for a nick if not speaking for "
"some minutes on channel"),
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_smart_filter, NULL, NULL, NULL);
"some minutes on channel (you must create a filter on tag "
"\"irc_smart_filter\")"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_delay = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_delay", "integer",
@@ -1089,7 +1015,8 @@ irc_config_init ()
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -1161,45 +1088,13 @@ irc_config_init ()
N_("send unknown commands to IRC server"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* log */
ptr_section = weechat_config_new_section (irc_config_file, "log",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
return 0;
}
irc_config_log_auto_log_server = weechat_config_new_option (
irc_config_file, ptr_section,
"auto_log_server", "boolean",
N_("automatically log server messages"),
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_auto_log_channel = weechat_config_new_option (
irc_config_file, ptr_section,
"auto_log_channel", "boolean",
N_("automatically log channel chats"),
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_auto_log_private = weechat_config_new_option (
irc_config_file, ptr_section,
"auto_log_private", "boolean",
N_("automatically log private chats"),
NULL, 0, 0, "off", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
irc_config_log_hide_nickserv_pwd = weechat_config_new_option (
irc_config_file, ptr_section,
"hide_nickserv_pwd", "boolean",
N_("hide password displayed by nickserv"),
NULL, 0, 0, "on", NULL, NULL, NULL, &irc_config_change_log, NULL, NULL, NULL);
/* filters */
ptr_section = weechat_config_new_section (irc_config_file, "ignore",
0, 0,
&irc_config_ignore_read, NULL,
&irc_config_ignore_write, NULL,
&irc_config_ignore_write, NULL,
NULL, NULL);
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -1210,7 +1105,8 @@ irc_config_init ()
ptr_section = weechat_config_new_section (irc_config_file, "server_default",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -1227,7 +1123,8 @@ irc_config_init ()
NULL, NULL,
NULL, NULL,
&irc_config_server_write_default, NULL,
&irc_config_server_create_option, NULL);
&irc_config_server_create_option, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
+1 -5
View File
@@ -69,6 +69,7 @@ extern struct t_config_option *irc_config_look_nick_suffix;
extern struct t_config_option *irc_config_look_nick_completion_smart;
extern struct t_config_option *irc_config_look_display_away;
extern struct t_config_option *irc_config_look_display_channel_modes;
extern struct t_config_option *irc_config_look_hide_nickserv_pwd;
extern struct t_config_option *irc_config_look_highlight_tags;
extern struct t_config_option *irc_config_look_show_away_once;
extern struct t_config_option *irc_config_look_smart_filter;
@@ -87,11 +88,6 @@ extern struct t_config_option *irc_config_network_colors_receive;
extern struct t_config_option *irc_config_network_colors_send;
extern struct t_config_option *irc_config_network_send_unknown_commands;
extern struct t_config_option *irc_config_log_auto_log_server;
extern struct t_config_option *irc_config_log_auto_log_channel;
extern struct t_config_option *irc_config_log_auto_log_private;
extern struct t_config_option *irc_config_log_hide_nickserv_pwd;
extern struct t_config_option *irc_config_server_default[];
extern int irc_config_search_server_option (const char *option_name);
+1 -1
View File
@@ -201,7 +201,7 @@ irc_display_server (struct t_irc_server *server, int with_detail)
string = NULL;
if (string)
{
if (weechat_config_boolean (irc_config_log_hide_nickserv_pwd))
if (weechat_config_boolean (irc_config_look_hide_nickserv_pwd))
irc_display_hide_password (string, 1);
weechat_printf (NULL, " command . . . . . . : %s",
string);
+8 -6
View File
@@ -30,6 +30,7 @@
#include "irc-nick.h"
#include "irc-color.h"
#include "irc-config.h"
#include "irc-protocol.h"
/*
@@ -54,12 +55,13 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
else
ptr_nick = NULL;
weechat_printf (buffer,
"%s%s",
irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL,
(ptr_nick) ? NULL : ptr_server->nick,
IRC_COLOR_CHAT_NICK_SELF),
(text_decoded) ? text_decoded : text);
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg", NULL),
"%s%s",
irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL,
(ptr_nick) ? NULL : ptr_server->nick,
IRC_COLOR_CHAT_NICK_SELF),
(text_decoded) ? text_decoded : text);
}
if (text_decoded)
+139 -111
View File
@@ -99,6 +99,31 @@ irc_protocol_get_address_from_host (const char *host)
return address;
}
/*
* irc_protocol_log_level_for_command: get log level for IRC command
*/
int
irc_protocol_log_level_for_command (const char *command)
{
if (!command || !command[0])
return 0;
if ((strcmp (command, "privmsg") == 0)
|| (strcmp (command, "notice") == 0))
return 1;
if (strcmp (command, "nick") == 0)
return 2;
if ((strcmp (command, "join") == 0)
|| (strcmp (command, "part") == 0)
|| (strcmp (command, "quit") == 0))
return 4;
return 3;
}
/*
* irc_protocol_tags: build tags list with IRC command and/or tags
*/
@@ -106,21 +131,38 @@ irc_protocol_get_address_from_host (const char *host)
char *
irc_protocol_tags (const char *command, const char *tags)
{
static char string[256];
static char string[512];
int log_level;
char str_log_level[32];
if (command && tags)
log_level = 0;
str_log_level[0] = '\0';
if (command && command[0])
{
snprintf (string, sizeof (string), "irc_cmd_%s,%s", command, tags);
log_level = irc_protocol_log_level_for_command (command);
if (log_level > 0)
{
snprintf (str_log_level, sizeof (str_log_level),
",log%d", log_level);
}
}
if (command && command[0] && tags && tags[0])
{
snprintf (string, sizeof (string),
"irc_cmd_%s,%s%s", command, tags, str_log_level);
return string;
}
if (command)
if (command && command[0])
{
snprintf (string, sizeof (string), "irc_cmd_%s", command);
snprintf (string, sizeof (string),
"irc_cmd_%s%s", command, str_log_level);
return string;
}
if (tags)
if (tags && tags[0])
{
snprintf (string, sizeof (string), "%s", tags);
return string;
@@ -243,7 +285,7 @@ irc_protocol_cmd_invite (struct t_irc_server *server, const char *command,
if (!irc_ignore_check (server, NULL, nick, host))
{
weechat_printf_tags (server->buffer,
"irc_invite,notify_highlight",
irc_protocol_tags (command, "otify_highlight"),
_("%sYou have been invited to %s%s%s by "
"%s%s"),
irc_buffer_get_server_prefix (server, "network"),
@@ -305,10 +347,11 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
ptr_nick_speaking = (weechat_config_boolean (irc_config_look_smart_filter)) ?
irc_channel_nick_speaking_time_search (ptr_channel, nick, 1) : NULL;
weechat_printf_tags (ptr_channel->buffer,
(local_join
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
"irc_join" : "irc_join,irc_smart_filter",
irc_protocol_tags (command,
(local_join
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter"),
_("%s%s%s %s(%s%s%s)%s has joined %s%s"),
weechat_prefix ("join"),
IRC_COLOR_CHAT_NICK,
@@ -378,7 +421,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
if (pos_comment)
{
weechat_printf_tags (ptr_channel->buffer,
"irc_kick",
irc_protocol_tags (command, NULL),
_("%s%s%s%s has kicked %s%s%s from %s%s "
"%s(%s%s%s)"),
weechat_prefix ("quit"),
@@ -398,7 +441,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_channel->buffer,
"irc_kick",
irc_protocol_tags (command, NULL),
_("%s%s%s%s has kicked %s%s%s from %s%s"),
weechat_prefix ("quit"),
IRC_COLOR_CHAT_NICK,
@@ -463,7 +506,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
if (pos_comment)
{
weechat_printf_tags (ptr_channel->buffer,
"irc_kill",
irc_protocol_tags (command, NULL),
_("%sYou were killed by %s%s %s(%s%s%s)"),
weechat_prefix ("quit"),
IRC_COLOR_CHAT_NICK,
@@ -476,7 +519,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_channel->buffer,
"irc_kill",
irc_protocol_tags (command, NULL),
_("%sYou were killed by %s%s"),
weechat_prefix ("quit"),
IRC_COLOR_CHAT_NICK,
@@ -536,7 +579,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
{
weechat_printf_tags ((ptr_channel) ?
ptr_channel->buffer : server->buffer,
"irc_mode",
irc_protocol_tags (command, NULL),
_("%sMode %s%s %s[%s%s%s]%s by %s%s"),
(ptr_channel) ? weechat_prefix ("network") : irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -555,7 +598,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
if (!irc_ignore_check (server, NULL, nick, host))
{
weechat_printf_tags (server->buffer,
"irc_mode",
irc_protocol_tags (command, NULL),
_("%sUser mode %s[%s%s%s]%s by %s%s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -627,7 +670,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
if (local_nick)
{
weechat_printf_tags (ptr_channel->buffer,
"irc_nick",
irc_protocol_tags (command, NULL),
_("%sYou are now known as "
"%s%s"),
weechat_prefix ("network"),
@@ -639,7 +682,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
if (!irc_ignore_check (server, ptr_channel, nick, host))
{
weechat_printf_tags (ptr_channel->buffer,
"irc_nick",
irc_protocol_tags (command, NULL),
_("%s%s%s%s is now known as "
"%s%s"),
weechat_prefix ("network"),
@@ -676,10 +719,11 @@ int
irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_target, *pos_args, *pos_end, *pos_usec, tags[128];
char *pos_target, *pos_args, *pos_end, *pos_usec;
struct timeval tv;
long sec1, usec1, sec2, usec2, difftime;
struct t_irc_channel *ptr_channel;
int notify_private;
/* NOTICE message looks like:
NOTICE AUTH :*** Looking up your hostname...
@@ -711,7 +755,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
if (pos_end)
pos_end[0] = '\0';
weechat_printf_tags (server->buffer,
"irc_notice",
irc_protocol_tags (command, NULL),
_("%sCTCP %sVERSION%s reply from %s%s%s: %s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -749,7 +793,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
((sec1 * 1000000) + usec1);
weechat_printf_tags (server->buffer,
"irc_notice,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sCTCP %sPING%s reply from "
"%s%s%s: %ld.%ld %s"),
irc_buffer_get_server_prefix (server,
@@ -776,7 +820,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
/* notice for channel */
ptr_channel = irc_channel_search (server, pos_target);
weechat_printf_tags ((ptr_channel) ? ptr_channel->buffer : server->buffer,
"irc_notice",
irc_protocol_tags (command, NULL),
"%sNotice%s(%s%s%s)%s: %s",
(ptr_channel) ?
weechat_prefix ("network") : irc_buffer_get_server_prefix (server, "network"),
@@ -790,18 +834,13 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
else
{
/* notice for user */
notify_private = 0;
if (nick
&& (weechat_strcasecmp (nick, "nickserv") != 0)
&& (weechat_strcasecmp (nick, "chanserv") != 0)
&& (weechat_strcasecmp (nick, "memoserv") != 0))
{
snprintf (tags, sizeof (tags),
"%s", "irc_notice,notify_private");
}
else
{
snprintf (tags, sizeof (tags),
"%s", "irc_notice");
notify_private = 1;
}
if (nick && weechat_config_boolean (irc_config_look_notice_as_pv))
@@ -827,7 +866,8 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
irc_channel_set_topic (ptr_channel, address);
weechat_printf_tags (ptr_channel->buffer,
tags,
irc_protocol_tags (command,
(notify_private) ? "notify_private" : NULL),
"%s%s",
irc_nick_as_prefix (NULL, nick,
IRC_COLOR_CHAT_NICK_OTHER),
@@ -838,7 +878,8 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
if (address && address[0])
{
weechat_printf_tags (server->buffer,
tags,
irc_protocol_tags (command,
(notify_private) ? "notify_private" : NULL),
"%s%s%s %s(%s%s%s)%s: %s",
irc_buffer_get_server_prefix (server,
"network"),
@@ -856,7 +897,8 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
if (nick && nick[0])
{
weechat_printf_tags (server->buffer,
tags,
irc_protocol_tags (command,
(notify_private) ? "notify_private" : NULL),
"%s%s%s%s: %s",
irc_buffer_get_server_prefix (server,
"network"),
@@ -868,7 +910,8 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
tags,
irc_protocol_tags (command,
(notify_private) ? "notify_private" : NULL),
"%s%s",
irc_buffer_get_server_prefix (server,
"network"),
@@ -923,10 +966,11 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
if (pos_comment)
{
weechat_printf_tags (ptr_channel->buffer,
(local_part
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
"irc_part" : "irc_part,irc_smart_filter",
irc_protocol_tags (command,
(local_part
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter"),
_("%s%s%s %s(%s%s%s)%s has left %s%s "
"%s(%s%s%s)"),
weechat_prefix ("quit"),
@@ -947,10 +991,11 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_channel->buffer,
(local_part
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
"irc_part" : "irc_part,irc_smart_filter",
irc_protocol_tags (command,
(local_part
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter"),
_("%s%s%s %s(%s%s%s)%s has left "
"%s%s"),
weechat_prefix ("quit"),
@@ -1173,7 +1218,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
pos_end_01[0] = '\0';
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_action,notify_message",
irc_protocol_tags (command,
"irc_action,notify_message"),
"%s%s%s %s%s",
weechat_prefix ("action"),
IRC_COLOR_CHAT_NICK,
@@ -1202,7 +1248,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
pos_end_01[0] = '\0';
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sReceived a CTCP %sSOUND%s \"%s\" "
"from %s%s"),
weechat_prefix ("network"),
@@ -1239,7 +1285,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
irc_server_sendf (server, "NOTICE %s :\01PING\01",
nick);
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sCTCP %sPING%s received from %s%s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -1290,7 +1336,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
if (pos_message)
{
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP %s%s%s "
"received from %s%s%s: %s"),
weechat_prefix ("network"),
@@ -1305,7 +1351,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP %s%s%s "
"received from %s%s"),
weechat_prefix ("network"),
@@ -1334,7 +1380,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
if (!irc_ignore_check (server, ptr_channel, nick, host))
{
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,notify_message",
irc_protocol_tags (command,
"notify_message"),
"%s%s",
irc_nick_as_prefix (ptr_nick,
(ptr_nick) ? NULL : nick,
@@ -1395,7 +1442,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
irc_server_sendf (server, "NOTICE %s :\01PING\01",
nick);
weechat_printf_tags (server->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sCTCP %sPING%s received from %s%s"),
irc_buffer_get_server_prefix (server,
"network"),
@@ -1906,7 +1953,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
pos_end_01[0] = '\0';
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,irc_action,notify_private",
irc_protocol_tags (command,
"irc_action,notify_private"),
"%s%s%s %s%s",
weechat_prefix ("action"),
IRC_COLOR_CHAT_NICK,
@@ -1950,7 +1998,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
if (pos_message)
{
weechat_printf_tags (server->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP %s%s%s "
"received from %s%s%s: %s"),
irc_buffer_get_server_prefix (server,
@@ -1966,7 +2014,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
"irc_privmsg,irc_ctcp",
irc_protocol_tags (command, "irc_ctcp"),
_("%sUnknown CTCP %s%s%s "
"received from %s%s"),
irc_buffer_get_server_prefix (server,
@@ -2011,7 +2059,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
irc_channel_set_topic (ptr_channel, address);
weechat_printf_tags (ptr_channel->buffer,
"irc_privmsg,notify_private",
irc_protocol_tags (command, "notify_private"),
"%s%s",
irc_nick_as_prefix (NULL,
nick,
@@ -2076,10 +2124,11 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
if (pos_comment && pos_comment[0])
{
weechat_printf_tags (ptr_channel->buffer,
(local_quit
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
"irc_quit" : "irc_quit,irc_smart_filter",
irc_protocol_tags (command,
(local_quit
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter"),
_("%s%s%s %s(%s%s%s)%s has quit "
"%s(%s%s%s)"),
weechat_prefix ("quit"),
@@ -2098,10 +2147,11 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_channel->buffer,
(local_quit
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
"irc_quit" : "irc_quit,irc_smart_filter",
irc_protocol_tags (command,
(local_quit
|| !weechat_config_boolean (irc_config_look_smart_filter)
|| ptr_nick_speaking) ?
NULL : "irc_smart_filter"),
_("%s%s%s %s(%s%s%s)%s has quit"),
weechat_prefix ("quit"),
IRC_COLOR_CHAT_NICK,
@@ -2229,7 +2279,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
topic_color = irc_color_decode (pos_topic,
weechat_config_boolean (irc_config_network_colors_receive));
weechat_printf_tags (ptr_buffer,
"irc_topic",
irc_protocol_tags (command, NULL),
_("%s%s%s%s has changed topic for %s%s%s to: "
"\"%s%s\""),
(ptr_buffer == server->buffer) ?
@@ -2248,7 +2298,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_buffer,
"irc_topic",
irc_protocol_tags (command, NULL),
_("%s%s%s%s has unset topic for %s%s"),
(ptr_buffer == server->buffer) ?
irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"),
@@ -2284,7 +2334,7 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command,
if (!irc_ignore_check (server, NULL, nick, host))
{
weechat_printf_tags (server->buffer,
"irc_wallops",
irc_protocol_tags (command, NULL),
_("%sWallops from %s%s %s(%s%s%s)%s: %s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_NICK,
@@ -2553,15 +2603,7 @@ irc_protocol_cmd_305 (struct t_irc_server *server, const char *command,
server->is_away = 0;
server->away_time = 0;
/*
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if ((ptr_window->buffer->protocol == irc_protocol)
&& (IRC_BUFFER_SERVER(ptr_window->buffer) == server))
gui_status_draw (ptr_window->buffer, 1);
}
*/
weechat_bar_item_update ("buffer_name");
return WEECHAT_RC_OK;
}
@@ -2595,21 +2637,7 @@ irc_protocol_cmd_306 (struct t_irc_server *server, const char *command,
server->is_away = 1;
server->away_time = time (NULL);
/*
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if (ptr_window->buffer->protocol == irc_protocol)
{
if (IRC_BUFFER_SERVER(ptr_window->buffer) == server)
{
gui_status_draw (ptr_window->buffer, 1);
ptr_window->buffer->last_read_line =
ptr_window->buffer->last_line;
}
}
}
*/
weechat_bar_item_update ("buffer_name");
return WEECHAT_RC_OK;
}
@@ -2689,7 +2717,7 @@ irc_protocol_cmd_312 (struct t_irc_server *server, const char *command,
IRC_PROTOCOL_MIN_ARGS(6);
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s] %s%s %s(%s%s%s)",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -2721,7 +2749,7 @@ irc_protocol_cmd_314 (struct t_irc_server *server, const char *command,
IRC_PROTOCOL_MIN_ARGS(8);
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s%s %s(%s%s@%s%s)%s was %s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_NICK,
@@ -2761,7 +2789,7 @@ irc_protocol_cmd_315 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s]%s %s",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -2806,7 +2834,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, const char *command,
if (day > 0)
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s[%s%s%s]%s idle: %s%d %s%s, "
"%s%02d %s%s %s%02d %s%s %s%02d "
"%s%s, signon at: %s%s"),
@@ -2838,7 +2866,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s[%s%s%s]%s idle: %s%02d %s%s "
"%s%02d %s%s %s%02d %s%s, "
"signon at: %s%s"),
@@ -2887,7 +2915,7 @@ irc_protocol_cmd_321 (struct t_irc_server *server, const char *command,
((argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]) : NULL;
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s%s%s",
irc_buffer_get_server_prefix (server, "network"),
argv[3],
@@ -2920,7 +2948,7 @@ irc_protocol_cmd_322 (struct t_irc_server *server, const char *command,
(regexec (server->cmd_list_regexp, argv[3], 0, NULL, 0) == 0))
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s%s%s(%s%s%s)%s%s%s",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -2960,7 +2988,7 @@ irc_protocol_cmd_323 (struct t_irc_server *server, const char *command,
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s",
irc_buffer_get_server_prefix (server, "network"),
(pos_args && pos_args[0]) ? pos_args : "");
@@ -3030,7 +3058,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, const char *command,
if (pos_realname && pos_realname[0])
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s] %s%s %s %s(%s%s%s)",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -3048,7 +3076,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s] %s%s %s",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -3083,7 +3111,7 @@ irc_protocol_cmd_328 (struct t_irc_server *server, const char *command,
if (ptr_channel)
{
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sURL for %s%s%s: %s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -3123,7 +3151,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, const char *command,
if (ptr_channel->display_creation_date)
{
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sChannel created on %s"),
weechat_prefix ("network"),
ctime (&datetime));
@@ -3133,7 +3161,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sChannel %s%s%s created on %s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -3168,7 +3196,7 @@ irc_protocol_cmd_331 (struct t_irc_server *server, const char *command,
ptr_channel = irc_channel_search (server, argv[3]);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
weechat_printf_tags (ptr_buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sNo topic set for channel %s%s"),
(ptr_buffer == server->buffer) ?
irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"),
@@ -3209,7 +3237,7 @@ irc_protocol_cmd_332 (struct t_irc_server *server, const char *command,
ptr_buffer = server->buffer;
weechat_printf_tags (ptr_buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sTopic for %s%s%s is: \"%s%s\""),
(ptr_buffer == server->buffer) ?
irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"),
@@ -3245,7 +3273,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command,
if (ptr_channel && ptr_channel->nicks)
{
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sTopic set by %s%s%s on %s"),
weechat_prefix ("network"),
IRC_COLOR_CHAT_NICK,
@@ -3256,7 +3284,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sTopic for %s%s%s set by %s%s%s on %s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -3286,7 +3314,7 @@ irc_protocol_cmd_338 (struct t_irc_server *server, const char *command,
IRC_PROTOCOL_MIN_ARGS(6);
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s[%s%s%s]%s %s %s%s",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_DELIMITERS,
@@ -3319,7 +3347,7 @@ irc_protocol_cmd_341 (struct t_irc_server *server, const char *command,
(void) argv_eol;
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s%s%s has invited %s%s%s on %s%s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_NICK,
@@ -3349,7 +3377,7 @@ irc_protocol_cmd_344 (struct t_irc_server *server, const char *command,
IRC_PROTOCOL_MIN_ARGS(5);
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%sChannel reop %s%s%s: %s%s"),
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -3376,7 +3404,7 @@ irc_protocol_cmd_345 (struct t_irc_server *server, const char *command,
IRC_PROTOCOL_MIN_ARGS(5);
weechat_printf_tags (server->buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
"%s%s%s%s: %s",
irc_buffer_get_server_prefix (server, "network"),
IRC_COLOR_CHAT_CHANNEL,
@@ -3416,7 +3444,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, const char *command,
{
datetime = (time_t)(atol (argv[6]));
weechat_printf_tags (ptr_buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s[%s%s%s]%s exception %s%s%s "
"by %s%s %s(%s%s%s)%s on %s"),
(ptr_buffer == server->buffer) ?
@@ -3441,7 +3469,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, const char *command,
else
{
weechat_printf_tags (ptr_buffer,
irc_protocol_tags(command, "irc_numeric"),
irc_protocol_tags (command, "irc_numeric"),
_("%s%s[%s%s%s]%s exception %s%s"),
(ptr_buffer == server->buffer) ?
irc_buffer_get_server_prefix (server, "network") : weechat_prefix ("network"),
+1
View File
@@ -70,6 +70,7 @@ struct t_irc_protocol_msg
};
extern char *irc_protocol_get_nick_from_host (const char *host);
extern char *irc_protocol_tags (const char *command, const char *tags);
extern void irc_protocol_recv_command (struct t_irc_server *server,
const char *entire_line,
const char *host, const char *command,
+4 -3
View File
@@ -2111,6 +2111,10 @@ irc_server_create_buffer (struct t_irc_server *server, int all_servers)
if (!server->buffer)
return NULL;
weechat_buffer_set (server->buffer, "short_name", server->name);
weechat_buffer_set (server->buffer, "localvar_set_server", server->name);
weechat_buffer_set (server->buffer, "localvar_set_channel", server->name);
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, server->buffer);
@@ -2192,9 +2196,6 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
irc_buffer_servers = server->buffer;
}
weechat_buffer_set (server->buffer, "short_name", server->name);
weechat_buffer_set (server->buffer, "localvar_set_server", server->name);
weechat_buffer_set (server->buffer, "display", "1");
weechat_bar_item_update ("buffer_name");
+50 -5
View File
@@ -66,20 +66,29 @@ logger_buffer_valid (struct t_logger_buffer *logger_buffer)
*/
struct t_logger_buffer *
logger_buffer_add (struct t_gui_buffer *buffer, const char *log_filename)
logger_buffer_add (struct t_gui_buffer *buffer, int log_level)
{
struct t_logger_buffer *new_logger_buffer;
if (!buffer || !log_filename)
if (!buffer)
return NULL;
if (logger_debug)
{
weechat_printf (NULL,
"%s: start logging for buffer \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"));
}
new_logger_buffer = malloc (sizeof (*new_logger_buffer));
if (new_logger_buffer)
{
new_logger_buffer->buffer = buffer;
new_logger_buffer->log_filename = strdup (log_filename);
new_logger_buffer->log_filename = NULL;
new_logger_buffer->log_file = NULL;
new_logger_buffer->log_enabled = 1;
new_logger_buffer->log_level = log_level;
new_logger_buffer->prev_buffer = last_logger_buffer;
new_logger_buffer->next_buffer = NULL;
@@ -94,11 +103,11 @@ logger_buffer_add (struct t_gui_buffer *buffer, const char *log_filename)
}
/*
* logger_buffer_search: search a logger buffer by buffer pointer
* logger_buffer_search_buffer: search a logger buffer by buffer pointer
*/
struct t_logger_buffer *
logger_buffer_search (struct t_gui_buffer *buffer)
logger_buffer_search_buffer (struct t_gui_buffer *buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
@@ -113,6 +122,32 @@ logger_buffer_search (struct t_gui_buffer *buffer)
return NULL;
}
/*
* logger_buffer_search_log_filename: search a logger buffer by log filename
*/
struct t_logger_buffer *
logger_buffer_search_log_filename (const char *log_filename)
{
struct t_logger_buffer *ptr_logger_buffer;
if (!log_filename)
return NULL;
for (ptr_logger_buffer = logger_buffers; ptr_logger_buffer;
ptr_logger_buffer = ptr_logger_buffer->next_buffer)
{
if (ptr_logger_buffer->log_filename)
{
if (strcmp (ptr_logger_buffer->log_filename, log_filename) == 0)
return ptr_logger_buffer;
}
}
/* logger buffer not found */
return NULL;
}
/*
* logger_buffer_free: remove a logger buffer from list
*/
@@ -122,6 +157,14 @@ logger_buffer_free (struct t_logger_buffer *logger_buffer)
{
struct t_logger_buffer *new_logger_buffers;
if (logger_debug)
{
weechat_printf (NULL,
"%s: stop logging for buffer \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (logger_buffer->buffer, "name"));
}
/* remove logger buffer */
if (last_logger_buffer == logger_buffer)
last_logger_buffer = logger_buffer->prev_buffer;
@@ -182,6 +225,8 @@ logger_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "log_enabled", logger_buffer->log_enabled))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "log_level", logger_buffer->log_level))
return 0;
return 1;
}
+4 -2
View File
@@ -28,6 +28,7 @@ struct t_logger_buffer
char *log_filename; /* log filename */
FILE *log_file; /* log file */
int log_enabled; /* log enabled ? */
int log_level; /* log level (0..9) */
struct t_logger_buffer *prev_buffer; /* link to previous buffer */
struct t_logger_buffer *next_buffer; /* link to next buffer */
};
@@ -37,8 +38,9 @@ extern struct t_logger_buffer *last_logger_buffer;
extern int logger_buffer_valid (struct t_logger_buffer *logger_buffer);
extern struct t_logger_buffer *logger_buffer_add (struct t_gui_buffer *,
const char *log_filename);
extern struct t_logger_buffer *logger_buffer_search (struct t_gui_buffer *buffer);
int log_level);
extern struct t_logger_buffer *logger_buffer_search_buffer (struct t_gui_buffer *buffer);
extern struct t_logger_buffer *logger_buffer_search_log_filename (const char *log_filename);
extern void logger_buffer_free (struct t_logger_buffer *logger_buffer);
extern void logger_buffer_free_all ();
extern int logger_buffer_add_to_infolist (struct t_infolist *infolist,
+318 -5
View File
@@ -28,6 +28,10 @@
struct t_config_file *logger_config_file = NULL;
struct t_config_section *logger_config_section_level = NULL;
struct t_config_section *logger_config_section_mask = NULL;
int logger_config_loading = 0;
/* logger config, look section */
@@ -38,10 +42,271 @@ struct t_config_option *logger_config_look_backlog;
struct t_config_option *logger_config_file_auto_log;
struct t_config_option *logger_config_file_name_lower_case;
struct t_config_option *logger_config_file_path;
struct t_config_option *logger_config_file_mask;
struct t_config_option *logger_config_file_info_lines;
struct t_config_option *logger_config_file_time_format;
/*
* logger_config_change_file_option_restart_log: called when a file option is
* changed and that logging must
* be restarted for all buffers
*/
void
logger_config_change_file_option_restart_log (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
if (!logger_config_loading)
{
logger_stop_all ();
logger_start_buffer_all ();
}
}
/*
* logger_config_level_change: called when a level option is changed
*/
void
logger_config_level_change (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
if (!logger_config_loading)
logger_start_buffer_all ();
}
/*
* logger_config_level_delete_option: delete option in "level" section
*/
int
logger_config_level_delete_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
weechat_config_option_free (option);
logger_start_buffer_all ();
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
/*
* logger_config_level_create_option: create option in "level" section
*/
int
logger_config_level_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
int rc;
/* make C compiler happy */
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
option_name);
if (ptr_option)
{
if (value && value[0])
rc = weechat_config_option_set (ptr_option, value, 1);
else
{
weechat_config_option_free (ptr_option);
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
else
{
if (value && value[0])
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "integer",
_("logging level for this buffer (0 = logging disabled, "
"1 = a few messages (most important) .. 9 = all messages)"),
NULL, 0, 9, "9", value, NULL, NULL,
&logger_config_level_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
if (!logger_config_loading)
logger_start_buffer_all ();
return rc;
}
/*
* logger_config_get_level: get a level option
*/
struct t_config_option *
logger_config_get_level (const char *name)
{
return weechat_config_search_option (logger_config_file,
logger_config_section_level,
name);
}
/*
* logger_config_set_level: set a level option
*/
int
logger_config_set_level (const char *name, const char *value)
{
return logger_config_level_create_option (NULL,
logger_config_file,
logger_config_section_level,
name,
value);
}
/*
* logger_config_mask_change: called when a mask option is changed
*/
void
logger_config_mask_change (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
if (!logger_config_loading)
{
logger_stop_all ();
logger_start_buffer_all ();
}
}
/*
* logger_config_mask_delete_option: delete option in "mask" section
*/
int
logger_config_mask_delete_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) config_file;
(void) section;
weechat_config_option_free (option);
logger_stop_all ();
logger_start_buffer_all ();
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
}
/*
* logger_config_mask_create_option: create option in "mask" section
*/
int
logger_config_mask_create_option (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
int rc;
/* make C compiler happy */
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
if (option_name)
{
ptr_option = weechat_config_search_option (config_file, section,
option_name);
if (ptr_option)
{
if (value && value[0])
rc = weechat_config_option_set (ptr_option, value, 1);
else
{
weechat_config_option_free (ptr_option);
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
else
{
if (value && value[0])
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string",
_("file mask for log file; local buffer variables are "
"permitted"),
NULL, 0, 0, "", value, NULL, NULL,
&logger_config_mask_change, NULL,
NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
}
if (!logger_config_loading)
{
logger_stop_all ();
logger_start_buffer_all ();
}
return rc;
}
/*
* logger_config_get_mask: get a mask option
*/
struct t_config_option *
logger_config_get_mask (const char *name)
{
return weechat_config_search_option (logger_config_file,
logger_config_section_mask,
name);
}
/*
* logger_config_init: init logger configuration file
* return: 1 if ok, 0 if error
@@ -61,7 +326,8 @@ logger_config_init ()
ptr_section = weechat_config_new_section (logger_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -79,7 +345,8 @@ logger_config_init ()
ptr_section = weechat_config_new_section (logger_config_file, "file",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -96,13 +363,23 @@ logger_config_init ()
logger_config_file, ptr_section,
"name_lower_case", "boolean",
N_("use only lower case for log filenames"),
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
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)"),
NULL, 0, 0, "%h/logs/", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, 0, 0, "%h/logs/", NULL, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_mask = weechat_config_new_option (
logger_config_file, ptr_section,
"mask", "string",
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"),
NULL, 0, 0, "$plugin.$name.weechatlog", NULL, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_info_lines = weechat_config_new_option (
logger_config_file, ptr_section,
"info_lines", "boolean",
@@ -116,6 +393,36 @@ logger_config_init ()
"specifiers)"),
NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* level */
ptr_section = weechat_config_new_section (logger_config_file, "level",
1, 1,
NULL, NULL, NULL, NULL,
NULL, NULL,
&logger_config_level_create_option, NULL,
&logger_config_level_delete_option, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
return 0;
}
logger_config_section_level = ptr_section;
/* mask */
ptr_section = weechat_config_new_section (logger_config_file, "mask",
1, 1,
NULL, NULL, NULL, NULL,
NULL, NULL,
&logger_config_mask_create_option, NULL,
&logger_config_mask_delete_option, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
return 0;
}
logger_config_section_mask = ptr_section;
return 1;
}
@@ -126,7 +433,13 @@ logger_config_init ()
int
logger_config_read ()
{
return weechat_config_read (logger_config_file);
int rc;
logger_config_loading = 1;
rc = weechat_config_read (logger_config_file);
logger_config_loading = 0;
return rc;
}
/*
+4
View File
@@ -28,9 +28,13 @@ extern struct t_config_option *logger_config_look_backlog;
extern struct t_config_option *logger_config_file_auto_log;
extern struct t_config_option *logger_config_file_name_lower_case;
extern struct t_config_option *logger_config_file_path;
extern struct t_config_option *logger_config_file_mask;
extern struct t_config_option *logger_config_file_info_lines;
extern struct t_config_option *logger_config_file_time_format;
extern struct t_config_option *logger_config_get_level (const char *name);
extern int logger_config_set_level (const char *name, const char *value);
extern struct t_config_option *logger_config_get_mask (const char *name);
extern int logger_config_init ();
extern int logger_config_read ();
extern int logger_config_write ();
+14 -7
View File
@@ -30,6 +30,7 @@
#include <fcntl.h>
#include <string.h>
#include "../weechat-plugin.h"
#include "logger.h"
#include "logger-tail.h"
@@ -108,7 +109,7 @@ logger_tail_file (const char *filename, int n_lines)
while (ptr_buf && (ptr_buf >= buf))
{
pos_eol = logger_tail_last_eol (buf, ptr_buf);
if ((pos_eol && pos_eol[1]) || (!pos_eol && (file_pos == 0)))
if ((pos_eol && (pos_eol[1] || part_of_line)) || (file_pos == 0))
{
/* use data and part_of_line (if existing) to build a new line */
if (!pos_eol)
@@ -209,14 +210,20 @@ logger_tail_file (const char *filename, int n_lines)
void
logger_tail_free (struct t_logger_line *lines)
{
struct t_logger_line *ptr_line, *next_line;
if (!lines)
return;
while (lines->next_line)
ptr_line = lines;
while (ptr_line)
{
if (lines->data)
free (lines->data);
lines = lines->next_line;
next_line = ptr_line->next_line;
if (ptr_line->data)
free (ptr_line->data);
free (ptr_line);
ptr_line = next_line;
}
free (lines);
}
+591 -183
View File
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -51,9 +52,44 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_logger_plugin = NULL;
int logger_debug = 0;
char *logger_buf_write = NULL; /* buffer for writing a line */
/*
* logger_debug_cb: callback for "debug" signal
*/
int
logger_debug_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;
(void) signal;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
if (weechat_strcasecmp ((char *)signal_data, LOGGER_PLUGIN_NAME) == 0)
{
logger_debug ^= 1;
if (logger_debug)
{
weechat_printf (NULL, _("%s: debug enabled"),
LOGGER_PLUGIN_NAME);
}
else
{
weechat_printf (NULL, _("%s: debug disabled"),
LOGGER_PLUGIN_NAME);
}
}
}
return WEECHAT_RC_OK;
}
/*
* logger_create_directory: create logger directory
* return 1 if success (directory created or already
@@ -78,13 +114,9 @@ logger_create_directory ()
dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
if (dir2)
{
if (mkdir (dir2, 0755) < 0)
{
if (errno != EEXIST)
rc = 0;
}
else
chmod (dir2, 0700);
if (!weechat_mkdir_parents (dir2, 0700))
rc = 0;
free (dir2);
}
else
@@ -100,6 +132,139 @@ logger_create_directory ()
return rc;
}
/*
* logger_build_option_name: build option name with a buffer
*/
char *
logger_build_option_name (struct t_gui_buffer *buffer)
{
char *plugin_name, *name, *option_name;
int length;
if (!buffer)
return NULL;
plugin_name = weechat_buffer_get_string (buffer, "plugin");
name = weechat_buffer_get_string (buffer, "name");
length = strlen (plugin_name) + 1 + strlen (name) + 1;
option_name = malloc (length);
if (!option_name)
return NULL;
snprintf (option_name, length, "%s.%s", plugin_name, name);
return option_name;
}
/*
* logger_get_level_for_buffer: get logging level for buffer (0 = disabled, 1..9)
*/
int
logger_get_level_for_buffer (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
name = logger_build_option_name (buffer);
if (!name)
return LOGGER_LEVEL_DEFAULT;
option_name = strdup (name);
if (option_name)
{
ptr_end = option_name + strlen (option_name);
while (ptr_end >= option_name)
{
ptr_option = logger_config_get_level (option_name);
if (ptr_option)
{
free (option_name);
free (name);
return weechat_config_integer (ptr_option);
}
ptr_end--;
while ((ptr_end >= option_name) && (ptr_end[0] != '.'))
{
ptr_end--;
}
if ((ptr_end >= option_name) && (ptr_end[0] == '.'))
ptr_end[0] = '\0';
}
ptr_option = logger_config_get_level (option_name);
free (option_name);
free (name);
if (ptr_option)
return weechat_config_integer (ptr_option);
}
else
free (name);
/* nothing found => return default level */
return LOGGER_LEVEL_DEFAULT;
}
/*
* logger_get_mask_for_buffer: get filename mask for a buffer
* we first try with all arguments, then remove one by
* one to find mask (from specific to general mask)
*/
char *
logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
name = logger_build_option_name (buffer);
if (!name)
return NULL;
option_name = strdup (name);
if (option_name)
{
ptr_end = option_name + strlen (option_name);
while (ptr_end >= option_name)
{
ptr_option = logger_config_get_mask (option_name);
if (ptr_option)
{
free (option_name);
free (name);
return weechat_config_string (ptr_option);
}
ptr_end--;
while ((ptr_end >= option_name) && (ptr_end[0] != '.'))
{
ptr_end--;
}
if ((ptr_end >= option_name) && (ptr_end[0] == '.'))
ptr_end[0] = '\0';
}
ptr_option = logger_config_get_mask (option_name);
free (option_name);
free (name);
if (ptr_option)
return weechat_config_string (ptr_option);
}
else
free (name);
/* nothing found => return default mask (if set) */
if (weechat_config_string (logger_config_file_mask)
&& weechat_config_string (logger_config_file_mask)[0])
return weechat_config_string (logger_config_file_mask);
/* no default mask set */
return NULL;
}
/*
* logger_get_filename: build log filename for a buffer
*/
@@ -107,14 +272,40 @@ logger_create_directory ()
char *
logger_get_filename (struct t_gui_buffer *buffer)
{
struct t_infolist *ptr_infolist;
char *res;
char *dir_separator, *weechat_dir, *log_path, *log_path2;
char *plugin_name, *plugin_name2, *name, *name2;
char *res, *mask, *mask_decoded, *dir_separator, *weechat_dir;
char *log_path, *log_path2, *pos_last_sep;
int length;
res = 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_decoded = weechat_buffer_string_replace_local_var (buffer, mask);
if (!mask_decoded)
return NULL;
if (logger_debug)
{
weechat_printf (NULL,
"%s: buffer = \"%s\", mask = \"%s\", "
"decoded mask = \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"),
mask, mask_decoded);
}
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (mask_decoded);
dir_separator = weechat_info_get ("dir_separator", "");
weechat_dir = weechat_info_get ("weechat_dir", "");
log_path = weechat_string_replace (weechat_config_string (logger_config_file_path),
@@ -123,49 +314,17 @@ logger_get_filename (struct t_gui_buffer *buffer)
if (dir_separator && weechat_dir && log_path && log_path2)
{
ptr_infolist = weechat_infolist_get ("buffer", buffer, NULL);
if (ptr_infolist)
length = strlen (log_path2) + strlen (mask_decoded) + 1;
res = malloc (length);
if (res)
{
plugin_name2 = NULL;
name2 = NULL;
if (weechat_infolist_next (ptr_infolist))
{
plugin_name = weechat_infolist_string (ptr_infolist, "plugin_name");
plugin_name2 = (plugin_name) ?
weechat_string_replace (plugin_name, dir_separator, "_") : NULL;
name = weechat_infolist_string (ptr_infolist, "name");
name2 = (name) ?
weechat_string_replace (name, dir_separator, "_") : NULL;
}
length = strlen (log_path2);
if (plugin_name2)
length += strlen (plugin_name2) + 1;
if (name2)
length += strlen (name2) + 1;
length += 16;
res = malloc (length);
if (res)
{
strcpy (res, log_path2);
if (plugin_name2)
{
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (plugin_name2);
strcat (res, plugin_name2);
strcat (res, ".");
}
if (name2)
{
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (name2);
strcat (res, name2);
strcat (res, ".");
}
strcat (res, "weechatlog");
}
if (name2)
free (name2);
weechat_infolist_free (ptr_infolist);
snprintf (res, length, "%s%s", log_path2, mask_decoded);
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];
}
}
@@ -177,6 +336,44 @@ logger_get_filename (struct t_gui_buffer *buffer)
return res;
}
/*
* logger_set_log_filename: set log filename for a logger buffer
*/
void
logger_set_log_filename (struct t_logger_buffer *logger_buffer)
{
char *log_filename;
struct t_logger_buffer *ptr_logger_buffer;
log_filename = logger_get_filename (logger_buffer->buffer);
if (!log_filename)
{
weechat_printf (NULL,
_("%s%s: not enough memory"),
weechat_prefix ("error"),
LOGGER_PLUGIN_NAME);
return;
}
ptr_logger_buffer = logger_buffer_search_log_filename (log_filename);
if (ptr_logger_buffer)
{
weechat_printf (NULL,
_("%s%s: unable to start logging for buffer "
"\"%s\": filename \"%s\" is already user by "
"another buffer (check your log settings)"),
weechat_prefix ("error"),
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (logger_buffer->buffer, "name"),
log_filename);
free (log_filename);
return;
}
logger_buffer->log_filename = log_filename;
}
/*
* logger_write_line: write a line to log file
*/
@@ -190,132 +387,80 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
time_t seconds;
struct tm *date_tmp;
char buf_time[256];
if (!logger_buf_write)
logger_buf_write = malloc (LOGGER_BUF_WRITE_SIZE);
if (!logger_buf_write)
return;
if (logger_buffer->log_filename)
charset = weechat_info_get ("charset_terminal", "");
if (!logger_buffer->log_file)
{
charset = weechat_info_get ("charset_terminal", "");
if (!logger_create_directory ())
{
weechat_printf (NULL,
_("%s%s: unable to create directory for logs "
"(\"%s\")"),
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
weechat_config_string (logger_config_file_path));
logger_buffer_free (logger_buffer);
return;
}
if (!logger_buffer->log_filename)
logger_set_log_filename (logger_buffer);
if (!logger_buffer->log_filename)
{
logger_buffer_free (logger_buffer);
return;
}
logger_buffer->log_file =
fopen (logger_buffer->log_filename, "a");
if (!logger_buffer->log_file)
{
if (!logger_create_directory ())
{
weechat_printf (NULL,
_("%s%s: unable to create directory for logs "
"(\"%s\")"),
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
weechat_config_string (logger_config_file_path));
free (logger_buffer->log_filename);
logger_buffer->log_filename = NULL;
return;
}
logger_buffer->log_file =
fopen (logger_buffer->log_filename, "a");
if (!logger_buffer->log_file)
{
weechat_printf (NULL,
_("%s%s: unable to write log file \"%s\""),
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
logger_buffer->log_filename);
free (logger_buffer->log_filename);
logger_buffer->log_filename = NULL;
return;
}
if (weechat_config_boolean (logger_config_file_info_lines))
{
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);
message = (charset) ?
weechat_iconv_from_internal (charset, logger_buf_write) : NULL;
fprintf (logger_buffer->log_file,
"%s\n", (message) ? message : logger_buf_write);
if (message)
free (message);
}
}
va_start (argptr, format);
vsnprintf (logger_buf_write, LOGGER_BUF_WRITE_SIZE, format, argptr);
va_end (argptr);
message = (charset) ?
weechat_iconv_from_internal (charset, logger_buf_write) : NULL;
fprintf (logger_buffer->log_file,
"%s\n", (message) ? message : logger_buf_write);
fflush (logger_buffer->log_file);
if (message)
free (message);
}
}
/*
* logger_start_buffer: start a log for a buffer
*/
void
logger_start_buffer (struct t_gui_buffer *buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
char *log_filename;
if (!buffer || !weechat_config_boolean (logger_config_file_auto_log))
return;
ptr_logger_buffer = logger_buffer_search (buffer);
if (!ptr_logger_buffer)
{
log_filename = logger_get_filename (buffer);
if (!log_filename)
weechat_printf (NULL,
_("%s%s: unable to write log file \"%s\""),
weechat_prefix ("error"), LOGGER_PLUGIN_NAME,
logger_buffer->log_filename);
logger_buffer_free (logger_buffer);
return;
ptr_logger_buffer = logger_buffer_add (buffer, log_filename);
free (log_filename);
}
if (ptr_logger_buffer)
{
if (ptr_logger_buffer->log_filename)
}
if (weechat_config_boolean (logger_config_file_info_lines))
{
if (ptr_logger_buffer->log_file)
{
fclose (ptr_logger_buffer->log_file);
ptr_logger_buffer->log_file = NULL;
}
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);
message = (charset) ?
weechat_iconv_from_internal (charset, logger_buf_write) : NULL;
fprintf (logger_buffer->log_file,
"%s\n", (message) ? message : logger_buf_write);
if (message)
free (message);
}
}
}
/*
* logger_start_buffer_all: start log buffer for all buffers
*/
void
logger_start_buffer_all ()
{
struct t_infolist *ptr_infolist;
ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (ptr_infolist)
{
while (weechat_infolist_next (ptr_infolist))
{
logger_start_buffer (weechat_infolist_pointer (ptr_infolist,
"pointer"));
}
weechat_infolist_free (ptr_infolist);
}
va_start (argptr, format);
vsnprintf (logger_buf_write, LOGGER_BUF_WRITE_SIZE, format, argptr);
va_end (argptr);
message = (charset) ?
weechat_iconv_from_internal (charset, logger_buf_write) : NULL;
fprintf (logger_buffer->log_file,
"%s\n", (message) ? message : logger_buf_write);
fflush (logger_buffer->log_file);
if (message)
free (message);
}
/*
@@ -332,7 +477,7 @@ logger_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
if (!logger_buffer)
return;
if (logger_buffer->log_file)
if (logger_buffer->log_enabled && logger_buffer->log_file)
{
if (write_info_line && weechat_config_boolean (logger_config_file_info_lines))
{
@@ -369,6 +514,199 @@ logger_stop_all ()
}
}
/*
* logger_start_buffer: start a log for a buffer
*/
void
logger_start_buffer (struct t_gui_buffer *buffer)
{
struct t_logger_buffer *ptr_logger_buffer;
int log_level, log_enabled;
if (!buffer)
return;
log_level = logger_get_level_for_buffer (buffer);
log_enabled = weechat_config_boolean (logger_config_file_auto_log)
&& (log_level > 0);
ptr_logger_buffer = logger_buffer_search_buffer (buffer);
/* logging is disabled for buffer */
if (!log_enabled)
{
/* stop logger if it is active */
if (ptr_logger_buffer)
logger_stop (ptr_logger_buffer, 1);
}
else
{
/* logging is enabled for buffer */
if (ptr_logger_buffer)
ptr_logger_buffer->log_level = log_level;
else
{
ptr_logger_buffer = logger_buffer_add (buffer, log_level);
if (ptr_logger_buffer)
{
if (ptr_logger_buffer->log_filename)
{
if (ptr_logger_buffer->log_file)
{
fclose (ptr_logger_buffer->log_file);
ptr_logger_buffer->log_file = NULL;
}
}
}
}
}
}
/*
* logger_start_buffer_all: start log buffer for all buffers
*/
void
logger_start_buffer_all ()
{
struct t_infolist *ptr_infolist;
ptr_infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (ptr_infolist)
{
while (weechat_infolist_next (ptr_infolist))
{
logger_start_buffer (weechat_infolist_pointer (ptr_infolist,
"pointer"));
}
weechat_infolist_free (ptr_infolist);
}
}
/*
* logger_list: show logging status for buffers
*/
void
logger_list ()
{
struct t_infolist *ptr_infolist;
struct t_logger_buffer *ptr_logger_buffer;
struct t_gui_buffer *ptr_buffer;
char status[128];
weechat_printf (NULL, "");
weechat_printf (NULL, _("Logging on buffers:"));
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");
if (ptr_buffer)
{
ptr_logger_buffer = logger_buffer_search_buffer (ptr_buffer);
if (ptr_logger_buffer)
{
snprintf (status, sizeof (status),
_("logging (level: %d)"),
ptr_logger_buffer->log_level);
}
else
{
snprintf (status, sizeof (status), _("not logging"));
}
weechat_printf (NULL,
" %s[%s%d%s]%s (%s) %s%s%s: %s%s%s%s",
weechat_color("chat_delimiters"),
weechat_color("chat"),
weechat_infolist_integer (ptr_infolist, "number"),
weechat_color("chat_delimiters"),
weechat_color("chat"),
weechat_infolist_string (ptr_infolist, "plugin_name"),
weechat_color("chat_buffer"),
weechat_infolist_string (ptr_infolist, "name"),
weechat_color("chat"),
status,
(ptr_logger_buffer) ? " (" : "",
(ptr_logger_buffer) ?
((ptr_logger_buffer->log_filename) ?
ptr_logger_buffer->log_filename : _("log not started")) : "",
(ptr_logger_buffer) ? ")" : "");
}
}
weechat_infolist_free (ptr_infolist);
}
}
/*
* logger_set_buffer: enable/disable log on a buffer
*/
void
logger_set_buffer (struct t_gui_buffer *buffer, const char *value)
{
char *name;
struct t_config_option *ptr_option;
name = logger_build_option_name (buffer);
if (!name)
return;
if (logger_config_set_level (name, value) != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
ptr_option = logger_config_get_level (name);
if (ptr_option)
{
weechat_printf (NULL, _("%s: \"%s\" => level %d"),
LOGGER_PLUGIN_NAME, name,
weechat_config_integer (ptr_option));
}
}
free (name);
}
/*
* logger_command_cb: callback for /logger command
*/
int
logger_command_cb (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
/* make C compiler happy */
(void) data;
(void) argv_eol;
if ((argc == 1)
|| ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0)))
{
logger_list ();
return WEECHAT_RC_OK;
}
if (argc > 1)
{
if (weechat_strcasecmp (argv[1], "set") == 0)
{
if (argc > 2)
logger_set_buffer (buffer, argv[2]);
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "disable") == 0)
{
logger_set_buffer (buffer, "0");
}
}
return WEECHAT_RC_OK;
}
/*
* logger_buffer_open_signal_cb: callback for "buffer_open" signal
*/
@@ -400,7 +738,7 @@ logger_buffer_closing_signal_cb (void *data, const char *signal,
(void) signal;
(void) type_data;
logger_stop (logger_buffer_search (signal_data), 1);
logger_stop (logger_buffer_search_buffer (signal_data), 1);
return WEECHAT_RC_OK;
}
@@ -452,9 +790,12 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines)
if (last_lines)
logger_tail_free (last_lines);
if (num_lines > 0)
{
weechat_printf (buffer,
_("===\t========== End of backlog (%d lines) =========="),
num_lines);
weechat_buffer_set (buffer, "unread", "");
}
}
/*
@@ -474,17 +815,22 @@ logger_backlog_signal_cb (void *data, const char *signal,
if (weechat_config_integer (logger_config_look_backlog) >= 0)
{
ptr_logger_buffer = logger_buffer_search (signal_data);
if (ptr_logger_buffer && ptr_logger_buffer->log_filename
&& ptr_logger_buffer->log_enabled)
ptr_logger_buffer = logger_buffer_search_buffer (signal_data);
if (ptr_logger_buffer && ptr_logger_buffer->log_enabled)
{
ptr_logger_buffer->log_enabled = 0;
if (!ptr_logger_buffer->log_filename)
logger_set_log_filename (ptr_logger_buffer);
logger_backlog (signal_data,
ptr_logger_buffer->log_filename,
weechat_config_integer (logger_config_look_backlog));
ptr_logger_buffer->log_enabled = 1;
if (ptr_logger_buffer->log_filename)
{
ptr_logger_buffer->log_enabled = 0;
logger_backlog (signal_data,
ptr_logger_buffer->log_filename,
weechat_config_integer (logger_config_look_backlog));
ptr_logger_buffer->log_enabled = 1;
}
}
}
@@ -524,35 +870,60 @@ logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
(void) signal;
(void) type_data;
ptr_logger_buffer = logger_buffer_search (signal_data);
ptr_logger_buffer = logger_buffer_search_buffer (signal_data);
if (ptr_logger_buffer)
logger_stop (ptr_logger_buffer, 0);
return WEECHAT_RC_OK;
}
/*
* logger_line_log_level: get log level for a line (with its tags)
*/
int
logger_line_log_level (int tags_count, const char **tags)
{
int i;
for (i = 0; i < tags_count; i++)
{
if (strncmp (tags[i], "log", 3) == 0)
{
if (isdigit (tags[i][3]))
{
return (tags[i][3] - '0');
}
}
}
return 9;
}
/*
* logger_print_cb: callback for print hook
*/
int
logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
int tags_count, char **tags,
int tags_count, const char **tags,
const char *prefix, const char *message)
{
struct t_logger_buffer *ptr_logger_buffer;
struct tm *date_tmp;
char buf_time[256];
int line_log_level;
/* make C compiler happy */
(void) data;
(void) tags_count;
(void) tags;
ptr_logger_buffer = logger_buffer_search (buffer);
if (ptr_logger_buffer && ptr_logger_buffer->log_filename
line_log_level = logger_line_log_level (tags_count, tags);
ptr_logger_buffer = logger_buffer_search_buffer (buffer);
if (ptr_logger_buffer
&& ptr_logger_buffer->log_enabled
&& (date > 0))
&& (date > 0)
&& (line_log_level <= ptr_logger_buffer->log_level))
{
date_tmp = localtime (&date);
buf_time[0] = '\0';
@@ -592,6 +963,43 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
if (logger_config_read () < 0)
return WEECHAT_RC_ERROR;
/* callback for debug */
weechat_hook_signal ("debug", &logger_debug_cb, NULL);
/* command /logger */
weechat_hook_command ("logger",
N_("logger plugin configuration"),
N_("[list | set level | disable]"),
N_(" list: show logging status for open buffers\n"
" set: set logging level on current buffer\n"
" level: level for messages to be logged (0 = "
"logging disabled, 1 = a few messages (most "
"important) .. 9 = all messages)\n"
"disable: disable logging on current buffer (set "
"level to 0)\n\n"
"Options \"logger.level.*\" and \"logger.mask.*\" "
"can be used to set level or mask for a buffer, "
"or buffers beginning with name.\n\n"
"Examples:\n"
" set level to 5 for current buffer:\n"
" /logger set 5\n"
" disable logging for current buffer:\n"
" /logger disable\n\n"
" set level to 3 for all IRC buffers:\n"
" /set logger.level.irc = 3\n"
" disable logging for main WeeChat buffer:\n"
" /set logger.level.core.weechat = 0\n"
" use a directory per IRC server and a file per channel inside:\n"
" /set logger.mask.irc = $server/$channel.weechatlog\n\n"
"Log levels used by IRC plugin:\n"
" 1: user message, notice, private\n"
" 2: nick change\n"
" 3: server message\n"
" 4: join/part/quit\n"
" 9: all other messages"),
"list|set|disable",
&logger_command_cb, NULL);
logger_start_buffer_all ();
weechat_hook_signal ("buffer_open", &logger_buffer_open_signal_cb, NULL);
+3
View File
@@ -24,6 +24,9 @@
#define LOGGER_PLUGIN_NAME "logger"
#define LOGGER_BUF_WRITE_SIZE (16*1024)
#define LOGGER_LEVEL_DEFAULT 9
extern int logger_debug;
extern struct t_weechat_plugin *weechat_logger_plugin;
+6 -4
View File
@@ -331,7 +331,8 @@ notify_config_init ()
NULL, NULL,
NULL, NULL,
NULL, NULL,
&notify_config_create_option, NULL);
&notify_config_create_option, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (notify_config_file);
@@ -404,10 +405,11 @@ notify_set (struct t_gui_buffer *buffer, const char *name, int value)
/* display message */
if (value >= 0)
weechat_printf (NULL, _("Notify level: %s => %s"),
name, notify_string[value]);
weechat_printf (NULL, "%s: \"%s\" => %s",
NOTIFY_PLUGIN_NAME, name, notify_string[value]);
else
weechat_printf (NULL, _("Notify level: %s: removed"), name);
weechat_printf (NULL, _("%s: \"%s\" removed"),
NOTIFY_PLUGIN_NAME, name);
}
}
-55
View File
@@ -86,61 +86,6 @@ plugin_api_ngettext (const char *single, const char *plural, int count)
return NG_(single, plural, count);
}
/*
* plugin_api_mkdir_home: create a directory in WeeChat home
* return 1 if ok, 0 if error
*/
int
plugin_api_mkdir_home (const char *directory, int mode)
{
char *dir_name;
int dir_length;
if (!directory)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (directory) + 2;
dir_name = malloc (dir_length);
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, directory);
if (mkdir (dir_name, mode) < 0)
{
if (errno != EEXIST)
{
free (dir_name);
return 0;
}
}
free (dir_name);
return 1;
}
/*
* plugin_api_mkdir: create a directory
* return 1 if ok, 0 if error
*/
int
plugin_api_mkdir (const char *directory, int mode)
{
if (!directory)
return 0;
if (mkdir (directory, mode) < 0)
{
if (errno != EEXIST)
return 0;
}
return 1;
}
/*
* plugin_api_config_get: get value of an option
*/
-4
View File
@@ -27,10 +27,6 @@ extern char *plugin_api_gettext (const char *string);
extern char *plugin_api_ngettext (const char *single, const char *plural,
int count);
/* directories */
extern int plugin_api_mkdir_home (const char *directory, int mode);
extern int plugin_api_mkdir (const char *directory, int mode);
/* config */
extern struct t_config_option *plugin_api_config_get (const char *option_name);
extern char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
+2 -1
View File
@@ -186,7 +186,8 @@ plugin_config_init ()
NULL, NULL,
NULL, NULL,
NULL, NULL,
&plugin_config_create_option, NULL);
&plugin_config_create_option, NULL,
NULL, NULL);
}
else
plugin_config_section_var = NULL;
+3 -2
View File
@@ -332,8 +332,9 @@ plugin_load (const char *filename)
new_plugin->utf8_real_pos = &utf8_real_pos;
new_plugin->utf8_pos = &utf8_pos;
new_plugin->mkdir_home = &plugin_api_mkdir_home;
new_plugin->mkdir = &plugin_api_mkdir;
new_plugin->mkdir_home = &util_mkdir_home;
new_plugin->mkdir = &util_mkdir;
new_plugin->mkdir_parents = &util_mkdir_parents;
new_plugin->exec_on_files = &util_exec_on_files;
new_plugin->timeval_cmp = &util_timeval_cmp;
+106 -11
View File
@@ -442,6 +442,46 @@ weechat_lua_api_mkdir (lua_State *L)
LUA_RETURN_OK;
}
/*
* weechat_lua_api_mkdir_parents: create a directory and make parent
* directories as needed
*/
static int
weechat_lua_api_mkdir_parents (lua_State *L)
{
const char *directory;
int mode, n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir_parents");
LUA_RETURN_ERROR;
}
directory = NULL;
mode = 0;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir_parents");
LUA_RETURN_ERROR;
}
directory = lua_tostring (lua_current_interpreter, -2);
mode = lua_tonumber (lua_current_interpreter, -1);
if (weechat_mkdir_parents (directory, mode))
LUA_RETURN_OK;
LUA_RETURN_OK;
}
/*
* weechat_lua_api_list_new: create a new list
*/
@@ -1157,6 +1197,54 @@ weechat_lua_api_config_section_create_option_cb (void *data,
return 0;
}
/*
* weechat_lua_api_config_section_delete_option_cb: callback to delete an option
*/
int
weechat_lua_api_config_section_delete_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
char *lua_argv[4];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback->function && script_callback->function[0])
{
lua_argv[0] = script_ptr2str (config_file);
lua_argv[1] = script_ptr2str (section);
lua_argv[2] = script_ptr2str (option);
lua_argv[3] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
lua_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
{
ret = *rc;
free (rc);
}
if (lua_argv[0])
free (lua_argv[0]);
if (lua_argv[1])
free (lua_argv[1]);
if (lua_argv[2])
free (lua_argv[2]);
return ret;
}
return 0;
}
/*
* weechat_lua_api_config_new_section: create a new section in configuration file
*/
@@ -1166,6 +1254,7 @@ weechat_lua_api_config_new_section (lua_State *L)
{
const char *config_file, *name, *function_read, *function_write;
const char *function_write_default, *function_create_option;
const char *function_delete_option;
char *result;
int n, user_can_add_options, user_can_delete_options;
@@ -1186,23 +1275,25 @@ weechat_lua_api_config_new_section (lua_State *L)
function_write = NULL;
function_write_default = NULL;
function_create_option = NULL;
function_delete_option = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 8)
if (n < 9)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_section");
LUA_RETURN_EMPTY;
}
config_file = lua_tostring (lua_current_interpreter, -8);
name = lua_tostring (lua_current_interpreter, -7);
user_can_add_options = lua_tonumber (lua_current_interpreter, -6);
user_can_delete_options = lua_tonumber (lua_current_interpreter, -5);
function_read = lua_tostring (lua_current_interpreter, -4);
function_write = lua_tostring (lua_current_interpreter, -3);
function_write_default = lua_tostring (lua_current_interpreter, -2);
function_create_option = lua_tostring (lua_current_interpreter, -1);
config_file = lua_tostring (lua_current_interpreter, -9);
name = lua_tostring (lua_current_interpreter, -8);
user_can_add_options = lua_tonumber (lua_current_interpreter, -7);
user_can_delete_options = lua_tonumber (lua_current_interpreter, -6);
function_read = lua_tostring (lua_current_interpreter, -5);
function_write = lua_tostring (lua_current_interpreter, -4);
function_write_default = lua_tostring (lua_current_interpreter, -3);
function_create_option = lua_tostring (lua_current_interpreter, -2);
function_delete_option = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_config_new_section (weechat_lua_plugin,
lua_current_script,
@@ -1217,7 +1308,9 @@ weechat_lua_api_config_new_section (lua_State *L)
&weechat_lua_api_config_section_write_default_cb,
function_write_default,
&weechat_lua_api_config_section_create_option_cb,
function_create_option));
function_create_option,
&weechat_lua_api_config_section_delete_option_cb,
function_delete_option));
LUA_RETURN_STRING_FREE(result);
}
@@ -2722,7 +2815,8 @@ weechat_lua_api_hook_connect (lua_State *L)
int
weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
time_t date,
int tags_count, const char **tags,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
@@ -5603,6 +5697,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "ngettext", &weechat_lua_api_ngettext },
{ "mkdir_home", &weechat_lua_api_mkdir_home },
{ "mkdir", &weechat_lua_api_mkdir },
{ "mkdir_parents", &weechat_lua_api_mkdir_parents },
{ "list_new", &weechat_lua_api_list_new },
{ "list_add", &weechat_lua_api_list_add },
{ "list_search", &weechat_lua_api_list_search },
+88 -3
View File
@@ -366,6 +366,37 @@ static XS (XS_weechat_api_mkdir)
PERL_RETURN_ERROR;
}
/*
* weechat::mkdir_parents: create a directory and make parent directories as
* needed
*/
static XS (XS_weechat_api_mkdir_parents)
{
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir_parents");
PERL_RETURN_ERROR;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir_parents");
PERL_RETURN_ERROR;
}
if (weechat_mkdir_parents (SvPV (ST (0), PL_na), /* directory */
SvIV (ST (1)))) /* mode */
PERL_RETURN_OK;
PERL_RETURN_ERROR;
}
/*
* weechat::list_new: create a new list
*/
@@ -976,6 +1007,54 @@ weechat_perl_api_config_section_create_option_cb (void *data,
return 0;
}
/*
* weechat_perl_api_config_section_delete_option_cb: callback to delete an option
*/
int
weechat_perl_api_config_section_delete_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
char *perl_argv[4];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback->function && script_callback->function[0])
{
perl_argv[0] = script_ptr2str (config_file);
perl_argv[1] = script_ptr2str (section);
perl_argv[2] = script_ptr2str (option);
perl_argv[3] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
perl_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
{
ret = *rc;
free (rc);
}
if (perl_argv[0])
free (perl_argv[0]);
if (perl_argv[1])
free (perl_argv[1]);
if (perl_argv[2])
free (perl_argv[2]);
return ret;
}
return 0;
}
/*
* weechat::config_new_section: create a new section in configuration file
*/
@@ -984,6 +1063,7 @@ static XS (XS_weechat_api_config_new_section)
{
char *result, *cfg_file, *name, *function_read, *function_write;
char *function_write_default, *function_create_option;
char *function_delete_option;
dXSARGS;
/* make C compiler happy */
@@ -995,7 +1075,7 @@ static XS (XS_weechat_api_config_new_section)
PERL_RETURN_EMPTY;
}
if (items < 8)
if (items < 9)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_section");
PERL_RETURN_EMPTY;
@@ -1007,6 +1087,7 @@ static XS (XS_weechat_api_config_new_section)
function_write = SvPV (ST (5), PL_na);
function_write_default = SvPV (ST (6), PL_na);
function_create_option = SvPV (ST (7), PL_na);
function_delete_option = SvPV (ST (8), PL_na);
result = script_ptr2str (script_api_config_new_section (weechat_perl_plugin,
perl_current_script,
script_str2ptr (cfg_file),
@@ -1020,7 +1101,9 @@ static XS (XS_weechat_api_config_new_section)
&weechat_perl_api_config_section_write_default_cb,
function_write_default,
&weechat_perl_api_config_section_create_option_cb,
function_create_option));
function_create_option,
&weechat_perl_api_config_section_delete_option_cb,
function_delete_option));
PERL_RETURN_STRING_FREE(result);
}
@@ -2256,7 +2339,8 @@ static XS (XS_weechat_api_hook_connect)
int
weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
time_t date,
int tags_count, const char **tags,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
@@ -4359,6 +4443,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::ngettext", XS_weechat_api_ngettext, "weechat");
newXS ("weechat::mkdir_home", XS_weechat_api_mkdir_home, "weechat");
newXS ("weechat::mkdir", XS_weechat_api_mkdir, "weechat");
newXS ("weechat::mkdir_parents", XS_weechat_api_mkdir_parents, "weechat");
newXS ("weechat::list_new", XS_weechat_api_list_new, "weechat");
newXS ("weechat::list_add", XS_weechat_api_list_add, "weechat");
newXS ("weechat::list_search", XS_weechat_api_list_search, "weechat");
@@ -379,6 +379,41 @@ weechat_python_api_mkdir (PyObject *self, PyObject *args)
PYTHON_RETURN_ERROR;
}
/*
* weechat_python_api_mkdir_parents: create a directory and make parent
* directories as needed
*/
static PyObject *
weechat_python_api_mkdir_parents (PyObject *self, PyObject *args)
{
char *directory;
int mode;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir_parents");
PYTHON_RETURN_ERROR;
}
directory = NULL;
mode = 0;
if (!PyArg_ParseTuple (args, "si", &directory, &mode))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir_parents");
PYTHON_RETURN_ERROR;
}
if (weechat_mkdir_parents (directory, mode))
PYTHON_RETURN_OK;
PYTHON_RETURN_ERROR;
}
/*
* weechat_python_api_list_new: create a new list
*/
@@ -1023,6 +1058,54 @@ weechat_python_api_config_section_create_option_cb (void *data,
return 0;
}
/*
* weechat_python_api_config_section_delete_option_cb: callback to delete an option
*/
int
weechat_python_api_config_section_delete_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
char *python_argv[4];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback->function && script_callback->function[0])
{
python_argv[0] = script_ptr2str (config_file);
python_argv[1] = script_ptr2str (section);
python_argv[2] = script_ptr2str (option);
python_argv[3] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
python_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
{
ret = *rc;
free (rc);
}
if (python_argv[0])
free (python_argv[0]);
if (python_argv[1])
free (python_argv[1]);
if (python_argv[2])
free (python_argv[2]);
return ret;
}
return 0;
}
/*
* weechat_python_api_config_new_section: create a new section in configuration file
*/
@@ -1032,6 +1115,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
{
char *config_file, *name, *function_read, *function_write;
char *function_write_default, *function_create_option;
char *function_delete_option;
char *result;
int user_can_add_options, user_can_delete_options;
PyObject *object;
@@ -1053,11 +1137,13 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
function_write = NULL;
function_write_default = NULL;
function_create_option = NULL;
function_delete_option = NULL;
if (!PyArg_ParseTuple (args, "ssiissss", &config_file, &name,
if (!PyArg_ParseTuple (args, "ssiisssss", &config_file, &name,
&user_can_add_options, &user_can_delete_options,
&function_read, &function_write,
&function_write_default, &function_create_option))
&function_write_default, &function_create_option,
&function_delete_option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_section");
PYTHON_RETURN_EMPTY;
@@ -1076,7 +1162,9 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args)
&weechat_python_api_config_section_write_default_cb,
function_write_default,
&weechat_python_api_config_section_create_option_cb,
function_create_option));
function_create_option,
&weechat_python_api_config_section_delete_option_cb,
function_delete_option));
PYTHON_RETURN_STRING_FREE(result);
}
@@ -2404,7 +2492,8 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
int
weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
time_t date,
int tags_count, const char **tags,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
@@ -4630,6 +4719,7 @@ PyMethodDef weechat_python_funcs[] =
{ "ngettext", &weechat_python_api_ngettext, METH_VARARGS, "" },
{ "mkdir_home", &weechat_python_api_mkdir_home, METH_VARARGS, "" },
{ "mkdir", &weechat_python_api_mkdir, METH_VARARGS, "" },
{ "mkdir_parents", &weechat_python_api_mkdir_parents, METH_VARARGS, "" },
{ "list_new", &weechat_python_api_list_new, METH_VARARGS, "" },
{ "list_add", &weechat_python_api_list_add, METH_VARARGS, "" },
{ "list_search", &weechat_python_api_list_search, METH_VARARGS, "" },
+103 -5
View File
@@ -441,6 +441,47 @@ weechat_ruby_api_mkdir (VALUE class, VALUE directory, VALUE mode)
RUBY_RETURN_ERROR;
}
/*
* weechat_ruby_api_mkdir_parents: create a directory and make parent
* directories as needed
*/
static VALUE
weechat_ruby_api_mkdir_parents (VALUE class, VALUE directory, VALUE mode)
{
char *c_directory;
int c_mode;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir_parents");
RUBY_RETURN_ERROR;
}
c_directory = NULL;
c_mode = 0;
if (NIL_P (directory) || NIL_P (mode))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir_parents");
RUBY_RETURN_ERROR;
}
Check_Type (directory, T_STRING);
Check_Type (mode, T_FIXNUM);
c_directory = STR2CSTR (directory);
c_mode = FIX2INT (mode);
if (weechat_mkdir_parents (c_directory, c_mode))
RUBY_RETURN_OK;
RUBY_RETURN_ERROR;
}
/*
* weechat_ruby_api_list_new: create a new list
*/
@@ -1146,6 +1187,54 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
return 0;
}
/*
* weechat_ruby_api_config_section_delete_option_cb: callback to delete an option
*/
int
weechat_ruby_api_config_section_delete_option_cb (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
struct t_script_callback *script_callback;
char *ruby_argv[4];
int *rc, ret;
script_callback = (struct t_script_callback *)data;
if (script_callback->function && script_callback->function[0])
{
ruby_argv[0] = script_ptr2str (config_file);
ruby_argv[1] = script_ptr2str (section);
ruby_argv[2] = script_ptr2str (option);
ruby_argv[3] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
ruby_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
else
{
ret = *rc;
free (rc);
}
if (ruby_argv[0])
free (ruby_argv[0]);
if (ruby_argv[1])
free (ruby_argv[1]);
if (ruby_argv[2])
free (ruby_argv[2]);
return ret;
}
return 0;
}
/*
* weechat_ruby_api_config_new_section: create a new section in configuration file
*/
@@ -1157,10 +1246,12 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
VALUE function_read,
VALUE function_write,
VALUE function_write_default,
VALUE function_create_option)
VALUE function_create_option,
VALUE function_delete_option)
{
char *c_config_file, *c_name, *c_function_read, *c_function_write;
char *c_function_write_default, *c_function_create_option;
char *c_function_delete_option;
char *result;
int c_user_can_add_options, c_user_can_delete_options;
VALUE return_value;
@@ -1182,11 +1273,12 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
c_function_write = NULL;
c_function_write_default = NULL;
c_function_create_option = NULL;
c_function_delete_option = NULL;
if (NIL_P (config_file) || NIL_P (name) || NIL_P (user_can_add_options)
|| NIL_P (user_can_delete_options) || NIL_P (function_read)
|| NIL_P (function_write) || NIL_P (function_write_default)
|| NIL_P (function_create_option))
|| NIL_P (function_create_option) || NIL_P (function_delete_option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_section");
RUBY_RETURN_EMPTY;
@@ -1200,6 +1292,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
Check_Type (function_write, T_STRING);
Check_Type (function_write_default, T_STRING);
Check_Type (function_create_option, T_STRING);
Check_Type (function_delete_option, T_STRING);
c_config_file = STR2CSTR (config_file);
c_name = STR2CSTR (name);
@@ -1209,6 +1302,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
c_function_write = STR2CSTR (function_write);
c_function_write_default = STR2CSTR (function_write_default);
c_function_create_option = STR2CSTR (function_create_option);
c_function_delete_option = STR2CSTR (function_delete_option);
result = script_ptr2str (script_api_config_new_section (weechat_ruby_plugin,
ruby_current_script,
@@ -1223,7 +1317,9 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
&weechat_ruby_api_config_section_write_default_cb,
c_function_write_default,
&weechat_ruby_api_config_section_create_option_cb,
c_function_create_option));
c_function_create_option,
&weechat_ruby_api_config_section_delete_option_cb,
c_function_delete_option));
RUBY_RETURN_STRING_FREE(result);
}
@@ -2777,7 +2873,8 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE address, VALUE port,
int
weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count, char **tags,
time_t date,
int tags_count, const char **tags,
const char *prefix, const char *message)
{
struct t_script_callback *script_callback;
@@ -5344,6 +5441,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "ngettext", &weechat_ruby_api_ngettext, 3);
rb_define_module_function (ruby_mWeechat, "mkdir_home", &weechat_ruby_api_mkdir_home, 2);
rb_define_module_function (ruby_mWeechat, "mkdir", &weechat_ruby_api_mkdir, 2);
rb_define_module_function (ruby_mWeechat, "mkdir_parents", &weechat_ruby_api_mkdir_parents, 2);
rb_define_module_function (ruby_mWeechat, "list_new", &weechat_ruby_api_list_new, 0);
rb_define_module_function (ruby_mWeechat, "list_add", &weechat_ruby_api_list_add, 3);
rb_define_module_function (ruby_mWeechat, "list_search", &weechat_ruby_api_list_search, 2);
@@ -5358,7 +5456,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "list_remove_all", &weechat_ruby_api_list_remove_all, 1);
rb_define_module_function (ruby_mWeechat, "list_free", &weechat_ruby_api_list_free, 1);
rb_define_module_function (ruby_mWeechat, "config_new", &weechat_ruby_api_config_new, 2);
rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 8);
rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 9);
rb_define_module_function (ruby_mWeechat, "config_search_section", &weechat_ruby_api_config_search_section, 2);
rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 13);
rb_define_module_function (ruby_mWeechat, "config_search_option", &weechat_ruby_api_config_search_option, 3);
+60 -6
View File
@@ -118,21 +118,29 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_create_option)
const char *function_create_option,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const char *function_delete_option)
{
struct t_script_callback *new_script_callback1, *new_script_callback2;
struct t_script_callback *new_script_callback3, *new_script_callback4;
struct t_script_callback *new_script_callback5;
struct t_config_section *new_section;
void *callback1, *callback2, *callback3, *callback4;
void *callback1, *callback2, *callback3, *callback4, *callback5;
new_script_callback1 = NULL;
new_script_callback2 = NULL;
new_script_callback3 = NULL;
new_script_callback4 = NULL;
new_script_callback5 = NULL;
callback1 = NULL;
callback2 = NULL;
callback3 = NULL;
callback4 = NULL;
callback5 = NULL;
if (function_read && function_read[0])
{
@@ -141,7 +149,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
return NULL;
callback1 = callback_read;
}
if (function_write && function_write[0])
{
new_script_callback2 = script_callback_alloc ();
@@ -202,6 +210,36 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
callback4 = callback_create_option;
}
if (function_delete_option && function_delete_option[0])
{
new_script_callback5 = script_callback_alloc ();
if (!new_script_callback5)
{
if (new_script_callback1)
{
script_callback_free_data (new_script_callback1);
free (new_script_callback1);
}
if (new_script_callback2)
{
script_callback_free_data (new_script_callback2);
free (new_script_callback2);
}
if (new_script_callback3)
{
script_callback_free_data (new_script_callback3);
free (new_script_callback3);
}
if (new_script_callback4)
{
script_callback_free_data (new_script_callback4);
free (new_script_callback4);
}
return NULL;
}
callback5 = callback_delete_option;
}
new_section = weechat_config_new_section (config_file,
name,
user_can_add_options,
@@ -213,7 +251,9 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
callback3,
new_script_callback3,
callback4,
new_script_callback4);
new_script_callback4,
callback5,
new_script_callback5);
if (!new_section)
{
if (new_script_callback1)
@@ -236,6 +276,11 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
script_callback_free_data (new_script_callback4);
free (new_script_callback4);
}
if (new_script_callback5)
{
script_callback_free_data (new_script_callback5);
free (new_script_callback5);
}
return NULL;
}
@@ -275,6 +320,15 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
script_callback_add (script, new_script_callback4);
}
if (new_script_callback5)
{
new_script_callback5->script = script;
new_script_callback5->function = strdup (function_delete_option);
new_script_callback5->config_file = config_file;
new_script_callback5->config_section = new_section;
script_callback_add (script, new_script_callback5);
}
return new_section;
}
@@ -734,7 +788,7 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count, char **tags,
int tags_count, const char **tags,
const char *prefix,
const char *message),
const char *function)
+7 -2
View File
@@ -51,7 +51,12 @@ extern struct t_config_section *script_api_config_new_section (struct t_weechat_
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_create_option);
const char *function_create_option,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const char *function_delete_option);
extern struct t_config_option *script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
@@ -136,7 +141,7 @@ extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_pl
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
char **tags,
const char **tags,
const char *prefix,
const char *message),
const char *function);
File diff suppressed because it is too large Load Diff
+19 -6
View File
@@ -23,6 +23,7 @@
#include <sys/types.h>
struct t_config_option;
struct t_gui_window;
struct t_gui_buffer;
struct t_gui_bar;
@@ -148,7 +149,7 @@ struct t_weechat_plugin
char **(*string_explode) (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
char *(*string_build_with_exploded) (char **exploded_string,
char *(*string_build_with_exploded) (const char **exploded_string,
const char *separator);
char **(*string_split_command) (const char *command, char separator);
void (*string_free_splitted_command) (char **splitted_command);
@@ -172,6 +173,7 @@ struct t_weechat_plugin
/* directories */
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
int (*mkdir_parents) (const char *directory, int mode);
void (*exec_on_files) (const char *directory, void *data,
void (*callback)(void *data, const char *filename));
@@ -200,7 +202,7 @@ struct t_weechat_plugin
struct t_weelist_item *item);
void (*list_remove_all) (struct t_weelist *weelist);
void (*list_free) (struct t_weelist *weelist);
/* config files */
struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
const char *name,
@@ -230,7 +232,12 @@ struct t_weechat_plugin
struct t_config_section *section,
const char *option_name,
const char *value),
void *callback_create_option_data);
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
void *callback_delete_option_data);
struct t_config_section *(*config_search_section) (struct t_config_file *config_file,
const char *section_name);
struct t_config_option *(*config_new_option) (struct t_config_file *config_file,
@@ -342,7 +349,7 @@ struct t_weechat_plugin
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
char **tags,
const char **tags,
const char *prefix,
const char *message),
void *callback_data);
@@ -659,6 +666,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->mkdir_home(__directory, __mode)
#define weechat_mkdir(__directory, __mode) \
weechat_plugin->mkdir(__directory, __mode)
#define weechat_mkdir_parents(__directory, __mode) \
weechat_plugin->mkdir_parents(__directory, __mode)
#define weechat_exec_on_files(__directory, __data, __callback) \
weechat_plugin->exec_on_files(__directory, __data, __callback)
@@ -711,7 +720,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__cb_write_std, __cb_write_std_data, \
__cb_write_def, __cb_write_def_data, \
__cb_create_option, \
__cb_create_option_data) \
__cb_create_option_data, \
__cb_delete_option, \
__cb_delete_option_data) \
weechat_plugin->config_new_section(__config, __name, \
__user_can_add_options, \
__user_can_delete_options, \
@@ -721,7 +732,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__cb_write_def, \
__cb_write_def_data, \
__cb_create_option, \
__cb_create_option_data)
__cb_create_option_data, \
__cb_delete_option, \
__cb_delete_option_data)
#define weechat_config_search_section(__config, __name) \
weechat_plugin->config_search_section(__config, __name)
#define weechat_config_new_option(__config, __section, __name, __type, \
+8 -4
View File
@@ -111,7 +111,8 @@ xfer_config_init ()
ptr_section = weechat_config_new_section (xfer_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -134,7 +135,8 @@ xfer_config_init ()
ptr_section = weechat_config_new_section (xfer_config_file, "color",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -199,7 +201,8 @@ xfer_config_init ()
ptr_section = weechat_config_new_section (xfer_config_file, "network",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -245,7 +248,8 @@ xfer_config_init ()
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);