diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-01-16 11:52:22 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-01-16 11:52:22 +0000 |
commit | 88930e50dd06fcad997fa9380227084b319181a9 (patch) | |
tree | fe3d62f54f0f7f477ed5ff381b0f2606ec61a7f9 | |
parent | 555999534ee0d4782f61a5e1e7b546830f5d5662 (diff) | |
download | weechat-88930e50dd06fcad997fa9380227084b319181a9.zip |
Improved completion (now completes commands args), fixed color bug (gray removed, replaced by default), fixed crash when unknown section with option(s) in config file, fixed IRC commands: /op, /deop, /voice, /devoice
48 files changed, 3108 insertions, 1486 deletions
@@ -1,29 +1,35 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -Developers: ----------- - -All developers are connected to IRC: -server: irc.freenode.net, channel: #weechat +Developer: +--------- FlashCode <flashcode@flashtux.org> - Web : http://www.flashtux.org - IRC : nick is "FlashCode" + Web : http://weechat.flashtux.org + IRC : nick is "FlashCode" @ irc.freenode.net Jabber: flashcode@jabber.org ICQ : 160677660 AIM : FlashCode AIM Yahoo : FlashCode_Y +Testers: +------- + Bounga <bounga@altern.org> Web : http://bounga.ath.cx - IRC : nick is "Bounga" + IRC : nick is "Bounga" @ irc.freenode.net Jabber: Bounga@jabber.org ICQ : 178297842 Xahlexx <xahlexx@weeland.org> Web : http://www.weeland.org - IRC : nick is "xahlexx" + IRC : nick is "xahlexx" @ irc.freenode.net + + +===== + +Whole team is connected to IRC: +server: irc.freenode.net, channel: #weechat See README file for licence detail. @@ -1,10 +1,16 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-01-08 +ChangeLog - 2005-01-16 Version 0.1.0 (under dev!): + * improved completion: now completes commands arguments (IRC and internal), + when only one completion matches, completion mechanism is stoped (to + complete command arg for example) + * fixed colors bug: removed "gray" color (replaced by "default"), colors are + ok when terminal has white (or light) background + * fixed crash when unknown section with option(s) in config file * improved /set command: empty strings are allowed, new colors, server options can be changed while WeeChat is running * added default away/part/quit messages in config file @@ -12,6 +18,7 @@ Version 0.1.0 (under dev!): "irc_display_away" * server messages & errors are all prefixed (by 3 chars, like '-@-') * added new options for charset: look_charset_decode and look_charset_encode + * fixed /op, /deop, /voice, /devoice (now ok with many nicks) * fixed /me command (now ok without parameter) * fixed /away command (now ok if not away) * logs are now disabled by default (server/channel/private) @@ -1,4 +1,4 @@ -WeeChat FAQ, 2004-05-31 +WeeChat FAQ, 2005-01-16 ======================= Intended audience: @@ -53,7 +53,7 @@ A: Because WeeChat is very light and has new features. * developed from scratch (not based on any other IRC client) * multi-platform * 100% GPL and free - This is the "geekest Irc client" ;) + This is the "geekest" IRC client ;) 2.2 @@ -67,7 +67,7 @@ A: For help you can type /help. For help about a command, type /help command. ================================================================================ Q: How can I customize key bindings? -A: Today you can't do that. This will be available in a future version. +A: Today you can't do that. This is planed for a future version. 2.4 @@ -79,21 +79,22 @@ A: You can use /perl command to load scripts (default path is ~/.weechat/perl). Note that scripts in ~/.weechat/perl/autoload are automatically loaded when WeeChat is starting up. - WeeChat perl scripts are compatible with X-Chat, not with Irssi, sorry ;) + WeeChat perl scripts are compatible with X-Chat, but not with Irssi, + sorry ;) 2.5 ================================================================================ Q: How can I load Python scripts? -A: Today Python interface is not developed, so can't load any Python script. +A: Today Python interface is not developed, so you can't load any Python script. 2.6 ================================================================================ Q: How can I load Ruby scripts? -A: Today Ruby interface is not developed, so can't load any Ruby script. +A: Today Ruby interface is not developed, so you can't load any Ruby script. 3.1 @@ -154,4 +155,4 @@ A: There's many tasks to do (code, documentation, ...) ================================================================================ Q: Can I give money or other things to WeeChat developers? -A: No. +A: Beer is welcome :) @@ -1,4 +1,4 @@ -WeeChat FAQ, 2004-05-31 +WeeChat FAQ, 2005-01-16 ======================= Public concerné : @@ -57,7 +57,7 @@ R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités. * développé à partir de zéro (non basé sur un quelconque client IRC) * multi-platformes * 100% GPL et libre - C'est le client le plus "geek" ;) + C'est le client IRC le plus "geek" ;) 2.2 @@ -85,7 +85,7 @@ R: La commande /perl permet de charger les scripts Perl (le chemin par défaut est ~/.weechat/perl). Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement chargés par WeeChat lorsqu'il démarre. - Les scripts Perl WeeChat sont compatibles avec X-Chat, pas Irssi, + Les scripts Perl WeeChat sont compatibles avec X-Chat, mais pas Irssi, désolé ;) @@ -169,4 +169,4 @@ R: Il y a plusieurs choses à faire (code, documentation, ...) ================================================================================ Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ? -R: Non. +R: La bière est la bienvenue :) @@ -6,7 +6,7 @@ WeeChat - Installation instructions --disable-curses : do not build Curses interface --enable-gtk : build Gtk+ interface (under development!) --enable-qt : build Qt interface (not developed!) - --with-debug : 1 for debug compilation, 2 for debug messages + --with-debug=X : X=1 for debug compilation, 2 for debug messages 2) Run 'make' @@ -22,10 +22,7 @@ Features Copyright --------- -WeeChat (c) Copyright 2004 - by: FlashCode <flashcode@flashtux.org> - Xahlexx <xahlex@weeland.org> - Bounga <bounga@altern.org> +WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org> (see AUTHORS file if you want to contact authors) WeeChat is distributed under GPL licence (see COPYING file for complete license): @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.0-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-01-05 23:47+0100\n" +"POT-Creation-Date: 2005-01-16 12:34+0100\n" "PO-Revision-Date: 2005-01-01 13:00+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -20,7 +20,7 @@ msgstr "" msgid "%s cannot allocate new nick\n" msgstr "%s ompossible d'allouer un nouveau pseudo\n" -#: src/irc/irc-server.c:136 src/common/weeconfig.c:1397 +#: src/irc/irc-server.c:136 src/common/weeconfig.c:1406 msgid "Unable to get user's name" msgstr "Impossible de déterminer le nom d'utilisateur" @@ -1162,7 +1162,7 @@ msgstr "drapeau de mode inconnu" msgid "can't change mode for other users" msgstr "impossible de changer le mode pour les autres utilisateurs" -#: src/irc/irc-display.c:145 src/common/command.c:860 +#: src/irc/irc-display.c:145 src/common/command.c:796 msgid "Server: " msgstr "Serveur: " @@ -1199,38 +1199,42 @@ msgstr "inconnu" msgid "%s: using local hostname \"%s\"\n" msgstr "%s: utilisation du nom de machine local \"%s\"\n" -#: src/irc/irc-send.c:274 src/irc/irc-send.c:300 src/irc/irc-send.c:401 -#: src/irc/irc-send.c:724 src/irc/irc-send.c:803 src/irc/irc-send.c:1307 +#: src/irc/irc-send.c:257 +msgid "This command is not developed!\n" +msgstr "Cette commande n'est pas développée !\n" + +#: src/irc/irc-send.c:282 src/irc/irc-send.c:308 src/irc/irc-send.c:409 +#: src/irc/irc-send.c:734 src/irc/irc-send.c:813 src/irc/irc-send.c:1314 #, c-format msgid "%s \"%s\" command can only be executed in a channel window\n" msgstr "" "%s la commande \"%s\" peut seulement être exécutée dans une fenêtre de " "canal\n" -#: src/irc/irc-send.c:509 src/irc/irc-send.c:576 src/irc/irc-send.c:851 -#: src/irc/irc-send.c:865 src/irc/irc-send.c:1201 +#: src/irc/irc-send.c:519 src/irc/irc-send.c:586 src/irc/irc-send.c:861 +#: src/irc/irc-send.c:875 src/irc/irc-send.c:1208 #, c-format msgid "%s \"%s\" command can not be executed on a server window\n" msgstr "" "%s la commande \"%s\" ne peut pas être exécutée dans une fenêtre serveur\n" -#: src/irc/irc-send.c:594 src/irc/irc-send.c:619 src/irc/irc-recv.c:264 +#: src/irc/irc-send.c:604 src/irc/irc-send.c:629 src/irc/irc-recv.c:264 #: src/irc/irc-recv.c:1048 #, c-format msgid "%s nick not found for \"%s\" command\n" msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n" -#: src/irc/irc-send.c:671 src/irc/irc-send.c:949 src/irc/irc-recv.c:1214 +#: src/irc/irc-send.c:681 src/irc/irc-send.c:959 src/irc/irc-recv.c:1214 #, c-format msgid "%s cannot create new private window \"%s\"\n" msgstr "%s impossible de créer la fenêtre privée \"%s\"\n" -#: src/irc/irc-send.c:702 src/irc/irc-send.c:776 src/common/command.c:1331 +#: src/irc/irc-send.c:712 src/irc/irc-send.c:786 src/common/command.c:1302 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n" -#: src/irc/irc-send.c:1279 +#: src/irc/irc-send.c:1286 #, c-format msgid "%s, compiled on %s %s\n" msgstr "%s, compilé le %s %s\n" @@ -1769,35 +1773,35 @@ msgstr "Mo" msgid "Gb" msgstr "Go" -#: src/gui/curses/gui-display.c:1006 +#: src/gui/curses/gui-display.c:1009 #, c-format msgid "%d:[not connected] " msgstr "%d:[non connecté] " -#: src/gui/curses/gui-display.c:1014 +#: src/gui/curses/gui-display.c:1017 msgid "[Act: " msgstr "[Act: " -#: src/gui/curses/gui-display.c:1053 src/gui/curses/gui-display.c:1056 +#: src/gui/curses/gui-display.c:1056 src/gui/curses/gui-display.c:1059 msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/curses/gui-display.c:1225 +#: src/gui/curses/gui-display.c:1228 msgid " [A] Accept" msgstr " [A] Accepter" -#: src/gui/curses/gui-display.c:1226 src/gui/curses/gui-display.c:1232 -#: src/gui/curses/gui-display.c:1239 +#: src/gui/curses/gui-display.c:1229 src/gui/curses/gui-display.c:1235 +#: src/gui/curses/gui-display.c:1242 msgid " [C] Cancel" msgstr " [C] Annuler" -#: src/gui/curses/gui-display.c:1227 src/gui/curses/gui-display.c:1233 -#: src/gui/curses/gui-display.c:1240 src/gui/curses/gui-display.c:1247 -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1230 src/gui/curses/gui-display.c:1236 +#: src/gui/curses/gui-display.c:1243 src/gui/curses/gui-display.c:1250 +#: src/gui/curses/gui-display.c:1255 msgid " [Q] Close DCC view" msgstr " [Q] Fermer la vue DCC" -#: src/gui/curses/gui-display.c:1246 +#: src/gui/curses/gui-display.c:1249 msgid " [R] Remove" msgstr " [R] Retirer" @@ -1810,24 +1814,24 @@ msgstr "serveur" msgid "%s not enough memory for infobar message\n" msgstr "%s pas assez de mémoire pour un message de la barre d'infos\n" -#: src/gui/gui-common.c:462 +#: src/gui/gui-common.c:465 #, c-format msgid "%s not enough memory for new line!\n" msgstr "%s pas assez de mémoire pour une nouvelle ligne !\n" -#: src/gui/gui-common.c:505 +#: src/gui/gui-common.c:508 msgid "not enough memory!\n" msgstr "pas assez de mémoire !\n" -#: src/common/command.c:41 +#: src/common/command.c:42 msgid "create an alias for a command" msgstr "créer un alias pour une commande" -#: src/common/command.c:42 +#: src/common/command.c:43 msgid "[alias_name [command [arguments]]" msgstr "[nom_alias [commande [paramètres]]" -#: src/common/command.c:43 +#: src/common/command.c:44 msgid "" "alias_name: name of alias\n" "command: command name (WeeChat or IRC command, without first '/')\n" @@ -1837,15 +1841,15 @@ msgstr "" "commande: nom de la commande (commande WeeChat ou IRC, sans le premier '/')\n" "paramètres: paramètres pour la commande" -#: src/common/command.c:46 +#: src/common/command.c:47 msgid "manage buffers" msgstr "gère les buffers" -#: src/common/command.c:47 +#: src/common/command.c:48 msgid "[action | number]" msgstr "[action | nombre]" -#: src/common/command.c:48 +#: src/common/command.c:49 msgid "" "action: action to do:\n" " move move buffer in the list (may be relative, for example -1)\n" @@ -1865,59 +1869,59 @@ msgstr "" "3=2+join/part)\n" "nombre: sauter au buffer qui a ce numéro" -#: src/common/command.c:55 +#: src/common/command.c:56 msgid "clear window(s)" msgstr "affacer la/les fenêtre(s)" -#: src/common/command.c:56 +#: src/common/command.c:57 msgid "[-all]" msgstr "[-all]" -#: src/common/command.c:57 +#: src/common/command.c:58 msgid "-all: clear all windows" msgstr "-all: effacer toutes les fenêtres" -#: src/common/command.c:59 +#: src/common/command.c:60 msgid "connect to a server" msgstr "se connecter à un serveur" -#: src/common/command.c:60 src/common/command.c:64 +#: src/common/command.c:61 src/common/command.c:65 msgid "servername" msgstr "nom_serveur" -#: src/common/command.c:61 +#: src/common/command.c:62 msgid "servername: server name to connect" msgstr "nom_serveur: nom du serveur pour se connecter" -#: src/common/command.c:63 +#: src/common/command.c:64 msgid "disconnect from a server" msgstr "se déconnecter d'un serveur" -#: src/common/command.c:65 +#: src/common/command.c:66 msgid "servername: server name to disconnect" msgstr "nom_serveur: nom du serveur pour se déconnecter" -#: src/common/command.c:67 +#: src/common/command.c:68 msgid "display help about commands" msgstr "afficher l'aide sur les commandes" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "[command]" msgstr "[commande]" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "command: name of a WeeChat or IRC command" msgstr "commande: nom d'une commande WeeChat ou IRC" -#: src/common/command.c:70 +#: src/common/command.c:71 msgid "list/load/unload Perl scripts" msgstr "liste/charge/décharge des scripts Perl" -#: src/common/command.c:71 +#: src/common/command.c:72 msgid "[load filename] | [autoload] | [unload]" msgstr "[load fichier] | [autoload] | [unload]" -#: src/common/command.c:72 +#: src/common/command.c:73 msgid "" "filename: Perl script (file) to load\n" "Without argument, /perl command lists all loaded Perl scripts." @@ -1925,11 +1929,11 @@ msgstr "" "fichier: script Perl (fichier) à charger\n" "Sans paramètre, la commande /perl liste tous les scripts Perl chargés." -#: src/common/command.c:75 +#: src/common/command.c:76 msgid "list, add or remove servers" msgstr "liste, ajoute ou retire des serveurs" -#: src/common/command.c:76 +#: src/common/command.c:77 msgid "" "[servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-" "nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-" @@ -1940,7 +1944,7 @@ msgstr "" "nom_utilisateur] [-realname nom_réel] [-command commande] [-autojoin canal[," "canal]] ] | [del nom_serveur]" -#: src/common/command.c:81 +#: src/common/command.c:82 msgid "" "servername: server name, for internal & display use\n" "hostname: name or IP address of server\n" @@ -1962,27 +1966,27 @@ msgstr "" "nom_utilisateur: nom d'utilisateur\n" "nom_réel: nom réel de l'utilisateur" -#: src/common/command.c:91 +#: src/common/command.c:92 msgid "save config to disk" msgstr "sauvegarder la configuration sur disque" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "[file]" msgstr "[fichier]" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "file: filename for writing config" msgstr "fichier: fichier pour sauvegarder la configuration" -#: src/common/command.c:94 +#: src/common/command.c:95 msgid "set config parameters" msgstr "modifier des paramètres de configuration" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "[option[=value]]" msgstr "[option[=valeur]]" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "" "option: name of an option\n" "value: value for option" @@ -1990,27 +1994,27 @@ msgstr "" "option: nom d'une option\n" "valeur: valeur pour l'option" -#: src/common/command.c:97 +#: src/common/command.c:98 msgid "remove an alias" msgstr "supprimer un alias" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name" msgstr "nom_alias" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name: name of alias to remove" msgstr "nom_alias: nom de l'alias à supprimer" -#: src/common/command.c:100 +#: src/common/command.c:101 msgid "manage windows" msgstr "gestion des fenêtres" -#: src/common/command.c:101 +#: src/common/command.c:102 msgid "[action]" msgstr "[action]" -#: src/common/command.c:102 +#: src/common/command.c:103 msgid "" "action: action to do:\n" " close close current window (under development!)\n" @@ -2025,29 +2029,29 @@ msgstr "" " splith éclate la fenêtre en deux horizontalement\n" " splitv éclate la fenêtre en deux verticalement" -#: src/common/command.c:357 +#: src/common/command.c:237 #, c-format msgid "%s alias or command \"%s\" already exists!\n" msgstr "%s l'alias ou la commande \"%s\" existe déjà !\n" -#: src/common/command.c:366 +#: src/common/command.c:247 #, c-format msgid "%s alias cannot run another alias!\n" msgstr "%s l'alias ne peux pas lancer un autre alias !\n" -#: src/common/command.c:372 +#: src/common/command.c:254 #, c-format msgid "%s target command \"%s\" does not exist!\n" msgstr "%s la commande cible \"%s\" n'existe pas !\n" -#: src/common/command.c:558 +#: src/common/command.c:451 #, c-format msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n" msgstr "" "%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: %d " "paramètre%s)\n" -#: src/common/command.c:567 +#: src/common/command.c:463 #, c-format msgid "" "%s wrong argument count for %s command \"%s\" (expected: between %d and %d " @@ -2056,19 +2060,19 @@ msgstr "" "%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: entre " "%d et %d paramètre%s)\n" -#: src/common/command.c:586 +#: src/common/command.c:485 #, c-format msgid "%s %s command \"%s\" failed\n" msgstr "%s %s la commande \"%s\" a échoué\n" -#: src/common/command.c:611 +#: src/common/command.c:513 #, c-format msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n" msgstr "" "%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: %d " "paramètre%s)\n" -#: src/common/command.c:620 +#: src/common/command.c:525 #, c-format msgid "" "%s wrong argument count for IRC command \"%s\" (expected: between %d and %d " @@ -2077,186 +2081,189 @@ msgstr "" "%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: " "entre %d et %d paramètre%s)\n" -#: src/common/command.c:633 +#: src/common/command.c:540 #, c-format msgid "%s command \"%s\" needs a server connection!\n" msgstr "%s la commande \"%s\" nécessite une connexion au serveur !\n" -#: src/common/command.c:645 +#: src/common/command.c:555 #, c-format msgid "%s IRC command \"%s\" failed\n" msgstr "%s la commande IRC \"%s\" a échoué\n" -#: src/common/command.c:692 +#: src/common/command.c:604 #, c-format msgid "%s unknown command \"%s\" (type /help for help)\n" msgstr "%s commande \"%s\" inconnue (tapez /help pour l'aide)\n" -#: src/common/command.c:761 +#: src/common/command.c:675 #, c-format msgid "%s cannot find nick for sending message\n" msgstr "%s impossible de trouver le pseudo pour envoyer le message\n" -#: src/common/command.c:767 +#: src/common/command.c:684 msgid "This window is not a channel!\n" msgstr "Cette fenêtre n'est pas un canal !\n" -#: src/common/command.c:793 src/common/command.c:805 src/common/command.c:894 +#: src/common/command.c:712 src/common/command.c:736 src/common/command.c:831 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:800 +#: src/common/command.c:721 #, c-format msgid "Alias \"%s\" => \"%s\" created\n" msgstr "Alias \"%s\" => \"%s\" créé\n" -#: src/common/command.c:815 +#: src/common/command.c:727 +#, c-format +msgid "Failed to create alias \"%s\" => \"%s\" (not enough memory)\n" +msgstr "Impossible de créer l'alias \"%s\" => \"%s\" (pas assez de mémoire)\n" + +#: src/common/command.c:747 msgid "List of aliases:\n" msgstr "Liste des alias:\n" -#: src/common/command.c:825 +#: src/common/command.c:760 msgid "No alias defined.\n" msgstr "Aucun alias défini.\n" -#: src/common/command.c:847 +#: src/common/command.c:783 msgid "Opened buffers:\n" msgstr "Tampons ouverts:\n" -#: src/common/command.c:866 +#: src/common/command.c:802 msgid "Channel: " msgstr "Canal: " -#: src/common/command.c:869 src/common/command.c:879 +#: src/common/command.c:805 src/common/command.c:815 msgid " (server: " msgstr " (serveur: " -#: src/common/command.c:876 +#: src/common/command.c:812 msgid "Private with: " msgstr "Privé avec: " -#: src/common/command.c:916 src/common/command.c:1019 +#: src/common/command.c:854 src/common/command.c:963 #, c-format msgid "%s incorrect buffer number\n" msgstr "%s numéro de buffer incorrect\n" -#: src/common/command.c:929 +#: src/common/command.c:868 #, c-format msgid "%s can not close the single buffer\n" msgstr "%s impossible de fermer le tampon unique\n" -#: src/common/command.c:938 +#: src/common/command.c:878 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" "%s impossible de fermer le tampon du serveur tant que des canaux sont " "ouverts\n" -#: src/common/command.c:959 +#: src/common/command.c:899 msgid "Notify levels: " msgstr "Niveaux de notification: " -#: src/common/command.c:985 src/common/command.c:994 +#: src/common/command.c:926 src/common/command.c:936 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "%s niveau de notification incorrect (doit être entre 0 et 3)\n" -#: src/common/command.c:1011 +#: src/common/command.c:954 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "%s buffer \"%s\" non trouvé pour la commande \"%s\"\n" -#: src/common/command.c:1043 +#: src/common/command.c:988 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n" -#: src/common/command.c:1071 +#: src/common/command.c:1017 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "%s déjà connecté au serveur \"%s\" !\n" -#: src/common/command.c:1090 src/common/command.c:1128 -#: src/common/command.c:1704 +#: src/common/command.c:1037 src/common/command.c:1080 +#: src/common/command.c:1693 #, c-format msgid "%s server \"%s\" not found\n" msgstr "%s serveur \"%s\" non trouvé\n" -#: src/common/command.c:1115 +#: src/common/command.c:1063 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "%s non connecté au serveur \"%s\" !\n" -#: src/common/command.c:1121 +#: src/common/command.c:1071 msgid "Auto-reconnection is cancelled\n" msgstr "La reconnexion automatique est annulée\n" -#: src/common/command.c:1147 +#: src/common/command.c:1100 #, c-format msgid "> List of %s internal commands:\n" -msgstr "> Liste des commandes internes %s:\n" +msgstr "> Liste des commandes internes %s :\n" -#: src/common/command.c:1152 +#: src/common/command.c:1111 msgid "> List of IRC commands:\n" -msgstr "> Liste des commandes IRC:\n" +msgstr "> Liste des commandes IRC :\n" -#: src/common/command.c:1167 +#: src/common/command.c:1129 #, c-format -msgid "> Help on %s internal command \"%s\":\n" -msgstr "> Aide sur la commande interne %s \"%s\":\n" +msgid "> Help on %s internal command \"" +msgstr "> Aide sur la commande interne %s \"" -#: src/common/command.c:1170 src/common/command.c:1189 -#, c-format -msgid "Syntax: /%s %s\n" -msgstr "Syntaxe: /%s %s\n" +#: src/common/command.c:1134 src/common/command.c:1157 +msgid "Syntax: " +msgstr "Syntaxe: " -#: src/common/command.c:1187 -#, c-format -msgid "> Help on IRC command \"%s\":\n" -msgstr "> Aide sur la commande IRC \"%s\":\n" +#: src/common/command.c:1152 +msgid "> Help on IRC command \"" +msgstr "> Aide sur la commande IRC \"" -#: src/common/command.c:1202 +#: src/common/command.c:1171 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n" -#: src/common/command.c:1227 +#: src/common/command.c:1196 msgid "Registered Perl scripts:\n" msgstr "Scripts Perl enregistrés :\n" -#: src/common/command.c:1244 src/common/command.c:1266 -#: src/common/command.c:1288 +#: src/common/command.c:1213 src/common/command.c:1235 +#: src/common/command.c:1257 msgid " (none)\n" msgstr " (aucun)\n" -#: src/common/command.c:1249 +#: src/common/command.c:1218 msgid "Perl message handlers:\n" msgstr "Fonctions Perl pour messages :\n" -#: src/common/command.c:1258 +#: src/common/command.c:1227 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr " IRC(%s) => Perl(%s)\n" -#: src/common/command.c:1271 +#: src/common/command.c:1240 msgid "Perl command handlers:\n" msgstr "Commandes Perl :\n" -#: src/common/command.c:1280 +#: src/common/command.c:1249 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr " Commande /%s => Perl(%s)\n" -#: src/common/command.c:1300 +#: src/common/command.c:1269 msgid "Perl scripts unloaded\n" msgstr "Scripts Perl déchargés\n" -#: src/common/command.c:1325 src/common/command.c:1917 +#: src/common/command.c:1295 src/common/command.c:1924 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "%s option inconnue pour la commande \"%s\"\n" -#: src/common/command.c:1336 +#: src/common/command.c:1308 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" @@ -2265,120 +2272,120 @@ msgstr "" "Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le " "script ./configure\n" -#: src/common/command.c:1385 +#: src/common/command.c:1357 msgid "No server.\n" msgstr "Pas de serveur.\n" -#: src/common/command.c:1396 +#: src/common/command.c:1368 #, c-format msgid "Server '%s' not found.\n" msgstr "Serveur '%s' non trouvé.\n" -#: src/common/command.c:1407 +#: src/common/command.c:1380 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n" -#: src/common/command.c:1413 +#: src/common/command.c:1388 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n" -#: src/common/command.c:1430 +#: src/common/command.c:1407 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n" -#: src/common/command.c:1436 src/common/command.c:1569 +#: src/common/command.c:1413 src/common/command.c:1554 msgid "Server" msgstr "Serveur" -#: src/common/command.c:1439 +#: src/common/command.c:1416 msgid "has been deleted\n" msgstr "a été supprimé\n" -#: src/common/command.c:1453 +#: src/common/command.c:1431 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:1462 +#: src/common/command.c:1441 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n" -#: src/common/command.c:1486 src/common/command.c:1512 -#: src/common/command.c:1524 src/common/command.c:1548 +#: src/common/command.c:1466 src/common/command.c:1494 +#: src/common/command.c:1507 src/common/command.c:1533 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n" -#: src/common/command.c:1498 +#: src/common/command.c:1479 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n" -#: src/common/command.c:1536 +#: src/common/command.c:1520 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "%s commande manquante pour le paramètre \"%s\"\n" -#: src/common/command.c:1572 +#: src/common/command.c:1557 msgid "created\n" msgstr "créé\n" -#: src/common/command.c:1577 +#: src/common/command.c:1563 #, c-format msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1633 +#: src/common/command.c:1620 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1656 +#: src/common/command.c:1643 msgid "(password hidden) " msgstr "(mot de passe caché)" -#: src/common/command.c:1732 src/common/command.c:1772 +#: src/common/command.c:1725 src/common/command.c:1771 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "%s option de configuration \"%s\" non trouvée\n" -#: src/common/command.c:1736 src/common/command.c:1766 +#: src/common/command.c:1730 src/common/command.c:1763 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "%s valeur incorrecte pour l'option \"%s\"\n" -#: src/common/command.c:1751 +#: src/common/command.c:1746 #, 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:1845 +#: src/common/command.c:1847 #, c-format msgid "No config option found with \"%s\"\n" msgstr "Aucune option de configuration trouvée avec \"%s\"\n" -#: src/common/command.c:1848 +#: src/common/command.c:1850 msgid "No config option found\n" msgstr "Aucune option de configuration trouvée\n" -#: src/common/command.c:1854 +#: src/common/command.c:1857 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "option(s) de configuration trouvée(s) avec \"%s\"\n" -#: src/common/command.c:1857 +#: src/common/command.c:1860 msgid "config option(s) found\n" msgstr "option(s) de configuration trouvée(s)\n" -#: src/common/command.c:1876 +#: src/common/command.c:1880 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1885 +#: src/common/command.c:1890 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" @@ -3261,15 +3268,20 @@ msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n" #: src/common/weeconfig.c:1136 #, c-format +msgid "%s %s, line %d: invalid section for option, line is ignored\n" +msgstr "%s %s, ligne %d: section invalide pour l'option, ligne ignorée\n" + +#: src/common/weeconfig.c:1144 +#, 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:1170 +#: src/common/weeconfig.c:1178 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "%s %s, ligne %d: option \"%s\" invalide\n" -#: src/common/weeconfig.c:1181 +#: src/common/weeconfig.c:1189 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" @@ -3278,7 +3290,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:1190 +#: src/common/weeconfig.c:1198 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -3287,7 +3299,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:1201 +#: src/common/weeconfig.c:1209 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -3296,26 +3308,26 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: une de ces chaînes: " -#: src/common/weeconfig.c:1217 +#: src/common/weeconfig.c:1225 #, 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:1276 src/common/weeconfig.c:1449 +#: src/common/weeconfig.c:1285 src/common/weeconfig.c:1458 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "%s impossible de créer le fichier \"%s\"\n" -#: src/common/weeconfig.c:1282 +#: src/common/weeconfig.c:1291 #, 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:1283 +#: src/common/weeconfig.c:1292 msgid "creating default config file\n" msgstr "création du fichier de configuration par défaut\n" -#: src/common/weeconfig.c:1286 src/common/weeconfig.c:1458 +#: src/common/weeconfig.c:1295 src/common/weeconfig.c:1467 #, c-format msgid "" "#\n" @@ -3324,6 +3336,18 @@ msgstr "" "#\n" "# %s: fichier de configuration, créé par %s v%s le %s#\n" -#: src/common/weeconfig.c:1455 +#: src/common/weeconfig.c:1464 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" + +#~ msgid "> List of " +#~ msgstr "> Liste de " + +#~ msgid " commands:\n" +#~ msgstr " commandes:\n" + +#~ msgid "> Help on " +#~ msgstr "> Aide sur " + +#~ msgid " command \"" +#~ msgstr " commande \"" diff --git a/po/weechat.pot b/po/weechat.pot index 2bf4af5f0..0e60776b8 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: 2005-01-05 23:47+0100\n" +"POT-Creation-Date: 2005-01-16 12:34+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" @@ -20,7 +20,7 @@ msgstr "" msgid "%s cannot allocate new nick\n" msgstr "" -#: src/irc/irc-server.c:136 src/common/weeconfig.c:1397 +#: src/irc/irc-server.c:136 src/common/weeconfig.c:1406 msgid "Unable to get user's name" msgstr "" @@ -1068,7 +1068,7 @@ msgstr "" msgid "can't change mode for other users" msgstr "" -#: src/irc/irc-display.c:145 src/common/command.c:860 +#: src/irc/irc-display.c:145 src/common/command.c:796 msgid "Server: " msgstr "" @@ -1105,35 +1105,39 @@ msgstr "" msgid "%s: using local hostname \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:274 src/irc/irc-send.c:300 src/irc/irc-send.c:401 -#: src/irc/irc-send.c:724 src/irc/irc-send.c:803 src/irc/irc-send.c:1307 +#: src/irc/irc-send.c:257 +msgid "This command is not developed!\n" +msgstr "" + +#: src/irc/irc-send.c:282 src/irc/irc-send.c:308 src/irc/irc-send.c:409 +#: src/irc/irc-send.c:734 src/irc/irc-send.c:813 src/irc/irc-send.c:1314 #, c-format msgid "%s \"%s\" command can only be executed in a channel window\n" msgstr "" -#: src/irc/irc-send.c:509 src/irc/irc-send.c:576 src/irc/irc-send.c:851 -#: src/irc/irc-send.c:865 src/irc/irc-send.c:1201 +#: src/irc/irc-send.c:519 src/irc/irc-send.c:586 src/irc/irc-send.c:861 +#: src/irc/irc-send.c:875 src/irc/irc-send.c:1208 #, c-format msgid "%s \"%s\" command can not be executed on a server window\n" msgstr "" -#: src/irc/irc-send.c:594 src/irc/irc-send.c:619 src/irc/irc-recv.c:264 +#: src/irc/irc-send.c:604 src/irc/irc-send.c:629 src/irc/irc-recv.c:264 #: src/irc/irc-recv.c:1048 #, c-format msgid "%s nick not found for \"%s\" command\n" msgstr "" -#: src/irc/irc-send.c:671 src/irc/irc-send.c:949 src/irc/irc-recv.c:1214 +#: src/irc/irc-send.c:681 src/irc/irc-send.c:959 src/irc/irc-recv.c:1214 #, c-format msgid "%s cannot create new private window \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:702 src/irc/irc-send.c:776 src/common/command.c:1331 +#: src/irc/irc-send.c:712 src/irc/irc-send.c:786 src/common/command.c:1302 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "" -#: src/irc/irc-send.c:1279 +#: src/irc/irc-send.c:1286 #, c-format msgid "%s, compiled on %s %s\n" msgstr "" @@ -1657,35 +1661,35 @@ msgstr "" msgid "Gb" msgstr "" -#: src/gui/curses/gui-display.c:1006 +#: src/gui/curses/gui-display.c:1009 #, c-format msgid "%d:[not connected] " msgstr "" -#: src/gui/curses/gui-display.c:1014 +#: src/gui/curses/gui-display.c:1017 msgid "[Act: " msgstr "" -#: src/gui/curses/gui-display.c:1053 src/gui/curses/gui-display.c:1056 +#: src/gui/curses/gui-display.c:1056 src/gui/curses/gui-display.c:1059 msgid "-MORE-" msgstr "" -#: src/gui/curses/gui-display.c:1225 +#: src/gui/curses/gui-display.c:1228 msgid " [A] Accept" msgstr "" -#: src/gui/curses/gui-display.c:1226 src/gui/curses/gui-display.c:1232 -#: src/gui/curses/gui-display.c:1239 +#: src/gui/curses/gui-display.c:1229 src/gui/curses/gui-display.c:1235 +#: src/gui/curses/gui-display.c:1242 msgid " [C] Cancel" msgstr "" -#: src/gui/curses/gui-display.c:1227 src/gui/curses/gui-display.c:1233 -#: src/gui/curses/gui-display.c:1240 src/gui/curses/gui-display.c:1247 -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1230 src/gui/curses/gui-display.c:1236 +#: src/gui/curses/gui-display.c:1243 src/gui/curses/gui-display.c:1250 +#: src/gui/curses/gui-display.c:1255 msgid " [Q] Close DCC view" msgstr "" -#: src/gui/curses/gui-display.c:1246 +#: src/gui/curses/gui-display.c:1249 msgid " [R] Remove" msgstr "" @@ -1698,39 +1702,39 @@ msgstr "" msgid "%s not enough memory for infobar message\n" msgstr "" -#: src/gui/gui-common.c:462 +#: src/gui/gui-common.c:465 #, c-format msgid "%s not enough memory for new line!\n" msgstr "" -#: src/gui/gui-common.c:505 +#: src/gui/gui-common.c:508 msgid "not enough memory!\n" msgstr "" -#: src/common/command.c:41 +#: src/common/command.c:42 msgid "create an alias for a command" msgstr "" -#: src/common/command.c:42 +#: src/common/command.c:43 msgid "[alias_name [command [arguments]]" msgstr "" -#: src/common/command.c:43 +#: src/common/command.c:44 msgid "" "alias_name: name of alias\n" "command: command name (WeeChat or IRC command, without first '/')\n" "arguments: arguments for command" msgstr "" -#: src/common/command.c:46 +#: src/common/command.c:47 msgid "manage buffers" msgstr "" -#: src/common/command.c:47 +#: src/common/command.c:48 msgid "[action | number]" msgstr "" -#: src/common/command.c:48 +#: src/common/command.c:49 msgid "" "action: action to do:\n" " move move buffer in the list (may be relative, for example -1)\n" @@ -1741,76 +1745,76 @@ msgid "" "number: jump to buffer by number" msgstr "" -#: src/common/command.c:55 +#: src/common/command.c:56 msgid "clear window(s)" msgstr "" -#: src/common/command.c:56 +#: src/common/command.c:57 msgid "[-all]" msgstr "" -#: src/common/command.c:57 +#: src/common/command.c:58 msgid "-all: clear all windows" msgstr "" -#: src/common/command.c:59 +#: src/common/command.c:60 msgid "connect to a server" msgstr "" -#: src/common/command.c:60 src/common/command.c:64 +#: src/common/command.c:61 src/common/command.c:65 msgid "servername" msgstr "" -#: src/common/command.c:61 +#: src/common/command.c:62 msgid "servername: server name to connect" msgstr "" -#: src/common/command.c:63 +#: src/common/command.c:64 msgid "disconnect from a server" msgstr "" -#: src/common/command.c:65 +#: src/common/command.c:66 msgid "servername: server name to disconnect" msgstr "" -#: src/common/command.c:67 +#: src/common/command.c:68 msgid "display help about commands" msgstr "" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "[command]" msgstr "" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "command: name of a WeeChat or IRC command" msgstr "" -#: src/common/command.c:70 +#: src/common/command.c:71 msgid "list/load/unload Perl scripts" msgstr "" -#: src/common/command.c:71 +#: src/common/command.c:72 msgid "[load filename] | [autoload] | [unload]" msgstr "" -#: src/common/command.c:72 +#: src/common/command.c:73 msgid "" "filename: Perl script (file) to load\n" "Without argument, /perl command lists all loaded Perl scripts." msgstr "" -#: src/common/command.c:75 +#: src/common/command.c:76 msgid "list, add or remove servers" msgstr "" -#: src/common/command.c:76 +#: src/common/command.c:77 msgid "" "[servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-" "nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-" "command command] [-autojoin channel[,channel]] ] | [del servername]" msgstr "" -#: src/common/command.c:81 +#: src/common/command.c:82 msgid "" "servername: server name, for internal & display use\n" "hostname: name or IP address of server\n" @@ -1823,53 +1827,53 @@ msgid "" "realname: real name of user" msgstr "" -#: src/common/command.c:91 +#: src/common/command.c:92 msgid "save config to disk" msgstr "" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "[file]" msgstr "" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "file: filename for writing config" msgstr "" -#: src/common/command.c:94 +#: src/common/command.c:95 msgid "set config parameters" msgstr "" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "[option[=value]]" msgstr "" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "" "option: name of an option\n" "value: value for option" msgstr "" -#: src/common/command.c:97 +#: src/common/command.c:98 msgid "remove an alias" msgstr "" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name" msgstr "" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name: name of alias to remove" msgstr "" -#: src/common/command.c:100 +#: src/common/command.c:101 msgid "manage windows" msgstr "" -#: src/common/command.c:101 +#: src/common/command.c:102 msgid "[action]" msgstr "" -#: src/common/command.c:102 +#: src/common/command.c:103 msgid "" "action: action to do:\n" " close close current window (under development!)\n" @@ -1878,347 +1882,350 @@ msgid "" " splitv split current window vertically" msgstr "" -#: src/common/command.c:357 +#: src/common/command.c:237 #, c-format msgid "%s alias or command \"%s\" already exists!\n" msgstr "" -#: src/common/command.c:366 +#: src/common/command.c:247 #, c-format msgid "%s alias cannot run another alias!\n" msgstr "" -#: src/common/command.c:372 +#: src/common/command.c:254 #, c-format msgid "%s target command \"%s\" does not exist!\n" msgstr "" -#: src/common/command.c:558 +#: src/common/command.c:451 #, c-format msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n" msgstr "" -#: src/common/command.c:567 +#: src/common/command.c:463 #, c-format msgid "" "%s wrong argument count for %s command \"%s\" (expected: between %d and %d " "arg%s)\n" msgstr "" -#: src/common/command.c:586 +#: src/common/command.c:485 #, c-format msgid "%s %s command \"%s\" failed\n" msgstr "" -#: src/common/command.c:611 +#: src/common/command.c:513 #, c-format msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n" msgstr "" -#: src/common/command.c:620 +#: src/common/command.c:525 #, c-format msgid "" "%s wrong argument count for IRC command \"%s\" (expected: between %d and %d " "arg%s)\n" msgstr "" -#: src/common/command.c:633 +#: src/common/command.c:540 #, c-format msgid "%s command \"%s\" needs a server connection!\n" msgstr "" -#: src/common/command.c:645 +#: src/common/command.c:555 #, c-format msgid "%s IRC command \"%s\" failed\n" msgstr "" -#: src/common/command.c:692 +#: src/common/command.c:604 #, c-format msgid "%s unknown command \"%s\" (type /help for help)\n" msgstr "" -#: src/common/command.c:761 +#: src/common/command.c:675 #, c-format msgid "%s cannot find nick for sending message\n" msgstr "" -#: src/common/command.c:767 +#: src/common/command.c:684 msgid "This window is not a channel!\n" msgstr "" -#: src/common/command.c:793 src/common/command.c:805 src/common/command.c:894 +#: src/common/command.c:712 src/common/command.c:736 src/common/command.c:831 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "" -#: src/common/command.c:800 +#: src/common/command.c:721 #, c-format msgid "Alias \"%s\" => \"%s\" created\n" msgstr "" -#: src/common/command.c:815 +#: src/common/command.c:727 +#, c-format +msgid "Failed to create alias \"%s\" => \"%s\" (not enough memory)\n" +msgstr "" + +#: src/common/command.c:747 msgid "List of aliases:\n" msgstr "" -#: src/common/command.c:825 +#: src/common/command.c:760 msgid "No alias defined.\n" msgstr "" -#: src/common/command.c:847 +#: src/common/command.c:783 msgid "Opened buffers:\n" msgstr "" -#: src/common/command.c:866 +#: src/common/command.c:802 msgid "Channel: " msgstr "" -#: src/common/command.c:869 src/common/command.c:879 +#: src/common/command.c:805 src/common/command.c:815 msgid " (server: " msgstr "" -#: src/common/command.c:876 +#: src/common/command.c:812 msgid "Private with: " msgstr "" -#: src/common/command.c:916 src/common/command.c:1019 +#: src/common/command.c:854 src/common/command.c:963 #, c-format msgid "%s incorrect buffer number\n" msgstr "" -#: src/common/command.c:929 +#: src/common/command.c:868 #, c-format msgid "%s can not close the single buffer\n" msgstr "" -#: src/common/command.c:938 +#: src/common/command.c:878 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" -#: src/common/command.c:959 +#: src/common/command.c:899 msgid "Notify levels: " msgstr "" -#: src/common/command.c:985 src/common/command.c:994 +#: src/common/command.c:926 src/common/command.c:936 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "" -#: src/common/command.c:1011 +#: src/common/command.c:954 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1043 +#: src/common/command.c:988 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "" -#: src/common/command.c:1071 +#: src/common/command.c:1017 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1090 src/common/command.c:1128 -#: src/common/command.c:1704 +#: src/common/command.c:1037 src/common/command.c:1080 +#: src/common/command.c:1693 #, c-format msgid "%s server \"%s\" not found\n" msgstr "" -#: src/common/command.c:1115 +#: src/common/command.c:1063 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1121 +#: src/common/command.c:1071 msgid "Auto-reconnection is cancelled\n" msgstr "" -#: src/common/command.c:1147 +#: src/common/command.c:1100 #, c-format msgid "> List of %s internal commands:\n" msgstr "" -#: src/common/command.c:1152 +#: src/common/command.c:1111 msgid "> List of IRC commands:\n" msgstr "" -#: src/common/command.c:1167 +#: src/common/command.c:1129 #, c-format -msgid "> Help on %s internal command \"%s\":\n" +msgid "> Help on %s internal command \"" msgstr "" -#: src/common/command.c:1170 src/common/command.c:1189 -#, c-format -msgid "Syntax: /%s %s\n" +#: src/common/command.c:1134 src/common/command.c:1157 +msgid "Syntax: " msgstr "" -#: src/common/command.c:1187 -#, c-format -msgid "> Help on IRC command \"%s\":\n" +#: src/common/command.c:1152 +msgid "> Help on IRC command \"" msgstr "" -#: src/common/command.c:1202 +#: src/common/command.c:1171 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "" -#: src/common/command.c:1227 +#: src/common/command.c:1196 msgid "Registered Perl scripts:\n" msgstr "" -#: src/common/command.c:1244 src/common/command.c:1266 -#: src/common/command.c:1288 +#: src/common/command.c:1213 src/common/command.c:1235 +#: src/common/command.c:1257 msgid " (none)\n" msgstr "" -#: src/common/command.c:1249 +#: src/common/command.c:1218 msgid "Perl message handlers:\n" msgstr "" -#: src/common/command.c:1258 +#: src/common/command.c:1227 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr "" -#: src/common/command.c:1271 +#: src/common/command.c:1240 msgid "Perl command handlers:\n" msgstr "" -#: src/common/command.c:1280 +#: src/common/command.c:1249 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr "" -#: src/common/command.c:1300 +#: src/common/command.c:1269 msgid "Perl scripts unloaded\n" msgstr "" -#: src/common/command.c:1325 src/common/command.c:1917 +#: src/common/command.c:1295 src/common/command.c:1924 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "" -#: src/common/command.c:1336 +#: src/common/command.c:1308 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" msgstr "" -#: src/common/command.c:1385 +#: src/common/command.c:1357 msgid "No server.\n" msgstr "" -#: src/common/command.c:1396 +#: src/common/command.c:1368 #, c-format msgid "Server '%s' not found.\n" msgstr "" -#: src/common/command.c:1407 +#: src/common/command.c:1380 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "" -#: src/common/command.c:1413 +#: src/common/command.c:1388 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "" -#: src/common/command.c:1430 +#: src/common/command.c:1407 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1436 src/common/command.c:1569 +#: src/common/command.c:1413 src/common/command.c:1554 msgid "Server" msgstr "" -#: src/common/command.c:1439 +#: src/common/command.c:1416 msgid "has been deleted\n" msgstr "" -#: src/common/command.c:1453 +#: src/common/command.c:1431 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "" -#: src/common/command.c:1462 +#: src/common/command.c:1441 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "" -#: src/common/command.c:1486 src/common/command.c:1512 -#: src/common/command.c:1524 src/common/command.c:1548 +#: src/common/command.c:1466 src/common/command.c:1494 +#: src/common/command.c:1507 src/common/command.c:1533 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1498 +#: src/common/command.c:1479 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1536 +#: src/common/command.c:1520 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1572 +#: src/common/command.c:1557 msgid "created\n" msgstr "" -#: src/common/command.c:1577 +#: src/common/command.c:1563 #, c-format msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1633 +#: src/common/command.c:1620 msgid "(unknown)" msgstr "" -#: src/common/command.c:1656 +#: src/common/command.c:1643 msgid "(password hidden) " msgstr "" -#: src/common/command.c:1732 src/common/command.c:1772 +#: src/common/command.c:1725 src/common/command.c:1771 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "" -#: src/common/command.c:1736 src/common/command.c:1766 +#: src/common/command.c:1730 src/common/command.c:1763 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "" -#: src/common/command.c:1751 +#: src/common/command.c:1746 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "" -#: src/common/command.c:1845 +#: src/common/command.c:1847 #, c-format msgid "No config option found with \"%s\"\n" msgstr "" -#: src/common/command.c:1848 +#: src/common/command.c:1850 msgid "No config option found\n" msgstr "" -#: src/common/command.c:1854 +#: src/common/command.c:1857 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "" -#: src/common/command.c:1857 +#: src/common/command.c:1860 msgid "config option(s) found\n" msgstr "" -#: src/common/command.c:1876 +#: src/common/command.c:1880 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1885 +#: src/common/command.c:1890 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" @@ -3049,61 +3056,66 @@ msgstr "" #: src/common/weeconfig.c:1136 #, c-format +msgid "%s %s, line %d: invalid section for option, line is ignored\n" +msgstr "" + +#: src/common/weeconfig.c:1144 +#, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "" -#: src/common/weeconfig.c:1170 +#: src/common/weeconfig.c:1178 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:1181 +#: src/common/weeconfig.c:1189 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" "Expected: boolean value: 'off' or 'on'\n" msgstr "" -#: src/common/weeconfig.c:1190 +#: src/common/weeconfig.c:1198 #, 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:1201 +#: src/common/weeconfig.c:1209 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: one of these strings: " msgstr "" -#: src/common/weeconfig.c:1217 +#: src/common/weeconfig.c:1225 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "" -#: src/common/weeconfig.c:1276 src/common/weeconfig.c:1449 +#: src/common/weeconfig.c:1285 src/common/weeconfig.c:1458 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:1282 +#: src/common/weeconfig.c:1291 #, c-format msgid "%s: creating default config file...\n" msgstr "" -#: src/common/weeconfig.c:1283 +#: src/common/weeconfig.c:1292 msgid "creating default config file\n" msgstr "" -#: src/common/weeconfig.c:1286 src/common/weeconfig.c:1458 +#: src/common/weeconfig.c:1295 src/common/weeconfig.c:1467 #, c-format msgid "" "#\n" "# %s configuration file, created by %s v%s on %s#\n" msgstr "" -#: src/common/weeconfig.c:1455 +#: src/common/weeconfig.c:1464 msgid "saving config to disk\n" msgstr "" diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 31346a741..8d425fd59 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -25,6 +25,8 @@ lib_weechat_main_a_SOURCES = weechat.c \ command.h \ completion.c \ completion.h \ + weelist.c \ + weelist.h \ weeconfig.c \ weeconfig.h \ history.c \ diff --git a/src/common/command.c b/src/common/command.c index 5d3bf7def..547657965 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -29,6 +29,7 @@ #include "weechat.h" #include "command.h" +#include "weelist.h" #include "weeconfig.h" #include "../irc/irc.h" #include "../gui/gui.h" @@ -111,111 +112,17 @@ t_weechat_command weechat_commands[] = t_weechat_alias *weechat_alias = NULL; t_weechat_alias *weechat_last_alias = NULL; -t_index_command *index_commands; -t_index_command *last_index_command; +t_weelist *index_commands; +t_weelist *last_index_command; /* - * index_command_search: search a command - */ - -t_index_command * -index_command_search (char *command) -{ - t_index_command *ptr_index; - - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) - { - if (strcasecmp (command, ptr_index->command_name) == 0) - return ptr_index; - } - return NULL; -} - -/* - * index_command_find_pos: find position for a command index (for sorting index) - */ - -t_index_command * -index_command_find_pos (char *command) -{ - t_index_command *ptr_index; - - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) - { - if (strcasecmp (command, ptr_index->command_name) < 0) - return ptr_index; - } - return NULL; -} - -/* - * index_command_insert_sorted: insert index into sorted list - */ - -void -index_command_insert_sorted (t_index_command *index) -{ - t_index_command *pos_index; - - pos_index = index_command_find_pos (index->command_name); - - if (index_commands) - { - if (pos_index) - { - /* insert index into the list (before index found) */ - index->prev_index = pos_index->prev_index; - index->next_index = pos_index; - if (pos_index->prev_index) - pos_index->prev_index->next_index = index; - else - index_commands = index; - pos_index->prev_index = index; - } - else - { - /* add index to the end */ - index->prev_index = last_index_command; - index->next_index = NULL; - last_index_command->next_index = index; - last_index_command = index; - } - } - else - { - index->prev_index = NULL; - index->next_index = NULL; - index_commands = index; - last_index_command = index; - } -} - -/* - * index_command_new: create new index command and add it to index list - */ - -t_index_command * -index_command_new (char *command_name) -{ - t_index_command *new_index; - - if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command))))) - { - new_index->command_name = strdup (command_name); - index_command_insert_sorted (new_index); - return new_index; - } - return NULL; -} - -/* - * index_command_build: build an index of commands (internal, irc and alias) + * command_index_build: build an index of commands (internal, irc and alias) * This list will be sorted, and used for completion */ void -index_command_build () +command_index_build () { int i; @@ -224,49 +131,21 @@ index_command_build () i = 0; while (weechat_commands[i].command_name) { - (void) index_command_new (weechat_commands[i].command_name); + (void) weelist_add (&index_commands, &last_index_command, + weechat_commands[i].command_name); i++; } i = 0; while (irc_commands[i].command_name) { if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) - (void) index_command_new (irc_commands[i].command_name); + (void) weelist_add (&index_commands, &last_index_command, + irc_commands[i].command_name); i++; } } /* - * index_command_free: free an index command and reomve it from list - */ - -void -index_command_free (t_index_command *index) -{ - t_index_command *new_index_commands; - - /* remove index command from list */ - if (last_index_command == index) - last_index_command = index->prev_index; - if (index->prev_index) - { - (index->prev_index)->next_index = index->next_index; - new_index_commands = index_commands; - } - else - new_index_commands = index->next_index; - - if (index->next_index) - (index->next_index)->prev_index = index->prev_index; - - /* free data */ - if (index->command_name) - free (index->command_name); - free (index); - index_commands = new_index_commands; -} - -/* * alias_search: search an alias */ @@ -352,8 +231,9 @@ alias_new (char *alias_name, char *alias_command) char *pos; t_weechat_alias *new_alias; - if (index_command_search (alias_name)) + if (weelist_search (index_commands, alias_name)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias or command \"%s\" already exists!\n"), WEECHAT_ERROR, alias_name); return NULL; @@ -363,12 +243,14 @@ alias_new (char *alias_name, char *alias_command) pos[0] = '\0'; if (alias_search (alias_command)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias cannot run another alias!\n"), WEECHAT_ERROR); return NULL; } - if (!index_command_search (alias_command)) + if (!weelist_search (index_commands, alias_command)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s target command \"%s\" does not exist!\n"), WEECHAT_ERROR, alias_command); return NULL; @@ -529,6 +411,15 @@ exec_weechat_command (t_irc_server *server, char *string) /* look for end of command */ ptr_args = NULL; + + pos = &command[strlen (command) - 1]; + if (pos[0] == ' ') + { + while ((pos > command) && (pos[0] == ' ')) + pos--; + pos[1] = '\0'; + } + pos = strchr (command, ' '); if (pos) { @@ -554,6 +445,8 @@ exec_weechat_command (t_irc_server *server, char *string) { if (weechat_commands[i].min_arg == weechat_commands[i].max_arg) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for %s command \"%s\" " "(expected: %d arg%s)\n"), @@ -562,7 +455,10 @@ exec_weechat_command (t_irc_server *server, char *string) weechat_commands[i].max_arg, (weechat_commands[i].max_arg > 1) ? "s" : ""); + } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for %s command \"%s\" " "(expected: between %d and %d arg%s)\n"), @@ -572,6 +468,7 @@ exec_weechat_command (t_irc_server *server, char *string) weechat_commands[i].max_arg, (weechat_commands[i].max_arg > 1) ? "s" : ""); + } } else { @@ -582,9 +479,12 @@ exec_weechat_command (t_irc_server *server, char *string) return_code = (int) (weechat_commands[i].cmd_function_1arg) (ptr_args); if (return_code < 0) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s %s command \"%s\" failed\n"), WEECHAT_ERROR, PACKAGE_NAME, command + 1); + } } if (argv) { @@ -606,6 +506,8 @@ exec_weechat_command (t_irc_server *server, char *string) || (argc > irc_commands[i].max_arg)) { if (irc_commands[i].min_arg == irc_commands[i].max_arg) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for IRC command \"%s\" " @@ -614,7 +516,10 @@ exec_weechat_command (t_irc_server *server, char *string) command + 1, irc_commands[i].max_arg, (irc_commands[i].max_arg > 1) ? "s" : ""); + } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for IRC command \"%s\" " @@ -623,15 +528,18 @@ exec_weechat_command (t_irc_server *server, char *string) command + 1, irc_commands[i].min_arg, irc_commands[i].max_arg, (irc_commands[i].max_arg > 1) ? "s" : ""); + } } else { if ((irc_commands[i].need_connection) && ((!server) || (!server->is_connected))) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s command \"%s\" needs a server connection!\n"), WEECHAT_ERROR, irc_commands[i].command_name); + free (command); return 0; } if (irc_commands[i].cmd_function_args) @@ -641,9 +549,12 @@ exec_weechat_command (t_irc_server *server, char *string) return_code = (int) (irc_commands[i].cmd_function_1arg) (server, ptr_args); if (return_code < 0) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s IRC command \"%s\" failed\n"), WEECHAT_ERROR, command + 1); + } } if (argv) { @@ -688,6 +599,7 @@ exec_weechat_command (t_irc_server *server, char *string) return 1; } } + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown command \"%s\" (type /help for help)\n"), WEECHAT_ERROR, @@ -757,14 +669,20 @@ user_command (t_irc_server *server, char *command) COLOR_WIN_CHAT, "%s\n", command); } else + { + irc_display_prefix (server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s cannot find nick for sending message\n"), WEECHAT_ERROR); + } } } else + { + irc_display_prefix ((server) ? server->buffer : NULL, PREFIX_ERROR); gui_printf ((server) ? server->buffer : NULL, _("This window is not a channel!\n")); + } } } @@ -790,18 +708,31 @@ weechat_cmd_alias (char *arguments) pos++; if (!pos[0]) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "alias"); return -1; } if (!alias_new (arguments, pos)) return -1; - (void) index_command_new (arguments); - gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"), - arguments, pos); + if (weelist_add (&index_commands, &last_index_command, arguments)) + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"), + arguments, pos); + } + else + { + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("Failed to create alias \"%s\" => \"%s\" " + "(not enough memory)\n"), + arguments, pos); + return -1; + } } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "alias"); return -1; @@ -812,17 +743,22 @@ weechat_cmd_alias (char *arguments) /* List all aliases */ if (weechat_alias) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("List of aliases:\n")); for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, " %s => %s\n", ptr_alias->alias_name, ptr_alias->alias_command + 1); } } else + { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("No alias defined.\n")); + } } return 0; } @@ -891,6 +827,7 @@ weechat_cmd_buffer (int argc, char **argv) if (argc < 2) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "buffer"); return -1; @@ -913,6 +850,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect buffer number\n"), WEECHAT_ERROR); return -1; @@ -925,7 +863,8 @@ weechat_cmd_buffer (int argc, char **argv) if ((!gui_current_window->buffer->next_buffer) && (gui_current_window->buffer == gui_buffers)) { - gui_printf (gui_current_window->buffer, + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("%s can not close the single buffer\n"), WEECHAT_ERROR); return -1; @@ -934,7 +873,8 @@ weechat_cmd_buffer (int argc, char **argv) { if (SERVER(gui_current_window->buffer)->channels) { - gui_printf (gui_current_window->buffer, + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("%s can not close server buffer while channels " "are opened\n"), WEECHAT_ERROR); @@ -982,6 +922,7 @@ weechat_cmd_buffer (int argc, char **argv) if ((number < 0) || (number > 3)) { /* invalid highlight level */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"), WEECHAT_ERROR); return -1; @@ -991,6 +932,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"), WEECHAT_ERROR); return -1; @@ -1007,6 +949,7 @@ weechat_cmd_buffer (int argc, char **argv) { if (!gui_switch_to_buffer_by_number (gui_current_window, (int) number)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s buffer \"%s\" not found for \"%s\" command\n"), WEECHAT_ERROR, argv[0], "buffer"); @@ -1016,6 +959,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect buffer number\n"), WEECHAT_ERROR); return -1; @@ -1039,6 +983,7 @@ weechat_cmd_clear (int argc, char **argv) gui_buffer_clear_all (); else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("unknown parameter \"%s\" for \"%s\" command\n"), argv[0], "clear"); @@ -1067,6 +1012,7 @@ weechat_cmd_connect (int argc, char **argv) { if (ptr_server->is_connected) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s already connected to server \"%s\"!\n"), WEECHAT_ERROR, argv[0]); @@ -1086,6 +1032,7 @@ weechat_cmd_connect (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, argv[0]); @@ -1111,19 +1058,24 @@ weechat_cmd_disconnect (int argc, char **argv) { if ((!ptr_server->is_connected) && (ptr_server->reconnect_start == 0)) { + irc_display_prefix (ptr_server->buffer, PREFIX_ERROR); gui_printf (ptr_server->buffer, _("%s not connected to server \"%s\"!\n"), WEECHAT_ERROR, argv[0]); return -1; } if (ptr_server->reconnect_start > 0) + { + irc_display_prefix (ptr_server->buffer, PREFIX_INFO); gui_printf (ptr_server->buffer, _("Auto-reconnection is cancelled\n")); + } server_disconnect (ptr_server, 0); gui_draw_buffer_status (gui_current_window->buffer, 1); } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, argv[0]); @@ -1143,18 +1095,29 @@ weechat_cmd_help (int argc, char **argv) if (argc == 0) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, - _("> List of %s internal commands:\n"), PACKAGE_NAME); + _("> List of %s internal commands:\n"), + PACKAGE_NAME); for (i = 0; weechat_commands[i].command_name; i++) - gui_printf (NULL, " %s - %s\n", - weechat_commands[i].command_name, + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", + weechat_commands[i].command_name); + gui_printf (NULL, " - %s\n", _(weechat_commands[i].command_description)); + } + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("> List of IRC commands:\n")); for (i = 0; irc_commands[i].command_name; i++) if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) - gui_printf (NULL, " %s - %s\n", - irc_commands[i].command_name, + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", + irc_commands[i].command_name); + gui_printf (NULL, " - %s\n", _(irc_commands[i].command_description)); + } } if (argc == 1) { @@ -1162,42 +1125,48 @@ weechat_cmd_help (int argc, char **argv) { if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) { - gui_printf - (NULL, - _("> Help on %s internal command \"%s\":\n"), - PACKAGE_NAME, weechat_commands[i].command_name); - gui_printf (NULL, - _("Syntax: /%s %s\n"), - weechat_commands[i].command_name, + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("> Help on %s internal command \""), PACKAGE_NAME); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", + weechat_commands[i].command_name); + gui_printf (NULL, "\":\n"); + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Syntax: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s", + weechat_commands[i].command_name); + gui_printf (NULL, " %s\n", (weechat_commands[i].arguments) ? _(weechat_commands[i].arguments) : ""); if (weechat_commands[i].arguments_description) - { gui_printf (NULL, "%s\n", _(weechat_commands[i].arguments_description)); - } return 0; } } for (i = 0; irc_commands[i].command_name; i++) { - if (strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + && (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)) { - gui_printf (NULL, - _("> Help on IRC command \"%s\":\n"), - irc_commands[i].command_name); - gui_printf (NULL, _("Syntax: /%s %s\n"), - irc_commands[i].command_name, + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("> Help on IRC command \"")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", + irc_commands[i].command_name); + gui_printf (NULL, "\":\n"); + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Syntax: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s", + irc_commands[i].command_name); + gui_printf (NULL, "%s\n", (irc_commands[i].arguments) ? _(irc_commands[i].arguments) : ""); if (irc_commands[i].arguments_description) - { gui_printf (NULL, "%s\n", _(irc_commands[i].arguments_description)); - } return 0; } } + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("No help available, \"%s\" is an unknown command\n"), argv[0]); @@ -1321,17 +1290,20 @@ weechat_cmd_perl (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "perl"); } break; default: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for \"%s\" command\n"), WEECHAT_ERROR, "perl"); } #else + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("WeeChat was build without Perl support.\n" "Please rebuild WeeChat with " @@ -1403,15 +1375,19 @@ weechat_cmd_server (int argc, char **argv) { if (argc < 2) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing servername for \"%s\" command\n"), WEECHAT_ERROR, "server del"); return -1; } if (argc > 2) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s too much arguments for \"%s\" command, ignoring arguments\n"), WEECHAT_WARNING, "server del"); + } /* look for server by name */ server_found = NULL; @@ -1426,6 +1402,7 @@ weechat_cmd_server (int argc, char **argv) } if (!server_found) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found for \"%s\" command\n"), WEECHAT_ERROR, argv[1], "server del"); @@ -1449,6 +1426,7 @@ weechat_cmd_server (int argc, char **argv) if (argc < 3) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing parameters for \"%s\" command\n"), WEECHAT_ERROR, "server"); @@ -1458,6 +1436,7 @@ weechat_cmd_server (int argc, char **argv) if (server_name_already_exists (argv[0])) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" already exists, can't create it!\n"), WEECHAT_ERROR, argv[0]); @@ -1482,6 +1461,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-pwd"); @@ -1494,6 +1474,7 @@ weechat_cmd_server (int argc, char **argv) { if (i >= (argc - 3)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing nick(s) for \"%s\" parameter\n"), WEECHAT_ERROR, "-nicks"); @@ -1508,6 +1489,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-username"); @@ -1520,6 +1502,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-realname"); @@ -1532,6 +1515,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing command for \"%s\" parameter\n"), WEECHAT_ERROR, "-command"); @@ -1544,6 +1528,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-autojoin"); @@ -1573,6 +1558,7 @@ weechat_cmd_server (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unable to create server\n"), WEECHAT_ERROR); @@ -1601,6 +1587,7 @@ weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *val { char *color_name, *pos_nickserv, *pos_pwd, *value2; + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, " %s%s%s", (prefix) ? prefix : "", (prefix) ? "." : "", @@ -1700,14 +1687,18 @@ weechat_cmd_set (char *arguments) pos[0] = '\0'; ptr_server = server_search (option); if (!ptr_server) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, option); + } else { switch (config_set_server_value (ptr_server, pos + 1, value)) { case 0: + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", config_sections[CONFIG_SECTION_SERVER].section_name); @@ -1730,10 +1721,12 @@ weechat_cmd_set (char *arguments) config_change_buffer_content (); break; case -1: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s config option \"%s\" not found\n"), WEECHAT_ERROR, pos + 1); break; case -2: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"), WEECHAT_ERROR, pos + 1); break; @@ -1748,6 +1741,7 @@ weechat_cmd_set (char *arguments) { if (ptr_option->handler_change == NULL) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s option \"%s\" can not be changed while WeeChat is running\n"), WEECHAT_ERROR, option); @@ -1764,12 +1758,16 @@ weechat_cmd_set (char *arguments) weechat_set_cmd_display_option (ptr_option, NULL, NULL); } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"), WEECHAT_ERROR, option); + } } } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s config option \"%s\" not found\n"), WEECHAT_ERROR, option); } @@ -1792,6 +1790,7 @@ weechat_cmd_set (char *arguments) { if (!section_displayed) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", @@ -1820,6 +1819,7 @@ weechat_cmd_set (char *arguments) { if (!section_displayed) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", config_sections[CONFIG_SECTION_SERVER].section_name); @@ -1842,6 +1842,7 @@ weechat_cmd_set (char *arguments) } if (number_found == 0) { + irc_display_prefix (NULL, PREFIX_INFO); if (option) gui_printf (NULL, _("No config option found with \"%s\"\n"), option); @@ -1850,6 +1851,7 @@ weechat_cmd_set (char *arguments) } else { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", number_found); if (option) gui_printf (NULL, _("config option(s) found with \"%s\"\n"), @@ -1868,21 +1870,23 @@ weechat_cmd_set (char *arguments) int weechat_cmd_unalias (char *arguments) { - t_index_command *ptr_index; + t_weelist *ptr_weelist; t_weechat_alias *ptr_alias; - ptr_index = index_command_search (arguments); - if (!ptr_index) + ptr_weelist = weelist_search (index_commands, arguments); + if (!ptr_weelist) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias or command \"%s\" not found\n"), WEECHAT_ERROR, arguments); return -1; } - index_command_free (ptr_index); + weelist_remove (&index_commands, &last_index_command, ptr_weelist); ptr_alias = alias_search (arguments); if (ptr_alias) alias_free (ptr_alias); + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("Alias \"%s\" removed\n"), arguments); return 0; @@ -1898,6 +1902,7 @@ weechat_cmd_window (int argc, char **argv) if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, "window list -- NOT DEVELOPED!\n"); } else @@ -1914,6 +1919,7 @@ weechat_cmd_window (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "window"); diff --git a/src/common/command.h b/src/common/command.h index 586cb7737..44a2a913b 100644 --- a/src/common/command.h +++ b/src/common/command.h @@ -21,6 +21,7 @@ #ifndef __WEECHAT_COMMAND_H #define __WEECHAT_COMMAND_H 1 +#include "weelist.h" #include "../irc/irc.h" #define MAX_ARGS 8192 @@ -48,21 +49,13 @@ struct t_weechat_alias t_weechat_alias *next_alias; }; -typedef struct t_index_command t_index_command; - -struct t_index_command -{ - char *command_name; - t_index_command *prev_index; - t_index_command *next_index; -}; +extern t_weechat_command weechat_commands[]; extern t_weechat_alias *weechat_alias; -extern t_index_command *index_commands; +extern t_weelist *index_commands; +extern t_weelist *last_index_command; -extern t_index_command *index_command_search (char *); -extern t_index_command *index_command_new (char *); -extern void index_command_build (); +extern void command_index_build (); extern t_weechat_alias *alias_new (char *, char *); extern int exec_weechat_command (t_irc_server *, char *); extern void user_command (t_irc_server *, char *); diff --git a/src/common/completion.c b/src/common/completion.c index 8f6a6d2ba..d7632f13e 100644 --- a/src/common/completion.c +++ b/src/common/completion.c @@ -29,8 +29,10 @@ #include "weechat.h" #include "completion.h" -#include "../irc/irc.h" #include "command.h" +#include "weelist.h" +#include "weeconfig.h" +#include "../irc/irc.h" /* @@ -40,8 +42,14 @@ void completion_init (t_completion *completion) { + completion->context = COMPLETION_NULL; + completion->base_command = NULL; + completion->base_command_arg = 0; completion->position = -1; completion->base_word = NULL; + + completion->completion_list = NULL; + completion->last_completion = NULL; } /* @@ -51,8 +59,463 @@ completion_init (t_completion *completion) void completion_free (t_completion *completion) { + if (completion->base_command) + free (completion->base_command); + completion->base_command = NULL; + if (completion->base_word) free (completion->base_word); + completion->base_word = NULL; + + while (completion->completion_list) + weelist_remove (&completion->completion_list, + &completion->last_completion, + completion->completion_list); + completion->completion_list = NULL; + completion->last_completion = NULL; +} + +/* + * completion_stop: stop completion (for example after 1 arg of command with 1 arg) + */ + +void +completion_stop (t_completion *completion) +{ + completion->context = COMPLETION_NULL; + completion->position = -1; +} + +/* + * completion_build_list: build data list according to command and argument # + */ + +void +completion_build_list (t_completion *completion, void *channel) +{ + t_weelist *ptr_list; + int i, j; + t_irc_server *ptr_server; + t_irc_channel *ptr_channel; + char option_name[256]; + t_weechat_alias *ptr_alias; + + /* WeeChat internal commands */ + + /* no completion for some commands */ + if ((strcasecmp (completion->base_command, "server") == 0) + || (strcasecmp (completion->base_command, "save") == 0)) + { + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "alias") == 0) + && (completion->base_command_arg == 1)) + { + for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_list->data); + } + return; + } + if ((strcasecmp (completion->base_command, "buffer") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "close"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "move"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "notify"); + return; + } + if ((strcasecmp (completion->base_command, "clear") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "-all"); + return; + } + if (((strcasecmp (completion->base_command, "connect") == 0) + || (strcasecmp (completion->base_command, "connect") == 0)) + && (completion->base_command_arg == 1)) + { + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_server->name); + } + return; + } + if ((strcasecmp (completion->base_command, "help") == 0) + && (completion->base_command_arg == 1)) + { + for (i = 0; weechat_commands[i].command_name; i++) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + weechat_commands[i].command_name); + } + for (i = 0; irc_commands[i].command_name; i++) + { + if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) + weelist_add (&completion->completion_list, + &completion->last_completion, + irc_commands[i].command_name); + } + return; + } + if ((strcasecmp (completion->base_command, "perl") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "load"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "autoload"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "unload"); + return; + } + if ((strcasecmp (completion->base_command, "set") == 0) + && (completion->base_command_arg == 1)) + { + 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++) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + weechat_options[i][j].option_name); + } + } + } + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) + { + snprintf (option_name, sizeof (option_name), "%s.%s", + ptr_server->name, + weechat_options[CONFIG_SECTION_SERVER][i].option_name); + weelist_add (&completion->completion_list, + &completion->last_completion, + option_name); + } + } + return; + } + if ((strcasecmp (completion->base_command, "unalias") == 0) + && (completion->base_command_arg == 1)) + { + for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_alias->alias_name); + } + return; + } + if ((strcasecmp (completion->base_command, "window") == 0) + && (completion->base_command_arg == 2)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "close"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splith"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splitv"); + return; + } + + /* IRC commands */ + + /* no completion for some commands */ + if ((strcasecmp (completion->base_command, "admin") == 0) + || (strcasecmp (completion->base_command, "die") == 0) + || (strcasecmp (completion->base_command, "info") == 0) + || (strcasecmp (completion->base_command, "join") == 0) + || (strcasecmp (completion->base_command, "links") == 0) + || (strcasecmp (completion->base_command, "list") == 0) + || (strcasecmp (completion->base_command, "lusers") == 0) + || (strcasecmp (completion->base_command, "me") == 0) + || (strcasecmp (completion->base_command, "motd") == 0) + || (strcasecmp (completion->base_command, "oper") == 0) + || (strcasecmp (completion->base_command, "ping") == 0) + || (strcasecmp (completion->base_command, "pong") == 0) + || (strcasecmp (completion->base_command, "quote") == 0) + || (strcasecmp (completion->base_command, "rehash") == 0) + || (strcasecmp (completion->base_command, "restart") == 0) + || (strcasecmp (completion->base_command, "service") == 0) + || (strcasecmp (completion->base_command, "servlist") == 0) + || (strcasecmp (completion->base_command, "squery") == 0) + || (strcasecmp (completion->base_command, "squit") == 0) + || (strcasecmp (completion->base_command, "stats") == 0) + || (strcasecmp (completion->base_command, "summon") == 0) + || (strcasecmp (completion->base_command, "time") == 0) + || (strcasecmp (completion->base_command, "trace") == 0) + || (strcasecmp (completion->base_command, "users") == 0) + || (strcasecmp (completion->base_command, "wallops") == 0) + || (strcasecmp (completion->base_command, "who") == 0)) + { + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "away") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_away); + return; + } + if ((strcasecmp (completion->base_command, "ctcp") == 0) + && (completion->base_command_arg == 2)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "action"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "version"); + return; + } + if ((strcasecmp (completion->base_command, "dcc") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "chat"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "send"); + return; + } + if (strcasecmp (completion->base_command, "invite") == 0) + { + /* arg1: nickname */ + if (completion->base_command_arg == 1) + return; + + /* arg > 2: not allowed */ + if (completion->base_command_arg > 2) + { + completion_stop (completion); + return; + } + + /* arg2: channel */ + if (SERVER(gui_current_window->buffer)) + { + for (ptr_channel = SERVER(gui_current_window->buffer)->channels; + ptr_channel; ptr_channel = ptr_channel->next_channel) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_channel->name); + } + } + return; + } + if (strcasecmp (completion->base_command, "kick") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if (strcasecmp (completion->base_command, "kill") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if (strcasecmp (completion->base_command, "notice") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "part") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_part); + return; + } + if (strcasecmp (completion->base_command, "query") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "quit") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_quit); + return; + } + if (strcasecmp (completion->base_command, "topic") == 0) + { + if (completion->base_command_arg == 1) + { + if (!channel || !((t_irc_channel *)channel)->topic + || !((t_irc_channel *)channel)->topic[0]) + completion_stop (completion); + else + weelist_add (&completion->completion_list, + &completion->last_completion, + ((t_irc_channel *)channel)->topic); + } + else + completion_stop (completion); + return; + } +} + +/* + * completion_find_context: find context for completion + */ + +void +completion_find_context (t_completion *completion, void *channel, char *buffer, + int size, int pos) +{ + int i, command, command_arg, pos_start, pos_end; + + /* look for context */ + completion_free (completion); + command = (buffer[0] == '/') ? 1 : 0; + command_arg = 0; + i = 0; + while (i < pos) + { + if (buffer[i] == ' ') + { + command_arg++; + i++; + while ((i < pos) && (buffer[i] == ' ')) i++; + } + else + i++; + } + if (command) + { + if (command_arg > 0) + { + completion->context = COMPLETION_COMMAND_ARG; + completion->base_command_arg = command_arg; + } + else + { + completion->context = COMPLETION_COMMAND; + completion->base_command_arg = 0; + } + } + else + { + if (channel) + completion->context = COMPLETION_NICK; + else + completion->context = COMPLETION_NULL; + } + + /* look for word to complete (base word) */ + completion->base_word_pos = 0; + completion->position_replace = pos; + + if (size > 0) + { + i = pos; + pos_start = i; + if (buffer[i] == ' ') + { + if ((i > 0) && (buffer[i-1] != ' ')) + { + i--; + while ((i >= 0) && (buffer[i] != ' ')) + i--; + pos_start = i + 1; + } + } + else + { + while ((i >= 0) && (buffer[i] != ' ')) + i--; + pos_start = i + 1; + } + i = pos; + while ((i < size) && (buffer[i] != ' ')) + i++; + pos_end = i - 1; + + completion->base_word_pos = pos_start; + + if (pos_start <= pos_end) + { + if (completion->context == COMPLETION_COMMAND) + completion->position_replace = pos_start + 1; + else + completion->position_replace = pos_start; + + completion->base_word = (char *) malloc (pos_end - pos_start + 2); + for (i = pos_start; i <= pos_end; i++) + completion->base_word[i - pos_start] = buffer[i]; + completion->base_word[pos_end - pos_start + 1] = '\0'; + } + } + + if (!completion->base_word) + completion->base_word = strdup (""); + + /* find command (for command argument completion only) */ + if (completion->context == COMPLETION_COMMAND_ARG) + { + pos_start = 0; + while ((pos_start < size) && (buffer[pos_start] != '/')) + pos_start++; + if (buffer[pos_start] == '/') + { + pos_start++; + pos_end = pos_start; + while ((pos_end < size) && (buffer[pos_end] != ' ')) + pos_end++; + if (buffer[pos_end] == ' ') + pos_end--; + + completion->base_command = (char *) malloc (pos_end - pos_start + 2); + for (i = pos_start; i <= pos_end; i++) + completion->base_command[i - pos_start] = buffer[i]; + completion->base_command[pos_end - pos_start + 1] = '\0'; + completion_build_list (completion, channel); + } + } } /* @@ -62,23 +525,37 @@ completion_free (t_completion *completion) void completion_command (t_completion *completion) { - int length, word_found_seen; - t_index_command *ptr_index; + int length, word_found_seen, other_completion; + t_weelist *ptr_weelist, *ptr_weelist2; length = strlen (completion->base_word) - 1; word_found_seen = 0; - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) + other_completion = 0; + for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0) + if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) { if ((!completion->word_found) || word_found_seen) { - completion->word_found = ptr_index->command_name; + completion->word_found = ptr_weelist->data; + for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; + ptr_weelist2 = ptr_weelist2->next_weelist) + { + if (strncasecmp (ptr_weelist2->data, + completion->base_word + 1, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; return; } + other_completion++; } if (completion->word_found && - (strcasecmp (ptr_index->command_name, completion->word_found) == 0)) + (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -95,11 +572,15 @@ completion_command (t_completion *completion) void completion_nick (t_completion *completion, t_irc_channel *channel) { - int length, word_found_seen; - t_irc_nick *ptr_nick; + int length, word_found_seen, other_completion; + t_irc_nick *ptr_nick, *ptr_nick2; + if (!channel) + return; + length = strlen (completion->base_word); word_found_seen = 0; + other_completion = 0; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) @@ -107,8 +588,21 @@ completion_nick (t_completion *completion, t_irc_channel *channel) if ((!completion->word_found) || word_found_seen) { completion->word_found = ptr_nick->nick; + for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; + ptr_nick2 = ptr_nick2->next_nick) + { + if (strncasecmp (ptr_nick2->nick, + completion->base_word, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; return; } + other_completion++; } if (completion->word_found && (strcasecmp (ptr_nick->nick, completion->word_found) == 0)) @@ -122,90 +616,104 @@ completion_nick (t_completion *completion, t_irc_channel *channel) } /* - * completion_search: complete word according to context + * completion_command_arg: complete a command argument */ void -completion_search (t_completion *completion, void *channel, - char *buffer, int size, int pos) +completion_command_arg (t_completion *completion, t_irc_channel *channel) { - int i, pos_start, pos_end; - char *old_word_found; + int length, word_found_seen, other_completion; + t_weelist *ptr_weelist, *ptr_weelist2; - /* TODO: complete when no word is there with command according to context */ - if (size == 0) + length = strlen (completion->base_word); + word_found_seen = 0; + other_completion = 0; + for (ptr_weelist = completion->completion_list; ptr_weelist; + ptr_weelist = ptr_weelist->next_weelist) + { + if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) + { + if ((!completion->word_found) || word_found_seen) + { + completion->word_found = ptr_weelist->data; + for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; + ptr_weelist2 = ptr_weelist2->next_weelist) + { + if (strncasecmp (ptr_weelist2->data, + completion->base_word, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; + return; + } + other_completion++; + } + if (completion->word_found && + (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + word_found_seen = 1; + } + if (completion->word_found) { completion->word_found = NULL; - return; + completion_command_arg (completion, channel); } +} + +/* + * completion_search: complete word according to context + */ + +void +completion_search (t_completion *completion, void *channel, + char *buffer, int size, int pos) +{ + char *old_word_found; - /* if new complation => look for base word */ + /* if new completion => look for base word */ if (pos != completion->position) { completion->word_found = NULL; - - if ((pos == size) || (buffer[pos-1] != ' ')) - pos--; - if ((pos > 0) && (buffer[pos] == ' ')) - return; - - i = pos; - while ((i >= 0) && (buffer[i] != ' ')) - i--; - pos_start = i + 1; - i = pos; - while ((i < size) && (buffer[i] != ' ')) - i++; - pos_end = i - 1; - - if (pos_start > pos_end) - return; - - completion->base_word_pos = pos_start; - - if (completion->base_word) - free (completion->base_word); - completion->base_word = (char *) malloc (pos_end - pos_start + 2); - - for (i = pos_start; i <= pos_end; i++) - completion->base_word[i - pos_start] = buffer[i]; - completion->base_word[pos_end - pos_start + 1] = '\0'; - - if (completion->base_word[0] == '/') - completion->position_replace = pos_start + 1; - else - completion->position_replace = pos_start; + completion_find_context (completion, channel, buffer, size, pos); } /* completion */ old_word_found = completion->word_found; - if (completion->base_word[0] == '/') + switch (completion->context) { - completion_command (completion); - if (completion->word_found) - { - if (old_word_found) - completion->diff_size = strlen (completion->word_found) - - strlen (old_word_found); + case COMPLETION_NULL: + /* should never be executed */ + return; + case COMPLETION_NICK: + if (channel) + completion_nick (completion, (t_irc_channel *)channel); else - completion->diff_size = strlen (completion->word_found) - - strlen (completion->base_word) + 1; - } + return; + break; + case COMPLETION_COMMAND: + completion_command (completion); + break; + case COMPLETION_COMMAND_ARG: + if (completion->completion_list) + completion_command_arg (completion, (t_irc_channel *)channel); + else + completion_nick (completion, (t_irc_channel *)channel); + break; } - else + if (completion->word_found) { - if (channel) + if (old_word_found) + completion->diff_size = strlen (completion->word_found) - + strlen (old_word_found); + else { - completion_nick (completion, (t_irc_channel *)channel); - if (completion->word_found) - { - if (old_word_found) - completion->diff_size = strlen (completion->word_found) - - strlen (old_word_found); - else - completion->diff_size = strlen (completion->word_found) - - strlen (completion->base_word); - } + completion->diff_size = strlen (completion->word_found) - + strlen (completion->base_word); + if (completion->context == COMPLETION_COMMAND) + completion->diff_size++; } } } diff --git a/src/common/completion.h b/src/common/completion.h index a040b03e0..9798a03a1 100644 --- a/src/common/completion.h +++ b/src/common/completion.h @@ -21,16 +21,33 @@ #ifndef __WEECHAT_COMPLETION_H #define __WEECHAT_COMPLETION_H 1 +#include "weelist.h" + +#define COMPLETION_NULL 0 +#define COMPLETION_NICK 1 +#define COMPLETION_COMMAND 2 +#define COMPLETION_COMMAND_ARG 3 + typedef struct t_completion t_completion; struct t_completion { - char *base_word; /* word to complete (when Tab was pressed) */ - int base_word_pos; /* beggining of base word */ - int position; /* position where we shoud complete */ - char *word_found; /* word found (to replace base word) */ - int position_replace; /* position where word should be replaced */ - int diff_size; /* size difference (< 0 = char(s) deleted) */ + /* completion context */ + int context; /* context: null, nick, command, cmd arg */ + char *base_command; /* command with arg to complete (can be NULL) */ + int base_command_arg; /* # arg to complete (if context is cmd arg) */ + char *base_word; /* word to complete (when Tab was pressed) */ + int base_word_pos; /* beggining of base word */ + int position; /* position where Tab was pressed */ + + /* for command argument completion */ + t_weelist *completion_list; /* data list for completion */ + t_weelist *last_completion; /* last data element for completion */ + + /* completion found */ + char *word_found; /* word found (to replace base word) */ + int position_replace; /* position where word has to be replaced */ + int diff_size; /* size difference (< 0 = char(s) deleted) */ }; extern void completion_init (t_completion *); diff --git a/src/common/weechat.c b/src/common/weechat.c index 0243383aa..95a468bfa 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -525,7 +525,7 @@ main (int argc, char *argv[]) wee_parse_args (argc, argv); /* parse command line args */ wee_create_home_dirs (); /* create WeeChat directories */ wee_init_log (); /* init log file */ - index_command_build (); /* build commands index for completion */ + command_index_build (); /* build commands index for completion */ switch (config_read ()) /* read configuration */ { diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index c57d20b74..6875e8df9 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -218,7 +218,7 @@ 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, &config_change_color }, + "default", 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, @@ -228,11 +228,11 @@ t_config_option weechat_options_colors[] = { "col_chat", N_("color for chat text"), N_("color for chat text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat, NULL, &config_change_color }, + "default", 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, &config_change_color }, + "default", 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, @@ -274,7 +274,7 @@ t_config_option weechat_options_colors[] = { "col_status", N_("color for status bar"), N_("color for status bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_status, NULL, &config_change_color }, + "default", NULL, &cfg_col_status, NULL, &config_change_color }, { "col_status_delimiters", N_("color for status bar delimiters"), N_("color for status bar delimiters"), OPTION_TYPE_COLOR, 0, 0, 0, @@ -290,7 +290,7 @@ t_config_option weechat_options_colors[] = { "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, - "gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color }, + "default", 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, @@ -318,7 +318,7 @@ t_config_option weechat_options_colors[] = { "col_input", N_("color for input text"), N_("color for input text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_input, NULL, &config_change_color }, + "default", 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, @@ -336,7 +336,7 @@ t_config_option weechat_options_colors[] = { "col_nick", N_("color for nicknames"), N_("color for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick, NULL, &config_change_color }, + "default", 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, @@ -360,7 +360,7 @@ t_config_option weechat_options_colors[] = { "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, &config_change_color }, + "default", 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, @@ -1017,7 +1017,7 @@ config_default_values () if (int_value < 0) gui_printf (NULL, _("%s unable to assign default int with string (\"%s\")\n"), - weechat_options[i][j].default_string); + WEECHAT_WARNING, weechat_options[i][j].default_string); else *weechat_options[i][j].ptr_int = int_value; @@ -1028,7 +1028,7 @@ config_default_values () weechat_options[i][j].default_string)) gui_printf (NULL, _("%s unable to assign default color (\"%s\")\n"), - weechat_options[i][j].default_string); + WEECHAT_WARNING, weechat_options[i][j].default_string); break; case OPTION_TYPE_STRING: *weechat_options[i][j].ptr_string = @@ -1130,96 +1130,105 @@ config_read () } else { - pos = strchr (line, '='); - if (pos == NULL) + if (section == CONFIG_SECTION_NONE) + { gui_printf (NULL, - _("%s %s, line %d: invalid syntax, missing \"=\"\n"), + _("%s %s, line %d: invalid section for option, line is ignored\n"), WEECHAT_WARNING, filename, line_number); + } else { - pos[0] = '\0'; - pos++; - pos2 = strchr (pos, '\r'); - if (pos2 != NULL) - pos2[0] = '\0'; - pos2 = strchr (pos, '\n'); - if (pos2 != NULL) - pos2[0] = '\0'; - - if (section == CONFIG_SECTION_ALIAS) - { - if (alias_new (line, pos)) - index_command_new (line); - } + pos = strchr (line, '='); + if (pos == NULL) + gui_printf (NULL, + _("%s %s, line %d: invalid syntax, missing \"=\"\n"), + WEECHAT_WARNING, filename, line_number); else { - option_number = -1; - for (i = 0; - weechat_options[section][i].option_name; i++) + pos[0] = '\0'; + pos++; + pos2 = strchr (pos, '\r'); + if (pos2 != NULL) + pos2[0] = '\0'; + pos2 = strchr (pos, '\n'); + if (pos2 != NULL) + pos2[0] = '\0'; + + if (section == CONFIG_SECTION_ALIAS) { - if (strcmp - (weechat_options[section][i].option_name, - ptr_line) == 0) - { - option_number = i; - break; - } + if (alias_new (line, pos)) + weelist_add (&index_commands, &last_index_command, line); } - if (option_number < 0) - gui_printf (NULL, - _("%s %s, line %d: invalid option \"%s\"\n"), - WEECHAT_WARNING, filename, line_number, ptr_line); else { - if (config_option_set_value (&weechat_options[section][option_number], pos) < 0) + option_number = -1; + for (i = 0; + weechat_options[section][i].option_name; i++) + { + if (strcmp + (weechat_options[section][i].option_name, + ptr_line) == 0) + { + option_number = i; + break; + } + } + if (option_number < 0) + gui_printf (NULL, + _("%s %s, line %d: invalid option \"%s\"\n"), + WEECHAT_WARNING, filename, line_number, ptr_line); + else { - switch (weechat_options[section] - [option_number].option_type) + if (config_option_set_value (&weechat_options[section][option_number], pos) < 0) { - case OPTION_TYPE_BOOLEAN: - gui_printf (NULL, - _("%s %s, line %d: invalid value for" - "option '%s'\n" - "Expected: boolean value: " - "'off' or 'on'\n"), - WEECHAT_WARNING, filename, - line_number, ptr_line); - break; - case OPTION_TYPE_INT: - gui_printf (NULL, - _("%s %s, line %d: invalid value for " - "option '%s'\n" - "Expected: integer between %d " - "and %d\n"), - WEECHAT_WARNING, filename, - line_number, ptr_line, - weechat_options[section][option_number].min, - weechat_options[section][option_number].max); - break; - case OPTION_TYPE_INT_WITH_STRING: - gui_printf (NULL, - _("%s %s, line %d: invalid value for " - "option '%s'\n" - "Expected: one of these strings: "), - WEECHAT_WARNING, filename, - line_number, ptr_line); - i = 0; - while (weechat_options[section][option_number].array_values[i]) - { - gui_printf (NULL, "\"%s\" ", - weechat_options[section][option_number].array_values[i]); - i++; - } - gui_printf (NULL, "\n"); - break; - case OPTION_TYPE_COLOR: - gui_printf (NULL, - _("%s %s, line %d: invalid color " - "name for option '%s'\n"), - WEECHAT_WARNING, filename, - line_number, - ptr_line); - break; + switch (weechat_options[section] + [option_number].option_type) + { + case OPTION_TYPE_BOOLEAN: + gui_printf (NULL, + _("%s %s, line %d: invalid value for" + "option '%s'\n" + "Expected: boolean value: " + "'off' or 'on'\n"), + WEECHAT_WARNING, filename, + line_number, ptr_line); + break; + case OPTION_TYPE_INT: + gui_printf (NULL, + _("%s %s, line %d: invalid value for " + "option '%s'\n" + "Expected: integer between %d " + "and %d\n"), + WEECHAT_WARNING, filename, + line_number, ptr_line, + weechat_options[section][option_number].min, + weechat_options[section][option_number].max); + break; + case OPTION_TYPE_INT_WITH_STRING: + gui_printf (NULL, + _("%s %s, line %d: invalid value for " + "option '%s'\n" + "Expected: one of these strings: "), + WEECHAT_WARNING, filename, + line_number, ptr_line); + i = 0; + while (weechat_options[section][option_number].array_values[i]) + { + gui_printf (NULL, "\"%s\" ", + weechat_options[section][option_number].array_values[i]); + i++; + } + gui_printf (NULL, "\n"); + break; + case OPTION_TYPE_COLOR: + gui_printf (NULL, + _("%s %s, line %d: invalid color " + "name for option '%s'\n"), + WEECHAT_WARNING, filename, + line_number, + ptr_line); + break; + } } } } diff --git a/src/common/weelist.c b/src/common/weelist.c new file mode 100644 index 000000000..e4bf30ef9 --- /dev/null +++ b/src/common/weelist.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* weelist.c: sorted lists management */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> +#include <string.h> + +#include "weechat.h" +#include "weelist.h" + + +/* + * weelist_search: search date in a list + */ + +t_weelist * +weelist_search (t_weelist *weelist, char *data) +{ + t_weelist *ptr_weelist; + + for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) + { + if (strcasecmp (data, ptr_weelist->data) == 0) + return ptr_weelist; + } + /* word not found in list */ + return NULL; +} + +/* + * weelist_find_pos: find position for data (keeping list sorted) + */ + +t_weelist * +weelist_find_pos (t_weelist *weelist, char *data) +{ + t_weelist *ptr_weelist; + + for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) + { + if (strcasecmp (data, ptr_weelist->data) < 0) + return ptr_weelist; + } + /* position not found, best position is at the end */ + return NULL; +} + +/* + * weelist_insert: insert an element to the list (at good position) + */ + +void +weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element) +{ + t_weelist *pos_weelist; + + pos_weelist = weelist_find_pos (*weelist, element->data); + + if (*weelist) + { + if (pos_weelist) + { + /* insert data into the list (before position found) */ + element->prev_weelist = pos_weelist->prev_weelist; + element->next_weelist = pos_weelist; + if (pos_weelist->prev_weelist) + pos_weelist->prev_weelist->next_weelist = element; + else + *weelist = element; + pos_weelist->prev_weelist = element; + } + else + { + /* add data to the end */ + element->prev_weelist = *last_weelist; + element->next_weelist = NULL; + (*last_weelist)->next_weelist = element; + *last_weelist = element; + } + } + else + { + element->prev_weelist = NULL; + element->next_weelist = NULL; + *weelist = element; + *last_weelist = element; + } +} + +/* + * weelist_add: create new data and add it to list + */ + +t_weelist * +weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data) +{ + t_weelist *new_weelist; + + if (!data || (!data[0])) + return NULL; + + if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist))))) + { + new_weelist->data = strdup (data); + weelist_insert (weelist, last_weelist, new_weelist); + return new_weelist; + } + /* failed to allocate new element */ + return NULL; +} + +/* + * weelist_remove: free an element in a list + */ + +void +weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element) +{ + t_weelist *new_weelist; + + /* remove element from list */ + if (*last_weelist == element) + *last_weelist = element->prev_weelist; + if (element->prev_weelist) + { + (element->prev_weelist)->next_weelist = element->next_weelist; + new_weelist = *weelist; + } + else + new_weelist = element->next_weelist; + + if (element->next_weelist) + (element->next_weelist)->prev_weelist = element->prev_weelist; + + /* free data */ + if (element->data) + free (element->data); + free (element); + *weelist = new_weelist; +} diff --git a/src/common/weelist.h b/src/common/weelist.h new file mode 100644 index 000000000..14a869968 --- /dev/null +++ b/src/common/weelist.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef __WEECHAT_LIST_H +#define __WEECHAT_LIST_H 1 + +typedef struct t_weelist t_weelist; + +struct t_weelist +{ + char *data; + t_weelist *prev_weelist; + t_weelist *next_weelist; +}; + +t_weelist *weelist_search (t_weelist *, char *); +t_weelist *weelist_add (t_weelist **, t_weelist **, char *); +void weelist_remove (t_weelist **, t_weelist **, t_weelist *); + +#endif /* weelist.h */ diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 767e30fc8..3c89eeeea 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -41,22 +41,21 @@ t_gui_color gui_colors[] = -{ { "default", -1 | A_NORMAL }, - { "black", COLOR_BLACK | A_NORMAL }, - { "red", COLOR_RED | A_NORMAL }, - { "lightred", COLOR_RED | A_BOLD }, - { "green", COLOR_GREEN | A_NORMAL }, - { "lightgreen", COLOR_GREEN | A_BOLD }, - { "brown", COLOR_YELLOW | A_NORMAL }, - { "yellow", COLOR_YELLOW | A_BOLD }, - { "blue", COLOR_BLUE | A_NORMAL }, - { "lightblue", COLOR_BLUE | A_BOLD }, - { "magenta", COLOR_MAGENTA | A_NORMAL }, +{ { "default", -1 | A_NORMAL }, + { "black", COLOR_BLACK | A_NORMAL }, + { "red", COLOR_RED | A_NORMAL }, + { "lightred", COLOR_RED | A_BOLD }, + { "green", COLOR_GREEN | A_NORMAL }, + { "lightgreen", COLOR_GREEN | A_BOLD }, + { "brown", COLOR_YELLOW | A_NORMAL }, + { "yellow", COLOR_YELLOW | A_BOLD }, + { "blue", COLOR_BLUE | A_NORMAL }, + { "lightblue", COLOR_BLUE | A_BOLD }, + { "magenta", COLOR_MAGENTA | A_NORMAL }, { "lightmagenta", COLOR_MAGENTA | A_BOLD }, - { "cyan", COLOR_CYAN | A_NORMAL }, - { "lightcyan", COLOR_CYAN | A_BOLD }, - { "gray", COLOR_WHITE }, - { "white", COLOR_WHITE | A_BOLD }, + { "cyan", COLOR_CYAN | A_NORMAL }, + { "lightcyan", COLOR_CYAN | A_BOLD }, + { "white", COLOR_WHITE | A_BOLD }, { NULL, 0 } }; @@ -892,6 +891,9 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) char format_more[32]; int i, first_mode; + /* make gcc happy */ + (void) buffer; + if (!gui_ok) return; @@ -1797,43 +1799,43 @@ gui_init_colors () init_pair (COLOR_DCC_ABORTED, cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg); - color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD; - color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD; - color_attr[COLOR_WIN_CHAT_TIME - 1] = cfg_col_chat_time & A_BOLD; - color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = cfg_col_chat_time_sep & A_BOLD; - color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD; - color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = cfg_col_chat_prefix1 & A_BOLD; - color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = cfg_col_chat_prefix2 & A_BOLD; - color_attr[COLOR_WIN_CHAT_NICK - 1] = cfg_col_chat_nick & A_BOLD; - color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD; - color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD; - color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD; - color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = cfg_col_chat_highlight & A_BOLD; - color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD; - color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = cfg_col_status_delimiters & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = cfg_col_status_data_highlight & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD; - color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD; - color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD; - color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD; - color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD; - color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD; - color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD; - color_attr[COLOR_WIN_NICK - 1] = cfg_col_nick & A_BOLD; - color_attr[COLOR_WIN_NICK_OP - 1] = cfg_col_nick_op & A_BOLD; - color_attr[COLOR_WIN_NICK_HALFOP - 1] = cfg_col_nick_halfop & A_BOLD; - color_attr[COLOR_WIN_NICK_VOICE - 1] = cfg_col_nick_voice & A_BOLD; + color_attr[COLOR_WIN_TITLE - 1] = (cfg_col_title >= 0) ? cfg_col_title & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT - 1] = (cfg_col_chat >= 0) ? cfg_col_chat & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_TIME - 1] = (cfg_col_chat_time >= 0) ? cfg_col_chat_time & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = (cfg_col_chat_time_sep >= 0) ? cfg_col_chat_time_sep & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_HOST - 1] = (cfg_col_chat_host >= 0) ? cfg_col_chat_host & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = (cfg_col_chat_channel >= 0) ? cfg_col_chat_channel & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = (cfg_col_chat_highlight >= 0) ? cfg_col_chat_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS - 1] = (cfg_col_status >= 0) ? cfg_col_status & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = (cfg_col_status_delimiters >= 0) ? cfg_col_status_delimiters & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = (cfg_col_status_data_msg >= 0) ? cfg_col_status_data_msg & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = (cfg_col_status_data_highlight >= 0) ? cfg_col_status_data_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = (cfg_col_status_data_other >= 0) ? cfg_col_status_data_other & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_MORE - 1] = (cfg_col_status_more >= 0) ? cfg_col_status_more & A_BOLD : 0; + color_attr[COLOR_WIN_INFOBAR - 1] = (cfg_col_infobar >= 0) ? cfg_col_infobar & A_BOLD : 0; + color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = (cfg_col_infobar_highlight >= 0) ? cfg_col_infobar_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT - 1] = (cfg_col_input >= 0) ? cfg_col_input & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = (cfg_col_input_channel >= 0) ? cfg_col_input_channel & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT_NICK - 1] = (cfg_col_input_nick >= 0) ? cfg_col_input_nick & A_BOLD : 0; + color_attr[COLOR_WIN_NICK - 1] = (cfg_col_nick >= 0) ? cfg_col_nick & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_OP - 1] = (cfg_col_nick_op >= 0) ? cfg_col_nick_op & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_HALFOP - 1] = (cfg_col_nick_halfop >= 0) ? cfg_col_nick_halfop & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_VOICE - 1] = (cfg_col_nick_voice >= 0) ? cfg_col_nick_voice & A_BOLD : 0; color_attr[COLOR_WIN_NICK_SEP - 1] = 0; - color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD; - color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD; - color_attr[COLOR_DCC_SELECTED - 1] = cfg_col_dcc_selected & A_BOLD; - color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD; - color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD; - color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD; - color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD; - color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD; - color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD; + color_attr[COLOR_WIN_NICK_SELF - 1] = (cfg_col_nick_self >= 0) ? cfg_col_nick_self & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_PRIVATE - 1] = (cfg_col_nick_private >= 0) ? cfg_col_nick_private & A_BOLD : 0; + color_attr[COLOR_DCC_SELECTED - 1] = (cfg_col_dcc_selected >= 0) ? cfg_col_dcc_selected & A_BOLD : 0; + color_attr[COLOR_DCC_WAITING - 1] = (cfg_col_dcc_waiting >= 0) ? cfg_col_dcc_waiting & A_BOLD : 0; + color_attr[COLOR_DCC_CONNECTING - 1] = (cfg_col_dcc_connecting >= 0) ? cfg_col_dcc_connecting & A_BOLD : 0; + color_attr[COLOR_DCC_ACTIVE - 1] = (cfg_col_dcc_active >= 0) ? cfg_col_dcc_active & A_BOLD : 0; + color_attr[COLOR_DCC_DONE - 1] = (cfg_col_dcc_done >= 0) ? cfg_col_dcc_done & A_BOLD : 0; + color_attr[COLOR_DCC_FAILED - 1] = (cfg_col_dcc_failed >= 0) ? cfg_col_dcc_failed & A_BOLD : 0; + color_attr[COLOR_DCC_ABORTED - 1] = (cfg_col_dcc_aborted >= 0) ? cfg_col_dcc_aborted & A_BOLD : 0; } } diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c index 54ed0dccc..eec1532ff 100644 --- a/src/gui/curses/gui-input.c +++ b/src/gui/curses/gui-input.c @@ -311,16 +311,16 @@ gui_read_keyb () gui_current_window->buffer->input_buffer, gui_current_window->buffer->input_buffer_size, gui_current_window->buffer->input_buffer_pos); + if (gui_current_window->buffer->completion.word_found) { /* replace word with new completed word into input buffer */ - gui_current_window->buffer->input_buffer_size += - gui_current_window->buffer->completion.diff_size; - gui_optimize_input_buffer_size (gui_current_window->buffer); - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; - if (gui_current_window->buffer->completion.diff_size > 0) { + gui_current_window->buffer->input_buffer_size += + gui_current_window->buffer->completion.diff_size; + gui_optimize_input_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; for (i = gui_current_window->buffer->input_buffer_size - 1; i >= gui_current_window->buffer->completion.position_replace + (int)strlen (gui_current_window->buffer->completion.word_found); i--) @@ -336,6 +336,10 @@ gui_read_keyb () gui_current_window->buffer->input_buffer[i] = gui_current_window->buffer->input_buffer[i - gui_current_window->buffer->completion.diff_size]; + gui_current_window->buffer->input_buffer_size += + gui_current_window->buffer->completion.diff_size; + gui_optimize_input_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; } strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace, @@ -344,35 +348,45 @@ gui_read_keyb () gui_current_window->buffer->input_buffer_pos = gui_current_window->buffer->completion.position_replace + strlen (gui_current_window->buffer->completion.word_found); - gui_current_window->buffer->completion.position = - gui_current_window->buffer->input_buffer_pos; + + /* position is < 0 this means only one word was found to complete, + so reinit to stop completion */ + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position = + gui_current_window->buffer->input_buffer_pos; /* add space or completor to the end of completion, if needed */ - if (gui_current_window->buffer->completion.base_word[0] == '/') + if ((gui_current_window->buffer->completion.context == COMPLETION_COMMAND) + || (gui_current_window->buffer->completion.context == COMPLETION_COMMAND_ARG)) { if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ') gui_buffer_insert_string (gui_current_window->buffer, " ", gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position++; + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position++; gui_current_window->buffer->input_buffer_pos++; } else { - if (gui_current_window->buffer->completion.base_word_pos == 0) + /* add nick completor if position 0 and completing nick */ + if ((gui_current_window->buffer->completion.base_word_pos == 0) + && (gui_current_window->buffer->completion.context == COMPLETION_NICK)) { if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos, cfg_look_completor, strlen (cfg_look_completor)) != 0) gui_buffer_insert_string (gui_current_window->buffer, cfg_look_completor, gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position += strlen (cfg_look_completor); + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position += strlen (cfg_look_completor); gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor); if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ') gui_buffer_insert_string (gui_current_window->buffer, " ", gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position++; + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position++; gui_current_window->buffer->input_buffer_pos++; } } diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index 17576ff5f..36cb5dda0 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -145,8 +145,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc, ((t_irc_server *)(server))->buffer = gui_buffers; if (channel) ((t_irc_channel *)(channel))->buffer = gui_buffers; - SERVER(gui_buffers) = server; - CHANNEL(gui_buffers) = channel; + gui_buffers->server = server; + gui_buffers->channel = channel; if (cfg_log_auto_server) log_start (gui_buffers); return gui_buffers; @@ -158,8 +158,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc, new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1; /* assign server and channel to buffer */ - SERVER(new_buffer) = server; - CHANNEL(new_buffer) = channel; + new_buffer->server = server; + new_buffer->channel = channel; new_buffer->dcc = dcc; /* assign buffer to server and channel */ if (server && !channel) @@ -381,6 +381,9 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another) if (hotlist_initial_buffer == buffer) hotlist_initial_buffer = NULL; + if (buffer_before_dcc == buffer) + buffer_before_dcc = NULL; + if (switch_to_another) { for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 87b0da101..5b2a2d6c1 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -52,10 +52,10 @@ t_irc_command irc_commands[] = 2, 3, 1, NULL, irc_cmd_send_dcc, NULL }, { "deop", N_("removes channel operator status from nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_deop, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL }, { "devoice", N_("removes voice from nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_devoice, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL }, { "die", N_("shutdown the server"), "", "", 0, 0, 1, NULL, irc_cmd_send_die, NULL }, @@ -136,7 +136,7 @@ t_irc_command irc_commands[] = 2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), - 0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL }, + 0, 1, 1, NULL, irc_cmd_send_names, NULL }, { "nick", N_("change current nickname"), N_("nickname"), N_("nickname: new nickname for current IRC server"), 1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick }, @@ -145,7 +145,7 @@ t_irc_command irc_commands[] = 2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice }, { "op", N_("gives channel operator status to nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_op, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_op, NULL, NULL }, { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), @@ -229,7 +229,7 @@ t_irc_command irc_commands[] = 0, 1, 1, NULL, irc_cmd_send_version, NULL }, { "voice", N_("gives voice to nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_voice, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL }, { "wallops", N_("send a message to all currently connected users who have " "set the 'w' user mode for themselves"), N_("text"), N_("text to send"), diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index 47447f22a..80c22ff5c 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -248,6 +248,14 @@ int irc_cmd_send_dcc (t_irc_server *server, char *arguments) { /* TODO: write this command! */ + + /* make gcc happy */ + (void) server; + (void) arguments; + + irc_display_prefix (server->buffer, PREFIX_ERROR); + gui_printf (server->buffer, _("This command is not developed!\n")); + return 0; } diff --git a/src/plugins/perl/wee-perl.c b/src/plugins/perl/wee-perl.c index c33e1bc40..555250cde 100644 --- a/src/plugins/perl/wee-perl.c +++ b/src/plugins/perl/wee-perl.c @@ -313,8 +313,8 @@ static XS (XS_IRC_add_command_handler) name = SvPV (ST (0), integer); function = SvPV (ST (1), integer); - if (!index_command_search (name)) - index_command_new (name); + if (!weelist_search (index_commands, name)) + weelist_add (&index_commands, &last_index_command, name); ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name); if (ptr_plugin_handler) { diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index e9b238aed..cafcd1970 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -337,6 +337,9 @@ plugin_exec_command (char *user_command, char *arguments, char *server) void plugin_unload (int plugin_type, char *scriptname) { + /* make gcc happy */ + (void) scriptname; + #ifdef PLUGINS switch (plugin_type) { diff --git a/weechat/AUTHORS b/weechat/AUTHORS index 5dfeb8169..04e442016 100644 --- a/weechat/AUTHORS +++ b/weechat/AUTHORS @@ -1,29 +1,35 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -Developers: ----------- - -All developers are connected to IRC: -server: irc.freenode.net, channel: #weechat +Developer: +--------- FlashCode <flashcode@flashtux.org> - Web : http://www.flashtux.org - IRC : nick is "FlashCode" + Web : http://weechat.flashtux.org + IRC : nick is "FlashCode" @ irc.freenode.net Jabber: flashcode@jabber.org ICQ : 160677660 AIM : FlashCode AIM Yahoo : FlashCode_Y +Testers: +------- + Bounga <bounga@altern.org> Web : http://bounga.ath.cx - IRC : nick is "Bounga" + IRC : nick is "Bounga" @ irc.freenode.net Jabber: Bounga@jabber.org ICQ : 178297842 Xahlexx <xahlexx@weeland.org> Web : http://www.weeland.org - IRC : nick is "xahlexx" + IRC : nick is "xahlexx" @ irc.freenode.net + + +===== + +Whole team is connected to IRC: +server: irc.freenode.net, channel: #weechat See README file for licence detail. diff --git a/weechat/ChangeLog b/weechat/ChangeLog index cd202b92b..770a28930 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,16 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-01-08 +ChangeLog - 2005-01-16 Version 0.1.0 (under dev!): + * improved completion: now completes commands arguments (IRC and internal), + when only one completion matches, completion mechanism is stoped (to + complete command arg for example) + * fixed colors bug: removed "gray" color (replaced by "default"), colors are + ok when terminal has white (or light) background + * fixed crash when unknown section with option(s) in config file * improved /set command: empty strings are allowed, new colors, server options can be changed while WeeChat is running * added default away/part/quit messages in config file @@ -12,6 +18,7 @@ Version 0.1.0 (under dev!): "irc_display_away" * server messages & errors are all prefixed (by 3 chars, like '-@-') * added new options for charset: look_charset_decode and look_charset_encode + * fixed /op, /deop, /voice, /devoice (now ok with many nicks) * fixed /me command (now ok without parameter) * fixed /away command (now ok if not away) * logs are now disabled by default (server/channel/private) diff --git a/weechat/FAQ b/weechat/FAQ index b61b03edc..efa7e33bd 100644 --- a/weechat/FAQ +++ b/weechat/FAQ @@ -1,4 +1,4 @@ -WeeChat FAQ, 2004-05-31 +WeeChat FAQ, 2005-01-16 ======================= Intended audience: @@ -53,7 +53,7 @@ A: Because WeeChat is very light and has new features. * developed from scratch (not based on any other IRC client) * multi-platform * 100% GPL and free - This is the "geekest Irc client" ;) + This is the "geekest" IRC client ;) 2.2 @@ -67,7 +67,7 @@ A: For help you can type /help. For help about a command, type /help command. ================================================================================ Q: How can I customize key bindings? -A: Today you can't do that. This will be available in a future version. +A: Today you can't do that. This is planed for a future version. 2.4 @@ -79,21 +79,22 @@ A: You can use /perl command to load scripts (default path is ~/.weechat/perl). Note that scripts in ~/.weechat/perl/autoload are automatically loaded when WeeChat is starting up. - WeeChat perl scripts are compatible with X-Chat, not with Irssi, sorry ;) + WeeChat perl scripts are compatible with X-Chat, but not with Irssi, + sorry ;) 2.5 ================================================================================ Q: How can I load Python scripts? -A: Today Python interface is not developed, so can't load any Python script. +A: Today Python interface is not developed, so you can't load any Python script. 2.6 ================================================================================ Q: How can I load Ruby scripts? -A: Today Ruby interface is not developed, so can't load any Ruby script. +A: Today Ruby interface is not developed, so you can't load any Ruby script. 3.1 @@ -154,4 +155,4 @@ A: There's many tasks to do (code, documentation, ...) ================================================================================ Q: Can I give money or other things to WeeChat developers? -A: No. +A: Beer is welcome :) diff --git a/weechat/FAQ.fr b/weechat/FAQ.fr index 847030a98..b3f4bdde7 100644 --- a/weechat/FAQ.fr +++ b/weechat/FAQ.fr @@ -1,4 +1,4 @@ -WeeChat FAQ, 2004-05-31 +WeeChat FAQ, 2005-01-16 ======================= Public concerné : @@ -57,7 +57,7 @@ R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités. * développé à partir de zéro (non basé sur un quelconque client IRC) * multi-platformes * 100% GPL et libre - C'est le client le plus "geek" ;) + C'est le client IRC le plus "geek" ;) 2.2 @@ -85,7 +85,7 @@ R: La commande /perl permet de charger les scripts Perl (le chemin par défaut est ~/.weechat/perl). Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement chargés par WeeChat lorsqu'il démarre. - Les scripts Perl WeeChat sont compatibles avec X-Chat, pas Irssi, + Les scripts Perl WeeChat sont compatibles avec X-Chat, mais pas Irssi, désolé ;) @@ -169,4 +169,4 @@ R: Il y a plusieurs choses à faire (code, documentation, ...) ================================================================================ Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ? -R: Non. +R: La bière est la bienvenue :) diff --git a/weechat/INSTALL b/weechat/INSTALL index cd5d82d1a..60680b026 100644 --- a/weechat/INSTALL +++ b/weechat/INSTALL @@ -6,7 +6,7 @@ WeeChat - Installation instructions --disable-curses : do not build Curses interface --enable-gtk : build Gtk+ interface (under development!) --enable-qt : build Qt interface (not developed!) - --with-debug : 1 for debug compilation, 2 for debug messages + --with-debug=X : X=1 for debug compilation, 2 for debug messages 2) Run 'make' diff --git a/weechat/README b/weechat/README index b04f4ff5f..2be68a19f 100644 --- a/weechat/README +++ b/weechat/README @@ -22,10 +22,7 @@ Features Copyright --------- -WeeChat (c) Copyright 2004 - by: FlashCode <flashcode@flashtux.org> - Xahlexx <xahlex@weeland.org> - Bounga <bounga@altern.org> +WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org> (see AUTHORS file if you want to contact authors) WeeChat is distributed under GPL licence (see COPYING file for complete license): diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 668ddae87..0e4103774 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.0-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-01-05 23:47+0100\n" +"POT-Creation-Date: 2005-01-16 12:34+0100\n" "PO-Revision-Date: 2005-01-01 13:00+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -20,7 +20,7 @@ msgstr "" msgid "%s cannot allocate new nick\n" msgstr "%s ompossible d'allouer un nouveau pseudo\n" -#: src/irc/irc-server.c:136 src/common/weeconfig.c:1397 +#: src/irc/irc-server.c:136 src/common/weeconfig.c:1406 msgid "Unable to get user's name" msgstr "Impossible de déterminer le nom d'utilisateur" @@ -1162,7 +1162,7 @@ msgstr "drapeau de mode inconnu" msgid "can't change mode for other users" msgstr "impossible de changer le mode pour les autres utilisateurs" -#: src/irc/irc-display.c:145 src/common/command.c:860 +#: src/irc/irc-display.c:145 src/common/command.c:796 msgid "Server: " msgstr "Serveur: " @@ -1199,38 +1199,42 @@ msgstr "inconnu" msgid "%s: using local hostname \"%s\"\n" msgstr "%s: utilisation du nom de machine local \"%s\"\n" -#: src/irc/irc-send.c:274 src/irc/irc-send.c:300 src/irc/irc-send.c:401 -#: src/irc/irc-send.c:724 src/irc/irc-send.c:803 src/irc/irc-send.c:1307 +#: src/irc/irc-send.c:257 +msgid "This command is not developed!\n" +msgstr "Cette commande n'est pas développée !\n" + +#: src/irc/irc-send.c:282 src/irc/irc-send.c:308 src/irc/irc-send.c:409 +#: src/irc/irc-send.c:734 src/irc/irc-send.c:813 src/irc/irc-send.c:1314 #, c-format msgid "%s \"%s\" command can only be executed in a channel window\n" msgstr "" "%s la commande \"%s\" peut seulement être exécutée dans une fenêtre de " "canal\n" -#: src/irc/irc-send.c:509 src/irc/irc-send.c:576 src/irc/irc-send.c:851 -#: src/irc/irc-send.c:865 src/irc/irc-send.c:1201 +#: src/irc/irc-send.c:519 src/irc/irc-send.c:586 src/irc/irc-send.c:861 +#: src/irc/irc-send.c:875 src/irc/irc-send.c:1208 #, c-format msgid "%s \"%s\" command can not be executed on a server window\n" msgstr "" "%s la commande \"%s\" ne peut pas être exécutée dans une fenêtre serveur\n" -#: src/irc/irc-send.c:594 src/irc/irc-send.c:619 src/irc/irc-recv.c:264 +#: src/irc/irc-send.c:604 src/irc/irc-send.c:629 src/irc/irc-recv.c:264 #: src/irc/irc-recv.c:1048 #, c-format msgid "%s nick not found for \"%s\" command\n" msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n" -#: src/irc/irc-send.c:671 src/irc/irc-send.c:949 src/irc/irc-recv.c:1214 +#: src/irc/irc-send.c:681 src/irc/irc-send.c:959 src/irc/irc-recv.c:1214 #, c-format msgid "%s cannot create new private window \"%s\"\n" msgstr "%s impossible de créer la fenêtre privée \"%s\"\n" -#: src/irc/irc-send.c:702 src/irc/irc-send.c:776 src/common/command.c:1331 +#: src/irc/irc-send.c:712 src/irc/irc-send.c:786 src/common/command.c:1302 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n" -#: src/irc/irc-send.c:1279 +#: src/irc/irc-send.c:1286 #, c-format msgid "%s, compiled on %s %s\n" msgstr "%s, compilé le %s %s\n" @@ -1769,35 +1773,35 @@ msgstr "Mo" msgid "Gb" msgstr "Go" -#: src/gui/curses/gui-display.c:1006 +#: src/gui/curses/gui-display.c:1009 #, c-format msgid "%d:[not connected] " msgstr "%d:[non connecté] " -#: src/gui/curses/gui-display.c:1014 +#: src/gui/curses/gui-display.c:1017 msgid "[Act: " msgstr "[Act: " -#: src/gui/curses/gui-display.c:1053 src/gui/curses/gui-display.c:1056 +#: src/gui/curses/gui-display.c:1056 src/gui/curses/gui-display.c:1059 msgid "-MORE-" msgstr "-PLUS-" -#: src/gui/curses/gui-display.c:1225 +#: src/gui/curses/gui-display.c:1228 msgid " [A] Accept" msgstr " [A] Accepter" -#: src/gui/curses/gui-display.c:1226 src/gui/curses/gui-display.c:1232 -#: src/gui/curses/gui-display.c:1239 +#: src/gui/curses/gui-display.c:1229 src/gui/curses/gui-display.c:1235 +#: src/gui/curses/gui-display.c:1242 msgid " [C] Cancel" msgstr " [C] Annuler" -#: src/gui/curses/gui-display.c:1227 src/gui/curses/gui-display.c:1233 -#: src/gui/curses/gui-display.c:1240 src/gui/curses/gui-display.c:1247 -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1230 src/gui/curses/gui-display.c:1236 +#: src/gui/curses/gui-display.c:1243 src/gui/curses/gui-display.c:1250 +#: src/gui/curses/gui-display.c:1255 msgid " [Q] Close DCC view" msgstr " [Q] Fermer la vue DCC" -#: src/gui/curses/gui-display.c:1246 +#: src/gui/curses/gui-display.c:1249 msgid " [R] Remove" msgstr " [R] Retirer" @@ -1810,24 +1814,24 @@ msgstr "serveur" msgid "%s not enough memory for infobar message\n" msgstr "%s pas assez de mémoire pour un message de la barre d'infos\n" -#: src/gui/gui-common.c:462 +#: src/gui/gui-common.c:465 #, c-format msgid "%s not enough memory for new line!\n" msgstr "%s pas assez de mémoire pour une nouvelle ligne !\n" -#: src/gui/gui-common.c:505 +#: src/gui/gui-common.c:508 msgid "not enough memory!\n" msgstr "pas assez de mémoire !\n" -#: src/common/command.c:41 +#: src/common/command.c:42 msgid "create an alias for a command" msgstr "créer un alias pour une commande" -#: src/common/command.c:42 +#: src/common/command.c:43 msgid "[alias_name [command [arguments]]" msgstr "[nom_alias [commande [paramètres]]" -#: src/common/command.c:43 +#: src/common/command.c:44 msgid "" "alias_name: name of alias\n" "command: command name (WeeChat or IRC command, without first '/')\n" @@ -1837,15 +1841,15 @@ msgstr "" "commande: nom de la commande (commande WeeChat ou IRC, sans le premier '/')\n" "paramètres: paramètres pour la commande" -#: src/common/command.c:46 +#: src/common/command.c:47 msgid "manage buffers" msgstr "gère les buffers" -#: src/common/command.c:47 +#: src/common/command.c:48 msgid "[action | number]" msgstr "[action | nombre]" -#: src/common/command.c:48 +#: src/common/command.c:49 msgid "" "action: action to do:\n" " move move buffer in the list (may be relative, for example -1)\n" @@ -1865,59 +1869,59 @@ msgstr "" "3=2+join/part)\n" "nombre: sauter au buffer qui a ce numéro" -#: src/common/command.c:55 +#: src/common/command.c:56 msgid "clear window(s)" msgstr "affacer la/les fenêtre(s)" -#: src/common/command.c:56 +#: src/common/command.c:57 msgid "[-all]" msgstr "[-all]" -#: src/common/command.c:57 +#: src/common/command.c:58 msgid "-all: clear all windows" msgstr "-all: effacer toutes les fenêtres" -#: src/common/command.c:59 +#: src/common/command.c:60 msgid "connect to a server" msgstr "se connecter à un serveur" -#: src/common/command.c:60 src/common/command.c:64 +#: src/common/command.c:61 src/common/command.c:65 msgid "servername" msgstr "nom_serveur" -#: src/common/command.c:61 +#: src/common/command.c:62 msgid "servername: server name to connect" msgstr "nom_serveur: nom du serveur pour se connecter" -#: src/common/command.c:63 +#: src/common/command.c:64 msgid "disconnect from a server" msgstr "se déconnecter d'un serveur" -#: src/common/command.c:65 +#: src/common/command.c:66 msgid "servername: server name to disconnect" msgstr "nom_serveur: nom du serveur pour se déconnecter" -#: src/common/command.c:67 +#: src/common/command.c:68 msgid "display help about commands" msgstr "afficher l'aide sur les commandes" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "[command]" msgstr "[commande]" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "command: name of a WeeChat or IRC command" msgstr "commande: nom d'une commande WeeChat ou IRC" -#: src/common/command.c:70 +#: src/common/command.c:71 msgid "list/load/unload Perl scripts" msgstr "liste/charge/décharge des scripts Perl" -#: src/common/command.c:71 +#: src/common/command.c:72 msgid "[load filename] | [autoload] | [unload]" msgstr "[load fichier] | [autoload] | [unload]" -#: src/common/command.c:72 +#: src/common/command.c:73 msgid "" "filename: Perl script (file) to load\n" "Without argument, /perl command lists all loaded Perl scripts." @@ -1925,11 +1929,11 @@ msgstr "" "fichier: script Perl (fichier) à charger\n" "Sans paramètre, la commande /perl liste tous les scripts Perl chargés." -#: src/common/command.c:75 +#: src/common/command.c:76 msgid "list, add or remove servers" msgstr "liste, ajoute ou retire des serveurs" -#: src/common/command.c:76 +#: src/common/command.c:77 msgid "" "[servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-" "nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-" @@ -1940,7 +1944,7 @@ msgstr "" "nom_utilisateur] [-realname nom_réel] [-command commande] [-autojoin canal[," "canal]] ] | [del nom_serveur]" -#: src/common/command.c:81 +#: src/common/command.c:82 msgid "" "servername: server name, for internal & display use\n" "hostname: name or IP address of server\n" @@ -1962,27 +1966,27 @@ msgstr "" "nom_utilisateur: nom d'utilisateur\n" "nom_réel: nom réel de l'utilisateur" -#: src/common/command.c:91 +#: src/common/command.c:92 msgid "save config to disk" msgstr "sauvegarder la configuration sur disque" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "[file]" msgstr "[fichier]" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "file: filename for writing config" msgstr "fichier: fichier pour sauvegarder la configuration" -#: src/common/command.c:94 +#: src/common/command.c:95 msgid "set config parameters" msgstr "modifier des paramètres de configuration" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "[option[=value]]" msgstr "[option[=valeur]]" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "" "option: name of an option\n" "value: value for option" @@ -1990,27 +1994,27 @@ msgstr "" "option: nom d'une option\n" "valeur: valeur pour l'option" -#: src/common/command.c:97 +#: src/common/command.c:98 msgid "remove an alias" msgstr "supprimer un alias" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name" msgstr "nom_alias" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name: name of alias to remove" msgstr "nom_alias: nom de l'alias à supprimer" -#: src/common/command.c:100 +#: src/common/command.c:101 msgid "manage windows" msgstr "gestion des fenêtres" -#: src/common/command.c:101 +#: src/common/command.c:102 msgid "[action]" msgstr "[action]" -#: src/common/command.c:102 +#: src/common/command.c:103 msgid "" "action: action to do:\n" " close close current window (under development!)\n" @@ -2025,29 +2029,29 @@ msgstr "" " splith éclate la fenêtre en deux horizontalement\n" " splitv éclate la fenêtre en deux verticalement" -#: src/common/command.c:357 +#: src/common/command.c:237 #, c-format msgid "%s alias or command \"%s\" already exists!\n" msgstr "%s l'alias ou la commande \"%s\" existe déjà !\n" -#: src/common/command.c:366 +#: src/common/command.c:247 #, c-format msgid "%s alias cannot run another alias!\n" msgstr "%s l'alias ne peux pas lancer un autre alias !\n" -#: src/common/command.c:372 +#: src/common/command.c:254 #, c-format msgid "%s target command \"%s\" does not exist!\n" msgstr "%s la commande cible \"%s\" n'existe pas !\n" -#: src/common/command.c:558 +#: src/common/command.c:451 #, c-format msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n" msgstr "" "%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: %d " "paramètre%s)\n" -#: src/common/command.c:567 +#: src/common/command.c:463 #, c-format msgid "" "%s wrong argument count for %s command \"%s\" (expected: between %d and %d " @@ -2056,19 +2060,19 @@ msgstr "" "%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: entre " "%d et %d paramètre%s)\n" -#: src/common/command.c:586 +#: src/common/command.c:485 #, c-format msgid "%s %s command \"%s\" failed\n" msgstr "%s %s la commande \"%s\" a échoué\n" -#: src/common/command.c:611 +#: src/common/command.c:513 #, c-format msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n" msgstr "" "%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: %d " "paramètre%s)\n" -#: src/common/command.c:620 +#: src/common/command.c:525 #, c-format msgid "" "%s wrong argument count for IRC command \"%s\" (expected: between %d and %d " @@ -2077,186 +2081,189 @@ msgstr "" "%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: " "entre %d et %d paramètre%s)\n" -#: src/common/command.c:633 +#: src/common/command.c:540 #, c-format msgid "%s command \"%s\" needs a server connection!\n" msgstr "%s la commande \"%s\" nécessite une connexion au serveur !\n" -#: src/common/command.c:645 +#: src/common/command.c:555 #, c-format msgid "%s IRC command \"%s\" failed\n" msgstr "%s la commande IRC \"%s\" a échoué\n" -#: src/common/command.c:692 +#: src/common/command.c:604 #, c-format msgid "%s unknown command \"%s\" (type /help for help)\n" msgstr "%s commande \"%s\" inconnue (tapez /help pour l'aide)\n" -#: src/common/command.c:761 +#: src/common/command.c:675 #, c-format msgid "%s cannot find nick for sending message\n" msgstr "%s impossible de trouver le pseudo pour envoyer le message\n" -#: src/common/command.c:767 +#: src/common/command.c:684 msgid "This window is not a channel!\n" msgstr "Cette fenêtre n'est pas un canal !\n" -#: src/common/command.c:793 src/common/command.c:805 src/common/command.c:894 +#: src/common/command.c:712 src/common/command.c:736 src/common/command.c:831 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:800 +#: src/common/command.c:721 #, c-format msgid "Alias \"%s\" => \"%s\" created\n" msgstr "Alias \"%s\" => \"%s\" créé\n" -#: src/common/command.c:815 +#: src/common/command.c:727 +#, c-format +msgid "Failed to create alias \"%s\" => \"%s\" (not enough memory)\n" +msgstr "Impossible de créer l'alias \"%s\" => \"%s\" (pas assez de mémoire)\n" + +#: src/common/command.c:747 msgid "List of aliases:\n" msgstr "Liste des alias:\n" -#: src/common/command.c:825 +#: src/common/command.c:760 msgid "No alias defined.\n" msgstr "Aucun alias défini.\n" -#: src/common/command.c:847 +#: src/common/command.c:783 msgid "Opened buffers:\n" msgstr "Tampons ouverts:\n" -#: src/common/command.c:866 +#: src/common/command.c:802 msgid "Channel: " msgstr "Canal: " -#: src/common/command.c:869 src/common/command.c:879 +#: src/common/command.c:805 src/common/command.c:815 msgid " (server: " msgstr " (serveur: " -#: src/common/command.c:876 +#: src/common/command.c:812 msgid "Private with: " msgstr "Privé avec: " -#: src/common/command.c:916 src/common/command.c:1019 +#: src/common/command.c:854 src/common/command.c:963 #, c-format msgid "%s incorrect buffer number\n" msgstr "%s numéro de buffer incorrect\n" -#: src/common/command.c:929 +#: src/common/command.c:868 #, c-format msgid "%s can not close the single buffer\n" msgstr "%s impossible de fermer le tampon unique\n" -#: src/common/command.c:938 +#: src/common/command.c:878 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" "%s impossible de fermer le tampon du serveur tant que des canaux sont " "ouverts\n" -#: src/common/command.c:959 +#: src/common/command.c:899 msgid "Notify levels: " msgstr "Niveaux de notification: " -#: src/common/command.c:985 src/common/command.c:994 +#: src/common/command.c:926 src/common/command.c:936 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "%s niveau de notification incorrect (doit être entre 0 et 3)\n" -#: src/common/command.c:1011 +#: src/common/command.c:954 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "%s buffer \"%s\" non trouvé pour la commande \"%s\"\n" -#: src/common/command.c:1043 +#: src/common/command.c:988 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n" -#: src/common/command.c:1071 +#: src/common/command.c:1017 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "%s déjà connecté au serveur \"%s\" !\n" -#: src/common/command.c:1090 src/common/command.c:1128 -#: src/common/command.c:1704 +#: src/common/command.c:1037 src/common/command.c:1080 +#: src/common/command.c:1693 #, c-format msgid "%s server \"%s\" not found\n" msgstr "%s serveur \"%s\" non trouvé\n" -#: src/common/command.c:1115 +#: src/common/command.c:1063 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "%s non connecté au serveur \"%s\" !\n" -#: src/common/command.c:1121 +#: src/common/command.c:1071 msgid "Auto-reconnection is cancelled\n" msgstr "La reconnexion automatique est annulée\n" -#: src/common/command.c:1147 +#: src/common/command.c:1100 #, c-format msgid "> List of %s internal commands:\n" -msgstr "> Liste des commandes internes %s:\n" +msgstr "> Liste des commandes internes %s :\n" -#: src/common/command.c:1152 +#: src/common/command.c:1111 msgid "> List of IRC commands:\n" -msgstr "> Liste des commandes IRC:\n" +msgstr "> Liste des commandes IRC :\n" -#: src/common/command.c:1167 +#: src/common/command.c:1129 #, c-format -msgid "> Help on %s internal command \"%s\":\n" -msgstr "> Aide sur la commande interne %s \"%s\":\n" +msgid "> Help on %s internal command \"" +msgstr "> Aide sur la commande interne %s \"" -#: src/common/command.c:1170 src/common/command.c:1189 -#, c-format -msgid "Syntax: /%s %s\n" -msgstr "Syntaxe: /%s %s\n" +#: src/common/command.c:1134 src/common/command.c:1157 +msgid "Syntax: " +msgstr "Syntaxe: " -#: src/common/command.c:1187 -#, c-format -msgid "> Help on IRC command \"%s\":\n" -msgstr "> Aide sur la commande IRC \"%s\":\n" +#: src/common/command.c:1152 +msgid "> Help on IRC command \"" +msgstr "> Aide sur la commande IRC \"" -#: src/common/command.c:1202 +#: src/common/command.c:1171 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n" -#: src/common/command.c:1227 +#: src/common/command.c:1196 msgid "Registered Perl scripts:\n" msgstr "Scripts Perl enregistrés :\n" -#: src/common/command.c:1244 src/common/command.c:1266 -#: src/common/command.c:1288 +#: src/common/command.c:1213 src/common/command.c:1235 +#: src/common/command.c:1257 msgid " (none)\n" msgstr " (aucun)\n" -#: src/common/command.c:1249 +#: src/common/command.c:1218 msgid "Perl message handlers:\n" msgstr "Fonctions Perl pour messages :\n" -#: src/common/command.c:1258 +#: src/common/command.c:1227 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr " IRC(%s) => Perl(%s)\n" -#: src/common/command.c:1271 +#: src/common/command.c:1240 msgid "Perl command handlers:\n" msgstr "Commandes Perl :\n" -#: src/common/command.c:1280 +#: src/common/command.c:1249 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr " Commande /%s => Perl(%s)\n" -#: src/common/command.c:1300 +#: src/common/command.c:1269 msgid "Perl scripts unloaded\n" msgstr "Scripts Perl déchargés\n" -#: src/common/command.c:1325 src/common/command.c:1917 +#: src/common/command.c:1295 src/common/command.c:1924 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "%s option inconnue pour la commande \"%s\"\n" -#: src/common/command.c:1336 +#: src/common/command.c:1308 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" @@ -2265,120 +2272,120 @@ msgstr "" "Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le " "script ./configure\n" -#: src/common/command.c:1385 +#: src/common/command.c:1357 msgid "No server.\n" msgstr "Pas de serveur.\n" -#: src/common/command.c:1396 +#: src/common/command.c:1368 #, c-format msgid "Server '%s' not found.\n" msgstr "Serveur '%s' non trouvé.\n" -#: src/common/command.c:1407 +#: src/common/command.c:1380 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n" -#: src/common/command.c:1413 +#: src/common/command.c:1388 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n" -#: src/common/command.c:1430 +#: src/common/command.c:1407 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n" -#: src/common/command.c:1436 src/common/command.c:1569 +#: src/common/command.c:1413 src/common/command.c:1554 msgid "Server" msgstr "Serveur" -#: src/common/command.c:1439 +#: src/common/command.c:1416 msgid "has been deleted\n" msgstr "a été supprimé\n" -#: src/common/command.c:1453 +#: src/common/command.c:1431 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "%s paramètres manquants pour la commande \"%s\"\n" -#: src/common/command.c:1462 +#: src/common/command.c:1441 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n" -#: src/common/command.c:1486 src/common/command.c:1512 -#: src/common/command.c:1524 src/common/command.c:1548 +#: src/common/command.c:1466 src/common/command.c:1494 +#: src/common/command.c:1507 src/common/command.c:1533 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n" -#: src/common/command.c:1498 +#: src/common/command.c:1479 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n" -#: src/common/command.c:1536 +#: src/common/command.c:1520 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "%s commande manquante pour le paramètre \"%s\"\n" -#: src/common/command.c:1572 +#: src/common/command.c:1557 msgid "created\n" msgstr "créé\n" -#: src/common/command.c:1577 +#: src/common/command.c:1563 #, c-format msgid "%s unable to create server\n" msgstr "%s impossible de créer le serveur\n" -#: src/common/command.c:1633 +#: src/common/command.c:1620 msgid "(unknown)" msgstr "(inconnu)" -#: src/common/command.c:1656 +#: src/common/command.c:1643 msgid "(password hidden) " msgstr "(mot de passe caché)" -#: src/common/command.c:1732 src/common/command.c:1772 +#: src/common/command.c:1725 src/common/command.c:1771 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "%s option de configuration \"%s\" non trouvée\n" -#: src/common/command.c:1736 src/common/command.c:1766 +#: src/common/command.c:1730 src/common/command.c:1763 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "%s valeur incorrecte pour l'option \"%s\"\n" -#: src/common/command.c:1751 +#: src/common/command.c:1746 #, 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:1845 +#: src/common/command.c:1847 #, c-format msgid "No config option found with \"%s\"\n" msgstr "Aucune option de configuration trouvée avec \"%s\"\n" -#: src/common/command.c:1848 +#: src/common/command.c:1850 msgid "No config option found\n" msgstr "Aucune option de configuration trouvée\n" -#: src/common/command.c:1854 +#: src/common/command.c:1857 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "option(s) de configuration trouvée(s) avec \"%s\"\n" -#: src/common/command.c:1857 +#: src/common/command.c:1860 msgid "config option(s) found\n" msgstr "option(s) de configuration trouvée(s)\n" -#: src/common/command.c:1876 +#: src/common/command.c:1880 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "%s alias ou commande \"%s\" non trouvé\n" -#: src/common/command.c:1885 +#: src/common/command.c:1890 #, c-format msgid "Alias \"%s\" removed\n" msgstr "Alias \"%s\" supprimé\n" @@ -3261,15 +3268,20 @@ msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n" #: src/common/weeconfig.c:1136 #, c-format +msgid "%s %s, line %d: invalid section for option, line is ignored\n" +msgstr "%s %s, ligne %d: section invalide pour l'option, ligne ignorée\n" + +#: src/common/weeconfig.c:1144 +#, 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:1170 +#: src/common/weeconfig.c:1178 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "%s %s, ligne %d: option \"%s\" invalide\n" -#: src/common/weeconfig.c:1181 +#: src/common/weeconfig.c:1189 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" @@ -3278,7 +3290,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:1190 +#: src/common/weeconfig.c:1198 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -3287,7 +3299,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:1201 +#: src/common/weeconfig.c:1209 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" @@ -3296,26 +3308,26 @@ msgstr "" "%s %s, ligne %d: valeur invalide pour l'option '%s'\n" "Attendu: une de ces chaînes: " -#: src/common/weeconfig.c:1217 +#: src/common/weeconfig.c:1225 #, 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:1276 src/common/weeconfig.c:1449 +#: src/common/weeconfig.c:1285 src/common/weeconfig.c:1458 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "%s impossible de créer le fichier \"%s\"\n" -#: src/common/weeconfig.c:1282 +#: src/common/weeconfig.c:1291 #, 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:1283 +#: src/common/weeconfig.c:1292 msgid "creating default config file\n" msgstr "création du fichier de configuration par défaut\n" -#: src/common/weeconfig.c:1286 src/common/weeconfig.c:1458 +#: src/common/weeconfig.c:1295 src/common/weeconfig.c:1467 #, c-format msgid "" "#\n" @@ -3324,6 +3336,18 @@ msgstr "" "#\n" "# %s: fichier de configuration, créé par %s v%s le %s#\n" -#: src/common/weeconfig.c:1455 +#: src/common/weeconfig.c:1464 msgid "saving config to disk\n" msgstr "sauvegarde de la configuration sur disque\n" + +#~ msgid "> List of " +#~ msgstr "> Liste de " + +#~ msgid " commands:\n" +#~ msgstr " commandes:\n" + +#~ msgid "> Help on " +#~ msgstr "> Aide sur " + +#~ msgid " command \"" +#~ msgstr " commande \"" diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot index 2bf4af5f0..0e60776b8 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: 2005-01-05 23:47+0100\n" +"POT-Creation-Date: 2005-01-16 12:34+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" @@ -20,7 +20,7 @@ msgstr "" msgid "%s cannot allocate new nick\n" msgstr "" -#: src/irc/irc-server.c:136 src/common/weeconfig.c:1397 +#: src/irc/irc-server.c:136 src/common/weeconfig.c:1406 msgid "Unable to get user's name" msgstr "" @@ -1068,7 +1068,7 @@ msgstr "" msgid "can't change mode for other users" msgstr "" -#: src/irc/irc-display.c:145 src/common/command.c:860 +#: src/irc/irc-display.c:145 src/common/command.c:796 msgid "Server: " msgstr "" @@ -1105,35 +1105,39 @@ msgstr "" msgid "%s: using local hostname \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:274 src/irc/irc-send.c:300 src/irc/irc-send.c:401 -#: src/irc/irc-send.c:724 src/irc/irc-send.c:803 src/irc/irc-send.c:1307 +#: src/irc/irc-send.c:257 +msgid "This command is not developed!\n" +msgstr "" + +#: src/irc/irc-send.c:282 src/irc/irc-send.c:308 src/irc/irc-send.c:409 +#: src/irc/irc-send.c:734 src/irc/irc-send.c:813 src/irc/irc-send.c:1314 #, c-format msgid "%s \"%s\" command can only be executed in a channel window\n" msgstr "" -#: src/irc/irc-send.c:509 src/irc/irc-send.c:576 src/irc/irc-send.c:851 -#: src/irc/irc-send.c:865 src/irc/irc-send.c:1201 +#: src/irc/irc-send.c:519 src/irc/irc-send.c:586 src/irc/irc-send.c:861 +#: src/irc/irc-send.c:875 src/irc/irc-send.c:1208 #, c-format msgid "%s \"%s\" command can not be executed on a server window\n" msgstr "" -#: src/irc/irc-send.c:594 src/irc/irc-send.c:619 src/irc/irc-recv.c:264 +#: src/irc/irc-send.c:604 src/irc/irc-send.c:629 src/irc/irc-recv.c:264 #: src/irc/irc-recv.c:1048 #, c-format msgid "%s nick not found for \"%s\" command\n" msgstr "" -#: src/irc/irc-send.c:671 src/irc/irc-send.c:949 src/irc/irc-recv.c:1214 +#: src/irc/irc-send.c:681 src/irc/irc-send.c:959 src/irc/irc-recv.c:1214 #, c-format msgid "%s cannot create new private window \"%s\"\n" msgstr "" -#: src/irc/irc-send.c:702 src/irc/irc-send.c:776 src/common/command.c:1331 +#: src/irc/irc-send.c:712 src/irc/irc-send.c:786 src/common/command.c:1302 #, c-format msgid "%s wrong argument count for \"%s\" command\n" msgstr "" -#: src/irc/irc-send.c:1279 +#: src/irc/irc-send.c:1286 #, c-format msgid "%s, compiled on %s %s\n" msgstr "" @@ -1657,35 +1661,35 @@ msgstr "" msgid "Gb" msgstr "" -#: src/gui/curses/gui-display.c:1006 +#: src/gui/curses/gui-display.c:1009 #, c-format msgid "%d:[not connected] " msgstr "" -#: src/gui/curses/gui-display.c:1014 +#: src/gui/curses/gui-display.c:1017 msgid "[Act: " msgstr "" -#: src/gui/curses/gui-display.c:1053 src/gui/curses/gui-display.c:1056 +#: src/gui/curses/gui-display.c:1056 src/gui/curses/gui-display.c:1059 msgid "-MORE-" msgstr "" -#: src/gui/curses/gui-display.c:1225 +#: src/gui/curses/gui-display.c:1228 msgid " [A] Accept" msgstr "" -#: src/gui/curses/gui-display.c:1226 src/gui/curses/gui-display.c:1232 -#: src/gui/curses/gui-display.c:1239 +#: src/gui/curses/gui-display.c:1229 src/gui/curses/gui-display.c:1235 +#: src/gui/curses/gui-display.c:1242 msgid " [C] Cancel" msgstr "" -#: src/gui/curses/gui-display.c:1227 src/gui/curses/gui-display.c:1233 -#: src/gui/curses/gui-display.c:1240 src/gui/curses/gui-display.c:1247 -#: src/gui/curses/gui-display.c:1252 +#: src/gui/curses/gui-display.c:1230 src/gui/curses/gui-display.c:1236 +#: src/gui/curses/gui-display.c:1243 src/gui/curses/gui-display.c:1250 +#: src/gui/curses/gui-display.c:1255 msgid " [Q] Close DCC view" msgstr "" -#: src/gui/curses/gui-display.c:1246 +#: src/gui/curses/gui-display.c:1249 msgid " [R] Remove" msgstr "" @@ -1698,39 +1702,39 @@ msgstr "" msgid "%s not enough memory for infobar message\n" msgstr "" -#: src/gui/gui-common.c:462 +#: src/gui/gui-common.c:465 #, c-format msgid "%s not enough memory for new line!\n" msgstr "" -#: src/gui/gui-common.c:505 +#: src/gui/gui-common.c:508 msgid "not enough memory!\n" msgstr "" -#: src/common/command.c:41 +#: src/common/command.c:42 msgid "create an alias for a command" msgstr "" -#: src/common/command.c:42 +#: src/common/command.c:43 msgid "[alias_name [command [arguments]]" msgstr "" -#: src/common/command.c:43 +#: src/common/command.c:44 msgid "" "alias_name: name of alias\n" "command: command name (WeeChat or IRC command, without first '/')\n" "arguments: arguments for command" msgstr "" -#: src/common/command.c:46 +#: src/common/command.c:47 msgid "manage buffers" msgstr "" -#: src/common/command.c:47 +#: src/common/command.c:48 msgid "[action | number]" msgstr "" -#: src/common/command.c:48 +#: src/common/command.c:49 msgid "" "action: action to do:\n" " move move buffer in the list (may be relative, for example -1)\n" @@ -1741,76 +1745,76 @@ msgid "" "number: jump to buffer by number" msgstr "" -#: src/common/command.c:55 +#: src/common/command.c:56 msgid "clear window(s)" msgstr "" -#: src/common/command.c:56 +#: src/common/command.c:57 msgid "[-all]" msgstr "" -#: src/common/command.c:57 +#: src/common/command.c:58 msgid "-all: clear all windows" msgstr "" -#: src/common/command.c:59 +#: src/common/command.c:60 msgid "connect to a server" msgstr "" -#: src/common/command.c:60 src/common/command.c:64 +#: src/common/command.c:61 src/common/command.c:65 msgid "servername" msgstr "" -#: src/common/command.c:61 +#: src/common/command.c:62 msgid "servername: server name to connect" msgstr "" -#: src/common/command.c:63 +#: src/common/command.c:64 msgid "disconnect from a server" msgstr "" -#: src/common/command.c:65 +#: src/common/command.c:66 msgid "servername: server name to disconnect" msgstr "" -#: src/common/command.c:67 +#: src/common/command.c:68 msgid "display help about commands" msgstr "" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "[command]" msgstr "" -#: src/common/command.c:68 +#: src/common/command.c:69 msgid "command: name of a WeeChat or IRC command" msgstr "" -#: src/common/command.c:70 +#: src/common/command.c:71 msgid "list/load/unload Perl scripts" msgstr "" -#: src/common/command.c:71 +#: src/common/command.c:72 msgid "[load filename] | [autoload] | [unload]" msgstr "" -#: src/common/command.c:72 +#: src/common/command.c:73 msgid "" "filename: Perl script (file) to load\n" "Without argument, /perl command lists all loaded Perl scripts." msgstr "" -#: src/common/command.c:75 +#: src/common/command.c:76 msgid "list, add or remove servers" msgstr "" -#: src/common/command.c:76 +#: src/common/command.c:77 msgid "" "[servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-" "nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-" "command command] [-autojoin channel[,channel]] ] | [del servername]" msgstr "" -#: src/common/command.c:81 +#: src/common/command.c:82 msgid "" "servername: server name, for internal & display use\n" "hostname: name or IP address of server\n" @@ -1823,53 +1827,53 @@ msgid "" "realname: real name of user" msgstr "" -#: src/common/command.c:91 +#: src/common/command.c:92 msgid "save config to disk" msgstr "" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "[file]" msgstr "" -#: src/common/command.c:92 +#: src/common/command.c:93 msgid "file: filename for writing config" msgstr "" -#: src/common/command.c:94 +#: src/common/command.c:95 msgid "set config parameters" msgstr "" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "[option[=value]]" msgstr "" -#: src/common/command.c:95 +#: src/common/command.c:96 msgid "" "option: name of an option\n" "value: value for option" msgstr "" -#: src/common/command.c:97 +#: src/common/command.c:98 msgid "remove an alias" msgstr "" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name" msgstr "" -#: src/common/command.c:98 +#: src/common/command.c:99 msgid "alias_name: name of alias to remove" msgstr "" -#: src/common/command.c:100 +#: src/common/command.c:101 msgid "manage windows" msgstr "" -#: src/common/command.c:101 +#: src/common/command.c:102 msgid "[action]" msgstr "" -#: src/common/command.c:102 +#: src/common/command.c:103 msgid "" "action: action to do:\n" " close close current window (under development!)\n" @@ -1878,347 +1882,350 @@ msgid "" " splitv split current window vertically" msgstr "" -#: src/common/command.c:357 +#: src/common/command.c:237 #, c-format msgid "%s alias or command \"%s\" already exists!\n" msgstr "" -#: src/common/command.c:366 +#: src/common/command.c:247 #, c-format msgid "%s alias cannot run another alias!\n" msgstr "" -#: src/common/command.c:372 +#: src/common/command.c:254 #, c-format msgid "%s target command \"%s\" does not exist!\n" msgstr "" -#: src/common/command.c:558 +#: src/common/command.c:451 #, c-format msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n" msgstr "" -#: src/common/command.c:567 +#: src/common/command.c:463 #, c-format msgid "" "%s wrong argument count for %s command \"%s\" (expected: between %d and %d " "arg%s)\n" msgstr "" -#: src/common/command.c:586 +#: src/common/command.c:485 #, c-format msgid "%s %s command \"%s\" failed\n" msgstr "" -#: src/common/command.c:611 +#: src/common/command.c:513 #, c-format msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n" msgstr "" -#: src/common/command.c:620 +#: src/common/command.c:525 #, c-format msgid "" "%s wrong argument count for IRC command \"%s\" (expected: between %d and %d " "arg%s)\n" msgstr "" -#: src/common/command.c:633 +#: src/common/command.c:540 #, c-format msgid "%s command \"%s\" needs a server connection!\n" msgstr "" -#: src/common/command.c:645 +#: src/common/command.c:555 #, c-format msgid "%s IRC command \"%s\" failed\n" msgstr "" -#: src/common/command.c:692 +#: src/common/command.c:604 #, c-format msgid "%s unknown command \"%s\" (type /help for help)\n" msgstr "" -#: src/common/command.c:761 +#: src/common/command.c:675 #, c-format msgid "%s cannot find nick for sending message\n" msgstr "" -#: src/common/command.c:767 +#: src/common/command.c:684 msgid "This window is not a channel!\n" msgstr "" -#: src/common/command.c:793 src/common/command.c:805 src/common/command.c:894 +#: src/common/command.c:712 src/common/command.c:736 src/common/command.c:831 #, c-format msgid "%s missing arguments for \"%s\" command\n" msgstr "" -#: src/common/command.c:800 +#: src/common/command.c:721 #, c-format msgid "Alias \"%s\" => \"%s\" created\n" msgstr "" -#: src/common/command.c:815 +#: src/common/command.c:727 +#, c-format +msgid "Failed to create alias \"%s\" => \"%s\" (not enough memory)\n" +msgstr "" + +#: src/common/command.c:747 msgid "List of aliases:\n" msgstr "" -#: src/common/command.c:825 +#: src/common/command.c:760 msgid "No alias defined.\n" msgstr "" -#: src/common/command.c:847 +#: src/common/command.c:783 msgid "Opened buffers:\n" msgstr "" -#: src/common/command.c:866 +#: src/common/command.c:802 msgid "Channel: " msgstr "" -#: src/common/command.c:869 src/common/command.c:879 +#: src/common/command.c:805 src/common/command.c:815 msgid " (server: " msgstr "" -#: src/common/command.c:876 +#: src/common/command.c:812 msgid "Private with: " msgstr "" -#: src/common/command.c:916 src/common/command.c:1019 +#: src/common/command.c:854 src/common/command.c:963 #, c-format msgid "%s incorrect buffer number\n" msgstr "" -#: src/common/command.c:929 +#: src/common/command.c:868 #, c-format msgid "%s can not close the single buffer\n" msgstr "" -#: src/common/command.c:938 +#: src/common/command.c:878 #, c-format msgid "%s can not close server buffer while channels are opened\n" msgstr "" -#: src/common/command.c:959 +#: src/common/command.c:899 msgid "Notify levels: " msgstr "" -#: src/common/command.c:985 src/common/command.c:994 +#: src/common/command.c:926 src/common/command.c:936 #, c-format msgid "%s incorrect notify level (must be between 0 and 3)\n" msgstr "" -#: src/common/command.c:1011 +#: src/common/command.c:954 #, c-format msgid "%s buffer \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1043 +#: src/common/command.c:988 #, c-format msgid "unknown parameter \"%s\" for \"%s\" command\n" msgstr "" -#: src/common/command.c:1071 +#: src/common/command.c:1017 #, c-format msgid "%s already connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1090 src/common/command.c:1128 -#: src/common/command.c:1704 +#: src/common/command.c:1037 src/common/command.c:1080 +#: src/common/command.c:1693 #, c-format msgid "%s server \"%s\" not found\n" msgstr "" -#: src/common/command.c:1115 +#: src/common/command.c:1063 #, c-format msgid "%s not connected to server \"%s\"!\n" msgstr "" -#: src/common/command.c:1121 +#: src/common/command.c:1071 msgid "Auto-reconnection is cancelled\n" msgstr "" -#: src/common/command.c:1147 +#: src/common/command.c:1100 #, c-format msgid "> List of %s internal commands:\n" msgstr "" -#: src/common/command.c:1152 +#: src/common/command.c:1111 msgid "> List of IRC commands:\n" msgstr "" -#: src/common/command.c:1167 +#: src/common/command.c:1129 #, c-format -msgid "> Help on %s internal command \"%s\":\n" +msgid "> Help on %s internal command \"" msgstr "" -#: src/common/command.c:1170 src/common/command.c:1189 -#, c-format -msgid "Syntax: /%s %s\n" +#: src/common/command.c:1134 src/common/command.c:1157 +msgid "Syntax: " msgstr "" -#: src/common/command.c:1187 -#, c-format -msgid "> Help on IRC command \"%s\":\n" +#: src/common/command.c:1152 +msgid "> Help on IRC command \"" msgstr "" -#: src/common/command.c:1202 +#: src/common/command.c:1171 #, c-format msgid "No help available, \"%s\" is an unknown command\n" msgstr "" -#: src/common/command.c:1227 +#: src/common/command.c:1196 msgid "Registered Perl scripts:\n" msgstr "" -#: src/common/command.c:1244 src/common/command.c:1266 -#: src/common/command.c:1288 +#: src/common/command.c:1213 src/common/command.c:1235 +#: src/common/command.c:1257 msgid " (none)\n" msgstr "" -#: src/common/command.c:1249 +#: src/common/command.c:1218 msgid "Perl message handlers:\n" msgstr "" -#: src/common/command.c:1258 +#: src/common/command.c:1227 #, c-format msgid " IRC(%s) => Perl(%s)\n" msgstr "" -#: src/common/command.c:1271 +#: src/common/command.c:1240 msgid "Perl command handlers:\n" msgstr "" -#: src/common/command.c:1280 +#: src/common/command.c:1249 #, c-format msgid " Command /%s => Perl(%s)\n" msgstr "" -#: src/common/command.c:1300 +#: src/common/command.c:1269 msgid "Perl scripts unloaded\n" msgstr "" -#: src/common/command.c:1325 src/common/command.c:1917 +#: src/common/command.c:1295 src/common/command.c:1924 #, c-format msgid "%s unknown option for \"%s\" command\n" msgstr "" -#: src/common/command.c:1336 +#: src/common/command.c:1308 msgid "" "WeeChat was build without Perl support.\n" "Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n" msgstr "" -#: src/common/command.c:1385 +#: src/common/command.c:1357 msgid "No server.\n" msgstr "" -#: src/common/command.c:1396 +#: src/common/command.c:1368 #, c-format msgid "Server '%s' not found.\n" msgstr "" -#: src/common/command.c:1407 +#: src/common/command.c:1380 #, c-format msgid "%s missing servername for \"%s\" command\n" msgstr "" -#: src/common/command.c:1413 +#: src/common/command.c:1388 #, c-format msgid "%s too much arguments for \"%s\" command, ignoring arguments\n" msgstr "" -#: src/common/command.c:1430 +#: src/common/command.c:1407 #, c-format msgid "%s server \"%s\" not found for \"%s\" command\n" msgstr "" -#: src/common/command.c:1436 src/common/command.c:1569 +#: src/common/command.c:1413 src/common/command.c:1554 msgid "Server" msgstr "" -#: src/common/command.c:1439 +#: src/common/command.c:1416 msgid "has been deleted\n" msgstr "" -#: src/common/command.c:1453 +#: src/common/command.c:1431 #, c-format msgid "%s missing parameters for \"%s\" command\n" msgstr "" -#: src/common/command.c:1462 +#: src/common/command.c:1441 #, c-format msgid "%s server \"%s\" already exists, can't create it!\n" msgstr "" -#: src/common/command.c:1486 src/common/command.c:1512 -#: src/common/command.c:1524 src/common/command.c:1548 +#: src/common/command.c:1466 src/common/command.c:1494 +#: src/common/command.c:1507 src/common/command.c:1533 #, c-format msgid "%s missing password for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1498 +#: src/common/command.c:1479 #, c-format msgid "%s missing nick(s) for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1536 +#: src/common/command.c:1520 #, c-format msgid "%s missing command for \"%s\" parameter\n" msgstr "" -#: src/common/command.c:1572 +#: src/common/command.c:1557 msgid "created\n" msgstr "" -#: src/common/command.c:1577 +#: src/common/command.c:1563 #, c-format msgid "%s unable to create server\n" msgstr "" -#: src/common/command.c:1633 +#: src/common/command.c:1620 msgid "(unknown)" msgstr "" -#: src/common/command.c:1656 +#: src/common/command.c:1643 msgid "(password hidden) " msgstr "" -#: src/common/command.c:1732 src/common/command.c:1772 +#: src/common/command.c:1725 src/common/command.c:1771 #, c-format msgid "%s config option \"%s\" not found\n" msgstr "" -#: src/common/command.c:1736 src/common/command.c:1766 +#: src/common/command.c:1730 src/common/command.c:1763 #, c-format msgid "%s incorrect value for option \"%s\"\n" msgstr "" -#: src/common/command.c:1751 +#: src/common/command.c:1746 #, c-format msgid "%s option \"%s\" can not be changed while WeeChat is running\n" msgstr "" -#: src/common/command.c:1845 +#: src/common/command.c:1847 #, c-format msgid "No config option found with \"%s\"\n" msgstr "" -#: src/common/command.c:1848 +#: src/common/command.c:1850 msgid "No config option found\n" msgstr "" -#: src/common/command.c:1854 +#: src/common/command.c:1857 #, c-format msgid "config option(s) found with \"%s\"\n" msgstr "" -#: src/common/command.c:1857 +#: src/common/command.c:1860 msgid "config option(s) found\n" msgstr "" -#: src/common/command.c:1876 +#: src/common/command.c:1880 #, c-format msgid "%s alias or command \"%s\" not found\n" msgstr "" -#: src/common/command.c:1885 +#: src/common/command.c:1890 #, c-format msgid "Alias \"%s\" removed\n" msgstr "" @@ -3049,61 +3056,66 @@ msgstr "" #: src/common/weeconfig.c:1136 #, c-format +msgid "%s %s, line %d: invalid section for option, line is ignored\n" +msgstr "" + +#: src/common/weeconfig.c:1144 +#, c-format msgid "%s %s, line %d: invalid syntax, missing \"=\"\n" msgstr "" -#: src/common/weeconfig.c:1170 +#: src/common/weeconfig.c:1178 #, c-format msgid "%s %s, line %d: invalid option \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:1181 +#: src/common/weeconfig.c:1189 #, c-format msgid "" "%s %s, line %d: invalid value foroption '%s'\n" "Expected: boolean value: 'off' or 'on'\n" msgstr "" -#: src/common/weeconfig.c:1190 +#: src/common/weeconfig.c:1198 #, 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:1201 +#: src/common/weeconfig.c:1209 #, c-format msgid "" "%s %s, line %d: invalid value for option '%s'\n" "Expected: one of these strings: " msgstr "" -#: src/common/weeconfig.c:1217 +#: src/common/weeconfig.c:1225 #, c-format msgid "%s %s, line %d: invalid color name for option '%s'\n" msgstr "" -#: src/common/weeconfig.c:1276 src/common/weeconfig.c:1449 +#: src/common/weeconfig.c:1285 src/common/weeconfig.c:1458 #, c-format msgid "%s cannot create file \"%s\"\n" msgstr "" -#: src/common/weeconfig.c:1282 +#: src/common/weeconfig.c:1291 #, c-format msgid "%s: creating default config file...\n" msgstr "" -#: src/common/weeconfig.c:1283 +#: src/common/weeconfig.c:1292 msgid "creating default config file\n" msgstr "" -#: src/common/weeconfig.c:1286 src/common/weeconfig.c:1458 +#: src/common/weeconfig.c:1295 src/common/weeconfig.c:1467 #, c-format msgid "" "#\n" "# %s configuration file, created by %s v%s on %s#\n" msgstr "" -#: src/common/weeconfig.c:1455 +#: src/common/weeconfig.c:1464 msgid "saving config to disk\n" msgstr "" diff --git a/weechat/src/common/Makefile.am b/weechat/src/common/Makefile.am index 31346a741..8d425fd59 100644 --- a/weechat/src/common/Makefile.am +++ b/weechat/src/common/Makefile.am @@ -25,6 +25,8 @@ lib_weechat_main_a_SOURCES = weechat.c \ command.h \ completion.c \ completion.h \ + weelist.c \ + weelist.h \ weeconfig.c \ weeconfig.h \ history.c \ diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 5d3bf7def..547657965 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -29,6 +29,7 @@ #include "weechat.h" #include "command.h" +#include "weelist.h" #include "weeconfig.h" #include "../irc/irc.h" #include "../gui/gui.h" @@ -111,111 +112,17 @@ t_weechat_command weechat_commands[] = t_weechat_alias *weechat_alias = NULL; t_weechat_alias *weechat_last_alias = NULL; -t_index_command *index_commands; -t_index_command *last_index_command; +t_weelist *index_commands; +t_weelist *last_index_command; /* - * index_command_search: search a command - */ - -t_index_command * -index_command_search (char *command) -{ - t_index_command *ptr_index; - - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) - { - if (strcasecmp (command, ptr_index->command_name) == 0) - return ptr_index; - } - return NULL; -} - -/* - * index_command_find_pos: find position for a command index (for sorting index) - */ - -t_index_command * -index_command_find_pos (char *command) -{ - t_index_command *ptr_index; - - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) - { - if (strcasecmp (command, ptr_index->command_name) < 0) - return ptr_index; - } - return NULL; -} - -/* - * index_command_insert_sorted: insert index into sorted list - */ - -void -index_command_insert_sorted (t_index_command *index) -{ - t_index_command *pos_index; - - pos_index = index_command_find_pos (index->command_name); - - if (index_commands) - { - if (pos_index) - { - /* insert index into the list (before index found) */ - index->prev_index = pos_index->prev_index; - index->next_index = pos_index; - if (pos_index->prev_index) - pos_index->prev_index->next_index = index; - else - index_commands = index; - pos_index->prev_index = index; - } - else - { - /* add index to the end */ - index->prev_index = last_index_command; - index->next_index = NULL; - last_index_command->next_index = index; - last_index_command = index; - } - } - else - { - index->prev_index = NULL; - index->next_index = NULL; - index_commands = index; - last_index_command = index; - } -} - -/* - * index_command_new: create new index command and add it to index list - */ - -t_index_command * -index_command_new (char *command_name) -{ - t_index_command *new_index; - - if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command))))) - { - new_index->command_name = strdup (command_name); - index_command_insert_sorted (new_index); - return new_index; - } - return NULL; -} - -/* - * index_command_build: build an index of commands (internal, irc and alias) + * command_index_build: build an index of commands (internal, irc and alias) * This list will be sorted, and used for completion */ void -index_command_build () +command_index_build () { int i; @@ -224,49 +131,21 @@ index_command_build () i = 0; while (weechat_commands[i].command_name) { - (void) index_command_new (weechat_commands[i].command_name); + (void) weelist_add (&index_commands, &last_index_command, + weechat_commands[i].command_name); i++; } i = 0; while (irc_commands[i].command_name) { if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) - (void) index_command_new (irc_commands[i].command_name); + (void) weelist_add (&index_commands, &last_index_command, + irc_commands[i].command_name); i++; } } /* - * index_command_free: free an index command and reomve it from list - */ - -void -index_command_free (t_index_command *index) -{ - t_index_command *new_index_commands; - - /* remove index command from list */ - if (last_index_command == index) - last_index_command = index->prev_index; - if (index->prev_index) - { - (index->prev_index)->next_index = index->next_index; - new_index_commands = index_commands; - } - else - new_index_commands = index->next_index; - - if (index->next_index) - (index->next_index)->prev_index = index->prev_index; - - /* free data */ - if (index->command_name) - free (index->command_name); - free (index); - index_commands = new_index_commands; -} - -/* * alias_search: search an alias */ @@ -352,8 +231,9 @@ alias_new (char *alias_name, char *alias_command) char *pos; t_weechat_alias *new_alias; - if (index_command_search (alias_name)) + if (weelist_search (index_commands, alias_name)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias or command \"%s\" already exists!\n"), WEECHAT_ERROR, alias_name); return NULL; @@ -363,12 +243,14 @@ alias_new (char *alias_name, char *alias_command) pos[0] = '\0'; if (alias_search (alias_command)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias cannot run another alias!\n"), WEECHAT_ERROR); return NULL; } - if (!index_command_search (alias_command)) + if (!weelist_search (index_commands, alias_command)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s target command \"%s\" does not exist!\n"), WEECHAT_ERROR, alias_command); return NULL; @@ -529,6 +411,15 @@ exec_weechat_command (t_irc_server *server, char *string) /* look for end of command */ ptr_args = NULL; + + pos = &command[strlen (command) - 1]; + if (pos[0] == ' ') + { + while ((pos > command) && (pos[0] == ' ')) + pos--; + pos[1] = '\0'; + } + pos = strchr (command, ' '); if (pos) { @@ -554,6 +445,8 @@ exec_weechat_command (t_irc_server *server, char *string) { if (weechat_commands[i].min_arg == weechat_commands[i].max_arg) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for %s command \"%s\" " "(expected: %d arg%s)\n"), @@ -562,7 +455,10 @@ exec_weechat_command (t_irc_server *server, char *string) weechat_commands[i].max_arg, (weechat_commands[i].max_arg > 1) ? "s" : ""); + } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for %s command \"%s\" " "(expected: between %d and %d arg%s)\n"), @@ -572,6 +468,7 @@ exec_weechat_command (t_irc_server *server, char *string) weechat_commands[i].max_arg, (weechat_commands[i].max_arg > 1) ? "s" : ""); + } } else { @@ -582,9 +479,12 @@ exec_weechat_command (t_irc_server *server, char *string) return_code = (int) (weechat_commands[i].cmd_function_1arg) (ptr_args); if (return_code < 0) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s %s command \"%s\" failed\n"), WEECHAT_ERROR, PACKAGE_NAME, command + 1); + } } if (argv) { @@ -606,6 +506,8 @@ exec_weechat_command (t_irc_server *server, char *string) || (argc > irc_commands[i].max_arg)) { if (irc_commands[i].min_arg == irc_commands[i].max_arg) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for IRC command \"%s\" " @@ -614,7 +516,10 @@ exec_weechat_command (t_irc_server *server, char *string) command + 1, irc_commands[i].max_arg, (irc_commands[i].max_arg > 1) ? "s" : ""); + } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for IRC command \"%s\" " @@ -623,15 +528,18 @@ exec_weechat_command (t_irc_server *server, char *string) command + 1, irc_commands[i].min_arg, irc_commands[i].max_arg, (irc_commands[i].max_arg > 1) ? "s" : ""); + } } else { if ((irc_commands[i].need_connection) && ((!server) || (!server->is_connected))) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s command \"%s\" needs a server connection!\n"), WEECHAT_ERROR, irc_commands[i].command_name); + free (command); return 0; } if (irc_commands[i].cmd_function_args) @@ -641,9 +549,12 @@ exec_weechat_command (t_irc_server *server, char *string) return_code = (int) (irc_commands[i].cmd_function_1arg) (server, ptr_args); if (return_code < 0) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s IRC command \"%s\" failed\n"), WEECHAT_ERROR, command + 1); + } } if (argv) { @@ -688,6 +599,7 @@ exec_weechat_command (t_irc_server *server, char *string) return 1; } } + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown command \"%s\" (type /help for help)\n"), WEECHAT_ERROR, @@ -757,14 +669,20 @@ user_command (t_irc_server *server, char *command) COLOR_WIN_CHAT, "%s\n", command); } else + { + irc_display_prefix (server->buffer, PREFIX_ERROR); gui_printf (server->buffer, _("%s cannot find nick for sending message\n"), WEECHAT_ERROR); + } } } else + { + irc_display_prefix ((server) ? server->buffer : NULL, PREFIX_ERROR); gui_printf ((server) ? server->buffer : NULL, _("This window is not a channel!\n")); + } } } @@ -790,18 +708,31 @@ weechat_cmd_alias (char *arguments) pos++; if (!pos[0]) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "alias"); return -1; } if (!alias_new (arguments, pos)) return -1; - (void) index_command_new (arguments); - gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"), - arguments, pos); + if (weelist_add (&index_commands, &last_index_command, arguments)) + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"), + arguments, pos); + } + else + { + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("Failed to create alias \"%s\" => \"%s\" " + "(not enough memory)\n"), + arguments, pos); + return -1; + } } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "alias"); return -1; @@ -812,17 +743,22 @@ weechat_cmd_alias (char *arguments) /* List all aliases */ if (weechat_alias) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("List of aliases:\n")); for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, " %s => %s\n", ptr_alias->alias_name, ptr_alias->alias_command + 1); } } else + { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("No alias defined.\n")); + } } return 0; } @@ -891,6 +827,7 @@ weechat_cmd_buffer (int argc, char **argv) if (argc < 2) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing arguments for \"%s\" command\n"), WEECHAT_ERROR, "buffer"); return -1; @@ -913,6 +850,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect buffer number\n"), WEECHAT_ERROR); return -1; @@ -925,7 +863,8 @@ weechat_cmd_buffer (int argc, char **argv) if ((!gui_current_window->buffer->next_buffer) && (gui_current_window->buffer == gui_buffers)) { - gui_printf (gui_current_window->buffer, + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("%s can not close the single buffer\n"), WEECHAT_ERROR); return -1; @@ -934,7 +873,8 @@ weechat_cmd_buffer (int argc, char **argv) { if (SERVER(gui_current_window->buffer)->channels) { - gui_printf (gui_current_window->buffer, + irc_display_prefix (NULL, PREFIX_ERROR); + gui_printf (NULL, _("%s can not close server buffer while channels " "are opened\n"), WEECHAT_ERROR); @@ -982,6 +922,7 @@ weechat_cmd_buffer (int argc, char **argv) if ((number < 0) || (number > 3)) { /* invalid highlight level */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"), WEECHAT_ERROR); return -1; @@ -991,6 +932,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect notify level (must be between 0 and 3)\n"), WEECHAT_ERROR); return -1; @@ -1007,6 +949,7 @@ weechat_cmd_buffer (int argc, char **argv) { if (!gui_switch_to_buffer_by_number (gui_current_window, (int) number)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s buffer \"%s\" not found for \"%s\" command\n"), WEECHAT_ERROR, argv[0], "buffer"); @@ -1016,6 +959,7 @@ weechat_cmd_buffer (int argc, char **argv) else { /* invalid number */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect buffer number\n"), WEECHAT_ERROR); return -1; @@ -1039,6 +983,7 @@ weechat_cmd_clear (int argc, char **argv) gui_buffer_clear_all (); else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("unknown parameter \"%s\" for \"%s\" command\n"), argv[0], "clear"); @@ -1067,6 +1012,7 @@ weechat_cmd_connect (int argc, char **argv) { if (ptr_server->is_connected) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s already connected to server \"%s\"!\n"), WEECHAT_ERROR, argv[0]); @@ -1086,6 +1032,7 @@ weechat_cmd_connect (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, argv[0]); @@ -1111,19 +1058,24 @@ weechat_cmd_disconnect (int argc, char **argv) { if ((!ptr_server->is_connected) && (ptr_server->reconnect_start == 0)) { + irc_display_prefix (ptr_server->buffer, PREFIX_ERROR); gui_printf (ptr_server->buffer, _("%s not connected to server \"%s\"!\n"), WEECHAT_ERROR, argv[0]); return -1; } if (ptr_server->reconnect_start > 0) + { + irc_display_prefix (ptr_server->buffer, PREFIX_INFO); gui_printf (ptr_server->buffer, _("Auto-reconnection is cancelled\n")); + } server_disconnect (ptr_server, 0); gui_draw_buffer_status (gui_current_window->buffer, 1); } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, argv[0]); @@ -1143,18 +1095,29 @@ weechat_cmd_help (int argc, char **argv) if (argc == 0) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, - _("> List of %s internal commands:\n"), PACKAGE_NAME); + _("> List of %s internal commands:\n"), + PACKAGE_NAME); for (i = 0; weechat_commands[i].command_name; i++) - gui_printf (NULL, " %s - %s\n", - weechat_commands[i].command_name, + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", + weechat_commands[i].command_name); + gui_printf (NULL, " - %s\n", _(weechat_commands[i].command_description)); + } + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("> List of IRC commands:\n")); for (i = 0; irc_commands[i].command_name; i++) if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) - gui_printf (NULL, " %s - %s\n", - irc_commands[i].command_name, + { + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", + irc_commands[i].command_name); + gui_printf (NULL, " - %s\n", _(irc_commands[i].command_description)); + } } if (argc == 1) { @@ -1162,42 +1125,48 @@ weechat_cmd_help (int argc, char **argv) { if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0) { - gui_printf - (NULL, - _("> Help on %s internal command \"%s\":\n"), - PACKAGE_NAME, weechat_commands[i].command_name); - gui_printf (NULL, - _("Syntax: /%s %s\n"), - weechat_commands[i].command_name, + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("> Help on %s internal command \""), PACKAGE_NAME); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", + weechat_commands[i].command_name); + gui_printf (NULL, "\":\n"); + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Syntax: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s", + weechat_commands[i].command_name); + gui_printf (NULL, " %s\n", (weechat_commands[i].arguments) ? _(weechat_commands[i].arguments) : ""); if (weechat_commands[i].arguments_description) - { gui_printf (NULL, "%s\n", _(weechat_commands[i].arguments_description)); - } return 0; } } for (i = 0; irc_commands[i].command_name; i++) { - if (strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0) + && (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)) { - gui_printf (NULL, - _("> Help on IRC command \"%s\":\n"), - irc_commands[i].command_name); - gui_printf (NULL, _("Syntax: /%s %s\n"), - irc_commands[i].command_name, + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("> Help on IRC command \"")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", + irc_commands[i].command_name); + gui_printf (NULL, "\":\n"); + irc_display_prefix (NULL, PREFIX_INFO); + gui_printf (NULL, _("Syntax: ")); + gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s", + irc_commands[i].command_name); + gui_printf (NULL, "%s\n", (irc_commands[i].arguments) ? _(irc_commands[i].arguments) : ""); if (irc_commands[i].arguments_description) - { gui_printf (NULL, "%s\n", _(irc_commands[i].arguments_description)); - } return 0; } } + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("No help available, \"%s\" is an unknown command\n"), argv[0]); @@ -1321,17 +1290,20 @@ weechat_cmd_perl (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "perl"); } break; default: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s wrong argument count for \"%s\" command\n"), WEECHAT_ERROR, "perl"); } #else + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("WeeChat was build without Perl support.\n" "Please rebuild WeeChat with " @@ -1403,15 +1375,19 @@ weechat_cmd_server (int argc, char **argv) { if (argc < 2) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing servername for \"%s\" command\n"), WEECHAT_ERROR, "server del"); return -1; } if (argc > 2) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s too much arguments for \"%s\" command, ignoring arguments\n"), WEECHAT_WARNING, "server del"); + } /* look for server by name */ server_found = NULL; @@ -1426,6 +1402,7 @@ weechat_cmd_server (int argc, char **argv) } if (!server_found) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found for \"%s\" command\n"), WEECHAT_ERROR, argv[1], "server del"); @@ -1449,6 +1426,7 @@ weechat_cmd_server (int argc, char **argv) if (argc < 3) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing parameters for \"%s\" command\n"), WEECHAT_ERROR, "server"); @@ -1458,6 +1436,7 @@ weechat_cmd_server (int argc, char **argv) if (server_name_already_exists (argv[0])) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" already exists, can't create it!\n"), WEECHAT_ERROR, argv[0]); @@ -1482,6 +1461,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-pwd"); @@ -1494,6 +1474,7 @@ weechat_cmd_server (int argc, char **argv) { if (i >= (argc - 3)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing nick(s) for \"%s\" parameter\n"), WEECHAT_ERROR, "-nicks"); @@ -1508,6 +1489,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-username"); @@ -1520,6 +1502,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-realname"); @@ -1532,6 +1515,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing command for \"%s\" parameter\n"), WEECHAT_ERROR, "-command"); @@ -1544,6 +1528,7 @@ weechat_cmd_server (int argc, char **argv) { if (i == (argc - 1)) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s missing password for \"%s\" parameter\n"), WEECHAT_ERROR, "-autojoin"); @@ -1573,6 +1558,7 @@ weechat_cmd_server (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unable to create server\n"), WEECHAT_ERROR); @@ -1601,6 +1587,7 @@ weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *val { char *color_name, *pos_nickserv, *pos_pwd, *value2; + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, " %s%s%s", (prefix) ? prefix : "", (prefix) ? "." : "", @@ -1700,14 +1687,18 @@ weechat_cmd_set (char *arguments) pos[0] = '\0'; ptr_server = server_search (option); if (!ptr_server) + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s server \"%s\" not found\n"), WEECHAT_ERROR, option); + } else { switch (config_set_server_value (ptr_server, pos + 1, value)) { case 0: + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", config_sections[CONFIG_SECTION_SERVER].section_name); @@ -1730,10 +1721,12 @@ weechat_cmd_set (char *arguments) config_change_buffer_content (); break; case -1: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s config option \"%s\" not found\n"), WEECHAT_ERROR, pos + 1); break; case -2: + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"), WEECHAT_ERROR, pos + 1); break; @@ -1748,6 +1741,7 @@ weechat_cmd_set (char *arguments) { if (ptr_option->handler_change == NULL) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s option \"%s\" can not be changed while WeeChat is running\n"), WEECHAT_ERROR, option); @@ -1764,12 +1758,16 @@ weechat_cmd_set (char *arguments) weechat_set_cmd_display_option (ptr_option, NULL, NULL); } else + { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"), WEECHAT_ERROR, option); + } } } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s config option \"%s\" not found\n"), WEECHAT_ERROR, option); } @@ -1792,6 +1790,7 @@ weechat_cmd_set (char *arguments) { if (!section_displayed) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", @@ -1820,6 +1819,7 @@ weechat_cmd_set (char *arguments) { if (!section_displayed) { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "["); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", config_sections[CONFIG_SECTION_SERVER].section_name); @@ -1842,6 +1842,7 @@ weechat_cmd_set (char *arguments) } if (number_found == 0) { + irc_display_prefix (NULL, PREFIX_INFO); if (option) gui_printf (NULL, _("No config option found with \"%s\"\n"), option); @@ -1850,6 +1851,7 @@ weechat_cmd_set (char *arguments) } else { + irc_display_prefix (NULL, PREFIX_INFO); gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", number_found); if (option) gui_printf (NULL, _("config option(s) found with \"%s\"\n"), @@ -1868,21 +1870,23 @@ weechat_cmd_set (char *arguments) int weechat_cmd_unalias (char *arguments) { - t_index_command *ptr_index; + t_weelist *ptr_weelist; t_weechat_alias *ptr_alias; - ptr_index = index_command_search (arguments); - if (!ptr_index) + ptr_weelist = weelist_search (index_commands, arguments); + if (!ptr_weelist) { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s alias or command \"%s\" not found\n"), WEECHAT_ERROR, arguments); return -1; } - index_command_free (ptr_index); + weelist_remove (&index_commands, &last_index_command, ptr_weelist); ptr_alias = alias_search (arguments); if (ptr_alias) alias_free (ptr_alias); + irc_display_prefix (NULL, PREFIX_INFO); gui_printf (NULL, _("Alias \"%s\" removed\n"), arguments); return 0; @@ -1898,6 +1902,7 @@ weechat_cmd_window (int argc, char **argv) if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0))) { /* list opened windows */ + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, "window list -- NOT DEVELOPED!\n"); } else @@ -1914,6 +1919,7 @@ weechat_cmd_window (int argc, char **argv) } else { + irc_display_prefix (NULL, PREFIX_ERROR); gui_printf (NULL, _("%s unknown option for \"%s\" command\n"), WEECHAT_ERROR, "window"); diff --git a/weechat/src/common/command.h b/weechat/src/common/command.h index 586cb7737..44a2a913b 100644 --- a/weechat/src/common/command.h +++ b/weechat/src/common/command.h @@ -21,6 +21,7 @@ #ifndef __WEECHAT_COMMAND_H #define __WEECHAT_COMMAND_H 1 +#include "weelist.h" #include "../irc/irc.h" #define MAX_ARGS 8192 @@ -48,21 +49,13 @@ struct t_weechat_alias t_weechat_alias *next_alias; }; -typedef struct t_index_command t_index_command; - -struct t_index_command -{ - char *command_name; - t_index_command *prev_index; - t_index_command *next_index; -}; +extern t_weechat_command weechat_commands[]; extern t_weechat_alias *weechat_alias; -extern t_index_command *index_commands; +extern t_weelist *index_commands; +extern t_weelist *last_index_command; -extern t_index_command *index_command_search (char *); -extern t_index_command *index_command_new (char *); -extern void index_command_build (); +extern void command_index_build (); extern t_weechat_alias *alias_new (char *, char *); extern int exec_weechat_command (t_irc_server *, char *); extern void user_command (t_irc_server *, char *); diff --git a/weechat/src/common/completion.c b/weechat/src/common/completion.c index 8f6a6d2ba..d7632f13e 100644 --- a/weechat/src/common/completion.c +++ b/weechat/src/common/completion.c @@ -29,8 +29,10 @@ #include "weechat.h" #include "completion.h" -#include "../irc/irc.h" #include "command.h" +#include "weelist.h" +#include "weeconfig.h" +#include "../irc/irc.h" /* @@ -40,8 +42,14 @@ void completion_init (t_completion *completion) { + completion->context = COMPLETION_NULL; + completion->base_command = NULL; + completion->base_command_arg = 0; completion->position = -1; completion->base_word = NULL; + + completion->completion_list = NULL; + completion->last_completion = NULL; } /* @@ -51,8 +59,463 @@ completion_init (t_completion *completion) void completion_free (t_completion *completion) { + if (completion->base_command) + free (completion->base_command); + completion->base_command = NULL; + if (completion->base_word) free (completion->base_word); + completion->base_word = NULL; + + while (completion->completion_list) + weelist_remove (&completion->completion_list, + &completion->last_completion, + completion->completion_list); + completion->completion_list = NULL; + completion->last_completion = NULL; +} + +/* + * completion_stop: stop completion (for example after 1 arg of command with 1 arg) + */ + +void +completion_stop (t_completion *completion) +{ + completion->context = COMPLETION_NULL; + completion->position = -1; +} + +/* + * completion_build_list: build data list according to command and argument # + */ + +void +completion_build_list (t_completion *completion, void *channel) +{ + t_weelist *ptr_list; + int i, j; + t_irc_server *ptr_server; + t_irc_channel *ptr_channel; + char option_name[256]; + t_weechat_alias *ptr_alias; + + /* WeeChat internal commands */ + + /* no completion for some commands */ + if ((strcasecmp (completion->base_command, "server") == 0) + || (strcasecmp (completion->base_command, "save") == 0)) + { + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "alias") == 0) + && (completion->base_command_arg == 1)) + { + for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_list->data); + } + return; + } + if ((strcasecmp (completion->base_command, "buffer") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "close"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "move"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "notify"); + return; + } + if ((strcasecmp (completion->base_command, "clear") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "-all"); + return; + } + if (((strcasecmp (completion->base_command, "connect") == 0) + || (strcasecmp (completion->base_command, "connect") == 0)) + && (completion->base_command_arg == 1)) + { + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_server->name); + } + return; + } + if ((strcasecmp (completion->base_command, "help") == 0) + && (completion->base_command_arg == 1)) + { + for (i = 0; weechat_commands[i].command_name; i++) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + weechat_commands[i].command_name); + } + for (i = 0; irc_commands[i].command_name; i++) + { + if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg) + weelist_add (&completion->completion_list, + &completion->last_completion, + irc_commands[i].command_name); + } + return; + } + if ((strcasecmp (completion->base_command, "perl") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "load"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "autoload"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "unload"); + return; + } + if ((strcasecmp (completion->base_command, "set") == 0) + && (completion->base_command_arg == 1)) + { + 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++) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + weechat_options[i][j].option_name); + } + } + } + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++) + { + snprintf (option_name, sizeof (option_name), "%s.%s", + ptr_server->name, + weechat_options[CONFIG_SECTION_SERVER][i].option_name); + weelist_add (&completion->completion_list, + &completion->last_completion, + option_name); + } + } + return; + } + if ((strcasecmp (completion->base_command, "unalias") == 0) + && (completion->base_command_arg == 1)) + { + for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_alias->alias_name); + } + return; + } + if ((strcasecmp (completion->base_command, "window") == 0) + && (completion->base_command_arg == 2)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "close"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "list"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splith"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "splitv"); + return; + } + + /* IRC commands */ + + /* no completion for some commands */ + if ((strcasecmp (completion->base_command, "admin") == 0) + || (strcasecmp (completion->base_command, "die") == 0) + || (strcasecmp (completion->base_command, "info") == 0) + || (strcasecmp (completion->base_command, "join") == 0) + || (strcasecmp (completion->base_command, "links") == 0) + || (strcasecmp (completion->base_command, "list") == 0) + || (strcasecmp (completion->base_command, "lusers") == 0) + || (strcasecmp (completion->base_command, "me") == 0) + || (strcasecmp (completion->base_command, "motd") == 0) + || (strcasecmp (completion->base_command, "oper") == 0) + || (strcasecmp (completion->base_command, "ping") == 0) + || (strcasecmp (completion->base_command, "pong") == 0) + || (strcasecmp (completion->base_command, "quote") == 0) + || (strcasecmp (completion->base_command, "rehash") == 0) + || (strcasecmp (completion->base_command, "restart") == 0) + || (strcasecmp (completion->base_command, "service") == 0) + || (strcasecmp (completion->base_command, "servlist") == 0) + || (strcasecmp (completion->base_command, "squery") == 0) + || (strcasecmp (completion->base_command, "squit") == 0) + || (strcasecmp (completion->base_command, "stats") == 0) + || (strcasecmp (completion->base_command, "summon") == 0) + || (strcasecmp (completion->base_command, "time") == 0) + || (strcasecmp (completion->base_command, "trace") == 0) + || (strcasecmp (completion->base_command, "users") == 0) + || (strcasecmp (completion->base_command, "wallops") == 0) + || (strcasecmp (completion->base_command, "who") == 0)) + { + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "away") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_away); + return; + } + if ((strcasecmp (completion->base_command, "ctcp") == 0) + && (completion->base_command_arg == 2)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "action"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "version"); + return; + } + if ((strcasecmp (completion->base_command, "dcc") == 0) + && (completion->base_command_arg == 1)) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + "chat"); + weelist_add (&completion->completion_list, + &completion->last_completion, + "send"); + return; + } + if (strcasecmp (completion->base_command, "invite") == 0) + { + /* arg1: nickname */ + if (completion->base_command_arg == 1) + return; + + /* arg > 2: not allowed */ + if (completion->base_command_arg > 2) + { + completion_stop (completion); + return; + } + + /* arg2: channel */ + if (SERVER(gui_current_window->buffer)) + { + for (ptr_channel = SERVER(gui_current_window->buffer)->channels; + ptr_channel; ptr_channel = ptr_channel->next_channel) + { + weelist_add (&completion->completion_list, + &completion->last_completion, + ptr_channel->name); + } + } + return; + } + if (strcasecmp (completion->base_command, "kick") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if (strcasecmp (completion->base_command, "kill") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if (strcasecmp (completion->base_command, "notice") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "part") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_part); + return; + } + if (strcasecmp (completion->base_command, "query") == 0) + { + if (completion->base_command_arg != 1) + completion_stop (completion); + return; + } + if ((strcasecmp (completion->base_command, "quit") == 0) + && (completion->base_command_arg == 1)) + { + if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) + weelist_add (&completion->completion_list, + &completion->last_completion, + cfg_irc_default_msg_quit); + return; + } + if (strcasecmp (completion->base_command, "topic") == 0) + { + if (completion->base_command_arg == 1) + { + if (!channel || !((t_irc_channel *)channel)->topic + || !((t_irc_channel *)channel)->topic[0]) + completion_stop (completion); + else + weelist_add (&completion->completion_list, + &completion->last_completion, + ((t_irc_channel *)channel)->topic); + } + else + completion_stop (completion); + return; + } +} + +/* + * completion_find_context: find context for completion + */ + +void +completion_find_context (t_completion *completion, void *channel, char *buffer, + int size, int pos) +{ + int i, command, command_arg, pos_start, pos_end; + + /* look for context */ + completion_free (completion); + command = (buffer[0] == '/') ? 1 : 0; + command_arg = 0; + i = 0; + while (i < pos) + { + if (buffer[i] == ' ') + { + command_arg++; + i++; + while ((i < pos) && (buffer[i] == ' ')) i++; + } + else + i++; + } + if (command) + { + if (command_arg > 0) + { + completion->context = COMPLETION_COMMAND_ARG; + completion->base_command_arg = command_arg; + } + else + { + completion->context = COMPLETION_COMMAND; + completion->base_command_arg = 0; + } + } + else + { + if (channel) + completion->context = COMPLETION_NICK; + else + completion->context = COMPLETION_NULL; + } + + /* look for word to complete (base word) */ + completion->base_word_pos = 0; + completion->position_replace = pos; + + if (size > 0) + { + i = pos; + pos_start = i; + if (buffer[i] == ' ') + { + if ((i > 0) && (buffer[i-1] != ' ')) + { + i--; + while ((i >= 0) && (buffer[i] != ' ')) + i--; + pos_start = i + 1; + } + } + else + { + while ((i >= 0) && (buffer[i] != ' ')) + i--; + pos_start = i + 1; + } + i = pos; + while ((i < size) && (buffer[i] != ' ')) + i++; + pos_end = i - 1; + + completion->base_word_pos = pos_start; + + if (pos_start <= pos_end) + { + if (completion->context == COMPLETION_COMMAND) + completion->position_replace = pos_start + 1; + else + completion->position_replace = pos_start; + + completion->base_word = (char *) malloc (pos_end - pos_start + 2); + for (i = pos_start; i <= pos_end; i++) + completion->base_word[i - pos_start] = buffer[i]; + completion->base_word[pos_end - pos_start + 1] = '\0'; + } + } + + if (!completion->base_word) + completion->base_word = strdup (""); + + /* find command (for command argument completion only) */ + if (completion->context == COMPLETION_COMMAND_ARG) + { + pos_start = 0; + while ((pos_start < size) && (buffer[pos_start] != '/')) + pos_start++; + if (buffer[pos_start] == '/') + { + pos_start++; + pos_end = pos_start; + while ((pos_end < size) && (buffer[pos_end] != ' ')) + pos_end++; + if (buffer[pos_end] == ' ') + pos_end--; + + completion->base_command = (char *) malloc (pos_end - pos_start + 2); + for (i = pos_start; i <= pos_end; i++) + completion->base_command[i - pos_start] = buffer[i]; + completion->base_command[pos_end - pos_start + 1] = '\0'; + completion_build_list (completion, channel); + } + } } /* @@ -62,23 +525,37 @@ completion_free (t_completion *completion) void completion_command (t_completion *completion) { - int length, word_found_seen; - t_index_command *ptr_index; + int length, word_found_seen, other_completion; + t_weelist *ptr_weelist, *ptr_weelist2; length = strlen (completion->base_word) - 1; word_found_seen = 0; - for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index) + other_completion = 0; + for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) { - if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0) + if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0) { if ((!completion->word_found) || word_found_seen) { - completion->word_found = ptr_index->command_name; + completion->word_found = ptr_weelist->data; + for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; + ptr_weelist2 = ptr_weelist2->next_weelist) + { + if (strncasecmp (ptr_weelist2->data, + completion->base_word + 1, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; return; } + other_completion++; } if (completion->word_found && - (strcasecmp (ptr_index->command_name, completion->word_found) == 0)) + (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) word_found_seen = 1; } if (completion->word_found) @@ -95,11 +572,15 @@ completion_command (t_completion *completion) void completion_nick (t_completion *completion, t_irc_channel *channel) { - int length, word_found_seen; - t_irc_nick *ptr_nick; + int length, word_found_seen, other_completion; + t_irc_nick *ptr_nick, *ptr_nick2; + if (!channel) + return; + length = strlen (completion->base_word); word_found_seen = 0; + other_completion = 0; for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick) { if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0) @@ -107,8 +588,21 @@ completion_nick (t_completion *completion, t_irc_channel *channel) if ((!completion->word_found) || word_found_seen) { completion->word_found = ptr_nick->nick; + for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2; + ptr_nick2 = ptr_nick2->next_nick) + { + if (strncasecmp (ptr_nick2->nick, + completion->base_word, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; return; } + other_completion++; } if (completion->word_found && (strcasecmp (ptr_nick->nick, completion->word_found) == 0)) @@ -122,90 +616,104 @@ completion_nick (t_completion *completion, t_irc_channel *channel) } /* - * completion_search: complete word according to context + * completion_command_arg: complete a command argument */ void -completion_search (t_completion *completion, void *channel, - char *buffer, int size, int pos) +completion_command_arg (t_completion *completion, t_irc_channel *channel) { - int i, pos_start, pos_end; - char *old_word_found; + int length, word_found_seen, other_completion; + t_weelist *ptr_weelist, *ptr_weelist2; - /* TODO: complete when no word is there with command according to context */ - if (size == 0) + length = strlen (completion->base_word); + word_found_seen = 0; + other_completion = 0; + for (ptr_weelist = completion->completion_list; ptr_weelist; + ptr_weelist = ptr_weelist->next_weelist) + { + if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0) + { + if ((!completion->word_found) || word_found_seen) + { + completion->word_found = ptr_weelist->data; + for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2; + ptr_weelist2 = ptr_weelist2->next_weelist) + { + if (strncasecmp (ptr_weelist2->data, + completion->base_word, length) == 0) + other_completion++; + } + if (other_completion == 0) + completion->position = -1; + else + if (completion->position < 0) + completion->position = 0; + return; + } + other_completion++; + } + if (completion->word_found && + (strcasecmp (ptr_weelist->data, completion->word_found) == 0)) + word_found_seen = 1; + } + if (completion->word_found) { completion->word_found = NULL; - return; + completion_command_arg (completion, channel); } +} + +/* + * completion_search: complete word according to context + */ + +void +completion_search (t_completion *completion, void *channel, + char *buffer, int size, int pos) +{ + char *old_word_found; - /* if new complation => look for base word */ + /* if new completion => look for base word */ if (pos != completion->position) { completion->word_found = NULL; - - if ((pos == size) || (buffer[pos-1] != ' ')) - pos--; - if ((pos > 0) && (buffer[pos] == ' ')) - return; - - i = pos; - while ((i >= 0) && (buffer[i] != ' ')) - i--; - pos_start = i + 1; - i = pos; - while ((i < size) && (buffer[i] != ' ')) - i++; - pos_end = i - 1; - - if (pos_start > pos_end) - return; - - completion->base_word_pos = pos_start; - - if (completion->base_word) - free (completion->base_word); - completion->base_word = (char *) malloc (pos_end - pos_start + 2); - - for (i = pos_start; i <= pos_end; i++) - completion->base_word[i - pos_start] = buffer[i]; - completion->base_word[pos_end - pos_start + 1] = '\0'; - - if (completion->base_word[0] == '/') - completion->position_replace = pos_start + 1; - else - completion->position_replace = pos_start; + completion_find_context (completion, channel, buffer, size, pos); } /* completion */ old_word_found = completion->word_found; - if (completion->base_word[0] == '/') + switch (completion->context) { - completion_command (completion); - if (completion->word_found) - { - if (old_word_found) - completion->diff_size = strlen (completion->word_found) - - strlen (old_word_found); + case COMPLETION_NULL: + /* should never be executed */ + return; + case COMPLETION_NICK: + if (channel) + completion_nick (completion, (t_irc_channel *)channel); else - completion->diff_size = strlen (completion->word_found) - - strlen (completion->base_word) + 1; - } + return; + break; + case COMPLETION_COMMAND: + completion_command (completion); + break; + case COMPLETION_COMMAND_ARG: + if (completion->completion_list) + completion_command_arg (completion, (t_irc_channel *)channel); + else + completion_nick (completion, (t_irc_channel *)channel); + break; } - else + if (completion->word_found) { - if (channel) + if (old_word_found) + completion->diff_size = strlen (completion->word_found) - + strlen (old_word_found); + else { - completion_nick (completion, (t_irc_channel *)channel); - if (completion->word_found) - { - if (old_word_found) - completion->diff_size = strlen (completion->word_found) - - strlen (old_word_found); - else - completion->diff_size = strlen (completion->word_found) - - strlen (completion->base_word); - } + completion->diff_size = strlen (completion->word_found) - + strlen (completion->base_word); + if (completion->context == COMPLETION_COMMAND) + completion->diff_size++; } } } diff --git a/weechat/src/common/completion.h b/weechat/src/common/completion.h index a040b03e0..9798a03a1 100644 --- a/weechat/src/common/completion.h +++ b/weechat/src/common/completion.h @@ -21,16 +21,33 @@ #ifndef __WEECHAT_COMPLETION_H #define __WEECHAT_COMPLETION_H 1 +#include "weelist.h" + +#define COMPLETION_NULL 0 +#define COMPLETION_NICK 1 +#define COMPLETION_COMMAND 2 +#define COMPLETION_COMMAND_ARG 3 + typedef struct t_completion t_completion; struct t_completion { - char *base_word; /* word to complete (when Tab was pressed) */ - int base_word_pos; /* beggining of base word */ - int position; /* position where we shoud complete */ - char *word_found; /* word found (to replace base word) */ - int position_replace; /* position where word should be replaced */ - int diff_size; /* size difference (< 0 = char(s) deleted) */ + /* completion context */ + int context; /* context: null, nick, command, cmd arg */ + char *base_command; /* command with arg to complete (can be NULL) */ + int base_command_arg; /* # arg to complete (if context is cmd arg) */ + char *base_word; /* word to complete (when Tab was pressed) */ + int base_word_pos; /* beggining of base word */ + int position; /* position where Tab was pressed */ + + /* for command argument completion */ + t_weelist *completion_list; /* data list for completion */ + t_weelist *last_completion; /* last data element for completion */ + + /* completion found */ + char *word_found; /* word found (to replace base word) */ + int position_replace; /* position where word has to be replaced */ + int diff_size; /* size difference (< 0 = char(s) deleted) */ }; extern void completion_init (t_completion *); diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index 0243383aa..95a468bfa 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -525,7 +525,7 @@ main (int argc, char *argv[]) wee_parse_args (argc, argv); /* parse command line args */ wee_create_home_dirs (); /* create WeeChat directories */ wee_init_log (); /* init log file */ - index_command_build (); /* build commands index for completion */ + command_index_build (); /* build commands index for completion */ switch (config_read ()) /* read configuration */ { diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index c57d20b74..6875e8df9 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -218,7 +218,7 @@ 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, &config_change_color }, + "default", 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, @@ -228,11 +228,11 @@ t_config_option weechat_options_colors[] = { "col_chat", N_("color for chat text"), N_("color for chat text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_chat, NULL, &config_change_color }, + "default", 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, &config_change_color }, + "default", 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, @@ -274,7 +274,7 @@ t_config_option weechat_options_colors[] = { "col_status", N_("color for status bar"), N_("color for status bar"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_status, NULL, &config_change_color }, + "default", NULL, &cfg_col_status, NULL, &config_change_color }, { "col_status_delimiters", N_("color for status bar delimiters"), N_("color for status bar delimiters"), OPTION_TYPE_COLOR, 0, 0, 0, @@ -290,7 +290,7 @@ t_config_option weechat_options_colors[] = { "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, - "gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color }, + "default", 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, @@ -318,7 +318,7 @@ t_config_option weechat_options_colors[] = { "col_input", N_("color for input text"), N_("color for input text"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_input, NULL, &config_change_color }, + "default", 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, @@ -336,7 +336,7 @@ t_config_option weechat_options_colors[] = { "col_nick", N_("color for nicknames"), N_("color for nicknames"), OPTION_TYPE_COLOR, 0, 0, 0, - "gray", NULL, &cfg_col_nick, NULL, &config_change_color }, + "default", 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, @@ -360,7 +360,7 @@ t_config_option weechat_options_colors[] = { "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, &config_change_color }, + "default", 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, @@ -1017,7 +1017,7 @@ config_default_values () if (int_value < 0) gui_printf (NULL, _("%s unable to assign default int with string (\"%s\")\n"), - weechat_options[i][j].default_string); + WEECHAT_WARNING, weechat_options[i][j].default_string); else *weechat_options[i][j].ptr_int = int_value; @@ -1028,7 +1028,7 @@ config_default_values () weechat_options[i][j].default_string)) gui_printf (NULL, _("%s unable to assign default color (\"%s\")\n"), - weechat_options[i][j].default_string); + WEECHAT_WARNING, weechat_options[i][j].default_string); break; case OPTION_TYPE_STRING: *weechat_options[i][j].ptr_string = @@ -1130,96 +1130,105 @@ config_read () } else { - pos = strchr (line, '='); - if (pos == NULL) + if (section == CONFIG_SECTION_NONE) + { gui_printf (NULL, - _("%s %s, line %d: invalid syntax, missing \"=\"\n"), + _("%s %s, line %d: invalid section for option, line is ignored\n"), WEECHAT_WARNING, filename, line_number); + } else { - pos[0] = '\0'; - pos++; - pos2 = strchr (pos, '\r'); - if (pos2 != NULL) - pos2[0] = '\0'; - pos2 = strchr (pos, '\n'); - if (pos2 != NULL) - pos2[0] = '\0'; - - if (section == CONFIG_SECTION_ALIAS) - { - if (alias_new (line, pos)) - index_command_new (line); - } + pos = strchr (line, '='); + if (pos == NULL) + gui_printf (NULL, + _("%s %s, line %d: invalid syntax, missing \"=\"\n"), + WEECHAT_WARNING, filename, line_number); else { - option_number = -1; - for (i = 0; - weechat_options[section][i].option_name; i++) + pos[0] = '\0'; + pos++; + pos2 = strchr (pos, '\r'); + if (pos2 != NULL) + pos2[0] = '\0'; + pos2 = strchr (pos, '\n'); + if (pos2 != NULL) + pos2[0] = '\0'; + + if (section == CONFIG_SECTION_ALIAS) { - if (strcmp - (weechat_options[section][i].option_name, - ptr_line) == 0) - { - option_number = i; - break; - } + if (alias_new (line, pos)) + weelist_add (&index_commands, &last_index_command, line); } - if (option_number < 0) - gui_printf (NULL, - _("%s %s, line %d: invalid option \"%s\"\n"), - WEECHAT_WARNING, filename, line_number, ptr_line); else { - if (config_option_set_value (&weechat_options[section][option_number], pos) < 0) + option_number = -1; + for (i = 0; + weechat_options[section][i].option_name; i++) + { + if (strcmp + (weechat_options[section][i].option_name, + ptr_line) == 0) + { + option_number = i; + break; + } + } + if (option_number < 0) + gui_printf (NULL, + _("%s %s, line %d: invalid option \"%s\"\n"), + WEECHAT_WARNING, filename, line_number, ptr_line); + else { - switch (weechat_options[section] - [option_number].option_type) + if (config_option_set_value (&weechat_options[section][option_number], pos) < 0) { - case OPTION_TYPE_BOOLEAN: - gui_printf (NULL, - _("%s %s, line %d: invalid value for" - "option '%s'\n" - "Expected: boolean value: " - "'off' or 'on'\n"), - WEECHAT_WARNING, filename, - line_number, ptr_line); - break; - case OPTION_TYPE_INT: - gui_printf (NULL, - _("%s %s, line %d: invalid value for " - "option '%s'\n" - "Expected: integer between %d " - "and %d\n"), - WEECHAT_WARNING, filename, - line_number, ptr_line, - weechat_options[section][option_number].min, - weechat_options[section][option_number].max); - break; - case OPTION_TYPE_INT_WITH_STRING: - gui_printf (NULL, - _("%s %s, line %d: invalid value for " - "option '%s'\n" - "Expected: one of these strings: "), - WEECHAT_WARNING, filename, - line_number, ptr_line); - i = 0; - while (weechat_options[section][option_number].array_values[i]) - { - gui_printf (NULL, "\"%s\" ", - weechat_options[section][option_number].array_values[i]); - i++; - } - gui_printf (NULL, "\n"); - break; - case OPTION_TYPE_COLOR: - gui_printf (NULL, - _("%s %s, line %d: invalid color " - "name for option '%s'\n"), - WEECHAT_WARNING, filename, - line_number, - ptr_line); - break; + switch (weechat_options[section] + [option_number].option_type) + { + case OPTION_TYPE_BOOLEAN: + gui_printf (NULL, + _("%s %s, line %d: invalid value for" + "option '%s'\n" + "Expected: boolean value: " + "'off' or 'on'\n"), + WEECHAT_WARNING, filename, + line_number, ptr_line); + break; + case OPTION_TYPE_INT: + gui_printf (NULL, + _("%s %s, line %d: invalid value for " + "option '%s'\n" + "Expected: integer between %d " + "and %d\n"), + WEECHAT_WARNING, filename, + line_number, ptr_line, + weechat_options[section][option_number].min, + weechat_options[section][option_number].max); + break; + case OPTION_TYPE_INT_WITH_STRING: + gui_printf (NULL, + _("%s %s, line %d: invalid value for " + "option '%s'\n" + "Expected: one of these strings: "), + WEECHAT_WARNING, filename, + line_number, ptr_line); + i = 0; + while (weechat_options[section][option_number].array_values[i]) + { + gui_printf (NULL, "\"%s\" ", + weechat_options[section][option_number].array_values[i]); + i++; + } + gui_printf (NULL, "\n"); + break; + case OPTION_TYPE_COLOR: + gui_printf (NULL, + _("%s %s, line %d: invalid color " + "name for option '%s'\n"), + WEECHAT_WARNING, filename, + line_number, + ptr_line); + break; + } } } } diff --git a/weechat/src/common/weelist.c b/weechat/src/common/weelist.c new file mode 100644 index 000000000..e4bf30ef9 --- /dev/null +++ b/weechat/src/common/weelist.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* weelist.c: sorted lists management */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> +#include <string.h> + +#include "weechat.h" +#include "weelist.h" + + +/* + * weelist_search: search date in a list + */ + +t_weelist * +weelist_search (t_weelist *weelist, char *data) +{ + t_weelist *ptr_weelist; + + for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) + { + if (strcasecmp (data, ptr_weelist->data) == 0) + return ptr_weelist; + } + /* word not found in list */ + return NULL; +} + +/* + * weelist_find_pos: find position for data (keeping list sorted) + */ + +t_weelist * +weelist_find_pos (t_weelist *weelist, char *data) +{ + t_weelist *ptr_weelist; + + for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist) + { + if (strcasecmp (data, ptr_weelist->data) < 0) + return ptr_weelist; + } + /* position not found, best position is at the end */ + return NULL; +} + +/* + * weelist_insert: insert an element to the list (at good position) + */ + +void +weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element) +{ + t_weelist *pos_weelist; + + pos_weelist = weelist_find_pos (*weelist, element->data); + + if (*weelist) + { + if (pos_weelist) + { + /* insert data into the list (before position found) */ + element->prev_weelist = pos_weelist->prev_weelist; + element->next_weelist = pos_weelist; + if (pos_weelist->prev_weelist) + pos_weelist->prev_weelist->next_weelist = element; + else + *weelist = element; + pos_weelist->prev_weelist = element; + } + else + { + /* add data to the end */ + element->prev_weelist = *last_weelist; + element->next_weelist = NULL; + (*last_weelist)->next_weelist = element; + *last_weelist = element; + } + } + else + { + element->prev_weelist = NULL; + element->next_weelist = NULL; + *weelist = element; + *last_weelist = element; + } +} + +/* + * weelist_add: create new data and add it to list + */ + +t_weelist * +weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data) +{ + t_weelist *new_weelist; + + if (!data || (!data[0])) + return NULL; + + if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist))))) + { + new_weelist->data = strdup (data); + weelist_insert (weelist, last_weelist, new_weelist); + return new_weelist; + } + /* failed to allocate new element */ + return NULL; +} + +/* + * weelist_remove: free an element in a list + */ + +void +weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element) +{ + t_weelist *new_weelist; + + /* remove element from list */ + if (*last_weelist == element) + *last_weelist = element->prev_weelist; + if (element->prev_weelist) + { + (element->prev_weelist)->next_weelist = element->next_weelist; + new_weelist = *weelist; + } + else + new_weelist = element->next_weelist; + + if (element->next_weelist) + (element->next_weelist)->prev_weelist = element->prev_weelist; + + /* free data */ + if (element->data) + free (element->data); + free (element); + *weelist = new_weelist; +} diff --git a/weechat/src/common/weelist.h b/weechat/src/common/weelist.h new file mode 100644 index 000000000..14a869968 --- /dev/null +++ b/weechat/src/common/weelist.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef __WEECHAT_LIST_H +#define __WEECHAT_LIST_H 1 + +typedef struct t_weelist t_weelist; + +struct t_weelist +{ + char *data; + t_weelist *prev_weelist; + t_weelist *next_weelist; +}; + +t_weelist *weelist_search (t_weelist *, char *); +t_weelist *weelist_add (t_weelist **, t_weelist **, char *); +void weelist_remove (t_weelist **, t_weelist **, t_weelist *); + +#endif /* weelist.h */ diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 767e30fc8..3c89eeeea 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -41,22 +41,21 @@ t_gui_color gui_colors[] = -{ { "default", -1 | A_NORMAL }, - { "black", COLOR_BLACK | A_NORMAL }, - { "red", COLOR_RED | A_NORMAL }, - { "lightred", COLOR_RED | A_BOLD }, - { "green", COLOR_GREEN | A_NORMAL }, - { "lightgreen", COLOR_GREEN | A_BOLD }, - { "brown", COLOR_YELLOW | A_NORMAL }, - { "yellow", COLOR_YELLOW | A_BOLD }, - { "blue", COLOR_BLUE | A_NORMAL }, - { "lightblue", COLOR_BLUE | A_BOLD }, - { "magenta", COLOR_MAGENTA | A_NORMAL }, +{ { "default", -1 | A_NORMAL }, + { "black", COLOR_BLACK | A_NORMAL }, + { "red", COLOR_RED | A_NORMAL }, + { "lightred", COLOR_RED | A_BOLD }, + { "green", COLOR_GREEN | A_NORMAL }, + { "lightgreen", COLOR_GREEN | A_BOLD }, + { "brown", COLOR_YELLOW | A_NORMAL }, + { "yellow", COLOR_YELLOW | A_BOLD }, + { "blue", COLOR_BLUE | A_NORMAL }, + { "lightblue", COLOR_BLUE | A_BOLD }, + { "magenta", COLOR_MAGENTA | A_NORMAL }, { "lightmagenta", COLOR_MAGENTA | A_BOLD }, - { "cyan", COLOR_CYAN | A_NORMAL }, - { "lightcyan", COLOR_CYAN | A_BOLD }, - { "gray", COLOR_WHITE }, - { "white", COLOR_WHITE | A_BOLD }, + { "cyan", COLOR_CYAN | A_NORMAL }, + { "lightcyan", COLOR_CYAN | A_BOLD }, + { "white", COLOR_WHITE | A_BOLD }, { NULL, 0 } }; @@ -892,6 +891,9 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) char format_more[32]; int i, first_mode; + /* make gcc happy */ + (void) buffer; + if (!gui_ok) return; @@ -1797,43 +1799,43 @@ gui_init_colors () init_pair (COLOR_DCC_ABORTED, cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg); - color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD; - color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD; - color_attr[COLOR_WIN_CHAT_TIME - 1] = cfg_col_chat_time & A_BOLD; - color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = cfg_col_chat_time_sep & A_BOLD; - color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD; - color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = cfg_col_chat_prefix1 & A_BOLD; - color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = cfg_col_chat_prefix2 & A_BOLD; - color_attr[COLOR_WIN_CHAT_NICK - 1] = cfg_col_chat_nick & A_BOLD; - color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD; - color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD; - color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD; - color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = cfg_col_chat_highlight & A_BOLD; - color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD; - color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = cfg_col_status_delimiters & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = cfg_col_status_data_highlight & A_BOLD; - color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD; - color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD; - color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD; - color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD; - color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD; - color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD; - color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD; - color_attr[COLOR_WIN_NICK - 1] = cfg_col_nick & A_BOLD; - color_attr[COLOR_WIN_NICK_OP - 1] = cfg_col_nick_op & A_BOLD; - color_attr[COLOR_WIN_NICK_HALFOP - 1] = cfg_col_nick_halfop & A_BOLD; - color_attr[COLOR_WIN_NICK_VOICE - 1] = cfg_col_nick_voice & A_BOLD; + color_attr[COLOR_WIN_TITLE - 1] = (cfg_col_title >= 0) ? cfg_col_title & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT - 1] = (cfg_col_chat >= 0) ? cfg_col_chat & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_TIME - 1] = (cfg_col_chat_time >= 0) ? cfg_col_chat_time & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = (cfg_col_chat_time_sep >= 0) ? cfg_col_chat_time_sep & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_HOST - 1] = (cfg_col_chat_host >= 0) ? cfg_col_chat_host & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = (cfg_col_chat_channel >= 0) ? cfg_col_chat_channel & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; + color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = (cfg_col_chat_highlight >= 0) ? cfg_col_chat_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS - 1] = (cfg_col_status >= 0) ? cfg_col_status & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = (cfg_col_status_delimiters >= 0) ? cfg_col_status_delimiters & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = (cfg_col_status_data_msg >= 0) ? cfg_col_status_data_msg & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = (cfg_col_status_data_highlight >= 0) ? cfg_col_status_data_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = (cfg_col_status_data_other >= 0) ? cfg_col_status_data_other & A_BOLD : 0; + color_attr[COLOR_WIN_STATUS_MORE - 1] = (cfg_col_status_more >= 0) ? cfg_col_status_more & A_BOLD : 0; + color_attr[COLOR_WIN_INFOBAR - 1] = (cfg_col_infobar >= 0) ? cfg_col_infobar & A_BOLD : 0; + color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = (cfg_col_infobar_highlight >= 0) ? cfg_col_infobar_highlight & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT - 1] = (cfg_col_input >= 0) ? cfg_col_input & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = (cfg_col_input_channel >= 0) ? cfg_col_input_channel & A_BOLD : 0; + color_attr[COLOR_WIN_INPUT_NICK - 1] = (cfg_col_input_nick >= 0) ? cfg_col_input_nick & A_BOLD : 0; + color_attr[COLOR_WIN_NICK - 1] = (cfg_col_nick >= 0) ? cfg_col_nick & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_OP - 1] = (cfg_col_nick_op >= 0) ? cfg_col_nick_op & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_HALFOP - 1] = (cfg_col_nick_halfop >= 0) ? cfg_col_nick_halfop & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_VOICE - 1] = (cfg_col_nick_voice >= 0) ? cfg_col_nick_voice & A_BOLD : 0; color_attr[COLOR_WIN_NICK_SEP - 1] = 0; - color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD; - color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD; - color_attr[COLOR_DCC_SELECTED - 1] = cfg_col_dcc_selected & A_BOLD; - color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD; - color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD; - color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD; - color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD; - color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD; - color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD; + color_attr[COLOR_WIN_NICK_SELF - 1] = (cfg_col_nick_self >= 0) ? cfg_col_nick_self & A_BOLD : 0; + color_attr[COLOR_WIN_NICK_PRIVATE - 1] = (cfg_col_nick_private >= 0) ? cfg_col_nick_private & A_BOLD : 0; + color_attr[COLOR_DCC_SELECTED - 1] = (cfg_col_dcc_selected >= 0) ? cfg_col_dcc_selected & A_BOLD : 0; + color_attr[COLOR_DCC_WAITING - 1] = (cfg_col_dcc_waiting >= 0) ? cfg_col_dcc_waiting & A_BOLD : 0; + color_attr[COLOR_DCC_CONNECTING - 1] = (cfg_col_dcc_connecting >= 0) ? cfg_col_dcc_connecting & A_BOLD : 0; + color_attr[COLOR_DCC_ACTIVE - 1] = (cfg_col_dcc_active >= 0) ? cfg_col_dcc_active & A_BOLD : 0; + color_attr[COLOR_DCC_DONE - 1] = (cfg_col_dcc_done >= 0) ? cfg_col_dcc_done & A_BOLD : 0; + color_attr[COLOR_DCC_FAILED - 1] = (cfg_col_dcc_failed >= 0) ? cfg_col_dcc_failed & A_BOLD : 0; + color_attr[COLOR_DCC_ABORTED - 1] = (cfg_col_dcc_aborted >= 0) ? cfg_col_dcc_aborted & A_BOLD : 0; } } diff --git a/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c index 54ed0dccc..eec1532ff 100644 --- a/weechat/src/gui/curses/gui-input.c +++ b/weechat/src/gui/curses/gui-input.c @@ -311,16 +311,16 @@ gui_read_keyb () gui_current_window->buffer->input_buffer, gui_current_window->buffer->input_buffer_size, gui_current_window->buffer->input_buffer_pos); + if (gui_current_window->buffer->completion.word_found) { /* replace word with new completed word into input buffer */ - gui_current_window->buffer->input_buffer_size += - gui_current_window->buffer->completion.diff_size; - gui_optimize_input_buffer_size (gui_current_window->buffer); - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; - if (gui_current_window->buffer->completion.diff_size > 0) { + gui_current_window->buffer->input_buffer_size += + gui_current_window->buffer->completion.diff_size; + gui_optimize_input_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; for (i = gui_current_window->buffer->input_buffer_size - 1; i >= gui_current_window->buffer->completion.position_replace + (int)strlen (gui_current_window->buffer->completion.word_found); i--) @@ -336,6 +336,10 @@ gui_read_keyb () gui_current_window->buffer->input_buffer[i] = gui_current_window->buffer->input_buffer[i - gui_current_window->buffer->completion.diff_size]; + gui_current_window->buffer->input_buffer_size += + gui_current_window->buffer->completion.diff_size; + gui_optimize_input_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; } strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace, @@ -344,35 +348,45 @@ gui_read_keyb () gui_current_window->buffer->input_buffer_pos = gui_current_window->buffer->completion.position_replace + strlen (gui_current_window->buffer->completion.word_found); - gui_current_window->buffer->completion.position = - gui_current_window->buffer->input_buffer_pos; + + /* position is < 0 this means only one word was found to complete, + so reinit to stop completion */ + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position = + gui_current_window->buffer->input_buffer_pos; /* add space or completor to the end of completion, if needed */ - if (gui_current_window->buffer->completion.base_word[0] == '/') + if ((gui_current_window->buffer->completion.context == COMPLETION_COMMAND) + || (gui_current_window->buffer->completion.context == COMPLETION_COMMAND_ARG)) { if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ') gui_buffer_insert_string (gui_current_window->buffer, " ", gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position++; + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position++; gui_current_window->buffer->input_buffer_pos++; } else { - if (gui_current_window->buffer->completion.base_word_pos == 0) + /* add nick completor if position 0 and completing nick */ + if ((gui_current_window->buffer->completion.base_word_pos == 0) + && (gui_current_window->buffer->completion.context == COMPLETION_NICK)) { if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos, cfg_look_completor, strlen (cfg_look_completor)) != 0) gui_buffer_insert_string (gui_current_window->buffer, cfg_look_completor, gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position += strlen (cfg_look_completor); + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position += strlen (cfg_look_completor); gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor); if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ') gui_buffer_insert_string (gui_current_window->buffer, " ", gui_current_window->buffer->input_buffer_pos); - gui_current_window->buffer->completion.position++; + if (gui_current_window->buffer->completion.position >= 0) + gui_current_window->buffer->completion.position++; gui_current_window->buffer->input_buffer_pos++; } } diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c index 17576ff5f..36cb5dda0 100644 --- a/weechat/src/gui/gui-common.c +++ b/weechat/src/gui/gui-common.c @@ -145,8 +145,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc, ((t_irc_server *)(server))->buffer = gui_buffers; if (channel) ((t_irc_channel *)(channel))->buffer = gui_buffers; - SERVER(gui_buffers) = server; - CHANNEL(gui_buffers) = channel; + gui_buffers->server = server; + gui_buffers->channel = channel; if (cfg_log_auto_server) log_start (gui_buffers); return gui_buffers; @@ -158,8 +158,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc, new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1; /* assign server and channel to buffer */ - SERVER(new_buffer) = server; - CHANNEL(new_buffer) = channel; + new_buffer->server = server; + new_buffer->channel = channel; new_buffer->dcc = dcc; /* assign buffer to server and channel */ if (server && !channel) @@ -381,6 +381,9 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another) if (hotlist_initial_buffer == buffer) hotlist_initial_buffer = NULL; + if (buffer_before_dcc == buffer) + buffer_before_dcc = NULL; + if (switch_to_another) { for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) diff --git a/weechat/src/irc/irc-commands.c b/weechat/src/irc/irc-commands.c index 87b0da101..5b2a2d6c1 100644 --- a/weechat/src/irc/irc-commands.c +++ b/weechat/src/irc/irc-commands.c @@ -52,10 +52,10 @@ t_irc_command irc_commands[] = 2, 3, 1, NULL, irc_cmd_send_dcc, NULL }, { "deop", N_("removes channel operator status from nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_deop, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL }, { "devoice", N_("removes voice from nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_devoice, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL }, { "die", N_("shutdown the server"), "", "", 0, 0, 1, NULL, irc_cmd_send_die, NULL }, @@ -136,7 +136,7 @@ t_irc_command irc_commands[] = 2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL }, { "names", N_("list nicknames on channels"), N_("[channel[,channel]]"), N_("channel: channel name"), - 0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL }, + 0, 1, 1, NULL, irc_cmd_send_names, NULL }, { "nick", N_("change current nickname"), N_("nickname"), N_("nickname: new nickname for current IRC server"), 1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick }, @@ -145,7 +145,7 @@ t_irc_command irc_commands[] = 2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice }, { "op", N_("gives channel operator status to nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_op, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_op, NULL, NULL }, { "oper", N_("get operator privileges"), N_("user password"), N_("user/password: used to get privileges on current IRC server"), @@ -229,7 +229,7 @@ t_irc_command irc_commands[] = 0, 1, 1, NULL, irc_cmd_send_version, NULL }, { "voice", N_("gives voice to nickname(s)"), N_("nickname [nickname]"), "", - 1, 1, 1, irc_cmd_send_voice, NULL, NULL }, + 1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL }, { "wallops", N_("send a message to all currently connected users who have " "set the 'w' user mode for themselves"), N_("text"), N_("text to send"), diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c index 47447f22a..80c22ff5c 100644 --- a/weechat/src/irc/irc-send.c +++ b/weechat/src/irc/irc-send.c @@ -248,6 +248,14 @@ int irc_cmd_send_dcc (t_irc_server *server, char *arguments) { /* TODO: write this command! */ + + /* make gcc happy */ + (void) server; + (void) arguments; + + irc_display_prefix (server->buffer, PREFIX_ERROR); + gui_printf (server->buffer, _("This command is not developed!\n")); + return 0; } diff --git a/weechat/src/plugins/perl/wee-perl.c b/weechat/src/plugins/perl/wee-perl.c index c33e1bc40..555250cde 100644 --- a/weechat/src/plugins/perl/wee-perl.c +++ b/weechat/src/plugins/perl/wee-perl.c @@ -313,8 +313,8 @@ static XS (XS_IRC_add_command_handler) name = SvPV (ST (0), integer); function = SvPV (ST (1), integer); - if (!index_command_search (name)) - index_command_new (name); + if (!weelist_search (index_commands, name)) + weelist_add (&index_commands, &last_index_command, name); ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name); if (ptr_plugin_handler) { diff --git a/weechat/src/plugins/plugins.c b/weechat/src/plugins/plugins.c index e9b238aed..cafcd1970 100644 --- a/weechat/src/plugins/plugins.c +++ b/weechat/src/plugins/plugins.c @@ -337,6 +337,9 @@ plugin_exec_command (char *user_command, char *arguments, char *server) void plugin_unload (int plugin_type, char *scriptname) { + /* make gcc happy */ + (void) scriptname; + #ifdef PLUGINS switch (plugin_type) { |