mirror of
https://github.com/weechat/weechat.git
synced 2026-06-17 00:24:47 +02:00
Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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,17 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2003-09-27
|
||||
WeeChat known bugs, 2003-11-03
|
||||
|
||||
- ./configure does not check that Curses header is installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(irc protocol is under dev!)
|
||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
||||
problem)
|
||||
- alias/unalias commands doesn't work
|
||||
- config is not saved (to ~/.weechat/weechatrc)
|
||||
(IRC protocol is under dev!)
|
||||
- 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
|
||||
- too much opened channels => display bug
|
||||
- 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
|
||||
|
||||
@@ -1,88 +1,45 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2003-09-27
|
||||
ChangeLog - 2003-11-03
|
||||
|
||||
* 2003-09-27:
|
||||
- WeeChat 0.0.1 released!
|
||||
|
||||
* 2003-09-26:
|
||||
- added completor prefix (in config: look_nick_completor)
|
||||
- fixef log_printf command (bug with year & month)
|
||||
- added "/kill" command
|
||||
- fixed /version and /ctcp commands (missing ":" before message)
|
||||
Version 0.0.3 (2003-11-03):
|
||||
* ./configure script to build WeeChat
|
||||
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||
* 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-25:
|
||||
- added "/kick" command
|
||||
- added IRC errors 402 to 407
|
||||
- added "/invite" command
|
||||
Version 0.0.2 (2003-10-05):
|
||||
* added commands /rehash and /restart
|
||||
* 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-24:
|
||||
- "ctcp version" received is now correctly displayed
|
||||
- "/version" command is ok
|
||||
|
||||
* 2003-09-23:
|
||||
- log file (~/.weechat/weechat.log)
|
||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
||||
|
||||
* 2003-09-21:
|
||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
||||
unread messages (from other users), lightmagenta for windows with other
|
||||
unread data (join, part, quit, away, ...)
|
||||
- "320" IRC message management
|
||||
- "/clear" command
|
||||
|
||||
* 2003-09-19:
|
||||
- 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
|
||||
Version 0.0.1 (2003-09-27):
|
||||
* ncurses GUI with color output
|
||||
* multi-servers
|
||||
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||
* private windows
|
||||
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||
quote, topic, version, voice, whois
|
||||
* WeeChat commands: clear, help, set (partial)
|
||||
* many config options
|
||||
* log file (~/.weechat/weechat.log)
|
||||
* nicklist can be moved on top, bottom, left or right of window
|
||||
|
||||
@@ -1,6 +1,134 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat FAQ, 2003-09-19
|
||||
WeeChat FAQ, 2003-10-27
|
||||
|
||||
<<< 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 ? Irssi and xchat 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?
|
||||
|
||||
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 ? Irssi and xchat 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.
|
||||
|
||||
|
||||
/------------------------------------------------------------------------------\
|
||||
| 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
|
||||
===================================
|
||||
|
||||
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 ;)
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
SUBDIRS = po intl src
|
||||
|
||||
EXTRA_DIST = weechat.1 BUGS FAQ
|
||||
|
||||
man_MANS = weechat.1
|
||||
@@ -1,6 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
FlashCode, 2003-09-27
|
||||
* FlashCode, 2003-11-03
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
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
|
||||
--------
|
||||
* 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
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* 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)
|
||||
* 100% GPL & free
|
||||
|
||||
@@ -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
|
||||
(3) only GNU/Linux version is available today
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2003-09-27
|
||||
TODO - 2003-11-03
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,115 +10,78 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.1:
|
||||
v0.0.3:
|
||||
------
|
||||
|
||||
* General:
|
||||
# use of ./configure script for building WeeChat
|
||||
|
||||
* IRC protocol:
|
||||
# "/quote" command: send a raw string to the server without parsing it
|
||||
# "/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
|
||||
# implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
# "/wallops" command: write the same string to all the
|
||||
persons with the flag +w enable
|
||||
|
||||
* WeeChat commands:
|
||||
# "/clear": to clear window content
|
||||
|
||||
* Interface:
|
||||
# "demi-highlight" when joins/quits etc
|
||||
# log messages/warning/errors to ~/.weechat/log file
|
||||
# improve editing zone (left arrow <> backspace)
|
||||
# sort nick list
|
||||
# choose nick list position (top, left, right (default), bottom)
|
||||
# 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
|
||||
+ "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colours, time
|
||||
format, etc)
|
||||
|
||||
* TCP/IP communication:
|
||||
# IPv4 protocol implementation
|
||||
* Interface:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* Configuration:
|
||||
# write default config file
|
||||
# do not stop program if problem with options in config file
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* IRC protocol:
|
||||
- implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- manage "halfop" status
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- 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
|
||||
- "/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
|
||||
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:
|
||||
- "/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"
|
||||
in the text bar it send it to the server as "you")
|
||||
- "/exec" command: execute a command as if we was in shell
|
||||
and show us the output on the current window. An option to exec
|
||||
like -o could send the output to the server, on the current
|
||||
channel/private
|
||||
- "/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:
|
||||
+ Gtk GUI
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret ^B in messages (this means bold text)
|
||||
- internationalization (traduce WeeChat in many languages)
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- log chats to file
|
||||
- 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!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- add clock (in status bar?)
|
||||
- Gtk GUI
|
||||
- log chats to file
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
- add missing options for config file
|
||||
- write 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
|
||||
loading config)
|
||||
|
||||
|
||||
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"
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.3, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.3])
|
||||
|
||||
# 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])
|
||||
|
||||
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)
|
||||
|
||||
enable_plugins=no
|
||||
enable_perl=no
|
||||
PERL_CFLAGS=
|
||||
enable_python=no
|
||||
PYTHON_CFLAGS=
|
||||
enable_ruby=no
|
||||
RUBY_CFLAGS=
|
||||
enable_debug=no
|
||||
DEBUG_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")
|
||||
|
||||
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
|
||||
|
||||
CFLAGS="-Wall -W -pipe -O2"
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/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
+13
-1
@@ -1,5 +1,17 @@
|
||||
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
|
||||
|
||||
* 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
|
||||
Priority: optional
|
||||
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
|
||||
|
||||
Package: weechat
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${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-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
|
||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
||||
Mon, 03 Nov 2003 23:15:00 +0200.
|
||||
|
||||
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.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
export DH_VERBOSE=1
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
@@ -22,8 +17,7 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -31,21 +25,14 @@ build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -53,45 +40,41 @@ install: build
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into 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.
|
||||
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.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# 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
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
dh_link -a
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
dh_installdeb -a
|
||||
dh_shlibdeps -a
|
||||
dh_gencontrol -a
|
||||
dh_md5sums -a
|
||||
dh_builddeb -a
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.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,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,24 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./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-common.c
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.c
|
||||
./src/common/weeconfig.c
|
||||
./src/irc/irc.h
|
||||
./src/gui/gui.h
|
||||
./src/common/command.h
|
||||
./src/common/completion.h
|
||||
./src/common/history.h
|
||||
./src/common/weechat.h
|
||||
./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
|
||||
}
|
||||
+2557
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) 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
|
||||
#
|
||||
|
||||
SUBDIRS = common irc 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;
|
||||
}
|
||||
@@ -15,23 +15,17 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
OPTIONS=-Wall -W -pipe -O2
|
||||
noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
OUTPUT=../gui.a
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_GTK
|
||||
|
||||
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 ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
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
@@ -23,7 +23,7 @@
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "irc/irc.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
@@ -40,6 +40,16 @@ struct t_weechat_command
|
||||
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;
|
||||
|
||||
struct t_index_command
|
||||
@@ -49,15 +59,22 @@ struct t_index_command
|
||||
t_index_command *next_index;
|
||||
};
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_index_command *index_commands;
|
||||
|
||||
extern t_index_command *index_command_new (char *);
|
||||
extern void index_command_build ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias(int, char **);
|
||||
extern int weechat_cmd_clear(int, char **);
|
||||
extern int weechat_cmd_alias (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_server (int, char **);
|
||||
extern int weechat_cmd_save (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 */
|
||||
@@ -19,16 +19,19 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* completion.c: completes words according to context (cmd/nick) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "irc/irc.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "command.h"
|
||||
|
||||
|
||||
@@ -43,6 +46,17 @@ completion_init (t_completion *completion)
|
||||
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
|
||||
*/
|
||||
@@ -36,6 +36,7 @@ struct t_completion
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_free (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
@@ -19,16 +19,19 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "gui/gui.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
@@ -36,10 +36,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* weechat.c: core functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -49,10 +52,10 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "config.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "irc/irc.h"
|
||||
#include "gui/gui.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/* char *display_name; */
|
||||
@@ -128,7 +131,7 @@ wee_parse_args (int argc, char *argv[])
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (WEECHAT_VERSION "\n");
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
exit (0);
|
||||
}
|
||||
else
|
||||
@@ -211,8 +214,8 @@ wee_init_log ()
|
||||
void
|
||||
wee_shutdown ()
|
||||
{
|
||||
gui_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
if (log_file)
|
||||
fclose (log_file);
|
||||
exit (0);
|
||||
@@ -227,6 +230,15 @@ main (int argc, char *argv[])
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
/* pre-initiliaze interface */
|
||||
gui_pre_init (&argc, &argv);
|
||||
|
||||
/* initialize variables */
|
||||
wee_init_vars ();
|
||||
|
||||
@@ -239,6 +251,9 @@ main (int argc, char *argv[])
|
||||
/* init log file */
|
||||
wee_init_log ();
|
||||
|
||||
/* build commands index (sorted), for completion */
|
||||
index_command_build ();
|
||||
|
||||
/* read configuration */
|
||||
switch (config_read ())
|
||||
{
|
||||
@@ -256,9 +271,6 @@ main (int argc, char *argv[])
|
||||
/* init gui */
|
||||
gui_init ();
|
||||
|
||||
/* build commands index (sorted), for completion */
|
||||
index_command_build ();
|
||||
|
||||
/* Welcome message - yeah! */
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
@@ -273,14 +285,14 @@ main (int argc, char *argv[])
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||
(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,
|
||||
", %s\n", cfg_look_weechat_slogan);
|
||||
}
|
||||
if (cfg_look_startup_version)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||
"%s" WEECHAT_NAME_AND_VERSION,
|
||||
"%s" PACKAGE_STRING,
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s %s %s\n",
|
||||
@@ -292,17 +304,23 @@ main (int argc, char *argv[])
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||
|
||||
/* connect to all servers */
|
||||
/* connect to all servers (with autoconnect flag) */
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
server_create_window (ptr_server);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
if (ptr_server->autoconnect)
|
||||
{
|
||||
gui_window_new (ptr_server, NULL);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
}
|
||||
gui_main_loop ();
|
||||
server_disconnect_all ();
|
||||
|
||||
/* save config file */
|
||||
config_write (NULL);
|
||||
|
||||
/* program ending */
|
||||
wee_shutdown ();
|
||||
|
||||
@@ -23,21 +23,33 @@
|
||||
#ifndef __WEECHAT_H
|
||||
#define __WEECHAT_H 1
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libintl.h>
|
||||
|
||||
#define _(string) gettext(string)
|
||||
#define N_(string) (string)
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#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 WEECHAT_NAME " (c) 2003 by Wee Team"
|
||||
#define WEECHAT_COPYRIGHT PACKAGE_NAME " (c) 2003 by Wee Team"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(WEECHAT_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(WEECHAT_NAME " Warning:")
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||
|
||||
/* debug mode, 0=normal use, 1=some debug msg, 2=full debug (developers only) */
|
||||
#define DEBUG 0
|
||||
@@ -49,7 +61,7 @@
|
||||
/* license */
|
||||
|
||||
#define WEE_LICENSE \
|
||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
PACKAGE_STRING " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||
@@ -69,7 +81,7 @@
|
||||
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
|
||||
|
||||
#define WEE_USAGE \
|
||||
WEECHAT_NAME_AND_VERSION " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
PACKAGE_STRING " (c) Copyright 2003, compiled on " __DATE__ __TIME__ \
|
||||
"Developed by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@tuxisland.org>\n\n" \
|
||||
@@ -19,10 +19,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* config.c: WeeChat configuration */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -30,9 +33,10 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "config.h"
|
||||
#include "irc/irc.h"
|
||||
#include "gui/gui.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/* config sections */
|
||||
@@ -44,11 +48,13 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
|
||||
{ CONFIG_SECTION_LOG, "log" },
|
||||
{ CONFIG_SECTION_DCC, "dcc" },
|
||||
{ CONFIG_SECTION_PROXY, "proxy" },
|
||||
{ CONFIG_SECTION_ALIAS, "alias" },
|
||||
{ CONFIG_SECTION_SERVER, "server" }
|
||||
};
|
||||
|
||||
/* config, look & feel section */
|
||||
|
||||
int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
@@ -67,16 +73,20 @@ char *cfg_look_no_nickname;
|
||||
char *cfg_look_completor;
|
||||
|
||||
t_config_option weechat_options_look[] =
|
||||
{ { "look_startup_logo", N_("display " WEECHAT_NAME " logo at startup"),
|
||||
N_("display " WEECHAT_NAME " logo at startup"),
|
||||
{ { "look_set_title", N_("set title for terminal window (curses GUI) with name & version"),
|
||||
N_("set title for terminal window (curses GUI) with name & version"),
|
||||
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,
|
||||
NULL, NULL, &cfg_look_startup_logo, NULL, NULL },
|
||||
{ "look_startup_version", N_("display " WEECHAT_NAME " version at startup"),
|
||||
N_("display " WEECHAT_NAME " version at startup"),
|
||||
{ "look_startup_version", N_("display WeeChat version at startup"),
|
||||
N_("display WeeChat version at startup"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_startup_version, NULL, NULL },
|
||||
{ "look_weechat_slogan", N_(WEECHAT_NAME "slogan"),
|
||||
N_(WEECHAT_NAME "slogan (if empty, slogan is not used)"),
|
||||
{ "look_weechat_slogan", N_("WeeChat slogan"),
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, NULL },
|
||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||
@@ -333,7 +343,7 @@ t_config_option weechat_options_log[] =
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
{ "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,
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, NULL },
|
||||
{ "log_name", N_("name for log files"),
|
||||
@@ -346,12 +356,12 @@ t_config_option weechat_options_log[] =
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~", NULL, NULL, &cfg_log_timestamp, NULL },
|
||||
{ "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)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"--- 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"),
|
||||
N_("text writed when ending log file "
|
||||
N_("text written when ending log file "
|
||||
"(see man strftime for date/time specifiers)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"--- Log ended %a %b %d %Y %H:%M:%s", NULL, NULL, &cfg_log_end_string, NULL },
|
||||
@@ -399,7 +409,7 @@ t_config_option weechat_options_dcc[] =
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_dcc_auto_rename, NULL, NULL },
|
||||
{ "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,
|
||||
NULL, NULL, &cfg_dcc_auto_resume, NULL, NULL },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
@@ -441,6 +451,10 @@ t_config_option weechat_options_server[] =
|
||||
N_("name associated to IRC server (for display only)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", 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"),
|
||||
N_("IP address or hostname of IRC server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -473,6 +487,14 @@ t_config_option weechat_options_server[] =
|
||||
N_("real name to use on IRC server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", 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 }
|
||||
};
|
||||
|
||||
@@ -481,7 +503,7 @@ t_config_option weechat_options_server[] =
|
||||
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
||||
{ weechat_options_look, weechat_options_colors, weechat_options_history,
|
||||
weechat_options_log, weechat_options_dcc, weechat_options_proxy,
|
||||
weechat_options_server
|
||||
NULL, weechat_options_server
|
||||
};
|
||||
|
||||
|
||||
@@ -507,21 +529,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
|
||||
config_init_server ()
|
||||
int
|
||||
config_option_set_value (t_config_option *option, char *value)
|
||||
{
|
||||
cfg_server.name = NULL;
|
||||
cfg_server.address = NULL;
|
||||
cfg_server.port = -1;
|
||||
cfg_server.password = NULL;
|
||||
cfg_server.nick1 = NULL;
|
||||
cfg_server.nick2 = NULL;
|
||||
cfg_server.nick3 = NULL;
|
||||
cfg_server.username = NULL;
|
||||
cfg_server.realname = NULL;
|
||||
int int_value;
|
||||
|
||||
switch (option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (value, "on") == 0)
|
||||
*(option->ptr_int) = BOOL_TRUE;
|
||||
else if (strcasecmp (value, "off") == 0)
|
||||
*(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 +634,10 @@ config_allocate_server (char *filename, int line_number)
|
||||
return 0;
|
||||
}
|
||||
if (!server_new (cfg_server.name,
|
||||
cfg_server.address, cfg_server.port, cfg_server.password,
|
||||
cfg_server.nick1, cfg_server.nick2, cfg_server.nick3,
|
||||
cfg_server.username, cfg_server.realname))
|
||||
cfg_server.autoconnect, cfg_server.address, cfg_server.port,
|
||||
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
|
||||
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||
cfg_server.command, cfg_server.autojoin))
|
||||
{
|
||||
server_free_all ();
|
||||
gui_printf (NULL,
|
||||
@@ -566,26 +645,9 @@ config_allocate_server (char *filename, int line_number)
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
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;
|
||||
}
|
||||
@@ -601,7 +663,7 @@ config_default_values ()
|
||||
|
||||
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++)
|
||||
{
|
||||
@@ -654,7 +716,7 @@ config_read ()
|
||||
{
|
||||
char *filename;
|
||||
FILE *file;
|
||||
int section, line_number, i, option_number, int_value;
|
||||
int section, line_number, i, option_number;
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
@@ -670,7 +732,7 @@ config_read ()
|
||||
}
|
||||
|
||||
config_default_values ();
|
||||
config_init_server ();
|
||||
server_init (&cfg_server);
|
||||
|
||||
/* read config file */
|
||||
section = CONFIG_SECTION_NONE;
|
||||
@@ -694,58 +756,44 @@ config_read ()
|
||||
{
|
||||
pos = strchr (line, ']');
|
||||
if (pos == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"]\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
fclose (file);
|
||||
free (filename);
|
||||
return -2;
|
||||
}
|
||||
pos[0] = '\0';
|
||||
pos = ptr_line + 1;
|
||||
section = CONFIG_SECTION_NONE;
|
||||
for (i = 0; config_sections[i].section_name; i++)
|
||||
else
|
||||
{
|
||||
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;
|
||||
break;
|
||||
if (strcmp (config_sections[i].section_name, pos) == 0)
|
||||
{
|
||||
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
|
||||
{
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
fclose (file);
|
||||
free (filename);
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = '\0';
|
||||
@@ -756,128 +804,83 @@ config_read ()
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
|
||||
if (section == CONFIG_SECTION_ALIAS)
|
||||
{
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
option_number = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (option_number < 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, ptr_line);
|
||||
fclose (file);
|
||||
free (filename);
|
||||
return -2;
|
||||
if (alias_new (line, pos))
|
||||
index_command_new (pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (weechat_options[section]
|
||||
[option_number].option_type)
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (pos, "on") == 0)
|
||||
*weechat_options[section]
|
||||
[option_number].ptr_int = BOOL_TRUE;
|
||||
else if (strcasecmp (pos, "off") == 0)
|
||||
*weechat_options[section]
|
||||
[option_number].ptr_int = BOOL_FALSE;
|
||||
else
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
option_number = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (option_number < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, ptr_line);
|
||||
else
|
||||
{
|
||||
if (config_option_set_value (&weechat_options[section][option_number], pos) < 0)
|
||||
{
|
||||
switch (weechat_options[section]
|
||||
[option_number].option_type)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for"
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
fclose (file);
|
||||
free (filename);
|
||||
return -2;
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for"
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line,
|
||||
weechat_options[section][option_number].min,
|
||||
weechat_options[section][option_number].max);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
i = 0;
|
||||
while (weechat_options[section][option_number].array_values[i])
|
||||
{
|
||||
gui_printf (NULL, "\"%s\" ",
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
i++;
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid color "
|
||||
"name for option '%s'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number,
|
||||
ptr_line);
|
||||
break;
|
||||
}
|
||||
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 +923,8 @@ config_read ()
|
||||
|
||||
/*
|
||||
* config_create_default: create default WeeChat config
|
||||
* return: 0 if ok
|
||||
* < 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -936,24 +941,25 @@ config_create_default ()
|
||||
sprintf (filename, "%s/.weechat/" WEECHAT_CONFIG_NAME, getenv ("HOME"));
|
||||
if ((file = fopen (filename, "wt")) == NULL)
|
||||
{
|
||||
free (filename);
|
||||
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||
WEECHAT_ERROR, filename);
|
||||
free (filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf (_(WEECHAT_NAME ": creating default config file...\n"));
|
||||
printf (_("%s: creating default config file...\n"), PACKAGE_NAME);
|
||||
log_printf (_("creating default config file\n"));
|
||||
|
||||
current_time = time (NULL);
|
||||
sprintf (line, _("#\n# " WEECHAT_NAME " configuration file, generated by "
|
||||
WEECHAT_NAME " " WEECHAT_VERSION " on %s"), ctime (¤t_time));
|
||||
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);
|
||||
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++)
|
||||
{
|
||||
if (i != CONFIG_SECTION_SERVER)
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
sprintf (line, "\n[%s]\n", config_sections[i].section_name);
|
||||
fputs (line, file);
|
||||
@@ -969,33 +975,62 @@ config_create_default ()
|
||||
{
|
||||
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].
|
||||
default_int) ? "on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
sprintf (line, "%s=%d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
case OPTION_TYPE_COLOR:
|
||||
case OPTION_TYPE_STRING:
|
||||
sprintf (line, "%s=%s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
sprintf (line, "%s=%s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].default_int) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
sprintf (line, "%s=%d\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_int);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
case OPTION_TYPE_COLOR:
|
||||
case OPTION_TYPE_STRING:
|
||||
sprintf (line, "%s=%s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
}
|
||||
fputs (line, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* default aliases */
|
||||
/* TODO: remove comments when missing commands will be ok */
|
||||
fputs ("\n[alias]\n", file);
|
||||
fputs ("SAY=msg *\n", file);
|
||||
fputs ("BYE=quit\n", file);
|
||||
fputs ("EXIT=quit\n", file);
|
||||
fputs ("SIGNOFF=quit\n", file);
|
||||
fputs ("C=clear\n", file);
|
||||
fputs ("CL=clear\n", file);
|
||||
fputs ("# CHAT=dcc chat\n", file);
|
||||
fputs ("# GET=dcc get\n", file);
|
||||
fputs ("# IG=ignore\n", file);
|
||||
fputs ("J=join\n", file);
|
||||
fputs ("K=kick\n", file);
|
||||
fputs ("# KB=kickban\n", file);
|
||||
fputs ("# KN=knockout\n", file);
|
||||
fputs ("LEAVE=part\n", file);
|
||||
fputs ("M=msg\n", file);
|
||||
fputs ("# MUB=unban *\n", file);
|
||||
fputs ("N=names\n", file);
|
||||
fputs ("T=topic\n", file);
|
||||
fputs ("# UB=unban\n", file);
|
||||
fputs ("# UNIG=unignore\n", file);
|
||||
fputs ("# W=who\n", file);
|
||||
fputs ("WC=part\n", file);
|
||||
fputs ("WI=whois\n", file);
|
||||
fputs ("# WW=whowas\n", file);
|
||||
|
||||
/* default server is freenode */
|
||||
fputs ("\n[server]\n", file);
|
||||
fputs ("server_name=freenode\n", file);
|
||||
fputs ("server_autoconnect=on\n", file);
|
||||
fputs ("server_address=irc.freenode.net\n", file);
|
||||
fputs ("server_port=6667\n", file);
|
||||
fputs ("server_password=\n", file);
|
||||
@@ -1004,6 +1039,8 @@ config_create_default ()
|
||||
fputs ("server_nick3=weechat3\n", file);
|
||||
fputs ("server_username=weechat\n", file);
|
||||
fputs ("server_realname=WeeChat default realname\n", file);
|
||||
fputs ("server_command=\n", file);
|
||||
fputs ("server_autojoin=\n", file);
|
||||
|
||||
fclose (file);
|
||||
free (filename);
|
||||
@@ -1012,10 +1049,153 @@ config_create_default ()
|
||||
|
||||
/*
|
||||
* config_write: write WeeChat configurtion
|
||||
* return: 0 if ok
|
||||
* < 0 if error
|
||||
*/
|
||||
|
||||
void
|
||||
config_write ()
|
||||
int
|
||||
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 (getenv ("HOME")) + 64) * sizeof (char));
|
||||
sprintf (filename, "%s/.weechat/" WEECHAT_CONFIG_NAME, getenv ("HOME"));
|
||||
}
|
||||
|
||||
if ((file = fopen (filename, "wt")) == NULL)
|
||||
{
|
||||
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||
WEECHAT_ERROR, filename);
|
||||
free (filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -32,8 +32,9 @@
|
||||
#define CONFIG_SECTION_LOG 3
|
||||
#define CONFIG_SECTION_DCC 4
|
||||
#define CONFIG_SECTION_PROXY 5
|
||||
#define CONFIG_SECTION_SERVER 6
|
||||
#define CONFIG_NUMBER_SECTIONS 7
|
||||
#define CONFIG_SECTION_ALIAS 6
|
||||
#define CONFIG_SECTION_SERVER 7
|
||||
#define CONFIG_NUMBER_SECTIONS 8
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -74,6 +75,7 @@ struct t_config_option
|
||||
int (*handler_change)(int *, char **);
|
||||
};
|
||||
|
||||
extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
@@ -150,6 +152,6 @@ extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
|
||||
extern int config_read ();
|
||||
extern int config_create_default ();
|
||||
extern void config_write ();
|
||||
extern int config_write ();
|
||||
|
||||
#endif /* config.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
|
||||
@@ -15,17 +15,16 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
OUTPUT=weechat
|
||||
if GUI_CURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
all:
|
||||
cd src && make
|
||||
if GUI_GTK
|
||||
gtk_dir=gtk
|
||||
endif
|
||||
|
||||
install:
|
||||
@mkdir -v -p $(DESTDIR)/usr/$(LOCALRPM)/bin
|
||||
@cp -v src/$(OUTPUT) $(DESTDIR)/usr/$(LOCALRPM)/bin/
|
||||
@mkdir -v -p $(DESTDIR)/usr/share/man/man1
|
||||
@cp -v weechat.1 $(DESTDIR)/usr/share/man/man1/
|
||||
@echo -e "\n=== WeeChat installed!\n"
|
||||
if GUI_QT
|
||||
qt_dir=qt
|
||||
endif
|
||||
|
||||
clean:
|
||||
cd src && make clean
|
||||
SUBDIRS = $(curses_dir) $(gtk_dir) $(qt_dir)
|
||||
@@ -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,27 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(CURSES_LIBS)
|
||||
|
||||
weechat_curses_SOURCES = ../gui.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
gui-input.c
|
||||
+116
-282
@@ -19,31 +19,27 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* gui-display.c: display functions for Curses 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 <curses.h>
|
||||
|
||||
#include "../../weechat.h"
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../config.h"
|
||||
#include "../../common/weeconfig.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[] =
|
||||
{ { "default", -1 | A_NORMAL },
|
||||
{ "black", COLOR_BLACK | A_NORMAL },
|
||||
@@ -158,6 +154,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
|
||||
*/
|
||||
@@ -298,7 +305,7 @@ gui_draw_window_title (t_gui_window *window)
|
||||
{
|
||||
/* TODO: change this copyright as title? */
|
||||
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),
|
||||
"%s", WEECHAT_COPYRIGHT);
|
||||
}
|
||||
@@ -411,11 +418,13 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||
if (!ptr_message ||
|
||||
(window->win_chat_cursor_x > (window->win_chat_width - 1)))
|
||||
{
|
||||
window->win_chat_cursor_x = 0;
|
||||
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_x = 0;
|
||||
lines_displayed++;
|
||||
}
|
||||
}
|
||||
@@ -503,7 +512,11 @@ gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
|
||||
if (!ptr_message ||
|
||||
((window->win_chat_cursor_y <= window->win_chat_height - 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_x = 0;
|
||||
}
|
||||
}
|
||||
@@ -611,7 +624,8 @@ gui_draw_window_nick (t_gui_window *window)
|
||||
if (CHANNEL(window) && CHANNEL(window)->nicks)
|
||||
{
|
||||
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);
|
||||
delwin (window->win_chat);
|
||||
@@ -624,8 +638,7 @@ gui_draw_window_nick (t_gui_window *window)
|
||||
window->win_nick_width,
|
||||
window->win_nick_y,
|
||||
window->win_nick_x);
|
||||
//scrollok (window->win_chat, TRUE);
|
||||
gui_redraw_window_chat (window);
|
||||
gui_draw_window_chat (window);
|
||||
}
|
||||
sprintf (format, "%%-%ds", max_length);
|
||||
|
||||
@@ -752,6 +765,7 @@ void
|
||||
gui_draw_window_status (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format_more[32];
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if (window != gui_current_window)
|
||||
@@ -853,9 +867,12 @@ gui_draw_window_status (t_gui_window *window)
|
||||
/* display "*MORE*" if last line is not displayed */
|
||||
gui_window_set_color (window->win_status, COLOR_WIN_STATUS_MORE);
|
||||
if (window->sub_lines > 0)
|
||||
mvwprintw (window->win_status, 0, COLS - 7, "-MORE-");
|
||||
mvwprintw (window->win_status, 0, COLS - 7, _("-MORE-"));
|
||||
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);
|
||||
refresh ();
|
||||
@@ -958,17 +975,34 @@ gui_draw_window_input (t_gui_window *window)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (format, "%%s> %%-%ds", input_width);
|
||||
if (SERVER(window) && (SERVER(window)->is_connected))
|
||||
ptr_nickname = SERVER(window)->nick;
|
||||
if (SERVER(window))
|
||||
{
|
||||
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
|
||||
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));
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
wrefresh (window->win_input);
|
||||
@@ -1009,55 +1043,6 @@ gui_redraw_window (t_gui_window *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
|
||||
*/
|
||||
@@ -1071,7 +1056,7 @@ gui_switch_to_window (t_gui_window *window)
|
||||
another_window = 0;
|
||||
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 */
|
||||
another_window = 1;
|
||||
@@ -1085,21 +1070,22 @@ gui_switch_to_window (t_gui_window *window)
|
||||
ptr_win->win_nick = NULL;
|
||||
ptr_win->win_status = NULL;
|
||||
ptr_win->win_input = NULL;
|
||||
ptr_win->is_displayed = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_calculate_pos_size (window);
|
||||
|
||||
/* first time creation for windows */
|
||||
if (!another_window)
|
||||
{
|
||||
/* create new windows */
|
||||
gui_calculate_pos_size (window);
|
||||
window->win_title = newwin (1, COLS, 0, 0);
|
||||
window->win_chat = newwin (window->win_chat_height,
|
||||
window->win_chat_width,
|
||||
window->win_chat_y,
|
||||
window->win_chat_x);
|
||||
//scrollok (window->win_chat, TRUE);
|
||||
if (CHANNEL(window))
|
||||
window->win_nick = newwin (window->win_nick_height,
|
||||
window->win_nick_width,
|
||||
@@ -1112,40 +1098,40 @@ gui_switch_to_window (t_gui_window *window)
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_calculate_pos_size (window);
|
||||
|
||||
/* 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);
|
||||
window->win_chat = newwin (window->win_chat_height,
|
||||
window->win_chat_width,
|
||||
window->win_chat_y,
|
||||
window->win_chat_x);
|
||||
//scrollok (window->win_chat, TRUE);
|
||||
window->win_nick = newwin (window->win_nick_height,
|
||||
window->win_nick_width,
|
||||
window->win_nick_y,
|
||||
window->win_nick_x);
|
||||
}
|
||||
if (!(WIN_IS_CHANNEL(window)) && window->win_nick)
|
||||
if (!(WIN_IS_CHANNEL(window)))
|
||||
{
|
||||
/* remove nick list window */
|
||||
delwin (window->win_nick);
|
||||
if (window->win_nick)
|
||||
delwin (window->win_nick);
|
||||
window->win_nick = NULL;
|
||||
delwin (window->win_chat);
|
||||
window->win_chat = newwin (window->win_chat_height,
|
||||
window->win_chat_width,
|
||||
window->win_chat_y,
|
||||
window->win_chat_x);
|
||||
//scrollok (window->win_chat, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* change current window to the new window */
|
||||
gui_current_window = window;
|
||||
|
||||
window->is_displayed = 1;
|
||||
window->unread_data = 0;
|
||||
}
|
||||
|
||||
@@ -1220,133 +1206,11 @@ gui_move_page_down ()
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 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
|
||||
* gui_curses_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
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 ()
|
||||
gui_curses_resize_handler ()
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
int width, height;
|
||||
@@ -1358,10 +1222,10 @@ gui_resize_term_handler ()
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
gui_calculate_pos_size (ptr_win);
|
||||
// TODO: manage splitted windows!
|
||||
if (ptr_win->win_title)
|
||||
{
|
||||
ptr_win->is_displayed = 0;
|
||||
if (ptr_win->win_title)
|
||||
delwin (ptr_win->win_title);
|
||||
if (ptr_win->win_chat)
|
||||
@@ -1382,6 +1246,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
|
||||
*/
|
||||
@@ -1501,10 +1391,16 @@ gui_init ()
|
||||
|
||||
gui_init_colors ();
|
||||
|
||||
/* create windows */
|
||||
/* create a new window */
|
||||
gui_current_window = gui_window_new (NULL, NULL /*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;
|
||||
}
|
||||
@@ -1534,72 +1430,11 @@ gui_end ()
|
||||
/* TODO: free input buffer, lines, messages, completion */
|
||||
}
|
||||
|
||||
/* end of ncurses output */
|
||||
/* end of curses output */
|
||||
refresh ();
|
||||
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
|
||||
*/
|
||||
@@ -1643,7 +1478,7 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
|
||||
if ((window->win_chat_cursor_y
|
||||
+ gui_get_line_num_splits (window, window->last_line)) >
|
||||
(window->win_chat_height - 1))
|
||||
gui_redraw_window_chat (window);
|
||||
gui_draw_window_chat (window);
|
||||
else
|
||||
gui_display_line (window, window->last_line, 1);
|
||||
}
|
||||
@@ -1715,11 +1550,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_DARK, "] ");
|
||||
}
|
||||
gui_add_message (window, type, color, pos+1);
|
||||
pos = strchr (pos+1, '\n');
|
||||
if (pos)
|
||||
if (pos[1] == '\0')
|
||||
pos = NULL;
|
||||
gui_add_message (window, type, color, pos + 1);
|
||||
pos = strchr (pos + 1, '\n');
|
||||
if (pos && !pos[1])
|
||||
pos = NULL;
|
||||
}
|
||||
|
||||
wrefresh (window->win_chat);
|
||||
|
||||
+8
-160
@@ -19,10 +19,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* gui-input: user input functions for Curses GUI */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -32,168 +35,13 @@
|
||||
#include <sys/socket.h>
|
||||
#include <curses.h>
|
||||
|
||||
#include "../../weechat.h"
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
#include "../../config.h"
|
||||
#include "../../command.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
#define KEY_ESCAPE 27
|
||||
|
||||
/*
|
||||
* gui_read_keyb: read keyboard line
|
||||
|
||||
@@ -15,23 +15,15 @@
|
||||
# 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
|
||||
OBJS=gui-display.o gui-input.o
|
||||
DEFINES=WEE_QT
|
||||
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(GTK_LIBS)
|
||||
|
||||
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 ../../config.h \
|
||||
../../irc/irc.h ../../gui/gui.h
|
||||
gui-input.o: gui-input.c ../../weechat.h ../gui.h
|
||||
weechat_gtk_SOURCES = ../gui.h \
|
||||
../gui-common.c \
|
||||
gui-display.c \
|
||||
gui-input.c
|
||||
@@ -0,0 +1,752 @@
|
||||
/*
|
||||
* 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-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 /*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)
|
||||
{
|
||||
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 */
|
||||
@@ -19,8 +19,46 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* gui-gtk.c: Gtk+ GUI for WeeChat */
|
||||
/* gui-input: user input functions for Gtk GUI */
|
||||
|
||||
|
||||
/* ***** Gtk+ GUI for WeeChat, NOT developed! ***** */
|
||||
#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,454 @@
|
||||
/*
|
||||
* 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-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 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 */
|
||||
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_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);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
{
|
||||
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
|
||||
{
|
||||
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);
|
||||
}
|
||||
+37
-34
@@ -23,16 +23,8 @@
|
||||
#ifndef __WEECHAT_GUI_H
|
||||
#define __WEECHAT_GUI_H 1
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "../completion.h"
|
||||
#include "../history.h"
|
||||
|
||||
#ifdef WEE_CURSES
|
||||
#define KEY_ESCAPE 27
|
||||
#endif
|
||||
#include "../common/completion.h"
|
||||
#include "../common/history.h"
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
@@ -120,6 +112,8 @@ typedef struct t_gui_window t_gui_window;
|
||||
|
||||
struct t_gui_window
|
||||
{
|
||||
int is_displayed; /* = 1 if window is displayed */
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* window's server */
|
||||
void *channel; /* window's channel */
|
||||
@@ -140,20 +134,22 @@ struct t_gui_window
|
||||
int win_nick_width; /* width of chat window */
|
||||
int win_nick_height; /* height of chat window */
|
||||
|
||||
/* windows */
|
||||
#ifdef WEE_CURSES
|
||||
WINDOW *win_title; /* title window */
|
||||
WINDOW *win_chat; /* chat window (exemple: channel) */
|
||||
WINDOW *win_nick; /* nick window */
|
||||
WINDOW *win_status; /* status window */
|
||||
WINDOW *win_input; /* input window */
|
||||
#endif
|
||||
#ifdef WEE_GTK
|
||||
/* TODO: declare Gtk+ window */
|
||||
#endif
|
||||
#ifdef WEE_QT
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (exemple: channel) */
|
||||
void *win_nick; /* nick window */
|
||||
void *win_status; /* status window */
|
||||
void *win_input; /* input window */
|
||||
|
||||
/* windows for Curses GUI */
|
||||
void *textview_chat; /* textview widget for chat */
|
||||
void *textbuffer_chat; /* textbuffer widget for chat */
|
||||
void *texttag_chat; /* texttag widget for chat */
|
||||
void *textview_nicklist; /* textview widget for nicklist */
|
||||
void *textbuffer_nicklist; /* textbuffer widget for nicklist */
|
||||
|
||||
/* windows for Curses GUI */
|
||||
/* TODO: declare Qt window */
|
||||
#endif
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
@@ -186,14 +182,28 @@ struct t_gui_window
|
||||
|
||||
extern int gui_ready;
|
||||
extern t_gui_window *gui_windows;
|
||||
extern t_gui_window *last_gui_window;
|
||||
extern t_gui_window *gui_current_window;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* GUI independent functions */
|
||||
extern t_gui_window *gui_window_new (void *, void * /*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_get_color_by_name (char *);
|
||||
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_redraw_window_title (t_gui_window *);
|
||||
extern void gui_draw_window_chat (t_gui_window *);
|
||||
@@ -205,25 +215,18 @@ extern void gui_redraw_window_status (t_gui_window *);
|
||||
extern void gui_draw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window (t_gui_window *);
|
||||
|
||||
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_previous_window ();
|
||||
extern void gui_switch_to_next_window ();
|
||||
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
//extern void gui_init_colors ();
|
||||
extern void gui_init ();
|
||||
/* 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_end ();
|
||||
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 ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# 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
|
||||
#
|
||||
@@ -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) 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
|
||||
#
|
||||
|
||||
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
|
||||
@@ -19,14 +19,17 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-channel.c: manages a chat (channel or private chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
|
||||
+110
-2773
File diff suppressed because it is too large
Load Diff
@@ -19,18 +19,21 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-display.c: display functions for IRC */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../config.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
|
||||
+7
-4
@@ -19,15 +19,18 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-nick.c: manages nick list for channels */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
@@ -79,8 +82,8 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 3) + (nick1->is_halfop * 2) + nick1->has_voice );
|
||||
score2 = - ( (nick2->is_op * 3) + (nick2->is_halfop * 2) + nick2->has_voice );
|
||||
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
|
||||
+2483
File diff suppressed because it is too large
Load Diff
+1058
File diff suppressed because it is too large
Load Diff
+121
-67
@@ -19,10 +19,13 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* irc-server.c: (dis)connection and communication with irc server */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
@@ -34,7 +37,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -49,6 +52,36 @@ t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
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
|
||||
*/
|
||||
@@ -65,28 +98,12 @@ server_alloc ()
|
||||
/* alloc memory for new server */
|
||||
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;
|
||||
}
|
||||
|
||||
/* initialize new server */
|
||||
new_server->name = NULL;
|
||||
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;
|
||||
server_init (new_server);
|
||||
|
||||
/* add new server to queue */
|
||||
new_server->prev_server = last_irc_server;
|
||||
@@ -102,42 +119,12 @@ server_alloc ()
|
||||
}
|
||||
|
||||
/*
|
||||
* server_create_window: create windows for a server
|
||||
* server_destroy: free server data (not struct himself)
|
||||
*/
|
||||
|
||||
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 */
|
||||
if (server->name)
|
||||
free (server->name);
|
||||
@@ -155,12 +142,42 @@ server_free (t_irc_server *server)
|
||||
free (server->username);
|
||||
if (server->realname)
|
||||
free (server->realname);
|
||||
if (server->command)
|
||||
free (server->command);
|
||||
if (server->autojoin)
|
||||
free (server->autojoin);
|
||||
if (server->nick)
|
||||
free (server->nick);
|
||||
if (server->channels)
|
||||
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);
|
||||
irc_servers = new_irc_servers;
|
||||
}
|
||||
@@ -182,26 +199,29 @@ server_free_all ()
|
||||
*/
|
||||
|
||||
t_irc_server *
|
||||
server_new (char *name, char *address, int port, char *password,
|
||||
char *nick1, char *nick2, char *nick3,
|
||||
char *username, char *realname)
|
||||
server_new (char *name, int autoconnect, char *address, int port,
|
||||
char *password, char *nick1, char *nick2, char *nick3,
|
||||
char *username, char *realname, char *command, char *autojoin)
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
if (!name || !address || (port < 0) || !nick1 || !nick2 || !nick3
|
||||
|| !username || !realname)
|
||||
if (!name || !address || (port < 0))
|
||||
return NULL;
|
||||
|
||||
#if DEBUG >= 1
|
||||
log_printf ("creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s)\n",
|
||||
name, address, port, password, nick1, nick2, nick3,
|
||||
username, realname);
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
{
|
||||
new_server->name = strdup (name);
|
||||
new_server->autoconnect = autoconnect;
|
||||
new_server->address = strdup (address);
|
||||
new_server->port = port;
|
||||
new_server->password = (password) ? strdup (password) : strdup ("");
|
||||
@@ -212,6 +232,10 @@ server_new (char *name, char *address, int port, char *password,
|
||||
(username) ? strdup (username) : strdup ("weechat");
|
||||
new_server->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);
|
||||
}
|
||||
else
|
||||
@@ -458,9 +482,9 @@ server_connect (t_irc_server *server)
|
||||
int server_pipe[2];
|
||||
|
||||
gui_printf (server->window,
|
||||
_(WEECHAT_NAME ": connecting to %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
log_printf ("connecting to server %s:%d...\n",
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
log_printf (_("connecting to server %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
server->is_connected = 0;
|
||||
|
||||
@@ -482,7 +506,7 @@ server_connect (t_irc_server *server)
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
_("%s cannot set socket option 'SO_REUSEADDR'\n"),
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
@@ -530,7 +554,7 @@ server_connect (t_irc_server *server)
|
||||
|
||||
/* connection to server */
|
||||
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));
|
||||
if (error != 0)
|
||||
@@ -555,12 +579,24 @@ server_connect (t_irc_server *server)
|
||||
void
|
||||
server_disconnect (t_irc_server *server)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
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_write);
|
||||
close (server->sock4);
|
||||
server->is_connected = 0;
|
||||
server->sock4 = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,6 +613,24 @@ server_disconnect_all ()
|
||||
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
|
||||
*/
|
||||
|
||||
+38
-6
@@ -78,6 +78,7 @@ struct t_irc_server
|
||||
{
|
||||
/* user choices */
|
||||
char *name; /* name of server (only for display) */
|
||||
int autoconnect; /* = 1 if auto connect at startup */
|
||||
char *address; /* address of server (IP or name) */
|
||||
int port; /* port for server (6667 by default) */
|
||||
char *password; /* password for server */
|
||||
@@ -86,6 +87,8 @@ struct t_irc_server
|
||||
char *nick3; /* 2nd alternate nickname */
|
||||
char *username; /* user name */
|
||||
char *realname; /* real name */
|
||||
char *command; /* command to run once connected */
|
||||
char *autojoin; /* channels to automatically join */
|
||||
|
||||
/* internal vars */
|
||||
char *nick; /* current nickname */
|
||||
@@ -137,18 +140,20 @@ extern t_irc_channel *current_channel;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
extern void server_init (t_irc_server *);
|
||||
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_all ();
|
||||
extern t_irc_server *server_new (char *, char *, int, char *, char *, char *,
|
||||
char *, char *, char *);
|
||||
extern t_irc_server *server_new (char *, int, char *, int, char *, char *,
|
||||
char *, char *, char *, char *, char *, char *);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern int server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
extern int server_connect ();
|
||||
extern void server_disconnect (t_irc_server *);
|
||||
extern void server_disconnect_all ();
|
||||
extern t_irc_server *server_search (char *);
|
||||
extern int server_get_number_connected ();
|
||||
extern int server_name_already_exists (char *);
|
||||
|
||||
@@ -183,32 +188,54 @@ extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *);
|
||||
extern void irc_login (t_irc_server *);
|
||||
/* 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_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
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_ison (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_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_lusers (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_me (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_mode (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_msg (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_motd (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_names (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_nick (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_notice (t_irc_server *, char *);
|
||||
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_ping (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ping (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_pong (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quit (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_quote (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_rehash (t_irc_server *, char *);
|
||||
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_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_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_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
||||
@@ -226,9 +253,12 @@ 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_004 (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_311 (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_314 (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_319 (t_irc_server *, char *, char *);
|
||||
@@ -240,7 +270,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_333 (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_365 (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 *);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.TH WEECHAT 1 "September 2003" "FlashCode"
|
||||
.TH WEECHAT 1 "November 2003" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat \- wee enhanced environment for chat
|
||||
weechat \- Wee Enhanced Environment for Chat
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B weechat
|
||||
@@ -9,8 +9,11 @@ weechat \- wee enhanced environment for chat
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Fast, light and extensible IRC client for many operating systems. Everything can be
|
||||
done with a keyboard. It is customizable and extensible with scripts.
|
||||
Fast, light and extensible IRC client for many operating systems.
|
||||
.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
|
||||
.TP
|
||||
@@ -30,6 +33,9 @@ display WeeChat version
|
||||
.TP
|
||||
.B $HOME/.weechat/weechat.rc
|
||||
configuration file for WeeChat
|
||||
.TP
|
||||
.B $HOME/.weechat/weechat.log
|
||||
WeeChat log file
|
||||
|
||||
.SH AUTHOR
|
||||
WeeChat is written by:
|
||||
@@ -41,4 +47,8 @@ WeeChat is written by:
|
||||
WeeChat on the web:
|
||||
.UR
|
||||
http://weechat.flashtux.org
|
||||
.br
|
||||
Get support there:
|
||||
.UR
|
||||
http://weechat.flashtux.org/support.php
|
||||
.UE
|
||||
|
||||
+12
-5
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.1
|
||||
%define version 0.0.3
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -22,20 +22,27 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
|
||||
|
||||
%install
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
|
||||
|
||||
%find_lang %name
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root,0755)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING FAQ INSTALL NEWS README TODO
|
||||
/usr/share/man/man1/weechat.1*
|
||||
/usr/local/bin/weechat
|
||||
/usr/local/man/man1/weechat.1*
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Thu Sep 27 2003 FlashCode <flashcode@flashtux.org> 0.0.1-1
|
||||
* 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
|
||||
|
||||
+9
-9
@@ -1,17 +1,17 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2003-09-27
|
||||
WeeChat known bugs, 2003-11-03
|
||||
|
||||
- ./configure does not check that Curses header is installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(irc protocol is under dev!)
|
||||
- bug in nicklist resize (sometimes resize doesn't work and there is display
|
||||
problem)
|
||||
- alias/unalias commands doesn't work
|
||||
- config is not saved (to ~/.weechat/weechatrc)
|
||||
(IRC protocol is under dev!)
|
||||
- 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
|
||||
- too much opened channels => display bug
|
||||
- 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
|
||||
|
||||
+38
-81
@@ -1,88 +1,45 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2003-09-27
|
||||
ChangeLog - 2003-11-03
|
||||
|
||||
* 2003-09-27:
|
||||
- WeeChat 0.0.1 released!
|
||||
|
||||
* 2003-09-26:
|
||||
- added completor prefix (in config: look_nick_completor)
|
||||
- fixef log_printf command (bug with year & month)
|
||||
- added "/kill" command
|
||||
- fixed /version and /ctcp commands (missing ":" before message)
|
||||
Version 0.0.3 (2003-11-03):
|
||||
* ./configure script to build WeeChat
|
||||
* nicks are now correctly sorted (op, halfop, voice, other)
|
||||
* 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-25:
|
||||
- added "/kick" command
|
||||
- added IRC errors 402 to 407
|
||||
- added "/invite" command
|
||||
Version 0.0.2 (2003-10-05):
|
||||
* added commands /rehash and /restart
|
||||
* 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-24:
|
||||
- "ctcp version" received is now correctly displayed
|
||||
- "/version" command is ok
|
||||
|
||||
* 2003-09-23:
|
||||
- log file (~/.weechat/weechat.log)
|
||||
- renamed config file (~/.weechat/weechatrc to ~/.weechat/weechat.rc)
|
||||
|
||||
* 2003-09-21:
|
||||
- "demi-highlight": 2 types of windows highlight: lightred for windows with
|
||||
unread messages (from other users), lightmagenta for windows with other
|
||||
unread data (join, part, quit, away, ...)
|
||||
- "320" IRC message management
|
||||
- "/clear" command
|
||||
|
||||
* 2003-09-19:
|
||||
- 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
|
||||
Version 0.0.1 (2003-09-27):
|
||||
* ncurses GUI with color output
|
||||
* multi-servers
|
||||
* channel windows, with nicklist (position: top, bottom, left or right)
|
||||
* private windows
|
||||
* IRC commands: away, ctcp, deop, devoice, invite, join, kick, kill, list,
|
||||
me, mode, msg, names, nick, notice, op, oper, part, ping, pong, quit,
|
||||
quote, topic, version, voice, whois
|
||||
* WeeChat commands: clear, help, set (partial)
|
||||
* many config options
|
||||
* log file (~/.weechat/weechat.log)
|
||||
* nicklist can be moved on top, bottom, left or right of window
|
||||
|
||||
+130
-2
@@ -1,6 +1,134 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat FAQ, 2003-09-19
|
||||
WeeChat FAQ, 2003-10-27
|
||||
|
||||
<<< 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 ? Irssi and xchat 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?
|
||||
|
||||
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 ? Irssi and xchat 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.
|
||||
|
||||
|
||||
/------------------------------------------------------------------------------\
|
||||
| 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
|
||||
===================================
|
||||
|
||||
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 ;)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
SUBDIRS = po intl src
|
||||
|
||||
EXTRA_DIST = weechat.1 BUGS FAQ
|
||||
|
||||
man_MANS = weechat.1
|
||||
+10
-2
@@ -1,6 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
FlashCode, 2003-09-27
|
||||
* FlashCode, 2003-11-03
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
WeeChat 0.0.3 released.
|
||||
|
||||
* FlashCode, 2003-10-05
|
||||
|
||||
WeeChat 0.0.2 released.
|
||||
|
||||
* FlashCode, 2003-09-27
|
||||
|
||||
WeeChat 0.0.1 released.
|
||||
|
||||
+3
-2
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
|
||||
Features
|
||||
--------
|
||||
* 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
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* 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)
|
||||
* 100% GPL & free
|
||||
|
||||
@@ -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
|
||||
(3) only GNU/Linux version is available today
|
||||
|
||||
+27
-64
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2003-09-27
|
||||
TODO - 2003-11-03
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,115 +10,78 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.1:
|
||||
v0.0.3:
|
||||
------
|
||||
|
||||
* General:
|
||||
# use of ./configure script for building WeeChat
|
||||
|
||||
* IRC protocol:
|
||||
# "/quote" command: send a raw string to the server without parsing it
|
||||
# "/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
|
||||
# implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
# "/wallops" command: write the same string to all the
|
||||
persons with the flag +w enable
|
||||
|
||||
* WeeChat commands:
|
||||
# "/clear": to clear window content
|
||||
|
||||
* Interface:
|
||||
# "demi-highlight" when joins/quits etc
|
||||
# log messages/warning/errors to ~/.weechat/log file
|
||||
# improve editing zone (left arrow <> backspace)
|
||||
# sort nick list
|
||||
# choose nick list position (top, left, right (default), bottom)
|
||||
# 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
|
||||
+ "/set" command: allow the user to set the WeeChat variables
|
||||
under WeeChat without editing the config file (colours, time
|
||||
format, etc)
|
||||
|
||||
* TCP/IP communication:
|
||||
# IPv4 protocol implementation
|
||||
* Interface:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* Configuration:
|
||||
# write default config file
|
||||
# do not stop program if problem with options in config file
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* IRC protocol:
|
||||
- implement RFC 2812
|
||||
+ "/mode" command: change the user/channels modes
|
||||
- "/dcc" command (for chat and sending/receiving files)
|
||||
- manage "halfop" status
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/connect" and "/disconnect" commands (for multiservers use)
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- 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
|
||||
- "/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
|
||||
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:
|
||||
- "/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"
|
||||
in the text bar it send it to the server as "you")
|
||||
- "/exec" command: execute a command as if we was in shell
|
||||
and show us the output on the current window. An option to exec
|
||||
like -o could send the output to the server, on the current
|
||||
channel/private
|
||||
- "/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:
|
||||
+ Gtk GUI
|
||||
- display current channel modes (example : #weechat(+nt))
|
||||
- interpret ^B in messages (this means bold text)
|
||||
- internationalization (traduce WeeChat in many languages)
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- log chats to file
|
||||
- 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!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- add clock (in status bar?)
|
||||
- Gtk GUI
|
||||
- log chats to file
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
- add missing options for config file
|
||||
- write 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
|
||||
loading config)
|
||||
|
||||
|
||||
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,134 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.3, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.3])
|
||||
|
||||
# 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])
|
||||
|
||||
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)
|
||||
|
||||
enable_plugins=no
|
||||
enable_perl=no
|
||||
PERL_CFLAGS=
|
||||
enable_python=no
|
||||
PYTHON_CFLAGS=
|
||||
enable_ruby=no
|
||||
RUBY_CFLAGS=
|
||||
enable_debug=no
|
||||
DEBUG_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")
|
||||
|
||||
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
|
||||
|
||||
CFLAGS="-Wall -W -pipe -O2"
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
src/common/Makefile
|
||||
src/irc/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,17 @@
|
||||
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
|
||||
|
||||
* 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
|
||||
Priority: optional
|
||||
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
|
||||
|
||||
Package: weechat
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${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-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
|
||||
Sat, 27 Sep 2003 10:00:00 +0200.
|
||||
Mon, 03 Nov 2003 23:15:00 +0200.
|
||||
|
||||
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.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
|
||||
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
export DH_VERBOSE=1
|
||||
|
||||
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
CFLAGS += -O0
|
||||
@@ -22,8 +17,7 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-gtk
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -31,21 +25,14 @@ build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
$(MAKE)
|
||||
#/usr/bin/docbook-to-man debian/weechat.sgml > weechat.1
|
||||
|
||||
touch build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -53,45 +40,41 @@ install: build
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into 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.
|
||||
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.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
dh_installexamples
|
||||
# dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# 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
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
dh_link -a
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
dh_installdeb -a
|
||||
dh_shlibdeps -a
|
||||
dh_gencontrol -a
|
||||
dh_md5sums -a
|
||||
dh_builddeb -a
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
usr/bin
|
||||
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-curses
|
||||
@@ -0,0 +1 @@
|
||||
usr/bin
|
||||
@@ -0,0 +1 @@
|
||||
usr/bin/weechat-gtk
|
||||
@@ -1 +0,0 @@
|
||||
shlibs:Depends=libc6 (>= 2.3.2-1), libncurses5 (>= 5.3.20030510-1)
|
||||
@@ -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,24 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./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-common.c
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.c
|
||||
./src/common/weeconfig.c
|
||||
./src/irc/irc.h
|
||||
./src/gui/gui.h
|
||||
./src/common/command.h
|
||||
./src/common/completion.h
|
||||
./src/common/history.h
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.h
|
||||
+2599
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
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) 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
|
||||
#
|
||||
|
||||
SUBDIRS = common irc gui
|
||||
@@ -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;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user