1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-18 09:04:47 +02:00

Compare commits

...

53 Commits

Author SHA1 Message Date
Sebastien Helleu fc95f86528 v0.0.6 doc 2004-06-05 10:59:14 +00:00
Sebastien Helleu d7287a71e5 Version 0.0.6 2004-06-05 09:20:35 +00:00
Sebastien Helleu b861403369 Updated FAQ, added french FAQ 2004-05-31 21:13:55 +00:00
Sebastien Helleu d8a790e8eb New license for doc (FDL => GPL) 2004-05-31 16:26:45 +00:00
Sebastien Helleu 9211a67fb4 Improved channel highlight (priority to message vs join/part) 2004-05-31 15:16:34 +00:00
Sebastien Helleu d0babb2896 Fixed bug in /away command 2004-05-31 15:14:06 +00:00
Sebastien Helleu ad345c0bce Added WeeChat forum URL. 2004-05-13 15:58:04 +00:00
Sebastien Helleu 3b7b459522 Updated TODO 2004-04-25 10:46:33 +00:00
Sebastien Helleu a99e6f3d95 Fixed bug when a user changes nick (do not change private window name if nick is not the same) 2004-04-19 21:53:12 +00:00
Sebastien Helleu 35d6c43f85 Fixed bug when opened private win and remote user changes his nick 2004-03-27 15:09:36 +00:00
Sebastien Helleu db235b23fa /query command added, IRC messages 476, 477 now displayed 2004-03-20 11:19:00 +00:00
Sebastien Helleu a4ed5069c1 Fixed IRC channel for support 2004-03-07 19:04:18 +00:00
Sebastien Helleu 0bd38072f2 Display channel modes when joining channel that already exists (i.e. with modes already set) 2004-02-29 21:16:22 +00:00
Sebastien Helleu 81da0f41d7 Added modes channel (and /mode command is now ok), dcc skeleton, fixed display bug for nicklist 2004-02-29 16:31:26 +00:00
Sebastien Helleu 070e1b6ec7 Fixed display bug (text was blinking when scrolling) 2004-02-24 23:29:58 +00:00
Sebastien Helleu 4e86ff9682 CTCP Version reply is now in english only and doesn't show host (security reason) 2004-02-21 13:26:28 +00:00
Sebastien Helleu 867b881bac Version 0.0.6-pre1 2004-02-07 21:25:53 +00:00
Sebastien Helleu 2c31a11aeb Version 0.0.5 2004-02-07 19:35:26 +00:00
Sebastien Helleu 1d2a83b055 Version 0.0.5 2004-02-07 19:22:53 +00:00
Sebastien Helleu 915ea408f0 Updated doc 2004-01-25 14:13:42 +00:00
Sebastien Helleu c9a469f51b Channel can be specified at the end of command line URL with /channel 2004-01-24 21:53:22 +00:00
Sebastien Helleu 69cb87251e /set command is now ok 2004-01-24 20:17:01 +00:00
Sebastien Helleu 8bcbc3dcae Secured code to prevent buffer overflows and memory leaks 2004-01-24 12:59:57 +00:00
Sebastien Helleu dcb3b6fc7e Secured code to prevent buffer overflows and memory leaks 2004-01-24 02:22:16 +00:00
Sebastien Helleu 16717f8322 Fixed memory leak in exec_weechat_command() 2004-01-23 19:44:59 +00:00
Sebastien Helleu dc38b59849 Infobar highlight notifications 2004-01-21 18:40:13 +00:00
Sebastien Helleu 7d91cdcbb3 Updated bugs 2004-01-21 15:57:20 +00:00
Sebastien Helleu 885fe7434f Fixed QUIT command: now sent to all connected servers (not only current) 2004-01-21 15:55:25 +00:00
Sebastien Helleu 84677f2835 Added IRC::print_infobar Perl function 2004-01-21 15:29:43 +00:00
Sebastien Helleu c20a3fdfa4 Added look_infobar_timestamp config option 2004-01-19 23:16:07 +00:00
Sebastien Helleu f97a5555ca Removed unused variables 2004-01-19 00:00:43 +00:00
Sebastien Helleu 59bd0b825d Fixed minor typo 2004-01-19 00:00:13 +00:00
Sebastien Helleu 38bf163c17 Servers allowed on command line (irc://nick:passwd@irc.example.org:port) 2004-01-18 23:53:34 +00:00
Sebastien Helleu 09a36a5d8e Changed default color for info bar 2004-01-18 19:03:28 +00:00
Sebastien Helleu 10f0236ea9 Added info bar 2004-01-18 18:59:34 +00:00
Sebastien Helleu 6d7afb96c1 Fixed crash with /oper command 2004-01-18 18:58:38 +00:00
Sebastien Helleu 48941e3646 Updated ChangeLog 2004-01-17 10:47:37 +00:00
Sebastien Helleu 72cb070ee4 Fixed bug when un*x realname (in /etc/passwd) is not set 2004-01-17 10:33:11 +00:00
Sebastien Helleu 390a097718 Added check of sys/types.h pwd.h and errno.h 2004-01-17 10:23:01 +00:00
Sebastien Helleu f4733b970a Updated french translations 2004-01-17 10:17:21 +00:00
Sebastien Helleu b80086cfac Nick for default config file is now based on un*x user 2004-01-17 10:15:27 +00:00
Sebastien Helleu 984eaaf826 Updated Changelog 2004-01-15 23:09:18 +00:00
Sebastien Helleu 0dddf86ab7 Fixed crash when config file can not be created 2004-01-15 21:51:55 +00:00
Sebastien Helleu c057937c7b Create plugin directories only if plugin is built when WeeChat is compiled 2004-01-15 21:33:18 +00:00
Sebastien Helleu 938cc50f5e Added LOCALEDIR define 2004-01-15 21:00:27 +00:00
Sebastien Helleu aac1a0a08c Added default values for --config option 2004-01-11 22:54:20 +00:00
Sebastien Helleu b77e441dc4 Added config file options 2004-01-11 22:53:13 +00:00
Sebastien Helleu f9279df092 Added -c (--config) command line parameter to see config file options 2004-01-11 17:45:37 +00:00
Sebastien Helleu d84b1fa58f Added -c (--config) command line parameter to see config file options 2004-01-11 17:29:56 +00:00
Sebastien Helleu 12941227d7 Updated doc for v0.0.4 2004-01-03 10:37:33 +00:00
Sebastien Helleu 25f79c7bba Highlight action messages 2004-01-01 23:14:20 +00:00
Sebastien Helleu ac3f6dfa7b Version 0.0.5-pre1 2004-01-01 23:13:42 +00:00
Sebastien Helleu 65704c6fea Added --enable-perl for ./configure and Perl dependency for Debian package (for building v0.0.4 RPM & Debian packages) 2004-01-01 11:48:46 +00:00
90 changed files with 9974 additions and 4360 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2004-01-01
WeeChat known bugs, 2004-06-05
- ./configure does not check that Curses headers are installed
- ./configure does not check that Gtk 2.0 libraries are installed
@@ -17,4 +17,4 @@ WeeChat known bugs, 2004-01-01
- wrong alias is not created and not saved when quitting WeeChat
- when many WeeChat are launched, log file is not properly written (cleared by
each WeeChat at startup)
- display problems with Konsole (Kde terminal)
- display problems with old Konsole versions (Kde terminal)
+26 -1
View File
@@ -1,9 +1,34 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2004-01-01
ChangeLog - 2004-06-05
Version 0.0.6 (2004-06-05):
* improved channel highlight (priority to message vs join/part)
* fixed bug when opened private win and remote user changes his nick
* /query command added (starts private conversation)
* IRC messages 476, 477 added
* /mode command is now ok and channel flags are displayed in status bar
* fixed display bug (text was blinking when scrolling)
* CTCP Version reply is now in english only and doesn't show host (security reason)
Version 0.0.5 (2004-02-07):
* /set command to modify config options when WeeChat is running
* fixed look_nicklist config option, now enables/disables nicklist
* secured code to prevent buffer overflows and memory leaks
* fixed QUIT IRC command: now sent to all connected servers (not only current)
* URL command line parameter to connect to server(s)
* new Perl script function to display message in info bar ("IRC::print_infobar")
* info bar highlight notifications
* info bar timestamp is added to config ("look_infobar_timestamp")
* added info bar (optional, "look_infobar" to enable it, "on" by default)
* fixed crash with /oper command
* for default config file, nick is now based on un*x username (thanks to Witukind)
* fixed crash when config file cannot be written
* -c (or --config) command line parameter added to see config file options
* highlight action messages
Version 0.0.4 (2004-01-01):
* Perl plugin, with auto-load
* when private window is created (another user is talking), WeeChat does not
+120 -121
View File
@@ -1,158 +1,157 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat FAQ, 2004-05-31
=======================
WeeChat FAQ, 2004-01-01
Intended audience:
All WeeChat users.
Before reading the following:
the following Q/A list is *not* exhaustive.
It is also possible that you won't find any Q/A that matches your problem.
Please read them anyway, they may provide you help in fixing your problem
anyway.
And even if your problem is listed below, it is possible that the answers don't
help you anymore to solve it. Then, please contact us, we will try to help you
finding a solution.
1 - Compiling
2 - Using WeeChat
3 - Development
1.1
================================================================================
Q: I heard about many GUI for WeeChat. How can I compile/use them?
A: Curses GUI is built by default.
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
--enable-gtk to enable Gtk GUI
--enable-qt to enable Qt QUI
Type ./configure --help to see available options.
WARNING: only Curses GUI is ok today. Other GUI are under development!
1- Compiling
1.2
================================================================================
Q: I can't compile WeeChat CVS.
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
1.2 I can't compile WeeChat CVS.
2- Using WeeChat
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
2.2 I've launched WeeChat, but I'm lost, what can I do?
2.3 How can I customize key bindings?
2.4 How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
2.5 How can I load Python scripts?
2.6 How can I load Ruby scripts?
3- Development
3.1 How should I report bugs?
3.2 How should I submit patches?
3.3 How should I submit new feature request?
3.4 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows?
3.5 I want to help WeeChat developers. What can I do?
3.6 Can I give money or other things to WeeChat developers?
A: Check that you have latest version of autoconf and automake.
WeeChat has been developed with autoconf version 2.56 and automake
version 1.7.
You should have at least these versions in order to compile WeeChat CVS.
If you can't or don't want to install these versions, you can download and
install "devel package", a package built almost every day, based on CVS.
Note that this package may not correspond exactly to CVS base.
/------------------------------------------------------------------------------\
| 1- Compiling |
\------------------------------------------------------------------------------/
2.1
================================================================================
Q: Why using WeeChat ? X-Chat and Irssi are so good...
A: Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, Qt),
* extensible with scripts (Perl, Python, Ruby),
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
This is the "geekest Irc client" ;)
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
2.2
================================================================================
Q: I've launched WeeChat, but I'm lost, what can I do?
Curses GUI is built by default.
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
--enable-gtk to enable gtk GUI
--enable-qt to enable Qt QUI
Type ./configure --help to see available options.
WARNING: only Curses GUI is ok today. Other GUI are under development!
A: For help you can type /help. For help about a command, type /help command.
1.2 I can't compile WeeChat CVS.
2.3
================================================================================
Q: How can I customize key bindings?
Check that you have latest version of autoconf and automake.
WeeChat has been developed with autoconf version 2.56 and automake version 1.7.
You should have at least these versions in order to compile WeeChat CVS.
If you can't or don't want to install these versions, you can download and
install "devel package", a package built almost every day, based on CVS.
Note that this package may not correspond exactly to CVS base.
A: Today you can't do that. This will be available in a future version.
/------------------------------------------------------------------------------\
| 2- Using WeeChat |
\------------------------------------------------------------------------------/
2.4
================================================================================
Q: How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
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 ;)
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
2.5
================================================================================
Q: How can I load Python scripts?
Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, Qt),
* extensible with scripts (Perl, Python, Ruby),
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
This is the "geekest Irc client" ;)
A: Today Python interface is not developed, so can't load any Python script.
2.2 I've launched WeeChat, but I'm lost, what can I do?
2.6
================================================================================
Q: How can I load Ruby scripts?
For help you can type /help. For help about a command, type /help command.
A: Today Ruby interface is not developed, so can't load any Ruby script.
2.3 How can I customize key bindings?
3.1
================================================================================
Q: How should I report bugs?
Today you can't do that. This will be available in a future version.
A: There is 3 ways to report bugs:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can submit your bug at this url:
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. you can mail your problem, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.4 How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
3.2
================================================================================
Q: How should I submit patches?
Yes, you can use /perl command to launch 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 ;)
A: There is 3 ways to submit patches:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can submit your patch at this url:
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. you can mail your patch, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.5 How can I load Python scripts?
3.3
================================================================================
Q: How should I submit new feature request?
Today Python interface is not developed, so can't load any Python script.
A: There is 2 ways to submit your feature request:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can mail your feature request, look at support page for developer's
mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.6 How can I load Ruby scripts?
3.4
================================================================================
Q: Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
Today Ruby interface is not developed, so can't load any Ruby script.
A: Yes. Future versions will be available for these OS.
/------------------------------------------------------------------------------\
| 3- Development |
\------------------------------------------------------------------------------/
3.5
================================================================================
Q: I want to help WeeChat developers. What can I do?
A: There's many tasks to do (code, documentation, ...)
Please contact us with IRC or mail, look at support page:
http://weechat.flashtux.org/support.php
3.1 How should I report bugs?
3.6
================================================================================
Q: Can I give money or other things to WeeChat developers?
There is 3 ways to report bugs:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can submit your bug at this url:
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. you can mail your problem, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.2 How should I submit patches?
There is 3 ways to submit patches:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can submit your patch at this url:
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. you can mail your patch, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.3 How should I submit new feature request?
There is 2 ways to submit your feature request:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can mail your feature request, look at support page for developer's
mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.4 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
Yes. Future versions will be available for these OS.
3.5 I want to help WeeChat developers. What can I do?
There's many tasks to do (code, documentation, ...)
Please contact us with IRC or mail, look at support page:
http://weechat.flashtux.org/support.php
3.6 Can I give money or other things to WeeChat developers?
No.
A: No.
+172
View File
@@ -0,0 +1,172 @@
WeeChat FAQ, 2004-05-31
=======================
Public concerné :
Tous les utilisateurs de WeeChat.
Avant de lire la suite ceci :
la liste suivante de questions/réponses n'est *pas* exhaustive.
Il est donc possible que vous ne trouviez pas de question/réponse correspondant
à votre problème.
Lisez les quand même SVP, elles peuvent vous aider à corriger votre problème.
Et même si votre problème est mentionné ci-dessous, il est possible que la
réponse ne vous aide pas à corriger le problème. Dans ce cas, contactez-nous,
nous essaierons de vous aider Ă  trouver une solution.
1 - Compilation
2 - Utilisation de WeeChat
3 - Développement
1.1
================================================================================
Q: J'ai entendu parler de plusieurs interfaces pour WeeChat.
Comment puis-je les compiler/utiliser ?
R: L'interface Curses est construite par défaut.
Pour construire l'interface Gtk ou Qt, vous devez spécifier des options
pour le script ./configure :
--enable-gtk pour activer l'interface Gtk
--enable-qt pour activer l'interface Qt
Tapez ./configure --help pour voir les options disponibles.
ATTENTION : seule l'interface Curses est ok aujourd'hui.
Les autres interfaces sont en développement.
1.2
================================================================================
Q: Je ne peux pas compiler le CVS WeeChat.
R: Vérifiez que vous avez bien la dernière version d'autoconf et automake.
WeeChat a été développé avec autoconf version 2.56 et automake
version 1.7.
Vous devez avoir au moins ces versions pour compiler le CVS WeeChat.
Si vous n'avez pas ou ne souhaitez pas installer ces versions, vous
pouvez télécharger et installer le paquet "devel", un paquet construit
quasiment tous les jours, basé sur le CVS.
Notez que ce paquet peut ne pas correspondre exactement Ă  la base CVS.
2.1
================================================================================
Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
Quelques nouvelles fonctionnalités :
* plusieurs interfaces (Curses, Gtk, Qt),
* extensible par des scripts (Perl, Python, Ruby),
* 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" ;)
2.2
================================================================================
Q: J'ai lancé WeeChat, mais je suis perdu, que puis-je faire ?
R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
tapez /help commande.
2.3
================================================================================
Q: Comment puis-je configurer les raccourcis clavier ?
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
version future.
2.4
================================================================================
Q: Comment puis-je charger des scripts Perl ?
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
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,
désolé ;)
2.5
================================================================================
Q: Comment puis-je charger les scripts Python ?
R: Aujourd'hui l'interface Python n'est pas déceloppée.
Vous ne pouvez donc charger aucun script Python.
2.6
================================================================================
Q: Comment puis-je charger des scripts Ruby ?
R: Aujourd'hui l'interface Ruby n'est pas développée.
Vous ne pouvez donc charger aucun script Ruby.
3.1
================================================================================
Q: Comment dois-je reporter les bugs ?
R: Il y a 3 manières de reporter les bugs :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
2. vous pouvez soumettre votre bug Ă  cette adresse :
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. vous pouvez envoyer votre problem par mail, consultez la page
support pour les mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.2
================================================================================
Q: Comment dois-je soumettre les patches ?
R: Il y a 3 manières de soumettre les patches :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
2. vous pouvez soumettre votre patch Ă  cette adresse :
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. vous pouvez envoyer votre patch par mail, consultez la page
support pour les mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.3
================================================================================
Q: Comment dois-je soumettre les demandes de nouvelles fonctionnalités ?
R: Il y a 2 manières :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, channel #weechat
2. vous pouvez envoyer un mail, consultez la page support pour les
mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.4
================================================================================
Q: WeeChat sera-t-il porté sur *BSD, QNX, MacOS X, Microsoft Windows ?
R: Oui. Les futures versions seront disponibles pour ces OS.
3.5
================================================================================
Q: Je souhaiterai aider les développeurs WeeChat. Que puis-je faire ?
R: Il y a plusieurs choses Ă  faire (code, documentation, ...)
Merci de prendre contact avec nous par IRC ou mail, consultez la page
support :
http://weechat.flashtux.org/support.php
3.6
================================================================================
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
R: Non.
+1 -1
View File
@@ -17,6 +17,6 @@
SUBDIRS = po intl src
EXTRA_DIST = weechat.1 BUGS FAQ
EXTRA_DIST = weechat.1 BUGS FAQ FAQ.fr
man_MANS = weechat.1
+4
View File
@@ -1,6 +1,10 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
* FlashCode, 2004-02-07
WeeChat 0.0.5 released.
* FlashCode, 2004-01-01
WeeChat 0.0.4 released.
+17 -21
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2004-01-01
TODO - 2004-06-05
Legend:
# done
@@ -10,34 +10,34 @@ Legend:
? is this really necessary?
v0.0.4:
v0.0.6:
------
* General:
# debug messages can be enabled via ./configure --enbale-debug option
- Windows version
+ Solaris version
* IRC protocol:
# "/mode" command: change the user/channels modes
+ "/dcc" command (for chat and sending/receiving files)
# "/query" command: start private conversation
* Interface:
+ internationalization (traduce WeeChat in many languages)
# intercept Ctrl-C
# when private window is created (another user is talking), WeeChat does not
switch to this window
# highlight when our nick is written in a channel/private window
# display current channel modes (example : #weechat(+nt))
* Plugins:
# Perl plugin
# "/perl load" and "/perl unload" commands to (un)load Perl scripts
# auto-load Perl scripts at startup
* Configuration:
+ add missing options for config file
- add key bindings to config file
Future versions:
---------------
* General:
- Windows version
- *BSD version
* IRC protocol:
+ "/mode" command: change the user/channels modes
- "/dcc" command (for chat and sending/receiving files)
- complete "/list" command: add regexp search, display only channels that
match regexp
- "/ignore" and "/unignore" commands: hide all that is write by a given
@@ -48,9 +48,6 @@ Future versions:
nick/host connect to the given irc network
* WeeChat commands:
+ "/set" command: allow the user to set the WeeChat variables
under WeeChat without editing the config file (colours, time
format, etc)
- "/reload" command: reload the WeeChat's config file
- "/highlight" command: highlight a given word when it appears on
channels/privates
@@ -60,10 +57,11 @@ Future versions:
and show us the output on the current window. An option to exec
like -o could send the output to the server, on the current
channel/private
- "/last": command to look for text in previous messages
* Interface:
+ Gtk GUI
- display current channel modes (example : #weechat(+nt))
- color for nicks (except own nick) when nick colors are disabled
- interpret special chars in messages (color & bold for example)
- many channel windows in one window/term (window split)
- add lag indicator
@@ -71,7 +69,7 @@ Future versions:
if WeeChat is running for long time, a lot of memory is used!)
- improve completion (for example complete command parameters when possible)
- understand incomplete commands if unambigous (for example: /he for /help is ok)
- add clock (in status bar?)
- tab key with empty command line should switch to next window (like F7)
- log chats to file
? Qt GUI
@@ -82,8 +80,6 @@ Future versions:
- IPv6 protocol implementation
* Configuration:
- add missing options for config file
- add key bindings to config file
- load config file after GUI (so init values by default (colors, ...) before
loading config)
+3 -3
View File
@@ -19,10 +19,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 0.0.4, flashcode@flashtux.org)
AC_INIT(WeeChat, 0.0.6, flashcode@flashtux.org)
AC_CONFIG_SRCDIR([src/common/weechat.c])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([weechat], [0.0.4])
AM_INIT_AUTOMAKE([weechat], [0.0.6])
# Checks for programs.
AC_PROG_CC
@@ -38,7 +38,7 @@ AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
+12
View File
@@ -1,3 +1,15 @@
weechat (0.0.6-1) unstable; urgency=low
* WeeChat version 0.0.6, see ChangeLog for detail.
-- FlashCode <flashcode@flashtux.org> Sat, 05 Jun 2004 11:30:00 +0200
weechat (0.0.5-1) unstable; urgency=low
* WeeChat version 0.0.5, see ChangeLog for detail.
-- FlashCode <flashcode@flashtux.org> Sat, 07 Feb 2004 20:30:00 +0200
weechat (0.0.4-1) unstable; urgency=low
* WeeChat version 0.0.4, see ChangeLog for detail.
+1 -1
View File
@@ -2,7 +2,7 @@ Source: weechat
Section: net
Priority: optional
Maintainer: FlashCode <flashcode@flashtux.org>
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7)
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
Standards-Version: 3.5.8
Package: weechat
+1 -1
View File
@@ -1,5 +1,5 @@
This package was debianized by FlashCode <flashcode@flashtux.org> on
Thu, 01 Jan 2004 13:00:00 +0200.
Sat, 05 Jun 2004 11:30:00 +0200.
It was downloaded from http://weechat.flashtux.org/download
+1 -1
View File
@@ -17,7 +17,7 @@ endif
configure: configure-stamp
configure-stamp:
dh_testdir
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
./configure --prefix=/usr --sysconfdir=/etc --enable-perl --enable-gtk
touch configure-stamp
+1
View File
@@ -3,6 +3,7 @@ BUGS
ChangeLog
COPYING
FAQ
FAQ.fr
INSTALL
NEWS
README
+360 -15
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (english version)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_en.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_en.texi
@@ -28,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.0.4 - November, 23 2003
@subtitle Documentation for WeeChat v0.0.6 - June, 05 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ This manual documents WeeChat IRC client, it is part of WeeChat.@*
Latest version of this document can be found on this page:@*
@uref{http://weechat.flashtux.org/doc.php?lang=en}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
This document may be used under the terms the GNU General Public License
@@ -198,17 +205,20 @@ Then follow instructions for source package - @xref{Source package}.
@chapter Usage
@menu
* Run WeeChat::
* Run WeeChat::
* Config file::
* Key bindings::
* WeeChat commands::
@end menu
@node Run WeeChat, Key bindings, Usage, Usage
@node Run WeeChat, Config file, Usage, Usage
@section Run WeeChat
@subsection Command line parameters
@table @code
@item -c, --config
Display config file help (list of options)@*
@item -h, --help
Display help screen@*
@item -l, --license
@@ -220,7 +230,7 @@ Display WeeChat version@*
@subsection Run WeeChat
Just issue this command to run WeeChat:@*
@kbd{weechat}@*
@kbd{weechat-curses} (for Curses front-end)@*
or @kbd{weechat-gtk} (for Gtk front-end)@*
or @kbd{weechat-qt} (for Qt front-end)@*
@@ -231,7 +241,306 @@ The default configuration file is: ~/.weechat/weechat.rc@*
You can edit this file at your convenience to configure WeeChat, or you can
set parameters with @kbd{/set} command in WeeChat - @xref{WeeChat commands}.
@node Key bindings, WeeChat commands, Run WeeChat, Usage
@node Config file, Key bindings, Run WeeChat, Usage
@section Config file
Here is a list of all options for config file:@*
@table @kbd
@item look_set_title
Set title for window (terminal for Curses GUI) with name & version@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_startup_logo
Display WeeChat logo at startup@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_startup_version
Display WeeChat version at startup@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_weechat_slogan
WeeChat slogan (if empty, slogan is not used)@*
Type: string (any string), default value: 'the geekest IRC client!'@*
@item look_color_nicks
Display nick names with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist_position
Nicklist position (top, left, right (default), bottom)@*
Type: string (values: 'left', 'right', 'top', 'bottom'), default value: 'right'@*
@item look_nicklist_min_size
Min size for nicklist (width or height, depending on look_nicklist_position (0 = no min size))@*
Type: integer (values: between 0 and 100), default value: 0@*
@item look_nicklist_max_size
Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min == max and > 0, then size is fixed))@*
Type: integer (values: between 0 and 100), default value: 0@*
@item look_no_nickname
Text to display instead of nick when not connected@*
Type: string (any string), default value: '-cmd-'@*
@item look_nickmode
Display nick mode ((half)op/voice) before each nick@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nickmode_empty
Display space if nick mode is not (half)op/voice@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item look_nick_completor
The string inserted after nick completion@*
Type: string (any string), default value: ':'@*
@item look_infobar
Enable info bar@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_infobar_timestamp
Timestamp for time in infobar@*
Type: string (any string), default value: '%B, %A %d %G - %H:%M'@*
@item look_infobar_delay_highlight
Delay (in seconds) for highlight messages in infobar (0 = disable highlight notifications in infobar)@*
Type: integer (values: between 0 and 2147483647), default value: 7@*
@item col_title
Color for title bar@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_title_bg
Background for title bar@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_chat
Color for chat text@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_chat_time
Color for time in chat window@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_chat_time_sep
Color for time separator (chat window)@*
Type: color (Curses or Gtk color), default value: 'brown'@*
@item col_chat_prefix1
Color for 1st and 3rd char of prefix@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_chat_prefix2
Color for middle char of prefix@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_chat_nick
Color for nicks in actions (chat window)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_chat_host
Color for hostnames (chat window)@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_chat_channel
Color for channel names in actions (chat window)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_chat_dark
Color for dark separators (chat window)@*
Type: color (Curses or Gtk color), default value: 'green'@*
@item col_chat_highlight
Color for highlighted nick (chat window)@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_chat_bg
Background for chat window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item col_status
Color for status bar@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_status_active
Color for active window (status bar)@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_status_data_msg
Color for window with new messages (status bar)@*
Type: color (Curses or Gtk color), default value: 'lightred'@*
@item col_status_data_other
Color for window with new data (not messages) (status bar)@*
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
@item col_status_more
Color for window with new data (status bar)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_status_bg
Background for status window@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_infobar_bg
Background for info bar window@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input
Color for input text@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_input_channel
Color for input text (channel name)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_input_nick
Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item col_nick
Color for nicknames@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_nick_op
Color for operator symbol@*
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
@item col_nick_halfop
Color for half-operator symbol@*
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
@item col_nick_voice
Color for voice symbol@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_nick_sep
Color for nick separator@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_nick_self
Color for local nick@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_nick_private
Color for other nick in private window@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_nick_bg
Background for nicknames@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item history_max_lines
Maximum number of lines in history for one server/channel/private window (0 = unlimited)@*
Type: integer (values: between 0 and 2147483647), default value: 4096@*
@item history_max_commands
Maximum number of user commands in history (0 = unlimited)@*
Type: integer (values: between 0 and 2147483647), default value: 100@*
@item log_auto_channels
Automatically log channel chats@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item log_auto_private
Automatically log private chats@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item log_path
Path for WeeChat log files@*
Type: string (any string), default value: '~/.weechat/logs/'@*
@item log_name
Name for log files (%S == irc server name, %N == channel name (or nickname if private chat)@*
Type: string (any string), default value: '%S,%N.weechatlog'@*
@item log_timestamp
Timestamp for log (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '~'@*
@item log_start_string
Text written when starting new log file (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '--- Log started %a %b %d %Y %H:%M:%s'@*
@item log_end_string
Text written when ending log file (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '--- Log ended %a %b %d %Y %H:%M:%s'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_max_size
Maximum size for incoming file when automatically accepted@*
Type: integer (values: between 0 and 2147483647), default value: 0@*
@item dcc_auto_accept_chats
Automatically accept dcc chats (use carefully!)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_timeout
Timeout for dcc request (in seconds)@*
Type: integer (values: between 1 and 2147483647), default value: 300@*
@item dcc_download_path
Path for writing incoming files with dcc (default: user home)@*
Type: string (any string), default value: '~'@*
@item dcc_upload_path
Path for reading files when sending thru dcc (when no path is specified)@*
Type: string (any string), default value: '~'@*
@item dcc_auto_rename
Rename incoming files if already exists (add '.1', '.2', ...)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_resume
Automatically resume dcc transfer if connection with remote host is loosed@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item proxy_use
Use a proxy server to connect to irc server@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item proxy_address
Proxy server address (IP or hostname)@*
Type: string (any string), default value: ''@*
@item proxy_port
Port for connecting to proxy server@*
Type: integer (values: between 0 and 65535), default value: 1080@*
@item proxy_password
Password for proxy server@*
Type: string (any string), default value: ''@*
@item server_name
Name associated to IRC server (for display only)@*
Type: string (any string), default value: ''@*
@item server_autoconnect
Automatically connect to server when WeeChat is starting@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item server_address
IP address or hostname of IRC server@*
Type: string (any string), default value: ''@*
@item server_port
Port for connecting to server@*
Type: integer (values: between 0 and 65535), default value: 6667@*
@item server_password
Password for IRC server@*
Type: string (any string), default value: ''@*
@item server_nick1
Nickname to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_nick2
Alternate nickname to use on IRC server (if nickname is already used)@*
Type: string (any string), default value: ''@*
@item server_nick3
2nd alternate nickname to use on IRC server (if alternate nickname is already used)@*
Type: string (any string), default value: ''@*
@item server_username
User name to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_realname
Real name to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_command
First command to run when connected to server@*
Type: string (any string), default value: ''@*
@item server_autojoin
Comma separated list of channels to join when connected to server@*
Type: string (any string), default value: ''@*
@end table
Colors for Curses GUI are:@*
@itemize @minus
@item
@kbd{default}: default color (transparent for background)
@item
@kbd{black}: black
@item
@kbd{red}: dark red
@item
@kbd{lightred}: light red
@item
@kbd{green}: dark green
@item
@kbd{lightgreen}: light green
@item
@kbd{brown}: brown
@item
@kbd{yellow}: yellow
@item
@kbd{blue}: dark blue
@item
@kbd{lightblue}: light blue
@item
@kbd{magenta}: dark magenta
@item
@kbd{lightmagenta}: light magenta
@item
@kbd{cyan}: dark cyan
@item
@kbd{lightcyan}: light cyan
@item
@kbd{gray}: gray
@item
@kbd{white}: white
@end itemize
@node Key bindings, WeeChat commands, Config file, Usage
@section Key bindings
@table @kbd
@@ -271,6 +580,9 @@ Switch to previous / next window@*
@item Alt + left arrow / Alt + right arrow
Same as F6 / F7@*
@*
@item F10
Remove last infobar message@*
@*
@end table
@node WeeChat commands, , Key bindings, Usage
@@ -345,6 +657,39 @@ Print message in current window (channel or server).@*
@code{IRC::print ("message");}@*
@*
@item
@command{IRC::print_with_channel ( channel, [server,] message );}@*
@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@item @option{message}: message to display
@end itemize
@*
@emph{Examples:}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
@code{IRC::print_with_channel ("#weechat", "message");}@*
@*
@item
@command{IRC::print_infobar ( delay, message );}@*
@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Example:}@*
@code{IRC::print_infobar (5, "message");}@*
@*
@item
@command{IRC::add_message_handler ( name, function );}@*
@*
@@ -466,7 +811,7 @@ Support with IRC:@*
- server: @b{irc.freenode.net}@*
- channel: @b{#weechat}@*@*
@item
WeeChat forum: soon!@*@*
WeeChat forum: @uref{http://forums.flashtux.org}@*@*
@item
Support with mailing list:@*
- to subscribe/unsubscribe:@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -486,7 +831,7 @@ Look for WeeChat support page for detail:@*
This manual documents WeeChat IRC client, it is part of WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
This document may be used under the terms the GNU General Public License
+360 -15
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (french version)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_fr.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_fr.texi
@@ -28,7 +35,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.0.4 - 23 novembre 2003
@subtitle Documentation pour WeeChat v0.0.6 - 5 juin 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
La derni@`ere version de ce document peut @^etre t@'el@'echarg@'ee sur cette page :@*
@uref{http://weechat.flashtux.org/doc.php}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
@@ -198,17 +205,20 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
@chapter Utilisation
@menu
* Lancer WeeChat::
* Lancer WeeChat::
* Fichier de configuration::
* Raccourcis clavier::
* Commandes WeeChat::
@end menu
@node Lancer WeeChat, Raccourcis clavier, Utilisation, Utilisation
@node Lancer WeeChat, Fichier de configuration, Utilisation, Utilisation
@section Lancer WeeChat
@subsection Param@`etres de ligne de commande
@table @code
@item -c, --config
Afficher l'aide sur le fichier de config (liste des options)@*
@item -h, --help
Afficher l'aide@*
@item -l, --license
@@ -220,7 +230,7 @@ Afficher la version de WeeChat@*
@subsection Lancer WeeChat
Tapez simplement cette commande pour lancer WeeChat :@*
@kbd{weechat-curses}@*
@kbd{weechat-curses} (pour l'interface Curses)@*
ou @kbd{weechat-gtk} (pour l'interface Gtk)@*
ou @kbd{weechat-qt} (pour l'interface Qt)@*
@@ -231,7 +241,306 @@ Le fichier de configuration par d@'efaut est : ~/.weechat/weechat.rc@*
Vous pouvez @'editer ce fichier pour configurer WeeChat @`a votre convenance, ou
vous pouvez modifier les param@`etres dans WeeChat avec la commande @kbd{/set} - @xref{Commandes WeeChat}.
@node Raccourcis clavier, Commandes WeeChat, Lancer WeeChat, Utilisation
@node Fichier de configuration, Raccourcis clavier, Lancer WeeChat, Utilisation
@section Fichier de configuration
Liste des options du fichier de configuration :@*
@table @kbd
@item look_set_title
D@'efinit le titre de la fen@^etre (terminal pour l'interface Curses) avec le nom et la version@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_startup_logo
Afficher le logo WeeChat au d@'emarrage@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_startup_version
Afficher la version de WeeChat au d@'emarrage@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_weechat_slogan
Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
@item look_color_nicks
Afficher les utilisateurs avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_color_actions
Afficher les actions avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_remove_colors_from_msgs
Supprimer les couleurs dans les messages entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist
Afficher la fen@^etre des utilisateurs (pour les fen@^etres de canaux)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist_position
Position de la fen@^etre d'utilisateurs (haut (top), gauche (left), droite (right, par d@'efaut), bas (bottom))@*
Type: cha@^ine (valeurs: 'left', 'right', 'top', 'bottom'), valeur par d@'efaut: 'right'@*
@item look_nicklist_min_size
Taille minimum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille minimum))@*
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
@item look_nicklist_max_size
Taille maximum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min == max et > 0, alors la taille est fixe))@*
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
@item look_no_nickname
Texte @`a afficher en lieu et place du nom d'utilisateur lorsque la connexion n'est pas active@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '-cmd-'@*
@item look_nickmode
Afficher le mode de l'utilisateur ((half)op/voice) devant chaque utilisateur@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nickmode_empty
Afficher un espace si le mode utilisateur n'est pas (half)op/voice@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item look_nick_completor
La cha@^ine affich@'ee apr@`es la compl@'etion des utilisateurs@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ':'@*
@item look_infobar
Active la barre d'infos@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_infobar_timestamp
Horodatage pour les conversations sauvegard@'ees@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %G - %H:%M'@*
@item look_infobar_delay_highlight
D@'elai (en secondes) pour la notification des messages dans la barre d'infos (0 = d@'esactiver les notifications dans la barre d'infos)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 7@*
@item col_title
Couleur pour la barre de titre@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_title_bg
Couleur de fond pour la barre de titre@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_chat
Couleur pour le texte de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_chat_time
Couleur pour l'heure dans la fen@^etre de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_chat_time_sep
Couleur pour la s@'eparation de l'heure (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'brown'@*
@item col_chat_prefix1
Couleur pour le 1er et le 3@`eme caract@`ere du pr@'efixe@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_chat_prefix2
Couleur pour le caract@`ere du milieu du pr@'efixe@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_chat_nick
Couleur pour les noms d'utilisateurs dans les actions (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_chat_host
Couleur pour les noms de machines (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_chat_channel
Couleur pour les canaux dans les actions (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_chat_dark
Couleur pour les s@'eparateurs sombres (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'green'@*
@item col_chat_highlight
Couleur pour le pseudo surlign@'e (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_chat_bg
Couleur de fond pour la fen@^etre de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item col_status
Couleur pour la barre de statut@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_status_active
Couleur pour la fen@^etre active (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_status_data_msg
Couleur pour une fen@^etre avec de nouvelles infos (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
@item col_status_data_other
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
@item col_status_more
Couleur pour une fen@^etre avec des nouvelles donn@'ees (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_status_bg
Couleur de fond pour la fen@^etre de statut@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar
Couleur pour la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'black'@*
@item col_infobar_highlight
Couleur pour la notification dans la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_infobar_bg
Couleur de fond pour la fen@^etre de barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_input
Couleur pour le texte saisi@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_input_channel
Couleur pour le texte saisi (nom du canal)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_input_nick
Couleur pour le texte saisi (pseudo)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
@item col_input_bg
Couleur de fond pour la fen@^etre de saisie@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item col_nick
Couleur pour les pseudos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_nick_op
Couleur pour le symbole op@'erateur@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
@item col_nick_halfop
Couleur pour le symbole demi-op@'erateur@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
@item col_nick_voice
Couleur pour le symbole voix@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_nick_sep
Couleur pour le s@'eparateur de pseudo@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_nick_self
Couleur pour le pseudo local@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_nick_private
Couleur pour l'autre pseudo dans la fen@^etre priv@'ee@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_nick_bg
Couleur de fond pour les pseudos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item history_max_lines
Nombre maximum de lignes dans l'historique pour un serveur/fen@^etre/fen@^etre priv@'ee (0 = sans limite)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 4096@*
@item history_max_commands
Nombre maximum de commandes utilisateur dans l'historique (0 = sans limite)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 100@*
@item log_auto_channels
Enregistrer automatiquement les conversations des canaux@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item log_auto_private
Enregistrer automatiquement les conversations priv@'ees@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item log_path
Chemin pour les conversations sauvegard@'ees par WeeChat@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
@item log_name
Nom des conversations saivegard@'ees (%S == nom du serveur irc, %N == nom du canal (ou pseudo si fen@^etre priv@'ee)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%S,%N.weechatlog'@*
@item log_timestamp
Horodatage pour les conversations sauvegard@'ees (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item log_start_string
Texte @'ecrit en d@'emarrant la sauvegarde d'une discussion (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '--- Log started %a %b %d %Y %H:%M:%s'@*
@item log_end_string
Texte @'ecrit @`a la fin d'une discussion sauvegard@'ees (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '--- Log ended %a %b %d %Y %H:%M:%s'@*
@item dcc_auto_accept_files
Accepte automatiquement les fichiers dcc entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_accept_max_size
Taille maximum pour un fichier entrant lorsqu'il est accept@'e automatiquement@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 0@*
@item dcc_auto_accept_chats
Accepte automatiquement les demandes de discussion dcc (@`a utiliser avec pr@'ecaution !)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_timeout
D@'elai d'attente pour les requ@^etes dcc (en secondes)@*
Type: entier (valeurs: entre 1 et 2147483647), valeur par d@'efaut: 300@*
@item dcc_download_path
Chemin pour @'ecrire les fichiers re@,{c}us par dcc (par d@'efaut: r@'epertoire de l'utilisateur)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item dcc_upload_path
Chemin pour lire les fichiers lorsqu'ils sont envoy@'es par dcc (quand aucun chemin n'est sp@'ecifi@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item dcc_auto_rename
Renommer les fichiers re@,{c}us s'ils existent d@'ej@`a (ajoute '.1', '.2', ...)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_resume
Continuer automatiquement les transferts dcc si la connexion avec la machine distante a @'et@'e perdue@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item proxy_use
Utiliser un proxy pour se connecter au serveur irc@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item proxy_address
Adresse du serveur proxy (IP ou nom)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item proxy_port
Port pour se connecter au serveur proxy@*
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 1080@*
@item proxy_password
Mot de passe pour le serveur proxy@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_name
Nom associ@'e au serveur IRC (pour affichage seulement)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_autoconnect
Connexion automatique au serveur quand WeeChat d@'emarre@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item server_address
Adresse IP ou nom du serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_port
Port pour se connecter au serveur@*
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 6667@*
@item server_password
Mot de passe pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick1
Pseudo @`a utiliser sur le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick2
Pseudo alternatif pour le serveur IRC (si le pseudo est d@'ej@`a utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick3
2nd pseudo alternatif pour le serveur IRC (si le pseudo alternatif est d@'ej@`a utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_username
Nom d'utilisateur pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_realname
Nom r@'eel pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_command
Commande @`a ex@'ecuter en premier lorsque connect@'e au serveur@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_autojoin
Liste des canaux (s@'epar@'es par des virgules) @`a rejoindre lorsque connect@'e au serveur@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@end table
Les couleurs pour l'interface Curses sont :@*
@itemize @minus
@item
@kbd{default}: couleur par d@'efaut (transparent pour le fond)
@item
@kbd{black}: noir
@item
@kbd{red}: rouge fonc@'e
@item
@kbd{lightred}: rouge clair
@item
@kbd{green}: vert fonc@'e
@item
@kbd{lightgreen}: vert clair
@item
@kbd{brown}: marron
@item
@kbd{yellow}: jaune
@item
@kbd{blue}: bleu fonc@'e
@item
@kbd{lightblue}: bleu clair
@item
@kbd{magenta}: violet fonc@'e
@item
@kbd{lightmagenta}: violet clair
@item
@kbd{cyan}: cyan fonc@'e
@item
@kbd{lightcyan}: cyan clair
@item
@kbd{gray}: gris
@item
@kbd{white}: blanc
@end itemize
@node Raccourcis clavier, Commandes WeeChat, Fichier de configuration, Utilisation
@section Raccourcis clavier
@table @kbd
@@ -271,6 +580,9 @@ Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
Identique @`a F6 / F7@*
@*
@item F10
Effacer le dernier message de la barre d'infos@*
@*
@end table
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
@@ -345,6 +657,39 @@ Affiche un message dans la fen@^etre courante (canal ou serveur).@*
@code{IRC::print ("message");}@*
@*
@item
@command{IRC::print_with_channel ( canal, [serveur,] message );}@*
@*
Affiche un message dans un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Exemples :}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
@code{IRC::print_with_channel ("#weechat", "message");}@*
@*
@item
@command{IRC::print_infobar ( d@'elai, message );}@*
@*
Affiche un message dans la barre d'infos.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{d@'elai}: d@'elai (en secondes) pendant lequel le message est affich@'e
(si 0, le message ne sera pas effac@'e).
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Exemple :}@*
@code{IRC::print_infobar (5, "message");}@*
@*
@item
@command{IRC::add_message_handler ( nom, fonction );}@*
@*
@@ -466,7 +811,7 @@ Support par IRC:@*
- serveur : @b{irc.freenode.net}@*
- canal : @b{#weechat}@*@*
@item
Forum WeeChat : bient@^ot !@*@*
Forum WeeChat : @uref{http://forums.flashtux.org}@*@*
@item
Support par la liste de diffusion :@*
- pour souscrire/d@'esinscrire :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -486,7 +831,7 @@ Voir la page support WeeChat pour plus de d@'etails :@*
Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
+57 -12
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (vers@~ao partuguesa)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_pt.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_pt.texi
@@ -28,7 +35,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.3 - 23 de Novembro de 2003
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.6 - 05 de Junho de 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ Este manual documenta o cliente de IRC WeeChat, ele faz parte do WeeChat.@*
A ultima versĂŁo deste documento pode ser descarregada de :@*
@uref{http://weechat.flashtux.org/doc.php}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Este documento pode ser utilizado sobre os termos da Licen@,{c}a P@'ublica geral GNU (GNU General Public
@@ -207,6 +214,8 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
@subsection Par@^ametros de linha de comandos
@table @code
@item -c, --config
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
@item -h, --help
Mostrar a ajuda@*
@item -l, --license
@@ -218,7 +227,7 @@ Mostrar a vers@~ao do WeeChat@*
@subsection Invocar o WeeChat
Escreve simplesmente este comando para invoceres o WeeChat :@*
@kbd{weechat-curses}@*
@kbd{weechat-curses} (para a interface em Curses)@*
ou @kbd{weechat-gtk} (para a interface em Gtk)@*
ou @kbd{weechat-qt} (para a interface em Qt)@*
@@ -268,6 +277,9 @@ Ir para a janela anterior/seguinte@*
@item Alt + Seta da esquerda / Alt + Seta da direita
Identico a F6 / F7@*
@*
@item F10
Apagar a @'ultima mensagem da barra do info@*
@*
@end table
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
@@ -340,6 +352,39 @@ Imprimne uma mensagem na janela actual (canal ou servidor).@*
@code{IRC::print ("mensagem");}@*
@*
@item
@command{IRC::print_with_channel ( canal, [servidor,] mensagem );}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Exemplos:}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "mensagem");}@*
@code{IRC::print_with_channel ("#weechat", "mensagem");}@*
@*
@item
@command{IRC::print_infobar ( atrasa, mensagem );}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Exemplo:}@*
@code{IRC::print_infobar (5, "mensagem");}@*
@*
@item
@command{IRC::add_message_handler ( nome, fun@,{c}@~ao );}@*
@*
@@ -457,7 +502,7 @@ Suporte por IRC:@*
- servidor : @b{irc.freenode.net}@*
- canal : @b{#weechat}@*@*
@item
Forum do WeeChat : mais tarde !@*@*
Forum do WeeChat : @uref{http://forums.flashtux.org}@*@*
@item
Suporte por lista de correio-e :@*
- para te inscreveres/desinscreveres :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -477,7 +522,7 @@ Para mais detalhes, v@^e tamb@'em a p@'agina de suporte do WeeChat :@*
Este manual documenta o cliente de IRC WeeChat, Ele faz parte do WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
Tradu@,{c}@~ao portuguesa de Jo@~ao Jer@'onimo <@email{j_j_b_o@@sapo.pt, j_j_b_o AT sapo.pt}>@*
@*
+869 -617
View File
File diff suppressed because it is too large Load Diff
+908 -669
View File
File diff suppressed because it is too large Load Diff
+167 -81
View File
@@ -84,7 +84,7 @@ t_weechat_command weechat_commands[] =
0, 1, weechat_cmd_save, NULL },
{ "set", N_("set config parameters"),
N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"),
0, 2, weechat_cmd_set, NULL },
0, MAX_ARGS, NULL, weechat_cmd_set },
{ "unalias", N_("remove an alias"),
N_("alias_name"), N_("alias_name: name of alias to remove"),
1, 1, NULL, weechat_cmd_unalias },
@@ -207,14 +207,14 @@ index_command_build ()
i = 0;
while (weechat_commands[i].command_name)
{
index_command_new (weechat_commands[i].command_name);
(void) index_command_new (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)
index_command_new (irc_commands[i].command_name);
(void) index_command_new (irc_commands[i].command_name);
i++;
}
}
@@ -363,8 +363,11 @@ alias_new (char *alias_name, char *alias_command)
{
new_alias->alias_name = strdup (alias_name);
new_alias->alias_command = (char *)malloc (strlen (alias_command) + 2);
new_alias->alias_command[0] = '/';
strcpy (new_alias->alias_command + 1, alias_command);
if (new_alias->alias_command)
{
new_alias->alias_command[0] = '/';
strcpy (new_alias->alias_command + 1, alias_command);
}
alias_insert_sorted (new_alias);
return new_alias;
}
@@ -409,7 +412,7 @@ alias_free (t_weechat_alias *alias)
*/
char **
explode_string (char *string, char *separators, int num_items_max,
explode_string (/*@null@*/ char *string, char *separators, int num_items_max,
int *num_items)
{
int i, n_items;
@@ -502,7 +505,7 @@ exec_weechat_command (t_irc_server *server, char *string)
char *command, *pos, *ptr_args, **argv, *alias_command;
t_weechat_alias *ptr_alias;
if ((!string[0]) || (string[0] != '/'))
if ((!string) || (!string[0]) || (string[0] != '/'))
return 0;
command = strdup (string);
@@ -572,6 +575,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -630,6 +634,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -643,14 +648,18 @@ exec_weechat_command (t_irc_server *server, char *string)
length1 = strlen (ptr_alias->alias_command);
length2 = strlen (ptr_args);
alias_command = (char *)malloc (length1 + 1 + length2 + 1);
strcpy (alias_command, ptr_alias->alias_command);
alias_command[length1] = ' ';
strcpy (alias_command + length1 + 1, ptr_args);
exec_weechat_command (server, alias_command);
free (alias_command);
if (alias_command)
{
strcpy (alias_command, ptr_alias->alias_command);
alias_command[length1] = ' ';
strcpy (alias_command + length1 + 1, ptr_args);
}
(void) exec_weechat_command (server, alias_command);
if (alias_command)
free (alias_command);
}
else
exec_weechat_command (server, ptr_alias->alias_command);
(void) exec_weechat_command (server, ptr_alias->alias_command);
if (argv)
{
@@ -658,6 +667,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -672,6 +682,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv);
}
}
free (command);
return 0;
}
@@ -690,7 +701,7 @@ user_command (t_irc_server *server, char *command)
if ((command[0] == '/') && (command[1] != '/'))
{
/* WeeChat internal command (or IRC command) */
exec_weechat_command (server, command);
(void) exec_weechat_command (server, command);
}
else
{
@@ -768,7 +779,7 @@ weechat_cmd_alias (char *arguments)
}
if (!alias_new (arguments, pos))
return -1;
index_command_new (arguments);
(void) index_command_new (arguments);
gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"),
arguments, pos);
}
@@ -847,7 +858,10 @@ weechat_cmd_connect (int argc, char **argv)
return -1;
}
if (!ptr_server->window)
gui_window_new (ptr_server, NULL, 1);
{
if (!gui_window_new (ptr_server, NULL, 1))
return -1;
}
if (server_connect (ptr_server))
{
irc_login (ptr_server);
@@ -990,7 +1004,7 @@ weechat_cmd_perl (int argc, char **argv)
#ifdef PLUGINS
t_plugin_script *ptr_plugin_script;
t_plugin_handler *ptr_plugin_handler;
int handler_found;
int handler_found, path_length;
char *path_script;
#ifdef PLUGIN_PERL
@@ -1081,10 +1095,11 @@ weechat_cmd_perl (int argc, char **argv)
path_script = NULL;
else
{
path_script = (char *) malloc ((strlen (weechat_home) +
strlen (argv[1]) + 7) * sizeof (char));
sprintf (path_script, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "perl", DIR_SEPARATOR, argv[1]);
path_length = strlen (weechat_home) + strlen (argv[1]) + 7;
path_script = (char *) malloc (path_length * sizeof (char));
snprintf (path_script, path_length, "%s%s%s%s%s",
weechat_home, DIR_SEPARATOR, "perl",
DIR_SEPARATOR, argv[1]);
}
plugin_load (PLUGIN_TYPE_PERL,
(path_script) ? path_script : argv[1]);
@@ -1167,8 +1182,11 @@ weechat_cmd_server (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL,
COLOR_WIN_CHAT,
_(" Autoconnect: %s\n"),
(ptr_server->autoconnect) ? _("yes") : _("no"));
_(" Autoconnect: %s%s\n"),
(ptr_server->autoconnect) ? _("yes") : _("no"),
(ptr_server->command_line) ?
_(" (temporary server, will not be saved)") :
"");
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL,
COLOR_WIN_CHAT,
@@ -1399,11 +1417,11 @@ weechat_cmd_server (int argc, char **argv)
}
/* create new server */
new_server = server_new (server.name, server.autoconnect, server.address,
server.port, server.password, server.nick1,
server.nick2, server.nick3, server.username,
server.realname, server.command,
server.autojoin);
new_server = server_new (server.name, server.autoconnect, 0,
server.address, server.port, server.password,
server.nick1, server.nick2, server.nick3,
server.username, server.realname,
server.command, server.autojoin);
if (new_server)
{
irc_display_prefix (NULL, PREFIX_INFO);
@@ -1423,7 +1441,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
gui_window_new (new_server, NULL, 1);
(void) gui_window_new (new_server, NULL, 1);
if (server_connect (new_server))
irc_login (new_server);
}
@@ -1438,72 +1456,140 @@ weechat_cmd_server (int argc, char **argv)
*/
int
weechat_cmd_set (int argc, char **argv)
weechat_cmd_set (char *arguments)
{
char *option, *value;
int i, j, section_displayed;
char *color_name;
t_config_option *ptr_option;
int number_found;
/* TODO: complete /set command */
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
option = NULL;
value = NULL;
if (arguments && arguments[0])
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
option = arguments;
value = strchr (option, ' ');
if (value)
{
for (j = 0; weechat_options[i][j].option_name; j++)
value[0] = '\0';
value++;
while (value[0] == ' ')
value++;
}
}
if (value && value[0])
{
ptr_option = config_option_search (option);
if (ptr_option)
{
if (ptr_option->handler_change == NULL)
{
if ((argc == 0) ||
((argc > 0)
&& (strstr (weechat_options[i][j].option_name, argv[0])
!= NULL)))
gui_printf (NULL,
_("%s option '%s' can not be changed while WeeChat is running\n"),
WEECHAT_ERROR, option);
}
else
{
if (config_option_set_value (ptr_option, value) == 0)
{
if (!section_displayed)
(void) (ptr_option->handler_change());
gui_printf (NULL, "[%s]\n", config_get_section (ptr_option));
gui_printf (NULL, " %s = %s\n", option, value);
}
else
gui_printf (NULL, _("%s incorrect value for option '%s'\n"),
WEECHAT_ERROR, option);
}
}
else
{
gui_printf (NULL, _("%s config option '%s' not found\n"),
WEECHAT_ERROR, option);
}
}
else
{
number_found = 0;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option)
!= NULL)))
{
gui_printf (NULL, "[%s]\n",
config_sections[i].section_name);
section_displayed = 1;
}
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].option_name,
(*weechat_options[i][j].ptr_int) ?
"ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf (NULL,
" %s = %d\n",
weechat_options[i][j].option_name,
*weechat_options[i][j].ptr_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].
option_name,
(*weechat_options[i][j].
ptr_string) ?
*weechat_options[i][j].
ptr_string : "");
break;
if (!section_displayed)
{
gui_printf (NULL, "[%s]\n",
config_sections[i].section_name);
section_displayed = 1;
}
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].option_name,
(*weechat_options[i][j].ptr_int) ?
"ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf (NULL,
" %s = %d\n",
weechat_options[i][j].option_name,
*weechat_options[i][j].ptr_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].
option_name,
(*weechat_options[i][j].
ptr_string) ?
*weechat_options[i][j].
ptr_string : "");
break;
}
number_found++;
}
}
}
}
if (number_found == 0)
{
if (value)
gui_printf (NULL, _("No config option found with '%s'\n"),
value);
else
gui_printf (NULL, _("No config option found with '%s'\n"));
}
else
{
if (value)
gui_printf (NULL, _("%d config option(s) found with '%s'\n"),
number_found, value);
else
gui_printf (NULL, _("%d config option(s) found\n"),
number_found);
}
}
gui_printf (NULL, "(TODO) \"/set\" command not fully developed!\n");
return 0;
}
+1 -1
View File
@@ -74,7 +74,7 @@ extern int weechat_cmd_help (int, char **);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_save (int, char **);
extern int weechat_cmd_server (int, char **);
extern int weechat_cmd_set (int, char **);
extern int weechat_cmd_set (char *);
extern int weechat_cmd_unalias (char *);
#endif /* command.h */
+177 -37
View File
@@ -62,6 +62,8 @@ int quit_weechat; /* = 1 if quit request from user... why ? :'( */
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log) */
int server_cmd_line; /* at least one server on WeeChat command line */
/*
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
@@ -95,13 +97,89 @@ wee_log_printf (char *message, ...)
seconds = time (NULL);
date_tmp = localtime (&seconds);
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
buffer);
if (date_tmp)
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
buffer);
else
fprintf (log_file, "[????-??-?? ??:??:??] %s", buffer);
fflush (log_file);
}
/*
* wee_display_config_options: display config options
*/
void wee_display_config_options ()
{
int i, j, k;
printf (_("WeeChat configuration options (~/.weechat/weechat.rc):\n\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if (weechat_options[i])
{
j = 0;
while (weechat_options[i][j].option_name)
{
printf ("* %s:\n",
weechat_options[i][j].option_name);
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
printf (_(" . type boolean (values: 'on' or 'off')\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_int == BOOL_TRUE) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
printf (_(" . type integer (values: between %d and %d)\n"),
weechat_options[i][j].min,
weechat_options[i][j].max);
printf (_(" . default value: %d\n"),
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
printf (_(" . type string (values: "));
k = 0;
while (weechat_options[i][j].array_values[k])
{
printf ("'%s'",
weechat_options[i][j].array_values[k]);
if (weechat_options[i][j].array_values[k + 1])
printf (", ");
k++;
}
printf (")\n");
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
case OPTION_TYPE_COLOR:
printf (_(" . type color (Curses or Gtk color, look at WeeChat doc)\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
case OPTION_TYPE_STRING:
printf (_(" . type string (any string)\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
}
printf (_(" . description: %s\n\n"),
gettext (weechat_options[i][j].long_description));
j++;
}
}
}
printf (_("Moreover, you can define aliases in [alias] section, by adding lines like:\n"));
printf ("j=join\n");
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
}
/*
* wee_parse_args: parse command line args
*/
@@ -110,26 +188,56 @@ void
wee_parse_args (int argc, char *argv[])
{
int i;
t_irc_server server_tmp;
server_cmd_line = 0;
for (i = 1; i < argc; i++)
{
if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
if ((strcmp (argv[i], "-c") == 0)
|| (strcmp (argv[i], "--config") == 0))
{
printf ("\n%s%s", WEE_USAGE);
exit (0);
wee_display_config_options ();
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
{
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
printf ("%s", WEE_USAGE2);
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
printf ("\n%s%s", WEE_LICENSE);
exit (0);
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-v") == 0)
|| (strcmp (argv[i], "--version") == 0))
{
printf (PACKAGE_VERSION "\n");
exit (0);
exit (EXIT_SUCCESS);
}
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
{
if (server_init_with_url (argv[i], &server_tmp) < 0)
{
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
WEECHAT_WARNING, argv[i]);
}
else
{
if (!server_new (server_tmp.name, 0, 1,
server_tmp.address, server_tmp.port,
server_tmp.password, server_tmp.nick1,
server_tmp.nick2, server_tmp.nick3,
NULL, NULL, NULL, server_tmp.autojoin))
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
WEECHAT_WARNING, argv[i]);
server_destroy (&server_tmp);
server_cmd_line = 1;
}
}
else
{
@@ -173,48 +281,78 @@ wee_create_dir (char *directory)
void
wee_create_home_dirs ()
{
char *dir_name;
char *ptr_home, *dir_name;
int dir_length;
/* TODO: rewrite this code for Windows version */
ptr_home = getenv ("HOME");
if (!ptr_home)
{
fprintf (stderr, _("%s unable to get HOME directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
dir_length = strlen (ptr_home) + 10;
weechat_home =
(char *) malloc ((strlen (getenv ("HOME")) + 10) * sizeof (char));
sprintf (weechat_home, "%s%s.weechat", getenv ("HOME"), DIR_SEPARATOR);
(char *) malloc (dir_length * sizeof (char));
if (!weechat_home)
{
fprintf (stderr, _("%s not enough memory for home directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
DIR_SEPARATOR);
/* create home directory "~/.weechat" ; error is fatal */
if (!wee_create_dir (weechat_home))
exit (1);
{
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
dir_name = (char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
dir_length = strlen (weechat_home) + 64;
dir_name = (char *) malloc (dir_length * sizeof (char));
#ifdef PLUGIN_PERL
/* create "~/.weechat/perl" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "perl");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"perl");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/perl/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "perl",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "perl", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
#ifdef PLUGIN_PYTHON
/* create "~/.weechat/python" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "python");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"python");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/python/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "python",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "python", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
#ifdef PLUGIN_RUBY
/* create "~/.weechat/ruby" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "ruby");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"ruby");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/ruby/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "ruby",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "ruby", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
free (dir_name);
}
@@ -241,18 +379,17 @@ wee_init_vars ()
void
wee_init_log ()
{
int filename_length;
char *filename;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s/" WEECHAT_LOG_NAME, weechat_home);
(char *) malloc (filename_length * sizeof (char));
snprintf (filename, filename_length, "%s/" WEECHAT_LOG_NAME, weechat_home);
if ((log_file = fopen (filename, "wt")) == NULL)
{
free (filename);
fprintf (stderr,
_("%s unable to create/append to log file (~/.weechat/%s)"),
WEECHAT_ERROR, WEECHAT_LOG_NAME);
}
WEECHAT_WARNING, WEECHAT_LOG_NAME);
free (filename);
}
@@ -307,7 +444,7 @@ wee_shutdown ()
gui_end ();
if (log_file)
fclose (log_file);
exit (0);
exit (EXIT_SUCCESS);
}
/*
@@ -336,25 +473,28 @@ main (int argc, char *argv[])
case 0: /* config file OK */
break;
case -1: /* config file not found */
config_create_default ();
config_read ();
if (config_create_default () < 0)
return EXIT_FAILURE;
if (config_read () != 0)
return EXIT_FAILURE;
break;
default: /* other error (fatal) */
server_free_all ();
return 1;
return EXIT_FAILURE;
}
gui_init (); /* init WeeChat interface */
plugin_init (); /* init plugin interface(s) */
weechat_welcome_message (); /* display WeeChat welcome message */
server_auto_connect (); /* auto-connect to servers */
/* auto-connect to servers */
server_auto_connect (server_cmd_line);
gui_main_loop (); /* WeeChat main loop */
plugin_end (); /* end plugin interface(s) */
server_disconnect_all (); /* disconnect from all servers */
config_write (NULL); /* save config file */
(void) config_write (NULL); /* save config file */
wee_shutdown (); /* quit WeeChat (oh no, why?) */
return 0; /* make gcc happy (never executed) */
return EXIT_SUCCESS; /* make gcc happy (never executed) */
}
+10 -6
View File
@@ -59,7 +59,8 @@
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
" Bounga <bounga@altern.org>\n" \
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
" Xahlexx <xahlexx@tuxisland.org>\n" \
"Website: " WEECHAT_WEBSITE "\n\n" \
"This program is free software; you can redistribute it and/or modify\n" \
"it under the terms of the GNU General Public License as published by\n" \
"the Free Software Foundation; either version 2 of the License, or\n" \
@@ -75,12 +76,15 @@
"along with this program; if not, write to the Free Software\n" \
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
#define WEE_USAGE \
#define WEE_USAGE1 \
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
" Bounga <bounga@altern.org>\n" \
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
" -h, --help this help screen\n", \
"\nDeveloped by FlashCode, Bounga and Xahlexx - " WEECHAT_WEBSITE "\n\n" \
"Usage: %s [options ...]\n" \
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
#define WEE_USAGE2 \
" -c, --config config file help (list of options)\n" \
" -h, --help this help screen\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n\n"
+324 -180
View File
@@ -25,10 +25,14 @@
#endif
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <pwd.h>
#include <sys/types.h>
#include "weechat.h"
#include "weeconfig.h"
@@ -69,70 +73,86 @@ int cfg_look_nickmode;
int cfg_look_nickmode_empty;
char *cfg_look_no_nickname;
char *cfg_look_completor;
int cfg_look_infobar;
char *cfg_look_infobar_timestamp;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
N_("set title for terminal window (curses GUI) with name & version"),
{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"),
N_("set title for window (terminal for Curses GUI) with name & version"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_set_title, NULL, NULL },
NULL, NULL, &cfg_look_set_title, NULL, config_change_title },
{ "look_startup_logo", N_("display WeeChat logo at startup"),
N_("display WeeChat logo at startup"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_startup_logo, NULL, NULL },
NULL, NULL, &cfg_look_startup_logo, NULL, config_change_noop },
{ "look_startup_version", N_("display WeeChat version at startup"),
N_("display WeeChat version at startup"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_startup_version, NULL, NULL },
NULL, NULL, &cfg_look_startup_version, NULL, config_change_noop },
{ "look_weechat_slogan", N_("WeeChat slogan"),
N_("WeeChat slogan (if empty, slogan is not used)"),
OPTION_TYPE_STRING, 0, 0, 0,
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, NULL },
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
{ "look_color_nicks", N_("display nick names with different colors"),
N_("display nick names with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_nicks, NULL, NULL },
NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop },
{ "look_color_actions", N_("display actions with different colors"),
N_("display actions with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_actions, NULL, NULL },
NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop },
{ "look_remove_colors_from_msgs", N_("remove colors from incoming messages"),
N_("remove colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, NULL },
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop },
{ "look_nicklist", N_("display nicklist window"),
N_("display nicklist window (for channel windows)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_nicklist, NULL, NULL },
NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows },
{ "look_nicklist_position", N_("nicklist position"),
N_("nicklist position (top, left, right (default), bottom)"),
OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, NULL },
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows },
{ "look_nicklist_min_size", N_("min size for nicklist"),
N_("min size for nicklist (width or height, depending on look_nicklist_position "
"(0 = no min size))"),
OPTION_TYPE_INT, 0, 100, 0,
NULL, NULL, &cfg_look_nicklist_min_size, NULL, NULL },
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows },
{ "look_nicklist_max_size", N_("max size for nicklist"),
N_("max size for nicklist (width or height, depending on look_nicklist_position "
"(0 = no max size; if min == max and > 0, then size is fixed))"),
OPTION_TYPE_INT, 0, 100, 0,
NULL, NULL, &cfg_look_nicklist_max_size, NULL, NULL },
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows },
{ "look_no_nickname", N_("text to display instead of nick when not connected"),
N_("text to display instead of nick when not connected"),
OPTION_TYPE_STRING, 0, 0, 0,
"-cmd-", NULL, NULL, &cfg_look_no_nickname, NULL },
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content },
{ "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"),
N_("display nick mode ((half)op/voice) before each nick"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_nickmode, NULL, NULL },
NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows },
{ "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"),
N_("display space if nick mode is not (half)op/voice"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_look_nickmode_empty, NULL, NULL },
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows },
{ "look_nick_completor", N_("the string inserted after nick completion"),
N_("the string inserted after nick completion"),
OPTION_TYPE_STRING, 0, 0, 0,
":", NULL, NULL, &cfg_look_completor, NULL },
":", NULL, NULL, &cfg_look_completor, config_change_noop },
{ "look_infobar", N_("enable info bar"),
N_("enable info bar"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_infobar, NULL, config_change_windows },
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
OPTION_TYPE_INT, 0, INT_MAX, 7,
NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -157,6 +177,9 @@ int cfg_col_status_data_msg;
int cfg_col_status_data_other;
int cfg_col_status_more;
int cfg_col_status_bg;
int cfg_col_infobar;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg;
int cfg_col_input;
int cfg_col_input_channel;
int cfg_col_input_nick;
@@ -175,135 +198,149 @@ t_config_option weechat_options_colors[] =
{ "col_title", N_("color for title bar"),
N_("color for title bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_title, NULL, NULL },
"gray", NULL, &cfg_col_title, NULL, &config_change_color },
{ "col_title_bg", N_("background for title bar"),
N_("background for title bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_title_bg, NULL, NULL },
"blue", NULL, &cfg_col_title_bg, NULL, &config_change_color },
/* chat window */
{ "col_chat", N_("color for chat text"),
N_("color for chat text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_chat, NULL, NULL },
"gray", NULL, &cfg_col_chat, NULL, &config_change_color },
{ "col_chat_time", N_("color for time"),
N_("color for time in chat window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_chat_time, NULL, NULL },
"gray", NULL, &cfg_col_chat_time, NULL, &config_change_color },
{ "col_chat_time_sep", N_("color for time separator"),
N_("color for time separator (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"brown", NULL, &cfg_col_chat_time_sep, NULL, NULL },
"brown", NULL, &cfg_col_chat_time_sep, NULL, &config_change_color },
{ "col_chat_prefix1", N_("color for 1st and 3rd char of prefix"),
N_("color for 1st and 3rd char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightcyan", NULL, &cfg_col_chat_prefix1, NULL, NULL },
"lightcyan", NULL, &cfg_col_chat_prefix1, NULL, &config_change_color },
{ "col_chat_prefix2", N_("color for middle char of prefix"),
N_("color for middle char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_prefix2, NULL, NULL },
"white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color },
{ "col_chat_nick", N_("color for nicks in actions"),
N_("color for nicks in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightcyan", NULL, &cfg_col_chat_nick, NULL, NULL },
"lightcyan", NULL, &cfg_col_chat_nick, NULL, &config_change_color },
{ "col_chat_host", N_("color for hostnames"),
N_("color for hostnames (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"cyan", NULL, &cfg_col_chat_host, NULL, NULL },
"cyan", NULL, &cfg_col_chat_host, NULL, &config_change_color },
{ "col_chat_channel", N_("color for channel names in actions"),
N_("color for channel names in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_channel, NULL, NULL },
"white", NULL, &cfg_col_chat_channel, NULL, &config_change_color },
{ "col_chat_dark", N_("color for dark separators"),
N_("color for dark separators (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"green", NULL, &cfg_col_chat_dark, NULL, NULL },
"green", NULL, &cfg_col_chat_dark, NULL, &config_change_color },
{ "col_chat_highlight", N_("color for highlighted nick"),
N_("color for highlighted nick (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_chat_highlight, NULL, NULL },
"yellow", NULL, &cfg_col_chat_highlight, NULL, &config_change_color },
{ "col_chat_bg", N_("background for chat"),
N_("background for chat window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_chat_bg, NULL, NULL },
"default", NULL, &cfg_col_chat_bg, NULL, &config_change_color },
/* status window */
{ "col_status", N_("color for status bar"),
N_("color for status bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_status, NULL, NULL },
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
{ "col_status_active", N_("color for active window"),
N_("color for active window (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_status_active, NULL, NULL },
"yellow", NULL, &cfg_col_status_active, NULL, &config_change_color },
{ "col_status_data_msg", N_("color for window with new messages"),
N_("color for window with new messages (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightred", NULL, &cfg_col_status_data_msg, NULL, NULL },
"lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
{ "col_status_data_other", N_("color for window with new data (not messages)"),
N_("color for window with new data (not messages) (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, NULL },
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
{ "col_status_more", N_("color for \"*MORE*\" text"),
N_("color for window with new data (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_status_more, NULL, NULL },
"white", NULL, &cfg_col_status_more, NULL, &config_change_color },
{ "col_status_bg", N_("background for status window"),
N_("background for status window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_status_bg, NULL, NULL },
"blue", NULL, &cfg_col_status_bg, NULL, &config_change_color },
/* infobar window */
{ "col_infobar", N_("color for info bar text"),
N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, &config_change_color },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_infobar_highlight, NULL, &config_change_color },
{ "col_infobar_bg", N_("background for info bar window"),
N_("background for info bar window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"cyan", NULL, &cfg_col_infobar_bg, NULL, &config_change_color },
/* input window */
{ "col_input", N_("color for input text"),
N_("color for input text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_input, NULL, NULL },
"gray", NULL, &cfg_col_input, NULL, &config_change_color },
{ "col_input_channel", N_("color for input text (channel name)"),
N_("color for input text (channel name)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_input_channel, NULL, NULL },
"white", NULL, &cfg_col_input_channel, NULL, &config_change_color },
{ "col_input_nick", N_("color for input text (nick name)"),
N_("color for input text (nick name)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_input_nick, NULL, NULL },
"lightgreen", NULL, &cfg_col_input_nick, NULL, &config_change_color },
{ "col_input_bg", N_("background for input window"),
N_("background for input window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_input_bg, NULL, NULL },
"default", NULL, &cfg_col_input_bg, NULL, &config_change_color },
/* nick window */
{ "col_nick", N_("color for nicknames"),
N_("color for nicknames"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_nick, NULL, NULL },
"gray", NULL, &cfg_col_nick, NULL, &config_change_color },
{ "col_nick_op", N_("color for operator symbol"),
N_("color for operator symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_nick_op, NULL, NULL },
"lightgreen", NULL, &cfg_col_nick_op, NULL, &config_change_color },
{ "col_nick_halfop", N_("color for half-operator symbol"),
N_("color for half-operator symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_nick_halfop, NULL, NULL },
"lightmagenta", NULL, &cfg_col_nick_halfop, NULL, &config_change_color },
{ "col_nick_voice", N_("color for voice symbol"),
N_("color for voice symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_nick_voice, NULL, NULL },
"yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color },
{ "col_nick_sep", N_("color for nick separator"),
N_("color for nick separator"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_nick_sep, NULL, NULL },
"blue", NULL, &cfg_col_nick_sep, NULL, &config_change_color },
{ "col_nick_self", N_("color for local nick"),
N_("color for local nick"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_nick_self, NULL, NULL },
"white", NULL, &cfg_col_nick_self, NULL, &config_change_color },
{ "col_nick_private", N_("color for other nick in private window"),
N_("color for other nick in private window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_nick_private, NULL, NULL },
"gray", NULL, &cfg_col_nick_private, NULL, &config_change_color },
{ "col_nick_bg", N_("background for nicknames"),
N_("background for nicknames"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_nick_bg, NULL, NULL },
"default", NULL, &cfg_col_nick_bg, NULL, &config_change_color },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -401,8 +438,8 @@ t_config_option weechat_options_dcc[] =
NULL, NULL, &cfg_dcc_timeout, NULL, NULL },
{ "dcc_download_path", N_("path for incoming files with dcc"),
N_("path for writing incoming files with dcc (default: user home)"),
OPTION_TYPE_STRING, 0, 0, 0, "~",
NULL, NULL, &cfg_dcc_download_path, NULL },
OPTION_TYPE_STRING, 0, 0, 0,
"~", NULL, NULL, &cfg_dcc_download_path, NULL },
{ "dcc_upload_path", N_("default path for sending files with dcc"),
N_("path for reading files when sending thru dcc (when no path is specified)"),
OPTION_TYPE_STRING, 0, 0, 0, "~",
@@ -531,6 +568,83 @@ get_pos_array_values (char **array, char *string)
return -1;
}
/*
* config_get_section: get section name from option pointer
*/
char *
config_get_section (t_config_option *ptr_option)
{
int i, j;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
/* if option found, return pointer to section name */
if (ptr_option == &weechat_options[i][j])
return config_sections[i].section_name;
}
}
}
/* option not found */
return NULL;
}
/*
* config_change_noop: called when an option is changed by /set command
* and that no special action is needed after that
*/
void
config_change_noop ()
{
/* do nothing */
}
/*
* config_change_title: called when title is changed
*/
void
config_change_title ()
{
gui_set_window_title ();
}
/*
* config_change_windows: called when windows change (for example nicklist)
*/
void
config_change_windows ()
{
gui_switch_to_window (gui_current_window);
gui_redraw_window (gui_current_window);
}
/*
* config_change_window_content: called when content of a window changes
*/
void
config_change_window_content ()
{
gui_redraw_window (gui_current_window);
}
/*
* config_change_color: called when a color is changed by /set command
*/
void
config_change_color()
{
gui_init_colors ();
}
/*
* config_option_set_value: set new value for an option
* return: 0 if success
@@ -578,14 +692,12 @@ config_option_set_value (t_config_option *option, char *value)
}
/*
* config_set_value: set new value for an option (found by name)
* return: 0 if success
* -1 if bad value for option
* -2 if option is not found
* config_option_search: look for an option and return pointer to this option
* if option is not found, NULL is returned
*/
int
config_set_value (char *option_name, char *value)
t_config_option *
config_option_search (char *option_name)
{
int i, j;
@@ -595,14 +707,33 @@ config_set_value (char *option_name, char *value)
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
/* if option found, assign value and exit */
/* if option found, return pointer */
if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0)
return config_option_set_value (&weechat_options[i][j], value);
return &weechat_options[i][j];
}
}
}
/* option not found */
return -2;
return NULL;
}
/*
* config_set_value: set new value for an option (found by name)
* return: 0 if success
* -1 if bad value for option
* -2 if option is not found
*/
int
config_set_value (char *option_name, char *value)
{
t_config_option *ptr_option;
ptr_option = config_option_search (option_name);
if (ptr_option)
return config_option_set_value (ptr_option, value);
else
return -2;
}
/*
@@ -637,7 +768,7 @@ config_allocate_server (char *filename, int line_number)
return 0;
}
if (!server_new (cfg_server.name,
cfg_server.autoconnect, cfg_server.address, cfg_server.port,
cfg_server.autoconnect, 0, cfg_server.address, cfg_server.port,
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
cfg_server.nick3, cfg_server.username, cfg_server.realname,
cfg_server.command, cfg_server.autojoin))
@@ -717,15 +848,20 @@ config_default_values ()
int
config_read ()
{
int filename_length;
char *filename;
FILE *file;
int section, line_number, i, option_number;
int server_found;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "rt")) == NULL)
{
gui_printf (NULL, _("%s config file \"%s\" not found.\n"),
@@ -902,21 +1038,6 @@ config_read ()
}
}
/* set default colors for colors not set */
/*for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if (i != CONFIG_SECTION_SERVER)
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((weechat_options[i][j].option_type == OPTION_TYPE_COLOR) &&
(*weechat_options[i][j].ptr_int == COLOR_NOT_SET))
*weechat_options[i][j].ptr_int =
gui_get_color_by_name (weechat_options[i][j].default_string);
}
}
}*/
fclose (file);
free (filename);
@@ -933,15 +1054,21 @@ config_read ()
int
config_create_default ()
{
int filename_length;
char *filename;
char line[1024];
FILE *file;
int i, j;
time_t current_time;
struct passwd *my_passwd;
char *realname, *pos;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "wt")) == NULL)
{
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
@@ -954,96 +1081,126 @@ config_create_default ()
wee_log_printf (_("creating default config file\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fputs (line, file);
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
fputs (line, file);
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
{
sprintf (line,
fprintf (file,
"# WARNING!!! Options for section \"%s\" are not developed!\n",
config_sections[i].section_name);
fputs (line, file);
}
for (j = 0; weechat_options[i][j].option_name; j++)
{
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].default_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
sprintf (line, "%s=%d\n",
fprintf (file, "%s=%d\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
case OPTION_TYPE_COLOR:
case OPTION_TYPE_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_string);
break;
}
fputs (line, file);
}
}
}
/* default aliases */
/* TODO: remove comments when missing commands will be ok */
fputs ("\n[alias]\n", file);
fputs ("SAY=msg *\n", file);
fputs ("BYE=quit\n", file);
fputs ("EXIT=quit\n", file);
fputs ("SIGNOFF=quit\n", file);
fputs ("C=clear\n", file);
fputs ("CL=clear\n", file);
fputs ("# CHAT=dcc chat\n", file);
fputs ("# GET=dcc get\n", file);
fputs ("# IG=ignore\n", file);
fputs ("J=join\n", file);
fputs ("K=kick\n", file);
fputs ("# KB=kickban\n", file);
fputs ("# KN=knockout\n", file);
fputs ("LEAVE=part\n", file);
fputs ("M=msg\n", file);
fputs ("# MUB=unban *\n", file);
fputs ("N=names\n", file);
fputs ("T=topic\n", file);
fputs ("# UB=unban\n", file);
fputs ("# UNIG=unignore\n", file);
fputs ("# W=who\n", file);
fputs ("WC=part\n", file);
fputs ("WI=whois\n", file);
fputs ("# WW=whowas\n", file);
fprintf (file, "\n[alias]\n");
fprintf (file, "SAY=msg *\n");
fprintf (file, "BYE=quit\n");
fprintf (file, "EXIT=quit\n");
fprintf (file, "SIGNOFF=quit\n");
fprintf (file, "C=clear\n");
fprintf (file, "CL=clear\n");
fprintf (file, "# CHAT=dcc chat\n");
fprintf (file, "# GET=dcc get\n");
fprintf (file, "# IG=ignore\n");
fprintf (file, "J=join\n");
fprintf (file, "K=kick\n");
fprintf (file, "# KB=kickban\n");
fprintf (file, "# KN=knockout\n");
fprintf (file, "LEAVE=part\n");
fprintf (file, "M=msg\n");
fprintf (file, "# MUB=unban *\n");
fprintf (file, "N=names\n");
fprintf (file, "Q=query\n");
fprintf (file, "T=topic\n");
fprintf (file, "# UB=unban\n");
fprintf (file, "# UNIG=unignore\n");
fprintf (file, "W=who\n");
fprintf (file, "WC=part\n");
fprintf (file, "WI=whois\n");
fprintf (file, "WW=whowas\n");
/* default server is freenode */
fputs ("\n[server]\n", file);
fputs ("server_name=freenode\n", file);
fputs ("server_autoconnect=on\n", file);
fputs ("server_address=irc.freenode.net\n", file);
fputs ("server_port=6667\n", file);
fputs ("server_password=\n", file);
fputs ("server_nick1=weechat_user\n", file);
fputs ("server_nick2=weechat2\n", file);
fputs ("server_nick3=weechat3\n", file);
fputs ("server_username=weechat\n", file);
fputs ("server_realname=WeeChat default realname\n", file);
fputs ("server_command=\n", file);
fputs ("server_autojoin=\n", file);
fprintf (file, "\n[server]\n");
fprintf (file, "server_name=freenode\n");
fprintf (file, "server_autoconnect=on\n");
fprintf (file, "server_address=irc.freenode.net\n");
fprintf (file, "server_port=6667\n");
fprintf (file, "server_password=\n");
/* Get the user's name from /etc/passwd */
if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
fprintf (file, "server_nick1=%s\n", my_passwd->pw_name);
fprintf (file, "server_nick2=%s1\n", my_passwd->pw_name);
fprintf (file, "server_nick3=%s2\n", my_passwd->pw_name);
fprintf (file, "server_username=%s\n", my_passwd->pw_name);
if ((!my_passwd->pw_gecos)
|| (my_passwd->pw_gecos[0] == '\0')
|| (my_passwd->pw_gecos[0] == ',')
|| (my_passwd->pw_gecos[0] == ' '))
fprintf (file, "server_realname=%s\n", my_passwd->pw_name);
else
{
realname = strdup (my_passwd->pw_gecos);
pos = strchr (realname, ',');
if (pos)
pos[0] = '\0';
fprintf (file, "server_realname=%s\n",
realname);
if (pos)
pos[0] = ',';
free (realname);
}
}
else
{
/* default values if /etc/passwd can't be read */
fprintf (stderr, "%s: %s (%s).",
WEECHAT_WARNING,
_("Unable to get user's name"),
strerror (errno));
fprintf (file, "server_nick1=weechat1\n");
fprintf (file, "server_nick2=weechat2\n");
fprintf (file, "server_nick3=weechat3\n");
fprintf (file, "server_username=weechat\n");
fprintf (file, "server_realname=WeeChat default realname\n");
}
fprintf (file, "server_command=\n");
fprintf (file, "server_autojoin=\n");
fclose (file);
free (filename);
@@ -1059,8 +1216,8 @@ config_create_default ()
int
config_write (char *config_name)
{
int filename_length;
char *filename;
char line[1024];
FILE *file;
int i, j;
time_t current_time;
@@ -1071,9 +1228,13 @@ config_write (char *config_name)
filename = strdup (config_name);
else
{
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
}
if ((file = fopen (filename, "wt")) == NULL)
@@ -1087,115 +1248,98 @@ config_write (char *config_name)
wee_log_printf (_("saving config to disk\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fputs (line, file);
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
fputs (line, file);
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
{
sprintf (line,
fprintf (file,
"# WARNING!!! Options for section \"%s\" are not developed!\n",
config_sections[i].section_name);
fputs (line, file);
}
for (j = 0; weechat_options[i][j].option_name; j++)
{
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int &&
*weechat_options[i][j].ptr_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
sprintf (line, "%s=%d\n",
fprintf (file, "%s=%d\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
*weechat_options[i][j].ptr_int :
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
break;
case OPTION_TYPE_COLOR:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
gui_get_color_by_value (*weechat_options[i][j].ptr_int) :
weechat_options[i][j].default_string);
break;
case OPTION_TYPE_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_string) ?
*weechat_options[i][j].ptr_string :
weechat_options[i][j].default_string);
break;
}
fputs (line, file);
}
}
}
/* alias section */
fputs ("\n[alias]\n", file);
fprintf (file, "\n[alias]\n");
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
ptr_alias->alias_name, ptr_alias->alias_command + 1);
fputs (line, file);
}
/* server section */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
/* default server is freenode */
fputs ("\n[server]\n", file);
sprintf (line, "server_name=%s\n", ptr_server->name);
fputs (line, file);
sprintf (line, "server_autoconnect=%s\n",
(ptr_server->autoconnect) ? "on" : "off");
fputs (line, file);
sprintf (line, "server_address=%s\n", ptr_server->address);
fputs (line, file);
sprintf (line, "server_port=%d\n", ptr_server->port);
fputs (line, file);
sprintf (line, "server_password=%s\n",
(ptr_server->password) ? ptr_server->password : "");
fputs (line, file);
sprintf (line, "server_nick1=%s\n", ptr_server->nick1);
fputs (line, file);
sprintf (line, "server_nick2=%s\n", ptr_server->nick2);
fputs (line, file);
sprintf (line, "server_nick3=%s\n", ptr_server->nick3);
fputs (line, file);
sprintf (line, "server_username=%s\n", ptr_server->username);
fputs (line, file);
sprintf (line, "server_realname=%s\n", ptr_server->realname);
fputs (line, file);
sprintf (line, "server_command=%s\n",
(ptr_server->command) ? ptr_server->command : "");
fputs (line, file);
sprintf (line, "server_autojoin=%s\n",
(ptr_server->autojoin) ? ptr_server->autojoin : "");
fputs (line, file);
if (!ptr_server->command_line)
{
fprintf (file, "\n[server]\n");
fprintf (file, "server_name=%s\n", ptr_server->name);
fprintf (file, "server_autoconnect=%s\n",
(ptr_server->autoconnect) ? "on" : "off");
fprintf (file, "server_address=%s\n", ptr_server->address);
fprintf (file, "server_port=%d\n", ptr_server->port);
fprintf (file, "server_password=%s\n",
(ptr_server->password) ? ptr_server->password : "");
fprintf (file, "server_nick1=%s\n", ptr_server->nick1);
fprintf (file, "server_nick2=%s\n", ptr_server->nick2);
fprintf (file, "server_nick3=%s\n", ptr_server->nick3);
fprintf (file, "server_username=%s\n", ptr_server->username);
fprintf (file, "server_realname=%s\n", ptr_server->realname);
fprintf (file, "server_command=%s\n",
(ptr_server->command) ? ptr_server->command : "");
fprintf (file, "server_autojoin=%s\n",
(ptr_server->autojoin) ? ptr_server->autojoin : "");
}
}
fclose (file);
+16 -1
View File
@@ -70,7 +70,7 @@ struct t_config_option
char **array_values;
int *ptr_int;
char **ptr_string;
int (*handler_change)(int *, char **);
void (*handler_change)();
};
extern int cfg_look_set_title;
@@ -88,6 +88,9 @@ extern int cfg_look_nickmode;
extern int cfg_look_nickmode_empty;
extern char *cfg_look_no_nickname;
extern char *cfg_look_completor;
extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title;
extern int cfg_col_title_bg;
@@ -108,6 +111,9 @@ extern int cfg_col_status_data_msg;
extern int cfg_col_status_data_other;
extern int cfg_col_status_more;
extern int cfg_col_status_bg;
extern int cfg_col_infobar;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg;
extern int cfg_col_input;
extern int cfg_col_input_channel;
extern int cfg_col_input_nick;
@@ -149,6 +155,15 @@ extern char *cfg_proxy_password;
extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS];
extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
extern char *config_get_section ();
extern void config_change_noop ();
extern void config_change_title ();
extern void config_change_windows ();
extern void config_change_window_content ();
extern void config_change_color ();
extern int config_option_set_value (t_config_option *, char *);
extern t_config_option *config_option_search (char *);
extern int config_set_value (char *, char *);
extern int config_read ();
extern int config_create_default ();
extern int config_write ();
+2
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
+271 -69
View File
@@ -159,7 +159,7 @@ gui_window_set_color (WINDOW *window, int num_color)
int
gui_window_has_nicklist (t_gui_window *window)
{
return (window->win_nick != NULL);
return ((window->win_nick != NULL) ? 1 : 0);
}
@@ -182,7 +182,7 @@ gui_calculate_pos_size (t_gui_window *window)
/* init chat & nicklist settings */
/* TODO: calculate values from function parameters */
if (WIN_IS_CHANNEL(window))
if (cfg_look_nicklist && WIN_IS_CHANNEL(window))
{
max_length = nick_get_max_length (CHANNEL(window));
@@ -192,21 +192,37 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = max_length + 2;
window->win_chat_y = 1;
window->win_chat_width = COLS - max_length - 2;
window->win_chat_height = LINES - 3;
window->win_nick_x = 0;
window->win_nick_y = 1;
window->win_nick_width = max_length + 2;
window->win_nick_height = LINES - 3;
if (cfg_look_infobar)
{
window->win_chat_height = LINES - 4;
window->win_nick_height = LINES - 4;
}
else
{
window->win_chat_height = LINES - 3;
window->win_nick_height = LINES - 3;
}
break;
case CFG_LOOK_NICKLIST_RIGHT:
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS - max_length - 2;
window->win_chat_height = LINES - 3;
window->win_nick_x = COLS - max_length - 2;
window->win_nick_y = 1;
window->win_nick_width = max_length + 2;
window->win_nick_height = LINES - 3;
if (cfg_look_infobar)
{
window->win_chat_height = LINES - 4;
window->win_nick_height = LINES - 4;
}
else
{
window->win_chat_height = LINES - 3;
window->win_nick_height = LINES - 3;
}
break;
case CFG_LOOK_NICKLIST_TOP:
nick_count (CHANNEL(window), &num_nicks, &num_op, &num_halfop,
@@ -218,7 +234,10 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1 + (lines + 1);
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3 - (lines + 1);
if (cfg_look_infobar)
window->win_chat_height = LINES - 3 - (lines + 1) - 1;
else
window->win_chat_height = LINES - 3 - (lines + 1);
window->win_nick_x = 0;
window->win_nick_y = 1;
window->win_nick_width = COLS;
@@ -234,9 +253,15 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3 - (lines + 1);
if (cfg_look_infobar)
window->win_chat_height = LINES - 3 - (lines + 1) - 1;
else
window->win_chat_height = LINES - 3 - (lines + 1);
window->win_nick_x = 0;
window->win_nick_y = LINES - 2 - (lines + 1);
if (cfg_look_infobar)
window->win_nick_y = LINES - 2 - (lines + 1) - 1;
else
window->win_nick_y = LINES - 2 - (lines + 1);
window->win_nick_width = COLS;
window->win_nick_height = lines + 1;
break;
@@ -250,7 +275,10 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3;
if (cfg_look_infobar)
window->win_chat_height = LINES - 4;
else
window->win_chat_height = LINES - 3;
window->win_chat_cursor_x = 0;
window->win_chat_cursor_y = 0;
window->win_nick_x = -1;
@@ -269,7 +297,6 @@ gui_curses_window_clear (WINDOW *window)
{
werase (window);
wmove (window, 0, 0);
//wrefresh (window);
}
/*
@@ -294,7 +321,7 @@ gui_draw_window_title (t_gui_window *window)
}
if (CHANNEL(window))
{
sprintf (format, "%%-%ds", window->win_width);
snprintf (format, 32, "%%-%ds", window->win_width);
if (CHANNEL(window)->topic)
mvwprintw (window->win_title, 0, 0, format,
CHANNEL(window)->topic);
@@ -361,9 +388,9 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
{
int lines_displayed, num_lines, offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32];
char saved_char, format_align[32], format_empty[32];
sprintf (format_align, "%%-%ds", line->length_align);
snprintf (format_align, 32, "%%-%ds", line->length_align);
num_lines = gui_get_line_num_splits (window, line);
ptr_message = line->messages;
offset = 0;
@@ -419,7 +446,11 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
if (lines_displayed >= num_lines - count)
{
if (window->win_chat_cursor_x <= window->win_chat_width - 1)
wclrtoeol (window->win_chat);
{
snprintf (format_empty, 32, "%%-%ds",
window->win_chat_width - window->win_chat_cursor_x);
wprintw (window->win_chat, format_empty, " ");
}
window->win_chat_cursor_y++;
}
window->win_chat_cursor_x = 0;
@@ -441,9 +472,9 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
{
int offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32];
char saved_char, format_align[32], format_empty[32];
sprintf (format_align, "%%-%ds", line->length_align);
snprintf (format_align, 32, "%%-%ds", line->length_align);
ptr_message = line->messages;
offset = 0;
while (ptr_message)
@@ -512,7 +543,11 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
(window->win_chat_cursor_x > window->win_chat_width - 1)))
{
if (window->win_chat_cursor_x <= window->win_chat_width - 1)
wclrtoeol (window->win_chat);
{
snprintf (format_empty, 32, "%%-%ds",
window->win_chat_width - window->win_chat_cursor_x);
wprintw (window->win_chat, format_empty, " ");
}
window->win_chat_cursor_y++;
}
window->win_chat_cursor_x = 0;
@@ -536,11 +571,7 @@ gui_draw_window_chat (t_gui_window *window)
return;
if (has_colors ())
{
gui_window_set_color (window->win_chat, COLOR_WIN_CHAT);
wborder (window->win_chat, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_chat);
}
ptr_line = window->last_line;
lines_used = 0;
@@ -596,11 +627,22 @@ gui_draw_window_chat (t_gui_window *window)
void
gui_redraw_window_chat (t_gui_window *window)
{
char format_empty[32];
int i;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_chat);
if (has_colors ())
gui_window_set_color (window->win_chat, COLOR_WIN_CHAT);
snprintf (format_empty, 32, "%%-%ds", window->win_chat_width);
for (i = 0; i < window->win_chat_height; i++)
{
mvwprintw (window->win_chat, i, 0, format_empty, " ");
}
gui_draw_window_chat (window);
}
@@ -612,7 +654,7 @@ void
gui_draw_window_nick (t_gui_window *window)
{
int i, x, y, column, max_length;
char format[32];
char format[32], format_empty[32];
t_irc_nick *ptr_nick;
/* TODO: manage splitted windows! */
@@ -636,9 +678,18 @@ gui_draw_window_nick (t_gui_window *window)
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
gui_draw_window_chat (window);
gui_redraw_window_chat (window);
if (has_colors ())
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
for (i = 0; i < window->win_nick_height; i++)
{
mvwprintw (window->win_nick, i, 0, format_empty, " ");
}
}
sprintf (format, "%%-%ds", max_length);
snprintf (format, 32, "%%-%ds", max_length);
if (has_colors ())
{
@@ -747,11 +798,22 @@ gui_draw_window_nick (t_gui_window *window)
void
gui_redraw_window_nick (t_gui_window *window)
{
char format_empty[32];
int i;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_nick);
if (has_colors ())
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
for (i = 0; i < window->win_nick_height; i++)
{
mvwprintw (window->win_nick, i, 0, format_empty, " ");
}
gui_draw_window_nick (window);
}
@@ -764,6 +826,7 @@ gui_draw_window_status (t_gui_window *window)
{
t_gui_window *ptr_win;
char format_more[32];
int i, first_mode;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
@@ -775,7 +838,6 @@ gui_draw_window_status (t_gui_window *window)
wborder (window->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_status);
}
//refresh ();
wmove (window->win_status, 0, 0);
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -853,7 +915,36 @@ gui_draw_window_status (t_gui_window *window)
gui_window_set_color (window->win_status,
COLOR_WIN_STATUS);
}
wprintw (window->win_status, "%s ", CHANNEL(ptr_win)->name);
wprintw (window->win_status, "%s", CHANNEL(ptr_win)->name);
if (gui_current_window == CHANNEL(ptr_win)->window)
{
/* display channel modes */
wprintw (window->win_status, "(");
i = 0;
first_mode = 1;
while (CHANNEL(ptr_win)->modes[i])
{
if (CHANNEL(ptr_win)->modes[i] != ' ')
{
if (first_mode)
{
wprintw (window->win_status, "+");
first_mode = 0;
}
wprintw (window->win_status, "%c",
CHANNEL(ptr_win)->modes[i]);
}
i++;
}
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_KEY] != ' ')
wprintw (window->win_status, ",%s",
CHANNEL(ptr_win)->key);
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_LIMIT] != ' ')
wprintw (window->win_status, ",%d",
CHANNEL(ptr_win)->limit);
wprintw (window->win_status, ")");
}
wprintw (window->win_status, " ");
}
if (!SERVER(ptr_win))
{
@@ -862,13 +953,13 @@ gui_draw_window_status (t_gui_window *window)
}
}
/* display "*MORE*" if last line is not displayed */
/* display "-MORE-" if last line is not displayed */
gui_window_set_color (window->win_status, COLOR_WIN_STATUS_MORE);
if (window->sub_lines > 0)
mvwprintw (window->win_status, 0, COLS - 7, _("-MORE-"));
else
{
sprintf (format_more, "%%-%ds", strlen (_("-MORE-")));
snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
mvwprintw (window->win_status, 0, COLS - 7, format_more, " ");
}
@@ -891,6 +982,62 @@ gui_redraw_window_status (t_gui_window *window)
gui_draw_window_status (window);
}
/*
* gui_draw_window_infobar: draw infobar window
*/
void
gui_draw_window_infobar (t_gui_window *window)
{
time_t time_seconds;
struct tm *local_time;
char text[1024 + 1];
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
if (has_colors ())
{
gui_window_set_color (window->win_infobar, COLOR_WIN_INFOBAR);
wborder (window->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_infobar);
}
wmove (window->win_infobar, 0, 0);
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
if (local_time)
{
strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
gui_window_set_color (window->win_infobar, COLOR_WIN_INFOBAR);
wprintw (window->win_infobar, "%s", text);
}
if (gui_infobar)
{
gui_window_set_color (window->win_infobar, gui_infobar->color);
wprintw (window->win_infobar, " | %s", gui_infobar->text);
}
wrefresh (window->win_infobar);
refresh ();
}
/*
* gui_redraw_window_infobar: redraw infobar window
*/
void
gui_redraw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_infobar);
gui_draw_window_infobar (window);
}
/*
* gui_get_input_width: return input width (max # chars displayed)
*/
@@ -931,7 +1078,6 @@ gui_draw_window_input (t_gui_window *window)
wborder (window->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_input);
}
//refresh ();
if (window->input_buffer_size == 0)
window->input_buffer[0] = '\0';
@@ -961,7 +1107,7 @@ gui_draw_window_input (t_gui_window *window)
}
if (CHANNEL(window))
{
sprintf (format, "%%s %%s> %%-%ds", input_width);
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
mvwprintw (window->win_input, 0, 0, format,
CHANNEL(window)->name,
SERVER(window)->nick,
@@ -975,7 +1121,7 @@ gui_draw_window_input (t_gui_window *window)
{
if (SERVER(window))
{
sprintf (format, "%%s> %%-%ds", input_width);
snprintf (format, 32, "%%s> %%-%ds", input_width);
if (SERVER(window) && (SERVER(window)->is_connected))
ptr_nickname = SERVER(window)->nick;
else
@@ -989,7 +1135,7 @@ gui_draw_window_input (t_gui_window *window)
}
else
{
sprintf (format, "%%s> %%-%ds", input_width);
snprintf (format, 32, "%%s> %%-%ds", input_width);
if (SERVER(window) && (SERVER(window)->is_connected))
ptr_nickname = SERVER(window)->nick;
else
@@ -1038,6 +1184,8 @@ gui_redraw_window (t_gui_window *window)
if (window->win_nick)
gui_redraw_window_nick (window);
gui_redraw_window_status (window);
if (cfg_look_infobar)
gui_redraw_window_infobar (window);
gui_redraw_window_input (window);
}
@@ -1062,13 +1210,18 @@ gui_switch_to_window (t_gui_window *window)
window->win_chat = ptr_win->win_chat;
window->win_nick = ptr_win->win_nick;
window->win_status = ptr_win->win_status;
window->win_infobar = ptr_win->win_infobar;
window->win_input = ptr_win->win_input;
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
if (ptr_win != window)
{
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_infobar = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
}
break;
}
}
@@ -1084,40 +1237,52 @@ gui_switch_to_window (t_gui_window *window)
window->win_chat_width,
window->win_chat_y,
window->win_chat_x);
if (CHANNEL(window))
if (cfg_look_nicklist && CHANNEL(window))
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
else
window->win_nick = NULL;
window->win_status = newwin (1, COLS, LINES - 2, 0);
window->win_input = newwin (1, COLS, LINES - 1, 0);
}
else
{
/* create chat & nick windows */
/* remove some windows */
if (window->win_nick)
{
delwin (window->win_nick);
window->win_nick = NULL;
}
if (window->win_status)
{
delwin (window->win_status);
window->win_status = NULL;
}
if (window->win_infobar)
{
delwin (window->win_infobar);
window->win_infobar = NULL;
}
/* create windows */
if (WIN_IS_CHANNEL(window))
{
/* (re)create nicklist window */
if (window->win_nick)
delwin (window->win_nick);
delwin (window->win_chat);
window->win_chat = newwin (window->win_chat_height,
window->win_chat_width,
window->win_chat_y,
window->win_chat_x);
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
if (cfg_look_nicklist)
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
else
window->win_nick = NULL;
}
if (!(WIN_IS_CHANNEL(window)))
{
/* remove nick list window */
if (window->win_nick)
delwin (window->win_nick);
window->win_nick = NULL;
delwin (window->win_chat);
window->win_chat = newwin (window->win_chat_height,
window->win_chat_width,
@@ -1126,6 +1291,15 @@ gui_switch_to_window (t_gui_window *window)
}
}
/* create status/infobar windows */
if (cfg_look_infobar)
{
window->win_infobar = newwin (1, COLS, LINES - 2, 0);
window->win_status = newwin (1, COLS, LINES - 3, 0);
}
else
window->win_status = newwin (1, COLS, LINES - 2, 0);
/* change current window to the new window */
gui_current_window = window;
@@ -1179,8 +1353,8 @@ gui_move_page_up ()
if (!gui_current_window->first_line_displayed)
{
gui_current_window->sub_lines += gui_current_window->win_chat_height - 1;
gui_redraw_window_chat (gui_current_window);
gui_redraw_window_status (gui_current_window);
gui_draw_window_chat (gui_current_window);
gui_draw_window_status (gui_current_window);
}
}
@@ -1198,8 +1372,8 @@ gui_move_page_down ()
gui_current_window->sub_lines = 0;
if (gui_current_window->sub_lines == 0)
gui_current_window->unread_data = 0;
gui_redraw_window_chat (gui_current_window);
gui_redraw_window_status (gui_current_window);
gui_draw_window_chat (gui_current_window);
gui_draw_window_status (gui_current_window);
}
}
@@ -1232,12 +1406,15 @@ gui_curses_resize_handler ()
delwin (ptr_win->win_nick);
if (ptr_win->win_status)
delwin (ptr_win->win_status);
if (ptr_win->win_infobar)
delwin (ptr_win->win_infobar);
if (ptr_win->win_input)
delwin (ptr_win->win_input);
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_infobar = NULL;
ptr_win->win_input = NULL;
gui_switch_to_window (ptr_win);
}
@@ -1255,6 +1432,7 @@ gui_window_init_subwindows (t_gui_window *window)
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_infobar = NULL;
window->win_input = NULL;
}
@@ -1316,6 +1494,10 @@ gui_init_colors ()
cfg_col_status_data_other & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_MORE,
cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT,
cfg_col_input & A_CHARTEXT, cfg_col_input_bg);
init_pair (COLOR_WIN_INPUT_CHANNEL,
@@ -1362,6 +1544,8 @@ gui_init_colors ()
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & 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;
@@ -1375,6 +1559,20 @@ gui_init_colors ()
}
}
/*
* gui_set_window_title: set terminal title
*/
void
gui_set_window_title ()
{
#ifdef __linux__
/* set title for term window, not for console */
if (strcmp (getenv ("TERM"), "linux") != 0)
printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a");
#endif
}
/*
* gui_init: init GUI
*/
@@ -1392,16 +1590,15 @@ gui_init ()
gui_init_colors ();
gui_infobar = NULL;
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
#ifdef __linux__
/* set title for term window, not for console */
if (cfg_look_set_title && (strcmp (getenv ("TERM"), "linux") != 0))
printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a");
#endif
if (cfg_look_set_title)
gui_set_window_title ();
gui_ready = 1;
}
@@ -1426,6 +1623,8 @@ gui_end ()
delwin (ptr_win->win_nick);
if (ptr_win->win_status)
delwin (ptr_win->win_status);
if (ptr_win->win_infobar)
delwin (ptr_win->win_infobar);
if (ptr_win->win_input)
delwin (ptr_win->win_input);
/* TODO: free input buffer, lines, messages, completion */
@@ -1485,8 +1684,11 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
}
if ((window != gui_current_window) || (window->sub_lines > 0))
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
if (window->unread_data < 1 + window->last_line->line_with_message)
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
}
}
}
}
@@ -1541,13 +1743,13 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
if ((!window->last_line) || (window->line_complete))
{
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
sprintf (timestamp, "%02d", date_tmp->tm_hour);
snprintf (timestamp, 16, "%02d", date_tmp->tm_hour);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
sprintf (timestamp, "%02d", date_tmp->tm_min);
snprintf (timestamp, 16, "%02d", date_tmp->tm_min);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
sprintf (timestamp, "%02d", date_tmp->tm_sec);
snprintf (timestamp, 16, "%02d", date_tmp->tm_sec);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
+34 -1
View File
@@ -57,10 +57,11 @@ gui_read_keyb ()
{
switch (key)
{
/* resize event: do nothing */
/* resize event */
case KEY_RESIZE:
gui_redraw_window (gui_current_window);
break;
/* previous window */
case KEY_F(6):
gui_switch_to_previous_window ();
break;
@@ -68,6 +69,10 @@ gui_read_keyb ()
case KEY_F(7):
gui_switch_to_next_window ();
break;
/* remove last infobar message */
case KEY_F(10):
gui_infobar_remove ();
break;
/* cursor up */
case KEY_UP:
if (gui_current_window->ptr_history)
@@ -352,10 +357,38 @@ gui_main_loop ()
fd_set read_fd;
static struct timeval timeout;
t_irc_server *ptr_server;
int old_min, old_sec;
time_t new_time;
struct tm *local_time;
quit_weechat = 0;
old_min = -1;
old_sec = -1;
while (!quit_weechat)
{
new_time = time (NULL);
local_time = localtime (&new_time);
/* minute has changed ? => redraw infobar */
if (local_time->tm_min != old_min)
{
old_min = local_time->tm_min;
gui_redraw_window_infobar (gui_current_window);
}
/* second has changed ? => count down time for infobar, if needed */
if (local_time->tm_sec != old_sec)
{
old_sec = local_time->tm_sec;
/* TODO: manage splitted windows! */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
gui_infobar->remaining_time--;
if (gui_infobar->remaining_time == 0)
gui_infobar_remove ();
}
}
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
FD_ZERO (&read_fd);
+2 -2
View File
@@ -15,9 +15,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
bin_PROGRAMS = weechat-gtk
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
INCLUDES = $(GTK_CFLAGS)
bin_PROGRAMS = weechat-gtk
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
+39
View File
@@ -349,6 +349,35 @@ gui_redraw_window_status (t_gui_window *window)
gui_draw_window_status (window);
}
/*
* gui_draw_window_infobar: draw infobar window
*/
void
gui_draw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
/* TODO: draw infobar window! */
}
/*
* gui_redraw_window_infobar: redraw infobar window
*/
void
gui_redraw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
/* TODO: first delete window content */
gui_draw_window_infobar (window);
}
/*
* gui_draw_window_input: draw input window
*/
@@ -570,6 +599,16 @@ gui_init_colors ()
/* TODO: init colors for Gtk */
}
/*
* gui_set_window_title: set window title
*/
void
gui_set_window_title ()
{
/* TODO: set window title for Gtk */
}
/*
* gui_init: init GUI
*/
+58 -1
View File
@@ -42,6 +42,7 @@ int gui_ready; /* = 1 if GUI is initialized */
t_gui_window *gui_windows = NULL; /* pointer to first window */
t_gui_window *last_gui_window = NULL; /* pointer to last window */
t_gui_window *gui_current_window = NULL; /* pointer to current window */
t_gui_infobar *gui_infobar; /* pointer to infobar content */
/*
@@ -182,6 +183,62 @@ gui_window_clear_all ()
gui_window_clear (ptr_win);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buffer);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
/* TODO: manage splitted windows! */
gui_redraw_window_infobar (gui_current_window);
}
else
wee_log_printf (_("%s not enough memory for infobar message\n"),
WEECHAT_ERROR);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
/* TODO: manage splitted windows! */
gui_redraw_window_infobar (gui_current_window);
}
}
/*
* gui_window_free: delete a window
*/
@@ -234,7 +291,7 @@ gui_window_free (t_gui_window *window)
/* always at least one window */
if (!gui_windows && create_new)
gui_window_new (NULL, NULL, 1);
(void) gui_window_new (NULL, NULL, 1);
}
/*
+39 -18
View File
@@ -26,7 +26,7 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 36
#define NUM_COLORS 38
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
@@ -43,18 +43,20 @@
#define COLOR_WIN_STATUS_DATA_MSG 14
#define COLOR_WIN_STATUS_DATA_OTHER 15
#define COLOR_WIN_STATUS_MORE 16
#define COLOR_WIN_INPUT 17
#define COLOR_WIN_INPUT_CHANNEL 18
#define COLOR_WIN_INPUT_NICK 19
#define COLOR_WIN_NICK 20
#define COLOR_WIN_NICK_OP 21
#define COLOR_WIN_NICK_HALFOP 22
#define COLOR_WIN_NICK_VOICE 23
#define COLOR_WIN_NICK_SEP 24
#define COLOR_WIN_NICK_SELF 25
#define COLOR_WIN_NICK_PRIVATE 26
#define COLOR_WIN_NICK_FIRST 27
#define COLOR_WIN_NICK_LAST 36
#define COLOR_WIN_INFOBAR 17
#define COLOR_WIN_INFOBAR_HIGHLIGHT 18
#define COLOR_WIN_INPUT 19
#define COLOR_WIN_INPUT_CHANNEL 20
#define COLOR_WIN_INPUT_NICK 21
#define COLOR_WIN_NICK 22
#define COLOR_WIN_NICK_OP 23
#define COLOR_WIN_NICK_HALFOP 24
#define COLOR_WIN_NICK_VOICE 25
#define COLOR_WIN_NICK_SEP 26
#define COLOR_WIN_NICK_SELF 27
#define COLOR_WIN_NICK_PRIVATE 28
#define COLOR_WIN_NICK_FIRST 29
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define SERVER(window) ((t_irc_server *)(window->server))
@@ -107,6 +109,18 @@ struct t_gui_color
int color;
};
typedef struct t_gui_infobar t_gui_infobar;
struct t_gui_infobar
{
int color; /* text color */
char *text; /* infobar text */
int remaining_time; /* delay (sec) before erasing this text */
/* if < 0, text is never erased (except */
/* by user action to erase it) */
t_gui_infobar *next_infobar; /* next message for infobar */
};
typedef struct t_gui_window t_gui_window;
struct t_gui_window
@@ -138,16 +152,17 @@ struct t_gui_window
void *win_chat; /* chat window (exemple: channel) */
void *win_nick; /* nick window */
void *win_status; /* status window */
void *win_infobar; /* info bar window */
void *win_input; /* input window */
/* windows for Curses GUI */
/* windows for Gtk GUI */
void *textview_chat; /* textview widget for chat */
void *textbuffer_chat; /* textbuffer widget for chat */
void *texttag_chat; /* texttag widget for chat */
void *textview_nicklist; /* textview widget for nicklist */
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
/* windows for Curses GUI */
/* windows for Qt GUI */
/* TODO: declare Qt window */
/* chat content (lines, line is composed by many messages) */
@@ -183,13 +198,16 @@ extern int gui_ready;
extern t_gui_window *gui_windows;
extern t_gui_window *last_gui_window;
extern t_gui_window *gui_current_window;
extern t_gui_infobar *gui_infobar;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (/*@null@*/ void *, /*@null@*/ void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_remove ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
@@ -211,6 +229,8 @@ extern void gui_draw_window_nick (t_gui_window *);
extern void gui_redraw_window_nick (t_gui_window *);
extern void gui_draw_window_status (t_gui_window *);
extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_infobar (t_gui_window *);
extern void gui_redraw_window_infobar (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
@@ -221,11 +241,12 @@ extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_pre_init (int *, char **[]);
//extern void gui_init_colors ();
extern void gui_init_colors ();
extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_printf_color_type (/*@null@*/ t_gui_window *, int, int, char *, ...);
extern void gui_main_loop ();
#endif /* gui.h */
+3
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
noinst_LIBRARIES = lib_weechat_irc.a
lib_weechat_irc_a_SOURCES = irc.h \
@@ -24,4 +26,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
irc-server.c \
irc-channel.c \
irc-nick.c \
irc-dcc.c \
irc-display.c
+5
View File
@@ -32,6 +32,7 @@
t_irc_channel *current_channel = NULL;
char *channel_modes = "iklmnst";
/*
@@ -55,6 +56,10 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
new_channel->topic = NULL;
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
new_channel->limit = 0;
new_channel->key = NULL;
new_channel->nicks = NULL;
new_channel->last_nick = NULL;
+22 -5
View File
@@ -44,6 +44,12 @@ t_irc_command irc_commands[] =
N_("nickname type"),
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
{ "dcc", N_("starts DCC (file or chat)"),
N_("action nickname [file]"),
N_("action: 'send' (file) or 'chat'\n"
"nickname: nickname to send file or chat\n"
"file: filename (on local host)"),
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 },
@@ -119,15 +125,15 @@ t_irc_command irc_commands[] =
" w: user receives wallops\n"
" o: operator flag\n"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
{ "motd", N_("get the \"Message Of The Day\""),
N_("[target]"),
N_("target: server name"),
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
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 },
@@ -158,6 +164,11 @@ t_irc_command irc_commands[] =
{ "privmsg", N_("message received"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
N_("nickname: nickname for private conversation"
"\ntext: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
{ "quit", N_("close all connections & quit " PACKAGE_NAME),
N_("[quit_message]"),
N_("quit_message: quit message (displayed to other users)"),
@@ -280,6 +291,8 @@ t_irc_command irc_commands[] =
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "332", N_("topic of channel"),
N_("channel :topic"),
@@ -383,6 +396,10 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "475", N_("cannot join channel (bad channel key)"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "476", N_("bad channel mask"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "477", N_("channel doesn't support modes"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "481", N_("you're not an IRC operator"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "482", N_("you're not channel operator"),
+515 -193
View File
@@ -183,7 +183,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
_(" has joined "));
gui_printf_color (ptr_channel->window, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
nick_new (ptr_channel, host, 0, 0, 0);
(void) nick_new (ptr_channel, host, 0, 0, 0);
gui_redraw_window_nick (gui_current_window);
return 0;
}
@@ -271,6 +271,256 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
return 0;
}
/*
* irc_get_channel_modes: get channel modes
*/
void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
char *nick_host, char *modes, char *parm)
{
char *pos, set_flag;
t_irc_nick *ptr_nick;
set_flag = '+';
while (modes && modes[0])
{
switch (modes[0])
{
case '+':
set_flag = '+';
break;
case '-':
set_flag = '-';
break;
case 'b':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "b", nick_host,
(set_flag == '+') ?
_("sets ban on") :
_("removes ban on"),
(parm) ? parm : NULL);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'i':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "i", nick_host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
_("removes invite-only channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_INVITE);
break;
case 'k':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "k", nick_host,
(set_flag == '+') ?
_("sets channel key to") :
_("removes channel key"),
(set_flag == '+') ?
((parm) ? parm : NULL) :
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_KEY);
if (ptr_channel->key)
free (ptr_channel->key);
ptr_channel->key = strdup (parm);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'l':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "l", nick_host,
(set_flag == '+') ?
_("sets the user limit to") :
_("removes user limit"),
(set_flag == '+') ?
((parm) ? parm : NULL) :
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_LIMIT);
ptr_channel->limit = atoi (parm);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'm':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "m", nick_host,
(set_flag == '+') ?
_("sets moderated channel flag") :
_("removes moderated channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_MODERATED);
break;
case 'n':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "n", nick_host,
(set_flag == '+') ?
_("sets messages from channel only flag") :
_("removes messages from channel only flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_NO_MSG_OUT);
break;
case 'o':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "o", nick_host,
(set_flag == '+') ?
_("gives channel operator status to") :
_("removes channel operator status from"),
(parm) ? parm : NULL);
if (parm)
{
ptr_nick = nick_search (ptr_channel, parm);
if (ptr_nick)
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
}
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'p':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "p", nick_host,
(set_flag == '+') ?
_("sets private channel flag") :
_("removes private channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 's':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "s", nick_host,
(set_flag == '+') ?
_("sets secret channel flag") :
_("removes secret channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 't':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "t", nick_host,
(set_flag == '+') ?
_("sets topic protection") :
_("removes topic protection"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_TOPIC);
break;
case 'v':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "v", nick_host,
(set_flag == '+') ?
_("gives voice to") :
_("removes voice from"),
(parm) ? parm : NULL);
if (parm)
{
ptr_nick = nick_search (ptr_channel, parm);
if (ptr_nick)
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
}
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
}
modes++;
}
}
/*
* irc_cmd_recv_mode: 'mode' message received
*/
@@ -278,10 +528,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
int
irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *pos_parm;
char set_flag;
char *pos, *pos_parm;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
/* no host => we can't identify sender of message! */
if (host == NULL)
@@ -317,127 +565,15 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
pos_parm++;
while (pos_parm[0] == ' ')
pos_parm++;
pos2 = strchr (pos_parm, ' ');
if (pos2)
pos2[0] = '\0';
}
set_flag = '+';
if (string_is_channel (arguments))
{
ptr_channel = channel_search (server, arguments);
if (ptr_channel)
{
/* channel modes */
while (pos && pos[0])
{
switch (pos[0])
{
case '+':
set_flag = '+';
break;
case '-':
set_flag = '-';
break;
case 'b':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "b", host,
(set_flag == '+') ?
_("sets ban on") :
_("removes ban on"),
pos_parm);
/* TODO: change & redraw channel modes */
break;
case 'i':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "i", host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
_("removes invite-only channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'l':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "l", host,
(set_flag == '+') ?
_("sets the user limit to") :
_("removes user limit"),
(set_flag == '+') ? pos_parm : NULL);
/* TODO: change & redraw channel modes */
break;
case 'm':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "m", host,
(set_flag == '+') ?
_("sets moderated channel flag") :
_("removes moderated channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'o':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "o", host,
(set_flag == '+') ?
_("gives channel operator status to") :
_("removes channel operator status from"),
pos_parm);
ptr_nick = nick_search (ptr_channel, pos_parm);
if (ptr_nick)
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
break;
/* TODO: remove this obsolete (?) channel flag? */
case 'p':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "p", host,
(set_flag == '+') ?
_("sets private channel flag") :
_("removes private channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 's':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "s", host,
(set_flag == '+') ?
_("sets secret channel flag") :
_("removes secret channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 't':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "t", host,
(set_flag == '+') ?
_("sets topic protection") :
_("removes topic protection"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'v':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "v", host,
(set_flag == '+') ?
_("gives voice to") :
_("removes voice from"),
pos_parm);
ptr_nick = nick_search (ptr_channel, pos_parm);
if (ptr_nick)
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
break;
}
pos++;
}
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
gui_draw_window_status (gui_current_window);
}
else
{
@@ -466,6 +602,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
int nick_is_me;
t_gui_window *ptr_window;
/* no host => we can't identify sender of message! */
if (host == NULL)
@@ -487,7 +624,23 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
ptr_nick = nick_search (ptr_channel, host);
if (ptr_nick)
{
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0);
/* change nickname in any opened private window */
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if ((SERVER(ptr_window) == server) && WIN_IS_PRIVATE(ptr_window))
{
if ((CHANNEL(ptr_window)->name)
&& (strcmp (ptr_nick->nick, CHANNEL(ptr_window)->name) == 0))
{
free (CHANNEL(ptr_window)->name);
CHANNEL(ptr_window)->name = strdup (arguments);
}
}
}
/* change nickname on channel */
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0;
nick_change (ptr_channel, ptr_nick, arguments);
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
if (nick_is_me)
@@ -519,6 +672,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
free (server->nick);
server->nick = strdup (arguments);
}
gui_redraw_window_status (gui_current_window);
gui_redraw_window_input (gui_current_window);
return 0;
@@ -741,6 +895,7 @@ int
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
struct utsname *buf;
@@ -787,8 +942,21 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME);
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host);
if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
ptr_channel->name,
host, pos);
}
else
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT, " %s\n", pos);
}
@@ -798,8 +966,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
@@ -845,15 +1022,23 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (strcmp (pos, "\01VERSION\01") == 0)
{
buf = (struct utsname *) malloc (sizeof (struct utsname));
uname (buf);
server_sendf (server,
_("NOTICE %s :%sVERSION %s v%s"
" compiled on %s, host \"%s\" is running "
"%s %s / %s%s"),
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
&buf->nodename, &buf->sysname,
&buf->release, &buf->machine, "\01\r\n");
free (buf);
if (buf && (uname (buf) == 0))
{
server_sendf (server,
"NOTICE %s :%sVERSION %s v%s"
" compiled on %s, running "
"%s %s / %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
&buf->sysname,
&buf->release, &buf->machine, "\01\r\n");
free (buf);
}
else
server_sendf (server,
"NOTICE %s :%sVERSION %s v%s"
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
irc_display_prefix (server->window, PREFIX_INFO);
gui_printf_color (server->window,
COLOR_WIN_CHAT, _("Received a "));
@@ -863,71 +1048,144 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT, _("from"));
gui_printf_color (server->window,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
/* ping request from another user => answer */
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
return 0;
}
/* incoming DCC file */
if (strncmp (pos, "\01DCC SEND", 9) == 0)
{
pos2 = strchr (pos, '\01');
if (!pos2)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
pos_file = pos + 9;
while (pos_file[0] == ' ')
pos_file++;
/* look for file size */
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_size;
pos_size++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC address (IP) */
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_addr;
pos_addr++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
pos_file, pos_addr, pos_port, pos_size);
return 0;
}
/* private message received => display it */
ptr_channel = channel_search (server, host);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
}
}
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
gui_redraw_window_title (ptr_channel->window);
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
{
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
{
/* ping request from another user => answer */
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
}
else
{
/* private message received => display it */
ptr_channel = channel_search (server, host);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
}
}
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
gui_redraw_window_title (ptr_channel->window);
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
else
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
@@ -1968,6 +2226,69 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
return 0;
}
/*
* irc_cmd_recv_324: '324' command (channel mode)
*/
int
irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
{
char *pos_chan, *pos, *pos_parm;
t_irc_channel *ptr_channel;
/* make gcc happy */
(void) host;
pos_chan = strchr (arguments, ' ');
if (pos_chan)
{
pos_chan[0] = '\0';
pos_chan++;
while (pos_chan[0] == ' ')
pos_chan++;
pos = strchr (pos_chan, ' ');
if (pos)
{
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
pos_parm = strchr (pos, ' ');
if (pos_parm)
{
pos_parm[0] = '\0';
pos_parm++;
while (pos_parm[0] == ' ')
pos_parm++;
}
ptr_channel = channel_search (server, pos_chan);
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
gui_draw_window_status (gui_current_window);
}
}
}
return 0;
}
/*
* irc_cmd_recv_329: '329' command (???)
*/
int
irc_cmd_recv_329 (t_irc_server *server, char *host, char *arguments)
{
/* make gcc happy */
(void) server;
(void) host;
(void) arguments;
return 0;
}
/*
* irc_cmd_recv_331: '331' command received (no topic for channel)
*/
@@ -2477,6 +2798,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
_("normal"));
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
irc_cmd_send_mode (server, ptr_channel->name);
}
else
{
+99 -21
View File
@@ -101,7 +101,7 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (server->is_connected)
if (ptr_server->is_connected)
{
if (pos)
server_sendf (ptr_server, "AWAY :%s\r\n", pos);
@@ -178,6 +178,17 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_dcc: starts DCC (file or chat)
*/
int
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
{
/* TODO: write this command! */
return 0;
}
/*
* irc_cmd_send_deop: remove operator privileges from nickname(s)
*/
@@ -405,6 +416,20 @@ irc_cmd_send_mode (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_motd: get the "Message Of The Day"
*/
int
irc_cmd_send_motd (t_irc_server *server, char *arguments)
{
if (arguments)
server_sendf (server, "MOTD %s\r\n", arguments);
else
server_sendf (server, "MOTD\r\n");
return 0;
}
/*
* irc_cmd_send_msg: send a message to a nick or channel
*/
@@ -526,20 +551,6 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_motd: get the "Message Of The Day"
*/
int
irc_cmd_send_motd (t_irc_server *server, char *arguments)
{
if (arguments)
server_sendf (server, "MOTD %s\r\n", arguments);
else
server_sendf (server, "MOTD\r\n");
return 0;
}
/*
* irc_cmd_send_names: list nicknames on channels
*/
@@ -622,7 +633,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
int
irc_cmd_send_oper (t_irc_server *server, char *arguments)
{
server_sendf (server, "OPER %s %s\r\n", arguments);
server_sendf (server, "OPER %s\r\n", arguments);
return 0;
}
@@ -714,6 +725,64 @@ irc_cmd_send_pong (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_query: start private conversation with a nick
*/
int
irc_cmd_send_query (t_irc_server *server, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
pos = strchr (arguments, ' ');
if (pos)
{
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
if (!pos[0])
pos = NULL;
}
/* create private window if not already opened */
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
gui_redraw_window_title (ptr_channel->window);
}
/* display text if given */
if (pos)
{
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
return 0;
}
/*
* irc_cmd_send_quit: disconnect from all servers and quit WeeChat
*/
@@ -721,12 +790,21 @@ irc_cmd_send_pong (t_irc_server *server, char *arguments)
int
irc_cmd_send_quit (t_irc_server *server, char *arguments)
{
if (server && server->is_connected)
t_irc_server *ptr_server;
/* make gcc happy */
(void) server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (arguments)
server_sendf (server, "QUIT :%s\r\n", arguments);
else
server_sendf (server, "QUIT\r\n");
if (ptr_server->is_connected)
{
if (arguments)
server_sendf (ptr_server, "QUIT :%s\r\n", arguments);
else
server_sendf (ptr_server, "QUIT\r\n");
}
}
quit_weechat = 1;
return 0;
+194 -69
View File
@@ -26,9 +26,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -59,6 +61,7 @@ server_init (t_irc_server *server)
{
server->name = NULL;
server->autoconnect = 0;
server->command_line = 0;
server->address = NULL;
server->port = -1;
server->password = NULL;
@@ -80,6 +83,103 @@ server_init (t_irc_server *server)
server->last_channel = NULL;
}
/*
* server_init_with_url: init a server with url of this form:
* irc://nick:pass@irc.toto.org:6667
* returns: 0 = ok
* -1 = invalid syntax
*/
int
server_init_with_url (char *irc_url, t_irc_server *server)
{
char *url, *pos_server, *pos_channel, *pos, *pos2;
struct passwd *my_passwd;
server_init (server);
if (strncasecmp (irc_url, "irc://", 6) != 0)
return -1;
url = strdup (irc_url);
pos_server = strchr (url, '@');
if (pos_server)
{
pos_server[0] = '\0';
pos_server++;
pos = url + 6;
if (!pos[0])
{
free (url);
return -1;
}
pos2 = strchr (pos, ':');
if (pos2)
{
pos2[0] = '\0';
server->password = strdup (pos2 + 1);
}
server->nick1 = strdup (pos);
}
else
{
if ((my_passwd = getpwuid (geteuid ())) != NULL)
server->nick1 = strdup (my_passwd->pw_name);
else
{
fprintf (stderr, "%s: %s (%s).",
WEECHAT_WARNING,
_("Unable to get user's name"),
strerror (errno));
free (url);
return -1;
}
pos_server = url + 6;
}
if (!pos_server[0])
{
free (url);
return -1;
}
pos_channel = strchr (pos_server, '/');
if (pos_channel)
{
pos_channel[0] = '\0';
pos_channel++;
}
pos = strchr (pos_server, ':');
if (pos)
{
pos[0] = '\0';
server->port = atoi (pos + 1);
}
server->name = strdup (pos_server);
server->address = strdup (pos_server);
if (pos_channel && pos_channel[0])
{
if (string_is_channel (pos_channel))
server->autojoin = strdup (pos_channel);
else
{
server->autojoin = (char *) malloc (strlen (pos_channel) + 2);
strcpy (server->autojoin, "#");
strcat (server->autojoin, pos_channel);
}
}
free (url);
/* some default values */
if (server->port < 0)
server->port = DEFAULT_IRC_PORT;
server->nick2 = (char *) malloc (strlen (server->nick1) + 2);
strcpy (server->nick2, server->nick1);
server->nick2 = strcat (server->nick2, "1");
server->nick3 = (char *) malloc (strlen (server->nick1) + 2);
strcpy (server->nick3, server->nick1);
server->nick3 = strcat (server->nick3, "2");
return 0;
}
/*
* server_alloc: allocate a new server and add it to the servers queue
*/
@@ -193,8 +293,8 @@ server_free_all ()
*/
t_irc_server *
server_new (char *name, int autoconnect, char *address, int port,
char *password, char *nick1, char *nick2, char *nick3,
server_new (char *name, int autoconnect, int command_line, char *address,
int port, char *password, char *nick1, char *nick2, char *nick3,
char *username, char *realname, char *command, char *autojoin)
{
t_irc_server *new_server;
@@ -216,6 +316,7 @@ server_new (char *name, int autoconnect, char *address, int port,
{
new_server->name = strdup (name);
new_server->autoconnect = autoconnect;
new_server->command_line = command_line;
new_server->address = strdup (address);
new_server->port = port;
new_server->password = (password) ? strdup (password) : strdup ("");
@@ -254,7 +355,7 @@ server_send (t_irc_server * server, char *buffer, int size_buf)
* server_sendf: send formatted data to irc server
*/
int
void
server_sendf (t_irc_server * server, char *fmt, ...)
{
va_list args;
@@ -262,14 +363,14 @@ server_sendf (t_irc_server * server, char *fmt, ...)
int size_buf;
if (!server)
return -1;
return;
va_start (args, fmt);
size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
va_end (args);
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
return 0;
return;
buffer[sizeof (buffer) - 1] = '\0';
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
@@ -279,7 +380,9 @@ server_sendf (t_irc_server * server, char *fmt, ...)
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
#endif
buffer[size_buf - 2] = '\r';
return server_send (server, buffer, size_buf);
if (server_send (server, buffer, size_buf) <= 0)
gui_printf (server->window, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
}
/*
@@ -287,18 +390,32 @@ server_sendf (t_irc_server * server, char *fmt, ...)
*/
void
server_msgq_add_msg (t_irc_server * server, char *msg)
server_msgq_add_msg (t_irc_server *server, char *msg)
{
t_irc_message *message;
message = (t_irc_message *) malloc (sizeof (t_irc_message));
if (!message)
{
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
return;
}
message->server = server;
if (unterminated_message)
{
message->data = (char *) malloc (strlen (unterminated_message) +
strlen (msg) + 1);
strcpy (message->data, unterminated_message);
strcat (message->data, msg);
if (!message->data)
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
{
strcpy (message->data, unterminated_message);
strcat (message->data, msg);
}
free (unterminated_message);
unterminated_message = NULL;
}
@@ -344,7 +461,12 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
unterminated_message =
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
strcpy (unterminated_message, buffer);
if (!unterminated_message)
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
strcpy (unterminated_message, buffer);
return;
}
gui_printf (server->window,
@@ -362,81 +484,83 @@ void
server_msgq_flush ()
{
t_irc_message *next;
/*char **argv;
int argc;*/
char *entire_line, *ptr_data, *pos, *pos2;
char *host, *command, *args;
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
while (recv_msgq)
{
#ifdef DEBUG
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
#endif
ptr_data = recv_msgq->data;
entire_line = strdup (ptr_data);
while (ptr_data[0] == ' ')
ptr_data++;
if (ptr_data)
if (recv_msgq->data)
{
#ifdef DEBUG
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
#endif
host = NULL;
command = NULL;
args = ptr_data;
ptr_data = recv_msgq->data;
entire_line = strdup (ptr_data);
if (ptr_data[0] == ':')
{
pos = strchr(ptr_data, ' ');
pos[0] = '\0';
host = ptr_data+1;
pos++;
}
else
pos = ptr_data;
while (ptr_data[0] == ' ')
ptr_data++;
if (pos != NULL)
if (ptr_data)
{
while (pos[0] == ' ')
pos++;
pos2 = strchr(pos, ' ');
if (pos2 != NULL)
#ifdef DEBUG
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
#endif
host = NULL;
command = NULL;
args = ptr_data;
if (ptr_data[0] == ':')
{
pos2[0] = '\0';
command = strdup(pos);
pos2++;
while (pos2[0] == ' ')
pos = strchr(ptr_data, ' ');
pos[0] = '\0';
host = ptr_data+1;
pos++;
}
else
pos = ptr_data;
if (pos != NULL)
{
while (pos[0] == ' ')
pos++;
pos2 = strchr(pos, ' ');
if (pos2 != NULL)
{
pos2[0] = '\0';
command = strdup(pos);
pos2++;
args = (pos2[0] == ':') ? pos2+1 : pos2;
while (pos2[0] == ' ')
pos2++;
args = (pos2[0] == ':') ? pos2+1 : pos2;
}
}
switch (irc_recv_command (recv_msgq->server, entire_line, host,
command, args))
{
case -1:
gui_printf (recv_msgq->server->window,
_("Command '%s' failed!\n"), command);
break;
case -2:
gui_printf (recv_msgq->server->window,
_("No command to execute!\n"));
break;
case -3:
gui_printf (recv_msgq->server->window,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
}
}
switch (irc_recv_command (recv_msgq->server, entire_line, host,
command, args))
{
case -1:
gui_printf (recv_msgq->server->window,
_("Command '%s' failed!\n"), command);
break;
case -2:
gui_printf (recv_msgq->server->window,
_("No command to execute!\n"));
break;
case -3:
gui_printf (recv_msgq->server->window,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
}
free (entire_line);
free (recv_msgq->data);
}
free (entire_line);
free (recv_msgq->data);
next = recv_msgq->next_message;
free (recv_msgq);
recv_msgq = next;
@@ -574,16 +698,17 @@ server_connect (t_irc_server *server)
*/
void
server_auto_connect ()
server_auto_connect (int command_line)
{
t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server->autoconnect)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
gui_window_new (ptr_server, NULL, 1);
(void) gui_window_new (ptr_server, NULL, 1);
if (server_connect (ptr_server))
irc_login (ptr_server);
}
+35 -5
View File
@@ -34,6 +34,22 @@
#define CHANNEL_PREFIX "#&+!"
#define NUM_CHANNEL_MODES 7
#define CHANNEL_MODE_INVITE 0
#define CHANNEL_MODE_KEY 1
#define CHANNEL_MODE_LIMIT 2
#define CHANNEL_MODE_MODERATED 3
#define CHANNEL_MODE_NO_MSG_OUT 4
#define CHANNEL_MODE_SECRET 5
#define CHANNEL_MODE_TOPIC 6
#define SET_CHANNEL_MODE(channel, set, mode) \
if (set) \
channel->modes[mode] = channel_modes[mode]; \
else \
channel->modes[mode] = ' ';
#define DEFAULT_IRC_PORT 6667
/* nick types */
typedef struct t_irc_nick t_irc_nick;
@@ -62,6 +78,9 @@ struct t_irc_channel
int type; /* channel type */
char *name; /* name of channel (exemple: "#abc") */
char *topic; /* topic of channel (host for private) */
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
int limit; /* user limit (0 is limit not set) */
char *key; /* channel key (NULL if no key is set) */
t_irc_nick *nicks; /* nicks on the channel */
t_irc_nick *last_nick; /* last nick on the channel */
t_gui_window *window; /* GUI window allocated for channel */
@@ -78,6 +97,7 @@ struct t_irc_server
/* user choices */
char *name; /* name of server (only for display) */
int autoconnect; /* = 1 if auto connect at startup */
int command_line; /* server was given on command line */
char *address; /* address of server (IP or name) */
int port; /* port for server (6667 by default) */
char *password; /* password for server */
@@ -136,21 +156,23 @@ extern t_irc_command irc_commands[];
extern t_irc_server *irc_servers, *current_irc_server;
extern t_irc_message *recv_msgq, *msgq_last_msg;
extern t_irc_channel *current_channel;
extern char *channel_modes;
/* server functions (irc-server.c) */
extern void server_init (t_irc_server *);
extern int server_init_with_url (char *, t_irc_server *);
extern t_irc_server *server_alloc ();
extern void server_destroy (t_irc_server *);
extern void server_free (t_irc_server *);
extern void server_free_all ();
extern t_irc_server *server_new (char *, int, char *, int, char *, char *,
extern t_irc_server *server_new (char *, int, int, char *, int, char *, char *,
char *, char *, char *, char *, char *, char *);
extern int server_send (t_irc_server *, char *, int);
extern int server_sendf (t_irc_server *, char *, ...);
extern void server_sendf (t_irc_server *, char *, ...);
extern void server_recv (t_irc_server *);
extern int server_connect ();
extern void server_auto_connect ();
extern void server_auto_connect (int);
extern void server_disconnect (t_irc_server *);
extern void server_disconnect_all ();
extern t_irc_server *server_search (char *);
@@ -176,9 +198,13 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
extern int nick_get_max_length (t_irc_channel *);
/* DCC functions (irc-dcc.c) */
extern void dcc_send ();
/* IRC display (irc-diplay.c) */
extern void irc_display_prefix (t_gui_window *, char *);
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
char *, char *);
@@ -191,6 +217,7 @@ extern void irc_login (t_irc_server *);
extern int irc_cmd_send_admin (t_irc_server *, char *);
extern int irc_cmd_send_away (t_irc_server *, char *);
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
extern int irc_cmd_send_dcc (t_irc_server *, char *);
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
extern int irc_cmd_send_die (t_irc_server *, char *);
@@ -205,8 +232,8 @@ extern int irc_cmd_send_list (t_irc_server *, char *);
extern int irc_cmd_send_lusers (t_irc_server *, char *);
extern int irc_cmd_send_me (t_irc_server *, char *);
extern int irc_cmd_send_mode (t_irc_server *, char *);
extern int irc_cmd_send_msg (t_irc_server *, char *);
extern int irc_cmd_send_motd (t_irc_server *, char *);
extern int irc_cmd_send_msg (t_irc_server *, char *);
extern int irc_cmd_send_names (t_irc_server *, char *);
extern int irc_cmd_send_nick (t_irc_server *, int, char **);
extern int irc_cmd_send_notice (t_irc_server *, char *);
@@ -215,6 +242,7 @@ extern int irc_cmd_send_oper (t_irc_server *, char *);
extern int irc_cmd_send_part (t_irc_server *, char *);
extern int irc_cmd_send_ping (t_irc_server *, char *);
extern int irc_cmd_send_pong (t_irc_server *, char *);
extern int irc_cmd_send_query (t_irc_server *, char *);
extern int irc_cmd_send_quit (t_irc_server *, char *);
extern int irc_cmd_send_quote (t_irc_server *, char *);
extern int irc_cmd_send_rehash (t_irc_server *, char *);
@@ -268,6 +296,8 @@ extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
+2
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
if PLUGIN_PERL
perl_dir = perl
endif
+1 -1
View File
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = $(PERL_CFLAGS)
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
noinst_LIBRARIES = lib_weechat_perl.a
+25
View File
@@ -202,6 +202,30 @@ static XS (XS_IRC_print_with_channel)
XSRETURN_NO;
}
/*
* IRC::print_infobar: print message to infobar
*/
static XS (XS_IRC_print_infobar)
{
int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (items == 2)
gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("Perl error: wrong parameters for IRC::print_infobar Perl function\n"));
}
XSRETURN_EMPTY;
}
/*
* IRC::add_message_handler: add handler for messages (privmsg, ...)
*/
@@ -321,6 +345,7 @@ xs_init (pTHX)
newXS ("IRC::register", XS_IRC_register, "IRC");
newXS ("IRC::print", XS_IRC_print, "IRC");
newXS ("IRC::print_with_channel", XS_IRC_print_with_channel, "IRC");
newXS ("IRC::print_infobar", XS_IRC_print_infobar, "IRC");
newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");
newXS ("IRC::add_command_handler", XS_IRC_add_command_handler, "IRC");
newXS ("IRC::get_info", XS_IRC_get_info, "IRC");
+4 -2
View File
@@ -56,15 +56,17 @@ t_plugin_handler *last_plugin_cmd_handler = NULL;
void
plugin_auto_load (int plugin_type, char *directory)
{
int dir_length;
char *dir_name, *current_dir;
DIR *dir;
struct dirent *entry;
struct stat statbuf;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (directory) + 2;
dir_name =
(char *) malloc ((strlen (weechat_home) + strlen (directory) + 2) * sizeof (char));
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
(char *) malloc (dir_length * sizeof (char));
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
/* save working directory */
current_dir = (char *) malloc (1024 * sizeof (char));
+2 -2
View File
@@ -61,14 +61,14 @@ extern t_plugin_script *perl_scripts;
extern void plugin_init ();
extern void plugin_load (int, char *);
extern void plugin_unload (int, char *);
extern void plugin_unload (int, /*@null@*/ char *);
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *);
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **,
int, char *, char *);
extern void plugin_handler_free_all_type (t_plugin_handler **,
t_plugin_handler **, int);
extern void plugin_event_msg (char *, char *);
extern int plugin_exec_command (char *, char *);
extern int plugin_exec_command (char *, /*@null@*/ char *);
extern void plugin_end ();
#endif /* plugins.h */
+17 -2
View File
@@ -1,11 +1,13 @@
.TH WEECHAT 1 "January 2004" "FlashCode"
.TH WEECHAT 1 "June 2004" "FlashCode"
.SH NAME
weechat \- Wee Enhanced Environment for Chat
.SH SYNOPSIS
.B weechat
.RI [ options ]
.RI [ options... ]
or
.RI [ url... ]
.br
.SH DESCRIPTION
@@ -17,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.SH OPTIONS
.TP
.B \-c, \-\-config
.br
display config file help (list of options)
.TP
.B \-h, \-\-help
.br
display summary of options
@@ -29,6 +35,15 @@ display program license
.br
display WeeChat version
.SH URL
WeeChat can use an URL (Uniform Resource Locator) to automatically connect
to an IRC server. These are in the following form:
.TP
.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel]
.TP
Exemple to join WeeChat channel support:
irc://irc.freenode.net/weechat
.SH FILES
.TP
.B $HOME/.weechat/weechat.rc
+8 -3
View File
@@ -1,5 +1,5 @@
%define name weechat
%define version 0.0.4
%define version 0.0.6
%define release 1
Name: %{name}
@@ -10,6 +10,7 @@ Source: http://weechat.flashtux.org/download/%{name}-%{version}.tar.gz
URL: http://weechat.flashtux.org
Group: Networking/IRC
BuildRoot: %{_tmppath}/%{name}-buildroot
Requires: perl
License: GPL
%description
@@ -22,7 +23,7 @@ rm -rf $RPM_BUILD_ROOT
%setup
%build
./configure
./configure --enable-perl
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
%install
@@ -35,11 +36,15 @@ rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root,0755)
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
%doc AUTHORS BUGS ChangeLog COPYING FAQ FAQ.fr INSTALL NEWS README TODO
/usr/local/man/man1/weechat.1*
/usr/local/bin/weechat-curses
%changelog
* Sat Jun 05 2004 FlashCode <flashcode@flashtux.org> 0.0.6-1
- Released version 0.0.6
* Thu Feb 02 2004 FlashCode <flashcode@flashtux.org> 0.0.5-1
- Released version 0.0.5
* Thu Jan 01 2004 FlashCode <flashcode@flashtux.org> 0.0.4-1
- Released version 0.0.4
* Mon Nov 03 2003 FlashCode <flashcode@flashtux.org> 0.0.3-1
+2 -2
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2004-01-01
WeeChat known bugs, 2004-06-05
- ./configure does not check that Curses headers are installed
- ./configure does not check that Gtk 2.0 libraries are installed
@@ -17,4 +17,4 @@ WeeChat known bugs, 2004-01-01
- wrong alias is not created and not saved when quitting WeeChat
- when many WeeChat are launched, log file is not properly written (cleared by
each WeeChat at startup)
- display problems with Konsole (Kde terminal)
- display problems with old Konsole versions (Kde terminal)
+26 -1
View File
@@ -1,9 +1,34 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2004-01-01
ChangeLog - 2004-06-05
Version 0.0.6 (2004-06-05):
* improved channel highlight (priority to message vs join/part)
* fixed bug when opened private win and remote user changes his nick
* /query command added (starts private conversation)
* IRC messages 476, 477 added
* /mode command is now ok and channel flags are displayed in status bar
* fixed display bug (text was blinking when scrolling)
* CTCP Version reply is now in english only and doesn't show host (security reason)
Version 0.0.5 (2004-02-07):
* /set command to modify config options when WeeChat is running
* fixed look_nicklist config option, now enables/disables nicklist
* secured code to prevent buffer overflows and memory leaks
* fixed QUIT IRC command: now sent to all connected servers (not only current)
* URL command line parameter to connect to server(s)
* new Perl script function to display message in info bar ("IRC::print_infobar")
* info bar highlight notifications
* info bar timestamp is added to config ("look_infobar_timestamp")
* added info bar (optional, "look_infobar" to enable it, "on" by default)
* fixed crash with /oper command
* for default config file, nick is now based on un*x username (thanks to Witukind)
* fixed crash when config file cannot be written
* -c (or --config) command line parameter added to see config file options
* highlight action messages
Version 0.0.4 (2004-01-01):
* Perl plugin, with auto-load
* when private window is created (another user is talking), WeeChat does not
+120 -121
View File
@@ -1,158 +1,157 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat FAQ, 2004-05-31
=======================
WeeChat FAQ, 2004-01-01
Intended audience:
All WeeChat users.
Before reading the following:
the following Q/A list is *not* exhaustive.
It is also possible that you won't find any Q/A that matches your problem.
Please read them anyway, they may provide you help in fixing your problem
anyway.
And even if your problem is listed below, it is possible that the answers don't
help you anymore to solve it. Then, please contact us, we will try to help you
finding a solution.
1 - Compiling
2 - Using WeeChat
3 - Development
1.1
================================================================================
Q: I heard about many GUI for WeeChat. How can I compile/use them?
A: Curses GUI is built by default.
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
--enable-gtk to enable Gtk GUI
--enable-qt to enable Qt QUI
Type ./configure --help to see available options.
WARNING: only Curses GUI is ok today. Other GUI are under development!
1- Compiling
1.2
================================================================================
Q: I can't compile WeeChat CVS.
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
1.2 I can't compile WeeChat CVS.
2- Using WeeChat
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
2.2 I've launched WeeChat, but I'm lost, what can I do?
2.3 How can I customize key bindings?
2.4 How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
2.5 How can I load Python scripts?
2.6 How can I load Ruby scripts?
3- Development
3.1 How should I report bugs?
3.2 How should I submit patches?
3.3 How should I submit new feature request?
3.4 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows?
3.5 I want to help WeeChat developers. What can I do?
3.6 Can I give money or other things to WeeChat developers?
A: Check that you have latest version of autoconf and automake.
WeeChat has been developed with autoconf version 2.56 and automake
version 1.7.
You should have at least these versions in order to compile WeeChat CVS.
If you can't or don't want to install these versions, you can download and
install "devel package", a package built almost every day, based on CVS.
Note that this package may not correspond exactly to CVS base.
/------------------------------------------------------------------------------\
| 1- Compiling |
\------------------------------------------------------------------------------/
2.1
================================================================================
Q: Why using WeeChat ? X-Chat and Irssi are so good...
A: Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, Qt),
* extensible with scripts (Perl, Python, Ruby),
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
This is the "geekest Irc client" ;)
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
2.2
================================================================================
Q: I've launched WeeChat, but I'm lost, what can I do?
Curses GUI is built by default.
To build Gtk or Qt GUI you've to specify extra options to ./configure script:
--enable-gtk to enable gtk GUI
--enable-qt to enable Qt QUI
Type ./configure --help to see available options.
WARNING: only Curses GUI is ok today. Other GUI are under development!
A: For help you can type /help. For help about a command, type /help command.
1.2 I can't compile WeeChat CVS.
2.3
================================================================================
Q: How can I customize key bindings?
Check that you have latest version of autoconf and automake.
WeeChat has been developed with autoconf version 2.56 and automake version 1.7.
You should have at least these versions in order to compile WeeChat CVS.
If you can't or don't want to install these versions, you can download and
install "devel package", a package built almost every day, based on CVS.
Note that this package may not correspond exactly to CVS base.
A: Today you can't do that. This will be available in a future version.
/------------------------------------------------------------------------------\
| 2- Using WeeChat |
\------------------------------------------------------------------------------/
2.4
================================================================================
Q: How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
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 ;)
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
2.5
================================================================================
Q: How can I load Python scripts?
Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, Qt),
* extensible with scripts (Perl, Python, Ruby),
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
This is the "geekest Irc client" ;)
A: Today Python interface is not developed, so can't load any Python script.
2.2 I've launched WeeChat, but I'm lost, what can I do?
2.6
================================================================================
Q: How can I load Ruby scripts?
For help you can type /help. For help about a command, type /help command.
A: Today Ruby interface is not developed, so can't load any Ruby script.
2.3 How can I customize key bindings?
3.1
================================================================================
Q: How should I report bugs?
Today you can't do that. This will be available in a future version.
A: There is 3 ways to report bugs:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can submit your bug at this url:
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. you can mail your problem, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.4 How can I load Perl scripts?
Are Perl scripts compatible with X-chat or/and Irssi ?
3.2
================================================================================
Q: How should I submit patches?
Yes, you can use /perl command to launch 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 ;)
A: There is 3 ways to submit patches:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can submit your patch at this url:
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. you can mail your patch, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.5 How can I load Python scripts?
3.3
================================================================================
Q: How should I submit new feature request?
Today Python interface is not developed, so can't load any Python script.
A: There is 2 ways to submit your feature request:
1. you can join us on IRC: irc.freenode.net, channel #weechat
2. you can mail your feature request, look at support page for developer's
mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
2.6 How can I load Ruby scripts?
3.4
================================================================================
Q: Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
Today Ruby interface is not developed, so can't load any Ruby script.
A: Yes. Future versions will be available for these OS.
/------------------------------------------------------------------------------\
| 3- Development |
\------------------------------------------------------------------------------/
3.5
================================================================================
Q: I want to help WeeChat developers. What can I do?
A: There's many tasks to do (code, documentation, ...)
Please contact us with IRC or mail, look at support page:
http://weechat.flashtux.org/support.php
3.1 How should I report bugs?
3.6
================================================================================
Q: Can I give money or other things to WeeChat developers?
There is 3 ways to report bugs:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can submit your bug at this url:
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. you can mail your problem, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.2 How should I submit patches?
There is 3 ways to submit patches:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can submit your patch at this url:
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. you can mail your patch, look at support page for developer's mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.3 How should I submit new feature request?
There is 2 ways to submit your feature request:
1. you can join us on IRC: irc.freenode.net, channel #eci
If no one can help you (huh?), try another way, see below.
2. you can mail your feature request, look at support page for developer's
mails:
http://weechat.flashtux.org/support.php
(you can subscribe and send to "support" mailing list)
3.4 Will WeeChat be ported to *BSD, QNX, MacOS X, Microsoft Windows ?
Yes. Future versions will be available for these OS.
3.5 I want to help WeeChat developers. What can I do?
There's many tasks to do (code, documentation, ...)
Please contact us with IRC or mail, look at support page:
http://weechat.flashtux.org/support.php
3.6 Can I give money or other things to WeeChat developers?
No.
A: No.
+172
View File
@@ -0,0 +1,172 @@
WeeChat FAQ, 2004-05-31
=======================
Public concerné :
Tous les utilisateurs de WeeChat.
Avant de lire la suite ceci :
la liste suivante de questions/réponses n'est *pas* exhaustive.
Il est donc possible que vous ne trouviez pas de question/réponse correspondant
à votre problème.
Lisez les quand même SVP, elles peuvent vous aider à corriger votre problème.
Et même si votre problème est mentionné ci-dessous, il est possible que la
réponse ne vous aide pas à corriger le problème. Dans ce cas, contactez-nous,
nous essaierons de vous aider Ă  trouver une solution.
1 - Compilation
2 - Utilisation de WeeChat
3 - Développement
1.1
================================================================================
Q: J'ai entendu parler de plusieurs interfaces pour WeeChat.
Comment puis-je les compiler/utiliser ?
R: L'interface Curses est construite par défaut.
Pour construire l'interface Gtk ou Qt, vous devez spécifier des options
pour le script ./configure :
--enable-gtk pour activer l'interface Gtk
--enable-qt pour activer l'interface Qt
Tapez ./configure --help pour voir les options disponibles.
ATTENTION : seule l'interface Curses est ok aujourd'hui.
Les autres interfaces sont en développement.
1.2
================================================================================
Q: Je ne peux pas compiler le CVS WeeChat.
R: Vérifiez que vous avez bien la dernière version d'autoconf et automake.
WeeChat a été développé avec autoconf version 2.56 et automake
version 1.7.
Vous devez avoir au moins ces versions pour compiler le CVS WeeChat.
Si vous n'avez pas ou ne souhaitez pas installer ces versions, vous
pouvez télécharger et installer le paquet "devel", un paquet construit
quasiment tous les jours, basé sur le CVS.
Notez que ce paquet peut ne pas correspondre exactement Ă  la base CVS.
2.1
================================================================================
Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
Quelques nouvelles fonctionnalités :
* plusieurs interfaces (Curses, Gtk, Qt),
* extensible par des scripts (Perl, Python, Ruby),
* 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" ;)
2.2
================================================================================
Q: J'ai lancé WeeChat, mais je suis perdu, que puis-je faire ?
R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
tapez /help commande.
2.3
================================================================================
Q: Comment puis-je configurer les raccourcis clavier ?
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
version future.
2.4
================================================================================
Q: Comment puis-je charger des scripts Perl ?
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
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,
désolé ;)
2.5
================================================================================
Q: Comment puis-je charger les scripts Python ?
R: Aujourd'hui l'interface Python n'est pas déceloppée.
Vous ne pouvez donc charger aucun script Python.
2.6
================================================================================
Q: Comment puis-je charger des scripts Ruby ?
R: Aujourd'hui l'interface Ruby n'est pas développée.
Vous ne pouvez donc charger aucun script Ruby.
3.1
================================================================================
Q: Comment dois-je reporter les bugs ?
R: Il y a 3 manières de reporter les bugs :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
2. vous pouvez soumettre votre bug Ă  cette adresse :
http://savannah.nongnu.org/bugs/?func=addbug&group=weechat
3. vous pouvez envoyer votre problem par mail, consultez la page
support pour les mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.2
================================================================================
Q: Comment dois-je soumettre les patches ?
R: Il y a 3 manières de soumettre les patches :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, canal #weechat
2. vous pouvez soumettre votre patch Ă  cette adresse :
http://savannah.nongnu.org/patch/?func=addpatch&group=weechat
3. vous pouvez envoyer votre patch par mail, consultez la page
support pour les mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.3
================================================================================
Q: Comment dois-je soumettre les demandes de nouvelles fonctionnalités ?
R: Il y a 2 manières :
1. vous pouvez nous joindre sur IRC: irc.freenode.net, channel #weechat
2. vous pouvez envoyer un mail, consultez la page support pour les
mails des développeurs :
http://weechat.flashtux.org/support.php
(vous pouvez souscrire et envoyer Ă  la liste de diffusion
"support")
3.4
================================================================================
Q: WeeChat sera-t-il porté sur *BSD, QNX, MacOS X, Microsoft Windows ?
R: Oui. Les futures versions seront disponibles pour ces OS.
3.5
================================================================================
Q: Je souhaiterai aider les développeurs WeeChat. Que puis-je faire ?
R: Il y a plusieurs choses Ă  faire (code, documentation, ...)
Merci de prendre contact avec nous par IRC ou mail, consultez la page
support :
http://weechat.flashtux.org/support.php
3.6
================================================================================
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
R: Non.
+1 -1
View File
@@ -17,6 +17,6 @@
SUBDIRS = po intl src
EXTRA_DIST = weechat.1 BUGS FAQ
EXTRA_DIST = weechat.1 BUGS FAQ FAQ.fr
man_MANS = weechat.1
+4
View File
@@ -1,6 +1,10 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
* FlashCode, 2004-02-07
WeeChat 0.0.5 released.
* FlashCode, 2004-01-01
WeeChat 0.0.4 released.
+17 -21
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2004-01-01
TODO - 2004-06-05
Legend:
# done
@@ -10,34 +10,34 @@ Legend:
? is this really necessary?
v0.0.4:
v0.0.6:
------
* General:
# debug messages can be enabled via ./configure --enbale-debug option
- Windows version
+ Solaris version
* IRC protocol:
# "/mode" command: change the user/channels modes
+ "/dcc" command (for chat and sending/receiving files)
# "/query" command: start private conversation
* Interface:
+ internationalization (traduce WeeChat in many languages)
# intercept Ctrl-C
# when private window is created (another user is talking), WeeChat does not
switch to this window
# highlight when our nick is written in a channel/private window
# display current channel modes (example : #weechat(+nt))
* Plugins:
# Perl plugin
# "/perl load" and "/perl unload" commands to (un)load Perl scripts
# auto-load Perl scripts at startup
* Configuration:
+ add missing options for config file
- add key bindings to config file
Future versions:
---------------
* General:
- Windows version
- *BSD version
* IRC protocol:
+ "/mode" command: change the user/channels modes
- "/dcc" command (for chat and sending/receiving files)
- complete "/list" command: add regexp search, display only channels that
match regexp
- "/ignore" and "/unignore" commands: hide all that is write by a given
@@ -48,9 +48,6 @@ Future versions:
nick/host connect to the given irc network
* WeeChat commands:
+ "/set" command: allow the user to set the WeeChat variables
under WeeChat without editing the config file (colours, time
format, etc)
- "/reload" command: reload the WeeChat's config file
- "/highlight" command: highlight a given word when it appears on
channels/privates
@@ -60,10 +57,11 @@ Future versions:
and show us the output on the current window. An option to exec
like -o could send the output to the server, on the current
channel/private
- "/last": command to look for text in previous messages
* Interface:
+ Gtk GUI
- display current channel modes (example : #weechat(+nt))
- color for nicks (except own nick) when nick colors are disabled
- interpret special chars in messages (color & bold for example)
- many channel windows in one window/term (window split)
- add lag indicator
@@ -71,7 +69,7 @@ Future versions:
if WeeChat is running for long time, a lot of memory is used!)
- improve completion (for example complete command parameters when possible)
- understand incomplete commands if unambigous (for example: /he for /help is ok)
- add clock (in status bar?)
- tab key with empty command line should switch to next window (like F7)
- log chats to file
? Qt GUI
@@ -82,8 +80,6 @@ Future versions:
- IPv6 protocol implementation
* Configuration:
- add missing options for config file
- add key bindings to config file
- load config file after GUI (so init values by default (colors, ...) before
loading config)
+3 -3
View File
@@ -19,10 +19,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 0.0.4, flashcode@flashtux.org)
AC_INIT(WeeChat, 0.0.6, flashcode@flashtux.org)
AC_CONFIG_SRCDIR([src/common/weechat.c])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([weechat], [0.0.4])
AM_INIT_AUTOMAKE([weechat], [0.0.6])
# Checks for programs.
AC_PROG_CC
@@ -38,7 +38,7 @@ AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
+12
View File
@@ -1,3 +1,15 @@
weechat (0.0.6-1) unstable; urgency=low
* WeeChat version 0.0.6, see ChangeLog for detail.
-- FlashCode <flashcode@flashtux.org> Sat, 05 Jun 2004 11:30:00 +0200
weechat (0.0.5-1) unstable; urgency=low
* WeeChat version 0.0.5, see ChangeLog for detail.
-- FlashCode <flashcode@flashtux.org> Sat, 07 Feb 2004 20:30:00 +0200
weechat (0.0.4-1) unstable; urgency=low
* WeeChat version 0.0.4, see ChangeLog for detail.
+1 -1
View File
@@ -2,7 +2,7 @@ Source: weechat
Section: net
Priority: optional
Maintainer: FlashCode <flashcode@flashtux.org>
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7)
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
Standards-Version: 3.5.8
Package: weechat
+1 -1
View File
@@ -1,5 +1,5 @@
This package was debianized by FlashCode <flashcode@flashtux.org> on
Thu, 01 Jan 2004 13:00:00 +0200.
Sat, 05 Jun 2004 11:30:00 +0200.
It was downloaded from http://weechat.flashtux.org/download
+1 -1
View File
@@ -17,7 +17,7 @@ endif
configure: configure-stamp
configure-stamp:
dh_testdir
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
./configure --prefix=/usr --sysconfdir=/etc --enable-perl --enable-gtk
touch configure-stamp
+1
View File
@@ -3,6 +3,7 @@ BUGS
ChangeLog
COPYING
FAQ
FAQ.fr
INSTALL
NEWS
README
+360 -15
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (english version)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_en.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_en.texi
@@ -28,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.0.4 - November, 23 2003
@subtitle Documentation for WeeChat v0.0.6 - June, 05 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ This manual documents WeeChat IRC client, it is part of WeeChat.@*
Latest version of this document can be found on this page:@*
@uref{http://weechat.flashtux.org/doc.php?lang=en}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
This document may be used under the terms the GNU General Public License
@@ -198,17 +205,20 @@ Then follow instructions for source package - @xref{Source package}.
@chapter Usage
@menu
* Run WeeChat::
* Run WeeChat::
* Config file::
* Key bindings::
* WeeChat commands::
@end menu
@node Run WeeChat, Key bindings, Usage, Usage
@node Run WeeChat, Config file, Usage, Usage
@section Run WeeChat
@subsection Command line parameters
@table @code
@item -c, --config
Display config file help (list of options)@*
@item -h, --help
Display help screen@*
@item -l, --license
@@ -220,7 +230,7 @@ Display WeeChat version@*
@subsection Run WeeChat
Just issue this command to run WeeChat:@*
@kbd{weechat}@*
@kbd{weechat-curses} (for Curses front-end)@*
or @kbd{weechat-gtk} (for Gtk front-end)@*
or @kbd{weechat-qt} (for Qt front-end)@*
@@ -231,7 +241,306 @@ The default configuration file is: ~/.weechat/weechat.rc@*
You can edit this file at your convenience to configure WeeChat, or you can
set parameters with @kbd{/set} command in WeeChat - @xref{WeeChat commands}.
@node Key bindings, WeeChat commands, Run WeeChat, Usage
@node Config file, Key bindings, Run WeeChat, Usage
@section Config file
Here is a list of all options for config file:@*
@table @kbd
@item look_set_title
Set title for window (terminal for Curses GUI) with name & version@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_startup_logo
Display WeeChat logo at startup@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_startup_version
Display WeeChat version at startup@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_weechat_slogan
WeeChat slogan (if empty, slogan is not used)@*
Type: string (any string), default value: 'the geekest IRC client!'@*
@item look_color_nicks
Display nick names with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist_position
Nicklist position (top, left, right (default), bottom)@*
Type: string (values: 'left', 'right', 'top', 'bottom'), default value: 'right'@*
@item look_nicklist_min_size
Min size for nicklist (width or height, depending on look_nicklist_position (0 = no min size))@*
Type: integer (values: between 0 and 100), default value: 0@*
@item look_nicklist_max_size
Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min == max and > 0, then size is fixed))@*
Type: integer (values: between 0 and 100), default value: 0@*
@item look_no_nickname
Text to display instead of nick when not connected@*
Type: string (any string), default value: '-cmd-'@*
@item look_nickmode
Display nick mode ((half)op/voice) before each nick@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nickmode_empty
Display space if nick mode is not (half)op/voice@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item look_nick_completor
The string inserted after nick completion@*
Type: string (any string), default value: ':'@*
@item look_infobar
Enable info bar@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_infobar_timestamp
Timestamp for time in infobar@*
Type: string (any string), default value: '%B, %A %d %G - %H:%M'@*
@item look_infobar_delay_highlight
Delay (in seconds) for highlight messages in infobar (0 = disable highlight notifications in infobar)@*
Type: integer (values: between 0 and 2147483647), default value: 7@*
@item col_title
Color for title bar@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_title_bg
Background for title bar@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_chat
Color for chat text@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_chat_time
Color for time in chat window@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_chat_time_sep
Color for time separator (chat window)@*
Type: color (Curses or Gtk color), default value: 'brown'@*
@item col_chat_prefix1
Color for 1st and 3rd char of prefix@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_chat_prefix2
Color for middle char of prefix@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_chat_nick
Color for nicks in actions (chat window)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_chat_host
Color for hostnames (chat window)@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_chat_channel
Color for channel names in actions (chat window)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_chat_dark
Color for dark separators (chat window)@*
Type: color (Curses or Gtk color), default value: 'green'@*
@item col_chat_highlight
Color for highlighted nick (chat window)@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_chat_bg
Background for chat window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item col_status
Color for status bar@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_status_active
Color for active window (status bar)@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_status_data_msg
Color for window with new messages (status bar)@*
Type: color (Curses or Gtk color), default value: 'lightred'@*
@item col_status_data_other
Color for window with new data (not messages) (status bar)@*
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
@item col_status_more
Color for window with new data (status bar)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_status_bg
Background for status window@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_infobar_bg
Background for info bar window@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input
Color for input text@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_input_channel
Color for input text (channel name)@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_input_nick
Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item col_nick
Color for nicknames@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_nick_op
Color for operator symbol@*
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
@item col_nick_halfop
Color for half-operator symbol@*
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
@item col_nick_voice
Color for voice symbol@*
Type: color (Curses or Gtk color), default value: 'yellow'@*
@item col_nick_sep
Color for nick separator@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_nick_self
Color for local nick@*
Type: color (Curses or Gtk color), default value: 'white'@*
@item col_nick_private
Color for other nick in private window@*
Type: color (Curses or Gtk color), default value: 'gray'@*
@item col_nick_bg
Background for nicknames@*
Type: color (Curses or Gtk color), default value: 'default'@*
@item history_max_lines
Maximum number of lines in history for one server/channel/private window (0 = unlimited)@*
Type: integer (values: between 0 and 2147483647), default value: 4096@*
@item history_max_commands
Maximum number of user commands in history (0 = unlimited)@*
Type: integer (values: between 0 and 2147483647), default value: 100@*
@item log_auto_channels
Automatically log channel chats@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item log_auto_private
Automatically log private chats@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item log_path
Path for WeeChat log files@*
Type: string (any string), default value: '~/.weechat/logs/'@*
@item log_name
Name for log files (%S == irc server name, %N == channel name (or nickname if private chat)@*
Type: string (any string), default value: '%S,%N.weechatlog'@*
@item log_timestamp
Timestamp for log (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '~'@*
@item log_start_string
Text written when starting new log file (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '--- Log started %a %b %d %Y %H:%M:%s'@*
@item log_end_string
Text written when ending log file (see man strftime for date/time specifiers)@*
Type: string (any string), default value: '--- Log ended %a %b %d %Y %H:%M:%s'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_max_size
Maximum size for incoming file when automatically accepted@*
Type: integer (values: between 0 and 2147483647), default value: 0@*
@item dcc_auto_accept_chats
Automatically accept dcc chats (use carefully!)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_timeout
Timeout for dcc request (in seconds)@*
Type: integer (values: between 1 and 2147483647), default value: 300@*
@item dcc_download_path
Path for writing incoming files with dcc (default: user home)@*
Type: string (any string), default value: '~'@*
@item dcc_upload_path
Path for reading files when sending thru dcc (when no path is specified)@*
Type: string (any string), default value: '~'@*
@item dcc_auto_rename
Rename incoming files if already exists (add '.1', '.2', ...)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_resume
Automatically resume dcc transfer if connection with remote host is loosed@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item proxy_use
Use a proxy server to connect to irc server@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item proxy_address
Proxy server address (IP or hostname)@*
Type: string (any string), default value: ''@*
@item proxy_port
Port for connecting to proxy server@*
Type: integer (values: between 0 and 65535), default value: 1080@*
@item proxy_password
Password for proxy server@*
Type: string (any string), default value: ''@*
@item server_name
Name associated to IRC server (for display only)@*
Type: string (any string), default value: ''@*
@item server_autoconnect
Automatically connect to server when WeeChat is starting@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item server_address
IP address or hostname of IRC server@*
Type: string (any string), default value: ''@*
@item server_port
Port for connecting to server@*
Type: integer (values: between 0 and 65535), default value: 6667@*
@item server_password
Password for IRC server@*
Type: string (any string), default value: ''@*
@item server_nick1
Nickname to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_nick2
Alternate nickname to use on IRC server (if nickname is already used)@*
Type: string (any string), default value: ''@*
@item server_nick3
2nd alternate nickname to use on IRC server (if alternate nickname is already used)@*
Type: string (any string), default value: ''@*
@item server_username
User name to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_realname
Real name to use on IRC server@*
Type: string (any string), default value: ''@*
@item server_command
First command to run when connected to server@*
Type: string (any string), default value: ''@*
@item server_autojoin
Comma separated list of channels to join when connected to server@*
Type: string (any string), default value: ''@*
@end table
Colors for Curses GUI are:@*
@itemize @minus
@item
@kbd{default}: default color (transparent for background)
@item
@kbd{black}: black
@item
@kbd{red}: dark red
@item
@kbd{lightred}: light red
@item
@kbd{green}: dark green
@item
@kbd{lightgreen}: light green
@item
@kbd{brown}: brown
@item
@kbd{yellow}: yellow
@item
@kbd{blue}: dark blue
@item
@kbd{lightblue}: light blue
@item
@kbd{magenta}: dark magenta
@item
@kbd{lightmagenta}: light magenta
@item
@kbd{cyan}: dark cyan
@item
@kbd{lightcyan}: light cyan
@item
@kbd{gray}: gray
@item
@kbd{white}: white
@end itemize
@node Key bindings, WeeChat commands, Config file, Usage
@section Key bindings
@table @kbd
@@ -271,6 +580,9 @@ Switch to previous / next window@*
@item Alt + left arrow / Alt + right arrow
Same as F6 / F7@*
@*
@item F10
Remove last infobar message@*
@*
@end table
@node WeeChat commands, , Key bindings, Usage
@@ -345,6 +657,39 @@ Print message in current window (channel or server).@*
@code{IRC::print ("message");}@*
@*
@item
@command{IRC::print_with_channel ( channel, [server,] message );}@*
@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@item @option{message}: message to display
@end itemize
@*
@emph{Examples:}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
@code{IRC::print_with_channel ("#weechat", "message");}@*
@*
@item
@command{IRC::print_infobar ( delay, message );}@*
@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Example:}@*
@code{IRC::print_infobar (5, "message");}@*
@*
@item
@command{IRC::add_message_handler ( name, function );}@*
@*
@@ -466,7 +811,7 @@ Support with IRC:@*
- server: @b{irc.freenode.net}@*
- channel: @b{#weechat}@*@*
@item
WeeChat forum: soon!@*@*
WeeChat forum: @uref{http://forums.flashtux.org}@*@*
@item
Support with mailing list:@*
- to subscribe/unsubscribe:@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -486,7 +831,7 @@ Look for WeeChat support page for detail:@*
This manual documents WeeChat IRC client, it is part of WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
This document may be used under the terms the GNU General Public License
+360 -15
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (french version)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_fr.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_fr.texi
@@ -28,7 +35,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.0.4 - 23 novembre 2003
@subtitle Documentation pour WeeChat v0.0.6 - 5 juin 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
La derni@`ere version de ce document peut @^etre t@'el@'echarg@'ee sur cette page :@*
@uref{http://weechat.flashtux.org/doc.php}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
@@ -198,17 +205,20 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
@chapter Utilisation
@menu
* Lancer WeeChat::
* Lancer WeeChat::
* Fichier de configuration::
* Raccourcis clavier::
* Commandes WeeChat::
@end menu
@node Lancer WeeChat, Raccourcis clavier, Utilisation, Utilisation
@node Lancer WeeChat, Fichier de configuration, Utilisation, Utilisation
@section Lancer WeeChat
@subsection Param@`etres de ligne de commande
@table @code
@item -c, --config
Afficher l'aide sur le fichier de config (liste des options)@*
@item -h, --help
Afficher l'aide@*
@item -l, --license
@@ -220,7 +230,7 @@ Afficher la version de WeeChat@*
@subsection Lancer WeeChat
Tapez simplement cette commande pour lancer WeeChat :@*
@kbd{weechat-curses}@*
@kbd{weechat-curses} (pour l'interface Curses)@*
ou @kbd{weechat-gtk} (pour l'interface Gtk)@*
ou @kbd{weechat-qt} (pour l'interface Qt)@*
@@ -231,7 +241,306 @@ Le fichier de configuration par d@'efaut est : ~/.weechat/weechat.rc@*
Vous pouvez @'editer ce fichier pour configurer WeeChat @`a votre convenance, ou
vous pouvez modifier les param@`etres dans WeeChat avec la commande @kbd{/set} - @xref{Commandes WeeChat}.
@node Raccourcis clavier, Commandes WeeChat, Lancer WeeChat, Utilisation
@node Fichier de configuration, Raccourcis clavier, Lancer WeeChat, Utilisation
@section Fichier de configuration
Liste des options du fichier de configuration :@*
@table @kbd
@item look_set_title
D@'efinit le titre de la fen@^etre (terminal pour l'interface Curses) avec le nom et la version@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_startup_logo
Afficher le logo WeeChat au d@'emarrage@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_startup_version
Afficher la version de WeeChat au d@'emarrage@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_weechat_slogan
Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
@item look_color_nicks
Afficher les utilisateurs avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_color_actions
Afficher les actions avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_remove_colors_from_msgs
Supprimer les couleurs dans les messages entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist
Afficher la fen@^etre des utilisateurs (pour les fen@^etres de canaux)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist_position
Position de la fen@^etre d'utilisateurs (haut (top), gauche (left), droite (right, par d@'efaut), bas (bottom))@*
Type: cha@^ine (valeurs: 'left', 'right', 'top', 'bottom'), valeur par d@'efaut: 'right'@*
@item look_nicklist_min_size
Taille minimum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille minimum))@*
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
@item look_nicklist_max_size
Taille maximum pour la fen@^etre d'utilisateurs (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min == max et > 0, alors la taille est fixe))@*
Type: entier (valeurs: entre 0 et 100), valeur par d@'efaut: 0@*
@item look_no_nickname
Texte @`a afficher en lieu et place du nom d'utilisateur lorsque la connexion n'est pas active@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '-cmd-'@*
@item look_nickmode
Afficher le mode de l'utilisateur ((half)op/voice) devant chaque utilisateur@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nickmode_empty
Afficher un espace si le mode utilisateur n'est pas (half)op/voice@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item look_nick_completor
La cha@^ine affich@'ee apr@`es la compl@'etion des utilisateurs@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ':'@*
@item look_infobar
Active la barre d'infos@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_infobar_timestamp
Horodatage pour les conversations sauvegard@'ees@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %G - %H:%M'@*
@item look_infobar_delay_highlight
D@'elai (en secondes) pour la notification des messages dans la barre d'infos (0 = d@'esactiver les notifications dans la barre d'infos)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 7@*
@item col_title
Couleur pour la barre de titre@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_title_bg
Couleur de fond pour la barre de titre@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_chat
Couleur pour le texte de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_chat_time
Couleur pour l'heure dans la fen@^etre de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_chat_time_sep
Couleur pour la s@'eparation de l'heure (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'brown'@*
@item col_chat_prefix1
Couleur pour le 1er et le 3@`eme caract@`ere du pr@'efixe@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_chat_prefix2
Couleur pour le caract@`ere du milieu du pr@'efixe@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_chat_nick
Couleur pour les noms d'utilisateurs dans les actions (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_chat_host
Couleur pour les noms de machines (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_chat_channel
Couleur pour les canaux dans les actions (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_chat_dark
Couleur pour les s@'eparateurs sombres (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'green'@*
@item col_chat_highlight
Couleur pour le pseudo surlign@'e (fen@^etre de discussion)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_chat_bg
Couleur de fond pour la fen@^etre de discussion@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item col_status
Couleur pour la barre de statut@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_status_active
Couleur pour la fen@^etre active (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_status_data_msg
Couleur pour une fen@^etre avec de nouvelles infos (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
@item col_status_data_other
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
@item col_status_more
Couleur pour une fen@^etre avec des nouvelles donn@'ees (barre de statut)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_status_bg
Couleur de fond pour la fen@^etre de statut@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar
Couleur pour la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'black'@*
@item col_infobar_highlight
Couleur pour la notification dans la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_infobar_bg
Couleur de fond pour la fen@^etre de barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_input
Couleur pour le texte saisi@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_input_channel
Couleur pour le texte saisi (nom du canal)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_input_nick
Couleur pour le texte saisi (pseudo)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
@item col_input_bg
Couleur de fond pour la fen@^etre de saisie@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item col_nick
Couleur pour les pseudos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_nick_op
Couleur pour le symbole op@'erateur@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
@item col_nick_halfop
Couleur pour le symbole demi-op@'erateur@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
@item col_nick_voice
Couleur pour le symbole voix@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
@item col_nick_sep
Couleur pour le s@'eparateur de pseudo@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_nick_self
Couleur pour le pseudo local@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@item col_nick_private
Couleur pour l'autre pseudo dans la fen@^etre priv@'ee@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
@item col_nick_bg
Couleur de fond pour les pseudos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@item history_max_lines
Nombre maximum de lignes dans l'historique pour un serveur/fen@^etre/fen@^etre priv@'ee (0 = sans limite)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 4096@*
@item history_max_commands
Nombre maximum de commandes utilisateur dans l'historique (0 = sans limite)@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 100@*
@item log_auto_channels
Enregistrer automatiquement les conversations des canaux@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item log_auto_private
Enregistrer automatiquement les conversations priv@'ees@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item log_path
Chemin pour les conversations sauvegard@'ees par WeeChat@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
@item log_name
Nom des conversations saivegard@'ees (%S == nom du serveur irc, %N == nom du canal (ou pseudo si fen@^etre priv@'ee)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%S,%N.weechatlog'@*
@item log_timestamp
Horodatage pour les conversations sauvegard@'ees (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item log_start_string
Texte @'ecrit en d@'emarrant la sauvegarde d'une discussion (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '--- Log started %a %b %d %Y %H:%M:%s'@*
@item log_end_string
Texte @'ecrit @`a la fin d'une discussion sauvegard@'ees (voir man strftime pour le format de date/heure)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '--- Log ended %a %b %d %Y %H:%M:%s'@*
@item dcc_auto_accept_files
Accepte automatiquement les fichiers dcc entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_accept_max_size
Taille maximum pour un fichier entrant lorsqu'il est accept@'e automatiquement@*
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 0@*
@item dcc_auto_accept_chats
Accepte automatiquement les demandes de discussion dcc (@`a utiliser avec pr@'ecaution !)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_timeout
D@'elai d'attente pour les requ@^etes dcc (en secondes)@*
Type: entier (valeurs: entre 1 et 2147483647), valeur par d@'efaut: 300@*
@item dcc_download_path
Chemin pour @'ecrire les fichiers re@,{c}us par dcc (par d@'efaut: r@'epertoire de l'utilisateur)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item dcc_upload_path
Chemin pour lire les fichiers lorsqu'ils sont envoy@'es par dcc (quand aucun chemin n'est sp@'ecifi@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
@item dcc_auto_rename
Renommer les fichiers re@,{c}us s'ils existent d@'ej@`a (ajoute '.1', '.2', ...)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_resume
Continuer automatiquement les transferts dcc si la connexion avec la machine distante a @'et@'e perdue@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item proxy_use
Utiliser un proxy pour se connecter au serveur irc@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item proxy_address
Adresse du serveur proxy (IP ou nom)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item proxy_port
Port pour se connecter au serveur proxy@*
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 1080@*
@item proxy_password
Mot de passe pour le serveur proxy@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_name
Nom associ@'e au serveur IRC (pour affichage seulement)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_autoconnect
Connexion automatique au serveur quand WeeChat d@'emarre@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item server_address
Adresse IP ou nom du serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_port
Port pour se connecter au serveur@*
Type: entier (valeurs: entre 0 et 65535), valeur par d@'efaut: 6667@*
@item server_password
Mot de passe pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick1
Pseudo @`a utiliser sur le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick2
Pseudo alternatif pour le serveur IRC (si le pseudo est d@'ej@`a utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_nick3
2nd pseudo alternatif pour le serveur IRC (si le pseudo alternatif est d@'ej@`a utilis@'e)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_username
Nom d'utilisateur pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_realname
Nom r@'eel pour le serveur IRC@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_command
Commande @`a ex@'ecuter en premier lorsque connect@'e au serveur@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item server_autojoin
Liste des canaux (s@'epar@'es par des virgules) @`a rejoindre lorsque connect@'e au serveur@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@end table
Les couleurs pour l'interface Curses sont :@*
@itemize @minus
@item
@kbd{default}: couleur par d@'efaut (transparent pour le fond)
@item
@kbd{black}: noir
@item
@kbd{red}: rouge fonc@'e
@item
@kbd{lightred}: rouge clair
@item
@kbd{green}: vert fonc@'e
@item
@kbd{lightgreen}: vert clair
@item
@kbd{brown}: marron
@item
@kbd{yellow}: jaune
@item
@kbd{blue}: bleu fonc@'e
@item
@kbd{lightblue}: bleu clair
@item
@kbd{magenta}: violet fonc@'e
@item
@kbd{lightmagenta}: violet clair
@item
@kbd{cyan}: cyan fonc@'e
@item
@kbd{lightcyan}: cyan clair
@item
@kbd{gray}: gris
@item
@kbd{white}: blanc
@end itemize
@node Raccourcis clavier, Commandes WeeChat, Fichier de configuration, Utilisation
@section Raccourcis clavier
@table @kbd
@@ -271,6 +580,9 @@ Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
Identique @`a F6 / F7@*
@*
@item F10
Effacer le dernier message de la barre d'infos@*
@*
@end table
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
@@ -345,6 +657,39 @@ Affiche un message dans la fen@^etre courante (canal ou serveur).@*
@code{IRC::print ("message");}@*
@*
@item
@command{IRC::print_with_channel ( canal, [serveur,] message );}@*
@*
Affiche un message dans un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Exemples :}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "message");}@*
@code{IRC::print_with_channel ("#weechat", "message");}@*
@*
@item
@command{IRC::print_infobar ( d@'elai, message );}@*
@*
Affiche un message dans la barre d'infos.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{d@'elai}: d@'elai (en secondes) pendant lequel le message est affich@'e
(si 0, le message ne sera pas effac@'e).
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Exemple :}@*
@code{IRC::print_infobar (5, "message");}@*
@*
@item
@command{IRC::add_message_handler ( nom, fonction );}@*
@*
@@ -466,7 +811,7 @@ Support par IRC:@*
- serveur : @b{irc.freenode.net}@*
- canal : @b{#weechat}@*@*
@item
Forum WeeChat : bient@^ot !@*@*
Forum WeeChat : @uref{http://forums.flashtux.org}@*@*
@item
Support par la liste de diffusion :@*
- pour souscrire/d@'esinscrire :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -486,7 +831,7 @@ Voir la page support WeeChat pour plus de d@'etails :@*
Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
+57 -12
View File
@@ -6,14 +6,21 @@
@c WeeChat documentation (vers@~ao partuguesa)
@c
@c Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
@c Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
@c
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.2
@c or any later version published by the Free Software Foundation;
@c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
@c A copy of the license is included in the section entitled "GNU
@c Free Documentation License".
@c This manual is free software; you can redistribute it and/or modify
@c it under the terms of the GNU General Public License as published by
@c the Free Software Foundation; either version 2 of the License, or
@c (at your option) any later version.
@c
@c This manual is distributed in the hope that it will be useful,
@c but WITHOUT ANY WARRANTY; without even the implied warranty of
@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with this program; if not, write to the Free Software
@c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@c pdf : texi2pdf weechat_doc_pt.texi
@c html: makeinfo --html --no-split --number-sections weechat_doc_pt.texi
@@ -28,7 +35,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.3 - 23 de Novembro de 2003
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.6 - 05 de Junho de 2004
@image{weechat_image}
@@ -41,7 +48,7 @@ Este manual documenta o cliente de IRC WeeChat, ele faz parte do WeeChat.@*
A ultima versĂŁo deste documento pode ser descarregada de :@*
@uref{http://weechat.flashtux.org/doc.php}@*
@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
@*
Este documento pode ser utilizado sobre os termos da Licen@,{c}a P@'ublica geral GNU (GNU General Public
@@ -207,6 +214,8 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
@subsection Par@^ametros de linha de comandos
@table @code
@item -c, --config
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
@item -h, --help
Mostrar a ajuda@*
@item -l, --license
@@ -218,7 +227,7 @@ Mostrar a vers@~ao do WeeChat@*
@subsection Invocar o WeeChat
Escreve simplesmente este comando para invoceres o WeeChat :@*
@kbd{weechat-curses}@*
@kbd{weechat-curses} (para a interface em Curses)@*
ou @kbd{weechat-gtk} (para a interface em Gtk)@*
ou @kbd{weechat-qt} (para a interface em Qt)@*
@@ -268,6 +277,9 @@ Ir para a janela anterior/seguinte@*
@item Alt + Seta da esquerda / Alt + Seta da direita
Identico a F6 / F7@*
@*
@item F10
Apagar a @'ultima mensagem da barra do info@*
@*
@end table
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
@@ -340,6 +352,39 @@ Imprimne uma mensagem na janela actual (canal ou servidor).@*
@code{IRC::print ("mensagem");}@*
@*
@item
@command{IRC::print_with_channel ( canal, [servidor,] mensagem );}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Exemplos:}@*
@code{IRC::print_with_channel ("#weechat", "freenode", "mensagem");}@*
@code{IRC::print_with_channel ("#weechat", "mensagem");}@*
@*
@item
@command{IRC::print_infobar ( atrasa, mensagem );}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Exemplo:}@*
@code{IRC::print_infobar (5, "mensagem");}@*
@*
@item
@command{IRC::add_message_handler ( nome, fun@,{c}@~ao );}@*
@*
@@ -457,7 +502,7 @@ Suporte por IRC:@*
- servidor : @b{irc.freenode.net}@*
- canal : @b{#weechat}@*@*
@item
Forum do WeeChat : mais tarde !@*@*
Forum do WeeChat : @uref{http://forums.flashtux.org}@*@*
@item
Suporte por lista de correio-e :@*
- para te inscreveres/desinscreveres :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
@@ -477,7 +522,7 @@ Para mais detalhes, v@^e tamb@'em a p@'agina de suporte do WeeChat :@*
Este manual documenta o cliente de IRC WeeChat, Ele faz parte do WeeChat.@*
Copyright @copyright{} 2003 FlashCode
Copyright @copyright{} 2004 FlashCode
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
Tradu@,{c}@~ao portuguesa de Jo@~ao Jer@'onimo <@email{j_j_b_o@@sapo.pt, j_j_b_o AT sapo.pt}>@*
@*
+869 -617
View File
File diff suppressed because it is too large Load Diff
+908 -669
View File
File diff suppressed because it is too large Load Diff
+167 -81
View File
@@ -84,7 +84,7 @@ t_weechat_command weechat_commands[] =
0, 1, weechat_cmd_save, NULL },
{ "set", N_("set config parameters"),
N_("[option [value]]"), N_("option: name of an option\nvalue: value for option"),
0, 2, weechat_cmd_set, NULL },
0, MAX_ARGS, NULL, weechat_cmd_set },
{ "unalias", N_("remove an alias"),
N_("alias_name"), N_("alias_name: name of alias to remove"),
1, 1, NULL, weechat_cmd_unalias },
@@ -207,14 +207,14 @@ index_command_build ()
i = 0;
while (weechat_commands[i].command_name)
{
index_command_new (weechat_commands[i].command_name);
(void) index_command_new (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)
index_command_new (irc_commands[i].command_name);
(void) index_command_new (irc_commands[i].command_name);
i++;
}
}
@@ -363,8 +363,11 @@ alias_new (char *alias_name, char *alias_command)
{
new_alias->alias_name = strdup (alias_name);
new_alias->alias_command = (char *)malloc (strlen (alias_command) + 2);
new_alias->alias_command[0] = '/';
strcpy (new_alias->alias_command + 1, alias_command);
if (new_alias->alias_command)
{
new_alias->alias_command[0] = '/';
strcpy (new_alias->alias_command + 1, alias_command);
}
alias_insert_sorted (new_alias);
return new_alias;
}
@@ -409,7 +412,7 @@ alias_free (t_weechat_alias *alias)
*/
char **
explode_string (char *string, char *separators, int num_items_max,
explode_string (/*@null@*/ char *string, char *separators, int num_items_max,
int *num_items)
{
int i, n_items;
@@ -502,7 +505,7 @@ exec_weechat_command (t_irc_server *server, char *string)
char *command, *pos, *ptr_args, **argv, *alias_command;
t_weechat_alias *ptr_alias;
if ((!string[0]) || (string[0] != '/'))
if ((!string) || (!string[0]) || (string[0] != '/'))
return 0;
command = strdup (string);
@@ -572,6 +575,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -630,6 +634,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -643,14 +648,18 @@ exec_weechat_command (t_irc_server *server, char *string)
length1 = strlen (ptr_alias->alias_command);
length2 = strlen (ptr_args);
alias_command = (char *)malloc (length1 + 1 + length2 + 1);
strcpy (alias_command, ptr_alias->alias_command);
alias_command[length1] = ' ';
strcpy (alias_command + length1 + 1, ptr_args);
exec_weechat_command (server, alias_command);
free (alias_command);
if (alias_command)
{
strcpy (alias_command, ptr_alias->alias_command);
alias_command[length1] = ' ';
strcpy (alias_command + length1 + 1, ptr_args);
}
(void) exec_weechat_command (server, alias_command);
if (alias_command)
free (alias_command);
}
else
exec_weechat_command (server, ptr_alias->alias_command);
(void) exec_weechat_command (server, ptr_alias->alias_command);
if (argv)
{
@@ -658,6 +667,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv[j]);
free (argv);
}
free (command);
return 1;
}
}
@@ -672,6 +682,7 @@ exec_weechat_command (t_irc_server *server, char *string)
free (argv);
}
}
free (command);
return 0;
}
@@ -690,7 +701,7 @@ user_command (t_irc_server *server, char *command)
if ((command[0] == '/') && (command[1] != '/'))
{
/* WeeChat internal command (or IRC command) */
exec_weechat_command (server, command);
(void) exec_weechat_command (server, command);
}
else
{
@@ -768,7 +779,7 @@ weechat_cmd_alias (char *arguments)
}
if (!alias_new (arguments, pos))
return -1;
index_command_new (arguments);
(void) index_command_new (arguments);
gui_printf (NULL, _("Alias \"%s\" => \"%s\" created\n"),
arguments, pos);
}
@@ -847,7 +858,10 @@ weechat_cmd_connect (int argc, char **argv)
return -1;
}
if (!ptr_server->window)
gui_window_new (ptr_server, NULL, 1);
{
if (!gui_window_new (ptr_server, NULL, 1))
return -1;
}
if (server_connect (ptr_server))
{
irc_login (ptr_server);
@@ -990,7 +1004,7 @@ weechat_cmd_perl (int argc, char **argv)
#ifdef PLUGINS
t_plugin_script *ptr_plugin_script;
t_plugin_handler *ptr_plugin_handler;
int handler_found;
int handler_found, path_length;
char *path_script;
#ifdef PLUGIN_PERL
@@ -1081,10 +1095,11 @@ weechat_cmd_perl (int argc, char **argv)
path_script = NULL;
else
{
path_script = (char *) malloc ((strlen (weechat_home) +
strlen (argv[1]) + 7) * sizeof (char));
sprintf (path_script, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "perl", DIR_SEPARATOR, argv[1]);
path_length = strlen (weechat_home) + strlen (argv[1]) + 7;
path_script = (char *) malloc (path_length * sizeof (char));
snprintf (path_script, path_length, "%s%s%s%s%s",
weechat_home, DIR_SEPARATOR, "perl",
DIR_SEPARATOR, argv[1]);
}
plugin_load (PLUGIN_TYPE_PERL,
(path_script) ? path_script : argv[1]);
@@ -1167,8 +1182,11 @@ weechat_cmd_server (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL,
COLOR_WIN_CHAT,
_(" Autoconnect: %s\n"),
(ptr_server->autoconnect) ? _("yes") : _("no"));
_(" Autoconnect: %s%s\n"),
(ptr_server->autoconnect) ? _("yes") : _("no"),
(ptr_server->command_line) ?
_(" (temporary server, will not be saved)") :
"");
irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL,
COLOR_WIN_CHAT,
@@ -1399,11 +1417,11 @@ weechat_cmd_server (int argc, char **argv)
}
/* create new server */
new_server = server_new (server.name, server.autoconnect, server.address,
server.port, server.password, server.nick1,
server.nick2, server.nick3, server.username,
server.realname, server.command,
server.autojoin);
new_server = server_new (server.name, server.autoconnect, 0,
server.address, server.port, server.password,
server.nick1, server.nick2, server.nick3,
server.username, server.realname,
server.command, server.autojoin);
if (new_server)
{
irc_display_prefix (NULL, PREFIX_INFO);
@@ -1423,7 +1441,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
gui_window_new (new_server, NULL, 1);
(void) gui_window_new (new_server, NULL, 1);
if (server_connect (new_server))
irc_login (new_server);
}
@@ -1438,72 +1456,140 @@ weechat_cmd_server (int argc, char **argv)
*/
int
weechat_cmd_set (int argc, char **argv)
weechat_cmd_set (char *arguments)
{
char *option, *value;
int i, j, section_displayed;
char *color_name;
t_config_option *ptr_option;
int number_found;
/* TODO: complete /set command */
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
option = NULL;
value = NULL;
if (arguments && arguments[0])
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
option = arguments;
value = strchr (option, ' ');
if (value)
{
for (j = 0; weechat_options[i][j].option_name; j++)
value[0] = '\0';
value++;
while (value[0] == ' ')
value++;
}
}
if (value && value[0])
{
ptr_option = config_option_search (option);
if (ptr_option)
{
if (ptr_option->handler_change == NULL)
{
if ((argc == 0) ||
((argc > 0)
&& (strstr (weechat_options[i][j].option_name, argv[0])
!= NULL)))
gui_printf (NULL,
_("%s option '%s' can not be changed while WeeChat is running\n"),
WEECHAT_ERROR, option);
}
else
{
if (config_option_set_value (ptr_option, value) == 0)
{
if (!section_displayed)
(void) (ptr_option->handler_change());
gui_printf (NULL, "[%s]\n", config_get_section (ptr_option));
gui_printf (NULL, " %s = %s\n", option, value);
}
else
gui_printf (NULL, _("%s incorrect value for option '%s'\n"),
WEECHAT_ERROR, option);
}
}
else
{
gui_printf (NULL, _("%s config option '%s' not found\n"),
WEECHAT_ERROR, option);
}
}
else
{
number_found = 0;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option)
!= NULL)))
{
gui_printf (NULL, "[%s]\n",
config_sections[i].section_name);
section_displayed = 1;
}
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].option_name,
(*weechat_options[i][j].ptr_int) ?
"ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf (NULL,
" %s = %d\n",
weechat_options[i][j].option_name,
*weechat_options[i][j].ptr_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].
option_name,
(*weechat_options[i][j].
ptr_string) ?
*weechat_options[i][j].
ptr_string : "");
break;
if (!section_displayed)
{
gui_printf (NULL, "[%s]\n",
config_sections[i].section_name);
section_displayed = 1;
}
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].option_name,
(*weechat_options[i][j].ptr_int) ?
"ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf (NULL,
" %s = %d\n",
weechat_options[i][j].option_name,
*weechat_options[i][j].ptr_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*weechat_options[i][j].ptr_int);
gui_printf (NULL,
" %s = %s\n",
weechat_options[i][j].option_name,
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
gui_printf (NULL, " %s = %s\n",
weechat_options[i][j].
option_name,
(*weechat_options[i][j].
ptr_string) ?
*weechat_options[i][j].
ptr_string : "");
break;
}
number_found++;
}
}
}
}
if (number_found == 0)
{
if (value)
gui_printf (NULL, _("No config option found with '%s'\n"),
value);
else
gui_printf (NULL, _("No config option found with '%s'\n"));
}
else
{
if (value)
gui_printf (NULL, _("%d config option(s) found with '%s'\n"),
number_found, value);
else
gui_printf (NULL, _("%d config option(s) found\n"),
number_found);
}
}
gui_printf (NULL, "(TODO) \"/set\" command not fully developed!\n");
return 0;
}
+1 -1
View File
@@ -74,7 +74,7 @@ extern int weechat_cmd_help (int, char **);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_save (int, char **);
extern int weechat_cmd_server (int, char **);
extern int weechat_cmd_set (int, char **);
extern int weechat_cmd_set (char *);
extern int weechat_cmd_unalias (char *);
#endif /* command.h */
+177 -37
View File
@@ -62,6 +62,8 @@ int quit_weechat; /* = 1 if quit request from user... why ? :'( */
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log) */
int server_cmd_line; /* at least one server on WeeChat command line */
/*
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
@@ -95,13 +97,89 @@ wee_log_printf (char *message, ...)
seconds = time (NULL);
date_tmp = localtime (&seconds);
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
buffer);
if (date_tmp)
fprintf (log_file, "[%04d-%02d-%02d %02d:%02d:%02d] %s",
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1, date_tmp->tm_mday,
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
buffer);
else
fprintf (log_file, "[????-??-?? ??:??:??] %s", buffer);
fflush (log_file);
}
/*
* wee_display_config_options: display config options
*/
void wee_display_config_options ()
{
int i, j, k;
printf (_("WeeChat configuration options (~/.weechat/weechat.rc):\n\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if (weechat_options[i])
{
j = 0;
while (weechat_options[i][j].option_name)
{
printf ("* %s:\n",
weechat_options[i][j].option_name);
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
printf (_(" . type boolean (values: 'on' or 'off')\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_int == BOOL_TRUE) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
printf (_(" . type integer (values: between %d and %d)\n"),
weechat_options[i][j].min,
weechat_options[i][j].max);
printf (_(" . default value: %d\n"),
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
printf (_(" . type string (values: "));
k = 0;
while (weechat_options[i][j].array_values[k])
{
printf ("'%s'",
weechat_options[i][j].array_values[k]);
if (weechat_options[i][j].array_values[k + 1])
printf (", ");
k++;
}
printf (")\n");
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
case OPTION_TYPE_COLOR:
printf (_(" . type color (Curses or Gtk color, look at WeeChat doc)\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
case OPTION_TYPE_STRING:
printf (_(" . type string (any string)\n"));
printf (_(" . default value: '%s'\n"),
(weechat_options[i][j].default_string) ?
weechat_options[i][j].default_string : _("empty"));
break;
}
printf (_(" . description: %s\n\n"),
gettext (weechat_options[i][j].long_description));
j++;
}
}
}
printf (_("Moreover, you can define aliases in [alias] section, by adding lines like:\n"));
printf ("j=join\n");
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
}
/*
* wee_parse_args: parse command line args
*/
@@ -110,26 +188,56 @@ void
wee_parse_args (int argc, char *argv[])
{
int i;
t_irc_server server_tmp;
server_cmd_line = 0;
for (i = 1; i < argc; i++)
{
if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
if ((strcmp (argv[i], "-c") == 0)
|| (strcmp (argv[i], "--config") == 0))
{
printf ("\n%s%s", WEE_USAGE);
exit (0);
wee_display_config_options ();
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
{
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
printf ("%s", WEE_USAGE2);
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
printf ("\n%s%s", WEE_LICENSE);
exit (0);
exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "-v") == 0)
|| (strcmp (argv[i], "--version") == 0))
{
printf (PACKAGE_VERSION "\n");
exit (0);
exit (EXIT_SUCCESS);
}
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
{
if (server_init_with_url (argv[i], &server_tmp) < 0)
{
fprintf (stderr, _("%s invalid syntax for IRC server ('%s'), ignored\n"),
WEECHAT_WARNING, argv[i]);
}
else
{
if (!server_new (server_tmp.name, 0, 1,
server_tmp.address, server_tmp.port,
server_tmp.password, server_tmp.nick1,
server_tmp.nick2, server_tmp.nick3,
NULL, NULL, NULL, server_tmp.autojoin))
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
WEECHAT_WARNING, argv[i]);
server_destroy (&server_tmp);
server_cmd_line = 1;
}
}
else
{
@@ -173,48 +281,78 @@ wee_create_dir (char *directory)
void
wee_create_home_dirs ()
{
char *dir_name;
char *ptr_home, *dir_name;
int dir_length;
/* TODO: rewrite this code for Windows version */
ptr_home = getenv ("HOME");
if (!ptr_home)
{
fprintf (stderr, _("%s unable to get HOME directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
dir_length = strlen (ptr_home) + 10;
weechat_home =
(char *) malloc ((strlen (getenv ("HOME")) + 10) * sizeof (char));
sprintf (weechat_home, "%s%s.weechat", getenv ("HOME"), DIR_SEPARATOR);
(char *) malloc (dir_length * sizeof (char));
if (!weechat_home)
{
fprintf (stderr, _("%s not enough memory for home directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
DIR_SEPARATOR);
/* create home directory "~/.weechat" ; error is fatal */
if (!wee_create_dir (weechat_home))
exit (1);
{
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
WEECHAT_ERROR);
exit (EXIT_FAILURE);
}
dir_name = (char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
dir_length = strlen (weechat_home) + 64;
dir_name = (char *) malloc (dir_length * sizeof (char));
#ifdef PLUGIN_PERL
/* create "~/.weechat/perl" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "perl");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"perl");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/perl/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "perl",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "perl", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
#ifdef PLUGIN_PYTHON
/* create "~/.weechat/python" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "python");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"python");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/python/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "python",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "python", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
#ifdef PLUGIN_RUBY
/* create "~/.weechat/ruby" */
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, "ruby");
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
"ruby");
if (wee_create_dir (dir_name))
{
/* create "~/.weechat/ruby/autoload" */
sprintf (dir_name, "%s%s%s%s%s", weechat_home, DIR_SEPARATOR, "ruby",
DIR_SEPARATOR, "autoload");
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
DIR_SEPARATOR, "ruby", DIR_SEPARATOR, "autoload");
wee_create_dir (dir_name);
}
#endif
free (dir_name);
}
@@ -241,18 +379,17 @@ wee_init_vars ()
void
wee_init_log ()
{
int filename_length;
char *filename;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s/" WEECHAT_LOG_NAME, weechat_home);
(char *) malloc (filename_length * sizeof (char));
snprintf (filename, filename_length, "%s/" WEECHAT_LOG_NAME, weechat_home);
if ((log_file = fopen (filename, "wt")) == NULL)
{
free (filename);
fprintf (stderr,
_("%s unable to create/append to log file (~/.weechat/%s)"),
WEECHAT_ERROR, WEECHAT_LOG_NAME);
}
WEECHAT_WARNING, WEECHAT_LOG_NAME);
free (filename);
}
@@ -307,7 +444,7 @@ wee_shutdown ()
gui_end ();
if (log_file)
fclose (log_file);
exit (0);
exit (EXIT_SUCCESS);
}
/*
@@ -336,25 +473,28 @@ main (int argc, char *argv[])
case 0: /* config file OK */
break;
case -1: /* config file not found */
config_create_default ();
config_read ();
if (config_create_default () < 0)
return EXIT_FAILURE;
if (config_read () != 0)
return EXIT_FAILURE;
break;
default: /* other error (fatal) */
server_free_all ();
return 1;
return EXIT_FAILURE;
}
gui_init (); /* init WeeChat interface */
plugin_init (); /* init plugin interface(s) */
weechat_welcome_message (); /* display WeeChat welcome message */
server_auto_connect (); /* auto-connect to servers */
/* auto-connect to servers */
server_auto_connect (server_cmd_line);
gui_main_loop (); /* WeeChat main loop */
plugin_end (); /* end plugin interface(s) */
server_disconnect_all (); /* disconnect from all servers */
config_write (NULL); /* save config file */
(void) config_write (NULL); /* save config file */
wee_shutdown (); /* quit WeeChat (oh no, why?) */
return 0; /* make gcc happy (never executed) */
return EXIT_SUCCESS; /* make gcc happy (never executed) */
}
+10 -6
View File
@@ -59,7 +59,8 @@
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
" Bounga <bounga@altern.org>\n" \
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
" Xahlexx <xahlexx@tuxisland.org>\n" \
"Website: " WEECHAT_WEBSITE "\n\n" \
"This program is free software; you can redistribute it and/or modify\n" \
"it under the terms of the GNU General Public License as published by\n" \
"the Free Software Foundation; either version 2 of the License, or\n" \
@@ -75,12 +76,15 @@
"along with this program; if not, write to the Free Software\n" \
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
#define WEE_USAGE \
#define WEE_USAGE1 \
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
" Bounga <bounga@altern.org>\n" \
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
" -h, --help this help screen\n", \
"\nDeveloped by FlashCode, Bounga and Xahlexx - " WEECHAT_WEBSITE "\n\n" \
"Usage: %s [options ...]\n" \
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
#define WEE_USAGE2 \
" -c, --config config file help (list of options)\n" \
" -h, --help this help screen\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n\n"
+324 -180
View File
@@ -25,10 +25,14 @@
#endif
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <pwd.h>
#include <sys/types.h>
#include "weechat.h"
#include "weeconfig.h"
@@ -69,70 +73,86 @@ int cfg_look_nickmode;
int cfg_look_nickmode_empty;
char *cfg_look_no_nickname;
char *cfg_look_completor;
int cfg_look_infobar;
char *cfg_look_infobar_timestamp;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] =
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
N_("set title for terminal window (curses GUI) with name & version"),
{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"),
N_("set title for window (terminal for Curses GUI) with name & version"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_set_title, NULL, NULL },
NULL, NULL, &cfg_look_set_title, NULL, config_change_title },
{ "look_startup_logo", N_("display WeeChat logo at startup"),
N_("display WeeChat logo at startup"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_startup_logo, NULL, NULL },
NULL, NULL, &cfg_look_startup_logo, NULL, config_change_noop },
{ "look_startup_version", N_("display WeeChat version at startup"),
N_("display WeeChat version at startup"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_startup_version, NULL, NULL },
NULL, NULL, &cfg_look_startup_version, NULL, config_change_noop },
{ "look_weechat_slogan", N_("WeeChat slogan"),
N_("WeeChat slogan (if empty, slogan is not used)"),
OPTION_TYPE_STRING, 0, 0, 0,
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, NULL },
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
{ "look_color_nicks", N_("display nick names with different colors"),
N_("display nick names with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_nicks, NULL, NULL },
NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop },
{ "look_color_actions", N_("display actions with different colors"),
N_("display actions with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_actions, NULL, NULL },
NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop },
{ "look_remove_colors_from_msgs", N_("remove colors from incoming messages"),
N_("remove colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, NULL },
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop },
{ "look_nicklist", N_("display nicklist window"),
N_("display nicklist window (for channel windows)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_nicklist, NULL, NULL },
NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows },
{ "look_nicklist_position", N_("nicklist position"),
N_("nicklist position (top, left, right (default), bottom)"),
OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, NULL },
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows },
{ "look_nicklist_min_size", N_("min size for nicklist"),
N_("min size for nicklist (width or height, depending on look_nicklist_position "
"(0 = no min size))"),
OPTION_TYPE_INT, 0, 100, 0,
NULL, NULL, &cfg_look_nicklist_min_size, NULL, NULL },
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows },
{ "look_nicklist_max_size", N_("max size for nicklist"),
N_("max size for nicklist (width or height, depending on look_nicklist_position "
"(0 = no max size; if min == max and > 0, then size is fixed))"),
OPTION_TYPE_INT, 0, 100, 0,
NULL, NULL, &cfg_look_nicklist_max_size, NULL, NULL },
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows },
{ "look_no_nickname", N_("text to display instead of nick when not connected"),
N_("text to display instead of nick when not connected"),
OPTION_TYPE_STRING, 0, 0, 0,
"-cmd-", NULL, NULL, &cfg_look_no_nickname, NULL },
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content },
{ "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"),
N_("display nick mode ((half)op/voice) before each nick"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_nickmode, NULL, NULL },
NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows },
{ "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"),
N_("display space if nick mode is not (half)op/voice"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_look_nickmode_empty, NULL, NULL },
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows },
{ "look_nick_completor", N_("the string inserted after nick completion"),
N_("the string inserted after nick completion"),
OPTION_TYPE_STRING, 0, 0, 0,
":", NULL, NULL, &cfg_look_completor, NULL },
":", NULL, NULL, &cfg_look_completor, config_change_noop },
{ "look_infobar", N_("enable info bar"),
N_("enable info bar"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_infobar, NULL, config_change_windows },
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
OPTION_TYPE_INT, 0, INT_MAX, 7,
NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -157,6 +177,9 @@ int cfg_col_status_data_msg;
int cfg_col_status_data_other;
int cfg_col_status_more;
int cfg_col_status_bg;
int cfg_col_infobar;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg;
int cfg_col_input;
int cfg_col_input_channel;
int cfg_col_input_nick;
@@ -175,135 +198,149 @@ t_config_option weechat_options_colors[] =
{ "col_title", N_("color for title bar"),
N_("color for title bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_title, NULL, NULL },
"gray", NULL, &cfg_col_title, NULL, &config_change_color },
{ "col_title_bg", N_("background for title bar"),
N_("background for title bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_title_bg, NULL, NULL },
"blue", NULL, &cfg_col_title_bg, NULL, &config_change_color },
/* chat window */
{ "col_chat", N_("color for chat text"),
N_("color for chat text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_chat, NULL, NULL },
"gray", NULL, &cfg_col_chat, NULL, &config_change_color },
{ "col_chat_time", N_("color for time"),
N_("color for time in chat window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_chat_time, NULL, NULL },
"gray", NULL, &cfg_col_chat_time, NULL, &config_change_color },
{ "col_chat_time_sep", N_("color for time separator"),
N_("color for time separator (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"brown", NULL, &cfg_col_chat_time_sep, NULL, NULL },
"brown", NULL, &cfg_col_chat_time_sep, NULL, &config_change_color },
{ "col_chat_prefix1", N_("color for 1st and 3rd char of prefix"),
N_("color for 1st and 3rd char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightcyan", NULL, &cfg_col_chat_prefix1, NULL, NULL },
"lightcyan", NULL, &cfg_col_chat_prefix1, NULL, &config_change_color },
{ "col_chat_prefix2", N_("color for middle char of prefix"),
N_("color for middle char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_prefix2, NULL, NULL },
"white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color },
{ "col_chat_nick", N_("color for nicks in actions"),
N_("color for nicks in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightcyan", NULL, &cfg_col_chat_nick, NULL, NULL },
"lightcyan", NULL, &cfg_col_chat_nick, NULL, &config_change_color },
{ "col_chat_host", N_("color for hostnames"),
N_("color for hostnames (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"cyan", NULL, &cfg_col_chat_host, NULL, NULL },
"cyan", NULL, &cfg_col_chat_host, NULL, &config_change_color },
{ "col_chat_channel", N_("color for channel names in actions"),
N_("color for channel names in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_channel, NULL, NULL },
"white", NULL, &cfg_col_chat_channel, NULL, &config_change_color },
{ "col_chat_dark", N_("color for dark separators"),
N_("color for dark separators (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"green", NULL, &cfg_col_chat_dark, NULL, NULL },
"green", NULL, &cfg_col_chat_dark, NULL, &config_change_color },
{ "col_chat_highlight", N_("color for highlighted nick"),
N_("color for highlighted nick (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_chat_highlight, NULL, NULL },
"yellow", NULL, &cfg_col_chat_highlight, NULL, &config_change_color },
{ "col_chat_bg", N_("background for chat"),
N_("background for chat window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_chat_bg, NULL, NULL },
"default", NULL, &cfg_col_chat_bg, NULL, &config_change_color },
/* status window */
{ "col_status", N_("color for status bar"),
N_("color for status bar"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_status, NULL, NULL },
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
{ "col_status_active", N_("color for active window"),
N_("color for active window (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_status_active, NULL, NULL },
"yellow", NULL, &cfg_col_status_active, NULL, &config_change_color },
{ "col_status_data_msg", N_("color for window with new messages"),
N_("color for window with new messages (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightred", NULL, &cfg_col_status_data_msg, NULL, NULL },
"lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
{ "col_status_data_other", N_("color for window with new data (not messages)"),
N_("color for window with new data (not messages) (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, NULL },
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
{ "col_status_more", N_("color for \"*MORE*\" text"),
N_("color for window with new data (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_status_more, NULL, NULL },
"white", NULL, &cfg_col_status_more, NULL, &config_change_color },
{ "col_status_bg", N_("background for status window"),
N_("background for status window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_status_bg, NULL, NULL },
"blue", NULL, &cfg_col_status_bg, NULL, &config_change_color },
/* infobar window */
{ "col_infobar", N_("color for info bar text"),
N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, &config_change_color },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_infobar_highlight, NULL, &config_change_color },
{ "col_infobar_bg", N_("background for info bar window"),
N_("background for info bar window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"cyan", NULL, &cfg_col_infobar_bg, NULL, &config_change_color },
/* input window */
{ "col_input", N_("color for input text"),
N_("color for input text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_input, NULL, NULL },
"gray", NULL, &cfg_col_input, NULL, &config_change_color },
{ "col_input_channel", N_("color for input text (channel name)"),
N_("color for input text (channel name)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_input_channel, NULL, NULL },
"white", NULL, &cfg_col_input_channel, NULL, &config_change_color },
{ "col_input_nick", N_("color for input text (nick name)"),
N_("color for input text (nick name)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_input_nick, NULL, NULL },
"lightgreen", NULL, &cfg_col_input_nick, NULL, &config_change_color },
{ "col_input_bg", N_("background for input window"),
N_("background for input window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_input_bg, NULL, NULL },
"default", NULL, &cfg_col_input_bg, NULL, &config_change_color },
/* nick window */
{ "col_nick", N_("color for nicknames"),
N_("color for nicknames"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_nick, NULL, NULL },
"gray", NULL, &cfg_col_nick, NULL, &config_change_color },
{ "col_nick_op", N_("color for operator symbol"),
N_("color for operator symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_nick_op, NULL, NULL },
"lightgreen", NULL, &cfg_col_nick_op, NULL, &config_change_color },
{ "col_nick_halfop", N_("color for half-operator symbol"),
N_("color for half-operator symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_nick_halfop, NULL, NULL },
"lightmagenta", NULL, &cfg_col_nick_halfop, NULL, &config_change_color },
{ "col_nick_voice", N_("color for voice symbol"),
N_("color for voice symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_nick_voice, NULL, NULL },
"yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color },
{ "col_nick_sep", N_("color for nick separator"),
N_("color for nick separator"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_nick_sep, NULL, NULL },
"blue", NULL, &cfg_col_nick_sep, NULL, &config_change_color },
{ "col_nick_self", N_("color for local nick"),
N_("color for local nick"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_nick_self, NULL, NULL },
"white", NULL, &cfg_col_nick_self, NULL, &config_change_color },
{ "col_nick_private", N_("color for other nick in private window"),
N_("color for other nick in private window"),
OPTION_TYPE_COLOR, 0, 0, 0,
"gray", NULL, &cfg_col_nick_private, NULL, NULL },
"gray", NULL, &cfg_col_nick_private, NULL, &config_change_color },
{ "col_nick_bg", N_("background for nicknames"),
N_("background for nicknames"),
OPTION_TYPE_COLOR, 0, 0, 0,
"default", NULL, &cfg_col_nick_bg, NULL, NULL },
"default", NULL, &cfg_col_nick_bg, NULL, &config_change_color },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -401,8 +438,8 @@ t_config_option weechat_options_dcc[] =
NULL, NULL, &cfg_dcc_timeout, NULL, NULL },
{ "dcc_download_path", N_("path for incoming files with dcc"),
N_("path for writing incoming files with dcc (default: user home)"),
OPTION_TYPE_STRING, 0, 0, 0, "~",
NULL, NULL, &cfg_dcc_download_path, NULL },
OPTION_TYPE_STRING, 0, 0, 0,
"~", NULL, NULL, &cfg_dcc_download_path, NULL },
{ "dcc_upload_path", N_("default path for sending files with dcc"),
N_("path for reading files when sending thru dcc (when no path is specified)"),
OPTION_TYPE_STRING, 0, 0, 0, "~",
@@ -531,6 +568,83 @@ get_pos_array_values (char **array, char *string)
return -1;
}
/*
* config_get_section: get section name from option pointer
*/
char *
config_get_section (t_config_option *ptr_option)
{
int i, j;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
/* if option found, return pointer to section name */
if (ptr_option == &weechat_options[i][j])
return config_sections[i].section_name;
}
}
}
/* option not found */
return NULL;
}
/*
* config_change_noop: called when an option is changed by /set command
* and that no special action is needed after that
*/
void
config_change_noop ()
{
/* do nothing */
}
/*
* config_change_title: called when title is changed
*/
void
config_change_title ()
{
gui_set_window_title ();
}
/*
* config_change_windows: called when windows change (for example nicklist)
*/
void
config_change_windows ()
{
gui_switch_to_window (gui_current_window);
gui_redraw_window (gui_current_window);
}
/*
* config_change_window_content: called when content of a window changes
*/
void
config_change_window_content ()
{
gui_redraw_window (gui_current_window);
}
/*
* config_change_color: called when a color is changed by /set command
*/
void
config_change_color()
{
gui_init_colors ();
}
/*
* config_option_set_value: set new value for an option
* return: 0 if success
@@ -578,14 +692,12 @@ config_option_set_value (t_config_option *option, char *value)
}
/*
* config_set_value: set new value for an option (found by name)
* return: 0 if success
* -1 if bad value for option
* -2 if option is not found
* config_option_search: look for an option and return pointer to this option
* if option is not found, NULL is returned
*/
int
config_set_value (char *option_name, char *value)
t_config_option *
config_option_search (char *option_name)
{
int i, j;
@@ -595,14 +707,33 @@ config_set_value (char *option_name, char *value)
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
/* if option found, assign value and exit */
/* if option found, return pointer */
if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0)
return config_option_set_value (&weechat_options[i][j], value);
return &weechat_options[i][j];
}
}
}
/* option not found */
return -2;
return NULL;
}
/*
* config_set_value: set new value for an option (found by name)
* return: 0 if success
* -1 if bad value for option
* -2 if option is not found
*/
int
config_set_value (char *option_name, char *value)
{
t_config_option *ptr_option;
ptr_option = config_option_search (option_name);
if (ptr_option)
return config_option_set_value (ptr_option, value);
else
return -2;
}
/*
@@ -637,7 +768,7 @@ config_allocate_server (char *filename, int line_number)
return 0;
}
if (!server_new (cfg_server.name,
cfg_server.autoconnect, cfg_server.address, cfg_server.port,
cfg_server.autoconnect, 0, cfg_server.address, cfg_server.port,
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
cfg_server.nick3, cfg_server.username, cfg_server.realname,
cfg_server.command, cfg_server.autojoin))
@@ -717,15 +848,20 @@ config_default_values ()
int
config_read ()
{
int filename_length;
char *filename;
FILE *file;
int section, line_number, i, option_number;
int server_found;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "rt")) == NULL)
{
gui_printf (NULL, _("%s config file \"%s\" not found.\n"),
@@ -902,21 +1038,6 @@ config_read ()
}
}
/* set default colors for colors not set */
/*for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if (i != CONFIG_SECTION_SERVER)
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((weechat_options[i][j].option_type == OPTION_TYPE_COLOR) &&
(*weechat_options[i][j].ptr_int == COLOR_NOT_SET))
*weechat_options[i][j].ptr_int =
gui_get_color_by_name (weechat_options[i][j].default_string);
}
}
}*/
fclose (file);
free (filename);
@@ -933,15 +1054,21 @@ config_read ()
int
config_create_default ()
{
int filename_length;
char *filename;
char line[1024];
FILE *file;
int i, j;
time_t current_time;
struct passwd *my_passwd;
char *realname, *pos;
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "wt")) == NULL)
{
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
@@ -954,96 +1081,126 @@ config_create_default ()
wee_log_printf (_("creating default config file\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fputs (line, file);
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
fputs (line, file);
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
{
sprintf (line,
fprintf (file,
"# WARNING!!! Options for section \"%s\" are not developed!\n",
config_sections[i].section_name);
fputs (line, file);
}
for (j = 0; weechat_options[i][j].option_name; j++)
{
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].default_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
sprintf (line, "%s=%d\n",
fprintf (file, "%s=%d\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
case OPTION_TYPE_COLOR:
case OPTION_TYPE_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
weechat_options[i][j].default_string);
break;
}
fputs (line, file);
}
}
}
/* default aliases */
/* TODO: remove comments when missing commands will be ok */
fputs ("\n[alias]\n", file);
fputs ("SAY=msg *\n", file);
fputs ("BYE=quit\n", file);
fputs ("EXIT=quit\n", file);
fputs ("SIGNOFF=quit\n", file);
fputs ("C=clear\n", file);
fputs ("CL=clear\n", file);
fputs ("# CHAT=dcc chat\n", file);
fputs ("# GET=dcc get\n", file);
fputs ("# IG=ignore\n", file);
fputs ("J=join\n", file);
fputs ("K=kick\n", file);
fputs ("# KB=kickban\n", file);
fputs ("# KN=knockout\n", file);
fputs ("LEAVE=part\n", file);
fputs ("M=msg\n", file);
fputs ("# MUB=unban *\n", file);
fputs ("N=names\n", file);
fputs ("T=topic\n", file);
fputs ("# UB=unban\n", file);
fputs ("# UNIG=unignore\n", file);
fputs ("# W=who\n", file);
fputs ("WC=part\n", file);
fputs ("WI=whois\n", file);
fputs ("# WW=whowas\n", file);
fprintf (file, "\n[alias]\n");
fprintf (file, "SAY=msg *\n");
fprintf (file, "BYE=quit\n");
fprintf (file, "EXIT=quit\n");
fprintf (file, "SIGNOFF=quit\n");
fprintf (file, "C=clear\n");
fprintf (file, "CL=clear\n");
fprintf (file, "# CHAT=dcc chat\n");
fprintf (file, "# GET=dcc get\n");
fprintf (file, "# IG=ignore\n");
fprintf (file, "J=join\n");
fprintf (file, "K=kick\n");
fprintf (file, "# KB=kickban\n");
fprintf (file, "# KN=knockout\n");
fprintf (file, "LEAVE=part\n");
fprintf (file, "M=msg\n");
fprintf (file, "# MUB=unban *\n");
fprintf (file, "N=names\n");
fprintf (file, "Q=query\n");
fprintf (file, "T=topic\n");
fprintf (file, "# UB=unban\n");
fprintf (file, "# UNIG=unignore\n");
fprintf (file, "W=who\n");
fprintf (file, "WC=part\n");
fprintf (file, "WI=whois\n");
fprintf (file, "WW=whowas\n");
/* default server is freenode */
fputs ("\n[server]\n", file);
fputs ("server_name=freenode\n", file);
fputs ("server_autoconnect=on\n", file);
fputs ("server_address=irc.freenode.net\n", file);
fputs ("server_port=6667\n", file);
fputs ("server_password=\n", file);
fputs ("server_nick1=weechat_user\n", file);
fputs ("server_nick2=weechat2\n", file);
fputs ("server_nick3=weechat3\n", file);
fputs ("server_username=weechat\n", file);
fputs ("server_realname=WeeChat default realname\n", file);
fputs ("server_command=\n", file);
fputs ("server_autojoin=\n", file);
fprintf (file, "\n[server]\n");
fprintf (file, "server_name=freenode\n");
fprintf (file, "server_autoconnect=on\n");
fprintf (file, "server_address=irc.freenode.net\n");
fprintf (file, "server_port=6667\n");
fprintf (file, "server_password=\n");
/* Get the user's name from /etc/passwd */
if ((my_passwd = getpwuid (geteuid ())) != NULL)
{
fprintf (file, "server_nick1=%s\n", my_passwd->pw_name);
fprintf (file, "server_nick2=%s1\n", my_passwd->pw_name);
fprintf (file, "server_nick3=%s2\n", my_passwd->pw_name);
fprintf (file, "server_username=%s\n", my_passwd->pw_name);
if ((!my_passwd->pw_gecos)
|| (my_passwd->pw_gecos[0] == '\0')
|| (my_passwd->pw_gecos[0] == ',')
|| (my_passwd->pw_gecos[0] == ' '))
fprintf (file, "server_realname=%s\n", my_passwd->pw_name);
else
{
realname = strdup (my_passwd->pw_gecos);
pos = strchr (realname, ',');
if (pos)
pos[0] = '\0';
fprintf (file, "server_realname=%s\n",
realname);
if (pos)
pos[0] = ',';
free (realname);
}
}
else
{
/* default values if /etc/passwd can't be read */
fprintf (stderr, "%s: %s (%s).",
WEECHAT_WARNING,
_("Unable to get user's name"),
strerror (errno));
fprintf (file, "server_nick1=weechat1\n");
fprintf (file, "server_nick2=weechat2\n");
fprintf (file, "server_nick3=weechat3\n");
fprintf (file, "server_username=weechat\n");
fprintf (file, "server_realname=WeeChat default realname\n");
}
fprintf (file, "server_command=\n");
fprintf (file, "server_autojoin=\n");
fclose (file);
free (filename);
@@ -1059,8 +1216,8 @@ config_create_default ()
int
config_write (char *config_name)
{
int filename_length;
char *filename;
char line[1024];
FILE *file;
int i, j;
time_t current_time;
@@ -1071,9 +1228,13 @@ config_write (char *config_name)
filename = strdup (config_name);
else
{
filename_length = strlen (weechat_home) + 64;
filename =
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
}
if ((file = fopen (filename, "wt")) == NULL)
@@ -1087,115 +1248,98 @@ config_write (char *config_name)
wee_log_printf (_("saving config to disk\n"));
current_time = time (NULL);
sprintf (line, _("#\n# %s configuration file, created by "
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fputs (line, file);
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
{
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
fputs (line, file);
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
{
sprintf (line,
fprintf (file,
"# WARNING!!! Options for section \"%s\" are not developed!\n",
config_sections[i].section_name);
fputs (line, file);
}
for (j = 0; weechat_options[i][j].option_name; j++)
{
switch (weechat_options[i][j].option_type)
{
case OPTION_TYPE_BOOLEAN:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int &&
*weechat_options[i][j].ptr_int) ?
"on" : "off");
break;
case OPTION_TYPE_INT:
sprintf (line, "%s=%d\n",
fprintf (file, "%s=%d\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
*weechat_options[i][j].ptr_int :
weechat_options[i][j].default_int);
break;
case OPTION_TYPE_INT_WITH_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
weechat_options[i][j].array_values[*weechat_options[i][j].ptr_int] :
weechat_options[i][j].array_values[weechat_options[i][j].default_int]);
break;
case OPTION_TYPE_COLOR:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
gui_get_color_by_value (*weechat_options[i][j].ptr_int) :
weechat_options[i][j].default_string);
break;
case OPTION_TYPE_STRING:
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_string) ?
*weechat_options[i][j].ptr_string :
weechat_options[i][j].default_string);
break;
}
fputs (line, file);
}
}
}
/* alias section */
fputs ("\n[alias]\n", file);
fprintf (file, "\n[alias]\n");
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
sprintf (line, "%s=%s\n",
fprintf (file, "%s=%s\n",
ptr_alias->alias_name, ptr_alias->alias_command + 1);
fputs (line, file);
}
/* server section */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
/* default server is freenode */
fputs ("\n[server]\n", file);
sprintf (line, "server_name=%s\n", ptr_server->name);
fputs (line, file);
sprintf (line, "server_autoconnect=%s\n",
(ptr_server->autoconnect) ? "on" : "off");
fputs (line, file);
sprintf (line, "server_address=%s\n", ptr_server->address);
fputs (line, file);
sprintf (line, "server_port=%d\n", ptr_server->port);
fputs (line, file);
sprintf (line, "server_password=%s\n",
(ptr_server->password) ? ptr_server->password : "");
fputs (line, file);
sprintf (line, "server_nick1=%s\n", ptr_server->nick1);
fputs (line, file);
sprintf (line, "server_nick2=%s\n", ptr_server->nick2);
fputs (line, file);
sprintf (line, "server_nick3=%s\n", ptr_server->nick3);
fputs (line, file);
sprintf (line, "server_username=%s\n", ptr_server->username);
fputs (line, file);
sprintf (line, "server_realname=%s\n", ptr_server->realname);
fputs (line, file);
sprintf (line, "server_command=%s\n",
(ptr_server->command) ? ptr_server->command : "");
fputs (line, file);
sprintf (line, "server_autojoin=%s\n",
(ptr_server->autojoin) ? ptr_server->autojoin : "");
fputs (line, file);
if (!ptr_server->command_line)
{
fprintf (file, "\n[server]\n");
fprintf (file, "server_name=%s\n", ptr_server->name);
fprintf (file, "server_autoconnect=%s\n",
(ptr_server->autoconnect) ? "on" : "off");
fprintf (file, "server_address=%s\n", ptr_server->address);
fprintf (file, "server_port=%d\n", ptr_server->port);
fprintf (file, "server_password=%s\n",
(ptr_server->password) ? ptr_server->password : "");
fprintf (file, "server_nick1=%s\n", ptr_server->nick1);
fprintf (file, "server_nick2=%s\n", ptr_server->nick2);
fprintf (file, "server_nick3=%s\n", ptr_server->nick3);
fprintf (file, "server_username=%s\n", ptr_server->username);
fprintf (file, "server_realname=%s\n", ptr_server->realname);
fprintf (file, "server_command=%s\n",
(ptr_server->command) ? ptr_server->command : "");
fprintf (file, "server_autojoin=%s\n",
(ptr_server->autojoin) ? ptr_server->autojoin : "");
}
}
fclose (file);
+16 -1
View File
@@ -70,7 +70,7 @@ struct t_config_option
char **array_values;
int *ptr_int;
char **ptr_string;
int (*handler_change)(int *, char **);
void (*handler_change)();
};
extern int cfg_look_set_title;
@@ -88,6 +88,9 @@ extern int cfg_look_nickmode;
extern int cfg_look_nickmode_empty;
extern char *cfg_look_no_nickname;
extern char *cfg_look_completor;
extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title;
extern int cfg_col_title_bg;
@@ -108,6 +111,9 @@ extern int cfg_col_status_data_msg;
extern int cfg_col_status_data_other;
extern int cfg_col_status_more;
extern int cfg_col_status_bg;
extern int cfg_col_infobar;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg;
extern int cfg_col_input;
extern int cfg_col_input_channel;
extern int cfg_col_input_nick;
@@ -149,6 +155,15 @@ extern char *cfg_proxy_password;
extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS];
extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
extern char *config_get_section ();
extern void config_change_noop ();
extern void config_change_title ();
extern void config_change_windows ();
extern void config_change_window_content ();
extern void config_change_color ();
extern int config_option_set_value (t_config_option *, char *);
extern t_config_option *config_option_search (char *);
extern int config_set_value (char *, char *);
extern int config_read ();
extern int config_create_default ();
extern int config_write ();
+2
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
+271 -69
View File
@@ -159,7 +159,7 @@ gui_window_set_color (WINDOW *window, int num_color)
int
gui_window_has_nicklist (t_gui_window *window)
{
return (window->win_nick != NULL);
return ((window->win_nick != NULL) ? 1 : 0);
}
@@ -182,7 +182,7 @@ gui_calculate_pos_size (t_gui_window *window)
/* init chat & nicklist settings */
/* TODO: calculate values from function parameters */
if (WIN_IS_CHANNEL(window))
if (cfg_look_nicklist && WIN_IS_CHANNEL(window))
{
max_length = nick_get_max_length (CHANNEL(window));
@@ -192,21 +192,37 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = max_length + 2;
window->win_chat_y = 1;
window->win_chat_width = COLS - max_length - 2;
window->win_chat_height = LINES - 3;
window->win_nick_x = 0;
window->win_nick_y = 1;
window->win_nick_width = max_length + 2;
window->win_nick_height = LINES - 3;
if (cfg_look_infobar)
{
window->win_chat_height = LINES - 4;
window->win_nick_height = LINES - 4;
}
else
{
window->win_chat_height = LINES - 3;
window->win_nick_height = LINES - 3;
}
break;
case CFG_LOOK_NICKLIST_RIGHT:
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS - max_length - 2;
window->win_chat_height = LINES - 3;
window->win_nick_x = COLS - max_length - 2;
window->win_nick_y = 1;
window->win_nick_width = max_length + 2;
window->win_nick_height = LINES - 3;
if (cfg_look_infobar)
{
window->win_chat_height = LINES - 4;
window->win_nick_height = LINES - 4;
}
else
{
window->win_chat_height = LINES - 3;
window->win_nick_height = LINES - 3;
}
break;
case CFG_LOOK_NICKLIST_TOP:
nick_count (CHANNEL(window), &num_nicks, &num_op, &num_halfop,
@@ -218,7 +234,10 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1 + (lines + 1);
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3 - (lines + 1);
if (cfg_look_infobar)
window->win_chat_height = LINES - 3 - (lines + 1) - 1;
else
window->win_chat_height = LINES - 3 - (lines + 1);
window->win_nick_x = 0;
window->win_nick_y = 1;
window->win_nick_width = COLS;
@@ -234,9 +253,15 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3 - (lines + 1);
if (cfg_look_infobar)
window->win_chat_height = LINES - 3 - (lines + 1) - 1;
else
window->win_chat_height = LINES - 3 - (lines + 1);
window->win_nick_x = 0;
window->win_nick_y = LINES - 2 - (lines + 1);
if (cfg_look_infobar)
window->win_nick_y = LINES - 2 - (lines + 1) - 1;
else
window->win_nick_y = LINES - 2 - (lines + 1);
window->win_nick_width = COLS;
window->win_nick_height = lines + 1;
break;
@@ -250,7 +275,10 @@ gui_calculate_pos_size (t_gui_window *window)
window->win_chat_x = 0;
window->win_chat_y = 1;
window->win_chat_width = COLS;
window->win_chat_height = LINES - 3;
if (cfg_look_infobar)
window->win_chat_height = LINES - 4;
else
window->win_chat_height = LINES - 3;
window->win_chat_cursor_x = 0;
window->win_chat_cursor_y = 0;
window->win_nick_x = -1;
@@ -269,7 +297,6 @@ gui_curses_window_clear (WINDOW *window)
{
werase (window);
wmove (window, 0, 0);
//wrefresh (window);
}
/*
@@ -294,7 +321,7 @@ gui_draw_window_title (t_gui_window *window)
}
if (CHANNEL(window))
{
sprintf (format, "%%-%ds", window->win_width);
snprintf (format, 32, "%%-%ds", window->win_width);
if (CHANNEL(window)->topic)
mvwprintw (window->win_title, 0, 0, format,
CHANNEL(window)->topic);
@@ -361,9 +388,9 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
{
int lines_displayed, num_lines, offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32];
char saved_char, format_align[32], format_empty[32];
sprintf (format_align, "%%-%ds", line->length_align);
snprintf (format_align, 32, "%%-%ds", line->length_align);
num_lines = gui_get_line_num_splits (window, line);
ptr_message = line->messages;
offset = 0;
@@ -419,7 +446,11 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
if (lines_displayed >= num_lines - count)
{
if (window->win_chat_cursor_x <= window->win_chat_width - 1)
wclrtoeol (window->win_chat);
{
snprintf (format_empty, 32, "%%-%ds",
window->win_chat_width - window->win_chat_cursor_x);
wprintw (window->win_chat, format_empty, " ");
}
window->win_chat_cursor_y++;
}
window->win_chat_cursor_x = 0;
@@ -441,9 +472,9 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
{
int offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32];
char saved_char, format_align[32], format_empty[32];
sprintf (format_align, "%%-%ds", line->length_align);
snprintf (format_align, 32, "%%-%ds", line->length_align);
ptr_message = line->messages;
offset = 0;
while (ptr_message)
@@ -512,7 +543,11 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
(window->win_chat_cursor_x > window->win_chat_width - 1)))
{
if (window->win_chat_cursor_x <= window->win_chat_width - 1)
wclrtoeol (window->win_chat);
{
snprintf (format_empty, 32, "%%-%ds",
window->win_chat_width - window->win_chat_cursor_x);
wprintw (window->win_chat, format_empty, " ");
}
window->win_chat_cursor_y++;
}
window->win_chat_cursor_x = 0;
@@ -536,11 +571,7 @@ gui_draw_window_chat (t_gui_window *window)
return;
if (has_colors ())
{
gui_window_set_color (window->win_chat, COLOR_WIN_CHAT);
wborder (window->win_chat, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_chat);
}
ptr_line = window->last_line;
lines_used = 0;
@@ -596,11 +627,22 @@ gui_draw_window_chat (t_gui_window *window)
void
gui_redraw_window_chat (t_gui_window *window)
{
char format_empty[32];
int i;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_chat);
if (has_colors ())
gui_window_set_color (window->win_chat, COLOR_WIN_CHAT);
snprintf (format_empty, 32, "%%-%ds", window->win_chat_width);
for (i = 0; i < window->win_chat_height; i++)
{
mvwprintw (window->win_chat, i, 0, format_empty, " ");
}
gui_draw_window_chat (window);
}
@@ -612,7 +654,7 @@ void
gui_draw_window_nick (t_gui_window *window)
{
int i, x, y, column, max_length;
char format[32];
char format[32], format_empty[32];
t_irc_nick *ptr_nick;
/* TODO: manage splitted windows! */
@@ -636,9 +678,18 @@ gui_draw_window_nick (t_gui_window *window)
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
gui_draw_window_chat (window);
gui_redraw_window_chat (window);
if (has_colors ())
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
for (i = 0; i < window->win_nick_height; i++)
{
mvwprintw (window->win_nick, i, 0, format_empty, " ");
}
}
sprintf (format, "%%-%ds", max_length);
snprintf (format, 32, "%%-%ds", max_length);
if (has_colors ())
{
@@ -747,11 +798,22 @@ gui_draw_window_nick (t_gui_window *window)
void
gui_redraw_window_nick (t_gui_window *window)
{
char format_empty[32];
int i;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_nick);
if (has_colors ())
gui_window_set_color (window->win_nick, COLOR_WIN_NICK);
snprintf (format_empty, 32, "%%-%ds", window->win_nick_width);
for (i = 0; i < window->win_nick_height; i++)
{
mvwprintw (window->win_nick, i, 0, format_empty, " ");
}
gui_draw_window_nick (window);
}
@@ -764,6 +826,7 @@ gui_draw_window_status (t_gui_window *window)
{
t_gui_window *ptr_win;
char format_more[32];
int i, first_mode;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
@@ -775,7 +838,6 @@ gui_draw_window_status (t_gui_window *window)
wborder (window->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_status);
}
//refresh ();
wmove (window->win_status, 0, 0);
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -853,7 +915,36 @@ gui_draw_window_status (t_gui_window *window)
gui_window_set_color (window->win_status,
COLOR_WIN_STATUS);
}
wprintw (window->win_status, "%s ", CHANNEL(ptr_win)->name);
wprintw (window->win_status, "%s", CHANNEL(ptr_win)->name);
if (gui_current_window == CHANNEL(ptr_win)->window)
{
/* display channel modes */
wprintw (window->win_status, "(");
i = 0;
first_mode = 1;
while (CHANNEL(ptr_win)->modes[i])
{
if (CHANNEL(ptr_win)->modes[i] != ' ')
{
if (first_mode)
{
wprintw (window->win_status, "+");
first_mode = 0;
}
wprintw (window->win_status, "%c",
CHANNEL(ptr_win)->modes[i]);
}
i++;
}
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_KEY] != ' ')
wprintw (window->win_status, ",%s",
CHANNEL(ptr_win)->key);
if (CHANNEL(ptr_win)->modes[CHANNEL_MODE_LIMIT] != ' ')
wprintw (window->win_status, ",%d",
CHANNEL(ptr_win)->limit);
wprintw (window->win_status, ")");
}
wprintw (window->win_status, " ");
}
if (!SERVER(ptr_win))
{
@@ -862,13 +953,13 @@ gui_draw_window_status (t_gui_window *window)
}
}
/* display "*MORE*" if last line is not displayed */
/* display "-MORE-" if last line is not displayed */
gui_window_set_color (window->win_status, COLOR_WIN_STATUS_MORE);
if (window->sub_lines > 0)
mvwprintw (window->win_status, 0, COLS - 7, _("-MORE-"));
else
{
sprintf (format_more, "%%-%ds", strlen (_("-MORE-")));
snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
mvwprintw (window->win_status, 0, COLS - 7, format_more, " ");
}
@@ -891,6 +982,62 @@ gui_redraw_window_status (t_gui_window *window)
gui_draw_window_status (window);
}
/*
* gui_draw_window_infobar: draw infobar window
*/
void
gui_draw_window_infobar (t_gui_window *window)
{
time_t time_seconds;
struct tm *local_time;
char text[1024 + 1];
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
if (has_colors ())
{
gui_window_set_color (window->win_infobar, COLOR_WIN_INFOBAR);
wborder (window->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_infobar);
}
wmove (window->win_infobar, 0, 0);
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
if (local_time)
{
strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
gui_window_set_color (window->win_infobar, COLOR_WIN_INFOBAR);
wprintw (window->win_infobar, "%s", text);
}
if (gui_infobar)
{
gui_window_set_color (window->win_infobar, gui_infobar->color);
wprintw (window->win_infobar, " | %s", gui_infobar->text);
}
wrefresh (window->win_infobar);
refresh ();
}
/*
* gui_redraw_window_infobar: redraw infobar window
*/
void
gui_redraw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
gui_curses_window_clear (window->win_infobar);
gui_draw_window_infobar (window);
}
/*
* gui_get_input_width: return input width (max # chars displayed)
*/
@@ -931,7 +1078,6 @@ gui_draw_window_input (t_gui_window *window)
wborder (window->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_input);
}
//refresh ();
if (window->input_buffer_size == 0)
window->input_buffer[0] = '\0';
@@ -961,7 +1107,7 @@ gui_draw_window_input (t_gui_window *window)
}
if (CHANNEL(window))
{
sprintf (format, "%%s %%s> %%-%ds", input_width);
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
mvwprintw (window->win_input, 0, 0, format,
CHANNEL(window)->name,
SERVER(window)->nick,
@@ -975,7 +1121,7 @@ gui_draw_window_input (t_gui_window *window)
{
if (SERVER(window))
{
sprintf (format, "%%s> %%-%ds", input_width);
snprintf (format, 32, "%%s> %%-%ds", input_width);
if (SERVER(window) && (SERVER(window)->is_connected))
ptr_nickname = SERVER(window)->nick;
else
@@ -989,7 +1135,7 @@ gui_draw_window_input (t_gui_window *window)
}
else
{
sprintf (format, "%%s> %%-%ds", input_width);
snprintf (format, 32, "%%s> %%-%ds", input_width);
if (SERVER(window) && (SERVER(window)->is_connected))
ptr_nickname = SERVER(window)->nick;
else
@@ -1038,6 +1184,8 @@ gui_redraw_window (t_gui_window *window)
if (window->win_nick)
gui_redraw_window_nick (window);
gui_redraw_window_status (window);
if (cfg_look_infobar)
gui_redraw_window_infobar (window);
gui_redraw_window_input (window);
}
@@ -1062,13 +1210,18 @@ gui_switch_to_window (t_gui_window *window)
window->win_chat = ptr_win->win_chat;
window->win_nick = ptr_win->win_nick;
window->win_status = ptr_win->win_status;
window->win_infobar = ptr_win->win_infobar;
window->win_input = ptr_win->win_input;
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
if (ptr_win != window)
{
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_infobar = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
}
break;
}
}
@@ -1084,40 +1237,52 @@ gui_switch_to_window (t_gui_window *window)
window->win_chat_width,
window->win_chat_y,
window->win_chat_x);
if (CHANNEL(window))
if (cfg_look_nicklist && CHANNEL(window))
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
else
window->win_nick = NULL;
window->win_status = newwin (1, COLS, LINES - 2, 0);
window->win_input = newwin (1, COLS, LINES - 1, 0);
}
else
{
/* create chat & nick windows */
/* remove some windows */
if (window->win_nick)
{
delwin (window->win_nick);
window->win_nick = NULL;
}
if (window->win_status)
{
delwin (window->win_status);
window->win_status = NULL;
}
if (window->win_infobar)
{
delwin (window->win_infobar);
window->win_infobar = NULL;
}
/* create windows */
if (WIN_IS_CHANNEL(window))
{
/* (re)create nicklist window */
if (window->win_nick)
delwin (window->win_nick);
delwin (window->win_chat);
window->win_chat = newwin (window->win_chat_height,
window->win_chat_width,
window->win_chat_y,
window->win_chat_x);
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
if (cfg_look_nicklist)
window->win_nick = newwin (window->win_nick_height,
window->win_nick_width,
window->win_nick_y,
window->win_nick_x);
else
window->win_nick = NULL;
}
if (!(WIN_IS_CHANNEL(window)))
{
/* remove nick list window */
if (window->win_nick)
delwin (window->win_nick);
window->win_nick = NULL;
delwin (window->win_chat);
window->win_chat = newwin (window->win_chat_height,
window->win_chat_width,
@@ -1126,6 +1291,15 @@ gui_switch_to_window (t_gui_window *window)
}
}
/* create status/infobar windows */
if (cfg_look_infobar)
{
window->win_infobar = newwin (1, COLS, LINES - 2, 0);
window->win_status = newwin (1, COLS, LINES - 3, 0);
}
else
window->win_status = newwin (1, COLS, LINES - 2, 0);
/* change current window to the new window */
gui_current_window = window;
@@ -1179,8 +1353,8 @@ gui_move_page_up ()
if (!gui_current_window->first_line_displayed)
{
gui_current_window->sub_lines += gui_current_window->win_chat_height - 1;
gui_redraw_window_chat (gui_current_window);
gui_redraw_window_status (gui_current_window);
gui_draw_window_chat (gui_current_window);
gui_draw_window_status (gui_current_window);
}
}
@@ -1198,8 +1372,8 @@ gui_move_page_down ()
gui_current_window->sub_lines = 0;
if (gui_current_window->sub_lines == 0)
gui_current_window->unread_data = 0;
gui_redraw_window_chat (gui_current_window);
gui_redraw_window_status (gui_current_window);
gui_draw_window_chat (gui_current_window);
gui_draw_window_status (gui_current_window);
}
}
@@ -1232,12 +1406,15 @@ gui_curses_resize_handler ()
delwin (ptr_win->win_nick);
if (ptr_win->win_status)
delwin (ptr_win->win_status);
if (ptr_win->win_infobar)
delwin (ptr_win->win_infobar);
if (ptr_win->win_input)
delwin (ptr_win->win_input);
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_infobar = NULL;
ptr_win->win_input = NULL;
gui_switch_to_window (ptr_win);
}
@@ -1255,6 +1432,7 @@ gui_window_init_subwindows (t_gui_window *window)
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_infobar = NULL;
window->win_input = NULL;
}
@@ -1316,6 +1494,10 @@ gui_init_colors ()
cfg_col_status_data_other & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_MORE,
cfg_col_status_more & A_CHARTEXT, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight & A_CHARTEXT, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT,
cfg_col_input & A_CHARTEXT, cfg_col_input_bg);
init_pair (COLOR_WIN_INPUT_CHANNEL,
@@ -1362,6 +1544,8 @@ gui_init_colors ()
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & 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;
@@ -1375,6 +1559,20 @@ gui_init_colors ()
}
}
/*
* gui_set_window_title: set terminal title
*/
void
gui_set_window_title ()
{
#ifdef __linux__
/* set title for term window, not for console */
if (strcmp (getenv ("TERM"), "linux") != 0)
printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a");
#endif
}
/*
* gui_init: init GUI
*/
@@ -1392,16 +1590,15 @@ gui_init ()
gui_init_colors ();
gui_infobar = NULL;
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
#ifdef __linux__
/* set title for term window, not for console */
if (cfg_look_set_title && (strcmp (getenv ("TERM"), "linux") != 0))
printf ("\e]2;" PACKAGE_NAME " " PACKAGE_VERSION "\a\e]1;" PACKAGE_NAME " " PACKAGE_VERSION "\a");
#endif
if (cfg_look_set_title)
gui_set_window_title ();
gui_ready = 1;
}
@@ -1426,6 +1623,8 @@ gui_end ()
delwin (ptr_win->win_nick);
if (ptr_win->win_status)
delwin (ptr_win->win_status);
if (ptr_win->win_infobar)
delwin (ptr_win->win_infobar);
if (ptr_win->win_input)
delwin (ptr_win->win_input);
/* TODO: free input buffer, lines, messages, completion */
@@ -1485,8 +1684,11 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
}
if ((window != gui_current_window) || (window->sub_lines > 0))
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
if (window->unread_data < 1 + window->last_line->line_with_message)
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
}
}
}
}
@@ -1541,13 +1743,13 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
if ((!window->last_line) || (window->line_complete))
{
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
sprintf (timestamp, "%02d", date_tmp->tm_hour);
snprintf (timestamp, 16, "%02d", date_tmp->tm_hour);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
sprintf (timestamp, "%02d", date_tmp->tm_min);
snprintf (timestamp, 16, "%02d", date_tmp->tm_min);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
sprintf (timestamp, "%02d", date_tmp->tm_sec);
snprintf (timestamp, 16, "%02d", date_tmp->tm_sec);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
+34 -1
View File
@@ -57,10 +57,11 @@ gui_read_keyb ()
{
switch (key)
{
/* resize event: do nothing */
/* resize event */
case KEY_RESIZE:
gui_redraw_window (gui_current_window);
break;
/* previous window */
case KEY_F(6):
gui_switch_to_previous_window ();
break;
@@ -68,6 +69,10 @@ gui_read_keyb ()
case KEY_F(7):
gui_switch_to_next_window ();
break;
/* remove last infobar message */
case KEY_F(10):
gui_infobar_remove ();
break;
/* cursor up */
case KEY_UP:
if (gui_current_window->ptr_history)
@@ -352,10 +357,38 @@ gui_main_loop ()
fd_set read_fd;
static struct timeval timeout;
t_irc_server *ptr_server;
int old_min, old_sec;
time_t new_time;
struct tm *local_time;
quit_weechat = 0;
old_min = -1;
old_sec = -1;
while (!quit_weechat)
{
new_time = time (NULL);
local_time = localtime (&new_time);
/* minute has changed ? => redraw infobar */
if (local_time->tm_min != old_min)
{
old_min = local_time->tm_min;
gui_redraw_window_infobar (gui_current_window);
}
/* second has changed ? => count down time for infobar, if needed */
if (local_time->tm_sec != old_sec)
{
old_sec = local_time->tm_sec;
/* TODO: manage splitted windows! */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
gui_infobar->remaining_time--;
if (gui_infobar->remaining_time == 0)
gui_infobar_remove ();
}
}
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
FD_ZERO (&read_fd);
+2 -2
View File
@@ -15,9 +15,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
bin_PROGRAMS = weechat-gtk
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS)
INCLUDES = $(GTK_CFLAGS)
bin_PROGRAMS = weechat-gtk
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
+39
View File
@@ -349,6 +349,35 @@ gui_redraw_window_status (t_gui_window *window)
gui_draw_window_status (window);
}
/*
* gui_draw_window_infobar: draw infobar window
*/
void
gui_draw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
/* TODO: draw infobar window! */
}
/*
* gui_redraw_window_infobar: redraw infobar window
*/
void
gui_redraw_window_infobar (t_gui_window *window)
{
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
/* TODO: first delete window content */
gui_draw_window_infobar (window);
}
/*
* gui_draw_window_input: draw input window
*/
@@ -570,6 +599,16 @@ gui_init_colors ()
/* TODO: init colors for Gtk */
}
/*
* gui_set_window_title: set window title
*/
void
gui_set_window_title ()
{
/* TODO: set window title for Gtk */
}
/*
* gui_init: init GUI
*/
+58 -1
View File
@@ -42,6 +42,7 @@ int gui_ready; /* = 1 if GUI is initialized */
t_gui_window *gui_windows = NULL; /* pointer to first window */
t_gui_window *last_gui_window = NULL; /* pointer to last window */
t_gui_window *gui_current_window = NULL; /* pointer to current window */
t_gui_infobar *gui_infobar; /* pointer to infobar content */
/*
@@ -182,6 +183,62 @@ gui_window_clear_all ()
gui_window_clear (ptr_win);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buffer);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
/* TODO: manage splitted windows! */
gui_redraw_window_infobar (gui_current_window);
}
else
wee_log_printf (_("%s not enough memory for infobar message\n"),
WEECHAT_ERROR);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
/* TODO: manage splitted windows! */
gui_redraw_window_infobar (gui_current_window);
}
}
/*
* gui_window_free: delete a window
*/
@@ -234,7 +291,7 @@ gui_window_free (t_gui_window *window)
/* always at least one window */
if (!gui_windows && create_new)
gui_window_new (NULL, NULL, 1);
(void) gui_window_new (NULL, NULL, 1);
}
/*
+39 -18
View File
@@ -26,7 +26,7 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 36
#define NUM_COLORS 38
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
@@ -43,18 +43,20 @@
#define COLOR_WIN_STATUS_DATA_MSG 14
#define COLOR_WIN_STATUS_DATA_OTHER 15
#define COLOR_WIN_STATUS_MORE 16
#define COLOR_WIN_INPUT 17
#define COLOR_WIN_INPUT_CHANNEL 18
#define COLOR_WIN_INPUT_NICK 19
#define COLOR_WIN_NICK 20
#define COLOR_WIN_NICK_OP 21
#define COLOR_WIN_NICK_HALFOP 22
#define COLOR_WIN_NICK_VOICE 23
#define COLOR_WIN_NICK_SEP 24
#define COLOR_WIN_NICK_SELF 25
#define COLOR_WIN_NICK_PRIVATE 26
#define COLOR_WIN_NICK_FIRST 27
#define COLOR_WIN_NICK_LAST 36
#define COLOR_WIN_INFOBAR 17
#define COLOR_WIN_INFOBAR_HIGHLIGHT 18
#define COLOR_WIN_INPUT 19
#define COLOR_WIN_INPUT_CHANNEL 20
#define COLOR_WIN_INPUT_NICK 21
#define COLOR_WIN_NICK 22
#define COLOR_WIN_NICK_OP 23
#define COLOR_WIN_NICK_HALFOP 24
#define COLOR_WIN_NICK_VOICE 25
#define COLOR_WIN_NICK_SEP 26
#define COLOR_WIN_NICK_SELF 27
#define COLOR_WIN_NICK_PRIVATE 28
#define COLOR_WIN_NICK_FIRST 29
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define SERVER(window) ((t_irc_server *)(window->server))
@@ -107,6 +109,18 @@ struct t_gui_color
int color;
};
typedef struct t_gui_infobar t_gui_infobar;
struct t_gui_infobar
{
int color; /* text color */
char *text; /* infobar text */
int remaining_time; /* delay (sec) before erasing this text */
/* if < 0, text is never erased (except */
/* by user action to erase it) */
t_gui_infobar *next_infobar; /* next message for infobar */
};
typedef struct t_gui_window t_gui_window;
struct t_gui_window
@@ -138,16 +152,17 @@ struct t_gui_window
void *win_chat; /* chat window (exemple: channel) */
void *win_nick; /* nick window */
void *win_status; /* status window */
void *win_infobar; /* info bar window */
void *win_input; /* input window */
/* windows for Curses GUI */
/* windows for Gtk GUI */
void *textview_chat; /* textview widget for chat */
void *textbuffer_chat; /* textbuffer widget for chat */
void *texttag_chat; /* texttag widget for chat */
void *textview_nicklist; /* textview widget for nicklist */
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
/* windows for Curses GUI */
/* windows for Qt GUI */
/* TODO: declare Qt window */
/* chat content (lines, line is composed by many messages) */
@@ -183,13 +198,16 @@ extern int gui_ready;
extern t_gui_window *gui_windows;
extern t_gui_window *last_gui_window;
extern t_gui_window *gui_current_window;
extern t_gui_infobar *gui_infobar;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (/*@null@*/ void *, /*@null@*/ void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_remove ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
@@ -211,6 +229,8 @@ extern void gui_draw_window_nick (t_gui_window *);
extern void gui_redraw_window_nick (t_gui_window *);
extern void gui_draw_window_status (t_gui_window *);
extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_infobar (t_gui_window *);
extern void gui_redraw_window_infobar (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
@@ -221,11 +241,12 @@ extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_pre_init (int *, char **[]);
//extern void gui_init_colors ();
extern void gui_init_colors ();
extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_printf_color_type (/*@null@*/ t_gui_window *, int, int, char *, ...);
extern void gui_main_loop ();
#endif /* gui.h */
+3
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
noinst_LIBRARIES = lib_weechat_irc.a
lib_weechat_irc_a_SOURCES = irc.h \
@@ -24,4 +26,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
irc-server.c \
irc-channel.c \
irc-nick.c \
irc-dcc.c \
irc-display.c
+5
View File
@@ -32,6 +32,7 @@
t_irc_channel *current_channel = NULL;
char *channel_modes = "iklmnst";
/*
@@ -55,6 +56,10 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
new_channel->topic = NULL;
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
new_channel->limit = 0;
new_channel->key = NULL;
new_channel->nicks = NULL;
new_channel->last_nick = NULL;
+22 -5
View File
@@ -44,6 +44,12 @@ t_irc_command irc_commands[] =
N_("nickname type"),
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
{ "dcc", N_("starts DCC (file or chat)"),
N_("action nickname [file]"),
N_("action: 'send' (file) or 'chat'\n"
"nickname: nickname to send file or chat\n"
"file: filename (on local host)"),
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 },
@@ -119,15 +125,15 @@ t_irc_command irc_commands[] =
" w: user receives wallops\n"
" o: operator flag\n"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
{ "motd", N_("get the \"Message Of The Day\""),
N_("[target]"),
N_("target: server name"),
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
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 },
@@ -158,6 +164,11 @@ t_irc_command irc_commands[] =
{ "privmsg", N_("message received"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
N_("nickname: nickname for private conversation"
"\ntext: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
{ "quit", N_("close all connections & quit " PACKAGE_NAME),
N_("[quit_message]"),
N_("quit_message: quit message (displayed to other users)"),
@@ -280,6 +291,8 @@ t_irc_command irc_commands[] =
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "332", N_("topic of channel"),
N_("channel :topic"),
@@ -383,6 +396,10 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "475", N_("cannot join channel (bad channel key)"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "476", N_("bad channel mask"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "477", N_("channel doesn't support modes"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "481", N_("you're not an IRC operator"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "482", N_("you're not channel operator"),
+515 -193
View File
@@ -183,7 +183,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
_(" has joined "));
gui_printf_color (ptr_channel->window, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
nick_new (ptr_channel, host, 0, 0, 0);
(void) nick_new (ptr_channel, host, 0, 0, 0);
gui_redraw_window_nick (gui_current_window);
return 0;
}
@@ -271,6 +271,256 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
return 0;
}
/*
* irc_get_channel_modes: get channel modes
*/
void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
char *nick_host, char *modes, char *parm)
{
char *pos, set_flag;
t_irc_nick *ptr_nick;
set_flag = '+';
while (modes && modes[0])
{
switch (modes[0])
{
case '+':
set_flag = '+';
break;
case '-':
set_flag = '-';
break;
case 'b':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "b", nick_host,
(set_flag == '+') ?
_("sets ban on") :
_("removes ban on"),
(parm) ? parm : NULL);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'i':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "i", nick_host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
_("removes invite-only channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_INVITE);
break;
case 'k':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "k", nick_host,
(set_flag == '+') ?
_("sets channel key to") :
_("removes channel key"),
(set_flag == '+') ?
((parm) ? parm : NULL) :
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_KEY);
if (ptr_channel->key)
free (ptr_channel->key);
ptr_channel->key = strdup (parm);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'l':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "l", nick_host,
(set_flag == '+') ?
_("sets the user limit to") :
_("removes user limit"),
(set_flag == '+') ?
((parm) ? parm : NULL) :
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_LIMIT);
ptr_channel->limit = atoi (parm);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'm':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "m", nick_host,
(set_flag == '+') ?
_("sets moderated channel flag") :
_("removes moderated channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_MODERATED);
break;
case 'n':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "n", nick_host,
(set_flag == '+') ?
_("sets messages from channel only flag") :
_("removes messages from channel only flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_NO_MSG_OUT);
break;
case 'o':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "o", nick_host,
(set_flag == '+') ?
_("gives channel operator status to") :
_("removes channel operator status from"),
(parm) ? parm : NULL);
if (parm)
{
ptr_nick = nick_search (ptr_channel, parm);
if (ptr_nick)
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
}
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 'p':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "p", nick_host,
(set_flag == '+') ?
_("sets private channel flag") :
_("removes private channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 's':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "s", nick_host,
(set_flag == '+') ?
_("sets secret channel flag") :
_("removes secret channel flag"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 't':
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "t", nick_host,
(set_flag == '+') ?
_("sets topic protection") :
_("removes topic protection"),
NULL);
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_TOPIC);
break;
case 'v':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->window,
channel_name, set_flag, "v", nick_host,
(set_flag == '+') ?
_("gives voice to") :
_("removes voice from"),
(parm) ? parm : NULL);
if (parm)
{
ptr_nick = nick_search (ptr_channel, parm);
if (ptr_nick)
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
}
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
}
modes++;
}
}
/*
* irc_cmd_recv_mode: 'mode' message received
*/
@@ -278,10 +528,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
int
irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *pos_parm;
char set_flag;
char *pos, *pos_parm;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
/* no host => we can't identify sender of message! */
if (host == NULL)
@@ -317,127 +565,15 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
pos_parm++;
while (pos_parm[0] == ' ')
pos_parm++;
pos2 = strchr (pos_parm, ' ');
if (pos2)
pos2[0] = '\0';
}
set_flag = '+';
if (string_is_channel (arguments))
{
ptr_channel = channel_search (server, arguments);
if (ptr_channel)
{
/* channel modes */
while (pos && pos[0])
{
switch (pos[0])
{
case '+':
set_flag = '+';
break;
case '-':
set_flag = '-';
break;
case 'b':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "b", host,
(set_flag == '+') ?
_("sets ban on") :
_("removes ban on"),
pos_parm);
/* TODO: change & redraw channel modes */
break;
case 'i':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "i", host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
_("removes invite-only channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'l':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "l", host,
(set_flag == '+') ?
_("sets the user limit to") :
_("removes user limit"),
(set_flag == '+') ? pos_parm : NULL);
/* TODO: change & redraw channel modes */
break;
case 'm':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "m", host,
(set_flag == '+') ?
_("sets moderated channel flag") :
_("removes moderated channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'o':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "o", host,
(set_flag == '+') ?
_("gives channel operator status to") :
_("removes channel operator status from"),
pos_parm);
ptr_nick = nick_search (ptr_channel, pos_parm);
if (ptr_nick)
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
break;
/* TODO: remove this obsolete (?) channel flag? */
case 'p':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "p", host,
(set_flag == '+') ?
_("sets private channel flag") :
_("removes private channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 's':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "s", host,
(set_flag == '+') ?
_("sets secret channel flag") :
_("removes secret channel flag"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 't':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "t", host,
(set_flag == '+') ?
_("sets topic protection") :
_("removes topic protection"),
NULL);
/* TODO: change & redraw channel modes */
break;
case 'v':
irc_display_mode (ptr_channel->window,
arguments, set_flag, "v", host,
(set_flag == '+') ?
_("gives voice to") :
_("removes voice from"),
pos_parm);
ptr_nick = nick_search (ptr_channel, pos_parm);
if (ptr_nick)
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
gui_redraw_window_nick (ptr_channel->window);
}
break;
}
pos++;
}
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
gui_draw_window_status (gui_current_window);
}
else
{
@@ -466,6 +602,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
int nick_is_me;
t_gui_window *ptr_window;
/* no host => we can't identify sender of message! */
if (host == NULL)
@@ -487,7 +624,23 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
ptr_nick = nick_search (ptr_channel, host);
if (ptr_nick)
{
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0);
/* change nickname in any opened private window */
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
{
if ((SERVER(ptr_window) == server) && WIN_IS_PRIVATE(ptr_window))
{
if ((CHANNEL(ptr_window)->name)
&& (strcmp (ptr_nick->nick, CHANNEL(ptr_window)->name) == 0))
{
free (CHANNEL(ptr_window)->name);
CHANNEL(ptr_window)->name = strdup (arguments);
}
}
}
/* change nickname on channel */
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0;
nick_change (ptr_channel, ptr_nick, arguments);
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
if (nick_is_me)
@@ -519,6 +672,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
free (server->nick);
server->nick = strdup (arguments);
}
gui_redraw_window_status (gui_current_window);
gui_redraw_window_input (gui_current_window);
return 0;
@@ -741,6 +895,7 @@ int
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
struct utsname *buf;
@@ -787,8 +942,21 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->window, PREFIX_ACTION_ME);
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host);
if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
ptr_channel->name,
host, pos);
}
else
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT, " %s\n", pos);
}
@@ -798,8 +966,17 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
irc_display_nick (ptr_channel->window, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
@@ -845,15 +1022,23 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (strcmp (pos, "\01VERSION\01") == 0)
{
buf = (struct utsname *) malloc (sizeof (struct utsname));
uname (buf);
server_sendf (server,
_("NOTICE %s :%sVERSION %s v%s"
" compiled on %s, host \"%s\" is running "
"%s %s / %s%s"),
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
&buf->nodename, &buf->sysname,
&buf->release, &buf->machine, "\01\r\n");
free (buf);
if (buf && (uname (buf) == 0))
{
server_sendf (server,
"NOTICE %s :%sVERSION %s v%s"
" compiled on %s, running "
"%s %s / %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
&buf->sysname,
&buf->release, &buf->machine, "\01\r\n");
free (buf);
}
else
server_sendf (server,
"NOTICE %s :%sVERSION %s v%s"
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
irc_display_prefix (server->window, PREFIX_INFO);
gui_printf_color (server->window,
COLOR_WIN_CHAT, _("Received a "));
@@ -863,71 +1048,144 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT, _("from"));
gui_printf_color (server->window,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
/* ping request from another user => answer */
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
return 0;
}
/* incoming DCC file */
if (strncmp (pos, "\01DCC SEND", 9) == 0)
{
pos2 = strchr (pos, '\01');
if (!pos2)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
pos_file = pos + 9;
while (pos_file[0] == ' ')
pos_file++;
/* look for file size */
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_size;
pos_size++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC address (IP) */
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
gui_printf (server->window,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_addr;
pos_addr++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
pos_file, pos_addr, pos_port, pos_size);
return 0;
}
/* private message received => display it */
ptr_channel = channel_search (server, host);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
}
}
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
gui_redraw_window_title (ptr_channel->window);
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
{
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->window != gui_current_window) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
{
/* ping request from another user => answer */
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
}
else
{
/* private message received => display it */
ptr_channel = channel_search (server, host);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
}
}
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
gui_redraw_window_title (ptr_channel->window);
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
else
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
}
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
@@ -1968,6 +2226,69 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
return 0;
}
/*
* irc_cmd_recv_324: '324' command (channel mode)
*/
int
irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
{
char *pos_chan, *pos, *pos_parm;
t_irc_channel *ptr_channel;
/* make gcc happy */
(void) host;
pos_chan = strchr (arguments, ' ');
if (pos_chan)
{
pos_chan[0] = '\0';
pos_chan++;
while (pos_chan[0] == ' ')
pos_chan++;
pos = strchr (pos_chan, ' ');
if (pos)
{
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
pos_parm = strchr (pos, ' ');
if (pos_parm)
{
pos_parm[0] = '\0';
pos_parm++;
while (pos_parm[0] == ' ')
pos_parm++;
}
ptr_channel = channel_search (server, pos_chan);
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
gui_draw_window_status (gui_current_window);
}
}
}
return 0;
}
/*
* irc_cmd_recv_329: '329' command (???)
*/
int
irc_cmd_recv_329 (t_irc_server *server, char *host, char *arguments)
{
/* make gcc happy */
(void) server;
(void) host;
(void) arguments;
return 0;
}
/*
* irc_cmd_recv_331: '331' command received (no topic for channel)
*/
@@ -2477,6 +2798,7 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
_("normal"));
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
irc_cmd_send_mode (server, ptr_channel->name);
}
else
{
+99 -21
View File
@@ -101,7 +101,7 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (server->is_connected)
if (ptr_server->is_connected)
{
if (pos)
server_sendf (ptr_server, "AWAY :%s\r\n", pos);
@@ -178,6 +178,17 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_dcc: starts DCC (file or chat)
*/
int
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
{
/* TODO: write this command! */
return 0;
}
/*
* irc_cmd_send_deop: remove operator privileges from nickname(s)
*/
@@ -405,6 +416,20 @@ irc_cmd_send_mode (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_motd: get the "Message Of The Day"
*/
int
irc_cmd_send_motd (t_irc_server *server, char *arguments)
{
if (arguments)
server_sendf (server, "MOTD %s\r\n", arguments);
else
server_sendf (server, "MOTD\r\n");
return 0;
}
/*
* irc_cmd_send_msg: send a message to a nick or channel
*/
@@ -526,20 +551,6 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_motd: get the "Message Of The Day"
*/
int
irc_cmd_send_motd (t_irc_server *server, char *arguments)
{
if (arguments)
server_sendf (server, "MOTD %s\r\n", arguments);
else
server_sendf (server, "MOTD\r\n");
return 0;
}
/*
* irc_cmd_send_names: list nicknames on channels
*/
@@ -622,7 +633,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
int
irc_cmd_send_oper (t_irc_server *server, char *arguments)
{
server_sendf (server, "OPER %s %s\r\n", arguments);
server_sendf (server, "OPER %s\r\n", arguments);
return 0;
}
@@ -714,6 +725,64 @@ irc_cmd_send_pong (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_query: start private conversation with a nick
*/
int
irc_cmd_send_query (t_irc_server *server, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
pos = strchr (arguments, ' ');
if (pos)
{
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
if (!pos[0])
pos = NULL;
}
/* create private window if not already opened */
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
gui_printf (server->window,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
gui_redraw_window_title (ptr_channel->window);
}
/* display text if given */
if (pos)
{
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
return 0;
}
/*
* irc_cmd_send_quit: disconnect from all servers and quit WeeChat
*/
@@ -721,12 +790,21 @@ irc_cmd_send_pong (t_irc_server *server, char *arguments)
int
irc_cmd_send_quit (t_irc_server *server, char *arguments)
{
if (server && server->is_connected)
t_irc_server *ptr_server;
/* make gcc happy */
(void) server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (arguments)
server_sendf (server, "QUIT :%s\r\n", arguments);
else
server_sendf (server, "QUIT\r\n");
if (ptr_server->is_connected)
{
if (arguments)
server_sendf (ptr_server, "QUIT :%s\r\n", arguments);
else
server_sendf (ptr_server, "QUIT\r\n");
}
}
quit_weechat = 1;
return 0;
+194 -69
View File
@@ -26,9 +26,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -59,6 +61,7 @@ server_init (t_irc_server *server)
{
server->name = NULL;
server->autoconnect = 0;
server->command_line = 0;
server->address = NULL;
server->port = -1;
server->password = NULL;
@@ -80,6 +83,103 @@ server_init (t_irc_server *server)
server->last_channel = NULL;
}
/*
* server_init_with_url: init a server with url of this form:
* irc://nick:pass@irc.toto.org:6667
* returns: 0 = ok
* -1 = invalid syntax
*/
int
server_init_with_url (char *irc_url, t_irc_server *server)
{
char *url, *pos_server, *pos_channel, *pos, *pos2;
struct passwd *my_passwd;
server_init (server);
if (strncasecmp (irc_url, "irc://", 6) != 0)
return -1;
url = strdup (irc_url);
pos_server = strchr (url, '@');
if (pos_server)
{
pos_server[0] = '\0';
pos_server++;
pos = url + 6;
if (!pos[0])
{
free (url);
return -1;
}
pos2 = strchr (pos, ':');
if (pos2)
{
pos2[0] = '\0';
server->password = strdup (pos2 + 1);
}
server->nick1 = strdup (pos);
}
else
{
if ((my_passwd = getpwuid (geteuid ())) != NULL)
server->nick1 = strdup (my_passwd->pw_name);
else
{
fprintf (stderr, "%s: %s (%s).",
WEECHAT_WARNING,
_("Unable to get user's name"),
strerror (errno));
free (url);
return -1;
}
pos_server = url + 6;
}
if (!pos_server[0])
{
free (url);
return -1;
}
pos_channel = strchr (pos_server, '/');
if (pos_channel)
{
pos_channel[0] = '\0';
pos_channel++;
}
pos = strchr (pos_server, ':');
if (pos)
{
pos[0] = '\0';
server->port = atoi (pos + 1);
}
server->name = strdup (pos_server);
server->address = strdup (pos_server);
if (pos_channel && pos_channel[0])
{
if (string_is_channel (pos_channel))
server->autojoin = strdup (pos_channel);
else
{
server->autojoin = (char *) malloc (strlen (pos_channel) + 2);
strcpy (server->autojoin, "#");
strcat (server->autojoin, pos_channel);
}
}
free (url);
/* some default values */
if (server->port < 0)
server->port = DEFAULT_IRC_PORT;
server->nick2 = (char *) malloc (strlen (server->nick1) + 2);
strcpy (server->nick2, server->nick1);
server->nick2 = strcat (server->nick2, "1");
server->nick3 = (char *) malloc (strlen (server->nick1) + 2);
strcpy (server->nick3, server->nick1);
server->nick3 = strcat (server->nick3, "2");
return 0;
}
/*
* server_alloc: allocate a new server and add it to the servers queue
*/
@@ -193,8 +293,8 @@ server_free_all ()
*/
t_irc_server *
server_new (char *name, int autoconnect, char *address, int port,
char *password, char *nick1, char *nick2, char *nick3,
server_new (char *name, int autoconnect, int command_line, char *address,
int port, char *password, char *nick1, char *nick2, char *nick3,
char *username, char *realname, char *command, char *autojoin)
{
t_irc_server *new_server;
@@ -216,6 +316,7 @@ server_new (char *name, int autoconnect, char *address, int port,
{
new_server->name = strdup (name);
new_server->autoconnect = autoconnect;
new_server->command_line = command_line;
new_server->address = strdup (address);
new_server->port = port;
new_server->password = (password) ? strdup (password) : strdup ("");
@@ -254,7 +355,7 @@ server_send (t_irc_server * server, char *buffer, int size_buf)
* server_sendf: send formatted data to irc server
*/
int
void
server_sendf (t_irc_server * server, char *fmt, ...)
{
va_list args;
@@ -262,14 +363,14 @@ server_sendf (t_irc_server * server, char *fmt, ...)
int size_buf;
if (!server)
return -1;
return;
va_start (args, fmt);
size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
va_end (args);
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
return 0;
return;
buffer[sizeof (buffer) - 1] = '\0';
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
@@ -279,7 +380,9 @@ server_sendf (t_irc_server * server, char *fmt, ...)
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
#endif
buffer[size_buf - 2] = '\r';
return server_send (server, buffer, size_buf);
if (server_send (server, buffer, size_buf) <= 0)
gui_printf (server->window, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
}
/*
@@ -287,18 +390,32 @@ server_sendf (t_irc_server * server, char *fmt, ...)
*/
void
server_msgq_add_msg (t_irc_server * server, char *msg)
server_msgq_add_msg (t_irc_server *server, char *msg)
{
t_irc_message *message;
message = (t_irc_message *) malloc (sizeof (t_irc_message));
if (!message)
{
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
return;
}
message->server = server;
if (unterminated_message)
{
message->data = (char *) malloc (strlen (unterminated_message) +
strlen (msg) + 1);
strcpy (message->data, unterminated_message);
strcat (message->data, msg);
if (!message->data)
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
{
strcpy (message->data, unterminated_message);
strcat (message->data, msg);
}
free (unterminated_message);
unterminated_message = NULL;
}
@@ -344,7 +461,12 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
unterminated_message =
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
strcpy (unterminated_message, buffer);
if (!unterminated_message)
gui_printf (server->window,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
strcpy (unterminated_message, buffer);
return;
}
gui_printf (server->window,
@@ -362,81 +484,83 @@ void
server_msgq_flush ()
{
t_irc_message *next;
/*char **argv;
int argc;*/
char *entire_line, *ptr_data, *pos, *pos2;
char *host, *command, *args;
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
while (recv_msgq)
{
#ifdef DEBUG
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
#endif
ptr_data = recv_msgq->data;
entire_line = strdup (ptr_data);
while (ptr_data[0] == ' ')
ptr_data++;
if (ptr_data)
if (recv_msgq->data)
{
#ifdef DEBUG
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
#endif
host = NULL;
command = NULL;
args = ptr_data;
ptr_data = recv_msgq->data;
entire_line = strdup (ptr_data);
if (ptr_data[0] == ':')
{
pos = strchr(ptr_data, ' ');
pos[0] = '\0';
host = ptr_data+1;
pos++;
}
else
pos = ptr_data;
while (ptr_data[0] == ' ')
ptr_data++;
if (pos != NULL)
if (ptr_data)
{
while (pos[0] == ' ')
pos++;
pos2 = strchr(pos, ' ');
if (pos2 != NULL)
#ifdef DEBUG
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
#endif
host = NULL;
command = NULL;
args = ptr_data;
if (ptr_data[0] == ':')
{
pos2[0] = '\0';
command = strdup(pos);
pos2++;
while (pos2[0] == ' ')
pos = strchr(ptr_data, ' ');
pos[0] = '\0';
host = ptr_data+1;
pos++;
}
else
pos = ptr_data;
if (pos != NULL)
{
while (pos[0] == ' ')
pos++;
pos2 = strchr(pos, ' ');
if (pos2 != NULL)
{
pos2[0] = '\0';
command = strdup(pos);
pos2++;
args = (pos2[0] == ':') ? pos2+1 : pos2;
while (pos2[0] == ' ')
pos2++;
args = (pos2[0] == ':') ? pos2+1 : pos2;
}
}
switch (irc_recv_command (recv_msgq->server, entire_line, host,
command, args))
{
case -1:
gui_printf (recv_msgq->server->window,
_("Command '%s' failed!\n"), command);
break;
case -2:
gui_printf (recv_msgq->server->window,
_("No command to execute!\n"));
break;
case -3:
gui_printf (recv_msgq->server->window,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
}
}
switch (irc_recv_command (recv_msgq->server, entire_line, host,
command, args))
{
case -1:
gui_printf (recv_msgq->server->window,
_("Command '%s' failed!\n"), command);
break;
case -2:
gui_printf (recv_msgq->server->window,
_("No command to execute!\n"));
break;
case -3:
gui_printf (recv_msgq->server->window,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
}
free (entire_line);
free (recv_msgq->data);
}
free (entire_line);
free (recv_msgq->data);
next = recv_msgq->next_message;
free (recv_msgq);
recv_msgq = next;
@@ -574,16 +698,17 @@ server_connect (t_irc_server *server)
*/
void
server_auto_connect ()
server_auto_connect (int command_line)
{
t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server->autoconnect)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
gui_window_new (ptr_server, NULL, 1);
(void) gui_window_new (ptr_server, NULL, 1);
if (server_connect (ptr_server))
irc_login (ptr_server);
}
+35 -5
View File
@@ -34,6 +34,22 @@
#define CHANNEL_PREFIX "#&+!"
#define NUM_CHANNEL_MODES 7
#define CHANNEL_MODE_INVITE 0
#define CHANNEL_MODE_KEY 1
#define CHANNEL_MODE_LIMIT 2
#define CHANNEL_MODE_MODERATED 3
#define CHANNEL_MODE_NO_MSG_OUT 4
#define CHANNEL_MODE_SECRET 5
#define CHANNEL_MODE_TOPIC 6
#define SET_CHANNEL_MODE(channel, set, mode) \
if (set) \
channel->modes[mode] = channel_modes[mode]; \
else \
channel->modes[mode] = ' ';
#define DEFAULT_IRC_PORT 6667
/* nick types */
typedef struct t_irc_nick t_irc_nick;
@@ -62,6 +78,9 @@ struct t_irc_channel
int type; /* channel type */
char *name; /* name of channel (exemple: "#abc") */
char *topic; /* topic of channel (host for private) */
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
int limit; /* user limit (0 is limit not set) */
char *key; /* channel key (NULL if no key is set) */
t_irc_nick *nicks; /* nicks on the channel */
t_irc_nick *last_nick; /* last nick on the channel */
t_gui_window *window; /* GUI window allocated for channel */
@@ -78,6 +97,7 @@ struct t_irc_server
/* user choices */
char *name; /* name of server (only for display) */
int autoconnect; /* = 1 if auto connect at startup */
int command_line; /* server was given on command line */
char *address; /* address of server (IP or name) */
int port; /* port for server (6667 by default) */
char *password; /* password for server */
@@ -136,21 +156,23 @@ extern t_irc_command irc_commands[];
extern t_irc_server *irc_servers, *current_irc_server;
extern t_irc_message *recv_msgq, *msgq_last_msg;
extern t_irc_channel *current_channel;
extern char *channel_modes;
/* server functions (irc-server.c) */
extern void server_init (t_irc_server *);
extern int server_init_with_url (char *, t_irc_server *);
extern t_irc_server *server_alloc ();
extern void server_destroy (t_irc_server *);
extern void server_free (t_irc_server *);
extern void server_free_all ();
extern t_irc_server *server_new (char *, int, char *, int, char *, char *,
extern t_irc_server *server_new (char *, int, int, char *, int, char *, char *,
char *, char *, char *, char *, char *, char *);
extern int server_send (t_irc_server *, char *, int);
extern int server_sendf (t_irc_server *, char *, ...);
extern void server_sendf (t_irc_server *, char *, ...);
extern void server_recv (t_irc_server *);
extern int server_connect ();
extern void server_auto_connect ();
extern void server_auto_connect (int);
extern void server_disconnect (t_irc_server *);
extern void server_disconnect_all ();
extern t_irc_server *server_search (char *);
@@ -176,9 +198,13 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
extern int nick_get_max_length (t_irc_channel *);
/* DCC functions (irc-dcc.c) */
extern void dcc_send ();
/* IRC display (irc-diplay.c) */
extern void irc_display_prefix (t_gui_window *, char *);
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
char *, char *);
@@ -191,6 +217,7 @@ extern void irc_login (t_irc_server *);
extern int irc_cmd_send_admin (t_irc_server *, char *);
extern int irc_cmd_send_away (t_irc_server *, char *);
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
extern int irc_cmd_send_dcc (t_irc_server *, char *);
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
extern int irc_cmd_send_die (t_irc_server *, char *);
@@ -205,8 +232,8 @@ extern int irc_cmd_send_list (t_irc_server *, char *);
extern int irc_cmd_send_lusers (t_irc_server *, char *);
extern int irc_cmd_send_me (t_irc_server *, char *);
extern int irc_cmd_send_mode (t_irc_server *, char *);
extern int irc_cmd_send_msg (t_irc_server *, char *);
extern int irc_cmd_send_motd (t_irc_server *, char *);
extern int irc_cmd_send_msg (t_irc_server *, char *);
extern int irc_cmd_send_names (t_irc_server *, char *);
extern int irc_cmd_send_nick (t_irc_server *, int, char **);
extern int irc_cmd_send_notice (t_irc_server *, char *);
@@ -215,6 +242,7 @@ extern int irc_cmd_send_oper (t_irc_server *, char *);
extern int irc_cmd_send_part (t_irc_server *, char *);
extern int irc_cmd_send_ping (t_irc_server *, char *);
extern int irc_cmd_send_pong (t_irc_server *, char *);
extern int irc_cmd_send_query (t_irc_server *, char *);
extern int irc_cmd_send_quit (t_irc_server *, char *);
extern int irc_cmd_send_quote (t_irc_server *, char *);
extern int irc_cmd_send_rehash (t_irc_server *, char *);
@@ -268,6 +296,8 @@ extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
+2
View File
@@ -15,6 +15,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
if PLUGIN_PERL
perl_dir = perl
endif
+1 -1
View File
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
INCLUDES = $(PERL_CFLAGS)
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
noinst_LIBRARIES = lib_weechat_perl.a
+25
View File
@@ -202,6 +202,30 @@ static XS (XS_IRC_print_with_channel)
XSRETURN_NO;
}
/*
* IRC::print_infobar: print message to infobar
*/
static XS (XS_IRC_print_infobar)
{
int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (items == 2)
gui_infobar_printf (SvIV (ST (0)), COLOR_WIN_INFOBAR, SvPV (ST (1), integer));
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("Perl error: wrong parameters for IRC::print_infobar Perl function\n"));
}
XSRETURN_EMPTY;
}
/*
* IRC::add_message_handler: add handler for messages (privmsg, ...)
*/
@@ -321,6 +345,7 @@ xs_init (pTHX)
newXS ("IRC::register", XS_IRC_register, "IRC");
newXS ("IRC::print", XS_IRC_print, "IRC");
newXS ("IRC::print_with_channel", XS_IRC_print_with_channel, "IRC");
newXS ("IRC::print_infobar", XS_IRC_print_infobar, "IRC");
newXS ("IRC::add_message_handler", XS_IRC_add_message_handler, "IRC");
newXS ("IRC::add_command_handler", XS_IRC_add_command_handler, "IRC");
newXS ("IRC::get_info", XS_IRC_get_info, "IRC");
+4 -2
View File
@@ -56,15 +56,17 @@ t_plugin_handler *last_plugin_cmd_handler = NULL;
void
plugin_auto_load (int plugin_type, char *directory)
{
int dir_length;
char *dir_name, *current_dir;
DIR *dir;
struct dirent *entry;
struct stat statbuf;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (directory) + 2;
dir_name =
(char *) malloc ((strlen (weechat_home) + strlen (directory) + 2) * sizeof (char));
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
(char *) malloc (dir_length * sizeof (char));
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
/* save working directory */
current_dir = (char *) malloc (1024 * sizeof (char));
+2 -2
View File
@@ -61,14 +61,14 @@ extern t_plugin_script *perl_scripts;
extern void plugin_init ();
extern void plugin_load (int, char *);
extern void plugin_unload (int, char *);
extern void plugin_unload (int, /*@null@*/ char *);
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *);
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **,
int, char *, char *);
extern void plugin_handler_free_all_type (t_plugin_handler **,
t_plugin_handler **, int);
extern void plugin_event_msg (char *, char *);
extern int plugin_exec_command (char *, char *);
extern int plugin_exec_command (char *, /*@null@*/ char *);
extern void plugin_end ();
#endif /* plugins.h */
+17 -2
View File
@@ -1,11 +1,13 @@
.TH WEECHAT 1 "January 2004" "FlashCode"
.TH WEECHAT 1 "June 2004" "FlashCode"
.SH NAME
weechat \- Wee Enhanced Environment for Chat
.SH SYNOPSIS
.B weechat
.RI [ options ]
.RI [ options... ]
or
.RI [ url... ]
.br
.SH DESCRIPTION
@@ -17,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.SH OPTIONS
.TP
.B \-c, \-\-config
.br
display config file help (list of options)
.TP
.B \-h, \-\-help
.br
display summary of options
@@ -29,6 +35,15 @@ display program license
.br
display WeeChat version
.SH URL
WeeChat can use an URL (Uniform Resource Locator) to automatically connect
to an IRC server. These are in the following form:
.TP
.B irc://[[nickname][:password]@]server[:port][/[#&+!]channel]
.TP
Exemple to join WeeChat channel support:
irc://irc.freenode.net/weechat
.SH FILES
.TP
.B $HOME/.weechat/weechat.rc
+8 -3
View File
@@ -1,5 +1,5 @@
%define name weechat
%define version 0.0.4
%define version 0.0.6
%define release 1
Name: %{name}
@@ -10,6 +10,7 @@ Source: http://weechat.flashtux.org/download/%{name}-%{version}.tar.gz
URL: http://weechat.flashtux.org
Group: Networking/IRC
BuildRoot: %{_tmppath}/%{name}-buildroot
Requires: perl
License: GPL
%description
@@ -22,7 +23,7 @@ rm -rf $RPM_BUILD_ROOT
%setup
%build
./configure
./configure --enable-perl
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
%install
@@ -35,11 +36,15 @@ rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-,root,root,0755)
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
%doc AUTHORS BUGS ChangeLog COPYING FAQ FAQ.fr INSTALL NEWS README TODO
/usr/local/man/man1/weechat.1*
/usr/local/bin/weechat-curses
%changelog
* Sat Jun 05 2004 FlashCode <flashcode@flashtux.org> 0.0.6-1
- Released version 0.0.6
* Thu Feb 02 2004 FlashCode <flashcode@flashtux.org> 0.0.5-1
- Released version 0.0.5
* Thu Jan 01 2004 FlashCode <flashcode@flashtux.org> 0.0.4-1
- Released version 0.0.4
* Mon Nov 03 2003 FlashCode <flashcode@flashtux.org> 0.0.3-1