mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 03:03:12 +02:00
Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85c32048cf | |||
| ffbc4c0b0c | |||
| 4e138f3dca | |||
| df66856a28 | |||
| 6950745079 | |||
| 3b6bf81ad6 | |||
| fd3e94070a | |||
| 0708f1a571 | |||
| 3ea696bbc0 | |||
| 57e00428ca | |||
| 555a4191d4 | |||
| a1f09df80f | |||
| c8c5ff3d68 | |||
| e2e384df49 | |||
| 507a5c17c0 | |||
| 4f23a3c621 | |||
| ba618d3276 | |||
| 2f1af3b53e | |||
| 10a170bf7d | |||
| 7a3ee901a4 | |||
| e469f0ef48 | |||
| ba65f5ec30 | |||
| 7779b2f78e | |||
| edcc01bcf0 | |||
| fe4ca01615 | |||
| 62fabde373 | |||
| 8758555b19 | |||
| d4ec2e46aa | |||
| fd9512bbbc | |||
| 176198fdc6 | |||
| 97d5c9bd0e | |||
| 13949e2ace | |||
| 1e1f2ca5b8 | |||
| 8676230eef | |||
| bde34ecd57 | |||
| f245ec3759 | |||
| 5839cc6bfd | |||
| 476054fb4f | |||
| be8b44a2d7 | |||
| 8d33ef0168 | |||
| 2b16f8c0d5 | |||
| 273f4860fe | |||
| 6af18b3dbc | |||
| c488066e33 | |||
| 9746520a24 | |||
| fb7a6efb5a | |||
| dc8368815e | |||
| a81f58f3f1 | |||
| 338e460be9 | |||
| 324077c333 | |||
| 1ba27c760b | |||
| c60a693f42 | |||
| 65c9a79603 | |||
| cafd93dcdd | |||
| 6d6eafa82a | |||
| d2d14ffb8f | |||
| f966b6a829 | |||
| b837017ba6 | |||
| ee3bb0d14f | |||
| 13716a5228 | |||
| ecd92ae24d | |||
| 836d7a139a | |||
| c67cfeaa87 | |||
| d92955a533 | |||
| b12527cf90 | |||
| 509c5738ff | |||
| 7a8edd3cea | |||
| 737b422552 | |||
| 67428a1aaf | |||
| 384b8780b0 | |||
| c6a53ea8ee | |||
| d3fc2646a7 | |||
| 2b305f378f | |||
| 64acebf3b5 | |||
| f0ddea9313 | |||
| 954f1b98bf | |||
| 641e5cd05a | |||
| 6668e362c1 | |||
| 627e0a24eb | |||
| ab6ca9a0b4 | |||
| 7e069ec3e2 | |||
| ddd798a65a | |||
| 4fde90e418 | |||
| 65c146e9c6 | |||
| d6454184e4 | |||
| 53efa7d6af | |||
| 073b1d0bd4 | |||
| 2968e61d97 | |||
| ede76f7b44 | |||
| db5ee98418 | |||
| a148073391 | |||
| 2db87e36b8 | |||
| e0fb9723a7 | |||
| 3782ef828a | |||
| cec899898a | |||
| 106bdb1d4a | |||
| ef4e6b93e0 | |||
| d0bb1e0c2a | |||
| 77e0d01d7a | |||
| b4ff775f03 | |||
| 9f1fd921f7 | |||
| 13c7cb9dd4 | |||
| a5ae266ee4 | |||
| a353a6d228 | |||
| 4ad98ebc52 | |||
| c32bc12d8e | |||
| 70cd53af86 | |||
| ac42b65177 | |||
| c3bb49501c | |||
| 625480e448 | |||
| ab6921ff85 | |||
| a7091f895d |
@@ -1,17 +1,20 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
WeeChat known bugs, 2003-09-27
|
WeeChat known bugs, 2004-01-01
|
||||||
|
|
||||||
|
- ./configure does not check that Curses headers are installed
|
||||||
|
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||||
|
- ./configure does not check that Perl headers & libraries are installed
|
||||||
- too much nicks in the channel (> height of window) => display bug
|
- too much nicks in the channel (> height of window) => display bug
|
||||||
- some IRC commands are marked as 'unknown' when received
|
- some IRC commands are marked as 'unknown' when received
|
||||||
(irc protocol is under dev!)
|
(IRC protocol is under dev!)
|
||||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
- too much opened channels => display bug
|
||||||
problem)
|
|
||||||
- alias/unalias commands doesn't work
|
|
||||||
- config is not saved (to ~/.weechat/weechatrc)
|
|
||||||
- intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!)
|
|
||||||
- program is stopped when bad option in config file (it should not, only display
|
|
||||||
warning)
|
|
||||||
- too much opened channel => display bug
|
|
||||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||||
|
- when function key (non used by WeeChat) is pressed, prompt is deleted
|
||||||
|
- when quitting WeeChat term title is not restored (if look_set_title is ON)
|
||||||
|
- command name for /server can not contain spaces
|
||||||
|
- 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)
|
||||||
|
|||||||
@@ -1,88 +1,53 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
ChangeLog - 2003-09-27
|
ChangeLog - 2004-01-01
|
||||||
|
|
||||||
* 2003-09-27:
|
|
||||||
- WeeChat 0.0.1 released!
|
|
||||||
|
|
||||||
* 2003-09-26:
|
Version 0.0.4 (2004-01-01):
|
||||||
- added completor prefix (in config: look_nick_completor)
|
* Perl plugin, with auto-load
|
||||||
- fixef log_printf command (bug with year & month)
|
* when private window is created (another user is talking), WeeChat does not
|
||||||
- added "/kill" command
|
switch to this window
|
||||||
- fixed /version and /ctcp commands (missing ":" before message)
|
* highlight when our nick is written in a channel/private window
|
||||||
|
* ctrl-C now intercepted (ignored)
|
||||||
|
* debug messages can be enabled via ./configure --enbale-debug option
|
||||||
|
|
||||||
* 2003-09-25:
|
Version 0.0.3 (2003-11-03):
|
||||||
- added "/kick" command
|
* ./configure script to build WeeChat
|
||||||
- added IRC errors 402 to 407
|
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||||
- added "/invite" command
|
* fixed problem with '353' IRC message (nicklist)
|
||||||
|
* fixed problem when nick is truncated by server
|
||||||
|
* fixed crash when entering text without any server connection
|
||||||
|
* fixed crash when /set command is executed
|
||||||
|
* fixed display bug (text was blinking when scrolling)
|
||||||
|
* french translation
|
||||||
|
* new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time,
|
||||||
|
/trace, /admin, /info, /servlist, /squery, /who, /whowas, /die, /summon,
|
||||||
|
/users, /wallops, /userhost, /ison, /ctcp ping
|
||||||
|
* code cleanup
|
||||||
|
|
||||||
* 2003-09-24:
|
Version 0.0.2 (2003-10-05):
|
||||||
- "ctcp version" received is now correctly displayed
|
* added commands /rehash and /restart
|
||||||
- "/version" command is ok
|
* command & auto-join channels when connected to server
|
||||||
|
* new commands for alias: /alias, /unalias (new section in config file)
|
||||||
|
* config is now saved automatically when quitting WeeChat, /save command added
|
||||||
|
* new commands for servers: /server, /connect, /disconnect
|
||||||
|
* added autoconnect flag for each server in config file
|
||||||
|
* added "look_set_title" option in config file
|
||||||
|
* term window title is modified with WeeChat name and version
|
||||||
|
* fixed nicklist display bug
|
||||||
|
* fixed crash when sending command which can only be received
|
||||||
|
* CTCP version returns more info (about OS)
|
||||||
|
|
||||||
* 2003-09-23:
|
Version 0.0.1 (2003-09-27):
|
||||||
- log file (~/.weechat/weechat.log)
|
* ncurses GUI with color output
|
||||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
* multi-servers
|
||||||
|
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||||
* 2003-09-21:
|
* private windows
|
||||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||||
unread messages (from other users), lightmagenta for windows with other
|
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||||
unread data (join, part, quit, away, ...)
|
quote, topic, version, voice, whois
|
||||||
- "320" IRC message management
|
* WeeChat commands: clear, help, set (partial)
|
||||||
- "/clear" command
|
* many config options
|
||||||
|
* log file (~/.weechat/weechat.log)
|
||||||
* 2003-09-19:
|
* nicklist can be moved on top, bottom, left or right of window
|
||||||
- préparation des sources pour l'internationalisation avec gettext
|
|
||||||
- "301" IRC command (away message)
|
|
||||||
- functions renamed in rc-commands.c, irc-server.c,
|
|
||||||
command.c and config.c (all functions are beginning with a prefix:
|
|
||||||
irc_cmd_recv_xxx, irc_cmd_send_xxx, server_xxx, weechat_cmd_xxx and
|
|
||||||
config_xxx). Moreover, all commands (sent and received) return a value
|
|
||||||
(success or not)
|
|
||||||
- "/quote" command
|
|
||||||
- "/whois" command (and colored display of /whois result in server window)
|
|
||||||
|
|
||||||
* 2003-09-18:
|
|
||||||
- use of alternate nickname (and 2nd alternate) if nick is already used
|
|
||||||
on server (changed/added in config file: options "nick1", "nick2", "nick3"
|
|
||||||
for a server, all are mandatory)
|
|
||||||
- "433" IRC error management (nickname already in use)
|
|
||||||
- "mode" command received correctly for "channel flags" and
|
|
||||||
op/deop/voice/devoice actions for a nick
|
|
||||||
- "401" IRC error management (no such nick/channel)
|
|
||||||
- private windows management (when received and opened, with /privmsg),
|
|
||||||
"/privmsg" completed consequently
|
|
||||||
|
|
||||||
* 2003-09-17:
|
|
||||||
- nickmode display ((half)op/voice) before nicks (as option, look at config
|
|
||||||
options beginning with "look_nickmode")
|
|
||||||
- windows history is now ok (pgup/pgdn on any window type)
|
|
||||||
- "/me" command (and OK when received)
|
|
||||||
- display nicks count when joining channel or with "/names" command
|
|
||||||
(total, ops, halfops, voices et normaux)
|
|
||||||
|
|
||||||
* 2003-09-16:
|
|
||||||
- added and normalized chat window colors
|
|
||||||
(new colors in config file)
|
|
||||||
- "/topic" command
|
|
||||||
- nicklist can be moved on top, bottom, left or right of window
|
|
||||||
|
|
||||||
* 2003-09-15:
|
|
||||||
- auto-resize of nicklist, according to nick max length
|
|
||||||
- IRC multi-servers is OK
|
|
||||||
|
|
||||||
* 2003-09-14:
|
|
||||||
- no hangup if "/part" command is executed on server window
|
|
||||||
- continue if no server is declared in config file
|
|
||||||
(empty window will be opened for executing WeeChat commands)
|
|
||||||
- string array for strings in config file
|
|
||||||
example: cfg_look_nicklist_position can take values "left", "right",
|
|
||||||
"top", "bottom", which are converted to int (from 0 for "left" to 3 for
|
|
||||||
"bottom")
|
|
||||||
- messages are aligned under time (server window) or under time + nick
|
|
||||||
(channel window)
|
|
||||||
|
|
||||||
* 2003-09-13:
|
|
||||||
- sources exploded in many directories: ./irc, ./gui/curses, ./gui/gtk,
|
|
||||||
./gui/qt and ./gui/text
|
|
||||||
|
|||||||
@@ -1,6 +1,158 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
WeeChat FAQ, 2003-09-19
|
WeeChat FAQ, 2004-01-01
|
||||||
|
|
||||||
<<< TO DO ! >>>
|
|
||||||
|
1- Compiling
|
||||||
|
|
||||||
|
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?
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 1- Compiling |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
|
||||||
|
|
||||||
|
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.2 I can't compile WeeChat CVS.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 2- Using WeeChat |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
|
||||||
|
|
||||||
|
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" ;)
|
||||||
|
|
||||||
|
|
||||||
|
2.2 I've launched WeeChat, but I'm lost, what can I do?
|
||||||
|
|
||||||
|
For help you can type /help. For help about a command, type /help command.
|
||||||
|
|
||||||
|
|
||||||
|
2.3 How can I customize key bindings?
|
||||||
|
|
||||||
|
Today you can't do that. This will be available in a future version.
|
||||||
|
|
||||||
|
|
||||||
|
2.4 How can I load Perl scripts?
|
||||||
|
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||||
|
|
||||||
|
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 ;)
|
||||||
|
|
||||||
|
|
||||||
|
2.5 How can I load Python scripts?
|
||||||
|
|
||||||
|
Today Python interface is not developed, so can't load any Python script.
|
||||||
|
|
||||||
|
|
||||||
|
2.6 How can I load Ruby scripts?
|
||||||
|
|
||||||
|
Today Ruby interface is not developed, so can't load any Ruby script.
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 3- Development |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
3.1 How should I report bugs?
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
WeeChat - Installation instructions
|
WeeChat - Installation instructions
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
1) Run 'make'
|
1) Run './configure'
|
||||||
|
options: --disable-curses : do not build Curses interface
|
||||||
|
--enable-gtk : build Gtk+ interface (under development!)
|
||||||
|
--enable-qt : build Qt interface (not developed!)
|
||||||
|
|
||||||
2) As root, run 'make install'
|
2) Run 'make'
|
||||||
|
|
||||||
3) Enjoy ! :-)
|
3) As root, run 'make install'
|
||||||
|
|
||||||
|
4) Enjoy ! :-)
|
||||||
|
|
||||||
See AUTHORS for any support, feel free to contact us for any problem ;)
|
See AUTHORS for any support, feel free to contact us for any problem ;)
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
SUBDIRS = po intl src
|
||||||
|
|
||||||
|
EXTRA_DIST = weechat.1 BUGS FAQ
|
||||||
|
|
||||||
|
man_MANS = weechat.1
|
||||||
@@ -1,6 +1,18 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
FlashCode, 2003-09-27
|
* FlashCode, 2004-01-01
|
||||||
|
|
||||||
WeeChat 0.0.1 released.
|
WeeChat 0.0.4 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-11-03
|
||||||
|
|
||||||
|
WeeChat 0.0.3 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-10-05
|
||||||
|
|
||||||
|
WeeChat 0.0.2 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-09-27
|
||||||
|
|
||||||
|
WeeChat 0.0.1 released.
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
|
|||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
* IRC chat client with multi-server connection
|
* IRC chat client with multi-server connection
|
||||||
* many GUI (curses, text, Gtk, QT) (1)
|
* many GUI (curses, Gtk, Qt) (1)
|
||||||
* small, fast and very light
|
* small, fast and very light
|
||||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||||
* compliant with RFC 1459,2810,2811,2812,2813
|
* compliant with RFC 1459,2810,2811,2812,2813
|
||||||
|
* developed from scratch (not based on any other IRC client, except for look ;)
|
||||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||||
* 100% GPL & free
|
* 100% GPL & free
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ Features
|
|||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
|
|
||||||
WeeChat (c) Copyright 2003
|
WeeChat (c) Copyright 2004
|
||||||
by: FlashCode <flashcode@flashtux.org>
|
by: FlashCode <flashcode@flashtux.org>
|
||||||
Xahlexx <xahlex@tuxisland.org>
|
Xahlexx <xahlex@tuxisland.org>
|
||||||
Bounga <bounga@altern.org>
|
Bounga <bounga@altern.org>
|
||||||
@@ -45,6 +46,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
(1) only curses & text interfaces are available today
|
(1) only curses interface is available today
|
||||||
(2) plugin interfaces are not yet developed
|
(2) plugin interfaces are not yet developed
|
||||||
(3) only GNU/Linux version is available today
|
(3) only GNU/Linux version is available today
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
TODO - 2003-09-27
|
TODO - 2004-01-01
|
||||||
|
|
||||||
Legend:
|
Legend:
|
||||||
# done
|
# done
|
||||||
@@ -10,121 +10,85 @@ Legend:
|
|||||||
? is this really necessary?
|
? is this really necessary?
|
||||||
|
|
||||||
|
|
||||||
v0.0.1:
|
v0.0.4:
|
||||||
|
------
|
||||||
|
|
||||||
* IRC protocol:
|
* General:
|
||||||
# "/quote" command: send a raw string to the server without parsing it
|
# debug messages can be enabled via ./configure --enbale-debug option
|
||||||
# "/me" command (for user actions description)
|
|
||||||
# "/away" command (to toggle the away status)
|
|
||||||
# "/op", "/deop", "/voice", "/devoice" commands
|
|
||||||
# "/invite" command
|
|
||||||
# "/kick", "/ban", "/unban" commands
|
|
||||||
# "/kill" command
|
|
||||||
# "/list" command: list of channels
|
|
||||||
# "/names" command: view who is on a given channel without being
|
|
||||||
on it (for example /names #weechat gives all the nicks present on
|
|
||||||
#weechat, except those who have the +i flag (server side))
|
|
||||||
# "/oper" command: become operator on the irc network
|
|
||||||
# "/topic" command: change the topic of a channel
|
|
||||||
# "/version" command: give the irc client version (CTCP VERSION)
|
|
||||||
of a given nick/channel (without parameter: gives WeeChat version)
|
|
||||||
# "/whois" command
|
|
||||||
|
|
||||||
* WeeChat commands:
|
|
||||||
# "/clear": to clear window content
|
|
||||||
|
|
||||||
* Interface:
|
* Interface:
|
||||||
# "demi-highlight" when joins/quits etc
|
+ internationalization (traduce WeeChat in many languages)
|
||||||
# log messages/warning/errors to ~/.weechat/log file
|
# intercept Ctrl-C
|
||||||
# improve editing zone (left arrow <> backspace)
|
# when private window is created (another user is talking), WeeChat does not
|
||||||
# sort nick list
|
switch to this window
|
||||||
# choose nick list position (top, left, right (default), bottom)
|
# highlight when our nick is written in a channel/private window
|
||||||
# auto-resize nicklist (when nick too long)
|
|
||||||
# do pretty cutting of long lines (align on the nick or after hour for server)
|
|
||||||
# keep history of commands and call them again with up/down arrow
|
|
||||||
# text GUI
|
|
||||||
# ncurses GUI:
|
|
||||||
# one window for each channel
|
|
||||||
# color display
|
|
||||||
# private windows
|
|
||||||
# redraw window when term size is modified
|
|
||||||
# chat history (pgup/pgdn for displaying history)
|
|
||||||
# switch to other channel window
|
|
||||||
|
|
||||||
* TCP/IP communication:
|
* Plugins:
|
||||||
# IPv4 protocol implementation
|
# Perl plugin
|
||||||
|
# "/perl load" and "/perl unload" commands to (un)load Perl scripts
|
||||||
* Configuration:
|
# auto-load Perl scripts at startup
|
||||||
# write default config file
|
|
||||||
|
|
||||||
|
|
||||||
Future versions:
|
Future versions:
|
||||||
|
---------------
|
||||||
|
|
||||||
|
* General:
|
||||||
|
- Windows version
|
||||||
|
|
||||||
* IRC protocol:
|
* IRC protocol:
|
||||||
- implement RFC 2812
|
|
||||||
+ "/mode" command: change the user/channels modes
|
+ "/mode" command: change the user/channels modes
|
||||||
- "/dcc" command (for chat and sending/receiving files)
|
- "/dcc" command (for chat and sending/receiving files)
|
||||||
- manage "halfop" status
|
|
||||||
- complete "/list" command: add regexp search, display only channels that
|
- complete "/list" command: add regexp search, display only channels that
|
||||||
match regexp
|
match regexp
|
||||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
|
||||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||||
nick/host
|
nick/host
|
||||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||||
When we come back from our away it should print it to the current window
|
When we come back from our away it should print it to the current window
|
||||||
- "/rehash" command: tell the server to reload its config file
|
|
||||||
- "/restart" command: tell the server to restart itself
|
|
||||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||||
nick/host connect to the given irc network
|
nick/host connect to the given irc network
|
||||||
- "/wallops" command: write the same string to all the
|
|
||||||
persons with the flag +w enable
|
|
||||||
|
|
||||||
* WeeChat commands:
|
* 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
|
||||||
- "/completion" command: do shortcuts (for example when we type "u"
|
- "/completion" command: do shortcuts (for example when we type "u"
|
||||||
in the text bar it send it to the server as "you")
|
in the text bar it send it to the server as "you")
|
||||||
- "/exec" command: execute a command as if we was in shell
|
- "/exec" command: execute a command as if we was in shell
|
||||||
and show us the output on the current window. An option to exec
|
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
|
like -o could send the output to the server, on the current
|
||||||
channel/private
|
channel/private
|
||||||
- "/reload" command: reload the WeeChat's config file
|
|
||||||
- "/set" command: allow the user to set the WeeChat variables
|
|
||||||
under WeeChat without editing the config file (colours, time
|
|
||||||
format, etc)
|
|
||||||
- "/highlight" command: highlight a given word when it appears on
|
|
||||||
channels/privates
|
|
||||||
|
|
||||||
* Interface:
|
* Interface:
|
||||||
|
+ Gtk GUI
|
||||||
- display current channel modes (example : #weechat(+nt))
|
- display current channel modes (example : #weechat(+nt))
|
||||||
- interpret ^B in messages (this means bold text)
|
- interpret special chars in messages (color & bold for example)
|
||||||
- internationalization (traduce WeeChat in many languages)
|
|
||||||
- many channel windows in one window/term (window split)
|
- many channel windows in one window/term (window split)
|
||||||
- add lag indicator
|
- add lag indicator
|
||||||
- log chats to file
|
|
||||||
- forget some old lines that were displayed long time ago (now all is saved,
|
- forget some old lines that were displayed long time ago (now all is saved,
|
||||||
if WeeChat is running for long time, a lot of memory is used!)
|
if WeeChat is running for long time, a lot of memory is used!)
|
||||||
- improve completion (for example complete command parameters when possible)
|
- improve completion (for example complete command parameters when possible)
|
||||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||||
- add clock (in status bar?)
|
- add clock (in status bar?)
|
||||||
- Gtk GUI
|
- log chats to file
|
||||||
? Qt GUI
|
? Qt GUI
|
||||||
|
|
||||||
* TCP/IP communication:
|
* TCP/IP communication:
|
||||||
|
- connect to server with child process (background)
|
||||||
|
- proxy support
|
||||||
|
- SSL support
|
||||||
- IPv6 protocol implementation
|
- IPv6 protocol implementation
|
||||||
|
|
||||||
* Configuration:
|
* Configuration:
|
||||||
- add key bindings to config file
|
|
||||||
- add missing options for config file
|
- add missing options for config file
|
||||||
- write config file
|
- add key bindings to config file
|
||||||
- add an option for each server in order to run commands on join
|
|
||||||
(example: /msg nickserv identify password)
|
|
||||||
- channel list for auto-join (for each server)
|
|
||||||
- do not stop program if problem with options in config file
|
|
||||||
- load config file after GUI (so init values by default (colors, ...) before
|
- load config file after GUI (so init values by default (colors, ...) before
|
||||||
loading config)
|
loading config)
|
||||||
|
|
||||||
* Plugins:
|
* Plugins:
|
||||||
- add Perl plugin
|
- Python plugin
|
||||||
- add Python plugin
|
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||||
- add Ruby plugin
|
- Ruby plugin
|
||||||
- "/load" and "/unload" commands to (un)load extension scripts
|
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||||
(perl, python, ruby, ...)
|
|
||||||
|
|||||||
Executable
+55
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
rm -f config.cache
|
||||||
|
|
||||||
|
### GETTEXT ###
|
||||||
|
|
||||||
|
echo searching for GNU gettext intl directory...
|
||||||
|
|
||||||
|
dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share"
|
||||||
|
found=0
|
||||||
|
for try in $dirs; do
|
||||||
|
echo -n " -> $try/gettext/intl... "
|
||||||
|
if test -d $try/gettext/intl; then
|
||||||
|
echo found it
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo no
|
||||||
|
done
|
||||||
|
if test "$found" != 1; then
|
||||||
|
echo ERROR: Cannot find gettext/intl directory.
|
||||||
|
echo ERROR: Install GNU gettext in /usr or /usr/local prefix.
|
||||||
|
exit 7
|
||||||
|
fi;
|
||||||
|
|
||||||
|
echo copying gettext intl files...
|
||||||
|
intldir="$try/gettext/intl"
|
||||||
|
if test ! -d intl; then
|
||||||
|
mkdir intl
|
||||||
|
fi
|
||||||
|
olddir=`pwd`
|
||||||
|
cd $intldir
|
||||||
|
for file in *; do
|
||||||
|
if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
|
||||||
|
rm -f $olddir/intl/$file
|
||||||
|
cp $intldir/$file $olddir/intl/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cp -f $try/gettext/po/Makefile.in.in $olddir/po/
|
||||||
|
cd $olddir
|
||||||
|
if test -f intl/plural.c; then
|
||||||
|
sleep 2
|
||||||
|
touch intl/plural.c
|
||||||
|
fi
|
||||||
|
|
||||||
|
### END GETTEXT ###
|
||||||
|
|
||||||
|
echo "running aclocal..."
|
||||||
|
aclocal -I /usr/share/aclocal
|
||||||
|
echo "running autoconf..."
|
||||||
|
autoconf
|
||||||
|
echo "running autoheader..."
|
||||||
|
autoheader
|
||||||
|
echo "running automake..."
|
||||||
|
automake -a
|
||||||
|
echo "autogen.sh ok, now run ./configure script"
|
||||||
+161
@@ -0,0 +1,161 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
# -*- Autoconf -*-
|
||||||
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
AC_PREREQ(2.56)
|
||||||
|
AC_INIT(WeeChat, 0.0.4, flashcode@flashtux.org)
|
||||||
|
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||||
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
AM_INIT_AUTOMAKE([weechat], [0.0.4])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
|
# Gettext
|
||||||
|
ALL_LINGUAS="fr"
|
||||||
|
AM_GNU_GETTEXT
|
||||||
|
|
||||||
|
# Checks for libraries.
|
||||||
|
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])
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_STRUCT_TM
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_REALLOC
|
||||||
|
AC_FUNC_SELECT_ARGTYPES
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||||
|
|
||||||
|
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||||
|
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||||
|
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
|
||||||
|
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||||
|
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||||
|
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||||
|
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
|
||||||
|
|
||||||
|
enable_plugins="no"
|
||||||
|
enable_python="no"
|
||||||
|
PYTHON_CFLAGS=
|
||||||
|
enable_ruby="no"
|
||||||
|
RUBY_CFLAGS=
|
||||||
|
|
||||||
|
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
|
||||||
|
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||||
|
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||||
|
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||||
|
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||||
|
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||||
|
|
||||||
|
if test "x$enable_curses" = "xyes" ; then
|
||||||
|
if test "$LIBCURSES_FOUND" = "0" ; then
|
||||||
|
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
|
||||||
|
fi
|
||||||
|
CURSES_LIBS="-lcurses"
|
||||||
|
AC_SUBST(CURSES_LIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_gtk" = "xyes" ; then
|
||||||
|
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||||
|
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||||
|
#fi
|
||||||
|
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||||
|
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||||
|
AC_SUBST(GTK_CFLAGS)
|
||||||
|
AC_SUBST(GTK_LIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLUGINS_LIBS=
|
||||||
|
|
||||||
|
if test "x$enable_perl" = "xyes" ; then
|
||||||
|
enable_plugins="yes"
|
||||||
|
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `perl -MExtUtils::Embed -e ldopts`"
|
||||||
|
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
|
||||||
|
AC_SUBST(PERL_CFLAGS)
|
||||||
|
AC_DEFINE(PLUGIN_PERL)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_plugins" = "xyes" ; then
|
||||||
|
AC_DEFINE(PLUGINS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(PLUGINS_LIBS)
|
||||||
|
|
||||||
|
if test "x$enable_debug" = "xyes" ; then
|
||||||
|
AC_DEFINE(DEBUG)
|
||||||
|
fi
|
||||||
|
|
||||||
|
CFLAGS="-Wall -W -pipe -O2"
|
||||||
|
|
||||||
|
AC_OUTPUT([Makefile
|
||||||
|
src/Makefile
|
||||||
|
src/common/Makefile
|
||||||
|
src/irc/Makefile
|
||||||
|
src/plugins/Makefile
|
||||||
|
src/plugins/perl/Makefile
|
||||||
|
src/gui/Makefile
|
||||||
|
src/gui/curses/Makefile
|
||||||
|
src/gui/gtk/Makefile
|
||||||
|
src/gui/qt/Makefile
|
||||||
|
intl/Makefile
|
||||||
|
po/Makefile.in])
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo $PACKAGE $VERSION
|
||||||
|
|
||||||
|
listgui=
|
||||||
|
if test "x$enable_curses" = "xyes" ; then
|
||||||
|
listgui="$listgui Curses"
|
||||||
|
fi
|
||||||
|
if test "x$enable_gtk" = "xyes" ; then
|
||||||
|
listgui="$listgui Gtk+"
|
||||||
|
fi
|
||||||
|
if test "x$enable_qt" = "xyes" ; then
|
||||||
|
listgui="$listgui Qt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$listgui" = "x" ; then
|
||||||
|
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Interfaces.................... :$listgui
|
||||||
|
echo
|
||||||
|
echo Build with Plugin support..... : $enable_plugins
|
||||||
|
echo Build with Perl support....... : $enable_perl
|
||||||
|
echo Build with Python support..... : $enable_python
|
||||||
|
echo Build with Ruby support....... : $enable_ruby
|
||||||
|
echo
|
||||||
|
echo Print debugging messages...... : $enable_debug
|
||||||
|
echo
|
||||||
|
eval eval echo WeeChat will be installed in $bindir.
|
||||||
|
echo
|
||||||
|
echo configure complete, now type \'make\' to build WeeChat
|
||||||
|
echo
|
||||||
Vendored
+19
-1
@@ -1,5 +1,23 @@
|
|||||||
|
weechat (0.0.4-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.4, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Thu, 01 Jan 2004 13:00:00 +0200
|
||||||
|
|
||||||
|
weechat (0.0.3-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.3, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Mon, 03 Nov 2003 23:15:00 +0200
|
||||||
|
|
||||||
|
weechat (0.0.2-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.2, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Sun, 05 Oct 2003 12:00:00 +0200
|
||||||
|
|
||||||
weechat (0.0.1-1) unstable; urgency=low
|
weechat (0.0.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* First version.
|
* First version.
|
||||||
|
|
||||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Jun 2003 12:00:00 +0200
|
-- FlashCode <flashcode@flashtux.org> Sat, 27 Sep 2003 12:00:00 +0200
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
4
|
|
||||||
Vendored
+27
-3
@@ -2,13 +2,37 @@ Source: weechat
|
|||||||
Section: net
|
Section: net
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||||
Build-Depends: debhelper (>> 4.0.0)
|
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7)
|
||||||
Standards-Version: 3.5.8
|
Standards-Version: 3.5.8
|
||||||
|
|
||||||
Package: weechat
|
Package: weechat
|
||||||
Architecture: any
|
Architecture: all
|
||||||
Depends: ${shlibs:Depends}
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||||
Description: Fast, light and extensible IRC client
|
Description: Fast, light and extensible IRC client
|
||||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
for many operating systems. Everything can be done with a keyboard.
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
It is customizable and extensible with scripts.
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-curses
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||||
|
Description: Fast, light and extensible IRC client
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-gtk
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||||
|
Description: Fast, light and extensible IRC client
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-common
|
||||||
|
Architecture: all
|
||||||
|
Replaces: weechat
|
||||||
|
Recommends: weechat-curses | weechat-gtk
|
||||||
|
Description: Common files for WeeChat
|
||||||
|
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||||
|
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
Thu, 01 Jan 2004 13:00:00 +0200.
|
||||||
|
|
||||||
It was downloaded from http://weechat.flashtux.org/download
|
It was downloaded from http://weechat.flashtux.org/download
|
||||||
|
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
weechat_0.0.1-1_i386.deb net optional
|
|
||||||
Vendored
+29
-46
@@ -3,12 +3,7 @@
|
|||||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
# Uncomment this to turn on verbose mode.
|
||||||
#export DH_VERBOSE=1
|
export DH_VERBOSE=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -Wall -g
|
|
||||||
|
|
||||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||||
CFLAGS += -O0
|
CFLAGS += -O0
|
||||||
@@ -22,8 +17,7 @@ endif
|
|||||||
configure: configure-stamp
|
configure: configure-stamp
|
||||||
configure-stamp:
|
configure-stamp:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
# Add here commands to configure the package.
|
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
|
||||||
|
|
||||||
touch configure-stamp
|
touch configure-stamp
|
||||||
|
|
||||||
|
|
||||||
@@ -31,21 +25,14 @@ build: build-stamp
|
|||||||
|
|
||||||
build-stamp: configure-stamp
|
build-stamp: configure-stamp
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
||||||
# Add here commands to compile the package.
|
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
|
||||||
|
|
||||||
touch build-stamp
|
touch build-stamp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
rm -f build-stamp configure-stamp
|
rm -f build-stamp configure-stamp
|
||||||
|
|
||||||
# Add here commands to clean up after the build process.
|
|
||||||
-$(MAKE) clean
|
-$(MAKE) clean
|
||||||
|
|
||||||
dh_clean
|
dh_clean
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
@@ -53,45 +40,41 @@ install: build
|
|||||||
dh_testroot
|
dh_testroot
|
||||||
dh_clean -k
|
dh_clean -k
|
||||||
dh_installdirs
|
dh_installdirs
|
||||||
|
|
||||||
# Add here commands to install the package into debian/weechat.
|
|
||||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||||
|
dh_install --sourcedir=debian/weechat
|
||||||
|
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||||
|
install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||||
|
|
||||||
|
|
||||||
# Build architecture-independent files here.
|
# Build architecture-independent files here.
|
||||||
binary-indep: build install
|
binary-indep: build install
|
||||||
# We have nothing to do by default.
|
dh_testdir -pweechat-common
|
||||||
|
dh_testroot -pweechat-common
|
||||||
|
dh_installchangelogs -pweechat-common
|
||||||
|
dh_installdocs -pweechat-common
|
||||||
|
dh_installexamples -pweechat-common
|
||||||
|
dh_installman weechat.1 -pweechat-common
|
||||||
|
dh_compress -pweechat-common
|
||||||
|
dh_fixperms -pweechat-common
|
||||||
|
dh_installdeb -pweechat-common
|
||||||
|
dh_shlibdeps -pweechat-common
|
||||||
|
dh_gencontrol -pweechat-common
|
||||||
|
dh_md5sums -pweechat-common
|
||||||
|
dh_builddeb -pweechat-common
|
||||||
|
|
||||||
# Build architecture-dependent files here.
|
# Build architecture-dependent files here.
|
||||||
binary-arch: build install
|
binary-arch: build install
|
||||||
dh_testdir
|
dh_testdir -a
|
||||||
dh_testroot
|
dh_testroot -a
|
||||||
dh_installchangelogs
|
dh_link -a
|
||||||
dh_installdocs
|
dh_strip -a
|
||||||
dh_installexamples
|
dh_compress -a
|
||||||
# dh_install
|
dh_fixperms -a
|
||||||
# dh_installmenu
|
dh_installdeb -a
|
||||||
# dh_installdebconf
|
dh_shlibdeps -a
|
||||||
# dh_installlogrotate
|
dh_gencontrol -a
|
||||||
# dh_installemacsen
|
dh_md5sums -a
|
||||||
# dh_installpam
|
dh_builddeb -a
|
||||||
# dh_installmime
|
|
||||||
# dh_installinit
|
|
||||||
# dh_installcron
|
|
||||||
# dh_installinfo
|
|
||||||
dh_installman weechat.1
|
|
||||||
dh_link
|
|
||||||
dh_strip
|
|
||||||
dh_compress
|
|
||||||
dh_fixperms
|
|
||||||
# dh_perl
|
|
||||||
# dh_python
|
|
||||||
# dh_makeshlibs
|
|
||||||
dh_installdeb
|
|
||||||
dh_shlibdeps
|
|
||||||
dh_gencontrol
|
|
||||||
dh_md5sums
|
|
||||||
dh_builddeb
|
|
||||||
|
|
||||||
binary: binary-indep binary-arch
|
binary: binary-indep binary-arch
|
||||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||||
|
|||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
usr/bin/weechat-curses
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
usr/bin/weechat-gtk
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
shlibs:Depends=libc6 (>= 2.3.2-1), libncurses5 (>= 5.3.20030510-1)
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi
|
||||||
|
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||||
|
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
|
||||||
|
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||||
|
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
|
||||||
|
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||||
|
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
|
||||||
|
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
|
||||||
|
export LANG=en_EN && texi2pdf weechat_doc_en.texi
|
||||||
|
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf weechat_doc_*.aux weechat_doc_*.cp weechat_doc_*.fn \
|
||||||
|
weechat_doc_*.html weechat_doc_*.ky weechat_doc_*.log \
|
||||||
|
weechat_doc_*.pdf weechat_doc_*.pg weechat_doc_*.toc \
|
||||||
|
weechat_doc_*.tp weechat_doc_*.txt weechat_doc_*.vr
|
||||||
@@ -0,0 +1,496 @@
|
|||||||
|
\input texinfo @c -*-texinfo-*-
|
||||||
|
@c %**start of header
|
||||||
|
@setfilename weechat_doc_en.info
|
||||||
|
@settitle WeeChat - fast, light and extensible IRC client
|
||||||
|
@c %**end of header
|
||||||
|
|
||||||
|
@c WeeChat documentation (english version)
|
||||||
|
@c
|
||||||
|
@c Copyright (c) 2003 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 pdf : texi2pdf weechat_doc_en.texi
|
||||||
|
@c html: makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||||
|
|
||||||
|
@c tex
|
||||||
|
@c \overfullrule=0pt
|
||||||
|
@c end tex
|
||||||
|
|
||||||
|
@documentlanguage en
|
||||||
|
|
||||||
|
@titlepage
|
||||||
|
|
||||||
|
@title WeeChat - User guide
|
||||||
|
@subtitle Fast, light and extensible IRC client
|
||||||
|
@subtitle Documentation for WeeChat v0.0.4 - November, 23 2003
|
||||||
|
|
||||||
|
@image{weechat_image}
|
||||||
|
|
||||||
|
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
|
||||||
|
@page
|
||||||
|
|
||||||
|
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
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||||
|
@*
|
||||||
|
This document may be used under the terms the GNU General Public License
|
||||||
|
version 2 or higher.
|
||||||
|
|
||||||
|
@end titlepage
|
||||||
|
|
||||||
|
@everyheading @thischapter @| @|
|
||||||
|
@everyfooting @thistitle @| @| Page @thispage
|
||||||
|
|
||||||
|
@contents
|
||||||
|
|
||||||
|
@node Top, Introduction, (dir), (dir)
|
||||||
|
@menu
|
||||||
|
* Introduction:: What is WeeChat ?
|
||||||
|
* Installation:: WeeChat installation
|
||||||
|
* Usage:: WeeChat usage
|
||||||
|
* Extensions:: WeeChat extensions
|
||||||
|
* Authors / Support:: Contact authors and get support
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Introduction *******************************
|
||||||
|
|
||||||
|
@node Introduction, Installation, Top, Top
|
||||||
|
@chapter Introduction
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Description::
|
||||||
|
* Pre-requisites::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Description, Pre-requisites, Introduction, Introduction
|
||||||
|
@section Description
|
||||||
|
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) is a free IRC client, fast and light,
|
||||||
|
designed for many operating systems.@*
|
||||||
|
@*
|
||||||
|
Main features are:
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
multi-servers connection
|
||||||
|
@item
|
||||||
|
many GUI (Graphical User Interface): Curses, Gtk and Qt
|
||||||
|
@item
|
||||||
|
small, fast and light
|
||||||
|
@item
|
||||||
|
customizable and extensible with scripts
|
||||||
|
@item
|
||||||
|
compliant with RFCs 1459, 2810, 2811, 2812, and 2813
|
||||||
|
@item
|
||||||
|
multi-platform (Gnu/Linux, *BSD, Windows and other)
|
||||||
|
@item
|
||||||
|
100% GPL, free software
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@*
|
||||||
|
WeeChat homepage is here:@*
|
||||||
|
@uref{http://weechat.flashtux.org}@*
|
||||||
|
|
||||||
|
@node Pre-requisites, , Description, Introduction
|
||||||
|
@section Pre-requisites
|
||||||
|
|
||||||
|
In order to install WeeChat, you @b{need}:@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
A running Gnu/Linux system (with compiler tools for source package)
|
||||||
|
@item
|
||||||
|
"root" privileges (to install WeeChat)
|
||||||
|
@item
|
||||||
|
According to GUI, one of the following libraries:
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
Curses: ncurses library,
|
||||||
|
@item
|
||||||
|
Gtk: *** GUI not developed ***,
|
||||||
|
@item
|
||||||
|
Qt: *** GUI not developed ***,
|
||||||
|
@end itemize
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Installation *******************************
|
||||||
|
|
||||||
|
@node Installation, Usage, Introduction, Top
|
||||||
|
@chapter Installation
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Binary package::
|
||||||
|
* Source package::
|
||||||
|
* CVS sources::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Binary package, Source package, Installation, Installation
|
||||||
|
@section Binary package
|
||||||
|
|
||||||
|
Binary packages are available for these distributions:
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Debian (or any Debian compatible distribution)@*
|
||||||
|
To install: @kbd{dpkg -i /path/weechat_x.y.z-1_i386.deb}
|
||||||
|
@item
|
||||||
|
Mandrake/Redhat (or any RPM compatible distribution)@*
|
||||||
|
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
|
||||||
|
@item
|
||||||
|
Gentoo@*
|
||||||
|
To install: see Gentoo documentation
|
||||||
|
@item
|
||||||
|
*BSD (not available!)
|
||||||
|
@item
|
||||||
|
Slackware (not available!)
|
||||||
|
@item
|
||||||
|
Windows (not available!)
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
where x.y.z is the version (for example 0.0.1)
|
||||||
|
@*
|
||||||
|
|
||||||
|
@node Source package, CVS sources, Binary package, Installation
|
||||||
|
@section Source package
|
||||||
|
|
||||||
|
All you have to do is to run in a console or a terminal:@*
|
||||||
|
@kbd{./configure}@*
|
||||||
|
@kbd{make}@*
|
||||||
|
Nota: to build only some interfaces, you can give parameters
|
||||||
|
to ./configure, type @kbd{./configure --help} for help about options.@*
|
||||||
|
|
||||||
|
Then get root privileges and install WeeChat:@*
|
||||||
|
@kbd{su -}@*
|
||||||
|
(enter root password)@*
|
||||||
|
@kbd{make install}@*
|
||||||
|
|
||||||
|
@node CVS sources, , Source package, Installation
|
||||||
|
@section CVS sources
|
||||||
|
|
||||||
|
Warning: CVS sources are for advanced users: it may not compile or not be stable.
|
||||||
|
You're warned!@*
|
||||||
|
|
||||||
|
To get CVS sources, issue these commands:@*
|
||||||
|
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||||
|
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||||
|
(when prompted for a password, just press Enter key)@*
|
||||||
|
|
||||||
|
Execute this script:@*
|
||||||
|
@kbd{./autogen.sh}@*
|
||||||
|
|
||||||
|
Then follow instructions for source package - @xref{Source package}.
|
||||||
|
|
||||||
|
|
||||||
|
@c ********************************** Usage ***********************************
|
||||||
|
|
||||||
|
@node Usage, Extensions, Installation, Top
|
||||||
|
@chapter Usage
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Run WeeChat::
|
||||||
|
* Key bindings::
|
||||||
|
* WeeChat commands::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Run WeeChat, Key bindings, Usage, Usage
|
||||||
|
@section Run WeeChat
|
||||||
|
|
||||||
|
@subsection Command line parameters
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item -h, --help
|
||||||
|
Display help screen@*
|
||||||
|
@item -l, --license
|
||||||
|
Display WeeChat license@*
|
||||||
|
@item -v, --version
|
||||||
|
Display WeeChat version@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@subsection Run WeeChat
|
||||||
|
|
||||||
|
Just issue this command to run WeeChat:@*
|
||||||
|
@kbd{weechat}@*
|
||||||
|
or @kbd{weechat-gtk} (for Gtk front-end)@*
|
||||||
|
or @kbd{weechat-qt} (for Qt front-end)@*
|
||||||
|
|
||||||
|
When you run WeeChat for the first time, a default configuration file is
|
||||||
|
created, with default options.@*
|
||||||
|
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
|
||||||
|
@section Key bindings
|
||||||
|
|
||||||
|
@table @kbd
|
||||||
|
@item Left arrow / Right arrow
|
||||||
|
Go to previous / next char in command line@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + left arrow / Ctrl + right arrow
|
||||||
|
Go to previous / next word in command line@*
|
||||||
|
@*
|
||||||
|
@item Home / End
|
||||||
|
Go to the beginning / end of command line@*
|
||||||
|
@*
|
||||||
|
@item Backspace / Delete
|
||||||
|
Erase previous / next char of command line@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + Backspace
|
||||||
|
Erase previous word of command line@*
|
||||||
|
@*
|
||||||
|
@item Tab
|
||||||
|
Complete command or nick (@kbd{Tab} again: find next completion)@*
|
||||||
|
@*
|
||||||
|
@item Any char
|
||||||
|
Insert char to cursor position in the command line@*
|
||||||
|
@*
|
||||||
|
@item Enter
|
||||||
|
Execute command or send message@*
|
||||||
|
@*
|
||||||
|
@item Up arrow / Down arrow
|
||||||
|
Call again last commands/messages@*
|
||||||
|
@*
|
||||||
|
@item PageUp / PageDown
|
||||||
|
Show window history@*
|
||||||
|
@*
|
||||||
|
@item F6 / F7
|
||||||
|
Switch to previous / next window@*
|
||||||
|
@*
|
||||||
|
@item Alt + left arrow / Alt + right arrow
|
||||||
|
Same as F6 / F7@*
|
||||||
|
@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@node WeeChat commands, , Key bindings, Usage
|
||||||
|
@section WeeChat commands
|
||||||
|
|
||||||
|
NOT WRITTEN!
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Extensions *********************************
|
||||||
|
|
||||||
|
@node Extensions, Authors / Support, Usage, Top
|
||||||
|
@chapter Extensions
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Perl scripts::
|
||||||
|
* Python scripts::
|
||||||
|
* Ruby scripts::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Perl scripts, Python scripts, Extensions, Extensions
|
||||||
|
@section Perl scripts
|
||||||
|
|
||||||
|
@subsection Load/unload Perl scripts
|
||||||
|
|
||||||
|
Perl scripts are loaded and unloaded with @command{/perl} command.
|
||||||
|
(type @kbd{/help perl} within WeeChat to get help about command).@*
|
||||||
|
|
||||||
|
@emph{Examples:}@*
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
|
||||||
|
@item
|
||||||
|
Unload all Perl scripts: @kbd{/perl unload}@*
|
||||||
|
@item
|
||||||
|
List all Perl scripts: @kbd{/perl}@*
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@subsection WeeChat / Perl API
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
@command{IRC::register ( name, version, shutdown_function, description );}@*
|
||||||
|
@*
|
||||||
|
This is first function to call in Perl script.@*
|
||||||
|
All Perl scripts for WeeChat should call this function.@*
|
||||||
|
|
||||||
|
@emph{Arguments:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{name}: unique name to identify script (each script must have
|
||||||
|
unique name)
|
||||||
|
@item @option{version}: script's version
|
||||||
|
@item @option{shutdown_function}: Perl function called when script is
|
||||||
|
unloaded (optional parameter, empty string means nothing is called at the end)
|
||||||
|
@item @option{description}: short description of script.
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Example:}@*
|
||||||
|
@code{IRC::register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::print ( message );}@*
|
||||||
|
@*
|
||||||
|
Print message in current window (channel or server).@*
|
||||||
|
|
||||||
|
@emph{Arguments:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{message}: message to display
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Example:}@*
|
||||||
|
@code{IRC::print ("message");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_message_handler ( name, function );}@*
|
||||||
|
@*
|
||||||
|
Attach a Perl function to an IRC message.@*
|
||||||
|
Function will be called each time IRC message will be received.@*
|
||||||
|
|
||||||
|
@emph{Arguments:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{name}: name of IRC message@*
|
||||||
|
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
|
||||||
|
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||||
|
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||||
|
@item @option{function}: Perl function called when message is received
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Example:}@*
|
||||||
|
@code{IRC::add_message_handler ("privmsg", my_function);}@*
|
||||||
|
@code{sub my_function}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
|
||||||
|
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||||
|
@code{@ @ @ @ IRC::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_command_handler ( name, function );}@*
|
||||||
|
@*
|
||||||
|
Create new WeeChat command, linked with Perl function.@*
|
||||||
|
Function will be called when user will launch command with @kbd{/name}.@*
|
||||||
|
|
||||||
|
@emph{Arguments:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{name}: name of new command@*
|
||||||
|
This name may be existing command, so that the command is overrided by
|
||||||
|
Perl function. Be careful when overriding WeeChat commands, they'll not be
|
||||||
|
available until your Perl script will be unloaded.
|
||||||
|
@item @option{function}: Perl function linked with command
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Example:}@*
|
||||||
|
@code{IRC::add_command_handler ("command", my_command);}@*
|
||||||
|
@code{sub my_command}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ IRC::print("Arguments: ".@@_[0]);}@*
|
||||||
|
@code{@ @ @ @ return 0;}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@node Python scripts, Ruby scripts, Perl scripts, Extensions
|
||||||
|
@section Python scripts
|
||||||
|
|
||||||
|
Not developed!
|
||||||
|
|
||||||
|
@node Ruby scripts, , Python scripts, Extensions
|
||||||
|
@section Ruby scripts
|
||||||
|
|
||||||
|
Not developed!
|
||||||
|
|
||||||
|
|
||||||
|
@c **************************** Authors / Support *****************************
|
||||||
|
|
||||||
|
@node Authors / Support, , Extensions, Top
|
||||||
|
@chapter Authors / Support
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@menu
|
||||||
|
* Authors::
|
||||||
|
* Get support::
|
||||||
|
* Copyright::
|
||||||
|
@end menu
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@menu
|
||||||
|
* Authors::
|
||||||
|
* Get support::
|
||||||
|
@end menu
|
||||||
|
@end ifnothtml
|
||||||
|
|
||||||
|
@node Authors, Get support, Authors / Support, Authors / Support
|
||||||
|
@section Authors
|
||||||
|
|
||||||
|
WeeChat is developed by:@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
FlashCode
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
@item
|
||||||
|
Bounga
|
||||||
|
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||||
|
@item
|
||||||
|
Xahlexx
|
||||||
|
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||||
|
@item
|
||||||
|
Crevetor
|
||||||
|
<@email{crevetor@@caramail.com, crevetor AT caramail.com}>
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Get support, Copyright, Authors, Authors / Support
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@node Get support, , Authors, Authors / Support
|
||||||
|
@end ifnothtml
|
||||||
|
@section Get support
|
||||||
|
|
||||||
|
Before asking for support, be sure you've read documentation and FAQ provided
|
||||||
|
with WeeChat.@*
|
||||||
|
(documentation is this document, if you don't read all lines until this sentence,
|
||||||
|
you can start again!)@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Support with IRC:@*
|
||||||
|
- server: @b{irc.freenode.net}@*
|
||||||
|
- channel: @b{#weechat}@*@*
|
||||||
|
@item
|
||||||
|
WeeChat forum: soon!@*@*
|
||||||
|
@item
|
||||||
|
Support with mailing list:@*
|
||||||
|
- to subscribe/unsubscribe:@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||||
|
- to send mail to all mailing list subscribers, send your mail to@*@email{weechat-support@@nongnu.org}.@*
|
||||||
|
|
||||||
|
Mailing archives are available here:@*
|
||||||
|
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||||
|
@item
|
||||||
|
Look for WeeChat support page for detail:@*
|
||||||
|
@uref{http://weechat.flashtux.org/support.php?lang=en}
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Copyright, , Get support, Authors / Support
|
||||||
|
@section Copyright
|
||||||
|
|
||||||
|
This manual documents WeeChat IRC client, it is part of WeeChat.@*
|
||||||
|
|
||||||
|
Copyright @copyright{} 2003 FlashCode
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||||
|
@*
|
||||||
|
This document may be used under the terms the GNU General Public License
|
||||||
|
version 2 or higher.
|
||||||
|
@end ifhtml
|
||||||
|
|
||||||
|
@bye
|
||||||
@@ -0,0 +1,496 @@
|
|||||||
|
\input texinfo @c -*-texinfo-*-
|
||||||
|
@c %**start of header
|
||||||
|
@setfilename weechat_doc_fr.info
|
||||||
|
@settitle WeeChat - Client IRC rapide, leger et extensible
|
||||||
|
@c %**end of header
|
||||||
|
|
||||||
|
@c WeeChat documentation (french version)
|
||||||
|
@c
|
||||||
|
@c Copyright (c) 2003 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 pdf : texi2pdf weechat_doc_fr.texi
|
||||||
|
@c html: makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||||
|
|
||||||
|
@c tex
|
||||||
|
@c \overfullrule=0pt
|
||||||
|
@c end tex
|
||||||
|
|
||||||
|
@documentlanguage fr
|
||||||
|
|
||||||
|
@titlepage
|
||||||
|
|
||||||
|
@title WeeChat - Guide utilisateur
|
||||||
|
@subtitle Client IRC rapide, l@'eger et extensible
|
||||||
|
@subtitle Documentation pour WeeChat v0.0.4 - 23 novembre 2003
|
||||||
|
|
||||||
|
@image{weechat_image}
|
||||||
|
|
||||||
|
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
|
||||||
|
@page
|
||||||
|
|
||||||
|
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
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||||
|
@*
|
||||||
|
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
|
||||||
|
License version 2 ou plus.
|
||||||
|
|
||||||
|
@end titlepage
|
||||||
|
|
||||||
|
@everyheading @thischapter @| @|
|
||||||
|
@everyfooting @thistitle @| @| Page @thispage
|
||||||
|
|
||||||
|
@contents
|
||||||
|
|
||||||
|
@node Top, Introduction, (dir), (dir)
|
||||||
|
@menu
|
||||||
|
* Introduction:: Description de WeeChat
|
||||||
|
* Installation:: Installation de WeeChat
|
||||||
|
* Utilisation:: Utilisation de WeeChat
|
||||||
|
* Extensions:: Extensions de WeeChat
|
||||||
|
* Auteurs / Support:: Contacter les auteurs et obtenir du support
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Introduction *******************************
|
||||||
|
|
||||||
|
@node Introduction, Installation, Top, Top
|
||||||
|
@chapter Introduction
|
||||||
|
@menu
|
||||||
|
* Description::
|
||||||
|
* Pre-requis::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Description, Pre-requis, Introduction, Introduction
|
||||||
|
@section Description
|
||||||
|
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) est un client IRC libre, rapide et l@'eger,
|
||||||
|
concu pour diff@'erents syst@`emes d'exploitation.@*
|
||||||
|
@*
|
||||||
|
Ses principales caract@'eristiques sont les suivantes :
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
connexion multi-serveurs
|
||||||
|
@item
|
||||||
|
plusieurs interfaces : Curses, Gtk et Qt
|
||||||
|
@item
|
||||||
|
petit, rapide et l@'eger
|
||||||
|
@item
|
||||||
|
param@'etrable et extensible avec des scripts
|
||||||
|
@item
|
||||||
|
conforme aux RFCs 1459, 2810, 2811, 2812, et 2813
|
||||||
|
@item
|
||||||
|
multi-plateformes (Gnu/Linux, *BSD, Windows et d'autres syst@`emes)
|
||||||
|
@item
|
||||||
|
100% GPL, logiciel libre
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@*
|
||||||
|
La page d'accueil de WeeChat est ici :@*
|
||||||
|
@uref{http://weechat.flashtux.org}@*
|
||||||
|
|
||||||
|
@node Pre-requis, , Description, Introduction
|
||||||
|
@section Pr@'e-requis
|
||||||
|
|
||||||
|
Pour installer WeeChat, vous @b{devez} avoir :@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Un syst@`eme Gnu/Linux (avec le compilateur et les outils associ@'es pour le paquet des sources)
|
||||||
|
@item
|
||||||
|
Droits "root" (pour installer WeeChat)
|
||||||
|
@item
|
||||||
|
Selon l'interface, une des biblioth@`eques suivantes :
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
Curses: la librairie ncurses,
|
||||||
|
@item
|
||||||
|
Gtk: *** interface non d@'evelopp@'ee ***,
|
||||||
|
@item
|
||||||
|
Qt: *** interface non d@'evelopp@'ee ***,
|
||||||
|
@end itemize
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Installation *******************************
|
||||||
|
|
||||||
|
@node Installation, Utilisation, Introduction, Top
|
||||||
|
@chapter Installation
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Paquet binaire::
|
||||||
|
* Paquet source::
|
||||||
|
* Sources CVS::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Paquet binaire, Paquet source, Installation, Installation
|
||||||
|
@section Paquet binaire
|
||||||
|
|
||||||
|
Les paquets binaires sont disponibles pour les distributions suivantes :
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Debian (ou toute distribution compatible Debian)@*
|
||||||
|
Pour installer : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
|
||||||
|
@item
|
||||||
|
Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
|
||||||
|
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||||
|
@item
|
||||||
|
Gentoo@*
|
||||||
|
Pour installer : voir la documentation Gentoo
|
||||||
|
@item
|
||||||
|
*BSD (non disponible !)
|
||||||
|
@item
|
||||||
|
Slackware (non disponible !)
|
||||||
|
@item
|
||||||
|
Windows (non disponible !)
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
o@`u x.y.z est la version (par exemple 0.0.1)
|
||||||
|
@*
|
||||||
|
|
||||||
|
@node Paquet source, Sources CVS, Paquet binaire, Installation
|
||||||
|
@section Paquet source
|
||||||
|
|
||||||
|
Tapez simplement dans une console ou un terminal :@*
|
||||||
|
@kbd{./configure}@*
|
||||||
|
@kbd{make}@*
|
||||||
|
Note: pour ne construire que certaines interfaces, vous pouvez passer des param@`etres
|
||||||
|
@`a ./configure, tapez @kbd{./configure --help} pour de l'aide sur ces options.@*
|
||||||
|
|
||||||
|
Obtenez les droits root et installez WeeChat :@*
|
||||||
|
@kbd{su -}@*
|
||||||
|
(entrez le mot de passe de root)@*
|
||||||
|
@kbd{make install}@*
|
||||||
|
|
||||||
|
@node Sources CVS, , Paquet source, Installation
|
||||||
|
@section Sources CVS
|
||||||
|
|
||||||
|
Attention: les sources CVS sont r@'eserv@'es aux utilisateurs avanc@'es : il se peut
|
||||||
|
que WeeChat ne compile pas et qu'il soit tr@`s instable.
|
||||||
|
Vous @^etes pr@'evenus !@*
|
||||||
|
|
||||||
|
Pour r@'ecup@'erer les sources CVS, tapez ces commandes :@*
|
||||||
|
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||||
|
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||||
|
(lorsqu'un mot de passe est demand@'e, tapez simplement sur Entr@'ee)@*
|
||||||
|
|
||||||
|
Ex@'ecutez ce script :@*
|
||||||
|
@kbd{./autogen.sh}@*
|
||||||
|
|
||||||
|
Suivez alors les instructions du paquet sources - @xref{Paquet source}.
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Utilisation ********************************
|
||||||
|
|
||||||
|
@node Utilisation, Extensions, Installation, Top
|
||||||
|
@chapter Utilisation
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Lancer WeeChat::
|
||||||
|
* Raccourcis clavier::
|
||||||
|
* Commandes WeeChat::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Lancer WeeChat, Raccourcis clavier, Utilisation, Utilisation
|
||||||
|
@section Lancer WeeChat
|
||||||
|
|
||||||
|
@subsection Param@`etres de ligne de commande
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item -h, --help
|
||||||
|
Afficher l'aide@*
|
||||||
|
@item -l, --license
|
||||||
|
Afficher la licence de WeeChat@*
|
||||||
|
@item -v, --version
|
||||||
|
Afficher la version de WeeChat@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@subsection Lancer WeeChat
|
||||||
|
|
||||||
|
Tapez simplement cette commande pour lancer WeeChat :@*
|
||||||
|
@kbd{weechat-curses}@*
|
||||||
|
ou @kbd{weechat-gtk} (pour l'interface Gtk)@*
|
||||||
|
ou @kbd{weechat-qt} (pour l'interface Qt)@*
|
||||||
|
|
||||||
|
Lorsque vous lancez WeeChat pour la premi@`ere fois, un fichier de configuration
|
||||||
|
par d@'efaut est cr@'e@'e, avec les options par d@'efaut.@*
|
||||||
|
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
|
||||||
|
@section Raccourcis clavier
|
||||||
|
|
||||||
|
@table @kbd
|
||||||
|
@item Fl@`eche gauche / Fl@`eche droite
|
||||||
|
Aller au caract@`ere pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + fl@`eche gauche / Ctrl + fl@`eche droite
|
||||||
|
Aller au mot pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Home / End
|
||||||
|
Aller au d@'ebut / @`a la fin de la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Backspace / Delete
|
||||||
|
Effacer le mot pr@'ec@'edent / suivant sur la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + Backspace
|
||||||
|
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Tab
|
||||||
|
Compl@'eter la commande ou le pseudo (@kbd{Tab} @`a nouveau : trouver la compl@'etion suivante)@*
|
||||||
|
@*
|
||||||
|
@item Tout caract@`ere
|
||||||
|
Ins@'erer le caract@`ere @`a la position du curseur sur la ligne de commande@*
|
||||||
|
@*
|
||||||
|
@item Entr@'ee
|
||||||
|
Ex@'ecuter la commande ou envoyer le message@*
|
||||||
|
@*
|
||||||
|
@item Fl@`eche haut / Fl@`eche bas
|
||||||
|
Rappeler les derni@`eres commandes/messages@*
|
||||||
|
@*
|
||||||
|
@item PageUp / PageDown
|
||||||
|
Afficher l'historique de la fen@^etre@*
|
||||||
|
@*
|
||||||
|
@item F6 / F7
|
||||||
|
Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
|
||||||
|
@*
|
||||||
|
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||||
|
Identique @`a F6 / F7@*
|
||||||
|
@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
|
||||||
|
@section Commandes WeeChat
|
||||||
|
|
||||||
|
NON ECRIT !
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Extensions *********************************
|
||||||
|
|
||||||
|
@node Extensions, Auteurs / Support, Utilisation, Top
|
||||||
|
@chapter Extensions
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Scripts Perl::
|
||||||
|
* Scripts Python::
|
||||||
|
* Scripts Ruby::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Scripts Perl, Scripts Python, Extensions, Extensions
|
||||||
|
@section Scripts Perl
|
||||||
|
|
||||||
|
@subsection Charger/d@'echarger des scripts Perl
|
||||||
|
|
||||||
|
Les scripts Perl sont charg@'es et d@'echarg@'es avec la commande @command{/perl}
|
||||||
|
(tapez @kbd{/help perl} dans WeeChat pour obtenir de l'aide sur la commande).@*
|
||||||
|
|
||||||
|
@emph{Exemples :}@*
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Charger un script Perl : @kbd{/perl load /tmp/essai.pl}@*
|
||||||
|
@item D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
|
||||||
|
@item
|
||||||
|
Lister les scripts Perl charg@'es : @kbd{/perl}@*
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@subsection Interface WeeChat / Perl
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
@command{IRC::register ( nom, version, fonction_de_fin, description );}@*
|
||||||
|
@*
|
||||||
|
C'est la premi@`ere fonction @`a appeler dans le script Perl.@*
|
||||||
|
Tout script Perl pour WeeChat doit appeler cette fonction.@*
|
||||||
|
|
||||||
|
@emph{Param@`etres :}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nom}: nom unique pour identifier le script (chaque script doit
|
||||||
|
avoir un nom diff@'erent)
|
||||||
|
@item @option{version}: version du script
|
||||||
|
@item @option{fonction_de_fin}: fonction Perl appel@'ee quand le script est
|
||||||
|
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
|
||||||
|
de fonction @`a appeler)
|
||||||
|
@item @option{description}: description br@`eve du script.
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemple :}@*
|
||||||
|
@code{IRC::register ("essai", "1.0", "fin_essai", "Script d'essai !");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::print ( message );}@*
|
||||||
|
@*
|
||||||
|
Affiche un message dans la fen@^etre courante (canal ou serveur).@*
|
||||||
|
|
||||||
|
@emph{Param@`etres :}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{message}: message @`a afficher
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemple :}@*
|
||||||
|
@code{IRC::print ("message");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_message_handler ( nom, fonction );}@*
|
||||||
|
@*
|
||||||
|
Attache une fonction Perl @`a un message IRC particulier.@*
|
||||||
|
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
|
||||||
|
|
||||||
|
@emph{Param@`etres :}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nom}: nom du message IRC pour lequel la fonction est appel@'ee@*
|
||||||
|
Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
|
||||||
|
RFC 1459 et/ou 2812 :@*
|
||||||
|
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||||
|
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||||
|
@item @option{fonction}: fonction Perl appel@'ee lorsque le message est re@,{c}u
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemple :}@*
|
||||||
|
@code{IRC::add_message_handler ("privmsg", ma_fonction);}@*
|
||||||
|
@code{sub ma_fonction}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ ($null, $canal, $message) = split ":",@@_[0],3;}@*
|
||||||
|
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
|
||||||
|
@code{@ @ @ @ IRC::print ("masque=$masque, canal=$canal, message=$message\n");}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_command_handler ( nom, fonction );}@*
|
||||||
|
@*
|
||||||
|
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Perl.@*
|
||||||
|
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
|
||||||
|
|
||||||
|
@emph{Param@`etres :}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nom}: nom de la nouvelle commande@*
|
||||||
|
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
|
||||||
|
la fonction Perl. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
|
||||||
|
ne seront plus accessibles tant que le script Perl sera charg@'e.
|
||||||
|
@item @option{fonction}: fonction Perl associ@'ee @`a la commande
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemple :}@*
|
||||||
|
@code{IRC::add_command_handler ("commande", ma_commande);}@*
|
||||||
|
@code{sub ma_commande}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ IRC::print("Param@`etres : ".@@_[0]);}@*
|
||||||
|
@code{@ @ @ @ return 0;}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@node Scripts Python, Scripts Ruby, Scripts Perl, Extensions
|
||||||
|
@section Scripts Python
|
||||||
|
|
||||||
|
Non d@'evelopp@'e !
|
||||||
|
|
||||||
|
@node Scripts Ruby, , Scripts Python, Extensions
|
||||||
|
@section Scripts Ruby
|
||||||
|
|
||||||
|
Non d@'evelopp@'e !
|
||||||
|
|
||||||
|
@c **************************** Auteurs / Support *****************************
|
||||||
|
|
||||||
|
@node Auteurs / Support, , Extensions, Top
|
||||||
|
@chapter Auteurs / Support
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@menu
|
||||||
|
* Auteurs::
|
||||||
|
* Obtenir du support::
|
||||||
|
* Copyright::
|
||||||
|
@end menu
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@menu
|
||||||
|
* Auteurs::
|
||||||
|
* Obtenir du support::
|
||||||
|
@end menu
|
||||||
|
@end ifnothtml
|
||||||
|
|
||||||
|
@node Auteurs, Obtenir du support, Auteurs / Support, Auteurs / Support
|
||||||
|
@section Auteurs
|
||||||
|
|
||||||
|
WeeChat est d@'evelopp@'e par :@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
FlashCode
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
@item
|
||||||
|
Bounga
|
||||||
|
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||||
|
@item
|
||||||
|
Xahlexx
|
||||||
|
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||||
|
@item
|
||||||
|
Crevetor
|
||||||
|
<@email{crevetor@@caramail.com, crevetor AT caramail.com}>
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Obtenir du support, Copyright, Auteurs, Auteurs / Support
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@node Obtenir du support, , Auteurs, Auteurs / Support
|
||||||
|
@end ifnothtml
|
||||||
|
@section Obtenir du support
|
||||||
|
|
||||||
|
Avant de faire appel au support, merci de lire la documentation et la
|
||||||
|
FAQ de WeeChat.@*
|
||||||
|
(la documentation est le document que vous @^etes en train de lire, si vous
|
||||||
|
n'avez pas tout lu jusqu'ici, il est encore temps de recommencer !)@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Support par IRC:@*
|
||||||
|
- serveur : @b{irc.freenode.net}@*
|
||||||
|
- canal : @b{#weechat}@*@*
|
||||||
|
@item
|
||||||
|
Forum WeeChat : bient@^ot !@*@*
|
||||||
|
@item
|
||||||
|
Support par la liste de diffusion :@*
|
||||||
|
- pour souscrire/d@'esinscrire :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||||
|
- pour envoyer un mail @`a la liste de diffusion, envoyer @`a :@*@email{weechat-support@@nongnu.org}.@*
|
||||||
|
|
||||||
|
Les archives de la liste de diffusion sont ici :@*
|
||||||
|
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||||
|
@item
|
||||||
|
Voir la page support WeeChat pour plus de d@'etails :@*
|
||||||
|
@uref{http://weechat.flashtux.org/support.php}
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Copyright, , Obtenir du support, Auteurs / Support
|
||||||
|
@section Copyright
|
||||||
|
|
||||||
|
Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat.@*
|
||||||
|
|
||||||
|
Copyright @copyright{} 2003 FlashCode
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||||
|
@*
|
||||||
|
Ce document peut @^etre utilis@'e sous les termes de la licence GNU General Public
|
||||||
|
License version 2 ou plus.
|
||||||
|
@end ifhtml
|
||||||
|
|
||||||
|
@bye
|
||||||
@@ -0,0 +1,490 @@
|
|||||||
|
\input texinfo @c -*-texinfo-*-
|
||||||
|
@c %**start of header
|
||||||
|
@setfilename weechat_doc_pt.info
|
||||||
|
@settitle WeeChat - Um cliente de IRC rapido, leve e extencivel
|
||||||
|
@c %**end of header
|
||||||
|
|
||||||
|
@c WeeChat documentation (vers@~ao partuguesa)
|
||||||
|
@c
|
||||||
|
@c Copyright (c) 2003 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 pdf : texi2pdf weechat_doc_pt.texi
|
||||||
|
@c html: makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||||
|
|
||||||
|
@c tex
|
||||||
|
@c \overfullrule=0pt
|
||||||
|
@c end tex
|
||||||
|
|
||||||
|
@documentlanguage pt
|
||||||
|
|
||||||
|
@titlepage
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
@image{weechat_image}
|
||||||
|
|
||||||
|
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
|
||||||
|
@page
|
||||||
|
|
||||||
|
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
|
||||||
|
<@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
|
||||||
|
License) vers@~ao 2 ou superior.
|
||||||
|
|
||||||
|
@end titlepage
|
||||||
|
|
||||||
|
@everyheading @thischapter @| @|
|
||||||
|
@everyfooting @thistitle @| @| Pagina @thispage
|
||||||
|
|
||||||
|
@contents
|
||||||
|
|
||||||
|
@node Top, Introducao, (dir), (dir)
|
||||||
|
@menu
|
||||||
|
* Introducao:: Descri@,{c}@~ao do WeeChat
|
||||||
|
* Instalacao:: Instala@,{c}@~ao do WeeChat
|
||||||
|
* Utilizacao:: Utiliza@,{c}@~ao do WeeChat
|
||||||
|
* Extencoes:: Exten@,{c}@~oes do Weechat
|
||||||
|
* Autores/Suporte:: Contactar os autores e obter suporte
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Introducao *******************************
|
||||||
|
|
||||||
|
@node Introducao, Instalacao, Top, Top
|
||||||
|
@chapter Introdu@,{c}@~ao
|
||||||
|
@menu
|
||||||
|
* Descricao::
|
||||||
|
* Pre-requisitos::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Descricao, Pre-requisitos, Introducao, Introducao
|
||||||
|
@section Descri@,{c}@~ao
|
||||||
|
|
||||||
|
O WeeChat (Wee Enhanced Environment for Chat) @'e um cliente de IRC livre, r@'apido e leve,
|
||||||
|
concebido para funcionar em diversos sistemas operativos.@*
|
||||||
|
@*
|
||||||
|
As suas caracter@'isticas prinicpais s@~ao as seguintes :
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
liga@,{c}@~ao a m@'ultiplos servidores
|
||||||
|
@item
|
||||||
|
v@'arias interfaces : Curses, Gtk e Qt
|
||||||
|
@item
|
||||||
|
pequeno r@'apido e leve
|
||||||
|
@item
|
||||||
|
configuravel e extenc@'ivel com scripts
|
||||||
|
@item
|
||||||
|
compat@'ivel com RFCs 1459, 2810, 2811, 2812, e 2813
|
||||||
|
@item
|
||||||
|
multiplataforma (Gnu/Linux, *BSD, Windows e outros)
|
||||||
|
@item
|
||||||
|
100% GPL, Software Livre
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@*
|
||||||
|
A p@'agina Web do Weechat @'e aqui :@*
|
||||||
|
@uref{http://weechat.flashtux.org}@*
|
||||||
|
|
||||||
|
@node Pre-requisitos, ,Descricao, Introducao
|
||||||
|
@section Pr@'e-requisitos
|
||||||
|
|
||||||
|
Para instalar o Weechat, vais @b{precisar} de ter :@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Um sistema Gnu/Linux (com um compilador e outros utilit@'arios associados aos pacotes de c@'odigo fonte)
|
||||||
|
@item
|
||||||
|
Direitos de "root" (para instalar)
|
||||||
|
@item
|
||||||
|
Consoante a interface escolhida, uma das seguintes bibliotecas :
|
||||||
|
@itemize @minus
|
||||||
|
@item
|
||||||
|
Curses: a biblioteca ncurses,
|
||||||
|
@item
|
||||||
|
Gtk: *** interface n@~ao desenvolvida ***,
|
||||||
|
@item
|
||||||
|
Qt: *** interface n@~ao desenvolvida ***,
|
||||||
|
@end itemize
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Instalacao *******************************
|
||||||
|
|
||||||
|
@node Instalacao, Utilizacao, Introducao, Top
|
||||||
|
@chapter Instala@,{c}@~ao
|
||||||
|
@menu
|
||||||
|
* Binarios::
|
||||||
|
* Codigo Fonte::
|
||||||
|
* Codigo Fonte via CVS::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Binarios, Codigo Fonte, Instalacao, Instalacao
|
||||||
|
@section Bin@'arios
|
||||||
|
|
||||||
|
Os pacotes bin@'arios est@'ao dispon@'iveis para as seguintes distribui@,{c}@~oes :
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Debian (ou compat@'ivel)@*
|
||||||
|
Instala@,{c}@~ao : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
|
||||||
|
@item
|
||||||
|
Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
|
||||||
|
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||||
|
@item
|
||||||
|
Gentoo@*
|
||||||
|
Instala@,{c}@~ao : ver a documenta@,{c}@~ao da Gentoo
|
||||||
|
@item
|
||||||
|
*BSD (non disponible !)
|
||||||
|
@item
|
||||||
|
Slackware (n@~ao dispon@'ivel !)
|
||||||
|
@item
|
||||||
|
Windows (n@~ao dispon@'ivel !)
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
Onde x.y.z @'e a vers@~ao (por exemplo 0.0.1)
|
||||||
|
@*
|
||||||
|
|
||||||
|
@node Codigo Fonte, Codigo Fonte via CVS, Binarios, Instalacao
|
||||||
|
@section C@'odigo Fonte
|
||||||
|
|
||||||
|
Escreve simplesmente numa consola ou num terminal :@*
|
||||||
|
@kbd{./configure}@*
|
||||||
|
@kbd{make}@*
|
||||||
|
Nota: Para compilar certas interfaces, podes passar par@^ametros
|
||||||
|
ao ./configure, escreve @kbd{./configure --help} para veres as op@,{c}@~oes.@*
|
||||||
|
|
||||||
|
Obter os direitos do root e instalar o Weechat :@*
|
||||||
|
@kbd{su -}@*
|
||||||
|
(escreve aqui a palavra-passe do superutilizador)@*
|
||||||
|
@kbd{make install}@*
|
||||||
|
|
||||||
|
@node Codigo Fonte via CVS, , Codigo Fonte, Instalacao
|
||||||
|
@section C@'odigo Fonte via CVS
|
||||||
|
|
||||||
|
Aten@,{c}@~ao: o c@'odigo fonte CVS est@'a reservado aos utilizadores avan@,{c}ados : o WeeChat pode n@~ao compilar ou ficar inst@'avel.@*
|
||||||
|
Considera-te avisado !@*
|
||||||
|
|
||||||
|
Para sacares o c@'odigo fonte via CVS, escreve estes comandos :@*
|
||||||
|
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
|
||||||
|
@kbd{cvs -z3 -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat co weechat}@*
|
||||||
|
(quando te pedirem a palavra-passe, primen simplesmente Enter)@*
|
||||||
|
|
||||||
|
Executa o script :@*
|
||||||
|
@kbd{./autogen.sh}@*
|
||||||
|
|
||||||
|
Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fonte}.
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Utilizacao ********************************
|
||||||
|
|
||||||
|
@node Utilizacao, Extencoes, Instalacao, Top
|
||||||
|
@chapter Utiliza@,{c}@~ao
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Invocar o WeeChat::
|
||||||
|
* Recursos de teclado::
|
||||||
|
* Comandos do WeeChat::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Invocar o WeeChat, Recursos de teclado, Utilizacao, Utilizacao
|
||||||
|
@section Invocar o WeeChat
|
||||||
|
|
||||||
|
@subsection Par@^ametros de linha de comandos
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item -h, --help
|
||||||
|
Mostrar a ajuda@*
|
||||||
|
@item -l, --license
|
||||||
|
Mostrar a licen@,{c}a do WeeChat@*
|
||||||
|
@item -v, --version
|
||||||
|
Mostrar a vers@~ao do WeeChat@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@subsection Invocar o WeeChat
|
||||||
|
|
||||||
|
Escreve simplesmente este comando para invoceres o WeeChat :@*
|
||||||
|
@kbd{weechat-curses}@*
|
||||||
|
ou @kbd{weechat-gtk} (para a interface em Gtk)@*
|
||||||
|
ou @kbd{weechat-qt} (para a interface em Qt)@*
|
||||||
|
|
||||||
|
Logo que lan@,{c}ares o WeeChat pela primeira vez, um ficheiro de configura@,{c}@~ao
|
||||||
|
por defeito @'e criado, com as configura@,{c}@~oes por defeito.@*
|
||||||
|
O ficheiro de configura@,{c}@~ao por defeito @'e : ~/.weechat/weechat.rc@*
|
||||||
|
|
||||||
|
Podes editar esse ficheiro para configurar o WeeChat @`a tua maneira, man tamb@'em podes modificar os par@^ametros dentro do WeeChat utilizando o comando @kbd{/set} - @xref{Comandos do WeeChat}.
|
||||||
|
|
||||||
|
@node Recursos de teclado, Comandos do WeeChat, Invocar o WeeChat, Utilizacao
|
||||||
|
@section Recursos de teclado
|
||||||
|
|
||||||
|
@table @kbd
|
||||||
|
@item Seta esquerda / Seta direita
|
||||||
|
Ir um caractere para traz / para a frente na linha de comando@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + Seta esquerda / Ctrl + Seta Direita
|
||||||
|
Ir uma palavra para traz / para a frente na linha de comando@*
|
||||||
|
@*
|
||||||
|
@item Home / End
|
||||||
|
Ir para o in@'icio / para o fim da linha de comando@*
|
||||||
|
@*
|
||||||
|
@item Backspace / Delete
|
||||||
|
Apagar o caractere anterior / seguinte na linha de comando@*
|
||||||
|
@*
|
||||||
|
@item Ctrl + Backspace
|
||||||
|
Apagar a palavra anterior na linha de comando
|
||||||
|
@*
|
||||||
|
@item Tab
|
||||||
|
Completar o comando ou o nick (@kbd{Tab} novamente : encontrar a pr@'oxima sugest@~ao)@*
|
||||||
|
@*
|
||||||
|
@item Qualquer caractere
|
||||||
|
Inserir o caractere na linha de comando, no s@'itio do cursor@*
|
||||||
|
@*
|
||||||
|
@item Enter
|
||||||
|
Executa o comando ou envia a mensagem@*
|
||||||
|
@*
|
||||||
|
@item Seta para cima / Seta para baixo
|
||||||
|
Repetir os ultimos comandos/mensagens@*
|
||||||
|
@*
|
||||||
|
@item PageUp / PageDown
|
||||||
|
Navegar no hist@'orico da janela@*
|
||||||
|
@*
|
||||||
|
@item F6 / F7
|
||||||
|
Ir para a janela anterior/seguinte@*
|
||||||
|
@*
|
||||||
|
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||||
|
Identico a F6 / F7@*
|
||||||
|
@*
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
|
||||||
|
@section Comandos do WeeChat
|
||||||
|
|
||||||
|
N@~AO ESCRITO !
|
||||||
|
|
||||||
|
|
||||||
|
@c ******************************* Extencoes *********************************
|
||||||
|
|
||||||
|
@node Extencoes, Autores/Suporte, Utilizacao, Top
|
||||||
|
@chapter Exten@,{c}@~oes
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Scripts Perl::
|
||||||
|
* Scripts Python::
|
||||||
|
* Scripts Ruby::
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Scripts Perl, Scripts Python, Extencoes, Extencoes
|
||||||
|
@section Scripts Perl
|
||||||
|
|
||||||
|
@subsection Carregar/Descarregar Scripts Perl
|
||||||
|
|
||||||
|
Os Scripts Perl s@~ao carregados e descarregados com o comando @command{/perl}.
|
||||||
|
(escreve @kbd{/help perl} dentro do WeeChat para obteres ajuda acerca do comando).@*
|
||||||
|
|
||||||
|
@emph{Exemplos:}@*
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Carregar um Script Perl: @kbd{/perl load /tmp/sample.pl}@*
|
||||||
|
@item
|
||||||
|
Descarregar todos os Scripts Perl: @kbd{/perl unload}@*
|
||||||
|
@item
|
||||||
|
Listar todos os Scripts Perl: @kbd{/perl}@*
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@subsection Interface WeeChat / Perl
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
@command{IRC::register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
|
||||||
|
@*
|
||||||
|
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Perl.@*
|
||||||
|
Todos os Scripts Perl para o Weechat devem invocar esta fun@,{c}@~ao.@*
|
||||||
|
|
||||||
|
@emph{Argumentos:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nome}: nome @'unico que indentifique o script (cada Script Perl deve ter um @'unico nome)
|
||||||
|
@item @option{vers@~ao}: vers@~ao do script
|
||||||
|
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Perl invocada quando o script Ă© descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
|
||||||
|
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemplo:}@*
|
||||||
|
@code{IRC::register ("sample", "1.0", "sample_end", "Sample script!");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::print ( mensagem );}@*
|
||||||
|
@*
|
||||||
|
Imprimne uma mensagem na janela actual (canal ou servidor).@*
|
||||||
|
|
||||||
|
@emph{Argumentos:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{mensagem}: mensagem a mostrar
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemplo:}@*
|
||||||
|
@code{IRC::print ("mensagem");}@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_message_handler ( nome, fun@,{c}@~ao );}@*
|
||||||
|
@*
|
||||||
|
Anexa uma fun@,{c}@~ao Perl a uma mensagem de IRC.@*
|
||||||
|
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
|
||||||
|
|
||||||
|
@emph{Argumentos:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nome}: nome da mensagem IRC@*
|
||||||
|
Para conheceres uma lista de mensagens de IRC, por favor lĂŞ o RFC 1459 e/ou o 2812:@*
|
||||||
|
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
|
||||||
|
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
|
||||||
|
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl invocada quando a mensagem Ă© recebida
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemplo:}@*
|
||||||
|
@code{IRC::add_message_handler ("privmsg", my_function);}@*
|
||||||
|
@code{sub my_function}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
|
||||||
|
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
|
||||||
|
@code{@ @ @ @ IRC::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@item
|
||||||
|
@command{IRC::add_command_handler ( nome, fun@,{c}@~ao );}@*
|
||||||
|
@*
|
||||||
|
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Perl.@*
|
||||||
|
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
|
||||||
|
|
||||||
|
@emph{Argumentos:}
|
||||||
|
@itemize @minus
|
||||||
|
@item @option{nome}: nome do novo comando@*
|
||||||
|
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Perl. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Perl.
|
||||||
|
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl ligada ao comando
|
||||||
|
@end itemize
|
||||||
|
@*
|
||||||
|
@emph{Exemplo:}@*
|
||||||
|
@code{IRC::add_command_handler ("command", my_command);}@*
|
||||||
|
@code{sub my_command}@*
|
||||||
|
@code{@{ }@*
|
||||||
|
@code{@ @ @ @ IRC::print("Argumentos: ".@@_[0]);}@*
|
||||||
|
@code{@ @ @ @ return 0;}@*
|
||||||
|
@code{@} }@*
|
||||||
|
@*
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@node Scripts Python, Scripts Ruby, Scripts Perl, Extencoes
|
||||||
|
@section Scripts Python
|
||||||
|
|
||||||
|
N@~AO DESENVOLVIDO!
|
||||||
|
|
||||||
|
@node Scripts Ruby, , Scripts Python, Extencoes
|
||||||
|
@section Scripts Ruby
|
||||||
|
|
||||||
|
N@~AO DESENVOLVIDO!
|
||||||
|
|
||||||
|
|
||||||
|
@c **************************** Autores/Suporte *****************************
|
||||||
|
|
||||||
|
@node Autores/Suporte, , Extencoes, Top
|
||||||
|
@chapter Autores / Suporte
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@menu
|
||||||
|
* Autores::
|
||||||
|
* Obter Suporte::
|
||||||
|
* Copyright::
|
||||||
|
@end menu
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@menu
|
||||||
|
* Autores::
|
||||||
|
* Obter Suporte::
|
||||||
|
@end menu
|
||||||
|
@end ifnothtml
|
||||||
|
|
||||||
|
@node Autores, Obter Suporte, Autores/Suporte, Autores/Suporte
|
||||||
|
@section Autores
|
||||||
|
|
||||||
|
O WeeChat @'e desenvolvido por :@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
FlashCode
|
||||||
|
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||||
|
@item
|
||||||
|
Bounga
|
||||||
|
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||||
|
@item
|
||||||
|
Xahlexx
|
||||||
|
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||||
|
@item
|
||||||
|
Crevetor
|
||||||
|
<@email{crevetor@@caramail.com, crevetor AT caramail.com}>
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Obter Suporte, Copyright, Autores, Autores/Suporte
|
||||||
|
@end ifhtml
|
||||||
|
@ifnothtml
|
||||||
|
@node Obter Suporte, , Autores, Autores/Suporte
|
||||||
|
@end ifnothtml
|
||||||
|
@section Obter Suporte
|
||||||
|
|
||||||
|
Antes de pedires suporte, agradecemos se leres toda a documenta@,{c}@~ao e a FAQ.@*
|
||||||
|
(a documenta@,{c}@~ao @'e este documento que est@'as a ler, se n@~ao leste tudo at@'e aqui, est@'a na hora de come@,{c}ares do in@'icio !)@*
|
||||||
|
|
||||||
|
@itemize @bullet
|
||||||
|
@item
|
||||||
|
Suporte por IRC:@*
|
||||||
|
- servidor : @b{irc.freenode.net}@*
|
||||||
|
- canal : @b{#weechat}@*@*
|
||||||
|
@item
|
||||||
|
Forum do WeeChat : mais tarde !@*@*
|
||||||
|
@item
|
||||||
|
Suporte por lista de correio-e :@*
|
||||||
|
- para te inscreveres/desinscreveres :@*@uref{http://mail.nongnu.org/mailman/listinfo/weechat-support}.@*
|
||||||
|
- para enviares uma mensagem para a lista :@*@email{weechat-support@@nongnu.org}.@*
|
||||||
|
|
||||||
|
Os arquivos da lista est@~ao aqui :@*
|
||||||
|
@uref{http://mail.nongnu.org/archive/html/weechat-support}@*@*
|
||||||
|
@item
|
||||||
|
Para mais detalhes, v@^e tamb@'em a p@'agina de suporte do WeeChat :@*
|
||||||
|
@uref{http://weechat.flashtux.org/support.php}
|
||||||
|
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
@ifhtml
|
||||||
|
@node Copyright, , Obter Suporte, Autores/Suporte
|
||||||
|
@section Copyright
|
||||||
|
|
||||||
|
Este manual documenta o cliente de IRC WeeChat, Ele faz parte do WeeChat.@*
|
||||||
|
|
||||||
|
Copyright @copyright{} 2003 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}>@*
|
||||||
|
@*
|
||||||
|
A utiliza@,{c}@~ao deste documento @'e regida pela GNU General Public
|
||||||
|
License vers@~ao 2 ou posterior.@*
|
||||||
|
|
||||||
|
@end ifhtml
|
||||||
|
|
||||||
|
@bye
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
|||||||
|
DOMAIN = $(PACKAGE)
|
||||||
|
subdir = po
|
||||||
|
top_builddir = ..
|
||||||
|
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
|
||||||
|
COPYRIGHT_HOLDER =
|
||||||
|
EXTRA_LOCALE_CATEGORIES =
|
||||||
|
MSGID_BUGS_ADDRESS = flashcode@flashtux.org
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
./src/irc/irc-nick.c
|
||||||
|
./src/irc/irc-server.c
|
||||||
|
./src/irc/irc-channel.c
|
||||||
|
./src/irc/irc.h
|
||||||
|
./src/irc/irc-commands.c
|
||||||
|
./src/irc/irc-display.c
|
||||||
|
./src/irc/irc-send.c
|
||||||
|
./src/irc/irc-recv.c
|
||||||
|
./src/plugins/perl/wee-perl.c
|
||||||
|
./src/plugins/perl/wee-perl.h
|
||||||
|
./src/plugins/plugins.c
|
||||||
|
./src/plugins/plugins.h
|
||||||
|
./src/gui/curses/gui-input.c
|
||||||
|
./src/gui/curses/gui-display.c
|
||||||
|
./src/gui/gtk/gui-display.c
|
||||||
|
./src/gui/gtk/gui-input.c
|
||||||
|
./src/gui/gui.h
|
||||||
|
./src/gui/gui-common.c
|
||||||
|
./src/common/command.c
|
||||||
|
./src/common/completion.c
|
||||||
|
./src/common/history.c
|
||||||
|
./src/common/weechat.c
|
||||||
|
./src/common/command.h
|
||||||
|
./src/common/completion.h
|
||||||
|
./src/common/history.h
|
||||||
|
./src/common/weechat.h
|
||||||
|
./src/common/weeconfig.c
|
||||||
|
./src/common/weeconfig.h
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Sed script that remove the POT-Creation-Date line in the header entry
|
||||||
|
# from a POT file.
|
||||||
|
#
|
||||||
|
# The distinction between the first and the following occurrences of the
|
||||||
|
# pattern is achieved by looking at the hold space.
|
||||||
|
/^"POT-Creation-Date: .*"$/{
|
||||||
|
x
|
||||||
|
# Test if the hold space is empty.
|
||||||
|
s/P/P/
|
||||||
|
ta
|
||||||
|
# Yes it was empty. First occurrence. Remove the line.
|
||||||
|
g
|
||||||
|
d
|
||||||
|
bb
|
||||||
|
:a
|
||||||
|
# The hold space was nonempty. Following occurrences. Do nothing.
|
||||||
|
x
|
||||||
|
:b
|
||||||
|
}
|
||||||
+2564
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
|
|
||||||
OPTIONS=-Wall -W -pipe -O2
|
|
||||||
|
|
||||||
OUTPUT=weechat
|
|
||||||
|
|
||||||
OBJS=weechat.o config.o command.o completion.o history.o
|
|
||||||
OBJS_IRC=irc/irc.a
|
|
||||||
OBJS_GUI=gui/gui.a
|
|
||||||
|
|
||||||
|
|
||||||
# WeeChat with Curses interface
|
|
||||||
ifeq ($(GUI), curses)
|
|
||||||
LIBS_CURSES=-lcurses
|
|
||||||
DEFINES=WEE_CURSES
|
|
||||||
|
|
||||||
curses: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
|
||||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_CURSES)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Gtk+ interface
|
|
||||||
ifeq ($(GUI), gtk)
|
|
||||||
OBJS_GTK=gui-gtk.o
|
|
||||||
LIBS_GTK=
|
|
||||||
DEFINES=WEE_GTK
|
|
||||||
gtk: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
|
||||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_GTK)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Qt interface
|
|
||||||
ifeq ($(GUI), qt)
|
|
||||||
OBJS_QT=gui-qt.o
|
|
||||||
LIBS_QT=
|
|
||||||
DEFINES=WEE_QT
|
|
||||||
qt: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
|
||||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_QT)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Text interface
|
|
||||||
ifeq ($(GUI), text)
|
|
||||||
OBJS_TEXT=gui-text.o
|
|
||||||
LIBS_TEXT=
|
|
||||||
DEFINES=WEE_TEXT
|
|
||||||
text: $(OBJS) $(OBJS_IRC) $(OBJS_GUI)
|
|
||||||
$(CC) $(OPTIONS) $(OBJS) $(OBJS_IRC) $(OBJS_GUI) -o $(OUTPUT) $(LIBS_TEXT)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
all:
|
|
||||||
make curses GUI=curses
|
|
||||||
|
|
||||||
$(OBJS):
|
|
||||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
|
||||||
|
|
||||||
irc/irc.a:
|
|
||||||
cd irc && make
|
|
||||||
|
|
||||||
gui/gui.a:
|
|
||||||
cd gui && make $(GUI) GUI=$(GUI)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.a *~ core $(OUTPUT)
|
|
||||||
cd irc && make clean
|
|
||||||
cd gui && make clean
|
|
||||||
|
|
||||||
command.o: command.c weechat.h command.h irc/irc.h gui/gui.h completion.h \
|
|
||||||
history.h config.h
|
|
||||||
completion.o: completion.c weechat.h completion.h irc/irc.h gui/gui.h \
|
|
||||||
history.h command.h
|
|
||||||
config.o: config.c weechat.h config.h irc/irc.h gui/gui.h completion.h \
|
|
||||||
history.h
|
|
||||||
history.o: history.c weechat.h history.h gui/gui.h completion.h
|
|
||||||
weechat.o: weechat.c weechat.h config.h command.h irc/irc.h gui/gui.h \
|
|
||||||
completion.h history.h
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
SUBDIRS = common irc plugins gui
|
||||||
-670
@@ -1,670 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
|
||||||
* Bounga <bounga@altern.org>
|
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* command.c: WeeChat internal commands */
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "weechat.h"
|
|
||||||
#include "command.h"
|
|
||||||
#include "irc/irc.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "gui/gui.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* WeeChat internal commands */
|
|
||||||
|
|
||||||
t_weechat_command weechat_commands[] =
|
|
||||||
{ { "alias", N_("create an alias for a command"),
|
|
||||||
N_("[alias_name [command [arguments]]"),
|
|
||||||
N_("alias_name: name of alias\ncommand: command name (" WEECHAT_NAME
|
|
||||||
" or IRC command)\n" "arguments: arguments for command"),
|
|
||||||
0, MAX_ARGS, weechat_cmd_alias, NULL },
|
|
||||||
{ "clear", N_("clear window(s)"),
|
|
||||||
N_("[-all]"),
|
|
||||||
N_("-all: clear all windows"),
|
|
||||||
0, 1, weechat_cmd_clear, NULL },
|
|
||||||
{ "help", N_("display help about commands"),
|
|
||||||
N_("[command]"), N_("command: name of a " WEECHAT_NAME " or IRC command"),
|
|
||||||
0, 1, weechat_cmd_help, 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 },
|
|
||||||
{ "unalias", N_("remove an alias"),
|
|
||||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
|
||||||
1, 1, weechat_cmd_unalias, NULL },
|
|
||||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
t_index_command *index_commands;
|
|
||||||
t_index_command *last_index_command;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* index_find_pos: find position for a command index (for sorting index)
|
|
||||||
*/
|
|
||||||
|
|
||||||
t_index_command *
|
|
||||||
index_command_find_pos (char *command)
|
|
||||||
{
|
|
||||||
t_index_command *ptr_index;
|
|
||||||
|
|
||||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
|
||||||
{
|
|
||||||
if (strcasecmp (command, ptr_index->command_name) < 0)
|
|
||||||
return ptr_index;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* index_command_insert_sorted: insert index into sorted list
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
index_command_insert_sorted (t_index_command *index)
|
|
||||||
{
|
|
||||||
t_index_command *pos_index;
|
|
||||||
|
|
||||||
pos_index = index_command_find_pos (index->command_name);
|
|
||||||
|
|
||||||
if (index_commands)
|
|
||||||
{
|
|
||||||
if (pos_index)
|
|
||||||
{
|
|
||||||
/* insert index into the list (before index found) */
|
|
||||||
index->prev_index = pos_index->prev_index;
|
|
||||||
index->next_index = pos_index;
|
|
||||||
if (pos_index->prev_index)
|
|
||||||
pos_index->prev_index->next_index = index;
|
|
||||||
else
|
|
||||||
index_commands = index;
|
|
||||||
pos_index->prev_index = index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* add index to the end */
|
|
||||||
index->prev_index = last_index_command;
|
|
||||||
index->next_index = NULL;
|
|
||||||
last_index_command->next_index = index;
|
|
||||||
last_index_command = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
index->prev_index = NULL;
|
|
||||||
index->next_index = NULL;
|
|
||||||
index_commands = index;
|
|
||||||
last_index_command = index;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* index_command_build: build an index of commands (internal, irc and alias)
|
|
||||||
* This list will be sorted, and used for completion
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
index_command_build ()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
t_index_command *new_index;
|
|
||||||
|
|
||||||
index_commands = NULL;
|
|
||||||
last_index_command = NULL;
|
|
||||||
i = 0;
|
|
||||||
while (weechat_commands[i].command_name)
|
|
||||||
{
|
|
||||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
|
||||||
{
|
|
||||||
new_index->command_name = strdup (weechat_commands[i].command_name);
|
|
||||||
index_command_insert_sorted (new_index);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
while (irc_commands[i].command_name)
|
|
||||||
{
|
|
||||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
|
||||||
{
|
|
||||||
if ((new_index = ((t_index_command *) malloc (sizeof (t_index_command)))))
|
|
||||||
{
|
|
||||||
new_index->command_name = strdup (irc_commands[i].command_name);
|
|
||||||
index_command_insert_sorted (new_index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* explode_string: explode a string according to separators
|
|
||||||
*/
|
|
||||||
|
|
||||||
char **
|
|
||||||
explode_string (char *string, char *separators, int num_items_max,
|
|
||||||
int *num_items)
|
|
||||||
{
|
|
||||||
int i, n_items;
|
|
||||||
char **array;
|
|
||||||
char *ptr, *ptr1, *ptr2;
|
|
||||||
|
|
||||||
if (num_items != NULL)
|
|
||||||
*num_items = 0;
|
|
||||||
|
|
||||||
n_items = num_items_max;
|
|
||||||
|
|
||||||
if (string == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (num_items_max == 0)
|
|
||||||
{
|
|
||||||
/* calculate number of items */
|
|
||||||
ptr = string;
|
|
||||||
i = 1;
|
|
||||||
while ((ptr = strpbrk (ptr, separators)))
|
|
||||||
{
|
|
||||||
while (strchr (separators, ptr[0]) != NULL)
|
|
||||||
ptr++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
n_items = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
array =
|
|
||||||
(char **) malloc ((num_items_max ? n_items : n_items + 1) *
|
|
||||||
sizeof (char *));
|
|
||||||
|
|
||||||
ptr1 = string;
|
|
||||||
ptr2 = string;
|
|
||||||
|
|
||||||
for (i = 0; i < n_items; i++)
|
|
||||||
{
|
|
||||||
while (strchr (separators, ptr1[0]) != NULL)
|
|
||||||
ptr1++;
|
|
||||||
if (i == (n_items - 1) || (ptr2 = strpbrk (ptr1, separators)) == NULL)
|
|
||||||
if ((ptr2 = strchr (ptr1, '\r')) == NULL)
|
|
||||||
if ((ptr2 = strchr (ptr1, '\n')) == NULL)
|
|
||||||
ptr2 = strchr (ptr1, '\0');
|
|
||||||
|
|
||||||
if ((ptr1 == NULL) || (ptr2 == NULL))
|
|
||||||
{
|
|
||||||
array[i] = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ptr2 - ptr1 > 0)
|
|
||||||
{
|
|
||||||
array[i] =
|
|
||||||
(char *) malloc ((ptr2 - ptr1 + 1) * sizeof (char));
|
|
||||||
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
|
|
||||||
array[i][ptr2 - ptr1] = '\0';
|
|
||||||
ptr1 = ++ptr2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
array[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num_items_max == 0)
|
|
||||||
{
|
|
||||||
array[i] = NULL;
|
|
||||||
if (num_items != NULL)
|
|
||||||
*num_items = i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (num_items != NULL)
|
|
||||||
*num_items = num_items_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
|
||||||
* returns: 1 if command was executed succesfully
|
|
||||||
* 0 if error (command not executed)
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
exec_weechat_command (t_irc_server *server, char *string)
|
|
||||||
{
|
|
||||||
int i, j, argc, return_code;
|
|
||||||
char *pos, *ptr_args, **argv;
|
|
||||||
|
|
||||||
if ((!string[0]) || (string[0] != '/'))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* look for end of command */
|
|
||||||
ptr_args = NULL;
|
|
||||||
pos = strchr (string, ' ');
|
|
||||||
if (pos)
|
|
||||||
{
|
|
||||||
pos[0] = '\0';
|
|
||||||
pos++;
|
|
||||||
while (pos[0] == ' ')
|
|
||||||
pos++;
|
|
||||||
ptr_args = pos;
|
|
||||||
if (!ptr_args[0])
|
|
||||||
ptr_args = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
argv = explode_string (ptr_args, " ", 0, &argc);
|
|
||||||
|
|
||||||
for (i = 0; weechat_commands[i].command_name; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp (weechat_commands[i].command_name, string + 1) == 0)
|
|
||||||
{
|
|
||||||
if ((argc < weechat_commands[i].min_arg)
|
|
||||||
|| (argc > weechat_commands[i].max_arg))
|
|
||||||
{
|
|
||||||
if (weechat_commands[i].min_arg ==
|
|
||||||
weechat_commands[i].max_arg)
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s wrong argument count for "
|
|
||||||
WEECHAT_NAME " command '%s' "
|
|
||||||
"(expected: %d arg%s)\n"),
|
|
||||||
WEECHAT_ERROR,
|
|
||||||
string + 1,
|
|
||||||
weechat_commands[i].max_arg,
|
|
||||||
(weechat_commands[i].max_arg >
|
|
||||||
1) ? "s" : "");
|
|
||||||
else
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s wrong argument count for "
|
|
||||||
WEECHAT_NAME " command '%s' "
|
|
||||||
"(expected: between %d and %d arg%s)\n"),
|
|
||||||
WEECHAT_ERROR,
|
|
||||||
string + 1,
|
|
||||||
weechat_commands[i].min_arg,
|
|
||||||
weechat_commands[i].max_arg,
|
|
||||||
(weechat_commands[i].max_arg >
|
|
||||||
1) ? "s" : "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (weechat_commands[i].cmd_function_args != NULL)
|
|
||||||
return_code = (int) (weechat_commands[i].cmd_function_args)
|
|
||||||
(argc, argv);
|
|
||||||
else
|
|
||||||
return_code = (int) (weechat_commands[i].cmd_function_1arg)
|
|
||||||
(ptr_args);
|
|
||||||
if (return_code < 0)
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s " WEECHAT_NAME " command \"%s\" failed\n"),
|
|
||||||
WEECHAT_ERROR, string + 1);
|
|
||||||
}
|
|
||||||
if (argv)
|
|
||||||
{
|
|
||||||
for (j = 0; argv[j]; j++)
|
|
||||||
free (argv[j]);
|
|
||||||
free (argv);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = 0; irc_commands[i].command_name; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp (irc_commands[i].command_name, string + 1) == 0)
|
|
||||||
{
|
|
||||||
if ((argc < irc_commands[i].min_arg)
|
|
||||||
|| (argc > irc_commands[i].max_arg))
|
|
||||||
{
|
|
||||||
if (irc_commands[i].min_arg == irc_commands[i].max_arg)
|
|
||||||
gui_printf
|
|
||||||
(NULL,
|
|
||||||
_("%s wrong argument count for IRC command '%s' "
|
|
||||||
"(expected: %d arg%s)\n"),
|
|
||||||
WEECHAT_ERROR,
|
|
||||||
string + 1,
|
|
||||||
irc_commands[i].max_arg,
|
|
||||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
|
||||||
else
|
|
||||||
gui_printf
|
|
||||||
(NULL,
|
|
||||||
_("%s wrong argument count for IRC command '%s' "
|
|
||||||
"(expected: between %d and %d arg%s)\n"),
|
|
||||||
WEECHAT_ERROR,
|
|
||||||
string + 1,
|
|
||||||
irc_commands[i].min_arg, irc_commands[i].max_arg,
|
|
||||||
(irc_commands[i].max_arg > 1) ? "s" : "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((irc_commands[i].need_connection) &&
|
|
||||||
((!server) || (!server->is_connected)))
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s command '%s' needs a server connection!\n"),
|
|
||||||
WEECHAT_ERROR, irc_commands[i].command_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (irc_commands[i].cmd_function_args != NULL)
|
|
||||||
return_code = (int) (irc_commands[i].cmd_function_args)
|
|
||||||
(server, argc, argv);
|
|
||||||
else
|
|
||||||
return_code = (int) (irc_commands[i].cmd_function_1arg)
|
|
||||||
(server, ptr_args);
|
|
||||||
if (return_code < 0)
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s IRC command \"%s\" failed\n"),
|
|
||||||
WEECHAT_ERROR, string + 1);
|
|
||||||
}
|
|
||||||
if (argv)
|
|
||||||
{
|
|
||||||
for (j = 0; argv[j]; j++)
|
|
||||||
free (argv[j]);
|
|
||||||
free (argv);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gui_printf (server->window,
|
|
||||||
_("%s unknown command '%s' (type /help for help)\n"),
|
|
||||||
WEECHAT_ERROR,
|
|
||||||
string + 1);
|
|
||||||
if (argv)
|
|
||||||
{
|
|
||||||
for (j = 0; argv[j]; j++)
|
|
||||||
free (argv[j]);
|
|
||||||
free (argv);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* user_command: interprets user command (if beginning with '/')
|
|
||||||
* any other text is sent to the server, if connected
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
user_command (t_irc_server *server, char *command)
|
|
||||||
{
|
|
||||||
t_irc_nick *ptr_nick;
|
|
||||||
|
|
||||||
if ((!command) || (command[0] == '\r') || (command[0] == '\n'))
|
|
||||||
return;
|
|
||||||
if ((command[0] == '/') && (command[1] != '/'))
|
|
||||||
{
|
|
||||||
/* WeeChat internal command (or IRC command) */
|
|
||||||
exec_weechat_command (server, command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((command[0] == '/') && (command[1] == '/'))
|
|
||||||
command++;
|
|
||||||
if (!WIN_IS_SERVER(gui_current_window))
|
|
||||||
{
|
|
||||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
|
||||||
CHANNEL(gui_current_window)->name,
|
|
||||||
command);
|
|
||||||
|
|
||||||
if (WIN_IS_PRIVATE(gui_current_window))
|
|
||||||
{
|
|
||||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
|
||||||
MSG_TYPE_NICK,
|
|
||||||
COLOR_WIN_CHAT_DARK, "<");
|
|
||||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
|
||||||
MSG_TYPE_NICK,
|
|
||||||
COLOR_WIN_NICK_SELF,
|
|
||||||
"%s", server->nick);
|
|
||||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
|
||||||
MSG_TYPE_NICK,
|
|
||||||
COLOR_WIN_CHAT_DARK, "> ");
|
|
||||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
|
||||||
MSG_TYPE_MSG,
|
|
||||||
COLOR_WIN_CHAT, "%s\n", command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ptr_nick = nick_search (CHANNEL(gui_current_window), server->nick);
|
|
||||||
if (ptr_nick)
|
|
||||||
{
|
|
||||||
irc_display_nick (CHANNEL(gui_current_window)->window, ptr_nick,
|
|
||||||
MSG_TYPE_NICK, 1, 1, 0);
|
|
||||||
gui_printf_color (CHANNEL(gui_current_window)->window,
|
|
||||||
COLOR_WIN_CHAT, "%s\n", command);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gui_printf (server->window,
|
|
||||||
_("%s cannot find nick for sending message\n"),
|
|
||||||
WEECHAT_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gui_printf (server->window, _("This window is not a channel!\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* weechat_cmd_alias: display or create alias
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
weechat_cmd_alias (int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
/* List all aliases */
|
|
||||||
}
|
|
||||||
argv = NULL;
|
|
||||||
gui_printf (NULL, _("(TODO) \"/alias\" command not developed!\n"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* weechat_cmd_clear: display or create alias
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
weechat_cmd_clear (int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
if (strcmp (argv[0], "-all") == 0)
|
|
||||||
gui_window_clear_all ();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("unknown parameter \"%s\" for /clear command\n"),
|
|
||||||
argv[0]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gui_window_clear (gui_current_window);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* weechat_cmd_help: display help
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
weechat_cmd_help (int argc, char **argv)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("> List of " WEECHAT_NAME " internal commands:\n"));
|
|
||||||
for (i = 0; weechat_commands[i].command_name; i++)
|
|
||||||
gui_printf (NULL, " %s - %s\n",
|
|
||||||
weechat_commands[i].command_name,
|
|
||||||
weechat_commands[i].command_description);
|
|
||||||
gui_printf (NULL, _("> List of IRC commands:\n"));
|
|
||||||
for (i = 0; irc_commands[i].command_name; i++)
|
|
||||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
|
||||||
gui_printf (NULL, " %s - %s\n",
|
|
||||||
irc_commands[i].command_name,
|
|
||||||
irc_commands[i].command_description);
|
|
||||||
}
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
for (i = 0; weechat_commands[i].command_name; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
|
||||||
{
|
|
||||||
gui_printf
|
|
||||||
(NULL,
|
|
||||||
_("> Help on " WEECHAT_NAME " internal command '%s':\n"),
|
|
||||||
weechat_commands[i].command_name);
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("Syntax: /%s %s\n"),
|
|
||||||
weechat_commands[i].command_name,
|
|
||||||
(weechat_commands[i].
|
|
||||||
arguments) ? weechat_commands[i].
|
|
||||||
arguments : "");
|
|
||||||
if (weechat_commands[i].arguments_description)
|
|
||||||
{
|
|
||||||
gui_printf (NULL, "%s\n",
|
|
||||||
weechat_commands[i].
|
|
||||||
arguments_description);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = 0; irc_commands[i].command_name; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("> Help on IRC command '%s':\n"),
|
|
||||||
irc_commands[i].command_name);
|
|
||||||
gui_printf (NULL, _("Syntax: /%s %s\n"),
|
|
||||||
irc_commands[i].command_name,
|
|
||||||
(irc_commands[i].arguments) ?
|
|
||||||
irc_commands[i].arguments : "");
|
|
||||||
if (irc_commands[i].arguments_description)
|
|
||||||
{
|
|
||||||
gui_printf (NULL, "%s\n",
|
|
||||||
irc_commands[i].
|
|
||||||
arguments_description);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("No help available, \"%s\" is an unknown command\n"),
|
|
||||||
argv[0]);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* weechat_cmd_set: set options
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
weechat_cmd_set (int argc, char **argv)
|
|
||||||
{
|
|
||||||
int i, j, section_displayed;
|
|
||||||
char *color_name;
|
|
||||||
|
|
||||||
/* TODO: complete /set command */
|
|
||||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
|
||||||
{
|
|
||||||
section_displayed = 0;
|
|
||||||
if (i != CONFIG_SECTION_SERVER)
|
|
||||||
{
|
|
||||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
|
||||||
{
|
|
||||||
if ((argc == 0) ||
|
|
||||||
((argc > 0)
|
|
||||||
&& (strstr (weechat_options[i][j].option_name, argv[0])
|
|
||||||
!= NULL)))
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gui_printf (NULL, _("(TODO) \"/set\" command not developed!\n"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cmd_unalias: remove an alias
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
weechat_cmd_unalias (int argc, char **argv)
|
|
||||||
{
|
|
||||||
if (argc != 1)
|
|
||||||
{
|
|
||||||
gui_printf
|
|
||||||
(NULL,
|
|
||||||
_("Wrong argument count for unalias function (expexted: 1 arg)\n"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
argv = NULL;
|
|
||||||
gui_printf (NULL, _("(TODO) \"/unalias\" not developed!\n"));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||||
|
|
||||||
|
noinst_LIBRARIES = lib_weechat_main.a
|
||||||
|
|
||||||
|
lib_weechat_main_a_SOURCES = weechat.c \
|
||||||
|
weechat.h \
|
||||||
|
command.c \
|
||||||
|
command.h \
|
||||||
|
completion.c \
|
||||||
|
completion.h \
|
||||||
|
weeconfig.c \
|
||||||
|
weeconfig.h \
|
||||||
|
history.c \
|
||||||
|
history.h
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,7 +21,7 @@
|
|||||||
#ifndef __WEECHAT_COMMAND_H
|
#ifndef __WEECHAT_COMMAND_H
|
||||||
#define __WEECHAT_COMMAND_H 1
|
#define __WEECHAT_COMMAND_H 1
|
||||||
|
|
||||||
#include "irc/irc.h"
|
#include "../irc/irc.h"
|
||||||
|
|
||||||
#define MAX_ARGS 8192
|
#define MAX_ARGS 8192
|
||||||
|
|
||||||
@@ -40,6 +38,16 @@ struct t_weechat_command
|
|||||||
int (*cmd_function_1arg)(char *);
|
int (*cmd_function_1arg)(char *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct t_weechat_alias t_weechat_alias;
|
||||||
|
|
||||||
|
struct t_weechat_alias
|
||||||
|
{
|
||||||
|
char *alias_name;
|
||||||
|
char *alias_command;
|
||||||
|
t_weechat_alias *prev_alias;
|
||||||
|
t_weechat_alias *next_alias;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct t_index_command t_index_command;
|
typedef struct t_index_command t_index_command;
|
||||||
|
|
||||||
struct t_index_command
|
struct t_index_command
|
||||||
@@ -49,15 +57,24 @@ struct t_index_command
|
|||||||
t_index_command *next_index;
|
t_index_command *next_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern t_weechat_alias *weechat_alias;
|
||||||
extern t_index_command *index_commands;
|
extern t_index_command *index_commands;
|
||||||
|
|
||||||
|
extern t_index_command *index_command_search (char *);
|
||||||
|
extern t_index_command *index_command_new (char *);
|
||||||
extern void index_command_build ();
|
extern void index_command_build ();
|
||||||
|
extern t_weechat_alias *alias_new (char *, char *);
|
||||||
extern int exec_weechat_command (t_irc_server *, char *);
|
extern int exec_weechat_command (t_irc_server *, char *);
|
||||||
extern void user_command (t_irc_server *, char *);
|
extern void user_command (t_irc_server *, char *);
|
||||||
extern int weechat_cmd_alias(int, char **);
|
extern int weechat_cmd_alias (char *);
|
||||||
extern int weechat_cmd_clear(int, char **);
|
extern int weechat_cmd_clear (int, char **);
|
||||||
|
extern int weechat_cmd_connect (int, char **);
|
||||||
|
extern int weechat_cmd_disconnect (int, char **);
|
||||||
extern int weechat_cmd_help (int, char **);
|
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 (int, char **);
|
||||||
extern int weechat_cmd_unalias (int, char **);
|
extern int weechat_cmd_unalias (char *);
|
||||||
|
|
||||||
#endif /* command.h */
|
#endif /* command.h */
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,16 +17,19 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* completion.c: completes words according to context (cmd/nick) */
|
/* completion.c: completes words according to context (cmd/nick) */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "weechat.h"
|
#include "weechat.h"
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
#include "irc/irc.h"
|
#include "../irc/irc.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +44,17 @@ completion_init (t_completion *completion)
|
|||||||
completion->base_word = NULL;
|
completion->base_word = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* completion_free: free completion
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
completion_free (t_completion *completion)
|
||||||
|
{
|
||||||
|
if (completion->base_word)
|
||||||
|
free (completion->base_word);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* completion_command: complete a command
|
* completion_command: complete a command
|
||||||
*/
|
*/
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,6 +34,7 @@ struct t_completion
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void completion_init (t_completion *);
|
extern void completion_init (t_completion *);
|
||||||
|
extern void completion_free (t_completion *);
|
||||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||||
|
|
||||||
#endif /* completion.h */
|
#endif /* completion.h */
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,16 +17,19 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* history.c: memorize and call again commands or text */
|
/* history.c: memorize and call again commands or text */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "weechat.h"
|
#include "weechat.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "gui/gui.h"
|
#include "../gui/gui.h"
|
||||||
|
|
||||||
|
|
||||||
t_history *history_general = NULL;
|
t_history *history_general = NULL;
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,10 +16,8 @@
|
|||||||
* ### ###
|
* ### ###
|
||||||
* ############################################################################
|
* ############################################################################
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -36,10 +34,13 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* weechat.c: core functions for WeeChat */
|
/* weechat.c: core functions for WeeChat */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -47,26 +48,38 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "weechat.h"
|
#include "weechat.h"
|
||||||
#include "config.h"
|
#include "weeconfig.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "irc/irc.h"
|
#include "../irc/irc.h"
|
||||||
#include "gui/gui.h"
|
#include "../gui/gui.h"
|
||||||
|
#include "../plugins/plugins.h"
|
||||||
|
|
||||||
|
|
||||||
/* char *display_name; */
|
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||||
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) */
|
||||||
FILE *log_file; /* WeeChat log file (~/.weechat/weechat.log */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||||
|
* Prevents user for exiting with Ctrl-C
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
log_printf (char *message, ...)
|
my_sigint ()
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_log_printf (char *message, ...)
|
||||||
{
|
{
|
||||||
static char buffer[4096];
|
static char buffer[4096];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
@@ -112,23 +125,10 @@ wee_parse_args (int argc, char *argv[])
|
|||||||
printf ("\n%s%s", WEE_LICENSE);
|
printf ("\n%s%s", WEE_LICENSE);
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
/*else if ((strcmp (argv[i], "-d") == 0)
|
|
||||||
|| (strcmp (argv[i], "--display") == 0))
|
|
||||||
{
|
|
||||||
if (i == (argc - 1))
|
|
||||||
fprintf (stderr,
|
|
||||||
_("%s no display specified (parameter '%s'), ignored\n"),
|
|
||||||
WEECHAT_WARNING, argv[i]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
display_name = argv[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
else if ((strcmp (argv[i], "-v") == 0)
|
else if ((strcmp (argv[i], "-v") == 0)
|
||||||
|| (strcmp (argv[i], "--version") == 0))
|
|| (strcmp (argv[i], "--version") == 0))
|
||||||
{
|
{
|
||||||
printf (WEECHAT_VERSION "\n");
|
printf (PACKAGE_VERSION "\n");
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -141,30 +141,82 @@ wee_parse_args (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wee_create_home_dir: create weechat home directory (if not found)
|
* wee_create_dir: create a directory
|
||||||
|
* return: 1 if ok (or directory already exists)
|
||||||
|
* 0 if error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
int
|
||||||
wee_create_home_dir ()
|
wee_create_dir (char *directory)
|
||||||
{
|
{
|
||||||
char *weechat_home_dir;
|
if (mkdir (directory, 0755) < 0)
|
||||||
int return_code;
|
|
||||||
|
|
||||||
weechat_home_dir =
|
|
||||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
|
||||||
sprintf (weechat_home_dir, "%s/.weechat", getenv ("HOME"));
|
|
||||||
return_code = mkdir (weechat_home_dir, 0755);
|
|
||||||
if (return_code < 0)
|
|
||||||
{
|
{
|
||||||
|
/* exit if error (except if directory already exists) */
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
{
|
{
|
||||||
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
fprintf (stderr, _("%s cannot create directory \"%s\"\n"),
|
||||||
WEECHAT_ERROR, weechat_home_dir);
|
WEECHAT_ERROR, directory);
|
||||||
free (weechat_home_dir);
|
return 0;
|
||||||
exit (1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free (weechat_home_dir);
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_create_home_dirs: create (if not found):
|
||||||
|
* - WeeChat home directory ("~/.weechat")
|
||||||
|
* - "perl" directory (and "autoload")
|
||||||
|
* - "ruby" directory (and "autoload")
|
||||||
|
* - "python" directory (and "autoload")
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_create_home_dirs ()
|
||||||
|
{
|
||||||
|
char *dir_name;
|
||||||
|
|
||||||
|
/* TODO: rewrite this code for Windows version */
|
||||||
|
weechat_home =
|
||||||
|
(char *) malloc ((strlen (getenv ("HOME")) + 10) * sizeof (char));
|
||||||
|
sprintf (weechat_home, "%s%s.weechat", getenv ("HOME"), DIR_SEPARATOR);
|
||||||
|
|
||||||
|
/* create home directory "~/.weechat" ; error is fatal */
|
||||||
|
if (!wee_create_dir (weechat_home))
|
||||||
|
exit (1);
|
||||||
|
|
||||||
|
dir_name = (char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
|
||||||
|
|
||||||
|
/* create "~/.weechat/perl" */
|
||||||
|
sprintf (dir_name, "%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");
|
||||||
|
wee_create_dir (dir_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create "~/.weechat/python" */
|
||||||
|
sprintf (dir_name, "%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");
|
||||||
|
wee_create_dir (dir_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create "~/.weechat/ruby" */
|
||||||
|
sprintf (dir_name, "%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");
|
||||||
|
wee_create_dir (dir_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (dir_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,74 +244,25 @@ wee_init_log ()
|
|||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename =
|
filename =
|
||||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
|
||||||
sprintf (filename, "%s/.weechat/" WEECHAT_LOG_NAME, getenv ("HOME"));
|
sprintf (filename, "%s/" WEECHAT_LOG_NAME, weechat_home);
|
||||||
if ((log_file = fopen (filename, "wt")) == NULL)
|
if ((log_file = fopen (filename, "wt")) == NULL)
|
||||||
{
|
{
|
||||||
free (filename);
|
free (filename);
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s unable to create/append to log file (~/.weechat/"
|
_("%s unable to create/append to log file (~/.weechat/%s)"),
|
||||||
WEECHAT_LOG_NAME), WEECHAT_ERROR);
|
WEECHAT_ERROR, WEECHAT_LOG_NAME);
|
||||||
}
|
}
|
||||||
free (filename);
|
free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wee_shutdown: shutdown WeeChat
|
* weechat_welcome_message: display WeeChat welcome message - yeah!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
wee_shutdown ()
|
weechat_welcome_message ()
|
||||||
{
|
{
|
||||||
gui_end ();
|
|
||||||
server_free_all ();
|
|
||||||
if (log_file)
|
|
||||||
fclose (log_file);
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* main: WeeChat startup
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
t_irc_server *ptr_server;
|
|
||||||
|
|
||||||
/* initialize variables */
|
|
||||||
wee_init_vars ();
|
|
||||||
|
|
||||||
/* parse command line args */
|
|
||||||
wee_parse_args (argc, argv);
|
|
||||||
|
|
||||||
/* create weechat home directory */
|
|
||||||
wee_create_home_dir ();
|
|
||||||
|
|
||||||
/* init log file */
|
|
||||||
wee_init_log ();
|
|
||||||
|
|
||||||
/* read configuration */
|
|
||||||
switch (config_read ())
|
|
||||||
{
|
|
||||||
case 0: /* success */
|
|
||||||
break;
|
|
||||||
case -1: /* config file not found */
|
|
||||||
config_create_default ();
|
|
||||||
config_read ();
|
|
||||||
break;
|
|
||||||
default: /* other error (fatal) */
|
|
||||||
server_free_all ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* init gui */
|
|
||||||
gui_init ();
|
|
||||||
|
|
||||||
/* build commands index (sorted), for completion */
|
|
||||||
index_command_build ();
|
|
||||||
|
|
||||||
/* Welcome message - yeah! */
|
|
||||||
if (cfg_look_startup_logo)
|
if (cfg_look_startup_logo)
|
||||||
{
|
{
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||||
@@ -273,14 +276,14 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||||
(cfg_look_startup_logo) ? " " : "");
|
(cfg_look_startup_logo) ? " " : "");
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, WEECHAT_NAME);
|
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||||
", %s\n", cfg_look_weechat_slogan);
|
", %s\n", cfg_look_weechat_slogan);
|
||||||
}
|
}
|
||||||
if (cfg_look_startup_version)
|
if (cfg_look_startup_version)
|
||||||
{
|
{
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||||
"%s" WEECHAT_NAME_AND_VERSION,
|
"%s" PACKAGE_STRING,
|
||||||
(cfg_look_startup_logo) ? " " : "");
|
(cfg_look_startup_logo) ? " " : "");
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||||
", %s %s %s\n",
|
", %s %s %s\n",
|
||||||
@@ -291,21 +294,67 @@ main (int argc, char *argv[])
|
|||||||
cfg_look_startup_version)
|
cfg_look_startup_version)
|
||||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||||
|
}
|
||||||
/* connect to all servers */
|
|
||||||
for (ptr_server = irc_servers; ptr_server;
|
/*
|
||||||
ptr_server = ptr_server->next_server)
|
* wee_shutdown: shutdown WeeChat
|
||||||
{
|
*/
|
||||||
server_create_window (ptr_server);
|
|
||||||
if (server_connect (ptr_server))
|
void
|
||||||
irc_login (ptr_server);
|
wee_shutdown ()
|
||||||
}
|
{
|
||||||
gui_main_loop ();
|
server_free_all ();
|
||||||
server_disconnect_all ();
|
gui_end ();
|
||||||
|
if (log_file)
|
||||||
/* program ending */
|
fclose (log_file);
|
||||||
wee_shutdown ();
|
exit (0);
|
||||||
|
}
|
||||||
/* make gcc happy (statement never executed) */
|
|
||||||
return 0;
|
/*
|
||||||
|
* main: WeeChat startup
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
setlocale (LC_ALL, ""); /* initialize gettext */
|
||||||
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||||
|
textdomain (PACKAGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||||
|
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||||
|
wee_init_vars (); /* initialize some variables */
|
||||||
|
wee_parse_args (argc, argv); /* parse command line args */
|
||||||
|
wee_create_home_dirs (); /* create WeeChat directories */
|
||||||
|
wee_init_log (); /* init log file */
|
||||||
|
index_command_build (); /* build commands index for completion */
|
||||||
|
|
||||||
|
switch (config_read ()) /* read configuration */
|
||||||
|
{
|
||||||
|
case 0: /* config file OK */
|
||||||
|
break;
|
||||||
|
case -1: /* config file not found */
|
||||||
|
config_create_default ();
|
||||||
|
config_read ();
|
||||||
|
break;
|
||||||
|
default: /* other error (fatal) */
|
||||||
|
server_free_all ();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
||||||
|
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 */
|
||||||
|
wee_shutdown (); /* quit WeeChat (oh no, why?) */
|
||||||
|
|
||||||
|
return 0; /* make gcc happy (never executed) */
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,24 +21,33 @@
|
|||||||
#ifndef __WEECHAT_H
|
#ifndef __WEECHAT_H
|
||||||
#define __WEECHAT_H 1
|
#define __WEECHAT_H 1
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <libintl.h>
|
|
||||||
|
|
||||||
#define _(string) gettext(string)
|
#if defined(ENABLE_NLS) && !defined(_)
|
||||||
#define N_(string) (string)
|
#include <locale.h>
|
||||||
|
#include <libintl.h>
|
||||||
|
#define _(x) gettext(x)
|
||||||
|
#ifdef gettext_noop
|
||||||
|
#define N_(string) gettext_noop (string)
|
||||||
|
#else
|
||||||
|
#define N_(string) (string)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !defined(_)
|
||||||
|
#define _(x) (x)
|
||||||
|
#define N_(string) (string)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WEECHAT_NAME "WeeChat"
|
|
||||||
#define WEECHAT_VERSION "0.0.1"
|
|
||||||
|
|
||||||
#define WEECHAT_NAME_AND_VERSION WEECHAT_NAME " " WEECHAT_VERSION
|
#define WEECHAT_COPYRIGHT PACKAGE_NAME " (c) 2004 by Wee Team"
|
||||||
#define WEECHAT_COPYRIGHT WEECHAT_NAME " (c) 2003 by Wee Team"
|
|
||||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||||
|
|
||||||
#define WEECHAT_ERROR _(WEECHAT_NAME " Error:")
|
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||||
#define WEECHAT_WARNING _(WEECHAT_NAME " Warning:")
|
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||||
|
|
||||||
/* debug mode, 0=normal use, 1=some debug msg, 2=full debug (developers only) */
|
|
||||||
#define DEBUG 0
|
|
||||||
|
|
||||||
/* log file */
|
/* log file */
|
||||||
|
|
||||||
@@ -49,8 +56,8 @@
|
|||||||
/* license */
|
/* license */
|
||||||
|
|
||||||
#define WEE_LICENSE \
|
#define WEE_LICENSE \
|
||||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
|
||||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
|
||||||
" Bounga <bounga@altern.org>\n" \
|
" Bounga <bounga@altern.org>\n" \
|
||||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||||
"This program is free software; you can redistribute it and/or modify\n" \
|
"This program is free software; you can redistribute it and/or modify\n" \
|
||||||
@@ -69,28 +76,28 @@
|
|||||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||||
|
|
||||||
#define WEE_USAGE \
|
#define WEE_USAGE \
|
||||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
PACKAGE_STRING " (c) Copyright 2004, compiled on " __DATE__ " " __TIME__ \
|
||||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
|
||||||
" Bounga <bounga@altern.org>\n" \
|
" Bounga <bounga@altern.org>\n" \
|
||||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||||
" Bounga <bounga@altern.org>\n" \
|
|
||||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
|
||||||
" -h, --help this help screen\n", \
|
" -h, --help this help screen\n", \
|
||||||
" -l, --license display WeeChat license\n" \
|
" -l, --license display WeeChat license\n" \
|
||||||
" -v, --version display WeeChat version\n\n"
|
" -v, --version display WeeChat version\n\n"
|
||||||
|
|
||||||
/* " -d, --display choose X display\n" \*/
|
/* directory separator, depending on OS */
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define DIR_SEPARATOR "\\"
|
||||||
|
#else
|
||||||
|
#define DIR_SEPARATOR "/"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*#define DEFAULT_DISPLAY ":0" */
|
/* global variables and functions */
|
||||||
|
|
||||||
|
|
||||||
/*extern char *display_name; */
|
|
||||||
int quit_weechat;
|
|
||||||
|
|
||||||
extern int quit_weechat;
|
extern int quit_weechat;
|
||||||
|
extern char *weechat_home;
|
||||||
|
|
||||||
extern void log_printf (char *, ...);
|
extern void wee_log_printf (char *, ...);
|
||||||
extern void wee_shutdown ();
|
extern void wee_shutdown ();
|
||||||
|
|
||||||
#endif /* weechat.h */
|
#endif /* weechat.h */
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,9 +17,12 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* weeconfig.c: WeeChat configuration */
|
||||||
|
|
||||||
/* config.c: WeeChat configuration */
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -30,9 +31,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "weechat.h"
|
#include "weechat.h"
|
||||||
#include "config.h"
|
#include "weeconfig.h"
|
||||||
#include "irc/irc.h"
|
#include "command.h"
|
||||||
#include "gui/gui.h"
|
#include "../irc/irc.h"
|
||||||
|
#include "../gui/gui.h"
|
||||||
|
|
||||||
|
|
||||||
/* config sections */
|
/* config sections */
|
||||||
@@ -44,11 +46,13 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
|
|||||||
{ CONFIG_SECTION_LOG, "log" },
|
{ CONFIG_SECTION_LOG, "log" },
|
||||||
{ CONFIG_SECTION_DCC, "dcc" },
|
{ CONFIG_SECTION_DCC, "dcc" },
|
||||||
{ CONFIG_SECTION_PROXY, "proxy" },
|
{ CONFIG_SECTION_PROXY, "proxy" },
|
||||||
|
{ CONFIG_SECTION_ALIAS, "alias" },
|
||||||
{ CONFIG_SECTION_SERVER, "server" }
|
{ CONFIG_SECTION_SERVER, "server" }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* config, look & feel section */
|
/* config, look & feel section */
|
||||||
|
|
||||||
|
int cfg_look_set_title;
|
||||||
int cfg_look_startup_logo;
|
int cfg_look_startup_logo;
|
||||||
int cfg_look_startup_version;
|
int cfg_look_startup_version;
|
||||||
char *cfg_look_weechat_slogan;
|
char *cfg_look_weechat_slogan;
|
||||||
@@ -67,16 +71,20 @@ char *cfg_look_no_nickname;
|
|||||||
char *cfg_look_completor;
|
char *cfg_look_completor;
|
||||||
|
|
||||||
t_config_option weechat_options_look[] =
|
t_config_option weechat_options_look[] =
|
||||||
{ { "look_startup_logo", N_("display " WEECHAT_NAME " logo at startup"),
|
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
|
||||||
N_("display " WEECHAT_NAME " logo at startup"),
|
N_("set title for terminal window (curses GUI) with name & version"),
|
||||||
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
|
NULL, NULL, &cfg_look_set_title, NULL, NULL },
|
||||||
|
{ "look_startup_logo", N_("display WeeChat logo at startup"),
|
||||||
|
N_("display WeeChat logo at startup"),
|
||||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
NULL, NULL, &cfg_look_startup_logo, NULL, NULL },
|
NULL, NULL, &cfg_look_startup_logo, NULL, NULL },
|
||||||
{ "look_startup_version", N_("display " WEECHAT_NAME " version at startup"),
|
{ "look_startup_version", N_("display WeeChat version at startup"),
|
||||||
N_("display " WEECHAT_NAME " version at startup"),
|
N_("display WeeChat version at startup"),
|
||||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
NULL, NULL, &cfg_look_startup_version, NULL, NULL },
|
NULL, NULL, &cfg_look_startup_version, NULL, NULL },
|
||||||
{ "look_weechat_slogan", N_(WEECHAT_NAME "slogan"),
|
{ "look_weechat_slogan", N_("WeeChat slogan"),
|
||||||
N_(WEECHAT_NAME "slogan (if empty, slogan is not used)"),
|
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
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, NULL },
|
||||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||||
@@ -141,6 +149,7 @@ int cfg_col_chat_nick;
|
|||||||
int cfg_col_chat_host;
|
int cfg_col_chat_host;
|
||||||
int cfg_col_chat_channel;
|
int cfg_col_chat_channel;
|
||||||
int cfg_col_chat_dark;
|
int cfg_col_chat_dark;
|
||||||
|
int cfg_col_chat_highlight;
|
||||||
int cfg_col_chat_bg;
|
int cfg_col_chat_bg;
|
||||||
int cfg_col_status;
|
int cfg_col_status;
|
||||||
int cfg_col_status_active;
|
int cfg_col_status_active;
|
||||||
@@ -209,6 +218,10 @@ t_config_option weechat_options_colors[] =
|
|||||||
N_("color for dark separators (chat window)"),
|
N_("color for dark separators (chat window)"),
|
||||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||||
"green", NULL, &cfg_col_chat_dark, NULL, NULL },
|
"green", NULL, &cfg_col_chat_dark, NULL, NULL },
|
||||||
|
{ "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 },
|
||||||
{ "col_chat_bg", N_("background for chat"),
|
{ "col_chat_bg", N_("background for chat"),
|
||||||
N_("background for chat window"),
|
N_("background for chat window"),
|
||||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||||
@@ -286,7 +299,7 @@ t_config_option weechat_options_colors[] =
|
|||||||
{ "col_nick_private", N_("color for other nick in private window"),
|
{ "col_nick_private", N_("color for other nick in private window"),
|
||||||
N_("color for other nick in private window"),
|
N_("color for other nick in private window"),
|
||||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||||
"brown", NULL, &cfg_col_nick_private, NULL, NULL },
|
"gray", NULL, &cfg_col_nick_private, NULL, NULL },
|
||||||
{ "col_nick_bg", N_("background for nicknames"),
|
{ "col_nick_bg", N_("background for nicknames"),
|
||||||
N_("background for nicknames"),
|
N_("background for nicknames"),
|
||||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||||
@@ -333,7 +346,7 @@ t_config_option weechat_options_log[] =
|
|||||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||||
{ "log_path", N_("path for log files"),
|
{ "log_path", N_("path for log files"),
|
||||||
N_("path for " WEECHAT_NAME " log files"),
|
N_("path for WeeChat log files"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, NULL },
|
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, NULL },
|
||||||
{ "log_name", N_("name for log files"),
|
{ "log_name", N_("name for log files"),
|
||||||
@@ -346,12 +359,12 @@ t_config_option weechat_options_log[] =
|
|||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"~", NULL, NULL, &cfg_log_timestamp, NULL },
|
"~", NULL, NULL, &cfg_log_timestamp, NULL },
|
||||||
{ "log_start_string", N_("start string for log files"),
|
{ "log_start_string", N_("start string for log files"),
|
||||||
N_("text writed when starting new log file "
|
N_("text written when starting new log file "
|
||||||
"(see man strftime for date/time specifiers)"),
|
"(see man strftime for date/time specifiers)"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"--- Log started %a %b %d %Y %H:%M:%s", NULL, NULL, &cfg_log_start_string, NULL },
|
"--- Log started %a %b %d %Y %H:%M:%s", NULL, NULL, &cfg_log_start_string, NULL },
|
||||||
{ "log_end_string", N_("end string for log files"),
|
{ "log_end_string", N_("end string for log files"),
|
||||||
N_("text writed when ending log file "
|
N_("text written when ending log file "
|
||||||
"(see man strftime for date/time specifiers)"),
|
"(see man strftime for date/time specifiers)"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"--- Log ended %a %b %d %Y %H:%M:%s", NULL, NULL, &cfg_log_end_string, NULL },
|
"--- Log ended %a %b %d %Y %H:%M:%s", NULL, NULL, &cfg_log_end_string, NULL },
|
||||||
@@ -399,7 +412,7 @@ t_config_option weechat_options_dcc[] =
|
|||||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
NULL, NULL, &cfg_dcc_auto_rename, NULL, NULL },
|
NULL, NULL, &cfg_dcc_auto_rename, NULL, NULL },
|
||||||
{ "dcc_auto_resume", N_("automatically resume aborted transfers"),
|
{ "dcc_auto_resume", N_("automatically resume aborted transfers"),
|
||||||
N_("automatically resume dcc trsnafer if connection with remote host is loosed"),
|
N_("automatically resume dcc transfer if connection with remote host is loosed"),
|
||||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
NULL, NULL, &cfg_dcc_auto_resume, NULL, NULL },
|
NULL, NULL, &cfg_dcc_auto_resume, NULL, NULL },
|
||||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||||
@@ -441,6 +454,10 @@ t_config_option weechat_options_server[] =
|
|||||||
N_("name associated to IRC server (for display only)"),
|
N_("name associated to IRC server (for display only)"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"", NULL, NULL, &(cfg_server.name), NULL },
|
"", NULL, NULL, &(cfg_server.name), NULL },
|
||||||
|
{ "server_autoconnect", N_("automatically connect to server"),
|
||||||
|
N_("automatically connect to server when WeeChat is starting"),
|
||||||
|
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||||
|
NULL, NULL, &(cfg_server.autoconnect), NULL, NULL },
|
||||||
{ "server_address", N_("server address or hostname"),
|
{ "server_address", N_("server address or hostname"),
|
||||||
N_("IP address or hostname of IRC server"),
|
N_("IP address or hostname of IRC server"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
@@ -473,6 +490,14 @@ t_config_option weechat_options_server[] =
|
|||||||
N_("real name to use on IRC server"),
|
N_("real name to use on IRC server"),
|
||||||
OPTION_TYPE_STRING, 0, 0, 0,
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
"", NULL, NULL, &(cfg_server.realname), NULL },
|
"", NULL, NULL, &(cfg_server.realname), NULL },
|
||||||
|
{ "server_command", N_("first command to run when connected to server"),
|
||||||
|
N_("first command to run when connected to server"),
|
||||||
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
|
"", NULL, NULL, &(cfg_server.command), NULL },
|
||||||
|
{ "server_autojoin", N_("list of channels to join when connected to server"),
|
||||||
|
N_("comma separated list of channels to join when connected to server"),
|
||||||
|
OPTION_TYPE_STRING, 0, 0, 0,
|
||||||
|
"", NULL, NULL, &(cfg_server.autojoin), NULL },
|
||||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -481,7 +506,7 @@ t_config_option weechat_options_server[] =
|
|||||||
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
||||||
{ weechat_options_look, weechat_options_colors, weechat_options_history,
|
{ weechat_options_look, weechat_options_colors, weechat_options_history,
|
||||||
weechat_options_log, weechat_options_dcc, weechat_options_proxy,
|
weechat_options_log, weechat_options_dcc, weechat_options_proxy,
|
||||||
weechat_options_server
|
NULL, weechat_options_server
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -507,21 +532,77 @@ get_pos_array_values (char **array, char *string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* config_init_server: init server struct
|
* config_option_set_value: set new value for an option
|
||||||
|
* return: 0 if success
|
||||||
|
* -1 if error (bad value)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
int
|
||||||
config_init_server ()
|
config_option_set_value (t_config_option *option, char *value)
|
||||||
{
|
{
|
||||||
cfg_server.name = NULL;
|
int int_value;
|
||||||
cfg_server.address = NULL;
|
|
||||||
cfg_server.port = -1;
|
switch (option->option_type)
|
||||||
cfg_server.password = NULL;
|
{
|
||||||
cfg_server.nick1 = NULL;
|
case OPTION_TYPE_BOOLEAN:
|
||||||
cfg_server.nick2 = NULL;
|
if (strcasecmp (value, "on") == 0)
|
||||||
cfg_server.nick3 = NULL;
|
*(option->ptr_int) = BOOL_TRUE;
|
||||||
cfg_server.username = NULL;
|
else if (strcasecmp (value, "off") == 0)
|
||||||
cfg_server.realname = NULL;
|
*(option->ptr_int) = BOOL_FALSE;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_INT:
|
||||||
|
int_value = atoi (value);
|
||||||
|
if ((int_value < option->min) || (int_value > option->max))
|
||||||
|
return -1;
|
||||||
|
*(option->ptr_int) = int_value;
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_INT_WITH_STRING:
|
||||||
|
int_value = get_pos_array_values (option->array_values, value);
|
||||||
|
if (int_value < 0)
|
||||||
|
return -1;
|
||||||
|
*(option->ptr_int) = int_value;
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_COLOR:
|
||||||
|
if (!gui_assign_color (option->ptr_int, value))
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_STRING:
|
||||||
|
if (*(option->ptr_string))
|
||||||
|
free (*(option->ptr_string));
|
||||||
|
*(option->ptr_string) = strdup (value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
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, assign value and exit */
|
||||||
|
if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0)
|
||||||
|
return config_option_set_value (&weechat_options[i][j], value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* option not found */
|
||||||
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -556,9 +637,10 @@ config_allocate_server (char *filename, int line_number)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!server_new (cfg_server.name,
|
if (!server_new (cfg_server.name,
|
||||||
cfg_server.address, cfg_server.port, cfg_server.password,
|
cfg_server.autoconnect, cfg_server.address, cfg_server.port,
|
||||||
cfg_server.nick1, cfg_server.nick2, cfg_server.nick3,
|
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
|
||||||
cfg_server.username, cfg_server.realname))
|
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||||
|
cfg_server.command, cfg_server.autojoin))
|
||||||
{
|
{
|
||||||
server_free_all ();
|
server_free_all ();
|
||||||
gui_printf (NULL,
|
gui_printf (NULL,
|
||||||
@@ -566,26 +648,9 @@ config_allocate_server (char *filename, int line_number)
|
|||||||
WEECHAT_WARNING, filename, line_number);
|
WEECHAT_WARNING, filename, line_number);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (cfg_server.name)
|
|
||||||
free (cfg_server.name);
|
|
||||||
if (cfg_server.address)
|
|
||||||
free (cfg_server.address);
|
|
||||||
if (cfg_server.password)
|
|
||||||
free (cfg_server.password);
|
|
||||||
if (cfg_server.nick1)
|
|
||||||
free (cfg_server.nick1);
|
|
||||||
if (cfg_server.nick2)
|
|
||||||
free (cfg_server.nick2);
|
|
||||||
if (cfg_server.nick3)
|
|
||||||
free (cfg_server.nick3);
|
|
||||||
if (cfg_server.username)
|
|
||||||
free (cfg_server.username);
|
|
||||||
if (cfg_server.realname)
|
|
||||||
free (cfg_server.realname);
|
|
||||||
if (cfg_server.nick)
|
|
||||||
free (cfg_server.nick);
|
|
||||||
|
|
||||||
config_init_server ();
|
server_destroy (&cfg_server);
|
||||||
|
server_init (&cfg_server);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -601,7 +666,7 @@ config_default_values ()
|
|||||||
|
|
||||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||||
{
|
{
|
||||||
if (i != CONFIG_SECTION_SERVER)
|
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||||
{
|
{
|
||||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||||
{
|
{
|
||||||
@@ -654,13 +719,13 @@ config_read ()
|
|||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int section, line_number, i, option_number, int_value;
|
int section, line_number, i, option_number;
|
||||||
int server_found;
|
int server_found;
|
||||||
char line[1024], *ptr_line, *pos, *pos2;
|
char line[1024], *ptr_line, *pos, *pos2;
|
||||||
|
|
||||||
filename =
|
filename =
|
||||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
|
||||||
sprintf (filename, "%s/.weechat/" WEECHAT_CONFIG_NAME, getenv ("HOME"));
|
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
|
||||||
if ((file = fopen (filename, "rt")) == NULL)
|
if ((file = fopen (filename, "rt")) == NULL)
|
||||||
{
|
{
|
||||||
gui_printf (NULL, _("%s config file \"%s\" not found.\n"),
|
gui_printf (NULL, _("%s config file \"%s\" not found.\n"),
|
||||||
@@ -670,7 +735,7 @@ config_read ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_default_values ();
|
config_default_values ();
|
||||||
config_init_server ();
|
server_init (&cfg_server);
|
||||||
|
|
||||||
/* read config file */
|
/* read config file */
|
||||||
section = CONFIG_SECTION_NONE;
|
section = CONFIG_SECTION_NONE;
|
||||||
@@ -694,58 +759,44 @@ config_read ()
|
|||||||
{
|
{
|
||||||
pos = strchr (line, ']');
|
pos = strchr (line, ']');
|
||||||
if (pos == NULL)
|
if (pos == NULL)
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
gui_printf (NULL,
|
||||||
_("%s %s, line %d: invalid syntax, missing \"]\"\n"),
|
_("%s %s, line %d: invalid syntax, missing \"]\"\n"),
|
||||||
WEECHAT_WARNING, filename, line_number);
|
WEECHAT_WARNING, filename, line_number);
|
||||||
fclose (file);
|
else
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
pos[0] = '\0';
|
|
||||||
pos = ptr_line + 1;
|
|
||||||
section = CONFIG_SECTION_NONE;
|
|
||||||
for (i = 0; config_sections[i].section_name; i++)
|
|
||||||
{
|
{
|
||||||
if (strcmp (config_sections[i].section_name, pos) == 0)
|
pos[0] = '\0';
|
||||||
|
pos = ptr_line + 1;
|
||||||
|
section = CONFIG_SECTION_NONE;
|
||||||
|
for (i = 0; config_sections[i].section_name; i++)
|
||||||
{
|
{
|
||||||
section = i;
|
if (strcmp (config_sections[i].section_name, pos) == 0)
|
||||||
break;
|
{
|
||||||
|
section = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (section == CONFIG_SECTION_NONE)
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s %s, line %d: unknown section identifier (\"%s\")\n"),
|
||||||
|
WEECHAT_WARNING, filename, line_number, pos);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (server_found)
|
||||||
|
{
|
||||||
|
/* if server already started => create it */
|
||||||
|
config_allocate_server (filename, line_number);
|
||||||
|
}
|
||||||
|
server_found = (section == CONFIG_SECTION_SERVER) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (section == CONFIG_SECTION_NONE)
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s %s, line %d: unknown section identifier (\"%s\")\n"),
|
|
||||||
WEECHAT_WARNING, filename, line_number, pos);
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (server_found)
|
|
||||||
{
|
|
||||||
/* if server already started => create it */
|
|
||||||
if (!config_allocate_server (filename, line_number))
|
|
||||||
{
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
server_found = (section == CONFIG_SECTION_SERVER) ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = strchr (line, '=');
|
pos = strchr (line, '=');
|
||||||
if (pos == NULL)
|
if (pos == NULL)
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
gui_printf (NULL,
|
||||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||||
WEECHAT_WARNING, filename, line_number);
|
WEECHAT_WARNING, filename, line_number);
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos[0] = '\0';
|
pos[0] = '\0';
|
||||||
@@ -756,128 +807,83 @@ config_read ()
|
|||||||
pos2 = strchr (pos, '\n');
|
pos2 = strchr (pos, '\n');
|
||||||
if (pos2 != NULL)
|
if (pos2 != NULL)
|
||||||
pos2[0] = '\0';
|
pos2[0] = '\0';
|
||||||
option_number = -1;
|
|
||||||
for (i = 0;
|
if (section == CONFIG_SECTION_ALIAS)
|
||||||
weechat_options[section][i].option_name; i++)
|
|
||||||
{
|
{
|
||||||
if (strcmp
|
if (alias_new (line, pos))
|
||||||
(weechat_options[section][i].option_name,
|
index_command_new (pos);
|
||||||
ptr_line) == 0)
|
|
||||||
{
|
|
||||||
option_number = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (option_number < 0)
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
|
||||||
WEECHAT_WARNING, filename, line_number, ptr_line);
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (weechat_options[section]
|
option_number = -1;
|
||||||
[option_number].option_type)
|
for (i = 0;
|
||||||
|
weechat_options[section][i].option_name; i++)
|
||||||
{
|
{
|
||||||
case OPTION_TYPE_BOOLEAN:
|
if (strcmp
|
||||||
if (strcasecmp (pos, "on") == 0)
|
(weechat_options[section][i].option_name,
|
||||||
*weechat_options[section]
|
ptr_line) == 0)
|
||||||
[option_number].ptr_int = BOOL_TRUE;
|
{
|
||||||
else if (strcasecmp (pos, "off") == 0)
|
option_number = i;
|
||||||
*weechat_options[section]
|
break;
|
||||||
[option_number].ptr_int = BOOL_FALSE;
|
}
|
||||||
else
|
}
|
||||||
|
if (option_number < 0)
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||||
|
WEECHAT_WARNING, filename, line_number, ptr_line);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (config_option_set_value (&weechat_options[section][option_number], pos) < 0)
|
||||||
|
{
|
||||||
|
switch (weechat_options[section]
|
||||||
|
[option_number].option_type)
|
||||||
{
|
{
|
||||||
gui_printf (NULL,
|
case OPTION_TYPE_BOOLEAN:
|
||||||
_("%s %s, line %d: invalid value for"
|
gui_printf (NULL,
|
||||||
"option '%s'\n"
|
_("%s %s, line %d: invalid value for"
|
||||||
"Expected: boolean value: "
|
"option '%s'\n"
|
||||||
"'off' or 'on'\n"),
|
"Expected: boolean value: "
|
||||||
WEECHAT_WARNING, filename,
|
"'off' or 'on'\n"),
|
||||||
line_number, ptr_line);
|
WEECHAT_WARNING, filename,
|
||||||
fclose (file);
|
line_number, ptr_line);
|
||||||
free (filename);
|
break;
|
||||||
return -2;
|
case OPTION_TYPE_INT:
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s %s, line %d: invalid value for "
|
||||||
|
"option '%s'\n"
|
||||||
|
"Expected: integer between %d "
|
||||||
|
"and %d\n"),
|
||||||
|
WEECHAT_WARNING, filename,
|
||||||
|
line_number, ptr_line,
|
||||||
|
weechat_options[section][option_number].min,
|
||||||
|
weechat_options[section][option_number].max);
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_INT_WITH_STRING:
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s %s, line %d: invalid value for "
|
||||||
|
"option '%s'\n"
|
||||||
|
"Expected: one of these strings: "),
|
||||||
|
WEECHAT_WARNING, filename,
|
||||||
|
line_number, ptr_line);
|
||||||
|
i = 0;
|
||||||
|
while (weechat_options[section][option_number].array_values[i])
|
||||||
|
{
|
||||||
|
gui_printf (NULL, "\"%s\" ",
|
||||||
|
weechat_options[section][option_number].array_values[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
gui_printf (NULL, "\n");
|
||||||
|
break;
|
||||||
|
case OPTION_TYPE_COLOR:
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s %s, line %d: invalid color "
|
||||||
|
"name for option '%s'\n"),
|
||||||
|
WEECHAT_WARNING, filename,
|
||||||
|
line_number,
|
||||||
|
ptr_line);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case OPTION_TYPE_INT:
|
|
||||||
int_value = atoi (pos);
|
|
||||||
if ((int_value <
|
|
||||||
weechat_options[section]
|
|
||||||
[option_number].min)
|
|
||||||
|| (int_value >
|
|
||||||
weechat_options[section]
|
|
||||||
[option_number].max))
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s %s, line %d: invalid value for"
|
|
||||||
"option '%s'\n"
|
|
||||||
"Expected: integer between %d "
|
|
||||||
"and %d\n"),
|
|
||||||
WEECHAT_WARNING, filename,
|
|
||||||
line_number, ptr_line,
|
|
||||||
weechat_options[section][option_number].min,
|
|
||||||
weechat_options[section][option_number].max);
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
*weechat_options[section][option_number].ptr_int =
|
|
||||||
int_value;
|
|
||||||
break;
|
|
||||||
case OPTION_TYPE_INT_WITH_STRING:
|
|
||||||
int_value = get_pos_array_values (
|
|
||||||
weechat_options[section][option_number].array_values,
|
|
||||||
pos);
|
|
||||||
if (int_value < 0)
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s %s, line %d: invalid value for"
|
|
||||||
"option '%s'\n"
|
|
||||||
"Expected: one of these strings: "),
|
|
||||||
WEECHAT_WARNING, filename,
|
|
||||||
line_number, ptr_line);
|
|
||||||
i = 0;
|
|
||||||
while (weechat_options[section][option_number].array_values[i])
|
|
||||||
{
|
|
||||||
gui_printf (NULL, "\"%s\" ",
|
|
||||||
weechat_options[section][option_number].array_values[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
gui_printf (NULL, "\n");
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
*weechat_options[section][option_number].ptr_int =
|
|
||||||
int_value;
|
|
||||||
break;
|
|
||||||
case OPTION_TYPE_COLOR:
|
|
||||||
if (!gui_assign_color (
|
|
||||||
weechat_options[section][option_number].ptr_int,
|
|
||||||
pos))
|
|
||||||
{
|
|
||||||
gui_printf (NULL,
|
|
||||||
_("%s %s, line %d: invalid color "
|
|
||||||
"name for option '%s'\n"),
|
|
||||||
WEECHAT_WARNING, filename,
|
|
||||||
line_number,
|
|
||||||
ptr_line);
|
|
||||||
fclose (file);
|
|
||||||
free (filename);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OPTION_TYPE_STRING:
|
|
||||||
if (*weechat_options[section]
|
|
||||||
[option_number].ptr_string)
|
|
||||||
free (*weechat_options[section][option_number].ptr_string);
|
|
||||||
*weechat_options[section][option_number].ptr_string =
|
|
||||||
strdup (pos);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -920,6 +926,8 @@ config_read ()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* config_create_default: create default WeeChat config
|
* config_create_default: create default WeeChat config
|
||||||
|
* return: 0 if ok
|
||||||
|
* < 0 if error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -932,28 +940,29 @@ config_create_default ()
|
|||||||
time_t current_time;
|
time_t current_time;
|
||||||
|
|
||||||
filename =
|
filename =
|
||||||
(char *) malloc ((strlen (getenv ("HOME")) + 64) * sizeof (char));
|
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
|
||||||
sprintf (filename, "%s/.weechat/" WEECHAT_CONFIG_NAME, getenv ("HOME"));
|
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
|
||||||
if ((file = fopen (filename, "wt")) == NULL)
|
if ((file = fopen (filename, "wt")) == NULL)
|
||||||
{
|
{
|
||||||
free (filename);
|
|
||||||
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||||
WEECHAT_ERROR, filename);
|
WEECHAT_ERROR, filename);
|
||||||
|
free (filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf (_(WEECHAT_NAME ": creating default config file...\n"));
|
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||||
|
wee_log_printf (_("creating default config file\n"));
|
||||||
|
|
||||||
current_time = time (NULL);
|
current_time = time (NULL);
|
||||||
sprintf (line, _("#\n# " WEECHAT_NAME " configuration file, generated by "
|
sprintf (line, _("#\n# %s configuration file, created by "
|
||||||
WEECHAT_NAME " " WEECHAT_VERSION " on %s"), ctime (¤t_time));
|
"%s v%s on %s#\n"),
|
||||||
|
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||||
|
ctime (¤t_time));
|
||||||
fputs (line, file);
|
fputs (line, file);
|
||||||
fputs (_("# This file may be edited by user. Invalid syntax will prevent "
|
|
||||||
WEECHAT_NAME " from running!\n#\n"), file);
|
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||||
{
|
{
|
||||||
if (i != CONFIG_SECTION_SERVER)
|
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||||
{
|
{
|
||||||
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
|
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
|
||||||
fputs (line, file);
|
fputs (line, file);
|
||||||
@@ -969,33 +978,62 @@ config_create_default ()
|
|||||||
{
|
{
|
||||||
switch (weechat_options[i][j].option_type)
|
switch (weechat_options[i][j].option_type)
|
||||||
{
|
{
|
||||||
case OPTION_TYPE_BOOLEAN:
|
case OPTION_TYPE_BOOLEAN:
|
||||||
sprintf (line, "%s=%s\n",
|
sprintf (line, "%s=%s\n",
|
||||||
weechat_options[i][j].option_name,
|
weechat_options[i][j].option_name,
|
||||||
(weechat_options[i][j].
|
(weechat_options[i][j].default_int) ?
|
||||||
default_int) ? "on" : "off");
|
"on" : "off");
|
||||||
break;
|
break;
|
||||||
case OPTION_TYPE_INT:
|
case OPTION_TYPE_INT:
|
||||||
sprintf (line, "%s=%d\n",
|
sprintf (line, "%s=%d\n",
|
||||||
weechat_options[i][j].option_name,
|
weechat_options[i][j].option_name,
|
||||||
weechat_options[i][j].default_int);
|
weechat_options[i][j].default_int);
|
||||||
break;
|
break;
|
||||||
case OPTION_TYPE_INT_WITH_STRING:
|
case OPTION_TYPE_INT_WITH_STRING:
|
||||||
case OPTION_TYPE_COLOR:
|
case OPTION_TYPE_COLOR:
|
||||||
case OPTION_TYPE_STRING:
|
case OPTION_TYPE_STRING:
|
||||||
sprintf (line, "%s=%s\n",
|
sprintf (line, "%s=%s\n",
|
||||||
weechat_options[i][j].option_name,
|
weechat_options[i][j].option_name,
|
||||||
weechat_options[i][j].default_string);
|
weechat_options[i][j].default_string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fputs (line, file);
|
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);
|
||||||
|
|
||||||
/* default server is freenode */
|
/* default server is freenode */
|
||||||
fputs ("\n[server]\n", file);
|
fputs ("\n[server]\n", file);
|
||||||
fputs ("server_name=freenode\n", file);
|
fputs ("server_name=freenode\n", file);
|
||||||
|
fputs ("server_autoconnect=on\n", file);
|
||||||
fputs ("server_address=irc.freenode.net\n", file);
|
fputs ("server_address=irc.freenode.net\n", file);
|
||||||
fputs ("server_port=6667\n", file);
|
fputs ("server_port=6667\n", file);
|
||||||
fputs ("server_password=\n", file);
|
fputs ("server_password=\n", file);
|
||||||
@@ -1004,6 +1042,8 @@ config_create_default ()
|
|||||||
fputs ("server_nick3=weechat3\n", file);
|
fputs ("server_nick3=weechat3\n", file);
|
||||||
fputs ("server_username=weechat\n", file);
|
fputs ("server_username=weechat\n", file);
|
||||||
fputs ("server_realname=WeeChat default realname\n", file);
|
fputs ("server_realname=WeeChat default realname\n", file);
|
||||||
|
fputs ("server_command=\n", file);
|
||||||
|
fputs ("server_autojoin=\n", file);
|
||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
free (filename);
|
free (filename);
|
||||||
@@ -1012,10 +1052,153 @@ config_create_default ()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* config_write: write WeeChat configurtion
|
* config_write: write WeeChat configurtion
|
||||||
|
* return: 0 if ok
|
||||||
|
* < 0 if error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
int
|
||||||
config_write ()
|
config_write (char *config_name)
|
||||||
{
|
{
|
||||||
/* TODO: write "config_write" function! */
|
char *filename;
|
||||||
|
char line[1024];
|
||||||
|
FILE *file;
|
||||||
|
int i, j;
|
||||||
|
time_t current_time;
|
||||||
|
t_irc_server *ptr_server;
|
||||||
|
t_weechat_alias *ptr_alias;
|
||||||
|
|
||||||
|
if (config_name)
|
||||||
|
filename = strdup (config_name);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filename =
|
||||||
|
(char *) malloc ((strlen (weechat_home) + 64) * sizeof (char));
|
||||||
|
sprintf (filename, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((file = fopen (filename, "wt")) == NULL)
|
||||||
|
{
|
||||||
|
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||||
|
WEECHAT_ERROR, filename);
|
||||||
|
free (filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
wee_log_printf (_("saving config to disk\n"));
|
||||||
|
|
||||||
|
current_time = time (NULL);
|
||||||
|
sprintf (line, _("#\n# %s configuration file, created by "
|
||||||
|
"%s v%s on %s#\n"),
|
||||||
|
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||||
|
ctime (¤t_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);
|
||||||
|
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
|
||||||
|
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
|
||||||
|
{
|
||||||
|
sprintf (line,
|
||||||
|
"# 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",
|
||||||
|
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",
|
||||||
|
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",
|
||||||
|
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",
|
||||||
|
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",
|
||||||
|
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);
|
||||||
|
for (ptr_alias = weechat_alias; ptr_alias;
|
||||||
|
ptr_alias = ptr_alias->next_alias)
|
||||||
|
{
|
||||||
|
sprintf (line, "%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);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (file);
|
||||||
|
free (filename);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -32,8 +30,9 @@
|
|||||||
#define CONFIG_SECTION_LOG 3
|
#define CONFIG_SECTION_LOG 3
|
||||||
#define CONFIG_SECTION_DCC 4
|
#define CONFIG_SECTION_DCC 4
|
||||||
#define CONFIG_SECTION_PROXY 5
|
#define CONFIG_SECTION_PROXY 5
|
||||||
#define CONFIG_SECTION_SERVER 6
|
#define CONFIG_SECTION_ALIAS 6
|
||||||
#define CONFIG_NUMBER_SECTIONS 7
|
#define CONFIG_SECTION_SERVER 7
|
||||||
|
#define CONFIG_NUMBER_SECTIONS 8
|
||||||
|
|
||||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||||
@@ -74,6 +73,7 @@ struct t_config_option
|
|||||||
int (*handler_change)(int *, char **);
|
int (*handler_change)(int *, char **);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern int cfg_look_set_title;
|
||||||
extern int cfg_look_startup_logo;
|
extern int cfg_look_startup_logo;
|
||||||
extern int cfg_look_startup_version;
|
extern int cfg_look_startup_version;
|
||||||
extern char *cfg_look_weechat_slogan;
|
extern char *cfg_look_weechat_slogan;
|
||||||
@@ -100,6 +100,7 @@ extern int cfg_col_chat_nick;
|
|||||||
extern int cfg_col_chat_host;
|
extern int cfg_col_chat_host;
|
||||||
extern int cfg_col_chat_channel;
|
extern int cfg_col_chat_channel;
|
||||||
extern int cfg_col_chat_dark;
|
extern int cfg_col_chat_dark;
|
||||||
|
extern int cfg_col_chat_highlight;
|
||||||
extern int cfg_col_chat_bg;
|
extern int cfg_col_chat_bg;
|
||||||
extern int cfg_col_status;
|
extern int cfg_col_status;
|
||||||
extern int cfg_col_status_active;
|
extern int cfg_col_status_active;
|
||||||
@@ -150,6 +151,6 @@ extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
|||||||
|
|
||||||
extern int config_read ();
|
extern int config_read ();
|
||||||
extern int config_create_default ();
|
extern int config_create_default ();
|
||||||
extern void config_write ();
|
extern int config_write ();
|
||||||
|
|
||||||
#endif /* config.h */
|
#endif /* weeconfig.h */
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
# WeeChat with Curses interface
|
|
||||||
ifeq ($(GUI), curses)
|
|
||||||
curses: curses/gui.a
|
|
||||||
curses/gui.a:
|
|
||||||
cd curses && make
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Gtk+ interface
|
|
||||||
ifeq ($(GUI), gtk)
|
|
||||||
gtk: gtk/gui.a
|
|
||||||
gtk/gui.a:
|
|
||||||
cd gtk && make
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Qt interface
|
|
||||||
ifeq ($(GUI), qt)
|
|
||||||
qt: qt/gui.a
|
|
||||||
qt/gui.a:
|
|
||||||
cd qt && make
|
|
||||||
endif
|
|
||||||
|
|
||||||
# WeeChat with Text interface
|
|
||||||
ifeq ($(GUI), text)
|
|
||||||
text: text/gui.a
|
|
||||||
text/gui.a:
|
|
||||||
cd text && make
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
all:
|
|
||||||
make curses GUI=curses
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.a *~ core
|
|
||||||
cd curses && make clean
|
|
||||||
cd gtk && make clean
|
|
||||||
cd qt && make clean
|
|
||||||
cd text && make clean
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,17 +15,16 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
OUTPUT=weechat
|
if GUI_CURSES
|
||||||
|
curses_dir=curses
|
||||||
|
endif
|
||||||
|
|
||||||
all:
|
if GUI_GTK
|
||||||
cd src && make
|
gtk_dir=gtk
|
||||||
|
endif
|
||||||
|
|
||||||
install:
|
if GUI_QT
|
||||||
@mkdir -v -p $(DESTDIR)/usr/$(LOCALRPM)/bin
|
qt_dir=qt
|
||||||
@cp -v src/$(OUTPUT) $(DESTDIR)/usr/$(LOCALRPM)/bin/
|
endif
|
||||||
@mkdir -v -p $(DESTDIR)/usr/share/man/man1
|
|
||||||
@cp -v weechat.1 $(DESTDIR)/usr/share/man/man1/
|
|
||||||
@echo -e "\n=== WeeChat installed!\n"
|
|
||||||
|
|
||||||
clean:
|
SUBDIRS = $(curses_dir) $(gtk_dir) $(qt_dir)
|
||||||
cd src && make clean
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
|
|
||||||
OPTIONS=-Wall -W -pipe -O2
|
|
||||||
|
|
||||||
OUTPUT=../gui.a
|
|
||||||
OBJS=gui-display.o gui-input.o
|
|
||||||
DEFINES=WEE_CURSES
|
|
||||||
|
|
||||||
all: $(OBJS)
|
|
||||||
ar r $(OUTPUT) $(OBJS)
|
|
||||||
|
|
||||||
$(OBJS):
|
|
||||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.a *~ core
|
|
||||||
|
|
||||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../completion.h \
|
|
||||||
../../history.h ../../config.h ../../irc/irc.h ../../gui/gui.h
|
|
||||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h ../../completion.h \
|
|
||||||
../../history.h ../../command.h ../../irc/irc.h ../../gui/gui.h
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
bin_PROGRAMS = weechat-curses
|
||||||
|
|
||||||
|
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||||
|
../../irc/lib_weechat_irc.a \
|
||||||
|
$(CURSES_LIBS) \
|
||||||
|
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||||
|
|
||||||
|
weechat_curses_SOURCES = ../gui.h \
|
||||||
|
../gui-common.c \
|
||||||
|
gui-display.c \
|
||||||
|
gui-input.c
|
||||||
+123
-288
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,31 +17,27 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* gui-display.c: display functions for Curses GUI */
|
/* gui-display.c: display functions for Curses GUI */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
|
|
||||||
#include "../../weechat.h"
|
#include "../../common/weechat.h"
|
||||||
#include "../gui.h"
|
#include "../gui.h"
|
||||||
#include "../../config.h"
|
#include "../../common/weeconfig.h"
|
||||||
#include "../../irc/irc.h"
|
#include "../../irc/irc.h"
|
||||||
|
|
||||||
|
|
||||||
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_color gui_colors[] =
|
t_gui_color gui_colors[] =
|
||||||
{ { "default", -1 | A_NORMAL },
|
{ { "default", -1 | A_NORMAL },
|
||||||
{ "black", COLOR_BLACK | A_NORMAL },
|
{ "black", COLOR_BLACK | A_NORMAL },
|
||||||
@@ -158,6 +152,17 @@ gui_window_set_color (WINDOW *window, int num_color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_has_nicklist: returns 1 if window has nicklist
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_window_has_nicklist (t_gui_window *window)
|
||||||
|
{
|
||||||
|
return (window->win_nick != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_calculate_pos_size: calculate position and size for a window & sub-win
|
* gui_calculate_pos_size: calculate position and size for a window & sub-win
|
||||||
*/
|
*/
|
||||||
@@ -298,7 +303,7 @@ gui_draw_window_title (t_gui_window *window)
|
|||||||
{
|
{
|
||||||
/* TODO: change this copyright as title? */
|
/* TODO: change this copyright as title? */
|
||||||
mvwprintw (window->win_title, 0, 0,
|
mvwprintw (window->win_title, 0, 0,
|
||||||
"%s", WEECHAT_NAME_AND_VERSION " - " WEECHAT_WEBSITE);
|
"%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
|
||||||
mvwprintw (window->win_title, 0, COLS - strlen (WEECHAT_COPYRIGHT),
|
mvwprintw (window->win_title, 0, COLS - strlen (WEECHAT_COPYRIGHT),
|
||||||
"%s", WEECHAT_COPYRIGHT);
|
"%s", WEECHAT_COPYRIGHT);
|
||||||
}
|
}
|
||||||
@@ -411,11 +416,13 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
|||||||
if (!ptr_message ||
|
if (!ptr_message ||
|
||||||
(window->win_chat_cursor_x > (window->win_chat_width - 1)))
|
(window->win_chat_cursor_x > (window->win_chat_width - 1)))
|
||||||
{
|
{
|
||||||
window->win_chat_cursor_x = 0;
|
|
||||||
if (lines_displayed >= num_lines - count)
|
if (lines_displayed >= num_lines - count)
|
||||||
{
|
{
|
||||||
|
if (window->win_chat_cursor_x <= window->win_chat_width - 1)
|
||||||
|
wclrtoeol (window->win_chat);
|
||||||
window->win_chat_cursor_y++;
|
window->win_chat_cursor_y++;
|
||||||
}
|
}
|
||||||
|
window->win_chat_cursor_x = 0;
|
||||||
lines_displayed++;
|
lines_displayed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,7 +510,11 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
|
|||||||
if (!ptr_message ||
|
if (!ptr_message ||
|
||||||
((window->win_chat_cursor_y <= window->win_chat_height - 1) &&
|
((window->win_chat_cursor_y <= window->win_chat_height - 1) &&
|
||||||
(window->win_chat_cursor_x > window->win_chat_width - 1)))
|
(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);
|
||||||
window->win_chat_cursor_y++;
|
window->win_chat_cursor_y++;
|
||||||
|
}
|
||||||
window->win_chat_cursor_x = 0;
|
window->win_chat_cursor_x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -611,7 +622,8 @@ gui_draw_window_nick (t_gui_window *window)
|
|||||||
if (CHANNEL(window) && CHANNEL(window)->nicks)
|
if (CHANNEL(window) && CHANNEL(window)->nicks)
|
||||||
{
|
{
|
||||||
max_length = nick_get_max_length (CHANNEL(window));
|
max_length = nick_get_max_length (CHANNEL(window));
|
||||||
if ((max_length + 2) != window->win_nick_width)
|
if ((window == gui_current_window) &&
|
||||||
|
((max_length + 2) != window->win_nick_width))
|
||||||
{
|
{
|
||||||
gui_calculate_pos_size (window);
|
gui_calculate_pos_size (window);
|
||||||
delwin (window->win_chat);
|
delwin (window->win_chat);
|
||||||
@@ -624,8 +636,7 @@ gui_draw_window_nick (t_gui_window *window)
|
|||||||
window->win_nick_width,
|
window->win_nick_width,
|
||||||
window->win_nick_y,
|
window->win_nick_y,
|
||||||
window->win_nick_x);
|
window->win_nick_x);
|
||||||
//scrollok (window->win_chat, TRUE);
|
gui_draw_window_chat (window);
|
||||||
gui_redraw_window_chat (window);
|
|
||||||
}
|
}
|
||||||
sprintf (format, "%%-%ds", max_length);
|
sprintf (format, "%%-%ds", max_length);
|
||||||
|
|
||||||
@@ -752,6 +763,7 @@ void
|
|||||||
gui_draw_window_status (t_gui_window *window)
|
gui_draw_window_status (t_gui_window *window)
|
||||||
{
|
{
|
||||||
t_gui_window *ptr_win;
|
t_gui_window *ptr_win;
|
||||||
|
char format_more[32];
|
||||||
|
|
||||||
/* TODO: manage splitted windows! */
|
/* TODO: manage splitted windows! */
|
||||||
if (window != gui_current_window)
|
if (window != gui_current_window)
|
||||||
@@ -853,9 +865,12 @@ 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);
|
gui_window_set_color (window->win_status, COLOR_WIN_STATUS_MORE);
|
||||||
if (window->sub_lines > 0)
|
if (window->sub_lines > 0)
|
||||||
mvwprintw (window->win_status, 0, COLS - 7, "-MORE-");
|
mvwprintw (window->win_status, 0, COLS - 7, _("-MORE-"));
|
||||||
else
|
else
|
||||||
mvwprintw (window->win_status, 0, COLS - 7, " ");
|
{
|
||||||
|
sprintf (format_more, "%%-%ds", strlen (_("-MORE-")));
|
||||||
|
mvwprintw (window->win_status, 0, COLS - 7, format_more, " ");
|
||||||
|
}
|
||||||
|
|
||||||
wrefresh (window->win_status);
|
wrefresh (window->win_status);
|
||||||
refresh ();
|
refresh ();
|
||||||
@@ -958,17 +973,34 @@ gui_draw_window_input (t_gui_window *window)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf (format, "%%s> %%-%ds", input_width);
|
if (SERVER(window))
|
||||||
if (SERVER(window) && (SERVER(window)->is_connected))
|
{
|
||||||
ptr_nickname = SERVER(window)->nick;
|
sprintf (format, "%%s> %%-%ds", input_width);
|
||||||
|
if (SERVER(window) && (SERVER(window)->is_connected))
|
||||||
|
ptr_nickname = SERVER(window)->nick;
|
||||||
|
else
|
||||||
|
ptr_nickname = cfg_look_no_nickname;
|
||||||
|
mvwprintw (window->win_input, 0, 0, format,
|
||||||
|
ptr_nickname,
|
||||||
|
window->input_buffer + window->input_buffer_1st_display);
|
||||||
|
wclrtoeol (window->win_input);
|
||||||
|
move (LINES - 1, strlen (ptr_nickname) + 2 +
|
||||||
|
(window->input_buffer_pos - window->input_buffer_1st_display));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ptr_nickname = cfg_look_no_nickname;
|
{
|
||||||
mvwprintw (window->win_input, 0, 0, format,
|
sprintf (format, "%%s> %%-%ds", input_width);
|
||||||
ptr_nickname,
|
if (SERVER(window) && (SERVER(window)->is_connected))
|
||||||
window->input_buffer + window->input_buffer_1st_display);
|
ptr_nickname = SERVER(window)->nick;
|
||||||
wclrtoeol (window->win_input);
|
else
|
||||||
move (LINES - 1, strlen (ptr_nickname) + 2 +
|
ptr_nickname = cfg_look_no_nickname;
|
||||||
(window->input_buffer_pos - window->input_buffer_1st_display));
|
mvwprintw (window->win_input, 0, 0, format,
|
||||||
|
ptr_nickname,
|
||||||
|
window->input_buffer + window->input_buffer_1st_display);
|
||||||
|
wclrtoeol (window->win_input);
|
||||||
|
move (LINES - 1, strlen (ptr_nickname) + 2 +
|
||||||
|
(window->input_buffer_pos - window->input_buffer_1st_display));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wrefresh (window->win_input);
|
wrefresh (window->win_input);
|
||||||
@@ -1009,55 +1041,6 @@ gui_redraw_window (t_gui_window *window)
|
|||||||
gui_redraw_window_input (window);
|
gui_redraw_window_input (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_window_clear: clear window content
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_window_clear (t_gui_window *window)
|
|
||||||
{
|
|
||||||
t_gui_line *ptr_line;
|
|
||||||
t_gui_message *ptr_message;
|
|
||||||
|
|
||||||
while (window->lines)
|
|
||||||
{
|
|
||||||
ptr_line = window->lines->next_line;
|
|
||||||
while (window->lines->messages)
|
|
||||||
{
|
|
||||||
ptr_message = window->lines->messages->next_message;
|
|
||||||
if (window->lines->messages->message)
|
|
||||||
free (window->lines->messages->message);
|
|
||||||
free (window->lines->messages);
|
|
||||||
window->lines->messages = ptr_message;
|
|
||||||
}
|
|
||||||
free (window->lines);
|
|
||||||
window->lines = ptr_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
window->lines = NULL;
|
|
||||||
window->last_line = NULL;
|
|
||||||
window->first_line_displayed = 1;
|
|
||||||
window->sub_lines = 0;
|
|
||||||
window->line_complete = 1;
|
|
||||||
window->unread_data = 0;
|
|
||||||
|
|
||||||
if (window == gui_current_window)
|
|
||||||
gui_redraw_window_chat (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_window_clear_all: clear all windows content
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_window_clear_all ()
|
|
||||||
{
|
|
||||||
t_gui_window *ptr_win;
|
|
||||||
|
|
||||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
|
||||||
gui_window_clear (ptr_win);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_switch_to_window: switch to another window
|
* gui_switch_to_window: switch to another window
|
||||||
*/
|
*/
|
||||||
@@ -1071,7 +1054,7 @@ gui_switch_to_window (t_gui_window *window)
|
|||||||
another_window = 0;
|
another_window = 0;
|
||||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||||
{
|
{
|
||||||
if (ptr_win->win_title)
|
if (ptr_win->is_displayed)
|
||||||
{
|
{
|
||||||
/* TODO: manage splitted windows */
|
/* TODO: manage splitted windows */
|
||||||
another_window = 1;
|
another_window = 1;
|
||||||
@@ -1085,21 +1068,22 @@ gui_switch_to_window (t_gui_window *window)
|
|||||||
ptr_win->win_nick = NULL;
|
ptr_win->win_nick = NULL;
|
||||||
ptr_win->win_status = NULL;
|
ptr_win->win_status = NULL;
|
||||||
ptr_win->win_input = NULL;
|
ptr_win->win_input = NULL;
|
||||||
|
ptr_win->is_displayed = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_calculate_pos_size (window);
|
||||||
|
|
||||||
/* first time creation for windows */
|
/* first time creation for windows */
|
||||||
if (!another_window)
|
if (!another_window)
|
||||||
{
|
{
|
||||||
/* create new windows */
|
/* create new windows */
|
||||||
gui_calculate_pos_size (window);
|
|
||||||
window->win_title = newwin (1, COLS, 0, 0);
|
window->win_title = newwin (1, COLS, 0, 0);
|
||||||
window->win_chat = newwin (window->win_chat_height,
|
window->win_chat = newwin (window->win_chat_height,
|
||||||
window->win_chat_width,
|
window->win_chat_width,
|
||||||
window->win_chat_y,
|
window->win_chat_y,
|
||||||
window->win_chat_x);
|
window->win_chat_x);
|
||||||
//scrollok (window->win_chat, TRUE);
|
|
||||||
if (CHANNEL(window))
|
if (CHANNEL(window))
|
||||||
window->win_nick = newwin (window->win_nick_height,
|
window->win_nick = newwin (window->win_nick_height,
|
||||||
window->win_nick_width,
|
window->win_nick_width,
|
||||||
@@ -1112,40 +1096,40 @@ gui_switch_to_window (t_gui_window *window)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gui_calculate_pos_size (window);
|
|
||||||
|
|
||||||
/* create chat & nick windows */
|
/* create chat & nick windows */
|
||||||
if (WIN_IS_CHANNEL(window) && !(window->win_nick))
|
if (WIN_IS_CHANNEL(window))
|
||||||
{
|
{
|
||||||
/* add nick list window */
|
/* (re)create nicklist window */
|
||||||
|
if (window->win_nick)
|
||||||
|
delwin (window->win_nick);
|
||||||
delwin (window->win_chat);
|
delwin (window->win_chat);
|
||||||
window->win_chat = newwin (window->win_chat_height,
|
window->win_chat = newwin (window->win_chat_height,
|
||||||
window->win_chat_width,
|
window->win_chat_width,
|
||||||
window->win_chat_y,
|
window->win_chat_y,
|
||||||
window->win_chat_x);
|
window->win_chat_x);
|
||||||
//scrollok (window->win_chat, TRUE);
|
|
||||||
window->win_nick = newwin (window->win_nick_height,
|
window->win_nick = newwin (window->win_nick_height,
|
||||||
window->win_nick_width,
|
window->win_nick_width,
|
||||||
window->win_nick_y,
|
window->win_nick_y,
|
||||||
window->win_nick_x);
|
window->win_nick_x);
|
||||||
}
|
}
|
||||||
if (!(WIN_IS_CHANNEL(window)) && window->win_nick)
|
if (!(WIN_IS_CHANNEL(window)))
|
||||||
{
|
{
|
||||||
/* remove nick list window */
|
/* remove nick list window */
|
||||||
delwin (window->win_nick);
|
if (window->win_nick)
|
||||||
|
delwin (window->win_nick);
|
||||||
window->win_nick = NULL;
|
window->win_nick = NULL;
|
||||||
delwin (window->win_chat);
|
delwin (window->win_chat);
|
||||||
window->win_chat = newwin (window->win_chat_height,
|
window->win_chat = newwin (window->win_chat_height,
|
||||||
window->win_chat_width,
|
window->win_chat_width,
|
||||||
window->win_chat_y,
|
window->win_chat_y,
|
||||||
window->win_chat_x);
|
window->win_chat_x);
|
||||||
//scrollok (window->win_chat, TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* change current window to the new window */
|
/* change current window to the new window */
|
||||||
gui_current_window = window;
|
gui_current_window = window;
|
||||||
|
|
||||||
|
window->is_displayed = 1;
|
||||||
window->unread_data = 0;
|
window->unread_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,133 +1204,11 @@ gui_move_page_down ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_window_new: create a new window
|
* gui_curses_resize_handler: called when term size is modified
|
||||||
* (TODO: add coordinates and size, for splited windows)
|
|
||||||
*/
|
|
||||||
|
|
||||||
t_gui_window *
|
|
||||||
gui_window_new (void *server, void *channel
|
|
||||||
/*int x, int y, int width, int height*/)
|
|
||||||
{
|
|
||||||
t_gui_window *new_window;
|
|
||||||
|
|
||||||
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
|
||||||
{
|
|
||||||
/* assign server and channel to window */
|
|
||||||
SERVER(new_window) = server;
|
|
||||||
CHANNEL(new_window) = channel;
|
|
||||||
/* assign window to server and channel */
|
|
||||||
if (server && !channel)
|
|
||||||
SERVER(new_window)->window = new_window;
|
|
||||||
if (channel)
|
|
||||||
CHANNEL(new_window)->window = new_window;
|
|
||||||
|
|
||||||
gui_calculate_pos_size (new_window);
|
|
||||||
|
|
||||||
/* init windows */
|
|
||||||
new_window->win_title = NULL;
|
|
||||||
new_window->win_chat = NULL;
|
|
||||||
new_window->win_nick = NULL;
|
|
||||||
new_window->win_status = NULL;
|
|
||||||
new_window->win_input = NULL;
|
|
||||||
|
|
||||||
/* init lines */
|
|
||||||
new_window->lines = NULL;
|
|
||||||
new_window->last_line = NULL;
|
|
||||||
new_window->first_line_displayed = 1;
|
|
||||||
new_window->sub_lines = 0;
|
|
||||||
new_window->line_complete = 1;
|
|
||||||
new_window->unread_data = 0;
|
|
||||||
|
|
||||||
/* init input buffer */
|
|
||||||
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
|
||||||
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
|
||||||
new_window->input_buffer[0] = '\0';
|
|
||||||
new_window->input_buffer_size = 0;
|
|
||||||
new_window->input_buffer_pos = 0;
|
|
||||||
new_window->input_buffer_1st_display = 0;
|
|
||||||
|
|
||||||
/* init completion */
|
|
||||||
completion_init (&(new_window->completion));
|
|
||||||
|
|
||||||
/* init history */
|
|
||||||
new_window->history = NULL;
|
|
||||||
new_window->ptr_history = NULL;
|
|
||||||
|
|
||||||
/* switch to new window */
|
|
||||||
gui_switch_to_window (new_window);
|
|
||||||
|
|
||||||
/* add window to windows queue */
|
|
||||||
new_window->prev_window = last_gui_window;
|
|
||||||
if (gui_windows)
|
|
||||||
last_gui_window->next_window = new_window;
|
|
||||||
else
|
|
||||||
gui_windows = new_window;
|
|
||||||
last_gui_window = new_window;
|
|
||||||
new_window->next_window = NULL;
|
|
||||||
|
|
||||||
/* redraw whole screen */
|
|
||||||
gui_redraw_window (new_window);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
return new_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_window_free: delete a window
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
gui_window_free (t_gui_window *window)
|
gui_curses_resize_handler ()
|
||||||
{
|
|
||||||
t_gui_line *ptr_line;
|
|
||||||
t_gui_message *ptr_message;
|
|
||||||
|
|
||||||
/* TODO: manage splitted windows! */
|
|
||||||
if (window == gui_current_window)
|
|
||||||
gui_switch_to_previous_window ();
|
|
||||||
|
|
||||||
/* free lines and messages */
|
|
||||||
while (window->lines)
|
|
||||||
{
|
|
||||||
ptr_line = window->lines->next_line;
|
|
||||||
while (window->lines->messages)
|
|
||||||
{
|
|
||||||
ptr_message = window->lines->messages->next_message;
|
|
||||||
if (window->lines->messages->message)
|
|
||||||
free (window->lines->messages->message);
|
|
||||||
free (window->lines->messages);
|
|
||||||
window->lines->messages = ptr_message;
|
|
||||||
}
|
|
||||||
free (window->lines);
|
|
||||||
window->lines = ptr_line;
|
|
||||||
}
|
|
||||||
if (window->input_buffer)
|
|
||||||
free (window->input_buffer);
|
|
||||||
|
|
||||||
/* TODO: free completion struct */
|
|
||||||
/* there... */
|
|
||||||
|
|
||||||
/* remove window from windows list */
|
|
||||||
if (window->prev_window)
|
|
||||||
window->prev_window->next_window = window->next_window;
|
|
||||||
if (window->next_window)
|
|
||||||
window->next_window->prev_window = window->prev_window;
|
|
||||||
if (gui_windows == window)
|
|
||||||
gui_windows = window->next_window;
|
|
||||||
if (last_gui_window == window)
|
|
||||||
last_gui_window = window->prev_window;
|
|
||||||
|
|
||||||
free (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_resize_term_handler: called when term size is modified
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_resize_term_handler ()
|
|
||||||
{
|
{
|
||||||
t_gui_window *ptr_win;
|
t_gui_window *ptr_win;
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -1358,10 +1220,10 @@ gui_resize_term_handler ()
|
|||||||
|
|
||||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||||
{
|
{
|
||||||
gui_calculate_pos_size (ptr_win);
|
|
||||||
// TODO: manage splitted windows!
|
// TODO: manage splitted windows!
|
||||||
if (ptr_win->win_title)
|
if (ptr_win->win_title)
|
||||||
{
|
{
|
||||||
|
ptr_win->is_displayed = 0;
|
||||||
if (ptr_win->win_title)
|
if (ptr_win->win_title)
|
||||||
delwin (ptr_win->win_title);
|
delwin (ptr_win->win_title);
|
||||||
if (ptr_win->win_chat)
|
if (ptr_win->win_chat)
|
||||||
@@ -1382,6 +1244,32 @@ gui_resize_term_handler ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_init_subwindows: init subwindows for a WeeChat window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_window_init_subwindows (t_gui_window *window)
|
||||||
|
{
|
||||||
|
window->win_title = NULL;
|
||||||
|
window->win_chat = NULL;
|
||||||
|
window->win_nick = NULL;
|
||||||
|
window->win_status = NULL;
|
||||||
|
window->win_input = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_pre_init (int *argc, char **argv[])
|
||||||
|
{
|
||||||
|
/* nothing for Curses interface */
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_init_colors: init GUI colors
|
* gui_init_colors: init GUI colors
|
||||||
*/
|
*/
|
||||||
@@ -1416,6 +1304,8 @@ gui_init_colors ()
|
|||||||
cfg_col_chat_channel & A_CHARTEXT, cfg_col_chat_bg);
|
cfg_col_chat_channel & A_CHARTEXT, cfg_col_chat_bg);
|
||||||
init_pair (COLOR_WIN_CHAT_DARK,
|
init_pair (COLOR_WIN_CHAT_DARK,
|
||||||
cfg_col_chat_dark & A_CHARTEXT, cfg_col_chat_bg);
|
cfg_col_chat_dark & A_CHARTEXT, cfg_col_chat_bg);
|
||||||
|
init_pair (COLOR_WIN_CHAT_HIGHLIGHT,
|
||||||
|
cfg_col_chat_highlight & A_CHARTEXT, cfg_col_chat_bg);
|
||||||
init_pair (COLOR_WIN_STATUS,
|
init_pair (COLOR_WIN_STATUS,
|
||||||
cfg_col_status & A_CHARTEXT, cfg_col_status_bg);
|
cfg_col_status & A_CHARTEXT, cfg_col_status_bg);
|
||||||
init_pair (COLOR_WIN_STATUS_ACTIVE,
|
init_pair (COLOR_WIN_STATUS_ACTIVE,
|
||||||
@@ -1466,6 +1356,7 @@ gui_init_colors ()
|
|||||||
color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD;
|
color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD;
|
||||||
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD;
|
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD;
|
||||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
||||||
|
color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = cfg_col_chat_highlight & A_BOLD;
|
||||||
color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD;
|
color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD;
|
||||||
color_attr[COLOR_WIN_STATUS_ACTIVE - 1] = cfg_col_status_active & A_BOLD;
|
color_attr[COLOR_WIN_STATUS_ACTIVE - 1] = cfg_col_status_active & A_BOLD;
|
||||||
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD;
|
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD;
|
||||||
@@ -1501,10 +1392,16 @@ gui_init ()
|
|||||||
|
|
||||||
gui_init_colors ();
|
gui_init_colors ();
|
||||||
|
|
||||||
/* create windows */
|
/* create a new window */
|
||||||
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
|
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
|
||||||
|
|
||||||
signal (SIGWINCH, gui_resize_term_handler);
|
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
|
||||||
|
|
||||||
gui_ready = 1;
|
gui_ready = 1;
|
||||||
}
|
}
|
||||||
@@ -1534,72 +1431,11 @@ gui_end ()
|
|||||||
/* TODO: free input buffer, lines, messages, completion */
|
/* TODO: free input buffer, lines, messages, completion */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end of ncurses output */
|
/* end of curses output */
|
||||||
refresh ();
|
refresh ();
|
||||||
endwin ();
|
endwin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_new_line: create new line for a window
|
|
||||||
*/
|
|
||||||
|
|
||||||
t_gui_line *
|
|
||||||
gui_new_line (t_gui_window *window)
|
|
||||||
{
|
|
||||||
t_gui_line *new_line;
|
|
||||||
|
|
||||||
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
|
||||||
{
|
|
||||||
new_line->length = 0;
|
|
||||||
new_line->length_align = 0;
|
|
||||||
new_line->line_with_message = 0;
|
|
||||||
new_line->messages = NULL;
|
|
||||||
new_line->last_message = NULL;
|
|
||||||
if (!window->lines)
|
|
||||||
window->lines = new_line;
|
|
||||||
else
|
|
||||||
window->last_line->next_line = new_line;
|
|
||||||
new_line->prev_line = window->last_line;
|
|
||||||
new_line->next_line = NULL;
|
|
||||||
window->last_line = new_line;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wprintw (window->win_chat,
|
|
||||||
_("%s not enough memory for new line!\n"),
|
|
||||||
WEECHAT_ERROR);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return new_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_new_message: create a new message for last line of window
|
|
||||||
*/
|
|
||||||
|
|
||||||
t_gui_message *
|
|
||||||
gui_new_message (t_gui_window *window)
|
|
||||||
{
|
|
||||||
t_gui_message *new_message;
|
|
||||||
|
|
||||||
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
|
||||||
{
|
|
||||||
if (!window->last_line->messages)
|
|
||||||
window->last_line->messages = new_message;
|
|
||||||
else
|
|
||||||
window->last_line->last_message->next_message = new_message;
|
|
||||||
new_message->prev_message = window->last_line->last_message;
|
|
||||||
new_message->next_message = NULL;
|
|
||||||
window->last_line->last_message = new_message;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
log_printf ("not enough memory!\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return new_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_add_message: add a message to a window
|
* gui_add_message: add a message to a window
|
||||||
*/
|
*/
|
||||||
@@ -1643,7 +1479,7 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
|
|||||||
if ((window->win_chat_cursor_y
|
if ((window->win_chat_cursor_y
|
||||||
+ gui_get_line_num_splits (window, window->last_line)) >
|
+ gui_get_line_num_splits (window, window->last_line)) >
|
||||||
(window->win_chat_height - 1))
|
(window->win_chat_height - 1))
|
||||||
gui_redraw_window_chat (window);
|
gui_draw_window_chat (window);
|
||||||
else
|
else
|
||||||
gui_display_line (window, window->last_line, 1);
|
gui_display_line (window, window->last_line, 1);
|
||||||
}
|
}
|
||||||
@@ -1684,7 +1520,7 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
|
|||||||
|
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
{
|
{
|
||||||
log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
|
wee_log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1715,11 +1551,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
|
|||||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||||
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
|
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
|
||||||
}
|
}
|
||||||
gui_add_message (window, type, color, pos+1);
|
gui_add_message (window, type, color, pos + 1);
|
||||||
pos = strchr (pos+1, '\n');
|
pos = strchr (pos + 1, '\n');
|
||||||
if (pos)
|
if (pos && !pos[1])
|
||||||
if (pos[1] == '\0')
|
pos = NULL;
|
||||||
pos = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wrefresh (window->win_chat);
|
wrefresh (window->win_chat);
|
||||||
|
|||||||
+10
-164
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +17,13 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* gui-input: user input functions for Curses GUI */
|
/* gui-input: user input functions for Curses GUI */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -32,168 +33,13 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
|
|
||||||
#include "../../weechat.h"
|
#include "../../common/weechat.h"
|
||||||
#include "../gui.h"
|
#include "../gui.h"
|
||||||
#include "../../config.h"
|
#include "../../common/weeconfig.h"
|
||||||
#include "../../command.h"
|
#include "../../common/command.h"
|
||||||
#include "../../irc/irc.h"
|
#include "../../irc/irc.h"
|
||||||
|
|
||||||
|
#define KEY_ESCAPE 27
|
||||||
/*
|
|
||||||
* gui_optimize_input_buffer_size: optimize input buffer size by adding
|
|
||||||
* or deleting data block (predefined size)
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_optimize_input_buffer_size (t_gui_window *window)
|
|
||||||
{
|
|
||||||
int optimal_size;
|
|
||||||
|
|
||||||
optimal_size = ((window->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
|
||||||
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
|
||||||
if (window->input_buffer_alloc != optimal_size)
|
|
||||||
{
|
|
||||||
window->input_buffer_alloc = optimal_size;
|
|
||||||
window->input_buffer = realloc (window->input_buffer, optimal_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_delete_previous_word: delete previous word
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_delete_previous_word ()
|
|
||||||
{
|
|
||||||
int i, j, num_char_deleted, num_char_end;
|
|
||||||
|
|
||||||
if (gui_current_window->input_buffer_pos > 0)
|
|
||||||
{
|
|
||||||
i = gui_current_window->input_buffer_pos - 1;
|
|
||||||
while ((i >= 0) &&
|
|
||||||
(gui_current_window->input_buffer[i] == ' '))
|
|
||||||
i--;
|
|
||||||
if (i >= 0)
|
|
||||||
{
|
|
||||||
while ((i >= 0) &&
|
|
||||||
(gui_current_window->input_buffer[i] != ' '))
|
|
||||||
i--;
|
|
||||||
if (i >= 0)
|
|
||||||
{
|
|
||||||
while ((i >= 0) &&
|
|
||||||
(gui_current_window->input_buffer[i] == ' '))
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i >= 0)
|
|
||||||
i++;
|
|
||||||
i++;
|
|
||||||
num_char_deleted = gui_current_window->input_buffer_pos - i;
|
|
||||||
num_char_end = gui_current_window->input_buffer_size -
|
|
||||||
gui_current_window->input_buffer_pos;
|
|
||||||
|
|
||||||
for (j = 0; j < num_char_end; j++)
|
|
||||||
gui_current_window->input_buffer[i + j] =
|
|
||||||
gui_current_window->input_buffer[gui_current_window->input_buffer_pos + j];
|
|
||||||
|
|
||||||
gui_current_window->input_buffer_size -= num_char_deleted;
|
|
||||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
|
||||||
gui_current_window->input_buffer_pos = i;
|
|
||||||
gui_draw_window_input (gui_current_window);
|
|
||||||
gui_optimize_input_buffer_size (gui_current_window);
|
|
||||||
gui_current_window->completion.position = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_move_previous_word: move to beginning of previous word
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_move_previous_word ()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (gui_current_window->input_buffer_pos > 0)
|
|
||||||
{
|
|
||||||
i = gui_current_window->input_buffer_pos - 1;
|
|
||||||
while ((i >= 0) &&
|
|
||||||
(gui_current_window->input_buffer[i] == ' '))
|
|
||||||
i--;
|
|
||||||
if (i < 0)
|
|
||||||
gui_current_window->input_buffer_pos = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while ((i >= 0) &&
|
|
||||||
(gui_current_window->input_buffer[i] != ' '))
|
|
||||||
i--;
|
|
||||||
gui_current_window->input_buffer_pos = i + 1;
|
|
||||||
}
|
|
||||||
gui_draw_window_input (gui_current_window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_move_next_word: move to the end of next
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_move_next_word ()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (gui_current_window->input_buffer_pos <
|
|
||||||
gui_current_window->input_buffer_size + 1)
|
|
||||||
{
|
|
||||||
i = gui_current_window->input_buffer_pos;
|
|
||||||
while ((i <= gui_current_window->input_buffer_size) &&
|
|
||||||
(gui_current_window->input_buffer[i] == ' '))
|
|
||||||
i++;
|
|
||||||
if (i > gui_current_window->input_buffer_size)
|
|
||||||
gui_current_window->input_buffer_pos = i - 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while ((i <= gui_current_window->input_buffer_size) &&
|
|
||||||
(gui_current_window->input_buffer[i] != ' '))
|
|
||||||
i++;
|
|
||||||
if (i > gui_current_window->input_buffer_size)
|
|
||||||
gui_current_window->input_buffer_pos =
|
|
||||||
gui_current_window->input_buffer_size;
|
|
||||||
else
|
|
||||||
gui_current_window->input_buffer_pos = i;
|
|
||||||
|
|
||||||
}
|
|
||||||
gui_draw_window_input (gui_current_window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_buffer_insert_string: insert a string into the input buffer
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_buffer_insert_string (char *string, int pos)
|
|
||||||
{
|
|
||||||
int i, start, end, length;
|
|
||||||
|
|
||||||
length = strlen (string);
|
|
||||||
|
|
||||||
/* increase buffer size */
|
|
||||||
gui_current_window->input_buffer_size += length;
|
|
||||||
gui_optimize_input_buffer_size (gui_current_window);
|
|
||||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
|
||||||
|
|
||||||
/* move end of string to the right */
|
|
||||||
start = pos + length;
|
|
||||||
end = gui_current_window->input_buffer_size - 1;
|
|
||||||
for (i = end; i >= start; i--)
|
|
||||||
gui_current_window->input_buffer[i] =
|
|
||||||
gui_current_window->input_buffer[i - length];
|
|
||||||
|
|
||||||
/* insert new string */
|
|
||||||
strncpy (gui_current_window->input_buffer + pos, string, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gui_read_keyb: read keyboard line
|
* gui_read_keyb: read keyboard line
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,23 +15,16 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
CC=gcc
|
bin_PROGRAMS = weechat-gtk
|
||||||
|
|
||||||
OPTIONS=-Wall -W -pipe -O2
|
INCLUDES = $(GTK_CFLAGS)
|
||||||
|
|
||||||
OUTPUT=../gui.a
|
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
|
||||||
OBJS=gui-display.o gui-input.o
|
../../irc/lib_weechat_irc.a \
|
||||||
DEFINES=WEE_TEXT
|
$(GTK_LIBS) \
|
||||||
|
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||||
|
|
||||||
all: $(OBJS)
|
weechat_gtk_SOURCES = ../gui.h \
|
||||||
ar r $(OUTPUT) $(OBJS)
|
../gui-common.c \
|
||||||
|
gui-display.c \
|
||||||
$(OBJS):
|
gui-input.c
|
||||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.a *~ core
|
|
||||||
|
|
||||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
|
||||||
../../irc/irc.h ../../gui/gui.h
|
|
||||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
|
||||||
@@ -0,0 +1,750 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* gui-display.c: display functions for Gtk GUI */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "../../common/weechat.h"
|
||||||
|
#include "../gui.h"
|
||||||
|
#include "../../common/weeconfig.h"
|
||||||
|
#include "../../irc/irc.h"
|
||||||
|
|
||||||
|
|
||||||
|
t_gui_color gui_colors[] =
|
||||||
|
{ { "default", 0 },
|
||||||
|
{ "black", 0 },
|
||||||
|
{ "red", 0 },
|
||||||
|
{ "lightred", 0 },
|
||||||
|
{ "green", 0 },
|
||||||
|
{ "lightgreen", 0 },
|
||||||
|
{ "brown", 0 },
|
||||||
|
{ "yellow", 0 },
|
||||||
|
{ "blue", 0 },
|
||||||
|
{ "lightblue", 0 },
|
||||||
|
{ "magenta", 0L },
|
||||||
|
{ "lightmagenta", 0 },
|
||||||
|
{ "cyan", 0 },
|
||||||
|
{ "lightcyan", 0 },
|
||||||
|
{ "gray", 0 },
|
||||||
|
{ "white", 0 },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
|
||||||
|
{ "cyan", "magenta", "green", "brown", "lightblue", "gray",
|
||||||
|
"lightcyan", "lightmagenta", "lightgreen", "blue" };
|
||||||
|
|
||||||
|
int color_attr[NUM_COLORS];
|
||||||
|
|
||||||
|
GtkWidget *gtk_main_window;
|
||||||
|
GtkWidget *vbox1;
|
||||||
|
GtkWidget *entry_topic;
|
||||||
|
GtkWidget *notebook1;
|
||||||
|
GtkWidget *vbox2;
|
||||||
|
GtkWidget *hbox1;
|
||||||
|
GtkWidget *scrolledwindow_chat;
|
||||||
|
GtkWidget *scrolledwindow_nick;
|
||||||
|
GtkWidget *entry_input;
|
||||||
|
GtkWidget *label1;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_assign_color: assign a color (read from config)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_assign_color (int *color, char *color_name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* look for Gtk colors in table */
|
||||||
|
i = 0;
|
||||||
|
while (gui_colors[i].name)
|
||||||
|
{
|
||||||
|
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||||
|
{
|
||||||
|
*color = gui_colors[i].color;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* color not found */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_get_color_by_name: get color by name
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_get_color_by_name (char *color_name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* look for Gtk in table */
|
||||||
|
i = 0;
|
||||||
|
while (gui_colors[i].name)
|
||||||
|
{
|
||||||
|
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||||
|
return gui_colors[i].color;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* color not found */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_get_color_by_value: get color name by value
|
||||||
|
*/
|
||||||
|
|
||||||
|
char *
|
||||||
|
gui_get_color_by_value (int color_value)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* look for Gtk colors in table */
|
||||||
|
i = 0;
|
||||||
|
while (gui_colors[i].name)
|
||||||
|
{
|
||||||
|
if (gui_colors[i].color == color_value)
|
||||||
|
return gui_colors[i].name;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* color not found */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_has_nicklist: returns 1 if window has nicklist
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_window_has_nicklist (t_gui_window *window)
|
||||||
|
{
|
||||||
|
return (window->textbuffer_nicklist != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_calculate_pos_size: calculate position and size for a window & sub-win
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_calculate_pos_size (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: write gui_calculate_pos_size for Gtk GUI */
|
||||||
|
(void) window;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_draw_window_title: draw title window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_draw_window_title (t_gui_window *window)
|
||||||
|
{
|
||||||
|
char format[32];
|
||||||
|
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CHANNEL(window))
|
||||||
|
{
|
||||||
|
sprintf (format, "%%-%ds", window->win_width);
|
||||||
|
/* TODO: display topic */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* TODO: display title for server window */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window_title: redraw title window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window_title (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: first delete window content */
|
||||||
|
gui_draw_window_title (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_get_line_num_splits: returns number of lines on window
|
||||||
|
* (depending on window width and type (server/channel)
|
||||||
|
* for alignment)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
|
||||||
|
{
|
||||||
|
int length, width;
|
||||||
|
|
||||||
|
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
|
||||||
|
if (line->length_align >= window->win_chat_width - 5)
|
||||||
|
{
|
||||||
|
length = line->length;
|
||||||
|
width = window->win_chat_width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = line->length - line->length_align;
|
||||||
|
width = window->win_chat_width - line->length_align;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (length % width == 0) ? (length / width) : ((length / width) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_display_end_of_line: display end of a line in the chat window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||||
|
{
|
||||||
|
/* TODO: display end of line! */
|
||||||
|
(void) window;
|
||||||
|
(void) line;
|
||||||
|
(void) count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_display_line: display a line in the chat window
|
||||||
|
* if stop_at_end == 1, screen will not scroll and then we
|
||||||
|
* exit since chat window is full
|
||||||
|
* returns: 1 if stop_at_end == 0 or screen not full
|
||||||
|
* 0 if screen is full and if stop_at_end == 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
|
||||||
|
{
|
||||||
|
/* TODO: display line! */
|
||||||
|
(void) window;
|
||||||
|
(void) line;
|
||||||
|
(void) stop_at_end;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_draw_window_chat: draw chat window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_draw_window_chat (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: draw chat window */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window_chat: redraw chat window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window_chat (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: first delete window content */
|
||||||
|
gui_draw_window_chat (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_draw_window_nick: draw nick window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_draw_window_nick (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: display nicklist for Gtk GUI */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window_nick: redraw nick window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window_nick (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: first delete window content */
|
||||||
|
gui_draw_window_nick (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_draw_window_status: draw status window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_draw_window_status (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: draw status window! */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window_status: redraw status window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window_status (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: first delete window content */
|
||||||
|
gui_draw_window_status (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_draw_window_input: draw input window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_draw_window_input (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: draw input window */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window_input: redraw input window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window_input (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* TODO: first delete window content */
|
||||||
|
gui_draw_window_input (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_redraw_window: redraw a window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_redraw_window (t_gui_window *window)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if (window != gui_current_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gui_redraw_window_title (window);
|
||||||
|
gui_redraw_window_chat (window);
|
||||||
|
if (gui_window_has_nicklist (window))
|
||||||
|
gui_redraw_window_nick (window);
|
||||||
|
gui_redraw_window_status (window);
|
||||||
|
gui_redraw_window_input (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_switch_to_window: switch to another window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_switch_to_window (t_gui_window *window)
|
||||||
|
{
|
||||||
|
t_gui_window *ptr_win;
|
||||||
|
GtkTextIter start, end;
|
||||||
|
|
||||||
|
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||||
|
{
|
||||||
|
if (ptr_win->is_displayed)
|
||||||
|
{
|
||||||
|
/* TODO: manage splitted windows */
|
||||||
|
ptr_win->is_displayed = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gui_calculate_pos_size (window);
|
||||||
|
|
||||||
|
if (!window->textview_chat)
|
||||||
|
{
|
||||||
|
window->textview_chat = gtk_text_view_new ();
|
||||||
|
gtk_widget_show (window->textview_chat);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), window->textview_chat);
|
||||||
|
gtk_widget_set_size_request (window->textview_chat, 300, -1);
|
||||||
|
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||||
|
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_chat), FALSE);
|
||||||
|
|
||||||
|
window->textbuffer_chat = gtk_text_buffer_new (NULL);
|
||||||
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_chat), window->textbuffer_chat);
|
||||||
|
|
||||||
|
window->texttag_chat = gtk_text_buffer_create_tag(window->textbuffer_chat, "courier", "font_family", "lucida");
|
||||||
|
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||||
|
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||||
|
}
|
||||||
|
if (WIN_IS_CHANNEL (window) && !window->textbuffer_nicklist)
|
||||||
|
{
|
||||||
|
|
||||||
|
window->textview_nicklist = gtk_text_view_new ();
|
||||||
|
gtk_widget_show (window->textview_nicklist);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), window->textview_nicklist);
|
||||||
|
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||||
|
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
|
||||||
|
|
||||||
|
window->textbuffer_nicklist = gtk_text_buffer_new (NULL);
|
||||||
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_nicklist), window->textbuffer_nicklist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* change current window to the new window */
|
||||||
|
gui_current_window = window;
|
||||||
|
|
||||||
|
window->is_displayed = 1;
|
||||||
|
window->unread_data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_switch_to_previous_window: switch to previous window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_switch_to_previous_window ()
|
||||||
|
{
|
||||||
|
/* if only one windows then return */
|
||||||
|
if (gui_windows == last_gui_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gui_current_window->prev_window)
|
||||||
|
gui_switch_to_window (gui_current_window->prev_window);
|
||||||
|
else
|
||||||
|
gui_switch_to_window (last_gui_window);
|
||||||
|
gui_redraw_window (gui_current_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_switch_to_next_window: switch to next window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_switch_to_next_window ()
|
||||||
|
{
|
||||||
|
/* if only one windows then return */
|
||||||
|
if (gui_windows == last_gui_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gui_current_window->next_window)
|
||||||
|
gui_switch_to_window (gui_current_window->next_window);
|
||||||
|
else
|
||||||
|
gui_switch_to_window (gui_windows);
|
||||||
|
gui_redraw_window (gui_current_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_move_page_up: display previous page on window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
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_move_page_down: display next page on window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_move_page_down ()
|
||||||
|
{
|
||||||
|
if (gui_current_window->sub_lines > 0)
|
||||||
|
{
|
||||||
|
gui_current_window->sub_lines -= gui_current_window->win_chat_height - 1;
|
||||||
|
if (gui_current_window->sub_lines < 0)
|
||||||
|
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_gtk_resize_handler: called when term size is modified
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_gtk_resize_handler ()
|
||||||
|
{
|
||||||
|
/* TODO: write resize handler for Gtk */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_init_subwindows: init subwindows for a WeeChat window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_window_init_subwindows (t_gui_window *window)
|
||||||
|
{
|
||||||
|
window->textview_chat = NULL;
|
||||||
|
window->textbuffer_chat = NULL;
|
||||||
|
window->texttag_chat = NULL;
|
||||||
|
window->textview_nicklist = NULL;
|
||||||
|
window->textbuffer_nicklist = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_pre_init (int *argc, char **argv[])
|
||||||
|
{
|
||||||
|
/* Initialise Gtk+ */
|
||||||
|
gtk_init (argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_init_colors: init GUI colors
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_init_colors ()
|
||||||
|
{
|
||||||
|
/* TODO: init colors for Gtk */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_init: init GUI
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_init ()
|
||||||
|
{
|
||||||
|
gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (gtk_main_window), PACKAGE_STRING);
|
||||||
|
|
||||||
|
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_widget_show (vbox1);
|
||||||
|
gtk_container_add (GTK_CONTAINER (gtk_main_window), vbox1);
|
||||||
|
|
||||||
|
entry_topic = gtk_entry_new ();
|
||||||
|
gtk_widget_show (entry_topic);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox1), entry_topic, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
notebook1 = gtk_notebook_new ();
|
||||||
|
gtk_widget_show (notebook1);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
|
||||||
|
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook1), GTK_POS_BOTTOM);
|
||||||
|
|
||||||
|
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_widget_show (vbox2);
|
||||||
|
gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
|
||||||
|
|
||||||
|
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||||
|
gtk_widget_show (hbox1);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox2), hbox1, TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
scrolledwindow_chat = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_show (scrolledwindow_chat);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_chat, TRUE, TRUE, 0);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_chat), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||||
|
|
||||||
|
scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_show (scrolledwindow_nick);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_nick, TRUE, TRUE, 0);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_nick), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||||
|
|
||||||
|
entry_input = gtk_entry_new ();
|
||||||
|
gtk_widget_show (entry_input);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox2), entry_input, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
label1 = gtk_label_new (_("server"));
|
||||||
|
gtk_widget_show (label1);
|
||||||
|
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);
|
||||||
|
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
|
||||||
|
|
||||||
|
gtk_widget_show_all (gtk_main_window);
|
||||||
|
|
||||||
|
/* create a new window */
|
||||||
|
gui_current_window = gui_window_new (NULL, NULL, 1 /*0, 0, COLS, LINES*/);
|
||||||
|
|
||||||
|
/* TODO: set gui_ready to 1 when Gtk display functions will be ok */
|
||||||
|
gui_ready = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_end: GUI end
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_end ()
|
||||||
|
{
|
||||||
|
t_gui_window *ptr_win;
|
||||||
|
|
||||||
|
/* delete all windows */
|
||||||
|
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||||
|
{
|
||||||
|
/* TODO: delete Gtk windows */
|
||||||
|
/* TODO: free input buffer, lines, messages, completion */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_add_message: add a message to a window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_add_message (t_gui_window *window, int type, int color, char *message)
|
||||||
|
{
|
||||||
|
char *pos;
|
||||||
|
int length;
|
||||||
|
GtkTextIter start, end;
|
||||||
|
|
||||||
|
/* create new line if previous was ending by '\n' (or if 1st line) */
|
||||||
|
if (window->line_complete)
|
||||||
|
{
|
||||||
|
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, "\n", -1);
|
||||||
|
window->line_complete = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = strchr (message, '\n');
|
||||||
|
if (pos)
|
||||||
|
{
|
||||||
|
pos[0] = '\0';
|
||||||
|
window->line_complete = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, message, -1);
|
||||||
|
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
|
||||||
|
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
|
||||||
|
|
||||||
|
if (pos)
|
||||||
|
pos[0] = '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_printf_color_type: display a message in a window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_printf_color_type (t_gui_window *window, int type, int color, char *message, ...)
|
||||||
|
{
|
||||||
|
static char buffer[8192];
|
||||||
|
char timestamp[16];
|
||||||
|
char *pos;
|
||||||
|
va_list argptr;
|
||||||
|
static time_t seconds;
|
||||||
|
struct tm *date_tmp;
|
||||||
|
|
||||||
|
if (gui_ready)
|
||||||
|
{
|
||||||
|
if (color == -1)
|
||||||
|
color = COLOR_WIN_CHAT;
|
||||||
|
|
||||||
|
if (window == NULL)
|
||||||
|
{
|
||||||
|
if (SERVER(gui_current_window))
|
||||||
|
window = SERVER(gui_current_window)->window;
|
||||||
|
else
|
||||||
|
window = gui_current_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window == NULL)
|
||||||
|
{
|
||||||
|
wee_log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start (argptr, message);
|
||||||
|
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||||
|
va_end (argptr);
|
||||||
|
|
||||||
|
if (gui_ready)
|
||||||
|
{
|
||||||
|
seconds = time (NULL);
|
||||||
|
date_tmp = localtime (&seconds);
|
||||||
|
|
||||||
|
pos = buffer - 1;
|
||||||
|
while (pos)
|
||||||
|
{
|
||||||
|
/* TODO: read timestamp format from config! */
|
||||||
|
if (window->line_complete)
|
||||||
|
{
|
||||||
|
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
|
||||||
|
sprintf (timestamp, "%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);
|
||||||
|
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);
|
||||||
|
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
|
||||||
|
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
|
||||||
|
}
|
||||||
|
gui_add_message (window, type, color, pos + 1);
|
||||||
|
pos = strchr (pos + 1, '\n');
|
||||||
|
if (pos && !pos[1])
|
||||||
|
pos = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_print ("%s", buffer);
|
||||||
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
|
||||||
* Bounga <bounga@altern.org>
|
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __WEECHAT_GUI_GTK_H
|
|
||||||
#define __WEECHAT_GUI_GTK_H 1
|
|
||||||
|
|
||||||
#endif /* gui-gtk.h */
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* gui-input: user input functions for Gtk GUI */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "../../common/weechat.h"
|
||||||
|
#include "../gui.h"
|
||||||
|
#include "../../common/weeconfig.h"
|
||||||
|
#include "../../common/command.h"
|
||||||
|
#include "../../irc/irc.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_read_keyb: read keyboard line
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_read_keyb ()
|
||||||
|
{
|
||||||
|
/* TODO: read keyboard for Gtk GUI */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_main_loop: main loop for WeeChat with Gtk GUI
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_main_loop ()
|
||||||
|
{
|
||||||
|
/* TODO: main loop function for Gtk GUI */
|
||||||
|
gtk_main ();
|
||||||
|
}
|
||||||
@@ -0,0 +1,453 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* gui-common.c: display functions, used by any GUI */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <curses.h>
|
||||||
|
|
||||||
|
#include "../common/weechat.h"
|
||||||
|
#include "gui.h"
|
||||||
|
#include "../irc/irc.h"
|
||||||
|
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_new: create a new window
|
||||||
|
* (TODO: add coordinates and size, for splited windows)
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_gui_window *
|
||||||
|
gui_window_new (void *server, void *channel, int switch_to_window
|
||||||
|
/*int x, int y, int width, int height*/)
|
||||||
|
{
|
||||||
|
t_gui_window *new_window;
|
||||||
|
|
||||||
|
if (gui_windows)
|
||||||
|
{
|
||||||
|
/* use first window if no server was assigned to this window */
|
||||||
|
if (!SERVER(gui_windows))
|
||||||
|
{
|
||||||
|
if (server)
|
||||||
|
((t_irc_server *)(server))->window = gui_windows;
|
||||||
|
if (channel)
|
||||||
|
((t_irc_channel *)(channel))->window = gui_windows;
|
||||||
|
SERVER(gui_windows) = server;
|
||||||
|
CHANNEL(gui_windows) = channel;
|
||||||
|
return gui_windows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
||||||
|
{
|
||||||
|
new_window->is_displayed = 0;
|
||||||
|
|
||||||
|
/* assign server and channel to window */
|
||||||
|
SERVER(new_window) = server;
|
||||||
|
CHANNEL(new_window) = channel;
|
||||||
|
/* assign window to server and channel */
|
||||||
|
if (server && !channel)
|
||||||
|
SERVER(new_window)->window = new_window;
|
||||||
|
if (channel)
|
||||||
|
CHANNEL(new_window)->window = new_window;
|
||||||
|
|
||||||
|
gui_calculate_pos_size (new_window);
|
||||||
|
|
||||||
|
/* init windows */
|
||||||
|
gui_window_init_subwindows(new_window);
|
||||||
|
|
||||||
|
/* init lines */
|
||||||
|
new_window->lines = NULL;
|
||||||
|
new_window->last_line = NULL;
|
||||||
|
new_window->first_line_displayed = 1;
|
||||||
|
new_window->sub_lines = 0;
|
||||||
|
new_window->line_complete = 1;
|
||||||
|
new_window->unread_data = 0;
|
||||||
|
|
||||||
|
/* init input buffer */
|
||||||
|
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||||
|
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||||
|
new_window->input_buffer[0] = '\0';
|
||||||
|
new_window->input_buffer_size = 0;
|
||||||
|
new_window->input_buffer_pos = 0;
|
||||||
|
new_window->input_buffer_1st_display = 0;
|
||||||
|
|
||||||
|
/* init completion */
|
||||||
|
completion_init (&(new_window->completion));
|
||||||
|
|
||||||
|
/* init history */
|
||||||
|
new_window->history = NULL;
|
||||||
|
new_window->ptr_history = NULL;
|
||||||
|
|
||||||
|
/* switch to new window */
|
||||||
|
if (switch_to_window)
|
||||||
|
gui_switch_to_window (new_window);
|
||||||
|
|
||||||
|
/* add window to windows queue */
|
||||||
|
new_window->prev_window = last_gui_window;
|
||||||
|
if (gui_windows)
|
||||||
|
last_gui_window->next_window = new_window;
|
||||||
|
else
|
||||||
|
gui_windows = new_window;
|
||||||
|
last_gui_window = new_window;
|
||||||
|
new_window->next_window = NULL;
|
||||||
|
|
||||||
|
/* redraw whole screen */
|
||||||
|
gui_redraw_window (gui_current_window);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return new_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_clear: clear window content
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_window_clear (t_gui_window *window)
|
||||||
|
{
|
||||||
|
t_gui_line *ptr_line;
|
||||||
|
t_gui_message *ptr_message;
|
||||||
|
|
||||||
|
while (window->lines)
|
||||||
|
{
|
||||||
|
ptr_line = window->lines->next_line;
|
||||||
|
while (window->lines->messages)
|
||||||
|
{
|
||||||
|
ptr_message = window->lines->messages->next_message;
|
||||||
|
if (window->lines->messages->message)
|
||||||
|
free (window->lines->messages->message);
|
||||||
|
free (window->lines->messages);
|
||||||
|
window->lines->messages = ptr_message;
|
||||||
|
}
|
||||||
|
free (window->lines);
|
||||||
|
window->lines = ptr_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->lines = NULL;
|
||||||
|
window->last_line = NULL;
|
||||||
|
window->first_line_displayed = 1;
|
||||||
|
window->sub_lines = 0;
|
||||||
|
window->line_complete = 1;
|
||||||
|
window->unread_data = 0;
|
||||||
|
|
||||||
|
if (window == gui_current_window)
|
||||||
|
gui_redraw_window_chat (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_clear_all: clear all windows content
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_window_clear_all ()
|
||||||
|
{
|
||||||
|
t_gui_window *ptr_win;
|
||||||
|
|
||||||
|
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||||
|
gui_window_clear (ptr_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_window_free: delete a window
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_window_free (t_gui_window *window)
|
||||||
|
{
|
||||||
|
t_gui_line *ptr_line;
|
||||||
|
t_gui_message *ptr_message;
|
||||||
|
int create_new;
|
||||||
|
|
||||||
|
create_new = (window->server || window->channel);
|
||||||
|
|
||||||
|
/* TODO: manage splitted windows! */
|
||||||
|
if ((window == gui_current_window) &&
|
||||||
|
((window->next_window) || (window->prev_window)))
|
||||||
|
gui_switch_to_previous_window ();
|
||||||
|
|
||||||
|
/* free lines and messages */
|
||||||
|
while (window->lines)
|
||||||
|
{
|
||||||
|
ptr_line = window->lines->next_line;
|
||||||
|
while (window->lines->messages)
|
||||||
|
{
|
||||||
|
ptr_message = window->lines->messages->next_message;
|
||||||
|
if (window->lines->messages->message)
|
||||||
|
free (window->lines->messages->message);
|
||||||
|
free (window->lines->messages);
|
||||||
|
window->lines->messages = ptr_message;
|
||||||
|
}
|
||||||
|
free (window->lines);
|
||||||
|
window->lines = ptr_line;
|
||||||
|
}
|
||||||
|
if (window->input_buffer)
|
||||||
|
free (window->input_buffer);
|
||||||
|
|
||||||
|
completion_free (&(window->completion));
|
||||||
|
|
||||||
|
/* remove window from windows list */
|
||||||
|
if (window->prev_window)
|
||||||
|
window->prev_window->next_window = window->next_window;
|
||||||
|
if (window->next_window)
|
||||||
|
window->next_window->prev_window = window->prev_window;
|
||||||
|
if (gui_windows == window)
|
||||||
|
gui_windows = window->next_window;
|
||||||
|
if (last_gui_window == window)
|
||||||
|
last_gui_window = window->prev_window;
|
||||||
|
|
||||||
|
free (window);
|
||||||
|
|
||||||
|
/* always at least one window */
|
||||||
|
if (!gui_windows && create_new)
|
||||||
|
gui_window_new (NULL, NULL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_new_line: create new line for a window
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_gui_line *
|
||||||
|
gui_new_line (t_gui_window *window)
|
||||||
|
{
|
||||||
|
t_gui_line *new_line;
|
||||||
|
|
||||||
|
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
||||||
|
{
|
||||||
|
new_line->length = 0;
|
||||||
|
new_line->length_align = 0;
|
||||||
|
new_line->line_with_message = 0;
|
||||||
|
new_line->messages = NULL;
|
||||||
|
new_line->last_message = NULL;
|
||||||
|
if (!window->lines)
|
||||||
|
window->lines = new_line;
|
||||||
|
else
|
||||||
|
window->last_line->next_line = new_line;
|
||||||
|
new_line->prev_line = window->last_line;
|
||||||
|
new_line->next_line = NULL;
|
||||||
|
window->last_line = new_line;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wee_log_printf (_("%s not enough memory for new line!\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return new_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_new_message: create a new message for last line of window
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_gui_message *
|
||||||
|
gui_new_message (t_gui_window *window)
|
||||||
|
{
|
||||||
|
t_gui_message *new_message;
|
||||||
|
|
||||||
|
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
||||||
|
{
|
||||||
|
if (!window->last_line->messages)
|
||||||
|
window->last_line->messages = new_message;
|
||||||
|
else
|
||||||
|
window->last_line->last_message->next_message = new_message;
|
||||||
|
new_message->prev_message = window->last_line->last_message;
|
||||||
|
new_message->next_message = NULL;
|
||||||
|
window->last_line->last_message = new_message;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wee_log_printf (_("not enough memory!\n"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return new_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_optimize_input_buffer_size: optimize input buffer size by adding
|
||||||
|
* or deleting data block (predefined size)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_optimize_input_buffer_size (t_gui_window *window)
|
||||||
|
{
|
||||||
|
int optimal_size;
|
||||||
|
|
||||||
|
optimal_size = ((window->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||||
|
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
||||||
|
if (window->input_buffer_alloc != optimal_size)
|
||||||
|
{
|
||||||
|
window->input_buffer_alloc = optimal_size;
|
||||||
|
window->input_buffer = realloc (window->input_buffer, optimal_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_delete_previous_word: delete previous word
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_delete_previous_word ()
|
||||||
|
{
|
||||||
|
int i, j, num_char_deleted, num_char_end;
|
||||||
|
|
||||||
|
if (gui_current_window->input_buffer_pos > 0)
|
||||||
|
{
|
||||||
|
i = gui_current_window->input_buffer_pos - 1;
|
||||||
|
while ((i >= 0) &&
|
||||||
|
(gui_current_window->input_buffer[i] == ' '))
|
||||||
|
i--;
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
while ((i >= 0) &&
|
||||||
|
(gui_current_window->input_buffer[i] != ' '))
|
||||||
|
i--;
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
while ((i >= 0) &&
|
||||||
|
(gui_current_window->input_buffer[i] == ' '))
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= 0)
|
||||||
|
i++;
|
||||||
|
i++;
|
||||||
|
num_char_deleted = gui_current_window->input_buffer_pos - i;
|
||||||
|
num_char_end = gui_current_window->input_buffer_size -
|
||||||
|
gui_current_window->input_buffer_pos;
|
||||||
|
|
||||||
|
for (j = 0; j < num_char_end; j++)
|
||||||
|
gui_current_window->input_buffer[i + j] =
|
||||||
|
gui_current_window->input_buffer[gui_current_window->input_buffer_pos + j];
|
||||||
|
|
||||||
|
gui_current_window->input_buffer_size -= num_char_deleted;
|
||||||
|
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||||
|
gui_current_window->input_buffer_pos = i;
|
||||||
|
gui_draw_window_input (gui_current_window);
|
||||||
|
gui_optimize_input_buffer_size (gui_current_window);
|
||||||
|
gui_current_window->completion.position = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_move_previous_word: move to beginning of previous word
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_move_previous_word ()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (gui_current_window->input_buffer_pos > 0)
|
||||||
|
{
|
||||||
|
i = gui_current_window->input_buffer_pos - 1;
|
||||||
|
while ((i >= 0) &&
|
||||||
|
(gui_current_window->input_buffer[i] == ' '))
|
||||||
|
i--;
|
||||||
|
if (i < 0)
|
||||||
|
gui_current_window->input_buffer_pos = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ((i >= 0) &&
|
||||||
|
(gui_current_window->input_buffer[i] != ' '))
|
||||||
|
i--;
|
||||||
|
gui_current_window->input_buffer_pos = i + 1;
|
||||||
|
}
|
||||||
|
gui_draw_window_input (gui_current_window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_move_next_word: move to the end of next
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_move_next_word ()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (gui_current_window->input_buffer_pos <
|
||||||
|
gui_current_window->input_buffer_size + 1)
|
||||||
|
{
|
||||||
|
i = gui_current_window->input_buffer_pos;
|
||||||
|
while ((i <= gui_current_window->input_buffer_size) &&
|
||||||
|
(gui_current_window->input_buffer[i] == ' '))
|
||||||
|
i++;
|
||||||
|
if (i > gui_current_window->input_buffer_size)
|
||||||
|
gui_current_window->input_buffer_pos = i - 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ((i <= gui_current_window->input_buffer_size) &&
|
||||||
|
(gui_current_window->input_buffer[i] != ' '))
|
||||||
|
i++;
|
||||||
|
if (i > gui_current_window->input_buffer_size)
|
||||||
|
gui_current_window->input_buffer_pos =
|
||||||
|
gui_current_window->input_buffer_size;
|
||||||
|
else
|
||||||
|
gui_current_window->input_buffer_pos = i;
|
||||||
|
|
||||||
|
}
|
||||||
|
gui_draw_window_input (gui_current_window);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gui_buffer_insert_string: insert a string into the input buffer
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_buffer_insert_string (char *string, int pos)
|
||||||
|
{
|
||||||
|
int i, start, end, length;
|
||||||
|
|
||||||
|
length = strlen (string);
|
||||||
|
|
||||||
|
/* increase buffer size */
|
||||||
|
gui_current_window->input_buffer_size += length;
|
||||||
|
gui_optimize_input_buffer_size (gui_current_window);
|
||||||
|
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||||
|
|
||||||
|
/* move end of string to the right */
|
||||||
|
start = pos + length;
|
||||||
|
end = gui_current_window->input_buffer_size - 1;
|
||||||
|
for (i = end; i >= start; i--)
|
||||||
|
gui_current_window->input_buffer[i] =
|
||||||
|
gui_current_window->input_buffer[i - length];
|
||||||
|
|
||||||
|
/* insert new string */
|
||||||
|
strncpy (gui_current_window->input_buffer + pos, string, length);
|
||||||
|
}
|
||||||
+58
-56
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,20 +21,12 @@
|
|||||||
#ifndef __WEECHAT_GUI_H
|
#ifndef __WEECHAT_GUI_H
|
||||||
#define __WEECHAT_GUI_H 1
|
#define __WEECHAT_GUI_H 1
|
||||||
|
|
||||||
#ifdef WEE_CURSES
|
#include "../common/completion.h"
|
||||||
#include <curses.h>
|
#include "../common/history.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../completion.h"
|
|
||||||
#include "../history.h"
|
|
||||||
|
|
||||||
#ifdef WEE_CURSES
|
|
||||||
#define KEY_ESCAPE 27
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||||
|
|
||||||
#define NUM_COLORS 35
|
#define NUM_COLORS 36
|
||||||
#define COLOR_WIN_TITLE 1
|
#define COLOR_WIN_TITLE 1
|
||||||
#define COLOR_WIN_CHAT 2
|
#define COLOR_WIN_CHAT 2
|
||||||
#define COLOR_WIN_CHAT_TIME 3
|
#define COLOR_WIN_CHAT_TIME 3
|
||||||
@@ -47,23 +37,24 @@
|
|||||||
#define COLOR_WIN_CHAT_HOST 8
|
#define COLOR_WIN_CHAT_HOST 8
|
||||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||||
#define COLOR_WIN_CHAT_DARK 10
|
#define COLOR_WIN_CHAT_DARK 10
|
||||||
#define COLOR_WIN_STATUS 11
|
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||||
#define COLOR_WIN_STATUS_ACTIVE 12
|
#define COLOR_WIN_STATUS 12
|
||||||
#define COLOR_WIN_STATUS_DATA_MSG 13
|
#define COLOR_WIN_STATUS_ACTIVE 13
|
||||||
#define COLOR_WIN_STATUS_DATA_OTHER 14
|
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||||
#define COLOR_WIN_STATUS_MORE 15
|
#define COLOR_WIN_STATUS_DATA_OTHER 15
|
||||||
#define COLOR_WIN_INPUT 16
|
#define COLOR_WIN_STATUS_MORE 16
|
||||||
#define COLOR_WIN_INPUT_CHANNEL 17
|
#define COLOR_WIN_INPUT 17
|
||||||
#define COLOR_WIN_INPUT_NICK 18
|
#define COLOR_WIN_INPUT_CHANNEL 18
|
||||||
#define COLOR_WIN_NICK 19
|
#define COLOR_WIN_INPUT_NICK 19
|
||||||
#define COLOR_WIN_NICK_OP 20
|
#define COLOR_WIN_NICK 20
|
||||||
#define COLOR_WIN_NICK_HALFOP 21
|
#define COLOR_WIN_NICK_OP 21
|
||||||
#define COLOR_WIN_NICK_VOICE 22
|
#define COLOR_WIN_NICK_HALFOP 22
|
||||||
#define COLOR_WIN_NICK_SEP 23
|
#define COLOR_WIN_NICK_VOICE 23
|
||||||
#define COLOR_WIN_NICK_SELF 24
|
#define COLOR_WIN_NICK_SEP 24
|
||||||
#define COLOR_WIN_NICK_PRIVATE 25
|
#define COLOR_WIN_NICK_SELF 25
|
||||||
#define COLOR_WIN_NICK_FIRST 26
|
#define COLOR_WIN_NICK_PRIVATE 26
|
||||||
#define COLOR_WIN_NICK_LAST 35
|
#define COLOR_WIN_NICK_FIRST 27
|
||||||
|
#define COLOR_WIN_NICK_LAST 36
|
||||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||||
|
|
||||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||||
@@ -120,6 +111,8 @@ typedef struct t_gui_window t_gui_window;
|
|||||||
|
|
||||||
struct t_gui_window
|
struct t_gui_window
|
||||||
{
|
{
|
||||||
|
int is_displayed; /* = 1 if window is displayed */
|
||||||
|
|
||||||
/* server/channel */
|
/* server/channel */
|
||||||
void *server; /* window's server */
|
void *server; /* window's server */
|
||||||
void *channel; /* window's channel */
|
void *channel; /* window's channel */
|
||||||
@@ -140,20 +133,22 @@ struct t_gui_window
|
|||||||
int win_nick_width; /* width of chat window */
|
int win_nick_width; /* width of chat window */
|
||||||
int win_nick_height; /* height of chat window */
|
int win_nick_height; /* height of chat window */
|
||||||
|
|
||||||
/* windows */
|
/* windows for Curses GUI */
|
||||||
#ifdef WEE_CURSES
|
void *win_title; /* title window */
|
||||||
WINDOW *win_title; /* title window */
|
void *win_chat; /* chat window (exemple: channel) */
|
||||||
WINDOW *win_chat; /* chat window (exemple: channel) */
|
void *win_nick; /* nick window */
|
||||||
WINDOW *win_nick; /* nick window */
|
void *win_status; /* status window */
|
||||||
WINDOW *win_status; /* status window */
|
void *win_input; /* input window */
|
||||||
WINDOW *win_input; /* input window */
|
|
||||||
#endif
|
/* windows for Curses GUI */
|
||||||
#ifdef WEE_GTK
|
void *textview_chat; /* textview widget for chat */
|
||||||
/* TODO: declare Gtk+ window */
|
void *textbuffer_chat; /* textbuffer widget for chat */
|
||||||
#endif
|
void *texttag_chat; /* texttag widget for chat */
|
||||||
#ifdef WEE_QT
|
void *textview_nicklist; /* textview widget for nicklist */
|
||||||
|
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
|
||||||
|
|
||||||
|
/* windows for Curses GUI */
|
||||||
/* TODO: declare Qt window */
|
/* TODO: declare Qt window */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* chat content (lines, line is composed by many messages) */
|
/* chat content (lines, line is composed by many messages) */
|
||||||
t_gui_line *lines; /* lines of chat window */
|
t_gui_line *lines; /* lines of chat window */
|
||||||
@@ -186,14 +181,28 @@ struct t_gui_window
|
|||||||
|
|
||||||
extern int gui_ready;
|
extern int gui_ready;
|
||||||
extern t_gui_window *gui_windows;
|
extern t_gui_window *gui_windows;
|
||||||
|
extern t_gui_window *last_gui_window;
|
||||||
extern t_gui_window *gui_current_window;
|
extern t_gui_window *gui_current_window;
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
|
||||||
|
/* GUI independent functions */
|
||||||
|
extern t_gui_window *gui_window_new (void *, 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 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 *);
|
||||||
|
extern void gui_delete_previous_word ();
|
||||||
|
extern void gui_move_previous_word ();
|
||||||
|
extern void gui_move_next_word ();
|
||||||
|
extern void gui_buffer_insert_string (char *, int);
|
||||||
|
/* GUI dependant functions */
|
||||||
extern int gui_assign_color (int *, char *);
|
extern int gui_assign_color (int *, char *);
|
||||||
extern int gui_get_color_by_name (char *);
|
extern int gui_get_color_by_name (char *);
|
||||||
extern char *gui_get_color_by_value (int);
|
extern char *gui_get_color_by_value (int);
|
||||||
|
extern int gui_window_has_nicklist (t_gui_window *);
|
||||||
|
extern void gui_calculate_pos_size (t_gui_window *);
|
||||||
extern void gui_draw_window_title (t_gui_window *);
|
extern void gui_draw_window_title (t_gui_window *);
|
||||||
extern void gui_redraw_window_title (t_gui_window *);
|
extern void gui_redraw_window_title (t_gui_window *);
|
||||||
extern void gui_draw_window_chat (t_gui_window *);
|
extern void gui_draw_window_chat (t_gui_window *);
|
||||||
@@ -205,25 +214,18 @@ extern void gui_redraw_window_status (t_gui_window *);
|
|||||||
extern void gui_draw_window_input (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_input (t_gui_window *);
|
||||||
extern void gui_redraw_window (t_gui_window *);
|
extern void gui_redraw_window (t_gui_window *);
|
||||||
|
|
||||||
extern void gui_window_clear (t_gui_window *);
|
|
||||||
extern void gui_window_clear_all ();
|
|
||||||
|
|
||||||
extern void gui_switch_to_window (t_gui_window *);
|
extern void gui_switch_to_window (t_gui_window *);
|
||||||
extern void gui_switch_to_previous_window ();
|
extern void gui_switch_to_previous_window ();
|
||||||
extern void gui_switch_to_next_window ();
|
extern void gui_switch_to_next_window ();
|
||||||
|
|
||||||
extern void gui_move_page_up ();
|
extern void gui_move_page_up ();
|
||||||
extern void gui_move_page_down ();
|
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 ();
|
extern void gui_init ();
|
||||||
/* TODO: add coordinates and size */
|
|
||||||
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
|
|
||||||
extern void gui_window_free (t_gui_window *);
|
extern void gui_window_free (t_gui_window *);
|
||||||
extern void gui_end ();
|
extern void gui_end ();
|
||||||
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
|
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
|
||||||
extern void gui_display_nick (t_gui_window *, void *, int, int, int, int);
|
|
||||||
|
|
||||||
extern void gui_main_loop ();
|
extern void gui_main_loop ();
|
||||||
|
|
||||||
#endif /* gui.h */
|
#endif /* gui.h */
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
+2
-4
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+2
-4
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
|
||||||
* Bounga <bounga@altern.org>
|
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* gui-text.c: text GUI - display functions */
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include "weechat.h"
|
|
||||||
#include "gui-text.h"
|
|
||||||
#include "command.h"
|
|
||||||
#include "irc.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_init: init GUI
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_init ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_init_irc_window: allocates a window for a channel or server
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_init_irc_window (t_irc_window * window)
|
|
||||||
{
|
|
||||||
/* no window in text GUI */
|
|
||||||
window->text = NULL;
|
|
||||||
window->window = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_free_irc_window: free a GUI window
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_free_irc_window (t_irc_window * window)
|
|
||||||
{
|
|
||||||
/* no window in text GUI */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_end: GUI end
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_end ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* read_keyb: read keyboard line
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
read_keyb ()
|
|
||||||
{
|
|
||||||
int num_read;
|
|
||||||
static char buffer[4096];
|
|
||||||
static int pos_buffer = 0;
|
|
||||||
char buffer_tmp[1024];
|
|
||||||
int pos_buffer_tmp;
|
|
||||||
|
|
||||||
num_read = read (STDIN_FILENO, buffer_tmp, sizeof (buffer_tmp) - 1);
|
|
||||||
pos_buffer_tmp = 0;
|
|
||||||
while (pos_buffer_tmp < num_read)
|
|
||||||
{
|
|
||||||
switch (buffer_tmp[pos_buffer_tmp])
|
|
||||||
{
|
|
||||||
case '\r':
|
|
||||||
break;
|
|
||||||
case '\n':
|
|
||||||
buffer[pos_buffer] = '\0';
|
|
||||||
pos_buffer = 0;
|
|
||||||
user_command (buffer);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
buffer[pos_buffer] = buffer_tmp[pos_buffer_tmp];
|
|
||||||
if (pos_buffer < (int) (sizeof (buffer) - 2))
|
|
||||||
pos_buffer++;
|
|
||||||
}
|
|
||||||
pos_buffer_tmp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_main_loop: main loop for WeeChat with text GUI
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_main_loop ()
|
|
||||||
{
|
|
||||||
struct timeval timeout;
|
|
||||||
fd_set read_fd;
|
|
||||||
t_irc_server *ptr_server;
|
|
||||||
|
|
||||||
quit_weechat = 0;
|
|
||||||
while (!quit_weechat)
|
|
||||||
{
|
|
||||||
timeout.tv_sec = 0;
|
|
||||||
timeout.tv_usec = 10000;
|
|
||||||
FD_ZERO (&read_fd);
|
|
||||||
FD_SET (STDIN_FILENO, &read_fd);
|
|
||||||
for (ptr_server = irc_servers; ptr_server;
|
|
||||||
ptr_server = ptr_server->next_server)
|
|
||||||
{
|
|
||||||
FD_SET (ptr_server->sock4, &read_fd);
|
|
||||||
}
|
|
||||||
select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout);
|
|
||||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
|
||||||
{
|
|
||||||
read_keyb ();
|
|
||||||
}
|
|
||||||
for (ptr_server = irc_servers; ptr_server;
|
|
||||||
ptr_server = ptr_server->next_server)
|
|
||||||
{
|
|
||||||
if (FD_ISSET (ptr_server->sock4, &read_fd))
|
|
||||||
recv_from_server (ptr_server);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* gui_display_message: display a message on the screen
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gui_display_message (char *message)
|
|
||||||
{
|
|
||||||
printf ("%s\n", message);
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
|
||||||
* Bounga <bounga@altern.org>
|
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __WEECHAT_GUI_TEXT_H
|
|
||||||
#define __WEECHAT_GUI_TEXT_H 1
|
|
||||||
|
|
||||||
#endif /* gui-text.h */
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
|
|
||||||
OPTIONS=-Wall -W -pipe -O2
|
|
||||||
|
|
||||||
OUTPUT=irc.a
|
|
||||||
OBJS=irc-commands.o irc-display.o irc-server.o irc-channel.o irc-nick.o
|
|
||||||
DEFINES=WEE_CURSES
|
|
||||||
|
|
||||||
all: $(OBJS)
|
|
||||||
ar r $(OUTPUT) $(OBJS)
|
|
||||||
|
|
||||||
$(OBJS):
|
|
||||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.a *~ core
|
|
||||||
|
|
||||||
irc-channel.o: irc-channel.c ../weechat.h irc.h ../gui/gui.h \
|
|
||||||
../completion.h ../history.h
|
|
||||||
irc-commands.o: irc-commands.c ../weechat.h irc.h ../gui/gui.h \
|
|
||||||
../completion.h ../history.h ../command.h ../irc/irc.h ../config.h
|
|
||||||
irc-display.o: irc-display.c ../weechat.h irc.h ../gui/gui.h \
|
|
||||||
../completion.h ../history.h
|
|
||||||
irc-nick.o: irc-nick.c ../weechat.h irc.h ../gui/gui.h ../completion.h \
|
|
||||||
../history.h
|
|
||||||
irc-server.o: irc-server.c ../weechat.h irc.h ../gui/gui.h \
|
|
||||||
../completion.h ../history.h
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
noinst_LIBRARIES = lib_weechat_irc.a
|
||||||
|
|
||||||
|
lib_weechat_irc_a_SOURCES = irc.h \
|
||||||
|
irc-commands.c \
|
||||||
|
irc-send.c \
|
||||||
|
irc-recv.c \
|
||||||
|
irc-server.c \
|
||||||
|
irc-channel.c \
|
||||||
|
irc-nick.c \
|
||||||
|
irc-display.c
|
||||||
+10
-12
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,14 +17,17 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* irc-channel.c: manages a chat (channel or private chat) */
|
/* irc-channel.c: manages a chat (channel or private chat) */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../weechat.h"
|
#include "../common/weechat.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -38,13 +39,10 @@ t_irc_channel *current_channel = NULL;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
t_irc_channel *
|
t_irc_channel *
|
||||||
channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||||
|
int switch_to_window)
|
||||||
{
|
{
|
||||||
t_irc_channel *new_channel;
|
t_irc_channel *new_channel;
|
||||||
|
|
||||||
#if DEBUG >= 1
|
|
||||||
log_printf ("joining channel %s\n", channel_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* alloc memory for new channel */
|
/* alloc memory for new channel */
|
||||||
if ((new_channel = (t_irc_channel *) malloc (sizeof (t_irc_channel))) == NULL)
|
if ((new_channel = (t_irc_channel *) malloc (sizeof (t_irc_channel))) == NULL)
|
||||||
@@ -69,7 +67,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name)
|
|||||||
server->channels = new_channel;
|
server->channels = new_channel;
|
||||||
server->last_channel = new_channel;
|
server->last_channel = new_channel;
|
||||||
|
|
||||||
gui_window_new (server, new_channel);
|
gui_window_new (server, new_channel, switch_to_window);
|
||||||
|
|
||||||
/* all is ok, return address of new channel */
|
/* all is ok, return address of new channel */
|
||||||
return new_channel;
|
return new_channel;
|
||||||
|
|||||||
+114
-2779
File diff suppressed because it is too large
Load Diff
+22
-14
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,18 +17,21 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* irc-display.c: display functions for IRC */
|
/* irc-display.c: display functions for IRC */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../weechat.h"
|
#include "../common/weechat.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#include "../config.h"
|
#include "../common/weeconfig.h"
|
||||||
#include "../gui/gui.h"
|
#include "../gui/gui.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ irc_display_prefix (t_gui_window *window, char *prefix)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* irc_display_nick: display nick in chat window
|
* irc_display_nick: display nick in chat window
|
||||||
|
* if color_nick < 0 then nick is highlighted
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -89,13 +91,19 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gui_printf_color_type (window,
|
if (color_nick < 0)
|
||||||
message_type,
|
gui_printf_color_type (window,
|
||||||
(color_nick) ?
|
message_type,
|
||||||
((cfg_look_color_nicks) ?
|
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||||
nick->color : COLOR_WIN_CHAT) :
|
"%s", nick->nick);
|
||||||
COLOR_WIN_CHAT,
|
else
|
||||||
"%s", nick->nick);
|
gui_printf_color_type (window,
|
||||||
|
message_type,
|
||||||
|
(color_nick) ?
|
||||||
|
((cfg_look_color_nicks) ?
|
||||||
|
nick->color : COLOR_WIN_CHAT) :
|
||||||
|
COLOR_WIN_CHAT,
|
||||||
|
"%s", nick->nick);
|
||||||
|
|
||||||
if (display_around)
|
if (display_around)
|
||||||
gui_printf_color_type (window,
|
gui_printf_color_type (window,
|
||||||
|
|||||||
+9
-8
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,15 +17,18 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* irc-nick.c: manages nick list for channels */
|
/* irc-nick.c: manages nick list for channels */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "../weechat.h"
|
#include "../common/weechat.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -79,8 +80,8 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
|||||||
{
|
{
|
||||||
int score1, score2, comp;
|
int score1, score2, comp;
|
||||||
|
|
||||||
score1 = - ( (nick1->is_op * 3) + (nick1->is_halfop * 2) + nick1->has_voice );
|
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||||
score2 = - ( (nick2->is_op * 3) + (nick2->is_halfop * 2) + nick2->has_voice );
|
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||||
|
|
||||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||||
if (comp > 0)
|
if (comp > 0)
|
||||||
|
|||||||
+2548
File diff suppressed because it is too large
Load Diff
+1056
File diff suppressed because it is too large
Load Diff
+156
-84
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -19,10 +17,13 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* irc-server.c: (dis)connection and communication with irc server */
|
/* irc-server.c: (dis)connection and communication with irc server */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
#include "../weechat.h"
|
#include "../common/weechat.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#include "../gui/gui.h"
|
#include "../gui/gui.h"
|
||||||
|
|
||||||
@@ -49,6 +50,36 @@ t_irc_message *recv_msgq, *msgq_last_msg;
|
|||||||
char *unterminated_message = NULL;
|
char *unterminated_message = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* server_init: init server struct with default values
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
server_init (t_irc_server *server)
|
||||||
|
{
|
||||||
|
server->name = NULL;
|
||||||
|
server->autoconnect = 0;
|
||||||
|
server->address = NULL;
|
||||||
|
server->port = -1;
|
||||||
|
server->password = NULL;
|
||||||
|
server->nick1 = NULL;
|
||||||
|
server->nick2 = NULL;
|
||||||
|
server->nick3 = NULL;
|
||||||
|
server->username = NULL;
|
||||||
|
server->realname = NULL;
|
||||||
|
server->command = NULL;
|
||||||
|
server->autojoin = NULL;
|
||||||
|
server->nick = NULL;
|
||||||
|
server->is_connected = 0;
|
||||||
|
server->sock4 = -1;
|
||||||
|
server->is_away = 0;
|
||||||
|
server->server_read = -1;
|
||||||
|
server->server_write = -1;
|
||||||
|
server->window = NULL;
|
||||||
|
server->channels = NULL;
|
||||||
|
server->last_channel = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_alloc: allocate a new server and add it to the servers queue
|
* server_alloc: allocate a new server and add it to the servers queue
|
||||||
*/
|
*/
|
||||||
@@ -57,36 +88,16 @@ t_irc_server *
|
|||||||
server_alloc ()
|
server_alloc ()
|
||||||
{
|
{
|
||||||
t_irc_server *new_server;
|
t_irc_server *new_server;
|
||||||
|
|
||||||
#if DEBUG >= 1
|
|
||||||
log_printf ("allocating new server\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* alloc memory for new server */
|
/* alloc memory for new server */
|
||||||
if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL)
|
if ((new_server = (t_irc_server *) malloc (sizeof (t_irc_server))) == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, _("%s cannot allocate new server"), WEECHAT_ERROR);
|
fprintf (stderr, _("%s cannot allocate new server\n"), WEECHAT_ERROR);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize new server */
|
/* initialize new server */
|
||||||
new_server->name = NULL;
|
server_init (new_server);
|
||||||
new_server->address = NULL;
|
|
||||||
new_server->password = NULL;
|
|
||||||
new_server->nick1 = NULL;
|
|
||||||
new_server->nick2 = NULL;
|
|
||||||
new_server->nick3 = NULL;
|
|
||||||
new_server->username = NULL;
|
|
||||||
new_server->realname = NULL;
|
|
||||||
new_server->nick = NULL;
|
|
||||||
new_server->is_connected = 0;
|
|
||||||
new_server->sock4 = -1;
|
|
||||||
new_server->is_away = 0;
|
|
||||||
new_server->server_read = -1;
|
|
||||||
new_server->server_write = -1;
|
|
||||||
new_server->window = NULL;
|
|
||||||
new_server->channels = NULL;
|
|
||||||
new_server->last_channel = NULL;
|
|
||||||
|
|
||||||
/* add new server to queue */
|
/* add new server to queue */
|
||||||
new_server->prev_server = last_irc_server;
|
new_server->prev_server = last_irc_server;
|
||||||
@@ -102,42 +113,12 @@ server_alloc ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_create_window: create windows for a server
|
* server_destroy: free server data (not struct himself)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
server_create_window (t_irc_server *server)
|
server_destroy (t_irc_server *server)
|
||||||
{
|
{
|
||||||
if (!SERVER(gui_windows))
|
|
||||||
{
|
|
||||||
server->window = gui_windows;
|
|
||||||
SERVER(gui_windows) = server;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gui_window_new (server, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* server_free: free a server and remove it from servers queue
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
server_free (t_irc_server *server)
|
|
||||||
{
|
|
||||||
t_irc_server *new_irc_servers;
|
|
||||||
|
|
||||||
/* remove server from queue */
|
|
||||||
if (server->prev_server)
|
|
||||||
{
|
|
||||||
(server->prev_server)->next_server = server->next_server;
|
|
||||||
new_irc_servers = irc_servers;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
new_irc_servers = server->next_server;
|
|
||||||
|
|
||||||
if (server->next_server)
|
|
||||||
(server->next_server)->prev_server = server->prev_server;
|
|
||||||
|
|
||||||
/* free data */
|
/* free data */
|
||||||
if (server->name)
|
if (server->name)
|
||||||
free (server->name);
|
free (server->name);
|
||||||
@@ -155,12 +136,42 @@ server_free (t_irc_server *server)
|
|||||||
free (server->username);
|
free (server->username);
|
||||||
if (server->realname)
|
if (server->realname)
|
||||||
free (server->realname);
|
free (server->realname);
|
||||||
|
if (server->command)
|
||||||
|
free (server->command);
|
||||||
|
if (server->autojoin)
|
||||||
|
free (server->autojoin);
|
||||||
if (server->nick)
|
if (server->nick)
|
||||||
free (server->nick);
|
free (server->nick);
|
||||||
if (server->channels)
|
if (server->channels)
|
||||||
channel_free_all (server);
|
channel_free_all (server);
|
||||||
/* TODO: free weechat window (???) */
|
}
|
||||||
/* (...) */
|
|
||||||
|
/*
|
||||||
|
* server_free: free a server and remove it from servers queue
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
server_free (t_irc_server *server)
|
||||||
|
{
|
||||||
|
t_irc_server *new_irc_servers;
|
||||||
|
|
||||||
|
/* remove server from queue */
|
||||||
|
if (last_irc_server == server)
|
||||||
|
last_irc_server = server->prev_server;
|
||||||
|
if (server->prev_server)
|
||||||
|
{
|
||||||
|
(server->prev_server)->next_server = server->next_server;
|
||||||
|
new_irc_servers = irc_servers;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_irc_servers = server->next_server;
|
||||||
|
|
||||||
|
if (server->next_server)
|
||||||
|
(server->next_server)->prev_server = server->prev_server;
|
||||||
|
|
||||||
|
server_destroy (server);
|
||||||
|
if (server->window)
|
||||||
|
gui_window_free (server->window);
|
||||||
free (server);
|
free (server);
|
||||||
irc_servers = new_irc_servers;
|
irc_servers = new_irc_servers;
|
||||||
}
|
}
|
||||||
@@ -182,26 +193,29 @@ server_free_all ()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
t_irc_server *
|
t_irc_server *
|
||||||
server_new (char *name, char *address, int port, char *password,
|
server_new (char *name, int autoconnect, char *address, int port,
|
||||||
char *nick1, char *nick2, char *nick3,
|
char *password, char *nick1, char *nick2, char *nick3,
|
||||||
char *username, char *realname)
|
char *username, char *realname, char *command, char *autojoin)
|
||||||
{
|
{
|
||||||
t_irc_server *new_server;
|
t_irc_server *new_server;
|
||||||
|
|
||||||
if (!name || !address || (port < 0) || !nick1 || !nick2 || !nick3
|
if (!name || !address || (port < 0))
|
||||||
|| !username || !realname)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if DEBUG >= 1
|
#ifdef DEBUG
|
||||||
log_printf ("creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
wee_log_printf ("creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s)\n",
|
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||||
name, address, port, password, nick1, nick2, nick3,
|
"command:%s, autojoin:%s)\n",
|
||||||
username, realname);
|
name, address, port, (password) ? password : "",
|
||||||
|
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||||
|
(username) ? username : "", (realname) ? realname : "",
|
||||||
|
(command) ? command : "", (autojoin) ? autojoin : "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((new_server = server_alloc ()))
|
if ((new_server = server_alloc ()))
|
||||||
{
|
{
|
||||||
new_server->name = strdup (name);
|
new_server->name = strdup (name);
|
||||||
|
new_server->autoconnect = autoconnect;
|
||||||
new_server->address = strdup (address);
|
new_server->address = strdup (address);
|
||||||
new_server->port = port;
|
new_server->port = port;
|
||||||
new_server->password = (password) ? strdup (password) : strdup ("");
|
new_server->password = (password) ? strdup (password) : strdup ("");
|
||||||
@@ -212,6 +226,10 @@ server_new (char *name, char *address, int port, char *password,
|
|||||||
(username) ? strdup (username) : strdup ("weechat");
|
(username) ? strdup (username) : strdup ("weechat");
|
||||||
new_server->realname =
|
new_server->realname =
|
||||||
(realname) ? strdup (realname) : strdup ("realname");
|
(realname) ? strdup (realname) : strdup ("realname");
|
||||||
|
new_server->command =
|
||||||
|
(command) ? strdup (command) : NULL;
|
||||||
|
new_server->autojoin =
|
||||||
|
(autojoin) ? strdup (autojoin) : NULL;
|
||||||
new_server->nick = strdup (new_server->nick1);
|
new_server->nick = strdup (new_server->nick1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -257,7 +275,7 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
|||||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||||
size_buf = strlen (buffer);
|
size_buf = strlen (buffer);
|
||||||
buffer[size_buf - 2] = '\0';
|
buffer[size_buf - 2] = '\0';
|
||||||
#if DEBUG >= 2
|
#ifdef DEBUG
|
||||||
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
|
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||||
#endif
|
#endif
|
||||||
buffer[size_buf - 2] = '\r';
|
buffer[size_buf - 2] = '\r';
|
||||||
@@ -346,24 +364,25 @@ server_msgq_flush ()
|
|||||||
t_irc_message *next;
|
t_irc_message *next;
|
||||||
/*char **argv;
|
/*char **argv;
|
||||||
int argc;*/
|
int argc;*/
|
||||||
char *ptr_data, *pos, *pos2;
|
char *entire_line, *ptr_data, *pos, *pos2;
|
||||||
char *host, *command, *args;
|
char *host, *command, *args;
|
||||||
|
|
||||||
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
|
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
|
||||||
while (recv_msgq)
|
while (recv_msgq)
|
||||||
{
|
{
|
||||||
#if DEBUG >= 2
|
#ifdef DEBUG
|
||||||
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
|
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ptr_data = recv_msgq->data;
|
ptr_data = recv_msgq->data;
|
||||||
|
entire_line = strdup (ptr_data);
|
||||||
|
|
||||||
while (ptr_data[0] == ' ')
|
while (ptr_data[0] == ' ')
|
||||||
ptr_data++;
|
ptr_data++;
|
||||||
|
|
||||||
if (ptr_data)
|
if (ptr_data)
|
||||||
{
|
{
|
||||||
#if DEBUG >= 2
|
#ifdef DEBUG
|
||||||
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
|
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -397,7 +416,8 @@ server_msgq_flush ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (irc_recv_command (recv_msgq->server, host, command, args))
|
switch (irc_recv_command (recv_msgq->server, entire_line, host,
|
||||||
|
command, args))
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
gui_printf (recv_msgq->server->window,
|
gui_printf (recv_msgq->server->window,
|
||||||
@@ -415,6 +435,7 @@ server_msgq_flush ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free (entire_line);
|
||||||
free (recv_msgq->data);
|
free (recv_msgq->data);
|
||||||
next = recv_msgq->next_message;
|
next = recv_msgq->next_message;
|
||||||
free (recv_msgq);
|
free (recv_msgq);
|
||||||
@@ -444,7 +465,7 @@ server_recv (t_irc_server *server)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_connect: connect to an irc server
|
* server_connect: connect to an IRC server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -458,10 +479,10 @@ server_connect (t_irc_server *server)
|
|||||||
int server_pipe[2];
|
int server_pipe[2];
|
||||||
|
|
||||||
gui_printf (server->window,
|
gui_printf (server->window,
|
||||||
_(WEECHAT_NAME ": connecting to %s:%d...\n"),
|
_("%s: connecting to %s:%d...\n"),
|
||||||
server->address, server->port);
|
PACKAGE_NAME, server->address, server->port);
|
||||||
log_printf ("connecting to server %s:%d...\n",
|
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||||
server->address, server->port);
|
server->address, server->port);
|
||||||
server->is_connected = 0;
|
server->is_connected = 0;
|
||||||
|
|
||||||
/* create pipe */
|
/* create pipe */
|
||||||
@@ -482,7 +503,7 @@ server_connect (t_irc_server *server)
|
|||||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||||
sizeof (set)) == -1)
|
sizeof (set)) == -1)
|
||||||
gui_printf (server->window,
|
gui_printf (server->window,
|
||||||
_("%s cannot set socket option 'SO_REUSEADDR'\n"),
|
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||||
WEECHAT_ERROR);
|
WEECHAT_ERROR);
|
||||||
set = 1;
|
set = 1;
|
||||||
if (setsockopt
|
if (setsockopt
|
||||||
@@ -530,7 +551,7 @@ server_connect (t_irc_server *server)
|
|||||||
|
|
||||||
/* connection to server */
|
/* connection to server */
|
||||||
gui_printf (server->window,
|
gui_printf (server->window,
|
||||||
_(WEECHAT_NAME ": server IP is: %s\n"), ip_address);
|
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||||
|
|
||||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
@@ -548,6 +569,27 @@ server_connect (t_irc_server *server)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* server_auto_connect: auto-connect to servers (called at startup)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
server_auto_connect ()
|
||||||
|
{
|
||||||
|
t_irc_server *ptr_server;
|
||||||
|
|
||||||
|
for (ptr_server = irc_servers; ptr_server;
|
||||||
|
ptr_server = ptr_server->next_server)
|
||||||
|
{
|
||||||
|
if (ptr_server->autoconnect)
|
||||||
|
{
|
||||||
|
gui_window_new (ptr_server, NULL, 1);
|
||||||
|
if (server_connect (ptr_server))
|
||||||
|
irc_login (ptr_server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_disconnect: disconnect from an irc server
|
* server_disconnect: disconnect from an irc server
|
||||||
*/
|
*/
|
||||||
@@ -555,12 +597,24 @@ server_connect (t_irc_server *server)
|
|||||||
void
|
void
|
||||||
server_disconnect (t_irc_server *server)
|
server_disconnect (t_irc_server *server)
|
||||||
{
|
{
|
||||||
|
t_irc_channel *ptr_channel;
|
||||||
|
|
||||||
if (server->is_connected)
|
if (server->is_connected)
|
||||||
{
|
{
|
||||||
|
/* write disconnection message on each channel/private window */
|
||||||
|
for (ptr_channel = server->channels; ptr_channel;
|
||||||
|
ptr_channel = ptr_channel->next_channel)
|
||||||
|
{
|
||||||
|
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
|
||||||
|
gui_printf (ptr_channel->window, _("Disconnected from server!\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close communication with server */
|
||||||
close (server->server_read);
|
close (server->server_read);
|
||||||
close (server->server_write);
|
close (server->server_write);
|
||||||
close (server->sock4);
|
close (server->sock4);
|
||||||
server->is_connected = 0;
|
server->is_connected = 0;
|
||||||
|
server->sock4 = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,6 +631,24 @@ server_disconnect_all ()
|
|||||||
server_disconnect (ptr_server);
|
server_disconnect (ptr_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* server_search: return pointer on a server with a name
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_irc_server *
|
||||||
|
server_search (char *servername)
|
||||||
|
{
|
||||||
|
t_irc_server *ptr_server;
|
||||||
|
|
||||||
|
for (ptr_server = irc_servers; ptr_server;
|
||||||
|
ptr_server = ptr_server->next_server)
|
||||||
|
{
|
||||||
|
if (strcmp (ptr_server->name, servername) == 0)
|
||||||
|
return ptr_server;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* server_get_number_connected: returns number of connected server
|
* server_get_number_connected: returns number of connected server
|
||||||
*/
|
*/
|
||||||
|
|||||||
+46
-12
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -32,6 +30,7 @@
|
|||||||
#define PREFIX_PART "<--"
|
#define PREFIX_PART "<--"
|
||||||
#define PREFIX_QUIT "<--"
|
#define PREFIX_QUIT "<--"
|
||||||
#define PREFIX_ERROR "=!="
|
#define PREFIX_ERROR "=!="
|
||||||
|
#define PREFIX_PLUGIN "-P-"
|
||||||
|
|
||||||
#define CHANNEL_PREFIX "#&+!"
|
#define CHANNEL_PREFIX "#&+!"
|
||||||
|
|
||||||
@@ -78,6 +77,7 @@ struct t_irc_server
|
|||||||
{
|
{
|
||||||
/* user choices */
|
/* user choices */
|
||||||
char *name; /* name of server (only for display) */
|
char *name; /* name of server (only for display) */
|
||||||
|
int autoconnect; /* = 1 if auto connect at startup */
|
||||||
char *address; /* address of server (IP or name) */
|
char *address; /* address of server (IP or name) */
|
||||||
int port; /* port for server (6667 by default) */
|
int port; /* port for server (6667 by default) */
|
||||||
char *password; /* password for server */
|
char *password; /* password for server */
|
||||||
@@ -86,6 +86,8 @@ struct t_irc_server
|
|||||||
char *nick3; /* 2nd alternate nickname */
|
char *nick3; /* 2nd alternate nickname */
|
||||||
char *username; /* user name */
|
char *username; /* user name */
|
||||||
char *realname; /* real name */
|
char *realname; /* real name */
|
||||||
|
char *command; /* command to run once connected */
|
||||||
|
char *autojoin; /* channels to automatically join */
|
||||||
|
|
||||||
/* internal vars */
|
/* internal vars */
|
||||||
char *nick; /* current nickname */
|
char *nick; /* current nickname */
|
||||||
@@ -137,24 +139,27 @@ extern t_irc_channel *current_channel;
|
|||||||
|
|
||||||
/* server functions (irc-server.c) */
|
/* server functions (irc-server.c) */
|
||||||
|
|
||||||
|
extern void server_init (t_irc_server *);
|
||||||
extern t_irc_server *server_alloc ();
|
extern t_irc_server *server_alloc ();
|
||||||
extern void server_create_window (t_irc_server *);
|
extern void server_destroy (t_irc_server *);
|
||||||
extern void server_free (t_irc_server *);
|
extern void server_free (t_irc_server *);
|
||||||
extern void server_free_all ();
|
extern void server_free_all ();
|
||||||
extern t_irc_server *server_new (char *, char *, int, char *, char *, char *,
|
extern t_irc_server *server_new (char *, int, char *, int, char *, char *,
|
||||||
char *, char *, char *);
|
char *, char *, char *, char *, char *, char *);
|
||||||
extern int server_send (t_irc_server *, char *, int);
|
extern int server_send (t_irc_server *, char *, int);
|
||||||
extern int server_sendf (t_irc_server *, char *, ...);
|
extern int server_sendf (t_irc_server *, char *, ...);
|
||||||
extern void server_recv (t_irc_server *);
|
extern void server_recv (t_irc_server *);
|
||||||
extern int server_connect ();
|
extern int server_connect ();
|
||||||
|
extern void server_auto_connect ();
|
||||||
extern void server_disconnect (t_irc_server *);
|
extern void server_disconnect (t_irc_server *);
|
||||||
extern void server_disconnect_all ();
|
extern void server_disconnect_all ();
|
||||||
|
extern t_irc_server *server_search (char *);
|
||||||
extern int server_get_number_connected ();
|
extern int server_get_number_connected ();
|
||||||
extern int server_name_already_exists (char *);
|
extern int server_name_already_exists (char *);
|
||||||
|
|
||||||
/* channel functions (irc-channel.c) */
|
/* channel functions (irc-channel.c) */
|
||||||
|
|
||||||
extern t_irc_channel *channel_new (t_irc_server *, int, char *);
|
extern t_irc_channel *channel_new (t_irc_server *, int, char *, int);
|
||||||
extern void channel_free (t_irc_server *, t_irc_channel *);
|
extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||||
extern void channel_free_all (t_irc_server *);
|
extern void channel_free_all (t_irc_server *);
|
||||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||||
@@ -180,35 +185,57 @@ extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
|||||||
|
|
||||||
/* IRC protocol (irc-commands.c) */
|
/* IRC protocol (irc-commands.c) */
|
||||||
|
|
||||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *);
|
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||||
extern void irc_login (t_irc_server *);
|
extern void irc_login (t_irc_server *);
|
||||||
/* IRC commands issued by user */
|
/* IRC commands issued by user */
|
||||||
|
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_away (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_deop (t_irc_server *, int, 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_devoice (t_irc_server *, int, char **);
|
||||||
|
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_info (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_ison (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_join (t_irc_server *, char *);
|
extern int irc_cmd_send_join (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_links (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_list (t_irc_server *, char *);
|
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_me (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_mode (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_msg (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_motd (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_names (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_nick (t_irc_server *, int, char **);
|
||||||
extern int irc_cmd_send_notice (t_irc_server *, char *);
|
extern int irc_cmd_send_notice (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_op (t_irc_server *, int, char **);
|
extern int irc_cmd_send_op (t_irc_server *, int, char **);
|
||||||
extern int irc_cmd_send_oper (t_irc_server *, int, char **);
|
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_part (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_ping (t_irc_server *, int, char **);
|
extern int irc_cmd_send_ping (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_pong (t_irc_server *, int, char **);
|
extern int irc_cmd_send_pong (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_quit (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_quote (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_rehash (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_restart (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_service (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_servlist (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_squery (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_squit (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_stats (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_summon (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_time (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_trace (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_userhost (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_users (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_version (t_irc_server *, char *);
|
extern int irc_cmd_send_version (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_voice (t_irc_server *, int, char **);
|
extern int irc_cmd_send_voice (t_irc_server *, int, char **);
|
||||||
|
extern int irc_cmd_send_wallops (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||||
|
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||||
/* IRC commands executed when received from server */
|
/* IRC commands executed when received from server */
|
||||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
||||||
@@ -226,9 +253,14 @@ extern int irc_cmd_recv_topic (t_irc_server *, char *, char *);
|
|||||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
|
||||||
@@ -240,7 +272,9 @@ 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_332 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
|
||||||
|
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
|
||||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
|
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,23 +15,22 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
CC=gcc
|
if PLUGIN_PERL
|
||||||
|
perl_dir = perl
|
||||||
|
endif
|
||||||
|
|
||||||
OPTIONS=-Wall -W -pipe -O2
|
# if PLUGIN_PYTHON
|
||||||
|
# python_dir = python
|
||||||
|
# endif
|
||||||
|
|
||||||
OUTPUT=../gui.a
|
# if PLUGIN_RUBY
|
||||||
OBJS=gui-display.o gui-input.o
|
# ruby_dir = ruby
|
||||||
DEFINES=WEE_QT
|
# endif
|
||||||
|
|
||||||
all: $(OBJS)
|
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
|
||||||
ar r $(OUTPUT) $(OBJS)
|
SUBDIRS = $(perl_dir)
|
||||||
|
|
||||||
$(OBJS):
|
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||||
$(CC) $(OPTIONS) -o $@ -c $< $(INCLUDES) -D$(DEFINES)
|
|
||||||
|
|
||||||
clean:
|
lib_weechat_plugins_a_SOURCES = plugins.h \
|
||||||
rm -f *.o *.a *~ core
|
plugins.c
|
||||||
|
|
||||||
gui-display.o: gui-display.c ../../weechat.h ../gui.h ../../config.h \
|
|
||||||
../../irc/irc.h ../../gui/gui.h
|
|
||||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
|
||||||
+4
-2
@@ -2,8 +2,10 @@ WeeChat - Wee Enhanced Environment for Chat
|
|||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
This is plugins directory for WeeChat.
|
This is plugins directory for WeeChat.
|
||||||
In the future, you'll find there interfaces with many famous languages for
|
|
||||||
|
Today, Perl interface is developed.
|
||||||
|
|
||||||
|
In the future, you'll find there interfaces with other famous languages for
|
||||||
writing extensions to WeeChat:
|
writing extensions to WeeChat:
|
||||||
- Perl interface,
|
|
||||||
- Python interface,
|
- Python interface,
|
||||||
- Ruby interface.
|
- Ruby interface.
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
INCLUDES = $(PERL_CFLAGS)
|
||||||
|
|
||||||
|
noinst_LIBRARIES = lib_weechat_perl.a
|
||||||
|
|
||||||
|
lib_weechat_perl_a_SOURCES = wee-perl.h \
|
||||||
|
wee-perl.c
|
||||||
@@ -0,0 +1,553 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* wee-perl.c: Perl plugin support for WeeChat */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <EXTERN.h>
|
||||||
|
#include <perl.h>
|
||||||
|
#include <XSUB.h>
|
||||||
|
#include "../../common/weechat.h"
|
||||||
|
#include "../plugins.h"
|
||||||
|
#include "wee-perl.h"
|
||||||
|
#include "../../common/command.h"
|
||||||
|
#include "../../irc/irc.h"
|
||||||
|
#include "../../gui/gui.h"
|
||||||
|
|
||||||
|
|
||||||
|
static PerlInterpreter *my_perl = NULL;
|
||||||
|
|
||||||
|
t_plugin_script *perl_scripts = NULL;
|
||||||
|
t_plugin_script *last_perl_script = NULL;
|
||||||
|
|
||||||
|
extern void boot_DynaLoader (pTHX_ CV* cv);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::register: startup function for all WeeChat Perl scripts
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_register)
|
||||||
|
{
|
||||||
|
char *name, *version, *shutdown_func, *description;
|
||||||
|
int integer;
|
||||||
|
t_plugin_script *ptr_perl_script, *perl_script_found, *new_perl_script;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) items;
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
name = SvPV (ST (0), integer);
|
||||||
|
version = SvPV (ST (1), integer);
|
||||||
|
shutdown_func = SvPV (ST (2), integer);
|
||||||
|
description = SvPV (ST (3), integer);
|
||||||
|
|
||||||
|
perl_script_found = NULL;
|
||||||
|
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||||
|
ptr_perl_script = ptr_perl_script->next_script)
|
||||||
|
{
|
||||||
|
if (strcasecmp (ptr_perl_script->name, name) == 0)
|
||||||
|
{
|
||||||
|
perl_script_found = ptr_perl_script;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perl_script_found)
|
||||||
|
{
|
||||||
|
/* error: another scripts already exists with this name! */
|
||||||
|
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("Perl error: unable to register Perl script \"%s\" (another script "
|
||||||
|
"already exists with this name)\n"),
|
||||||
|
name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* registering script */
|
||||||
|
new_perl_script = (t_plugin_script *)malloc (sizeof (t_plugin_script));
|
||||||
|
if (new_perl_script)
|
||||||
|
{
|
||||||
|
new_perl_script->name = strdup (name);
|
||||||
|
new_perl_script->version = strdup (version);
|
||||||
|
new_perl_script->shutdown_func = strdup (shutdown_func);
|
||||||
|
new_perl_script->description = strdup (description);
|
||||||
|
|
||||||
|
/* add new script to list */
|
||||||
|
new_perl_script->prev_script = last_perl_script;
|
||||||
|
new_perl_script->next_script = NULL;
|
||||||
|
if (perl_scripts)
|
||||||
|
last_perl_script->next_script = new_perl_script;
|
||||||
|
else
|
||||||
|
perl_scripts = new_perl_script;
|
||||||
|
last_perl_script = new_perl_script;
|
||||||
|
|
||||||
|
wee_log_printf (_("registered Perl script: \"%s\", version %s (%s)\n"),
|
||||||
|
name, version, description);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s unable to load Perl script \"%s\" (not enough memory)\n"),
|
||||||
|
WEECHAT_ERROR, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XST_mPV (0, VERSION);
|
||||||
|
XSRETURN (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::print: print message to current window
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_print)
|
||||||
|
{
|
||||||
|
int i, integer;
|
||||||
|
char *message;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
for (i = 0; i < items; i++)
|
||||||
|
{
|
||||||
|
message = SvPV (ST (i), integer);
|
||||||
|
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||||
|
gui_printf (gui_current_window, "%s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::print_with_channel: print message to a specific channel/server
|
||||||
|
* (server is optional)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_print_with_channel)
|
||||||
|
{
|
||||||
|
int integer;
|
||||||
|
char *message, *channel, *server = NULL;
|
||||||
|
t_gui_window *ptr_window;
|
||||||
|
t_irc_server *ptr_server;
|
||||||
|
t_irc_channel *ptr_channel;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
/* server specified */
|
||||||
|
if (items > 2)
|
||||||
|
{
|
||||||
|
server = SvPV (ST (2), integer);
|
||||||
|
if (!server[0])
|
||||||
|
server = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* look for window for printing message */
|
||||||
|
channel = SvPV (ST (1), integer);
|
||||||
|
ptr_window = NULL;
|
||||||
|
for (ptr_server = irc_servers; ptr_server;
|
||||||
|
ptr_server = ptr_server->next_server)
|
||||||
|
{
|
||||||
|
if (!server || (strcasecmp (ptr_server->name, server)) == 0)
|
||||||
|
{
|
||||||
|
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||||
|
ptr_channel = ptr_channel->next_channel)
|
||||||
|
{
|
||||||
|
if (strcasecmp (ptr_channel->name, channel) == 0)
|
||||||
|
{
|
||||||
|
ptr_window = ptr_channel->window;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ptr_window)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* window found => display message & return 1 */
|
||||||
|
if (ptr_window)
|
||||||
|
{
|
||||||
|
message = SvPV (ST (0), integer);
|
||||||
|
irc_display_prefix (ptr_window, PREFIX_PLUGIN);
|
||||||
|
gui_printf (ptr_window, "%s", message);
|
||||||
|
XSRETURN_YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no window found => return 0 */
|
||||||
|
XSRETURN_NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::add_message_handler: add handler for messages (privmsg, ...)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_add_message_handler)
|
||||||
|
{
|
||||||
|
char *name, *function;
|
||||||
|
int integer;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) items;
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
name = SvPV (ST (0), integer);
|
||||||
|
function = SvPV (ST (1), integer);
|
||||||
|
plugin_handler_add (&plugin_msg_handlers, &last_plugin_msg_handler,
|
||||||
|
PLUGIN_TYPE_PERL, name, function);
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::add_command_handler: add command handler (define/redefine commands)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_add_command_handler)
|
||||||
|
{
|
||||||
|
char *name, *function;
|
||||||
|
int integer;
|
||||||
|
t_plugin_handler *ptr_plugin_handler;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) items;
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
name = SvPV (ST (0), integer);
|
||||||
|
function = SvPV (ST (1), integer);
|
||||||
|
if (!index_command_search (name))
|
||||||
|
index_command_new (name);
|
||||||
|
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||||
|
if (ptr_plugin_handler)
|
||||||
|
{
|
||||||
|
free (ptr_plugin_handler->function_name);
|
||||||
|
ptr_plugin_handler->function_name = strdup (function);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||||
|
PLUGIN_TYPE_PERL, name, function);
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRC::get_info: get various infos
|
||||||
|
*/
|
||||||
|
|
||||||
|
static XS (XS_IRC_get_info)
|
||||||
|
{
|
||||||
|
char *arg, *info = NULL;
|
||||||
|
int integer;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) items;
|
||||||
|
(void) cv;
|
||||||
|
|
||||||
|
arg = SvPV (ST (0), integer);
|
||||||
|
|
||||||
|
if (arg)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) )
|
||||||
|
{
|
||||||
|
info = PACKAGE_STRING;
|
||||||
|
}
|
||||||
|
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
|
||||||
|
{
|
||||||
|
info = current_irc_server->nick;
|
||||||
|
}
|
||||||
|
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||||
|
{
|
||||||
|
if (WIN_IS_CHANNEL (gui_current_window))
|
||||||
|
info = CHANNEL (gui_current_window)->name;
|
||||||
|
}
|
||||||
|
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
|
||||||
|
{
|
||||||
|
info = current_irc_server->name;
|
||||||
|
}
|
||||||
|
else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) )
|
||||||
|
{
|
||||||
|
info = weechat_home;
|
||||||
|
}
|
||||||
|
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
|
||||||
|
{
|
||||||
|
XST_mIV (0, current_irc_server->is_away);
|
||||||
|
XSRETURN (1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info)
|
||||||
|
XST_mPV (0, info);
|
||||||
|
else
|
||||||
|
XST_mPV (0, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
XSRETURN (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xs_init: initialize subroutines
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
xs_init (pTHX)
|
||||||
|
{
|
||||||
|
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
|
||||||
|
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::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");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_init: initialize Perl interface for WeeChat
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_perl_init ()
|
||||||
|
{
|
||||||
|
char *perl_args[] = { "", "-e", "0" };
|
||||||
|
/* Following Perl code is extracted/modified from X-Chat IRC client */
|
||||||
|
/* X-Chat is (c) 1998-2002 Peter Zelezny */
|
||||||
|
char *weechat_perl_func =
|
||||||
|
{
|
||||||
|
"sub wee_perl_load_file"
|
||||||
|
"{"
|
||||||
|
" my $filename = shift;"
|
||||||
|
" local $/ = undef;"
|
||||||
|
" open FILE, $filename or return \"__WEECHAT_ERROR__\";"
|
||||||
|
" $_ = <FILE>;"
|
||||||
|
" close FILE;"
|
||||||
|
" return $_;"
|
||||||
|
"}"
|
||||||
|
"sub wee_perl_load_eval_file"
|
||||||
|
"{"
|
||||||
|
" my $filename = shift;"
|
||||||
|
" my $content = wee_perl_load_file ($filename);"
|
||||||
|
" if ($content eq \"__WEECHAT_ERROR__\")"
|
||||||
|
" {"
|
||||||
|
" IRC::print \"" WEECHAT_ERROR " Perl script '$filename' not found.\\n\";"
|
||||||
|
" return 1;"
|
||||||
|
" }"
|
||||||
|
" eval $content;"
|
||||||
|
" if ($@)"
|
||||||
|
" {"
|
||||||
|
" IRC::print \"" WEECHAT_ERROR " unable to load Perl script '$filename':\\n\";"
|
||||||
|
" IRC::print \"$@\\n\";"
|
||||||
|
" return 2;"
|
||||||
|
" }"
|
||||||
|
" return 0;"
|
||||||
|
"}"
|
||||||
|
"$SIG{__WARN__} = sub { IRC::print \"$_[0]\n\"; };"
|
||||||
|
};
|
||||||
|
|
||||||
|
my_perl = perl_alloc ();
|
||||||
|
perl_construct (my_perl);
|
||||||
|
perl_parse (my_perl, xs_init, 3, perl_args, NULL);
|
||||||
|
eval_pv (weechat_perl_func, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_search: search a (loaded) Perl script by name
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_plugin_script *
|
||||||
|
wee_perl_search (char *name)
|
||||||
|
{
|
||||||
|
t_plugin_script *ptr_perl_script;
|
||||||
|
|
||||||
|
for (ptr_perl_script = perl_scripts; ptr_perl_script;
|
||||||
|
ptr_perl_script = ptr_perl_script->next_script)
|
||||||
|
{
|
||||||
|
if (strcmp (ptr_perl_script->name, name) == 0)
|
||||||
|
return ptr_perl_script;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* script not found */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_exec: execute a Perl script
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
wee_perl_exec (char *function, char *arguments)
|
||||||
|
{
|
||||||
|
char *argv[2];
|
||||||
|
int count, return_code;
|
||||||
|
SV *sv;
|
||||||
|
|
||||||
|
/* call Perl function */
|
||||||
|
dSP;
|
||||||
|
ENTER;
|
||||||
|
SAVETMPS;
|
||||||
|
PUSHMARK(sp);
|
||||||
|
argv[0] = arguments;
|
||||||
|
argv[1] = NULL;
|
||||||
|
count = perl_call_argv (function, G_EVAL | G_SCALAR, argv);
|
||||||
|
SPAGAIN;
|
||||||
|
|
||||||
|
/* check if ok */
|
||||||
|
sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV));
|
||||||
|
return_code = 1;
|
||||||
|
if (SvTRUE (sv))
|
||||||
|
{
|
||||||
|
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("Perl error: %s\n"),
|
||||||
|
SvPV (sv, count));
|
||||||
|
POPs;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count != 1)
|
||||||
|
{
|
||||||
|
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("Perl error: too much values from \"%s\" (%d). Expected: 1.\n"),
|
||||||
|
function, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return_code = POPi;
|
||||||
|
}
|
||||||
|
|
||||||
|
PUTBACK;
|
||||||
|
FREETMPS;
|
||||||
|
LEAVE;
|
||||||
|
|
||||||
|
return return_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_load: load a Perl script
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
wee_perl_load (char *filename)
|
||||||
|
{
|
||||||
|
/* execute Perl script */
|
||||||
|
wee_log_printf (_("loading Perl script \"%s\"\n"), filename);
|
||||||
|
return wee_perl_exec ("wee_perl_load_eval_file", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_script_free: free a Perl script
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_perl_script_free (t_plugin_script *ptr_perl_script)
|
||||||
|
{
|
||||||
|
t_plugin_script *new_perl_scripts;
|
||||||
|
|
||||||
|
/* remove script from list */
|
||||||
|
if (last_perl_script == ptr_perl_script)
|
||||||
|
last_perl_script = ptr_perl_script->prev_script;
|
||||||
|
if (ptr_perl_script->prev_script)
|
||||||
|
{
|
||||||
|
(ptr_perl_script->prev_script)->next_script = ptr_perl_script->next_script;
|
||||||
|
new_perl_scripts = perl_scripts;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_perl_scripts = ptr_perl_script->next_script;
|
||||||
|
|
||||||
|
if (ptr_perl_script->next_script)
|
||||||
|
(ptr_perl_script->next_script)->prev_script = ptr_perl_script->prev_script;
|
||||||
|
|
||||||
|
/* free data */
|
||||||
|
if (ptr_perl_script->name)
|
||||||
|
free (ptr_perl_script->name);
|
||||||
|
if (ptr_perl_script->version)
|
||||||
|
free (ptr_perl_script->version);
|
||||||
|
if (ptr_perl_script->shutdown_func)
|
||||||
|
free (ptr_perl_script->shutdown_func);
|
||||||
|
if (ptr_perl_script->description)
|
||||||
|
free (ptr_perl_script->description);
|
||||||
|
free (ptr_perl_script);
|
||||||
|
perl_scripts = new_perl_scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_unload: unload a Perl script
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_perl_unload (t_plugin_script *ptr_perl_script)
|
||||||
|
{
|
||||||
|
if (ptr_perl_script)
|
||||||
|
{
|
||||||
|
wee_log_printf (_("unloading Perl script \"%s\"\n"),
|
||||||
|
ptr_perl_script->name);
|
||||||
|
|
||||||
|
/* call shutdown callback function */
|
||||||
|
if (ptr_perl_script->shutdown_func[0])
|
||||||
|
wee_perl_exec (ptr_perl_script->shutdown_func, "");
|
||||||
|
wee_perl_script_free (ptr_perl_script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_unload_all: unload all Perl scripts
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_perl_unload_all ()
|
||||||
|
{
|
||||||
|
wee_log_printf (_("unloading all Perl scripts...\n"));
|
||||||
|
while (perl_scripts)
|
||||||
|
wee_perl_unload (perl_scripts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wee_perl_end: shutdown Perl interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
wee_perl_end ()
|
||||||
|
{
|
||||||
|
/* unload all scripts */
|
||||||
|
wee_perl_unload_all ();
|
||||||
|
|
||||||
|
/* free all handlers */
|
||||||
|
plugin_handler_free_all_type (&plugin_msg_handlers,
|
||||||
|
&last_plugin_msg_handler,
|
||||||
|
PLUGIN_TYPE_PERL);
|
||||||
|
plugin_handler_free_all_type (&plugin_cmd_handlers,
|
||||||
|
&last_plugin_cmd_handler,
|
||||||
|
PLUGIN_TYPE_PERL);
|
||||||
|
|
||||||
|
/* free Perl interpreter */
|
||||||
|
if (my_perl)
|
||||||
|
{
|
||||||
|
perl_destruct (my_perl);
|
||||||
|
perl_free (my_perl);
|
||||||
|
my_perl = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
* Bounga <bounga@altern.org>
|
* See README for License detail, AUTHORS for developers list.
|
||||||
* Xahlexx <xahlexx@tuxisland.org>
|
|
||||||
* See README for License detail.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* gui-gtk.c: Gtk+ GUI for WeeChat */
|
#ifndef __WEECHAT_PERL_H
|
||||||
|
#define __WEECHAT_PERL_H 1
|
||||||
|
|
||||||
|
#include "../plugins.h"
|
||||||
|
|
||||||
/* ***** Gtk+ GUI for WeeChat, NOT developed! ***** */
|
extern void wee_perl_init ();
|
||||||
|
extern t_plugin_script *wee_perl_search (char *);
|
||||||
|
extern int wee_perl_exec (char *, char *);
|
||||||
|
extern int wee_perl_load (char *);
|
||||||
|
extern void wee_perl_unload (t_plugin_script *);
|
||||||
|
extern void wee_perl_unload_all ();
|
||||||
|
extern void wee_perl_end ();
|
||||||
|
|
||||||
|
#endif /* wee-perl.h */
|
||||||
@@ -0,0 +1,371 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* plugins.c: manages WeeChat plugins (Perl and/or Python and/or Ruby) */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include "../common/weechat.h"
|
||||||
|
#include "plugins.h"
|
||||||
|
#include "../irc/irc.h"
|
||||||
|
#include "../gui/gui.h"
|
||||||
|
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
#include "perl/wee-perl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
char *plugin_name[3] = { "Perl", "Python", "Ruby" };
|
||||||
|
|
||||||
|
t_plugin_handler *plugin_msg_handlers = NULL;
|
||||||
|
t_plugin_handler *last_plugin_msg_handler = NULL;
|
||||||
|
|
||||||
|
t_plugin_handler *plugin_cmd_handlers = NULL;
|
||||||
|
t_plugin_handler *last_plugin_cmd_handler = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_auto_load: auto-load all scripts in a directory
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_auto_load (int plugin_type, char *directory)
|
||||||
|
{
|
||||||
|
char *dir_name, *current_dir;
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent *entry;
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
/* build directory, adding WeeChat home */
|
||||||
|
dir_name =
|
||||||
|
(char *) malloc ((strlen (weechat_home) + strlen (directory) + 2) * sizeof (char));
|
||||||
|
sprintf (dir_name, "%s%s%s", weechat_home, DIR_SEPARATOR, directory);
|
||||||
|
|
||||||
|
/* save working directory */
|
||||||
|
current_dir = (char *) malloc (1024 * sizeof (char));
|
||||||
|
if (!getcwd (current_dir, 1024 - 1))
|
||||||
|
{
|
||||||
|
free (current_dir);
|
||||||
|
current_dir = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* browse autoload directory */
|
||||||
|
dir = opendir (dir_name);
|
||||||
|
chdir (dir_name);
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
while ((entry = readdir (dir)))
|
||||||
|
{
|
||||||
|
lstat (entry->d_name, &statbuf);
|
||||||
|
if (! S_ISDIR(statbuf.st_mode))
|
||||||
|
{
|
||||||
|
wee_log_printf (_("auto-loading %s script: %s%s%s\n"),
|
||||||
|
plugin_name[plugin_type],
|
||||||
|
dir_name, DIR_SEPARATOR, entry->d_name);
|
||||||
|
plugin_load (plugin_type, entry->d_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* restore working directory */
|
||||||
|
if (current_dir)
|
||||||
|
{
|
||||||
|
chdir (current_dir);
|
||||||
|
free (current_dir);
|
||||||
|
}
|
||||||
|
free (dir_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_init: initialize all plugins
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_init ()
|
||||||
|
{
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
wee_perl_init();
|
||||||
|
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_load: load a plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_load (int plugin_type, char *filename)
|
||||||
|
{
|
||||||
|
#ifdef PLUGINS
|
||||||
|
switch (plugin_type)
|
||||||
|
{
|
||||||
|
case PLUGIN_TYPE_PERL:
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
wee_perl_load (filename);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case PLUGIN_TYPE_PYTHON:
|
||||||
|
/* TODO: load Python script */
|
||||||
|
break;
|
||||||
|
case PLUGIN_TYPE_RUBY:
|
||||||
|
/* TODO: load Ruby script */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_handler_search: look for message/command handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
t_plugin_handler *
|
||||||
|
plugin_handler_search (t_plugin_handler *plugin_handlers, char *name)
|
||||||
|
{
|
||||||
|
t_plugin_handler *ptr_plugin_handler;
|
||||||
|
|
||||||
|
for (ptr_plugin_handler = plugin_handlers; ptr_plugin_handler;
|
||||||
|
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||||
|
{
|
||||||
|
/* handler found */
|
||||||
|
if (strcasecmp (ptr_plugin_handler->name, name) == 0)
|
||||||
|
return ptr_plugin_handler;
|
||||||
|
}
|
||||||
|
/* handler not found */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_handler_add: add a message/command handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_handler_add (t_plugin_handler **plugin_handlers,
|
||||||
|
t_plugin_handler **last_plugin_handler,
|
||||||
|
int plugin_type, char *name, char *function)
|
||||||
|
{
|
||||||
|
t_plugin_handler *new_plugin_handler;
|
||||||
|
|
||||||
|
new_plugin_handler = (t_plugin_handler *)malloc (sizeof (t_plugin_handler));
|
||||||
|
if (new_plugin_handler)
|
||||||
|
{
|
||||||
|
new_plugin_handler->plugin_type = plugin_type;
|
||||||
|
new_plugin_handler->name = strdup (name);
|
||||||
|
new_plugin_handler->function_name = strdup (function);
|
||||||
|
|
||||||
|
/* add new handler to list */
|
||||||
|
new_plugin_handler->prev_handler = *last_plugin_handler;
|
||||||
|
new_plugin_handler->next_handler = NULL;
|
||||||
|
if (*plugin_handlers)
|
||||||
|
(*last_plugin_handler)->next_handler = new_plugin_handler;
|
||||||
|
else
|
||||||
|
*plugin_handlers = new_plugin_handler;
|
||||||
|
*last_plugin_handler = new_plugin_handler;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||||
|
gui_printf (NULL,
|
||||||
|
_("%s unable to add handler for \"%s\" message (not enough memory)\n"),
|
||||||
|
WEECHAT_ERROR, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_handler_free: free message/command handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_handler_free (t_plugin_handler **plugin_handlers,
|
||||||
|
t_plugin_handler **last_plugin_handler,
|
||||||
|
t_plugin_handler *ptr_plugin_handler)
|
||||||
|
{
|
||||||
|
t_plugin_handler *new_plugin_handlers;
|
||||||
|
|
||||||
|
/* remove handler from list */
|
||||||
|
if (*last_plugin_handler == ptr_plugin_handler)
|
||||||
|
*last_plugin_handler = ptr_plugin_handler->prev_handler;
|
||||||
|
if (ptr_plugin_handler->prev_handler)
|
||||||
|
{
|
||||||
|
(ptr_plugin_handler->prev_handler)->next_handler = ptr_plugin_handler->next_handler;
|
||||||
|
new_plugin_handlers = *plugin_handlers;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
new_plugin_handlers = ptr_plugin_handler->next_handler;
|
||||||
|
|
||||||
|
if (ptr_plugin_handler->next_handler)
|
||||||
|
(ptr_plugin_handler->next_handler)->prev_handler = ptr_plugin_handler->prev_handler;
|
||||||
|
|
||||||
|
/* free data */
|
||||||
|
free (ptr_plugin_handler->name);
|
||||||
|
free (ptr_plugin_handler->function_name);
|
||||||
|
free (ptr_plugin_handler);
|
||||||
|
*plugin_handlers = new_plugin_handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_handler_free_all: remove all message/command handlers
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_handler_free_all (t_plugin_handler **plugin_handlers,
|
||||||
|
t_plugin_handler **last_plugin_handler)
|
||||||
|
{
|
||||||
|
while (*plugin_handlers)
|
||||||
|
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||||
|
*plugin_handlers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_handler_free_all_type: remove all message/command handlers for one type
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_handler_free_all_type (t_plugin_handler **plugin_handlers,
|
||||||
|
t_plugin_handler **last_plugin_handler,
|
||||||
|
int plugin_type)
|
||||||
|
{
|
||||||
|
t_plugin_handler *ptr_plugin_handler, *new_plugin_handler;
|
||||||
|
|
||||||
|
ptr_plugin_handler = *plugin_handlers;
|
||||||
|
while (ptr_plugin_handler)
|
||||||
|
{
|
||||||
|
if (ptr_plugin_handler->plugin_type == plugin_type)
|
||||||
|
{
|
||||||
|
new_plugin_handler = ptr_plugin_handler->next_handler;
|
||||||
|
plugin_handler_free (plugin_handlers, last_plugin_handler,
|
||||||
|
ptr_plugin_handler);
|
||||||
|
ptr_plugin_handler = new_plugin_handler;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ptr_plugin_handler = ptr_plugin_handler->next_handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_event_msg: IRC message received => call all handlers for this message
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_event_msg (char *irc_command, char *arguments)
|
||||||
|
{
|
||||||
|
#ifdef PLUGINS
|
||||||
|
t_plugin_handler *ptr_plugin_handler;
|
||||||
|
|
||||||
|
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||||
|
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||||
|
{
|
||||||
|
if (strcasecmp (ptr_plugin_handler->name, irc_command) == 0)
|
||||||
|
{
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||||
|
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) irc_command;
|
||||||
|
(void) arguments;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_exec_command: execute a command handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
plugin_exec_command (char *user_command, char *arguments)
|
||||||
|
{
|
||||||
|
#ifdef PLUGINS
|
||||||
|
t_plugin_handler *ptr_plugin_handler;
|
||||||
|
|
||||||
|
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||||
|
ptr_plugin_handler = ptr_plugin_handler->next_handler)
|
||||||
|
{
|
||||||
|
if (strcasecmp (ptr_plugin_handler->name, user_command) == 0)
|
||||||
|
{
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
if (ptr_plugin_handler->plugin_type == PLUGIN_TYPE_PERL)
|
||||||
|
wee_perl_exec (ptr_plugin_handler->function_name, arguments);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* command executed */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* make gcc happy */
|
||||||
|
(void) user_command;
|
||||||
|
(void) arguments;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* no command executed */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_unload: unload all scripts for a plugin type
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_unload (int plugin_type, char *scriptname)
|
||||||
|
{
|
||||||
|
#ifdef PLUGINS
|
||||||
|
switch (plugin_type)
|
||||||
|
{
|
||||||
|
case PLUGIN_TYPE_PERL:
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
/* unload one Perl script is not allowed */
|
||||||
|
wee_perl_end ();
|
||||||
|
wee_perl_init ();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case PLUGIN_TYPE_PYTHON:
|
||||||
|
/* TODO: unload Python scripts */
|
||||||
|
break;
|
||||||
|
case PLUGIN_TYPE_RUBY:
|
||||||
|
/* TODO: unload Ruby scripts */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* plugin_end: shutdown plugin interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
plugin_end ()
|
||||||
|
{
|
||||||
|
plugin_handler_free_all (&plugin_msg_handlers, &last_plugin_msg_handler);
|
||||||
|
plugin_handler_free_all (&plugin_cmd_handlers, &last_plugin_cmd_handler);
|
||||||
|
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
wee_perl_end();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||||
|
* See README for License detail, AUTHORS for developers list.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __WEECHAT_PLUGINS_H
|
||||||
|
#define __WEECHAT_PLUGINS_H 1
|
||||||
|
|
||||||
|
#define PLUGIN_TYPE_PERL 0
|
||||||
|
#define PLUGIN_TYPE_PYTHON 1
|
||||||
|
#define PLUGIN_TYPE_RUBY 2
|
||||||
|
|
||||||
|
typedef struct t_plugin_script t_plugin_script;
|
||||||
|
|
||||||
|
struct t_plugin_script
|
||||||
|
{
|
||||||
|
char *name; /* name of script */
|
||||||
|
char *version; /* version of script */
|
||||||
|
char *shutdown_func; /* function when script ends */
|
||||||
|
char *description; /* description of script */
|
||||||
|
t_plugin_script *prev_script; /* link to previous Perl script */
|
||||||
|
t_plugin_script *next_script; /* link to next Perl script */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct t_plugin_handler t_plugin_handler;
|
||||||
|
|
||||||
|
struct t_plugin_handler
|
||||||
|
{
|
||||||
|
int plugin_type; /* plugin type (Perl, Python, Ruby) */
|
||||||
|
char *name; /* name of IRC command (PRIVMSG, ..)
|
||||||
|
or command (without first '/') */
|
||||||
|
char *function_name; /* name of function (handler) */
|
||||||
|
t_plugin_handler *prev_handler; /* link to previous handler */
|
||||||
|
t_plugin_handler *next_handler; /* link to next handler */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern t_plugin_handler *plugin_msg_handlers;
|
||||||
|
extern t_plugin_handler *last_plugin_msg_handler;
|
||||||
|
|
||||||
|
extern t_plugin_handler *plugin_cmd_handlers;
|
||||||
|
extern t_plugin_handler *last_plugin_cmd_handler;
|
||||||
|
|
||||||
|
#ifdef PLUGIN_PERL
|
||||||
|
extern t_plugin_script *perl_scripts;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void plugin_init ();
|
||||||
|
extern void plugin_load (int, char *);
|
||||||
|
extern void plugin_unload (int, 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 void plugin_end ();
|
||||||
|
|
||||||
|
#endif /* plugins.h */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
.TH WEECHAT 1 "September 2003" "FlashCode"
|
.TH WEECHAT 1 "January 2004" "FlashCode"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
weechat \- wee enhanced environment for chat
|
weechat \- Wee Enhanced Environment for Chat
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B weechat
|
.B weechat
|
||||||
@@ -9,8 +9,11 @@ weechat \- wee enhanced environment for chat
|
|||||||
.br
|
.br
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Fast, light and extensible IRC client for many operating systems. Everything can be
|
Fast, light and extensible IRC client for many operating systems.
|
||||||
done with a keyboard. It is customizable and extensible with scripts.
|
.br
|
||||||
|
Everything can be done with a keyboard. It is customizable and extensible with scripts.
|
||||||
|
Many GUIs are available (Curses, Gtk, Qt, and text).
|
||||||
|
It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
@@ -30,6 +33,9 @@ display WeeChat version
|
|||||||
.TP
|
.TP
|
||||||
.B $HOME/.weechat/weechat.rc
|
.B $HOME/.weechat/weechat.rc
|
||||||
configuration file for WeeChat
|
configuration file for WeeChat
|
||||||
|
.TP
|
||||||
|
.B $HOME/.weechat/weechat.log
|
||||||
|
WeeChat log file
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
WeeChat is written by:
|
WeeChat is written by:
|
||||||
@@ -41,4 +47,8 @@ WeeChat is written by:
|
|||||||
WeeChat on the web:
|
WeeChat on the web:
|
||||||
.UR
|
.UR
|
||||||
http://weechat.flashtux.org
|
http://weechat.flashtux.org
|
||||||
|
.br
|
||||||
|
Get support there:
|
||||||
|
.UR
|
||||||
|
http://weechat.flashtux.org/support.php
|
||||||
.UE
|
.UE
|
||||||
|
|||||||
+14
-5
@@ -1,5 +1,5 @@
|
|||||||
%define name weechat
|
%define name weechat
|
||||||
%define version 0.0.1
|
%define version 0.0.4
|
||||||
%define release 1
|
%define release 1
|
||||||
|
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
@@ -22,20 +22,29 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%setup
|
%setup
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
./configure
|
||||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
|
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
|
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
|
||||||
|
|
||||||
|
%find_lang %name
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%files
|
%files -f %{name}.lang
|
||||||
%defattr(-,root,root,0755)
|
%defattr(-,root,root,0755)
|
||||||
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
|
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
|
||||||
/usr/share/man/man1/weechat.1*
|
/usr/local/man/man1/weechat.1*
|
||||||
/usr/local/bin/weechat
|
/usr/local/bin/weechat-curses
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Sep 27 2003 FlashCode <flashcode@flashtux.org> 0.0.1-1
|
* 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
|
||||||
|
- Released version 0.0.3
|
||||||
|
* Sun Oct 05 2003 FlashCode <flashcode@flashtux.org> 0.0.2-1
|
||||||
|
- Released version 0.0.2
|
||||||
|
* Sat Sep 27 2003 FlashCode <flashcode@flashtux.org> 0.0.1-1
|
||||||
- Released version 0.0.1
|
- Released version 0.0.1
|
||||||
|
|||||||
+13
-10
@@ -1,17 +1,20 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
WeeChat known bugs, 2003-09-27
|
WeeChat known bugs, 2004-01-01
|
||||||
|
|
||||||
|
- ./configure does not check that Curses headers are installed
|
||||||
|
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||||
|
- ./configure does not check that Perl headers & libraries are installed
|
||||||
- too much nicks in the channel (> height of window) => display bug
|
- too much nicks in the channel (> height of window) => display bug
|
||||||
- some IRC commands are marked as 'unknown' when received
|
- some IRC commands are marked as 'unknown' when received
|
||||||
(irc protocol is under dev!)
|
(IRC protocol is under dev!)
|
||||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
- too much opened channels => display bug
|
||||||
problem)
|
|
||||||
- alias/unalias commands doesn't work
|
|
||||||
- config is not saved (to ~/.weechat/weechatrc)
|
|
||||||
- intercept Ctrl-C (do not quit immediately if Ctrl-C pressed!)
|
|
||||||
- program is stopped when bad option in config file (it should not, only display
|
|
||||||
warning)
|
|
||||||
- too much opened channel => display bug
|
|
||||||
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
- when kicked, channel is not prefixed by '(' and sufixed by ')'
|
||||||
|
- when function key (non used by WeeChat) is pressed, prompt is deleted
|
||||||
|
- when quitting WeeChat term title is not restored (if look_set_title is ON)
|
||||||
|
- command name for /server can not contain spaces
|
||||||
|
- 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)
|
||||||
|
|||||||
+45
-80
@@ -1,88 +1,53 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
ChangeLog - 2003-09-27
|
ChangeLog - 2004-01-01
|
||||||
|
|
||||||
* 2003-09-27:
|
|
||||||
- WeeChat 0.0.1 released!
|
|
||||||
|
|
||||||
* 2003-09-26:
|
Version 0.0.4 (2004-01-01):
|
||||||
- added completor prefix (in config: look_nick_completor)
|
* Perl plugin, with auto-load
|
||||||
- fixef log_printf command (bug with year & month)
|
* when private window is created (another user is talking), WeeChat does not
|
||||||
- added "/kill" command
|
switch to this window
|
||||||
- fixed /version and /ctcp commands (missing ":" before message)
|
* highlight when our nick is written in a channel/private window
|
||||||
|
* ctrl-C now intercepted (ignored)
|
||||||
|
* debug messages can be enabled via ./configure --enbale-debug option
|
||||||
|
|
||||||
* 2003-09-25:
|
Version 0.0.3 (2003-11-03):
|
||||||
- added "/kick" command
|
* ./configure script to build WeeChat
|
||||||
- added IRC errors 402 to 407
|
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||||
- added "/invite" command
|
* fixed problem with '353' IRC message (nicklist)
|
||||||
|
* fixed problem when nick is truncated by server
|
||||||
|
* fixed crash when entering text without any server connection
|
||||||
|
* fixed crash when /set command is executed
|
||||||
|
* fixed display bug (text was blinking when scrolling)
|
||||||
|
* french translation
|
||||||
|
* new IRC command: /stats, /service, /squit, /motd, /lusers, /links, /time,
|
||||||
|
/trace, /admin, /info, /servlist, /squery, /who, /whowas, /die, /summon,
|
||||||
|
/users, /wallops, /userhost, /ison, /ctcp ping
|
||||||
|
* code cleanup
|
||||||
|
|
||||||
* 2003-09-24:
|
Version 0.0.2 (2003-10-05):
|
||||||
- "ctcp version" received is now correctly displayed
|
* added commands /rehash and /restart
|
||||||
- "/version" command is ok
|
* command & auto-join channels when connected to server
|
||||||
|
* new commands for alias: /alias, /unalias (new section in config file)
|
||||||
|
* config is now saved automatically when quitting WeeChat, /save command added
|
||||||
|
* new commands for servers: /server, /connect, /disconnect
|
||||||
|
* added autoconnect flag for each server in config file
|
||||||
|
* added "look_set_title" option in config file
|
||||||
|
* term window title is modified with WeeChat name and version
|
||||||
|
* fixed nicklist display bug
|
||||||
|
* fixed crash when sending command which can only be received
|
||||||
|
* CTCP version returns more info (about OS)
|
||||||
|
|
||||||
* 2003-09-23:
|
Version 0.0.1 (2003-09-27):
|
||||||
- log file (~/.weechat/weechat.log)
|
* ncurses GUI with color output
|
||||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
* multi-servers
|
||||||
|
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||||
* 2003-09-21:
|
* private windows
|
||||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||||
unread messages (from other users), lightmagenta for windows with other
|
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||||
unread data (join, part, quit, away, ...)
|
quote, topic, version, voice, whois
|
||||||
- "320" IRC message management
|
* WeeChat commands: clear, help, set (partial)
|
||||||
- "/clear" command
|
* many config options
|
||||||
|
* log file (~/.weechat/weechat.log)
|
||||||
* 2003-09-19:
|
* nicklist can be moved on top, bottom, left or right of window
|
||||||
- préparation des sources pour l'internationalisation avec gettext
|
|
||||||
- "301" IRC command (away message)
|
|
||||||
- functions renamed in rc-commands.c, irc-server.c,
|
|
||||||
command.c and config.c (all functions are beginning with a prefix:
|
|
||||||
irc_cmd_recv_xxx, irc_cmd_send_xxx, server_xxx, weechat_cmd_xxx and
|
|
||||||
config_xxx). Moreover, all commands (sent and received) return a value
|
|
||||||
(success or not)
|
|
||||||
- "/quote" command
|
|
||||||
- "/whois" command (and colored display of /whois result in server window)
|
|
||||||
|
|
||||||
* 2003-09-18:
|
|
||||||
- use of alternate nickname (and 2nd alternate) if nick is already used
|
|
||||||
on server (changed/added in config file: options "nick1", "nick2", "nick3"
|
|
||||||
for a server, all are mandatory)
|
|
||||||
- "433" IRC error management (nickname already in use)
|
|
||||||
- "mode" command received correctly for "channel flags" and
|
|
||||||
op/deop/voice/devoice actions for a nick
|
|
||||||
- "401" IRC error management (no such nick/channel)
|
|
||||||
- private windows management (when received and opened, with /privmsg),
|
|
||||||
"/privmsg" completed consequently
|
|
||||||
|
|
||||||
* 2003-09-17:
|
|
||||||
- nickmode display ((half)op/voice) before nicks (as option, look at config
|
|
||||||
options beginning with "look_nickmode")
|
|
||||||
- windows history is now ok (pgup/pgdn on any window type)
|
|
||||||
- "/me" command (and OK when received)
|
|
||||||
- display nicks count when joining channel or with "/names" command
|
|
||||||
(total, ops, halfops, voices et normaux)
|
|
||||||
|
|
||||||
* 2003-09-16:
|
|
||||||
- added and normalized chat window colors
|
|
||||||
(new colors in config file)
|
|
||||||
- "/topic" command
|
|
||||||
- nicklist can be moved on top, bottom, left or right of window
|
|
||||||
|
|
||||||
* 2003-09-15:
|
|
||||||
- auto-resize of nicklist, according to nick max length
|
|
||||||
- IRC multi-servers is OK
|
|
||||||
|
|
||||||
* 2003-09-14:
|
|
||||||
- no hangup if "/part" command is executed on server window
|
|
||||||
- continue if no server is declared in config file
|
|
||||||
(empty window will be opened for executing WeeChat commands)
|
|
||||||
- string array for strings in config file
|
|
||||||
example: cfg_look_nicklist_position can take values "left", "right",
|
|
||||||
"top", "bottom", which are converted to int (from 0 for "left" to 3 for
|
|
||||||
"bottom")
|
|
||||||
- messages are aligned under time (server window) or under time + nick
|
|
||||||
(channel window)
|
|
||||||
|
|
||||||
* 2003-09-13:
|
|
||||||
- sources exploded in many directories: ./irc, ./gui/curses, ./gui/gtk,
|
|
||||||
./gui/qt and ./gui/text
|
|
||||||
|
|||||||
+154
-2
@@ -1,6 +1,158 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
WeeChat FAQ, 2003-09-19
|
WeeChat FAQ, 2004-01-01
|
||||||
|
|
||||||
<<< TO DO ! >>>
|
|
||||||
|
1- Compiling
|
||||||
|
|
||||||
|
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?
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 1- Compiling |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
1.1 I heard about many GUI for WeeChat. How can I compile/use them?
|
||||||
|
|
||||||
|
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.2 I can't compile WeeChat CVS.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 2- Using WeeChat |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
2.1 Why using WeeChat ? X-Chat and Irssi are so good...
|
||||||
|
|
||||||
|
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" ;)
|
||||||
|
|
||||||
|
|
||||||
|
2.2 I've launched WeeChat, but I'm lost, what can I do?
|
||||||
|
|
||||||
|
For help you can type /help. For help about a command, type /help command.
|
||||||
|
|
||||||
|
|
||||||
|
2.3 How can I customize key bindings?
|
||||||
|
|
||||||
|
Today you can't do that. This will be available in a future version.
|
||||||
|
|
||||||
|
|
||||||
|
2.4 How can I load Perl scripts?
|
||||||
|
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||||
|
|
||||||
|
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 ;)
|
||||||
|
|
||||||
|
|
||||||
|
2.5 How can I load Python scripts?
|
||||||
|
|
||||||
|
Today Python interface is not developed, so can't load any Python script.
|
||||||
|
|
||||||
|
|
||||||
|
2.6 How can I load Ruby scripts?
|
||||||
|
|
||||||
|
Today Ruby interface is not developed, so can't load any Ruby script.
|
||||||
|
|
||||||
|
|
||||||
|
/------------------------------------------------------------------------------\
|
||||||
|
| 3- Development |
|
||||||
|
\------------------------------------------------------------------------------/
|
||||||
|
|
||||||
|
|
||||||
|
3.1 How should I report bugs?
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
+8
-3
@@ -1,10 +1,15 @@
|
|||||||
WeeChat - Installation instructions
|
WeeChat - Installation instructions
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
1) Run 'make'
|
1) Run './configure'
|
||||||
|
options: --disable-curses : do not build Curses interface
|
||||||
|
--enable-gtk : build Gtk+ interface (under development!)
|
||||||
|
--enable-qt : build Qt interface (not developed!)
|
||||||
|
|
||||||
2) As root, run 'make install'
|
2) Run 'make'
|
||||||
|
|
||||||
3) Enjoy ! :-)
|
3) As root, run 'make install'
|
||||||
|
|
||||||
|
4) Enjoy ! :-)
|
||||||
|
|
||||||
See AUTHORS for any support, feel free to contact us for any problem ;)
|
See AUTHORS for any support, feel free to contact us for any problem ;)
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
SUBDIRS = po intl src
|
||||||
|
|
||||||
|
EXTRA_DIST = weechat.1 BUGS FAQ
|
||||||
|
|
||||||
|
man_MANS = weechat.1
|
||||||
+14
-2
@@ -1,6 +1,18 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
FlashCode, 2003-09-27
|
* FlashCode, 2004-01-01
|
||||||
|
|
||||||
WeeChat 0.0.1 released.
|
WeeChat 0.0.4 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-11-03
|
||||||
|
|
||||||
|
WeeChat 0.0.3 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-10-05
|
||||||
|
|
||||||
|
WeeChat 0.0.2 released.
|
||||||
|
|
||||||
|
* FlashCode, 2003-09-27
|
||||||
|
|
||||||
|
WeeChat 0.0.1 released.
|
||||||
|
|||||||
+4
-3
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
|
|||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
* IRC chat client with multi-server connection
|
* IRC chat client with multi-server connection
|
||||||
* many GUI (curses, text, Gtk, QT) (1)
|
* many GUI (curses, Gtk, Qt) (1)
|
||||||
* small, fast and very light
|
* small, fast and very light
|
||||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||||
* compliant with RFC 1459,2810,2811,2812,2813
|
* compliant with RFC 1459,2810,2811,2812,2813
|
||||||
|
* developed from scratch (not based on any other IRC client, except for look ;)
|
||||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||||
* 100% GPL & free
|
* 100% GPL & free
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ Features
|
|||||||
Copyright
|
Copyright
|
||||||
---------
|
---------
|
||||||
|
|
||||||
WeeChat (c) Copyright 2003
|
WeeChat (c) Copyright 2004
|
||||||
by: FlashCode <flashcode@flashtux.org>
|
by: FlashCode <flashcode@flashtux.org>
|
||||||
Xahlexx <xahlex@tuxisland.org>
|
Xahlexx <xahlex@tuxisland.org>
|
||||||
Bounga <bounga@altern.org>
|
Bounga <bounga@altern.org>
|
||||||
@@ -45,6 +46,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
(1) only curses & text interfaces are available today
|
(1) only curses interface is available today
|
||||||
(2) plugin interfaces are not yet developed
|
(2) plugin interfaces are not yet developed
|
||||||
(3) only GNU/Linux version is available today
|
(3) only GNU/Linux version is available today
|
||||||
|
|||||||
+36
-72
@@ -1,7 +1,7 @@
|
|||||||
WeeChat - Wee Enhanced Environment for Chat
|
WeeChat - Wee Enhanced Environment for Chat
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
TODO - 2003-09-27
|
TODO - 2004-01-01
|
||||||
|
|
||||||
Legend:
|
Legend:
|
||||||
# done
|
# done
|
||||||
@@ -10,121 +10,85 @@ Legend:
|
|||||||
? is this really necessary?
|
? is this really necessary?
|
||||||
|
|
||||||
|
|
||||||
v0.0.1:
|
v0.0.4:
|
||||||
|
------
|
||||||
|
|
||||||
* IRC protocol:
|
* General:
|
||||||
# "/quote" command: send a raw string to the server without parsing it
|
# debug messages can be enabled via ./configure --enbale-debug option
|
||||||
# "/me" command (for user actions description)
|
|
||||||
# "/away" command (to toggle the away status)
|
|
||||||
# "/op", "/deop", "/voice", "/devoice" commands
|
|
||||||
# "/invite" command
|
|
||||||
# "/kick", "/ban", "/unban" commands
|
|
||||||
# "/kill" command
|
|
||||||
# "/list" command: list of channels
|
|
||||||
# "/names" command: view who is on a given channel without being
|
|
||||||
on it (for example /names #weechat gives all the nicks present on
|
|
||||||
#weechat, except those who have the +i flag (server side))
|
|
||||||
# "/oper" command: become operator on the irc network
|
|
||||||
# "/topic" command: change the topic of a channel
|
|
||||||
# "/version" command: give the irc client version (CTCP VERSION)
|
|
||||||
of a given nick/channel (without parameter: gives WeeChat version)
|
|
||||||
# "/whois" command
|
|
||||||
|
|
||||||
* WeeChat commands:
|
|
||||||
# "/clear": to clear window content
|
|
||||||
|
|
||||||
* Interface:
|
* Interface:
|
||||||
# "demi-highlight" when joins/quits etc
|
+ internationalization (traduce WeeChat in many languages)
|
||||||
# log messages/warning/errors to ~/.weechat/log file
|
# intercept Ctrl-C
|
||||||
# improve editing zone (left arrow <> backspace)
|
# when private window is created (another user is talking), WeeChat does not
|
||||||
# sort nick list
|
switch to this window
|
||||||
# choose nick list position (top, left, right (default), bottom)
|
# highlight when our nick is written in a channel/private window
|
||||||
# auto-resize nicklist (when nick too long)
|
|
||||||
# do pretty cutting of long lines (align on the nick or after hour for server)
|
|
||||||
# keep history of commands and call them again with up/down arrow
|
|
||||||
# text GUI
|
|
||||||
# ncurses GUI:
|
|
||||||
# one window for each channel
|
|
||||||
# color display
|
|
||||||
# private windows
|
|
||||||
# redraw window when term size is modified
|
|
||||||
# chat history (pgup/pgdn for displaying history)
|
|
||||||
# switch to other channel window
|
|
||||||
|
|
||||||
* TCP/IP communication:
|
* Plugins:
|
||||||
# IPv4 protocol implementation
|
# Perl plugin
|
||||||
|
# "/perl load" and "/perl unload" commands to (un)load Perl scripts
|
||||||
* Configuration:
|
# auto-load Perl scripts at startup
|
||||||
# write default config file
|
|
||||||
|
|
||||||
|
|
||||||
Future versions:
|
Future versions:
|
||||||
|
---------------
|
||||||
|
|
||||||
|
* General:
|
||||||
|
- Windows version
|
||||||
|
|
||||||
* IRC protocol:
|
* IRC protocol:
|
||||||
- implement RFC 2812
|
|
||||||
+ "/mode" command: change the user/channels modes
|
+ "/mode" command: change the user/channels modes
|
||||||
- "/dcc" command (for chat and sending/receiving files)
|
- "/dcc" command (for chat and sending/receiving files)
|
||||||
- manage "halfop" status
|
|
||||||
- complete "/list" command: add regexp search, display only channels that
|
- complete "/list" command: add regexp search, display only channels that
|
||||||
match regexp
|
match regexp
|
||||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
|
||||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||||
nick/host
|
nick/host
|
||||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||||
When we come back from our away it should print it to the current window
|
When we come back from our away it should print it to the current window
|
||||||
- "/rehash" command: tell the server to reload its config file
|
|
||||||
- "/restart" command: tell the server to restart itself
|
|
||||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||||
nick/host connect to the given irc network
|
nick/host connect to the given irc network
|
||||||
- "/wallops" command: write the same string to all the
|
|
||||||
persons with the flag +w enable
|
|
||||||
|
|
||||||
* WeeChat commands:
|
* 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
|
||||||
- "/completion" command: do shortcuts (for example when we type "u"
|
- "/completion" command: do shortcuts (for example when we type "u"
|
||||||
in the text bar it send it to the server as "you")
|
in the text bar it send it to the server as "you")
|
||||||
- "/exec" command: execute a command as if we was in shell
|
- "/exec" command: execute a command as if we was in shell
|
||||||
and show us the output on the current window. An option to exec
|
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
|
like -o could send the output to the server, on the current
|
||||||
channel/private
|
channel/private
|
||||||
- "/reload" command: reload the WeeChat's config file
|
|
||||||
- "/set" command: allow the user to set the WeeChat variables
|
|
||||||
under WeeChat without editing the config file (colours, time
|
|
||||||
format, etc)
|
|
||||||
- "/highlight" command: highlight a given word when it appears on
|
|
||||||
channels/privates
|
|
||||||
|
|
||||||
* Interface:
|
* Interface:
|
||||||
|
+ Gtk GUI
|
||||||
- display current channel modes (example : #weechat(+nt))
|
- display current channel modes (example : #weechat(+nt))
|
||||||
- interpret ^B in messages (this means bold text)
|
- interpret special chars in messages (color & bold for example)
|
||||||
- internationalization (traduce WeeChat in many languages)
|
|
||||||
- many channel windows in one window/term (window split)
|
- many channel windows in one window/term (window split)
|
||||||
- add lag indicator
|
- add lag indicator
|
||||||
- log chats to file
|
|
||||||
- forget some old lines that were displayed long time ago (now all is saved,
|
- forget some old lines that were displayed long time ago (now all is saved,
|
||||||
if WeeChat is running for long time, a lot of memory is used!)
|
if WeeChat is running for long time, a lot of memory is used!)
|
||||||
- improve completion (for example complete command parameters when possible)
|
- improve completion (for example complete command parameters when possible)
|
||||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||||
- add clock (in status bar?)
|
- add clock (in status bar?)
|
||||||
- Gtk GUI
|
- log chats to file
|
||||||
? Qt GUI
|
? Qt GUI
|
||||||
|
|
||||||
* TCP/IP communication:
|
* TCP/IP communication:
|
||||||
|
- connect to server with child process (background)
|
||||||
|
- proxy support
|
||||||
|
- SSL support
|
||||||
- IPv6 protocol implementation
|
- IPv6 protocol implementation
|
||||||
|
|
||||||
* Configuration:
|
* Configuration:
|
||||||
- add key bindings to config file
|
|
||||||
- add missing options for config file
|
- add missing options for config file
|
||||||
- write config file
|
- add key bindings to config file
|
||||||
- add an option for each server in order to run commands on join
|
|
||||||
(example: /msg nickserv identify password)
|
|
||||||
- channel list for auto-join (for each server)
|
|
||||||
- do not stop program if problem with options in config file
|
|
||||||
- load config file after GUI (so init values by default (colors, ...) before
|
- load config file after GUI (so init values by default (colors, ...) before
|
||||||
loading config)
|
loading config)
|
||||||
|
|
||||||
* Plugins:
|
* Plugins:
|
||||||
- add Perl plugin
|
- Python plugin
|
||||||
- add Python plugin
|
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||||
- add Ruby plugin
|
- Ruby plugin
|
||||||
- "/load" and "/unload" commands to (un)load extension scripts
|
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||||
(perl, python, ruby, ...)
|
|
||||||
|
|||||||
Executable
+55
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
rm -f config.cache
|
||||||
|
|
||||||
|
### GETTEXT ###
|
||||||
|
|
||||||
|
echo searching for GNU gettext intl directory...
|
||||||
|
|
||||||
|
dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share"
|
||||||
|
found=0
|
||||||
|
for try in $dirs; do
|
||||||
|
echo -n " -> $try/gettext/intl... "
|
||||||
|
if test -d $try/gettext/intl; then
|
||||||
|
echo found it
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo no
|
||||||
|
done
|
||||||
|
if test "$found" != 1; then
|
||||||
|
echo ERROR: Cannot find gettext/intl directory.
|
||||||
|
echo ERROR: Install GNU gettext in /usr or /usr/local prefix.
|
||||||
|
exit 7
|
||||||
|
fi;
|
||||||
|
|
||||||
|
echo copying gettext intl files...
|
||||||
|
intldir="$try/gettext/intl"
|
||||||
|
if test ! -d intl; then
|
||||||
|
mkdir intl
|
||||||
|
fi
|
||||||
|
olddir=`pwd`
|
||||||
|
cd $intldir
|
||||||
|
for file in *; do
|
||||||
|
if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
|
||||||
|
rm -f $olddir/intl/$file
|
||||||
|
cp $intldir/$file $olddir/intl/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cp -f $try/gettext/po/Makefile.in.in $olddir/po/
|
||||||
|
cd $olddir
|
||||||
|
if test -f intl/plural.c; then
|
||||||
|
sleep 2
|
||||||
|
touch intl/plural.c
|
||||||
|
fi
|
||||||
|
|
||||||
|
### END GETTEXT ###
|
||||||
|
|
||||||
|
echo "running aclocal..."
|
||||||
|
aclocal -I /usr/share/aclocal
|
||||||
|
echo "running autoconf..."
|
||||||
|
autoconf
|
||||||
|
echo "running autoheader..."
|
||||||
|
autoheader
|
||||||
|
echo "running automake..."
|
||||||
|
automake -a
|
||||||
|
echo "autogen.sh ok, now run ./configure script"
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
# Copyright (c) 2004 FlashCode <flashcode@flashtux.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
# -*- Autoconf -*-
|
||||||
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
AC_PREREQ(2.56)
|
||||||
|
AC_INIT(WeeChat, 0.0.4, flashcode@flashtux.org)
|
||||||
|
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||||
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
AM_INIT_AUTOMAKE([weechat], [0.0.4])
|
||||||
|
|
||||||
|
# Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
|
# Gettext
|
||||||
|
ALL_LINGUAS="fr"
|
||||||
|
AM_GNU_GETTEXT
|
||||||
|
|
||||||
|
# Checks for libraries.
|
||||||
|
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])
|
||||||
|
|
||||||
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_STRUCT_TM
|
||||||
|
|
||||||
|
# Checks for library functions.
|
||||||
|
AC_FUNC_MALLOC
|
||||||
|
AC_FUNC_REALLOC
|
||||||
|
AC_FUNC_SELECT_ARGTYPES
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||||
|
|
||||||
|
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||||
|
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||||
|
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
|
||||||
|
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||||
|
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||||
|
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||||
|
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
|
||||||
|
|
||||||
|
enable_plugins="no"
|
||||||
|
enable_python="no"
|
||||||
|
PYTHON_CFLAGS=
|
||||||
|
enable_ruby="no"
|
||||||
|
RUBY_CFLAGS=
|
||||||
|
|
||||||
|
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
|
||||||
|
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||||
|
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||||
|
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||||
|
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||||
|
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||||
|
|
||||||
|
if test "x$enable_curses" = "xyes" ; then
|
||||||
|
if test "$LIBCURSES_FOUND" = "0" ; then
|
||||||
|
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
|
||||||
|
fi
|
||||||
|
CURSES_LIBS="-lcurses"
|
||||||
|
AC_SUBST(CURSES_LIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_gtk" = "xyes" ; then
|
||||||
|
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||||
|
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
|
||||||
|
#fi
|
||||||
|
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
|
||||||
|
GTK_LIBS=`pkg-config --libs gtk+-2.0`
|
||||||
|
AC_SUBST(GTK_CFLAGS)
|
||||||
|
AC_SUBST(GTK_LIBS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLUGINS_LIBS=
|
||||||
|
|
||||||
|
if test "x$enable_perl" = "xyes" ; then
|
||||||
|
enable_plugins="yes"
|
||||||
|
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `perl -MExtUtils::Embed -e ldopts`"
|
||||||
|
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
|
||||||
|
AC_SUBST(PERL_CFLAGS)
|
||||||
|
AC_DEFINE(PLUGIN_PERL)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_plugins" = "xyes" ; then
|
||||||
|
AC_DEFINE(PLUGINS)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(PLUGINS_LIBS)
|
||||||
|
|
||||||
|
if test "x$enable_debug" = "xyes" ; then
|
||||||
|
AC_DEFINE(DEBUG)
|
||||||
|
fi
|
||||||
|
|
||||||
|
CFLAGS="-Wall -W -pipe -O2"
|
||||||
|
|
||||||
|
AC_OUTPUT([Makefile
|
||||||
|
src/Makefile
|
||||||
|
src/common/Makefile
|
||||||
|
src/irc/Makefile
|
||||||
|
src/plugins/Makefile
|
||||||
|
src/plugins/perl/Makefile
|
||||||
|
src/gui/Makefile
|
||||||
|
src/gui/curses/Makefile
|
||||||
|
src/gui/gtk/Makefile
|
||||||
|
src/gui/qt/Makefile
|
||||||
|
intl/Makefile
|
||||||
|
po/Makefile.in])
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo $PACKAGE $VERSION
|
||||||
|
|
||||||
|
listgui=
|
||||||
|
if test "x$enable_curses" = "xyes" ; then
|
||||||
|
listgui="$listgui Curses"
|
||||||
|
fi
|
||||||
|
if test "x$enable_gtk" = "xyes" ; then
|
||||||
|
listgui="$listgui Gtk+"
|
||||||
|
fi
|
||||||
|
if test "x$enable_qt" = "xyes" ; then
|
||||||
|
listgui="$listgui Qt"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$listgui" = "x" ; then
|
||||||
|
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Interfaces.................... :$listgui
|
||||||
|
echo
|
||||||
|
echo Build with Plugin support..... : $enable_plugins
|
||||||
|
echo Build with Perl support....... : $enable_perl
|
||||||
|
echo Build with Python support..... : $enable_python
|
||||||
|
echo Build with Ruby support....... : $enable_ruby
|
||||||
|
echo
|
||||||
|
echo Print debugging messages...... : $enable_debug
|
||||||
|
echo
|
||||||
|
eval eval echo WeeChat will be installed in $bindir.
|
||||||
|
echo
|
||||||
|
echo configure complete, now type \'make\' to build WeeChat
|
||||||
|
echo
|
||||||
@@ -1,5 +1,23 @@
|
|||||||
|
weechat (0.0.4-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.4, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Thu, 01 Jan 2004 13:00:00 +0200
|
||||||
|
|
||||||
|
weechat (0.0.3-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.3, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Mon, 03 Nov 2003 23:15:00 +0200
|
||||||
|
|
||||||
|
weechat (0.0.2-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* WeeChat version 0.0.2, see ChangeLog for detail.
|
||||||
|
|
||||||
|
-- FlashCode <flashcode@flashtux.org> Sun, 05 Oct 2003 12:00:00 +0200
|
||||||
|
|
||||||
weechat (0.0.1-1) unstable; urgency=low
|
weechat (0.0.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* First version.
|
* First version.
|
||||||
|
|
||||||
-- FlashCode <flashcode@flashtux.org> Sat, 27 Jun 2003 12:00:00 +0200
|
-- FlashCode <flashcode@flashtux.org> Sat, 27 Sep 2003 12:00:00 +0200
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
4
|
|
||||||
+27
-3
@@ -2,13 +2,37 @@ Source: weechat
|
|||||||
Section: net
|
Section: net
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||||
Build-Depends: debhelper (>> 4.0.0)
|
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7)
|
||||||
Standards-Version: 3.5.8
|
Standards-Version: 3.5.8
|
||||||
|
|
||||||
Package: weechat
|
Package: weechat
|
||||||
Architecture: any
|
Architecture: all
|
||||||
Depends: ${shlibs:Depends}
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||||
Description: Fast, light and extensible IRC client
|
Description: Fast, light and extensible IRC client
|
||||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
for many operating systems. Everything can be done with a keyboard.
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
It is customizable and extensible with scripts.
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-curses
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||||
|
Description: Fast, light and extensible IRC client
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-gtk
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||||
|
Description: Fast, light and extensible IRC client
|
||||||
|
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||||
|
for many operating systems. Everything can be done with a keyboard.
|
||||||
|
It is customizable and extensible with scripts.
|
||||||
|
|
||||||
|
Package: weechat-common
|
||||||
|
Architecture: all
|
||||||
|
Replaces: weechat
|
||||||
|
Recommends: weechat-curses | weechat-gtk
|
||||||
|
Description: Common files for WeeChat
|
||||||
|
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||||
|
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
Thu, 01 Jan 2004 13:00:00 +0200.
|
||||||
|
|
||||||
It was downloaded from http://weechat.flashtux.org/download
|
It was downloaded from http://weechat.flashtux.org/download
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
weechat_0.0.1-1_i386.deb net optional
|
|
||||||
+29
-46
@@ -3,12 +3,7 @@
|
|||||||
# GNU copyright 1997 to 1999 by Joey Hess.
|
# GNU copyright 1997 to 1999 by Joey Hess.
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
# Uncomment this to turn on verbose mode.
|
||||||
#export DH_VERBOSE=1
|
export DH_VERBOSE=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -Wall -g
|
|
||||||
|
|
||||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||||
CFLAGS += -O0
|
CFLAGS += -O0
|
||||||
@@ -22,8 +17,7 @@ endif
|
|||||||
configure: configure-stamp
|
configure: configure-stamp
|
||||||
configure-stamp:
|
configure-stamp:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
# Add here commands to configure the package.
|
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
|
||||||
|
|
||||||
touch configure-stamp
|
touch configure-stamp
|
||||||
|
|
||||||
|
|
||||||
@@ -31,21 +25,14 @@ build: build-stamp
|
|||||||
|
|
||||||
build-stamp: configure-stamp
|
build-stamp: configure-stamp
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
||||||
# Add here commands to compile the package.
|
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
|
||||||
|
|
||||||
touch build-stamp
|
touch build-stamp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
rm -f build-stamp configure-stamp
|
rm -f build-stamp configure-stamp
|
||||||
|
|
||||||
# Add here commands to clean up after the build process.
|
|
||||||
-$(MAKE) clean
|
-$(MAKE) clean
|
||||||
|
|
||||||
dh_clean
|
dh_clean
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
@@ -53,45 +40,41 @@ install: build
|
|||||||
dh_testroot
|
dh_testroot
|
||||||
dh_clean -k
|
dh_clean -k
|
||||||
dh_installdirs
|
dh_installdirs
|
||||||
|
|
||||||
# Add here commands to install the package into debian/weechat.
|
|
||||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||||
|
dh_install --sourcedir=debian/weechat
|
||||||
|
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||||
|
install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||||
|
|
||||||
|
|
||||||
# Build architecture-independent files here.
|
# Build architecture-independent files here.
|
||||||
binary-indep: build install
|
binary-indep: build install
|
||||||
# We have nothing to do by default.
|
dh_testdir -pweechat-common
|
||||||
|
dh_testroot -pweechat-common
|
||||||
|
dh_installchangelogs -pweechat-common
|
||||||
|
dh_installdocs -pweechat-common
|
||||||
|
dh_installexamples -pweechat-common
|
||||||
|
dh_installman weechat.1 -pweechat-common
|
||||||
|
dh_compress -pweechat-common
|
||||||
|
dh_fixperms -pweechat-common
|
||||||
|
dh_installdeb -pweechat-common
|
||||||
|
dh_shlibdeps -pweechat-common
|
||||||
|
dh_gencontrol -pweechat-common
|
||||||
|
dh_md5sums -pweechat-common
|
||||||
|
dh_builddeb -pweechat-common
|
||||||
|
|
||||||
# Build architecture-dependent files here.
|
# Build architecture-dependent files here.
|
||||||
binary-arch: build install
|
binary-arch: build install
|
||||||
dh_testdir
|
dh_testdir -a
|
||||||
dh_testroot
|
dh_testroot -a
|
||||||
dh_installchangelogs
|
dh_link -a
|
||||||
dh_installdocs
|
dh_strip -a
|
||||||
dh_installexamples
|
dh_compress -a
|
||||||
# dh_install
|
dh_fixperms -a
|
||||||
# dh_installmenu
|
dh_installdeb -a
|
||||||
# dh_installdebconf
|
dh_shlibdeps -a
|
||||||
# dh_installlogrotate
|
dh_gencontrol -a
|
||||||
# dh_installemacsen
|
dh_md5sums -a
|
||||||
# dh_installpam
|
dh_builddeb -a
|
||||||
# dh_installmime
|
|
||||||
# dh_installinit
|
|
||||||
# dh_installcron
|
|
||||||
# dh_installinfo
|
|
||||||
dh_installman weechat.1
|
|
||||||
dh_link
|
|
||||||
dh_strip
|
|
||||||
dh_compress
|
|
||||||
dh_fixperms
|
|
||||||
# dh_perl
|
|
||||||
# dh_python
|
|
||||||
# dh_makeshlibs
|
|
||||||
dh_installdeb
|
|
||||||
dh_shlibdeps
|
|
||||||
dh_gencontrol
|
|
||||||
dh_md5sums
|
|
||||||
dh_builddeb
|
|
||||||
|
|
||||||
binary: binary-indep binary-arch
|
binary: binary-indep binary-arch
|
||||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user