diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2004-01-24 20:17:01 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2004-01-24 20:17:01 +0000 |
commit | 69cb87251e20aa759675e12e72deb39899e69ee2 (patch) | |
tree | 2a9d8034801ffccd539a093d807552b43bcd8a55 | |
parent | 8bcbc3dcae92eaff85bb07476561a3361c2109cd (diff) | |
download | weechat-69cb87251e20aa759675e12e72deb39899e69ee2.zip |
/set command is now ok
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | TODO | 14 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | po/fr.po | 127 | ||||
-rw-r--r-- | po/weechat.pot | 119 | ||||
-rw-r--r-- | src/common/command.c | 119 | ||||
-rw-r--r-- | src/common/weeconfig.c | 220 | ||||
-rw-r--r-- | src/common/weeconfig.h | 11 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 95 | ||||
-rw-r--r-- | src/gui/gtk/gui-display.c | 10 | ||||
-rw-r--r-- | src/gui/gui.h | 3 | ||||
-rw-r--r-- | src/irc/irc-server.c | 6 | ||||
-rw-r--r-- | weechat/ChangeLog | 1 | ||||
-rw-r--r-- | weechat/TODO | 14 | ||||
-rw-r--r-- | weechat/configure.in | 4 | ||||
-rw-r--r-- | weechat/po/fr.po | 127 | ||||
-rw-r--r-- | weechat/po/weechat.pot | 119 | ||||
-rw-r--r-- | weechat/src/common/command.c | 119 | ||||
-rw-r--r-- | weechat/src/common/weeconfig.c | 220 | ||||
-rw-r--r-- | weechat/src/common/weeconfig.h | 11 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-display.c | 95 | ||||
-rw-r--r-- | weechat/src/gui/gtk/gui-display.c | 10 | ||||
-rw-r--r-- | weechat/src/gui/gui.h | 3 | ||||
-rw-r--r-- | weechat/src/irc/irc-server.c | 6 |
24 files changed, 992 insertions, 466 deletions
@@ -5,6 +5,7 @@ ChangeLog - 2004-01-24 Version 0.0.5 (under dev!): + * /set command to modify config options when WeeChat is running * secured code to prevent buffer overflows and memory leaks * fixed QUIT IRC command: now sent to all connected servers (not only current) * new Perl script function to display message in info bar ("IRC::print_infobar") @@ -1,7 +1,7 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -TODO - 2004-01-18 +TODO - 2004-01-24 Legend: # done @@ -17,9 +17,15 @@ v0.0.5: # debug messages can be enabled via ./configure --enbale-debug option + Solaris version + * WeeChat commands: + # "/set" command: allow the user to set the WeeChat variables + under WeeChat without editing the config file (colors, time + format, etc) + * Interface: + internationalization (traduce WeeChat in many languages) - + info bar + # info bar + # add clock * Configuration: + add missing options for config file @@ -46,9 +52,6 @@ Future versions: nick/host connect to the given irc network * WeeChat commands: - + "/set" command: allow the user to set the WeeChat variables - under WeeChat without editing the config file (colours, time - format, etc) - "/reload" command: reload the WeeChat's config file - "/highlight" command: highlight a given word when it appears on channels/privates @@ -69,7 +72,6 @@ Future versions: if WeeChat is running for long time, a lot of memory is used!) - improve completion (for example complete command parameters when possible) - understand incomplete commands if unambigous (for example: /he for /help is ok) - - add clock (in status bar?) - log chats to file ? Qt GUI diff --git a/configure.in b/configure.in index 519dec1ac..0d208792b 100644 --- a/configure.in +++ b/configure.in @@ -19,10 +19,10 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.56) -AC_INIT(WeeChat, 0.0.5-pre2, flashcode@flashtux.org) +AC_INIT(WeeChat, 0.0.5-pre3, flashcode@flashtux.org) AC_CONFIG_SRCDIR([src/common/weechat.c]) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE([weechat], [0.0.5-pre2]) +AM_INIT_AUTOMAKE([weechat], [0.0.5-pre3]) # Checks for programs. AC_PROG_CC @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: WeeChat 0.0.5-pre2\n" +"Project-Id-Version: WeeChat 0.0.5-pre3\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2004-01-24 03:16+0100\n" -"PO-Revision-Date: 2004-01-01 11:52+0100\n" +"POT-Creation-Date: 2004-01-24 20:57+0100\n" +"PO-Revision-Date: 2004-01-24 20:57+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -30,71 +30,76 @@ msgstr "%s impossible d'allouer un nouveau serveur\n" msgid "%s error sending data to IRC server\n" msgstr "%s erreur d'envoi de données au serveur IRC\n" -#: src/irc/irc-server.c:417 +#: src/irc/irc-server.c:364 src/irc/irc-server.c:375 src/irc/irc-server.c:429 +#, c-format +msgid "%s not enough memory for received IRC message\n" +msgstr "%s mémoire insuffisante pour un message IRC reçu\n" + +#: src/irc/irc-server.c:436 #, c-format msgid "%s unable to explode received buffer\n" msgstr "%s impossible d'exploser le tampon de réception\n" -#: src/irc/irc-server.c:490 +#: src/irc/irc-server.c:509 #, c-format msgid "Command '%s' failed!\n" msgstr "La commande '%s' a échoué !\n" -#: src/irc/irc-server.c:494 +#: src/irc/irc-server.c:513 msgid "No command to execute!\n" msgstr "Pas de commande à exécuter !\n" -#: src/irc/irc-server.c:498 +#: src/irc/irc-server.c:517 #, c-format msgid "Unknown command: cmd=%s, args=%s\n" msgstr "Commande inconnue: cmd=%s, params=%s\n" -#: src/irc/irc-server.c:548 +#: src/irc/irc-server.c:569 #, c-format msgid "%s: connecting to %s:%d...\n" msgstr "%s: connexion à %s:%d...\n" -#: src/irc/irc-server.c:550 +#: src/irc/irc-server.c:571 #, c-format msgid "connecting to server %s:%d...\n" msgstr "connexion au serveur %s:%d...\n" -#: src/irc/irc-server.c:558 +#: src/irc/irc-server.c:579 #, c-format msgid "%s cannot create pipe\n" msgstr "%s impossible de créer le pipe\n" -#: src/irc/irc-server.c:572 +#: src/irc/irc-server.c:593 #, c-format msgid "%s cannot set socket option \"SO_REUSEADDR\"\n" msgstr "%s impossible de paramétrer l'option socket \"SO_REUSEADDR\"\n" -#: src/irc/irc-server.c:579 +#: src/irc/irc-server.c:600 #, c-format msgid "%s cannot set socket option \"SO_KEEPALIVE\"\n" msgstr "%s impossible de paramétrer l'option socket \"SO_KEEPALIVE\"\n" -#: src/irc/irc-server.c:587 +#: src/irc/irc-server.c:608 #, c-format msgid "%s address \"%s\" not found\n" msgstr "%s adresse \"%s\" introuvable\n" -#: src/irc/irc-server.c:610 +#: src/irc/irc-server.c:631 #, c-format msgid "%s IP address not found\n" msgstr "%s adresse IP introuvable\n" -#: src/irc/irc-server.c:620 +#: src/irc/irc-server.c:641 #, c-format msgid "%s: server IP is: %s\n" msgstr "%s: l'adresse IP du serveur est : %s\n" -#: src/irc/irc-server.c:626 +#: src/irc/irc-server.c:647 #, c-format msgid "%s cannot connect to irc server\n" msgstr "%s connexion au serveur irc impossible\n" -#: src/irc/irc-server.c:676 +#: src/irc/irc-server.c:697 msgid "Disconnected from server!\n" msgstr "Déconnecté du serveur !\n" @@ -1547,12 +1552,12 @@ msgstr "déchargement du script Perl \"%s\"\n" msgid "unloading all Perl scripts...\n" msgstr "déchargement de tous les scripts Perl...\n" -#: src/plugins/plugins.c:87 +#: src/plugins/plugins.c:89 #, c-format msgid "auto-loading %s script: %s%s%s\n" msgstr "chargement automatique du script %s : %s%s%s\n" -#: src/plugins/plugins.c:193 +#: src/plugins/plugins.c:195 #, c-format msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" @@ -1567,7 +1572,7 @@ msgstr "[non connecté] " msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/gtk/gui-display.c:647 +#: src/gui/gtk/gui-display.c:657 msgid "server" msgstr "serveur" @@ -2069,16 +2074,46 @@ msgstr "créé\n" msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1529 +#: src/common/command.c:1490 +#, c-format +msgid "%s option '%s' can not be changed while WeeChat is running\n" +msgstr "%s l'option '%s' ne peut pas être changée lorsque WeeChat tourne\n" + +#: src/common/command.c:1502 +#, c-format +msgid "%s incorrect value for option '%s'\n" +msgstr "%s valeur incorrecte pour l'option '%s'\n" + +#: src/common/command.c:1508 +#, c-format +msgid "%s config option '%s' not found\n" +msgstr "%s option de configuration '%s' non trouvée\n" + +#: src/common/command.c:1558 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1562 +#: src/common/command.c:1578 src/common/command.c:1581 +#, c-format +msgid "No config option found with '%s'\n" +msgstr "Aucune option de configuration trouvée avec '%s'\n" + +#: src/common/command.c:1586 +#, c-format +msgid "%d config option(s) found with '%s'\n" +msgstr "%d option(s) de configuration trouvées avec '%s'\n" + +#: src/common/command.c:1589 +#, c-format +msgid "%d config option(s) found\n" +msgstr "%d option(s) de configuration trouvées\n" + +#: src/common/command.c:1609 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1571 +#: src/common/command.c:1618 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" @@ -2209,10 +2244,10 @@ msgid " Warning:" msgstr " Attention:" #: src/common/weeconfig.c:81 src/common/weeconfig.c:82 -msgid "set title for terminal window (curses GUI) with name & version" +msgid "set title for window (terminal for Curses GUI) with name & version" msgstr "" -"définit le titre de la fenêtre de terminal (GUI curses) avec le nom et la " -"version" +"définit le titre de la fenêtre (terminal pour l'interface Curses) avec le " +"nom et la version" #: src/common/weeconfig.c:85 src/common/weeconfig.c:86 msgid "display WeeChat logo at startup" @@ -2800,57 +2835,57 @@ msgstr "" "liste des canaux (séparés par des virgules) à rejoindre lorsque connecté au " "serveur" -#: src/common/weeconfig.c:663 +#: src/common/weeconfig.c:757 #, c-format msgid "%s %s, line %d: new server, but previous was incomplete\n" msgstr "%s %s, ligne %d: nouveau serveur, mais le précédent était incomplet\n" -#: src/common/weeconfig.c:672 +#: src/common/weeconfig.c:766 #, c-format msgid "%s %s, line %d: server '%s' already exists\n" msgstr "%s %s, ligne %d: le serveur '%s' existe déjà\n" -#: src/common/weeconfig.c:684 +#: src/common/weeconfig.c:778 #, c-format msgid "%s %s, line %d: unable to create server\n" msgstr "%s %s, ligne %d: impossible de créer le serveur\n" -#: src/common/weeconfig.c:723 +#: src/common/weeconfig.c:817 #, c-format msgid "%s unable to assign default int with string (\"%s\")\n" msgstr "%s impossible d'assigner la valeur entière avec la chaîne (\"%s\")\n" -#: src/common/weeconfig.c:734 +#: src/common/weeconfig.c:828 #, c-format msgid "%s unable to assign default color (\"%s\")\n" msgstr "%s impossible d'assigner la couleur par défaut (\"%s\")\n" -#: src/common/weeconfig.c:773 +#: src/common/weeconfig.c:867 #, c-format msgid "%s config file \"%s\" not found.\n" msgstr "%s fichier de configuration \"%s\" non trouvé.\n" -#: src/common/weeconfig.c:805 +#: src/common/weeconfig.c:899 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"]\"\n" msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"]\"\n" -#: src/common/weeconfig.c:822 +#: src/common/weeconfig.c:916 #, c-format msgid "%s %s, line %d: unknown section identifier (\"%s\")\n" msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n" -#: src/common/weeconfig.c:840 +#: src/common/weeconfig.c:934 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"=\"\n" -#: src/common/weeconfig.c:874 +#: src/common/weeconfig.c:968 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "%s %s, ligne %d: option \"%s\" invalide\n" -#: src/common/weeconfig.c:885 +#: src/common/weeconfig.c:979 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" @@ -2859,7 +2894,7 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: valeur booléenne: 'off' ou 'on'\n" -#: src/common/weeconfig.c:894 +#: src/common/weeconfig.c:988 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -2868,7 +2903,7 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: entier compris entre %d et %d\n" -#: src/common/weeconfig.c:905 +#: src/common/weeconfig.c:999 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -2877,26 +2912,26 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: une de ces chaînes: " -#: src/common/weeconfig.c:921 +#: src/common/weeconfig.c:1015 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "%s %s, ligne %d: nom de couleur invalide pour l'option '%s'\n" -#: src/common/weeconfig.c:980 src/common/weeconfig.c:1147 +#: src/common/weeconfig.c:1074 src/common/weeconfig.c:1241 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "%s impossible de créer le fichier \"%s\"\n" -#: src/common/weeconfig.c:986 +#: src/common/weeconfig.c:1080 #, c-format msgid "%s: creating default config file...\n" msgstr "%s: création du fichier de configuration par défaut...\n" -#: src/common/weeconfig.c:987 +#: src/common/weeconfig.c:1081 msgid "creating default config file\n" msgstr "création du fichier de configuration par défaut\n" -#: src/common/weeconfig.c:990 src/common/weeconfig.c:1156 +#: src/common/weeconfig.c:1084 src/common/weeconfig.c:1250 #, c-format msgid "" "#\n" @@ -2905,10 +2940,10 @@ msgstr "" "#\n" "# %s: fichier de configuration, créé par %s v%s le %s#\n" -#: src/common/weeconfig.c:1098 +#: src/common/weeconfig.c:1192 msgid "Unable to get user's name" msgstr "Impossible de déterminer le nom d'utilisateur" -#: src/common/weeconfig.c:1153 +#: src/common/weeconfig.c:1247 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" diff --git a/po/weechat.pot b/po/weechat.pot index e6564d936..663a643f1 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2004-01-24 03:16+0100\n" +"POT-Creation-Date: 2004-01-24 20:57+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" @@ -30,71 +30,76 @@ msgstr "" msgid "%s error sending data to IRC server\n" msgstr "" -#: src/irc/irc-server.c:417 +#: src/irc/irc-server.c:364 src/irc/irc-server.c:375 src/irc/irc-server.c:429 +#, c-format +msgid "%s not enough memory for received IRC message\n" +msgstr "" + +#: src/irc/irc-server.c:436 #, c-format msgid "%s unable to explode received buffer\n" msgstr "" -#: src/irc/irc-server.c:490 +#: src/irc/irc-server.c:509 #, c-format msgid "Command '%s' failed!\n" msgstr "" -#: src/irc/irc-server.c:494 +#: src/irc/irc-server.c:513 msgid "No command to execute!\n" msgstr "" -#: src/irc/irc-server.c:498 +#: src/irc/irc-server.c:517 #, c-format msgid "Unknown command: cmd=%s, args=%s\n" msgstr "" -#: src/irc/irc-server.c:548 +#: src/irc/irc-server.c:569 #, c-format msgid "%s: connecting to %s:%d...\n" msgstr "" -#: src/irc/irc-server.c:550 +#: src/irc/irc-server.c:571 #, c-format msgid "connecting to server %s:%d...\n" msgstr "" -#: src/irc/irc-server.c:558 +#: src/irc/irc-server.c:579 #, c-format msgid "%s cannot create pipe\n" msgstr "" -#: src/irc/irc-server.c:572 +#: src/irc/irc-server.c:593 #, c-format msgid "%s cannot set socket option \"SO_REUSEADDR\"\n" msgstr "" -#: src/irc/irc-server.c:579 +#: src/irc/irc-server.c:600 #, c-format msgid "%s cannot set socket option \"SO_KEEPALIVE\"\n" msgstr "" -#: src/irc/irc-server.c:587 +#: src/irc/irc-server.c:608 #, c-format msgid "%s address \"%s\" not found\n" msgstr "" -#: src/irc/irc-server.c:610 +#: src/irc/irc-server.c:631 #, c-format msgid "%s IP address not found\n" msgstr "" -#: src/irc/irc-server.c:620 +#: src/irc/irc-server.c:641 #, c-format msgid "%s: server IP is: %s\n" msgstr "" -#: src/irc/irc-server.c:626 +#: src/irc/irc-server.c:647 #, c-format msgid "%s cannot connect to irc server\n" msgstr "" -#: src/irc/irc-server.c:676 +#: src/irc/irc-server.c:697 msgid "Disconnected from server!\n" msgstr "" @@ -1445,12 +1450,12 @@ msgstr "" msgid "unloading all Perl scripts...\n" msgstr "" -#: src/plugins/plugins.c:87 +#: src/plugins/plugins.c:89 #, c-format msgid "auto-loading %s script: %s%s%s\n" msgstr "" -#: src/plugins/plugins.c:193 +#: src/plugins/plugins.c:195 #, c-format msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" @@ -1463,7 +1468,7 @@ msgstr "" msgid "-MORE-" msgstr "" -#: src/gui/gtk/gui-display.c:647 +#: src/gui/gtk/gui-display.c:657 msgid "server" msgstr "" @@ -1935,16 +1940,46 @@ msgstr "" msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1529 +#: src/common/command.c:1490 +#, c-format +msgid "%s option '%s' can not be changed while WeeChat is running\n" +msgstr "" + +#: src/common/command.c:1502 +#, c-format +msgid "%s incorrect value for option '%s'\n" +msgstr "" + +#: src/common/command.c:1508 +#, c-format +msgid "%s config option '%s' not found\n" +msgstr "" + +#: src/common/command.c:1558 msgid "(unknown)" msgstr "" -#: src/common/command.c:1562 +#: src/common/command.c:1578 src/common/command.c:1581 +#, c-format +msgid "No config option found with '%s'\n" +msgstr "" + +#: src/common/command.c:1586 +#, c-format +msgid "%d config option(s) found with '%s'\n" +msgstr "" + +#: src/common/command.c:1589 +#, c-format +msgid "%d config option(s) found\n" +msgstr "" + +#: src/common/command.c:1609 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1571 +#: src/common/command.c:1618 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" @@ -2067,7 +2102,7 @@ msgid " Warning:" msgstr "" #: src/common/weeconfig.c:81 src/common/weeconfig.c:82 -msgid "set title for terminal window (curses GUI) with name & version" +msgid "set title for window (terminal for Curses GUI) with name & version" msgstr "" #: src/common/weeconfig.c:85 src/common/weeconfig.c:86 @@ -2615,107 +2650,107 @@ msgstr "" msgid "comma separated list of channels to join when connected to server" msgstr "" -#: src/common/weeconfig.c:663 +#: src/common/weeconfig.c:757 #, c-format msgid "%s %s, line %d: new server, but previous was incomplete\n" msgstr "" -#: src/common/weeconfig.c:672 +#: src/common/weeconfig.c:766 #, c-format msgid "%s %s, line %d: server '%s' already exists\n" msgstr "" -#: src/common/weeconfig.c:684 +#: src/common/weeconfig.c:778 #, c-format msgid "%s %s, line %d: unable to create server\n" msgstr "" -#: src/common/weeconfig.c:723 +#: src/common/weeconfig.c:817 #, c-format msgid "%s unable to assign default int with string (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:734 +#: src/common/weeconfig.c:828 #, c-format msgid "%s unable to assign default color (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:773 +#: src/common/weeconfig.c:867 #, c-format msgid "%s config file \"%s\" not found.\n" msgstr "" -#: src/common/weeconfig.c:805 +#: src/common/weeconfig.c:899 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"]\"\n" msgstr "" -#: src/common/weeconfig.c:822 +#: src/common/weeconfig.c:916 #, c-format msgid "%s %s, line %d: unknown section identifier (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:840 +#: src/common/weeconfig.c:934 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "" -#: src/common/weeconfig.c:874 +#: src/common/weeconfig.c:968 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:885 +#: src/common/weeconfig.c:979 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" "Expected: boolean value: 'off' or 'on'\n" msgstr "" -#: src/common/weeconfig.c:894 +#: src/common/weeconfig.c:988 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: integer between %d and %d\n" msgstr "" -#: src/common/weeconfig.c:905 +#: src/common/weeconfig.c:999 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: one of these strings: " msgstr "" -#: src/common/weeconfig.c:921 +#: src/common/weeconfig.c:1015 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "" -#: src/common/weeconfig.c:980 src/common/weeconfig.c:1147 +#: src/common/weeconfig.c:1074 src/common/weeconfig.c:1241 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:986 +#: src/common/weeconfig.c:1080 #, c-format msgid "%s: creating default config file...\n" msgstr "" -#: src/common/weeconfig.c:987 +#: src/common/weeconfig.c:1081 msgid "creating default config file\n" msgstr "" -#: src/common/weeconfig.c:990 src/common/weeconfig.c:1156 +#: src/common/weeconfig.c:1084 src/common/weeconfig.c:1250 #, c-format msgid "" "#\n" "# %s configuration file, created by %s v%s on %s#\n" msgstr "" -#: src/common/weeconfig.c:1098 +#: src/common/weeconfig.c:1192 msgid "Unable to get user's name" msgstr "" -#: src/common/weeconfig.c:1153 +#: src/common/weeconfig.c:1247 msgid "saving config to disk\n" msgstr "" diff --git a/src/common/command.c b/src/common/command.c index da481ab71..3c10b170b 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -84,7 +84,7 @@ t_weechat_command weechat_commands[] = 0, 1, weechat_cmd_save, NULL }, { "set", N_("set config parameters"), N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"), - 0, 2, NULL, weechat_cmd_set }, + 0, MAX_ARGS, NULL, weechat_cmd_set }, { "unalias", N_("remove an alias"), N_("alias_name"), N_("alias_name: name of alias to remove"), 1, 1, NULL, weechat_cmd_unalias }, @@ -1461,6 +1461,8 @@ weechat_cmd_set (char *arguments) char *option, *value; int i, j, section_displayed; char *color_name; + t_config_option *ptr_option; + int number_found; option = NULL; value = NULL; @@ -1479,10 +1481,37 @@ weechat_cmd_set (char *arguments) if (value && value[0]) { - gui_printf (NULL, "TODO: set value!\n"); + ptr_option = config_option_search (option); + if (ptr_option) + { + if (ptr_option->handler_change == NULL) + { + gui_printf (NULL, + _("%s option '%s' can not be changed while WeeChat is running\n"), + WEECHAT_ERROR, option); + } + else + { + if (config_option_set_value (ptr_option, value) == 0) + { + (void) (ptr_option->handler_change()); + gui_printf (NULL, "[%s]\n", config_get_section (ptr_option)); + gui_printf (NULL, " %s = %s\n", option, value); + } + else + gui_printf (NULL, _("%s incorrect value for option '%s'\n"), + WEECHAT_ERROR, option); + } + } + else + { + gui_printf (NULL, _("%s config option '%s' not found\n"), + WEECHAT_ERROR, option); + } } else { + number_found = 0; for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) { section_displayed = 0; @@ -1503,45 +1532,63 @@ weechat_cmd_set (char *arguments) } switch (weechat_options[i][j].option_type) { - case OPTION_TYPE_BOOLEAN: - gui_printf (NULL, " %s = %s\n", - weechat_options[i][j].option_name, - (*weechat_options[i][j].ptr_int) ? - "ON" : "OFF"); - break; - case OPTION_TYPE_INT: - gui_printf (NULL, - " %s = %d\n", - weechat_options[i][j].option_name, - *weechat_options[i][j].ptr_int); - break; - case OPTION_TYPE_INT_WITH_STRING: - gui_printf (NULL, - " %s = %s\n", - weechat_options[i][j].option_name, - weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]); - break; - case OPTION_TYPE_COLOR: - color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int); - gui_printf (NULL, - " %s = %s\n", - weechat_options[i][j].option_name, - (color_name) ? color_name : _("(unknown)")); - break; - case OPTION_TYPE_STRING: - gui_printf (NULL, " %s = %s\n", - weechat_options[i][j]. - option_name, - (*weechat_options[i][j]. - ptr_string) ? - *weechat_options[i][j]. - ptr_string : ""); - break; + case OPTION_TYPE_BOOLEAN: + gui_printf (NULL, " %s = %s\n", + weechat_options[i][j].option_name, + (*weechat_options[i][j].ptr_int) ? + "ON" : "OFF"); + break; + case OPTION_TYPE_INT: + gui_printf (NULL, + " %s = %d\n", + weechat_options[i][j].option_name, + *weechat_options[i][j].ptr_int); + break; + case OPTION_TYPE_INT_WITH_STRING: + gui_printf (NULL, + " %s = %s\n", + weechat_options[i][j].option_name, + weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]); + break; + case OPTION_TYPE_COLOR: + color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int); + gui_printf (NULL, + " %s = %s\n", + weechat_options[i][j].option_name, + (color_name) ? color_name : _("(unknown)")); + break; + case OPTION_TYPE_STRING: + gui_printf (NULL, " %s = %s\n", + weechat_options[i][j]. + option_name, + (*weechat_options[i][j]. + ptr_string) ? + *weechat_options[i][j]. + ptr_string : ""); + break; } + number_found++; } } } } + if (number_found == 0) + { + if (value) + gui_printf (NULL, _("No config option found with '%s'\n"), + value); + else + gui_printf (NULL, _("No config option found with '%s'\n")); + } + else + { + if (value) + gui_printf (NULL, _("%d config option(s) found with '%s'\n"), + number_found, value); + else + gui_printf (NULL, _("%d config option(s) found\n"), + number_found); + } } return 0; } diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index 3f92af312..a86145863 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -78,81 +78,81 @@ char *cfg_look_infobar_timestamp; int cfg_look_infobar_delay_highlight; t_config_option weechat_options_look[] = -{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"), - N_("set title for terminal window (curses GUI) with name & version"), +{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"), + N_("set title for window (terminal for Curses GUI) with name & version"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_set_title, NULL, NULL }, + NULL, NULL, &cfg_look_set_title, NULL, config_change_title }, { "look_startup_logo", N_("display WeeChat logo at startup"), N_("display WeeChat logo at startup"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_startup_logo, NULL, NULL }, + NULL, NULL, &cfg_look_startup_logo, NULL, config_change_noop }, { "look_startup_version", N_("display WeeChat version at startup"), N_("display WeeChat version at startup"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_startup_version, NULL, NULL }, + NULL, NULL, &cfg_look_startup_version, NULL, config_change_noop }, { "look_weechat_slogan", N_("WeeChat slogan"), N_("WeeChat slogan (if empty, slogan is not used)"), OPTION_TYPE_STRING, 0, 0, 0, - "the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, NULL }, + "the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop }, { "look_color_nicks", N_("display nick names with different colors"), N_("display nick names with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_color_nicks, NULL, NULL }, + NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop }, { "look_color_actions", N_("display actions with different colors"), N_("display actions with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_color_actions, NULL, NULL }, + NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop }, { "look_remove_colors_from_msgs", N_("remove colors from incoming messages"), N_("remove colors from incoming messages"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, NULL }, + NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop }, { "look_nicklist", N_("display nicklist window"), N_("display nicklist window (for channel windows)"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_nicklist, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows }, { "look_nicklist_position", N_("nicklist position"), N_("nicklist position (top, left, right (default), bottom)"), OPTION_TYPE_INT_WITH_STRING, 0, 0, 0, - "right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, NULL }, + "right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows }, { "look_nicklist_min_size", N_("min size for nicklist"), N_("min size for nicklist (width or height, depending on look_nicklist_position " "(0 = no min size))"), OPTION_TYPE_INT, 0, 100, 0, - NULL, NULL, &cfg_look_nicklist_min_size, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows }, { "look_nicklist_max_size", N_("max size for nicklist"), N_("max size for nicklist (width or height, depending on look_nicklist_position " "(0 = no max size; if min == max and > 0, then size is fixed))"), OPTION_TYPE_INT, 0, 100, 0, - NULL, NULL, &cfg_look_nicklist_max_size, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows }, { "look_no_nickname", N_("text to display instead of nick when not connected"), N_("text to display instead of nick when not connected"), OPTION_TYPE_STRING, 0, 0, 0, - "-cmd-", NULL, NULL, &cfg_look_no_nickname, NULL }, + "-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content }, { "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"), N_("display nick mode ((half)op/voice) before each nick"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_nickmode, NULL, NULL }, + NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows }, { "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"), N_("display space if nick mode is not (half)op/voice"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, - NULL, NULL, &cfg_look_nickmode_empty, NULL, NULL }, + NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows }, { "look_nick_completor", N_("the string inserted after nick completion"), N_("the string inserted after nick completion"), OPTION_TYPE_STRING, 0, 0, 0, - ":", NULL, NULL, &cfg_look_completor, NULL }, + ":", NULL, NULL, &cfg_look_completor, config_change_noop }, { "look_infobar", N_("enable info bar"), N_("enable info bar"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_infobar, NULL, NULL }, + NULL, NULL, &cfg_look_infobar, NULL, config_change_windows }, { "look_infobar_timestamp", N_("timestamp for time in infobar"), N_("timestamp for time in infobar"), OPTION_TYPE_STRING, 0, 0, 0, - "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL }, + "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content }, { "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"), N_("delay (in seconds) for highlight messages in infobar " "(0 = disable highlight notifications in infobar)"), OPTION_TYPE_INT, 0, INT_MAX, 7, - NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, NULL }, + NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop }, { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; @@ -198,149 +198,149 @@ t_config_option weechat_options_colors[] = { "col_title", N_("color for title bar"), N_("color for title bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_title, NULL, NULL }, + "gray", NULL, &cfg_col_title, NULL, &config_change_color }, { "col_title_bg", N_("background for title bar"), N_("background for title bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_title_bg, NULL, NULL }, + "blue", NULL, &cfg_col_title_bg, NULL, &config_change_color }, /* chat window */ { "col_chat", N_("color for chat text"), N_("color for chat text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat, NULL, NULL }, + "gray", NULL, &cfg_col_chat, NULL, &config_change_color }, { "col_chat_time", N_("color for time"), N_("color for time in chat window"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat_time, NULL, NULL }, + "gray", NULL, &cfg_col_chat_time, NULL, &config_change_color }, { "col_chat_time_sep", N_("color for time separator"), N_("color for time separator (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "brown", NULL, &cfg_col_chat_time_sep, NULL, NULL }, + "brown", NULL, &cfg_col_chat_time_sep, NULL, &config_change_color }, { "col_chat_prefix1", N_("color for 1st and 3rd char of prefix"), N_("color for 1st and 3rd char of prefix"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightcyan", NULL, &cfg_col_chat_prefix1, NULL, NULL }, + "lightcyan", NULL, &cfg_col_chat_prefix1, NULL, &config_change_color }, { "col_chat_prefix2", N_("color for middle char of prefix"), N_("color for middle char of prefix"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_chat_prefix2, NULL, NULL }, + "white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color }, { "col_chat_nick", N_("color for nicks in actions"), N_("color for nicks in actions (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightcyan", NULL, &cfg_col_chat_nick, NULL, NULL }, + "lightcyan", NULL, &cfg_col_chat_nick, NULL, &config_change_color }, { "col_chat_host", N_("color for hostnames"), N_("color for hostnames (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "cyan", NULL, &cfg_col_chat_host, NULL, NULL }, + "cyan", NULL, &cfg_col_chat_host, NULL, &config_change_color }, { "col_chat_channel", N_("color for channel names in actions"), N_("color for channel names in actions (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_chat_channel, NULL, NULL }, + "white", NULL, &cfg_col_chat_channel, NULL, &config_change_color }, { "col_chat_dark", N_("color for dark separators"), N_("color for dark separators (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "green", NULL, &cfg_col_chat_dark, NULL, NULL }, + "green", NULL, &cfg_col_chat_dark, NULL, &config_change_color }, { "col_chat_highlight", N_("color for highlighted nick"), N_("color for highlighted nick (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_chat_highlight, NULL, NULL }, + "yellow", NULL, &cfg_col_chat_highlight, NULL, &config_change_color }, { "col_chat_bg", N_("background for chat"), N_("background for chat window"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_chat_bg, NULL, NULL }, + "default", NULL, &cfg_col_chat_bg, NULL, &config_change_color }, /* status window */ { "col_status", N_("color for status bar"), N_("color for status bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_status, NULL, NULL }, + "gray", NULL, &cfg_col_status, NULL, &config_change_color }, { "col_status_active", N_("color for active window"), N_("color for active window (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_status_active, NULL, NULL }, + "yellow", NULL, &cfg_col_status_active, NULL, &config_change_color }, { "col_status_data_msg", N_("color for window with new messages"), N_("color for window with new messages (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightred", NULL, &cfg_col_status_data_msg, NULL, NULL }, + "lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color }, { "col_status_data_other", N_("color for window with new data (not messages)"), N_("color for window with new data (not messages) (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightmagenta", NULL, &cfg_col_status_data_other, NULL, NULL }, + "lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color }, { "col_status_more", N_("color for \"*MORE*\" text"), N_("color for window with new data (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_status_more, NULL, NULL }, + "white", NULL, &cfg_col_status_more, NULL, &config_change_color }, { "col_status_bg", N_("background for status window"), N_("background for status window"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_status_bg, NULL, NULL }, + "blue", NULL, &cfg_col_status_bg, NULL, &config_change_color }, /* infobar window */ { "col_infobar", N_("color for info bar text"), N_("color for info bar text"), OPTION_TYPE_COLOR, 0, 0, 0, - "black", NULL, &cfg_col_infobar, NULL, NULL }, + "black", NULL, &cfg_col_infobar, NULL, &config_change_color }, { "col_infobar_highlight", N_("color for info bar highlight notification"), N_("color for info bar highlight notification"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_infobar_highlight, NULL, NULL }, + "white", NULL, &cfg_col_infobar_highlight, NULL, &config_change_color }, { "col_infobar_bg", N_("background for info bar window"), N_("background for info bar window"), OPTION_TYPE_COLOR, 0, 0, 0, - "cyan", NULL, &cfg_col_infobar_bg, NULL, NULL }, + "cyan", NULL, &cfg_col_infobar_bg, NULL, &config_change_color }, /* input window */ { "col_input", N_("color for input text"), N_("color for input text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_input, NULL, NULL }, + "gray", NULL, &cfg_col_input, NULL, &config_change_color }, { "col_input_channel", N_("color for input text (channel name)"), N_("color for input text (channel name)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_input_channel, NULL, NULL }, + "white", NULL, &cfg_col_input_channel, NULL, &config_change_color }, { "col_input_nick", N_("color for input text (nick name)"), N_("color for input text (nick name)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightgreen", NULL, &cfg_col_input_nick, NULL, NULL }, + "lightgreen", NULL, &cfg_col_input_nick, NULL, &config_change_color }, { "col_input_bg", N_("background for input window"), N_("background for input window"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_input_bg, NULL, NULL }, + "default", NULL, &cfg_col_input_bg, NULL, &config_change_color }, /* nick window */ { "col_nick", N_("color for nicknames"), N_("color for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick, NULL, NULL }, + "gray", NULL, &cfg_col_nick, NULL, &config_change_color }, { "col_nick_op", N_("color for operator symbol"), N_("color for operator symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightgreen", NULL, &cfg_col_nick_op, NULL, NULL }, + "lightgreen", NULL, &cfg_col_nick_op, NULL, &config_change_color }, { "col_nick_halfop", N_("color for half-operator symbol"), N_("color for half-operator symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightmagenta", NULL, &cfg_col_nick_halfop, NULL, NULL }, + "lightmagenta", NULL, &cfg_col_nick_halfop, NULL, &config_change_color }, { "col_nick_voice", N_("color for voice symbol"), N_("color for voice symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_nick_voice, NULL, NULL }, + "yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color }, { "col_nick_sep", N_("color for nick separator"), N_("color for nick separator"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_nick_sep, NULL, NULL }, + "blue", NULL, &cfg_col_nick_sep, NULL, &config_change_color }, { "col_nick_self", N_("color for local nick"), N_("color for local nick"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_nick_self, NULL, NULL }, + "white", NULL, &cfg_col_nick_self, NULL, &config_change_color }, { "col_nick_private", N_("color for other nick in private window"), N_("color for other nick in private window"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick_private, NULL, NULL }, + "gray", NULL, &cfg_col_nick_private, NULL, &config_change_color }, { "col_nick_bg", N_("background for nicknames"), N_("background for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_nick_bg, NULL, NULL }, + "default", NULL, &cfg_col_nick_bg, NULL, &config_change_color }, { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; @@ -569,6 +569,83 @@ get_pos_array_values (char **array, char *string) } /* + * config_get_section: get section name from option pointer + */ + +char * +config_get_section (t_config_option *ptr_option) +{ + int i, j; + + for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) + { + if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER)) + { + for (j = 0; weechat_options[i][j].option_name; j++) + { + /* if option found, return pointer to section name */ + if (ptr_option == &weechat_options[i][j]) + return config_sections[i].section_name; + } + } + } + /* option not found */ + return NULL; +} + +/* + * config_change_noop: called when an option is changed by /set command + * and that no special action is needed after that + */ + +void +config_change_noop () +{ + /* do nothing */ +} + +/* + * config_change_title: called when title is changed + */ + +void +config_change_title () +{ + gui_set_window_title (); +} + +/* + * config_change_windows: called when windows change (for example nicklist) + */ + +void +config_change_windows () +{ + gui_switch_to_window (gui_current_window); + gui_redraw_window (gui_current_window); +} + +/* + * config_change_window_content: called when content of a window changes + */ + +void +config_change_window_content () +{ + gui_redraw_window (gui_current_window); +} + +/* + * config_change_color: called when a color is changed by /set command + */ + +void +config_change_color() +{ + gui_init_colors (); +} + +/* * config_option_set_value: set new value for an option * return: 0 if success * -1 if error (bad value) @@ -615,14 +692,12 @@ config_option_set_value (t_config_option *option, char *value) } /* - * config_set_value: set new value for an option (found by name) - * return: 0 if success - * -1 if bad value for option - * -2 if option is not found + * config_option_search: look for an option and return pointer to this option + * if option is not found, NULL is returned */ -int -config_set_value (char *option_name, char *value) +t_config_option * +config_option_search (char *option_name) { int i, j; @@ -632,14 +707,33 @@ config_set_value (char *option_name, char *value) { for (j = 0; weechat_options[i][j].option_name; j++) { - /* if option found, assign value and exit */ + /* if option found, return pointer */ if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0) - return config_option_set_value (&weechat_options[i][j], value); + return &weechat_options[i][j]; } } } /* option not found */ - return -2; + return NULL; +} + +/* + * config_set_value: set new value for an option (found by name) + * return: 0 if success + * -1 if bad value for option + * -2 if option is not found + */ + +int +config_set_value (char *option_name, char *value) +{ + t_config_option *ptr_option; + + ptr_option = config_option_search (option_name); + if (ptr_option) + return config_option_set_value (ptr_option, value); + else + return -2; } /* diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h index 1b96f0e36..daea3c90a 100644 --- a/src/common/weeconfig.h +++ b/src/common/weeconfig.h @@ -70,7 +70,7 @@ struct t_config_option char **array_values; int *ptr_int; char **ptr_string; - int (*handler_change)(int *, char **); + void (*handler_change)(); }; extern int cfg_look_set_title; @@ -155,6 +155,15 @@ extern char *cfg_proxy_password; extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS]; extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS]; +extern char *config_get_section (); +extern void config_change_noop (); +extern void config_change_title (); +extern void config_change_windows (); +extern void config_change_window_content (); +extern void config_change_color (); +extern int config_option_set_value (t_config_option *, char *); +extern t_config_option *config_option_search (char *); +extern int config_set_value (char *, char *); extern int config_read (); extern int config_create_default (); extern int config_write (); diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 0ad260973..d82f56465 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -182,7 +182,7 @@ gui_calculate_pos_size (t_gui_window *window) /* init chat & nicklist settings */ /* TODO: calculate values from function parameters */ - if (WIN_IS_CHANNEL(window)) + if (cfg_look_nicklist && WIN_IS_CHANNEL(window)) { max_length = nick_get_max_length (CHANNEL(window)); @@ -1147,13 +1147,16 @@ gui_switch_to_window (t_gui_window *window) window->win_status = ptr_win->win_status; window->win_infobar = ptr_win->win_infobar; window->win_input = ptr_win->win_input; - ptr_win->win_title = NULL; - ptr_win->win_chat = NULL; - ptr_win->win_nick = NULL; - ptr_win->win_status = NULL; - ptr_win->win_infobar = NULL; - ptr_win->win_input = NULL; - ptr_win->is_displayed = 0; + if (ptr_win != window) + { + ptr_win->win_title = NULL; + ptr_win->win_chat = NULL; + ptr_win->win_nick = NULL; + ptr_win->win_status = NULL; + ptr_win->win_infobar = NULL; + ptr_win->win_input = NULL; + ptr_win->is_displayed = 0; + } break; } } @@ -1169,46 +1172,52 @@ gui_switch_to_window (t_gui_window *window) window->win_chat_width, window->win_chat_y, window->win_chat_x); - if (CHANNEL(window)) + if (cfg_look_nicklist && CHANNEL(window)) window->win_nick = newwin (window->win_nick_height, window->win_nick_width, window->win_nick_y, window->win_nick_x); else window->win_nick = NULL; - if (cfg_look_infobar) - { - window->win_infobar = newwin (1, COLS, LINES - 2, 0); - window->win_status = newwin (1, COLS, LINES - 3, 0); - } - else - window->win_status = newwin (1, COLS, LINES - 2, 0); window->win_input = newwin (1, COLS, LINES - 1, 0); } else { - /* create chat & nick windows */ + /* remove some windows */ + if (window->win_nick) + { + delwin (window->win_nick); + window->win_nick = NULL; + } + if (window->win_status) + { + delwin (window->win_status); + window->win_status = NULL; + } + if (window->win_infobar) + { + delwin (window->win_infobar); + window->win_infobar = NULL; + } + + /* create windows */ if (WIN_IS_CHANNEL(window)) { - /* (re)create nicklist window */ - if (window->win_nick) - delwin (window->win_nick); delwin (window->win_chat); window->win_chat = newwin (window->win_chat_height, window->win_chat_width, window->win_chat_y, window->win_chat_x); - window->win_nick = newwin (window->win_nick_height, - window->win_nick_width, - window->win_nick_y, - window->win_nick_x); + if (cfg_look_nicklist) + window->win_nick = newwin (window->win_nick_height, + window->win_nick_width, + window->win_nick_y, + window->win_nick_x); + else + window->win_nick = NULL; } if (!(WIN_IS_CHANNEL(window))) { - /* remove nick list window */ - if (window->win_nick) - delwin (window->win_nick); - window->win_nick = NULL; delwin (window->win_chat); window->win_chat = newwin (window->win_chat_height, window->win_chat_width, @@ -1217,6 +1226,15 @@ gui_switch_to_window (t_gui_window *window) } } + /* create status/infobar windows */ + if (cfg_look_infobar) + { + window->win_infobar = newwin (1, COLS, LINES - 2, 0); + window->win_status = newwin (1, COLS, LINES - 3, 0); + } + else + window->win_status = newwin (1, COLS, LINES - 2, 0); + /* change current window to the new window */ gui_current_window = window; @@ -1477,6 +1495,20 @@ gui_init_colors () } /* + * gui_set_window_title: set terminal title + */ + +void +gui_set_window_title () +{ + #ifdef __linux__ + /* set title for term window, not for console */ + if (strcmp (getenv ("TERM"), "linux") != 0) + printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a"); + #endif +} + +/* * gui_init: init GUI */ @@ -1500,11 +1532,8 @@ gui_init () signal (SIGWINCH, gui_curses_resize_handler); - #ifdef __linux__ - /* set title for term window, not for console */ - if (cfg_look_set_title && (strcmp (getenv ("TERM"), "linux") != 0)) - printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a"); - #endif + if (cfg_look_set_title) + gui_set_window_title (); gui_ready = 1; } diff --git a/src/gui/gtk/gui-display.c b/src/gui/gtk/gui-display.c index c39f6ecb5..f86ee8af9 100644 --- a/src/gui/gtk/gui-display.c +++ b/src/gui/gtk/gui-display.c @@ -600,6 +600,16 @@ gui_init_colors () } /* + * gui_set_window_title: set window title + */ + +void +gui_set_window_title () +{ + /* TODO: set window title for Gtk */ +} + +/* * gui_init: init GUI */ diff --git a/src/gui/gui.h b/src/gui/gui.h index af6aca5ec..019acc00d 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -241,7 +241,8 @@ extern void gui_move_page_up (); extern void gui_move_page_down (); extern void gui_window_init_subwindows (t_gui_window *); extern void gui_pre_init (int *, char **[]); -//extern void gui_init_colors (); +extern void gui_init_colors (); +extern void gui_set_window_title (); extern void gui_init (); extern void gui_window_free (t_gui_window *); extern void gui_end (); diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index 873c3f501..289d98ffb 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -361,7 +361,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg) if (!message) { gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); return; } @@ -372,7 +372,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg) strlen (msg) + 1); if (!message->data) gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); else { @@ -426,7 +426,7 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer) strlen (buffer) + 1); if (!unterminated_message) gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); else strcpy (unterminated_message, buffer); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 3dbf9a8e9..f533c0ac7 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2004-01-24 Version 0.0.5 (under dev!): + * /set command to modify config options when WeeChat is running * secured code to prevent buffer overflows and memory leaks * fixed QUIT IRC command: now sent to all connected servers (not only current) * new Perl script function to display message in info bar ("IRC::print_infobar") diff --git a/weechat/TODO b/weechat/TODO index 7c7673427..9e6f21e72 100644 --- a/weechat/TODO +++ b/weechat/TODO @@ -1,7 +1,7 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -TODO - 2004-01-18 +TODO - 2004-01-24 Legend: # done @@ -17,9 +17,15 @@ v0.0.5: # debug messages can be enabled via ./configure --enbale-debug option + Solaris version + * WeeChat commands: + # "/set" command: allow the user to set the WeeChat variables + under WeeChat without editing the config file (colors, time + format, etc) + * Interface: + internationalization (traduce WeeChat in many languages) - + info bar + # info bar + # add clock * Configuration: + add missing options for config file @@ -46,9 +52,6 @@ Future versions: nick/host connect to the given irc network * WeeChat commands: - + "/set" command: allow the user to set the WeeChat variables - under WeeChat without editing the config file (colours, time - format, etc) - "/reload" command: reload the WeeChat's config file - "/highlight" command: highlight a given word when it appears on channels/privates @@ -69,7 +72,6 @@ Future versions: if WeeChat is running for long time, a lot of memory is used!) - improve completion (for example complete command parameters when possible) - understand incomplete commands if unambigous (for example: /he for /help is ok) - - add clock (in status bar?) - log chats to file ? Qt GUI diff --git a/weechat/configure.in b/weechat/configure.in index 519dec1ac..0d208792b 100644 --- a/weechat/configure.in +++ b/weechat/configure.in @@ -19,10 +19,10 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.56) -AC_INIT(WeeChat, 0.0.5-pre2, flashcode@flashtux.org) +AC_INIT(WeeChat, 0.0.5-pre3, flashcode@flashtux.org) AC_CONFIG_SRCDIR([src/common/weechat.c]) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE([weechat], [0.0.5-pre2]) +AM_INIT_AUTOMAKE([weechat], [0.0.5-pre3]) # Checks for programs. AC_PROG_CC diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 1dd790061..20b6812ea 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: WeeChat 0.0.5-pre2\n" +"Project-Id-Version: WeeChat 0.0.5-pre3\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2004-01-24 03:16+0100\n" -"PO-Revision-Date: 2004-01-01 11:52+0100\n" +"POT-Creation-Date: 2004-01-24 20:57+0100\n" +"PO-Revision-Date: 2004-01-24 20:57+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -30,71 +30,76 @@ msgstr "%s impossible d'allouer un nouveau serveur\n" msgid "%s error sending data to IRC server\n" msgstr "%s erreur d'envoi de données au serveur IRC\n" -#: src/irc/irc-server.c:417 +#: src/irc/irc-server.c:364 src/irc/irc-server.c:375 src/irc/irc-server.c:429 +#, c-format +msgid "%s not enough memory for received IRC message\n" +msgstr "%s mémoire insuffisante pour un message IRC reçu\n" + +#: src/irc/irc-server.c:436 #, c-format msgid "%s unable to explode received buffer\n" msgstr "%s impossible d'exploser le tampon de réception\n" -#: src/irc/irc-server.c:490 +#: src/irc/irc-server.c:509 #, c-format msgid "Command '%s' failed!\n" msgstr "La commande '%s' a échoué !\n" -#: src/irc/irc-server.c:494 +#: src/irc/irc-server.c:513 msgid "No command to execute!\n" msgstr "Pas de commande à exécuter !\n" -#: src/irc/irc-server.c:498 +#: src/irc/irc-server.c:517 #, c-format msgid "Unknown command: cmd=%s, args=%s\n" msgstr "Commande inconnue: cmd=%s, params=%s\n" -#: src/irc/irc-server.c:548 +#: src/irc/irc-server.c:569 #, c-format msgid "%s: connecting to %s:%d...\n" msgstr "%s: connexion à %s:%d...\n" -#: src/irc/irc-server.c:550 +#: src/irc/irc-server.c:571 #, c-format msgid "connecting to server %s:%d...\n" msgstr "connexion au serveur %s:%d...\n" -#: src/irc/irc-server.c:558 +#: src/irc/irc-server.c:579 #, c-format msgid "%s cannot create pipe\n" msgstr "%s impossible de créer le pipe\n" -#: src/irc/irc-server.c:572 +#: src/irc/irc-server.c:593 #, c-format msgid "%s cannot set socket option \"SO_REUSEADDR\"\n" msgstr "%s impossible de paramétrer l'option socket \"SO_REUSEADDR\"\n" -#: src/irc/irc-server.c:579 +#: src/irc/irc-server.c:600 #, c-format msgid "%s cannot set socket option \"SO_KEEPALIVE\"\n" msgstr "%s impossible de paramétrer l'option socket \"SO_KEEPALIVE\"\n" -#: src/irc/irc-server.c:587 +#: src/irc/irc-server.c:608 #, c-format msgid "%s address \"%s\" not found\n" msgstr "%s adresse \"%s\" introuvable\n" -#: src/irc/irc-server.c:610 +#: src/irc/irc-server.c:631 #, c-format msgid "%s IP address not found\n" msgstr "%s adresse IP introuvable\n" -#: src/irc/irc-server.c:620 +#: src/irc/irc-server.c:641 #, c-format msgid "%s: server IP is: %s\n" msgstr "%s: l'adresse IP du serveur est : %s\n" -#: src/irc/irc-server.c:626 +#: src/irc/irc-server.c:647 #, c-format msgid "%s cannot connect to irc server\n" msgstr "%s connexion au serveur irc impossible\n" -#: src/irc/irc-server.c:676 +#: src/irc/irc-server.c:697 msgid "Disconnected from server!\n" msgstr "Déconnecté du serveur !\n" @@ -1547,12 +1552,12 @@ msgstr "déchargement du script Perl \"%s\"\n" msgid "unloading all Perl scripts...\n" msgstr "déchargement de tous les scripts Perl...\n" -#: src/plugins/plugins.c:87 +#: src/plugins/plugins.c:89 #, c-format msgid "auto-loading %s script: %s%s%s\n" msgstr "chargement automatique du script %s : %s%s%s\n" -#: src/plugins/plugins.c:193 +#: src/plugins/plugins.c:195 #, c-format msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" @@ -1567,7 +1572,7 @@ msgstr "[non connecté] " msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/gtk/gui-display.c:647 +#: src/gui/gtk/gui-display.c:657 msgid "server" msgstr "serveur" @@ -2069,16 +2074,46 @@ msgstr "créé\n" msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1529 +#: src/common/command.c:1490 +#, c-format +msgid "%s option '%s' can not be changed while WeeChat is running\n" +msgstr "%s l'option '%s' ne peut pas être changée lorsque WeeChat tourne\n" + +#: src/common/command.c:1502 +#, c-format +msgid "%s incorrect value for option '%s'\n" +msgstr "%s valeur incorrecte pour l'option '%s'\n" + +#: src/common/command.c:1508 +#, c-format +msgid "%s config option '%s' not found\n" +msgstr "%s option de configuration '%s' non trouvée\n" + +#: src/common/command.c:1558 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1562 +#: src/common/command.c:1578 src/common/command.c:1581 +#, c-format +msgid "No config option found with '%s'\n" +msgstr "Aucune option de configuration trouvée avec '%s'\n" + +#: src/common/command.c:1586 +#, c-format +msgid "%d config option(s) found with '%s'\n" +msgstr "%d option(s) de configuration trouvées avec '%s'\n" + +#: src/common/command.c:1589 +#, c-format +msgid "%d config option(s) found\n" +msgstr "%d option(s) de configuration trouvées\n" + +#: src/common/command.c:1609 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1571 +#: src/common/command.c:1618 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" @@ -2209,10 +2244,10 @@ msgid " Warning:" msgstr " Attention:" #: src/common/weeconfig.c:81 src/common/weeconfig.c:82 -msgid "set title for terminal window (curses GUI) with name & version" +msgid "set title for window (terminal for Curses GUI) with name & version" msgstr "" -"définit le titre de la fenêtre de terminal (GUI curses) avec le nom et la " -"version" +"définit le titre de la fenêtre (terminal pour l'interface Curses) avec le " +"nom et la version" #: src/common/weeconfig.c:85 src/common/weeconfig.c:86 msgid "display WeeChat logo at startup" @@ -2800,57 +2835,57 @@ msgstr "" "liste des canaux (séparés par des virgules) à rejoindre lorsque connecté au " "serveur" -#: src/common/weeconfig.c:663 +#: src/common/weeconfig.c:757 #, c-format msgid "%s %s, line %d: new server, but previous was incomplete\n" msgstr "%s %s, ligne %d: nouveau serveur, mais le précédent était incomplet\n" -#: src/common/weeconfig.c:672 +#: src/common/weeconfig.c:766 #, c-format msgid "%s %s, line %d: server '%s' already exists\n" msgstr "%s %s, ligne %d: le serveur '%s' existe déjà\n" -#: src/common/weeconfig.c:684 +#: src/common/weeconfig.c:778 #, c-format msgid "%s %s, line %d: unable to create server\n" msgstr "%s %s, ligne %d: impossible de créer le serveur\n" -#: src/common/weeconfig.c:723 +#: src/common/weeconfig.c:817 #, c-format msgid "%s unable to assign default int with string (\"%s\")\n" msgstr "%s impossible d'assigner la valeur entière avec la chaîne (\"%s\")\n" -#: src/common/weeconfig.c:734 +#: src/common/weeconfig.c:828 #, c-format msgid "%s unable to assign default color (\"%s\")\n" msgstr "%s impossible d'assigner la couleur par défaut (\"%s\")\n" -#: src/common/weeconfig.c:773 +#: src/common/weeconfig.c:867 #, c-format msgid "%s config file \"%s\" not found.\n" msgstr "%s fichier de configuration \"%s\" non trouvé.\n" -#: src/common/weeconfig.c:805 +#: src/common/weeconfig.c:899 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"]\"\n" msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"]\"\n" -#: src/common/weeconfig.c:822 +#: src/common/weeconfig.c:916 #, c-format msgid "%s %s, line %d: unknown section identifier (\"%s\")\n" msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n" -#: src/common/weeconfig.c:840 +#: src/common/weeconfig.c:934 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"=\"\n" -#: src/common/weeconfig.c:874 +#: src/common/weeconfig.c:968 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "%s %s, ligne %d: option \"%s\" invalide\n" -#: src/common/weeconfig.c:885 +#: src/common/weeconfig.c:979 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" @@ -2859,7 +2894,7 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: valeur booléenne: 'off' ou 'on'\n" -#: src/common/weeconfig.c:894 +#: src/common/weeconfig.c:988 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -2868,7 +2903,7 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: entier compris entre %d et %d\n" -#: src/common/weeconfig.c:905 +#: src/common/weeconfig.c:999 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -2877,26 +2912,26 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: une de ces chaînes: " -#: src/common/weeconfig.c:921 +#: src/common/weeconfig.c:1015 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "%s %s, ligne %d: nom de couleur invalide pour l'option '%s'\n" -#: src/common/weeconfig.c:980 src/common/weeconfig.c:1147 +#: src/common/weeconfig.c:1074 src/common/weeconfig.c:1241 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "%s impossible de créer le fichier \"%s\"\n" -#: src/common/weeconfig.c:986 +#: src/common/weeconfig.c:1080 #, c-format msgid "%s: creating default config file...\n" msgstr "%s: création du fichier de configuration par défaut...\n" -#: src/common/weeconfig.c:987 +#: src/common/weeconfig.c:1081 msgid "creating default config file\n" msgstr "création du fichier de configuration par défaut\n" -#: src/common/weeconfig.c:990 src/common/weeconfig.c:1156 +#: src/common/weeconfig.c:1084 src/common/weeconfig.c:1250 #, c-format msgid "" "#\n" @@ -2905,10 +2940,10 @@ msgstr "" "#\n" "# %s: fichier de configuration, créé par %s v%s le %s#\n" -#: src/common/weeconfig.c:1098 +#: src/common/weeconfig.c:1192 msgid "Unable to get user's name" msgstr "Impossible de déterminer le nom d'utilisateur" -#: src/common/weeconfig.c:1153 +#: src/common/weeconfig.c:1247 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot index e6564d936..663a643f1 100644 --- a/weechat/po/weechat.pot +++ b/weechat/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2004-01-24 03:16+0100\n" +"POT-Creation-Date: 2004-01-24 20:57+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" @@ -30,71 +30,76 @@ msgstr "" msgid "%s error sending data to IRC server\n" msgstr "" -#: src/irc/irc-server.c:417 +#: src/irc/irc-server.c:364 src/irc/irc-server.c:375 src/irc/irc-server.c:429 +#, c-format +msgid "%s not enough memory for received IRC message\n" +msgstr "" + +#: src/irc/irc-server.c:436 #, c-format msgid "%s unable to explode received buffer\n" msgstr "" -#: src/irc/irc-server.c:490 +#: src/irc/irc-server.c:509 #, c-format msgid "Command '%s' failed!\n" msgstr "" -#: src/irc/irc-server.c:494 +#: src/irc/irc-server.c:513 msgid "No command to execute!\n" msgstr "" -#: src/irc/irc-server.c:498 +#: src/irc/irc-server.c:517 #, c-format msgid "Unknown command: cmd=%s, args=%s\n" msgstr "" -#: src/irc/irc-server.c:548 +#: src/irc/irc-server.c:569 #, c-format msgid "%s: connecting to %s:%d...\n" msgstr "" -#: src/irc/irc-server.c:550 +#: src/irc/irc-server.c:571 #, c-format msgid "connecting to server %s:%d...\n" msgstr "" -#: src/irc/irc-server.c:558 +#: src/irc/irc-server.c:579 #, c-format msgid "%s cannot create pipe\n" msgstr "" -#: src/irc/irc-server.c:572 +#: src/irc/irc-server.c:593 #, c-format msgid "%s cannot set socket option \"SO_REUSEADDR\"\n" msgstr "" -#: src/irc/irc-server.c:579 +#: src/irc/irc-server.c:600 #, c-format msgid "%s cannot set socket option \"SO_KEEPALIVE\"\n" msgstr "" -#: src/irc/irc-server.c:587 +#: src/irc/irc-server.c:608 #, c-format msgid "%s address \"%s\" not found\n" msgstr "" -#: src/irc/irc-server.c:610 +#: src/irc/irc-server.c:631 #, c-format msgid "%s IP address not found\n" msgstr "" -#: src/irc/irc-server.c:620 +#: src/irc/irc-server.c:641 #, c-format msgid "%s: server IP is: %s\n" msgstr "" -#: src/irc/irc-server.c:626 +#: src/irc/irc-server.c:647 #, c-format msgid "%s cannot connect to irc server\n" msgstr "" -#: src/irc/irc-server.c:676 +#: src/irc/irc-server.c:697 msgid "Disconnected from server!\n" msgstr "" @@ -1445,12 +1450,12 @@ msgstr "" msgid "unloading all Perl scripts...\n" msgstr "" -#: src/plugins/plugins.c:87 +#: src/plugins/plugins.c:89 #, c-format msgid "auto-loading %s script: %s%s%s\n" msgstr "" -#: src/plugins/plugins.c:193 +#: src/plugins/plugins.c:195 #, c-format msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" @@ -1463,7 +1468,7 @@ msgstr "" msgid "-MORE-" msgstr "" -#: src/gui/gtk/gui-display.c:647 +#: src/gui/gtk/gui-display.c:657 msgid "server" msgstr "" @@ -1935,16 +1940,46 @@ msgstr "" msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1529 +#: src/common/command.c:1490 +#, c-format +msgid "%s option '%s' can not be changed while WeeChat is running\n" +msgstr "" + +#: src/common/command.c:1502 +#, c-format +msgid "%s incorrect value for option '%s'\n" +msgstr "" + +#: src/common/command.c:1508 +#, c-format +msgid "%s config option '%s' not found\n" +msgstr "" + +#: src/common/command.c:1558 msgid "(unknown)" msgstr "" -#: src/common/command.c:1562 +#: src/common/command.c:1578 src/common/command.c:1581 +#, c-format +msgid "No config option found with '%s'\n" +msgstr "" + +#: src/common/command.c:1586 +#, c-format +msgid "%d config option(s) found with '%s'\n" +msgstr "" + +#: src/common/command.c:1589 +#, c-format +msgid "%d config option(s) found\n" +msgstr "" + +#: src/common/command.c:1609 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1571 +#: src/common/command.c:1618 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" @@ -2067,7 +2102,7 @@ msgid " Warning:" msgstr "" #: src/common/weeconfig.c:81 src/common/weeconfig.c:82 -msgid "set title for terminal window (curses GUI) with name & version" +msgid "set title for window (terminal for Curses GUI) with name & version" msgstr "" #: src/common/weeconfig.c:85 src/common/weeconfig.c:86 @@ -2615,107 +2650,107 @@ msgstr "" msgid "comma separated list of channels to join when connected to server" msgstr "" -#: src/common/weeconfig.c:663 +#: src/common/weeconfig.c:757 #, c-format msgid "%s %s, line %d: new server, but previous was incomplete\n" msgstr "" -#: src/common/weeconfig.c:672 +#: src/common/weeconfig.c:766 #, c-format msgid "%s %s, line %d: server '%s' already exists\n" msgstr "" -#: src/common/weeconfig.c:684 +#: src/common/weeconfig.c:778 #, c-format msgid "%s %s, line %d: unable to create server\n" msgstr "" -#: src/common/weeconfig.c:723 +#: src/common/weeconfig.c:817 #, c-format msgid "%s unable to assign default int with string (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:734 +#: src/common/weeconfig.c:828 #, c-format msgid "%s unable to assign default color (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:773 +#: src/common/weeconfig.c:867 #, c-format msgid "%s config file \"%s\" not found.\n" msgstr "" -#: src/common/weeconfig.c:805 +#: src/common/weeconfig.c:899 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"]\"\n" msgstr "" -#: src/common/weeconfig.c:822 +#: src/common/weeconfig.c:916 #, c-format msgid "%s %s, line %d: unknown section identifier (\"%s\")\n" msgstr "" -#: src/common/weeconfig.c:840 +#: src/common/weeconfig.c:934 #, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "" -#: src/common/weeconfig.c:874 +#: src/common/weeconfig.c:968 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:885 +#: src/common/weeconfig.c:979 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" "Expected: boolean value: 'off' or 'on'\n" msgstr "" -#: src/common/weeconfig.c:894 +#: src/common/weeconfig.c:988 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: integer between %d and %d\n" msgstr "" -#: src/common/weeconfig.c:905 +#: src/common/weeconfig.c:999 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: one of these strings: " msgstr "" -#: src/common/weeconfig.c:921 +#: src/common/weeconfig.c:1015 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "" -#: src/common/weeconfig.c:980 src/common/weeconfig.c:1147 +#: src/common/weeconfig.c:1074 src/common/weeconfig.c:1241 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:986 +#: src/common/weeconfig.c:1080 #, c-format msgid "%s: creating default config file...\n" msgstr "" -#: src/common/weeconfig.c:987 +#: src/common/weeconfig.c:1081 msgid "creating default config file\n" msgstr "" -#: src/common/weeconfig.c:990 src/common/weeconfig.c:1156 +#: src/common/weeconfig.c:1084 src/common/weeconfig.c:1250 #, c-format msgid "" "#\n" "# %s configuration file, created by %s v%s on %s#\n" msgstr "" -#: src/common/weeconfig.c:1098 +#: src/common/weeconfig.c:1192 msgid "Unable to get user's name" msgstr "" -#: src/common/weeconfig.c:1153 +#: src/common/weeconfig.c:1247 msgid "saving config to disk\n" msgstr "" diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index da481ab71..3c10b170b 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -84,7 +84,7 @@ t_weechat_command weechat_commands[] = 0, 1, weechat_cmd_save, NULL }, { "set", N_("set config parameters"), N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"), - 0, 2, NULL, weechat_cmd_set }, + 0, MAX_ARGS, NULL, weechat_cmd_set }, { "unalias", N_("remove an alias"), N_("alias_name"), N_("alias_name: name of alias to remove"), 1, 1, NULL, weechat_cmd_unalias }, @@ -1461,6 +1461,8 @@ weechat_cmd_set (char *arguments) char *option, *value; int i, j, section_displayed; char *color_name; + t_config_option *ptr_option; + int number_found; option = NULL; value = NULL; @@ -1479,10 +1481,37 @@ weechat_cmd_set (char *arguments) if (value && value[0]) { - gui_printf (NULL, "TODO: set value!\n"); + ptr_option = config_option_search (option); + if (ptr_option) + { + if (ptr_option->handler_change == NULL) + { + gui_printf (NULL, + _("%s option '%s' can not be changed while WeeChat is running\n"), + WEECHAT_ERROR, option); + } + else + { + if (config_option_set_value (ptr_option, value) == 0) + { + (void) (ptr_option->handler_change()); + gui_printf (NULL, "[%s]\n", config_get_section (ptr_option)); + gui_printf (NULL, " %s = %s\n", option, value); + } + else + gui_printf (NULL, _("%s incorrect value for option '%s'\n"), + WEECHAT_ERROR, option); + } + } + else + { + gui_printf (NULL, _("%s config option '%s' not found\n"), + WEECHAT_ERROR, option); + } } else { + number_found = 0; for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) { section_displayed = 0; @@ -1503,45 +1532,63 @@ weechat_cmd_set (char *arguments) } switch (weechat_options[i][j].option_type) { - case OPTION_TYPE_BOOLEAN: - gui_printf (NULL, " %s = %s\n", - weechat_options[i][j].option_name, - (*weechat_options[i][j].ptr_int) ? - "ON" : "OFF"); - break; - case OPTION_TYPE_INT: - gui_printf (NULL, - " %s = %d\n", - weechat_options[i][j].option_name, - *weechat_options[i][j].ptr_int); - break; - case OPTION_TYPE_INT_WITH_STRING: - gui_printf (NULL, - " %s = %s\n", - weechat_options[i][j].option_name, - weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]); - break; - case OPTION_TYPE_COLOR: - color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int); - gui_printf (NULL, - " %s = %s\n", - weechat_options[i][j].option_name, - (color_name) ? color_name : _("(unknown)")); - break; - case OPTION_TYPE_STRING: - gui_printf (NULL, " %s = %s\n", - weechat_options[i][j]. - option_name, - (*weechat_options[i][j]. - ptr_string) ? - *weechat_options[i][j]. - ptr_string : ""); - break; + case OPTION_TYPE_BOOLEAN: + gui_printf (NULL, " %s = %s\n", + weechat_options[i][j].option_name, + (*weechat_options[i][j].ptr_int) ? + "ON" : "OFF"); + break; + case OPTION_TYPE_INT: + gui_printf (NULL, + " %s = %d\n", + weechat_options[i][j].option_name, + *weechat_options[i][j].ptr_int); + break; + case OPTION_TYPE_INT_WITH_STRING: + gui_printf (NULL, + " %s = %s\n", + weechat_options[i][j].option_name, + weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]); + break; + case OPTION_TYPE_COLOR: + color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int); + gui_printf (NULL, + " %s = %s\n", + weechat_options[i][j].option_name, + (color_name) ? color_name : _("(unknown)")); + break; + case OPTION_TYPE_STRING: + gui_printf (NULL, " %s = %s\n", + weechat_options[i][j]. + option_name, + (*weechat_options[i][j]. + ptr_string) ? + *weechat_options[i][j]. + ptr_string : ""); + break; } + number_found++; } } } } + if (number_found == 0) + { + if (value) + gui_printf (NULL, _("No config option found with '%s'\n"), + value); + else + gui_printf (NULL, _("No config option found with '%s'\n")); + } + else + { + if (value) + gui_printf (NULL, _("%d config option(s) found with '%s'\n"), + number_found, value); + else + gui_printf (NULL, _("%d config option(s) found\n"), + number_found); + } } return 0; } diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index 3f92af312..a86145863 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -78,81 +78,81 @@ char *cfg_look_infobar_timestamp; int cfg_look_infobar_delay_highlight; t_config_option weechat_options_look[] = -{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"), - N_("set title for terminal window (curses GUI) with name & version"), +{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"), + N_("set title for window (terminal for Curses GUI) with name & version"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_set_title, NULL, NULL }, + NULL, NULL, &cfg_look_set_title, NULL, config_change_title }, { "look_startup_logo", N_("display WeeChat logo at startup"), N_("display WeeChat logo at startup"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_startup_logo, NULL, NULL }, + NULL, NULL, &cfg_look_startup_logo, NULL, config_change_noop }, { "look_startup_version", N_("display WeeChat version at startup"), N_("display WeeChat version at startup"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_startup_version, NULL, NULL }, + NULL, NULL, &cfg_look_startup_version, NULL, config_change_noop }, { "look_weechat_slogan", N_("WeeChat slogan"), N_("WeeChat slogan (if empty, slogan is not used)"), OPTION_TYPE_STRING, 0, 0, 0, - "the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, NULL }, + "the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop }, { "look_color_nicks", N_("display nick names with different colors"), N_("display nick names with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_color_nicks, NULL, NULL }, + NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop }, { "look_color_actions", N_("display actions with different colors"), N_("display actions with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_color_actions, NULL, NULL }, + NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop }, { "look_remove_colors_from_msgs", N_("remove colors from incoming messages"), N_("remove colors from incoming messages"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, NULL }, + NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop }, { "look_nicklist", N_("display nicklist window"), N_("display nicklist window (for channel windows)"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_nicklist, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows }, { "look_nicklist_position", N_("nicklist position"), N_("nicklist position (top, left, right (default), bottom)"), OPTION_TYPE_INT_WITH_STRING, 0, 0, 0, - "right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, NULL }, + "right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows }, { "look_nicklist_min_size", N_("min size for nicklist"), N_("min size for nicklist (width or height, depending on look_nicklist_position " "(0 = no min size))"), OPTION_TYPE_INT, 0, 100, 0, - NULL, NULL, &cfg_look_nicklist_min_size, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows }, { "look_nicklist_max_size", N_("max size for nicklist"), N_("max size for nicklist (width or height, depending on look_nicklist_position " "(0 = no max size; if min == max and > 0, then size is fixed))"), OPTION_TYPE_INT, 0, 100, 0, - NULL, NULL, &cfg_look_nicklist_max_size, NULL, NULL }, + NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows }, { "look_no_nickname", N_("text to display instead of nick when not connected"), N_("text to display instead of nick when not connected"), OPTION_TYPE_STRING, 0, 0, 0, - "-cmd-", NULL, NULL, &cfg_look_no_nickname, NULL }, + "-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content }, { "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"), N_("display nick mode ((half)op/voice) before each nick"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_nickmode, NULL, NULL }, + NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows }, { "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"), N_("display space if nick mode is not (half)op/voice"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE, - NULL, NULL, &cfg_look_nickmode_empty, NULL, NULL }, + NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows }, { "look_nick_completor", N_("the string inserted after nick completion"), N_("the string inserted after nick completion"), OPTION_TYPE_STRING, 0, 0, 0, - ":", NULL, NULL, &cfg_look_completor, NULL }, + ":", NULL, NULL, &cfg_look_completor, config_change_noop }, { "look_infobar", N_("enable info bar"), N_("enable info bar"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, - NULL, NULL, &cfg_look_infobar, NULL, NULL }, + NULL, NULL, &cfg_look_infobar, NULL, config_change_windows }, { "look_infobar_timestamp", N_("timestamp for time in infobar"), N_("timestamp for time in infobar"), OPTION_TYPE_STRING, 0, 0, 0, - "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, NULL }, + "%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content }, { "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"), N_("delay (in seconds) for highlight messages in infobar " "(0 = disable highlight notifications in infobar)"), OPTION_TYPE_INT, 0, INT_MAX, 7, - NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, NULL }, + NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop }, { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; @@ -198,149 +198,149 @@ t_config_option weechat_options_colors[] = { "col_title", N_("color for title bar"), N_("color for title bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_title, NULL, NULL }, + "gray", NULL, &cfg_col_title, NULL, &config_change_color }, { "col_title_bg", N_("background for title bar"), N_("background for title bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_title_bg, NULL, NULL }, + "blue", NULL, &cfg_col_title_bg, NULL, &config_change_color }, /* chat window */ { "col_chat", N_("color for chat text"), N_("color for chat text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat, NULL, NULL }, + "gray", NULL, &cfg_col_chat, NULL, &config_change_color }, { "col_chat_time", N_("color for time"), N_("color for time in chat window"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat_time, NULL, NULL }, + "gray", NULL, &cfg_col_chat_time, NULL, &config_change_color }, { "col_chat_time_sep", N_("color for time separator"), N_("color for time separator (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "brown", NULL, &cfg_col_chat_time_sep, NULL, NULL }, + "brown", NULL, &cfg_col_chat_time_sep, NULL, &config_change_color }, { "col_chat_prefix1", N_("color for 1st and 3rd char of prefix"), N_("color for 1st and 3rd char of prefix"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightcyan", NULL, &cfg_col_chat_prefix1, NULL, NULL }, + "lightcyan", NULL, &cfg_col_chat_prefix1, NULL, &config_change_color }, { "col_chat_prefix2", N_("color for middle char of prefix"), N_("color for middle char of prefix"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_chat_prefix2, NULL, NULL }, + "white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color }, { "col_chat_nick", N_("color for nicks in actions"), N_("color for nicks in actions (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightcyan", NULL, &cfg_col_chat_nick, NULL, NULL }, + "lightcyan", NULL, &cfg_col_chat_nick, NULL, &config_change_color }, { "col_chat_host", N_("color for hostnames"), N_("color for hostnames (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "cyan", NULL, &cfg_col_chat_host, NULL, NULL }, + "cyan", NULL, &cfg_col_chat_host, NULL, &config_change_color }, { "col_chat_channel", N_("color for channel names in actions"), N_("color for channel names in actions (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_chat_channel, NULL, NULL }, + "white", NULL, &cfg_col_chat_channel, NULL, &config_change_color }, { "col_chat_dark", N_("color for dark separators"), N_("color for dark separators (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "green", NULL, &cfg_col_chat_dark, NULL, NULL }, + "green", NULL, &cfg_col_chat_dark, NULL, &config_change_color }, { "col_chat_highlight", N_("color for highlighted nick"), N_("color for highlighted nick (chat window)"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_chat_highlight, NULL, NULL }, + "yellow", NULL, &cfg_col_chat_highlight, NULL, &config_change_color }, { "col_chat_bg", N_("background for chat"), N_("background for chat window"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_chat_bg, NULL, NULL }, + "default", NULL, &cfg_col_chat_bg, NULL, &config_change_color }, /* status window */ { "col_status", N_("color for status bar"), N_("color for status bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_status, NULL, NULL }, + "gray", NULL, &cfg_col_status, NULL, &config_change_color }, { "col_status_active", N_("color for active window"), N_("color for active window (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_status_active, NULL, NULL }, + "yellow", NULL, &cfg_col_status_active, NULL, &config_change_color }, { "col_status_data_msg", N_("color for window with new messages"), N_("color for window with new messages (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightred", NULL, &cfg_col_status_data_msg, NULL, NULL }, + "lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color }, { "col_status_data_other", N_("color for window with new data (not messages)"), N_("color for window with new data (not messages) (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightmagenta", NULL, &cfg_col_status_data_other, NULL, NULL }, + "lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color }, { "col_status_more", N_("color for \"*MORE*\" text"), N_("color for window with new data (status bar)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_status_more, NULL, NULL }, + "white", NULL, &cfg_col_status_more, NULL, &config_change_color }, { "col_status_bg", N_("background for status window"), N_("background for status window"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_status_bg, NULL, NULL }, + "blue", NULL, &cfg_col_status_bg, NULL, &config_change_color }, /* infobar window */ { "col_infobar", N_("color for info bar text"), N_("color for info bar text"), OPTION_TYPE_COLOR, 0, 0, 0, - "black", NULL, &cfg_col_infobar, NULL, NULL }, + "black", NULL, &cfg_col_infobar, NULL, &config_change_color }, { "col_infobar_highlight", N_("color for info bar highlight notification"), N_("color for info bar highlight notification"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_infobar_highlight, NULL, NULL }, + "white", NULL, &cfg_col_infobar_highlight, NULL, &config_change_color }, { "col_infobar_bg", N_("background for info bar window"), N_("background for info bar window"), OPTION_TYPE_COLOR, 0, 0, 0, - "cyan", NULL, &cfg_col_infobar_bg, NULL, NULL }, + "cyan", NULL, &cfg_col_infobar_bg, NULL, &config_change_color }, /* input window */ { "col_input", N_("color for input text"), N_("color for input text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_input, NULL, NULL }, + "gray", NULL, &cfg_col_input, NULL, &config_change_color }, { "col_input_channel", N_("color for input text (channel name)"), N_("color for input text (channel name)"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_input_channel, NULL, NULL }, + "white", NULL, &cfg_col_input_channel, NULL, &config_change_color }, { "col_input_nick", N_("color for input text (nick name)"), N_("color for input text (nick name)"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightgreen", NULL, &cfg_col_input_nick, NULL, NULL }, + "lightgreen", NULL, &cfg_col_input_nick, NULL, &config_change_color }, { "col_input_bg", N_("background for input window"), N_("background for input window"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_input_bg, NULL, NULL }, + "default", NULL, &cfg_col_input_bg, NULL, &config_change_color }, /* nick window */ { "col_nick", N_("color for nicknames"), N_("color for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick, NULL, NULL }, + "gray", NULL, &cfg_col_nick, NULL, &config_change_color }, { "col_nick_op", N_("color for operator symbol"), N_("color for operator symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightgreen", NULL, &cfg_col_nick_op, NULL, NULL }, + "lightgreen", NULL, &cfg_col_nick_op, NULL, &config_change_color }, { "col_nick_halfop", N_("color for half-operator symbol"), N_("color for half-operator symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "lightmagenta", NULL, &cfg_col_nick_halfop, NULL, NULL }, + "lightmagenta", NULL, &cfg_col_nick_halfop, NULL, &config_change_color }, { "col_nick_voice", N_("color for voice symbol"), N_("color for voice symbol"), OPTION_TYPE_COLOR, 0, 0, 0, - "yellow", NULL, &cfg_col_nick_voice, NULL, NULL }, + "yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color }, { "col_nick_sep", N_("color for nick separator"), N_("color for nick separator"), OPTION_TYPE_COLOR, 0, 0, 0, - "blue", NULL, &cfg_col_nick_sep, NULL, NULL }, + "blue", NULL, &cfg_col_nick_sep, NULL, &config_change_color }, { "col_nick_self", N_("color for local nick"), N_("color for local nick"), OPTION_TYPE_COLOR, 0, 0, 0, - "white", NULL, &cfg_col_nick_self, NULL, NULL }, + "white", NULL, &cfg_col_nick_self, NULL, &config_change_color }, { "col_nick_private", N_("color for other nick in private window"), N_("color for other nick in private window"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick_private, NULL, NULL }, + "gray", NULL, &cfg_col_nick_private, NULL, &config_change_color }, { "col_nick_bg", N_("background for nicknames"), N_("background for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "default", NULL, &cfg_col_nick_bg, NULL, NULL }, + "default", NULL, &cfg_col_nick_bg, NULL, &config_change_color }, { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; @@ -569,6 +569,83 @@ get_pos_array_values (char **array, char *string) } /* + * config_get_section: get section name from option pointer + */ + +char * +config_get_section (t_config_option *ptr_option) +{ + int i, j; + + for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++) + { + if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER)) + { + for (j = 0; weechat_options[i][j].option_name; j++) + { + /* if option found, return pointer to section name */ + if (ptr_option == &weechat_options[i][j]) + return config_sections[i].section_name; + } + } + } + /* option not found */ + return NULL; +} + +/* + * config_change_noop: called when an option is changed by /set command + * and that no special action is needed after that + */ + +void +config_change_noop () +{ + /* do nothing */ +} + +/* + * config_change_title: called when title is changed + */ + +void +config_change_title () +{ + gui_set_window_title (); +} + +/* + * config_change_windows: called when windows change (for example nicklist) + */ + +void +config_change_windows () +{ + gui_switch_to_window (gui_current_window); + gui_redraw_window (gui_current_window); +} + +/* + * config_change_window_content: called when content of a window changes + */ + +void +config_change_window_content () +{ + gui_redraw_window (gui_current_window); +} + +/* + * config_change_color: called when a color is changed by /set command + */ + +void +config_change_color() +{ + gui_init_colors (); +} + +/* * config_option_set_value: set new value for an option * return: 0 if success * -1 if error (bad value) @@ -615,14 +692,12 @@ config_option_set_value (t_config_option *option, char *value) } /* - * config_set_value: set new value for an option (found by name) - * return: 0 if success - * -1 if bad value for option - * -2 if option is not found + * config_option_search: look for an option and return pointer to this option + * if option is not found, NULL is returned */ -int -config_set_value (char *option_name, char *value) +t_config_option * +config_option_search (char *option_name) { int i, j; @@ -632,14 +707,33 @@ config_set_value (char *option_name, char *value) { for (j = 0; weechat_options[i][j].option_name; j++) { - /* if option found, assign value and exit */ + /* if option found, return pointer */ if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0) - return config_option_set_value (&weechat_options[i][j], value); + return &weechat_options[i][j]; } } } /* option not found */ - return -2; + return NULL; +} + +/* + * config_set_value: set new value for an option (found by name) + * return: 0 if success + * -1 if bad value for option + * -2 if option is not found + */ + +int +config_set_value (char *option_name, char *value) +{ + t_config_option *ptr_option; + + ptr_option = config_option_search (option_name); + if (ptr_option) + return config_option_set_value (ptr_option, value); + else + return -2; } /* diff --git a/weechat/src/common/weeconfig.h b/weechat/src/common/weeconfig.h index 1b96f0e36..daea3c90a 100644 --- a/weechat/src/common/weeconfig.h +++ b/weechat/src/common/weeconfig.h @@ -70,7 +70,7 @@ struct t_config_option char **array_values; int *ptr_int; char **ptr_string; - int (*handler_change)(int *, char **); + void (*handler_change)(); }; extern int cfg_look_set_title; @@ -155,6 +155,15 @@ extern char *cfg_proxy_password; extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS]; extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS]; +extern char *config_get_section (); +extern void config_change_noop (); +extern void config_change_title (); +extern void config_change_windows (); +extern void config_change_window_content (); +extern void config_change_color (); +extern int config_option_set_value (t_config_option *, char *); +extern t_config_option *config_option_search (char *); +extern int config_set_value (char *, char *); extern int config_read (); extern int config_create_default (); extern int config_write (); diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 0ad260973..d82f56465 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -182,7 +182,7 @@ gui_calculate_pos_size (t_gui_window *window) /* init chat & nicklist settings */ /* TODO: calculate values from function parameters */ - if (WIN_IS_CHANNEL(window)) + if (cfg_look_nicklist && WIN_IS_CHANNEL(window)) { max_length = nick_get_max_length (CHANNEL(window)); @@ -1147,13 +1147,16 @@ gui_switch_to_window (t_gui_window *window) window->win_status = ptr_win->win_status; window->win_infobar = ptr_win->win_infobar; window->win_input = ptr_win->win_input; - ptr_win->win_title = NULL; - ptr_win->win_chat = NULL; - ptr_win->win_nick = NULL; - ptr_win->win_status = NULL; - ptr_win->win_infobar = NULL; - ptr_win->win_input = NULL; - ptr_win->is_displayed = 0; + if (ptr_win != window) + { + ptr_win->win_title = NULL; + ptr_win->win_chat = NULL; + ptr_win->win_nick = NULL; + ptr_win->win_status = NULL; + ptr_win->win_infobar = NULL; + ptr_win->win_input = NULL; + ptr_win->is_displayed = 0; + } break; } } @@ -1169,46 +1172,52 @@ gui_switch_to_window (t_gui_window *window) window->win_chat_width, window->win_chat_y, window->win_chat_x); - if (CHANNEL(window)) + if (cfg_look_nicklist && CHANNEL(window)) window->win_nick = newwin (window->win_nick_height, window->win_nick_width, window->win_nick_y, window->win_nick_x); else window->win_nick = NULL; - if (cfg_look_infobar) - { - window->win_infobar = newwin (1, COLS, LINES - 2, 0); - window->win_status = newwin (1, COLS, LINES - 3, 0); - } - else - window->win_status = newwin (1, COLS, LINES - 2, 0); window->win_input = newwin (1, COLS, LINES - 1, 0); } else { - /* create chat & nick windows */ + /* remove some windows */ + if (window->win_nick) + { + delwin (window->win_nick); + window->win_nick = NULL; + } + if (window->win_status) + { + delwin (window->win_status); + window->win_status = NULL; + } + if (window->win_infobar) + { + delwin (window->win_infobar); + window->win_infobar = NULL; + } + + /* create windows */ if (WIN_IS_CHANNEL(window)) { - /* (re)create nicklist window */ - if (window->win_nick) - delwin (window->win_nick); delwin (window->win_chat); window->win_chat = newwin (window->win_chat_height, window->win_chat_width, window->win_chat_y, window->win_chat_x); - window->win_nick = newwin (window->win_nick_height, - window->win_nick_width, - window->win_nick_y, - window->win_nick_x); + if (cfg_look_nicklist) + window->win_nick = newwin (window->win_nick_height, + window->win_nick_width, + window->win_nick_y, + window->win_nick_x); + else + window->win_nick = NULL; } if (!(WIN_IS_CHANNEL(window))) { - /* remove nick list window */ - if (window->win_nick) - delwin (window->win_nick); - window->win_nick = NULL; delwin (window->win_chat); window->win_chat = newwin (window->win_chat_height, window->win_chat_width, @@ -1217,6 +1226,15 @@ gui_switch_to_window (t_gui_window *window) } } + /* create status/infobar windows */ + if (cfg_look_infobar) + { + window->win_infobar = newwin (1, COLS, LINES - 2, 0); + window->win_status = newwin (1, COLS, LINES - 3, 0); + } + else + window->win_status = newwin (1, COLS, LINES - 2, 0); + /* change current window to the new window */ gui_current_window = window; @@ -1477,6 +1495,20 @@ gui_init_colors () } /* + * gui_set_window_title: set terminal title + */ + +void +gui_set_window_title () +{ + #ifdef __linux__ + /* set title for term window, not for console */ + if (strcmp (getenv ("TERM"), "linux") != 0) + printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a"); + #endif +} + +/* * gui_init: init GUI */ @@ -1500,11 +1532,8 @@ gui_init () signal (SIGWINCH, gui_curses_resize_handler); - #ifdef __linux__ - /* set title for term window, not for console */ - if (cfg_look_set_title && (strcmp (getenv ("TERM"), "linux") != 0)) - printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a"); - #endif + if (cfg_look_set_title) + gui_set_window_title (); gui_ready = 1; } diff --git a/weechat/src/gui/gtk/gui-display.c b/weechat/src/gui/gtk/gui-display.c index c39f6ecb5..f86ee8af9 100644 --- a/weechat/src/gui/gtk/gui-display.c +++ b/weechat/src/gui/gtk/gui-display.c @@ -600,6 +600,16 @@ gui_init_colors () } /* + * gui_set_window_title: set window title + */ + +void +gui_set_window_title () +{ + /* TODO: set window title for Gtk */ +} + +/* * gui_init: init GUI */ diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h index af6aca5ec..019acc00d 100644 --- a/weechat/src/gui/gui.h +++ b/weechat/src/gui/gui.h @@ -241,7 +241,8 @@ extern void gui_move_page_up (); extern void gui_move_page_down (); extern void gui_window_init_subwindows (t_gui_window *); extern void gui_pre_init (int *, char **[]); -//extern void gui_init_colors (); +extern void gui_init_colors (); +extern void gui_set_window_title (); extern void gui_init (); extern void gui_window_free (t_gui_window *); extern void gui_end (); diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c index 873c3f501..289d98ffb 100644 --- a/weechat/src/irc/irc-server.c +++ b/weechat/src/irc/irc-server.c @@ -361,7 +361,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg) if (!message) { gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); return; } @@ -372,7 +372,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg) strlen (msg) + 1); if (!message->data) gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); else { @@ -426,7 +426,7 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer) strlen (buffer) + 1); if (!unterminated_message) gui_printf (server->window, - _("%s not enough memory for received IRC message"), + _("%s not enough memory for received IRC message\n"), WEECHAT_ERROR); else strcpy (unterminated_message, buffer); |