mirror of
https://github.com/weechat/weechat.git
synced 2026-06-20 01:54:46 +02:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfc1c0370d | |||
| 89d9fb641e | |||
| a55da76244 | |||
| e90e206b35 | |||
| 8ede80b2b6 | |||
| 1af0359046 | |||
| 9c67fdf3ea | |||
| 0c695733b3 | |||
| df4ed3eeba | |||
| 85bd530a88 | |||
| 8921e45815 | |||
| 74b83e5294 | |||
| 4fa9edeb56 | |||
| 4d3e76eb3e | |||
| c48ee3cd73 | |||
| 9a7b7af41c | |||
| 7debba0eca | |||
| a0255a0a3a | |||
| 159fa3d806 | |||
| 07686bf69b | |||
| f877e8be51 | |||
| 757d00ab48 | |||
| ecb6ed6707 | |||
| 9d0b6fad72 | |||
| 63d6ee1007 | |||
| 6a1230de54 | |||
| 684f43298e | |||
| 26af7b49fd | |||
| 1ee8e1edb2 | |||
| a5bbd513b7 | |||
| 88930e50dd | |||
| 555999534e | |||
| 64601fc662 | |||
| d8360af103 | |||
| 55c042d604 | |||
| 6d3c24361d | |||
| 2f5c9a8fd4 | |||
| 96fc2c9aec | |||
| aca19813ad | |||
| 7dbaec1abf | |||
| 3b05b6bafe | |||
| 82265b629b | |||
| a3e3113e4e | |||
| b2c5317e17 | |||
| 9adb547b36 |
@@ -1,29 +1,35 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
Developer:
|
||||
---------
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Testers:
|
||||
-------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx"
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2005-01-01
|
||||
WeeChat known bugs, 2005-02-12
|
||||
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- problem when resizing terminal and that some windows are outside new term size
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(IRC protocol is under dev!)
|
||||
- too much nicks in the channel (> height of window) => some nicks are hidden
|
||||
- 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,9 +1,37 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-01-01
|
||||
ChangeLog - 2005-02-12
|
||||
|
||||
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
* added away indicator in status bar
|
||||
* added lag indicator (and auto-disconnect after a delay if important lag)
|
||||
* improved completion: now completes commands arguments (IRC and internal),
|
||||
when only one completion matches, completion mechanism is stoped (to
|
||||
complete command arg for example)
|
||||
* improved /set command: empty strings are allowed, new colors, server
|
||||
options can be changed while WeeChat is running
|
||||
* added default away/part/quit messages in config file
|
||||
* new [irc] section in config file, option "look_display_away" moved to
|
||||
"irc_display_away"
|
||||
* server messages & errors are all prefixed (by 3 chars, like '-@-')
|
||||
* added new options for charset (UTF-8 support): look_charset_decode,
|
||||
look_charset_encode and look_charset_internal
|
||||
* fixed many memory leaks
|
||||
* fixed colors bug: removed "gray" color (replaced by "default"), colors are
|
||||
ok when terminal has white (or light) background
|
||||
* fixed crash when resizing terminal to small size
|
||||
* fixed crash when multiple servers and big messages received from server
|
||||
* fixed crash when closing some private buffers
|
||||
* fixed crash when unknown section with option(s) in config file
|
||||
* fixed /op, /deop, /voice, /devoice (now ok with many nicks)
|
||||
* fixed /me command (now ok without parameter)
|
||||
* fixed /away command (now ok if not away)
|
||||
* logs are now disabled by default (server/channel/private)
|
||||
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2004-05-31
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -53,7 +53,7 @@ A: Because WeeChat is very light and has new features.
|
||||
* developed from scratch (not based on any other IRC client)
|
||||
* multi-platform
|
||||
* 100% GPL and free
|
||||
This is the "geekest Irc client" ;)
|
||||
This is the "geekest" IRC client ;)
|
||||
|
||||
|
||||
2.2
|
||||
@@ -65,13 +65,24 @@ A: For help you can type /help. For help about a command, type /help command.
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: Today you can't do that. This will be available in a future version.
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
|
||||
A: Today you can't do that. This is planed for a future version.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
@@ -79,21 +90,22 @@ A: You can use /perl command to load scripts
|
||||
(default path is ~/.weechat/perl).
|
||||
Note that scripts in ~/.weechat/perl/autoload are automatically loaded
|
||||
when WeeChat is starting up.
|
||||
WeeChat perl scripts are compatible with X-Chat, not with Irssi, sorry ;)
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
|
||||
A: Today Python interface is not developed, so can't load any Python script.
|
||||
WeeChat perl scripts are compatible with X-Chat, but not with Irssi,
|
||||
sorry ;)
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
|
||||
A: Today Python interface is not developed, so you can't load any Python script.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: How can I load Ruby scripts?
|
||||
|
||||
A: Today Ruby interface is not developed, so can't load any Ruby script.
|
||||
A: Today Ruby interface is not developed, so you can't load any Ruby script.
|
||||
|
||||
|
||||
3.1
|
||||
@@ -154,4 +166,4 @@ A: There's many tasks to do (code, documentation, ...)
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: No.
|
||||
A: Beer is welcome :)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2004-05-31
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -57,7 +57,7 @@ R: Parce que WeeChat est tr
|
||||
* développé à partir de zéro (non basé sur un quelconque client IRC)
|
||||
* multi-platformes
|
||||
* 100% GPL et libre
|
||||
C'est le client le plus "geek" ;)
|
||||
C'est le client IRC le plus "geek" ;)
|
||||
|
||||
|
||||
2.2
|
||||
@@ -70,13 +70,24 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: Comment puis-je configurer les raccourcis clavier ?
|
||||
|
||||
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
|
||||
version future.
|
||||
|
||||
|
||||
2.4
|
||||
2.5
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Perl ?
|
||||
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
|
||||
@@ -85,11 +96,11 @@ R: La commande /perl permet de charger les scripts Perl
|
||||
(le chemin par défaut est ~/.weechat/perl).
|
||||
Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement
|
||||
chargés par WeeChat lorsqu'il démarre.
|
||||
Les scripts Perl WeeChat sont compatibles avec X-Chat, pas Irssi,
|
||||
Les scripts Perl WeeChat sont compatibles avec X-Chat, mais pas Irssi,
|
||||
désolé ;)
|
||||
|
||||
|
||||
2.5
|
||||
2.6
|
||||
================================================================================
|
||||
Q: Comment puis-je charger les scripts Python ?
|
||||
|
||||
@@ -97,7 +108,7 @@ R: Aujourd'hui l'interface Python n'est pas d
|
||||
Vous ne pouvez donc charger aucun script Python.
|
||||
|
||||
|
||||
2.6
|
||||
2.7
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Ruby ?
|
||||
|
||||
@@ -169,4 +180,4 @@ R: Il y a plusieurs choses
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: Non.
|
||||
R: La bière est la bienvenue :)
|
||||
|
||||
@@ -6,7 +6,7 @@ WeeChat - Installation instructions
|
||||
--disable-curses : do not build Curses interface
|
||||
--enable-gtk : build Gtk+ interface (under development!)
|
||||
--enable-qt : build Qt interface (not developed!)
|
||||
--with-debug : 1 for debug compilation, 2 for debug messages
|
||||
--with-debug=X : X=1 for debug compilation, 2 for debug messages
|
||||
|
||||
2) Run 'make'
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
* FlashCode, 2005-01-01
|
||||
|
||||
WeeChat 0.0.9 released.
|
||||
|
||||
@@ -22,10 +22,7 @@ Features
|
||||
Copyright
|
||||
---------
|
||||
|
||||
WeeChat (c) Copyright 2004
|
||||
by: FlashCode <flashcode@flashtux.org>
|
||||
Xahlexx <xahlex@weeland.org>
|
||||
Bounga <bounga@altern.org>
|
||||
WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
(see AUTHORS file if you want to contact authors)
|
||||
|
||||
WeeChat is distributed under GPL licence (see COPYING file for complete license):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-01-01
|
||||
TODO - 2005-02-12
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,32 +10,29 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.9:
|
||||
v0.1.1:
|
||||
------
|
||||
|
||||
* General:
|
||||
- Windows version
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
- customizable CTCP version reply
|
||||
|
||||
* Interface:
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
(horizontally/vertically)
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
- add key bindings to config file
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* General:
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
@@ -59,17 +56,12 @@ Future versions:
|
||||
- "/last": command to look for text in previous messages
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- add lag indicator
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- tab key with empty command line should switch to next window (like F7)
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
@@ -79,3 +71,6 @@ Future versions:
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
|
||||
+21
-21
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.9, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.0, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.9])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.0])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -34,7 +34,7 @@ ALL_LINGUAS="fr"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0)
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
@@ -55,11 +55,11 @@ AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
enable_plugins="no"
|
||||
enable_python="no"
|
||||
@@ -67,19 +67,19 @@ PYTHON_CFLAGS=
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
|
||||
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
if test "$LIBCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([ncurses library not found! Install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
CURSES_LIBS="-lcurses"
|
||||
AC_SUBST(CURSES_LIBS)
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
@@ -139,8 +139,8 @@ echo
|
||||
echo $PACKAGE $VERSION
|
||||
|
||||
listgui=
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
listgui="$listgui Curses"
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
listgui="$listgui ncurses"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
@@ -150,16 +150,16 @@ if test "x$enable_qt" = "xyes" ; then
|
||||
fi
|
||||
|
||||
if test "x$listgui" = "x" ; then
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least ncurses, Gtk or Qt.])
|
||||
fi
|
||||
|
||||
msg_debug_compiler="No"
|
||||
msg_debug_verbose="No"
|
||||
msg_debug_compiler="no"
|
||||
msg_debug_verbose="no"
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
msg_debug_compiler="Yes"
|
||||
msg_debug_compiler="yes"
|
||||
fi
|
||||
if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="Yes"
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 12 Feb 2005 12:00:00 +0200
|
||||
|
||||
weechat (0.0.9-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.9, see ChangeLog for detail.
|
||||
|
||||
Vendored
+4
-4
@@ -1,13 +1,13 @@
|
||||
Source: weechat
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.5.8
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: weechat
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||
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.
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 01 Jan 2005 13:00:00 +0200.
|
||||
Sat, 12 Jan 2005 12:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
Vendored
+17
-15
@@ -14,7 +14,8 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@ clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
-$(MAKE) clean
|
||||
-$(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -40,32 +41,33 @@ install: build
|
||||
$(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
|
||||
# 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
|
||||
dh_testdir -pweechat-common
|
||||
dh_testroot -pweechat-common
|
||||
dh_testdir -pweechat-common -pweechat
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installexamples -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
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
dh_fixperms -pweechat-common -pweechat
|
||||
dh_installdeb -pweechat-common -pweechat
|
||||
dh_shlibdeps -pweechat-common -pweechat
|
||||
dh_gencontrol -pweechat-common -pweechat
|
||||
dh_md5sums -pweechat-common -pweechat
|
||||
dh_builddeb -pweechat-common -pweechat
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
dh_installchangelogs -a
|
||||
dh_installdocs -a
|
||||
# dh_installchangelogs -a
|
||||
# dh_installdocs -a
|
||||
dh_installman weechat-curses.1 -pweechat-curses
|
||||
dh_link -a
|
||||
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
|
||||
+47
-19
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.0.9 - January, 01 2005
|
||||
@subtitle Documentation for WeeChat v0.1.0 - February, 12 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -259,6 +259,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
WeeChat slogan (if empty, slogan is not used)@*
|
||||
Type: string (any string), default value: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_charset_encode
|
||||
Charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -292,30 +298,27 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_nick_completor
|
||||
The string inserted after nick completion@*
|
||||
Type: string (any string), default value: ':'@*
|
||||
@item look_display_away
|
||||
Display message to all channels when (un)marking as away@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_infobar
|
||||
Enable info bar@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Timestamp for time in infobar@*
|
||||
Type: string (any string), default value: '%B, %A %d %G - %H:%M'@*
|
||||
Type: string (any string), default value: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
Delay (in seconds) for highlight messages in infobar (0 = disable highlight notifications in infobar)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 7@*
|
||||
@item col_title
|
||||
Color for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_title_bg
|
||||
Background for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'blue'@*
|
||||
@item col_chat
|
||||
Color for chat text@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time
|
||||
Color for time in chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Color for time separator (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'brown'@*
|
||||
@@ -345,7 +348,7 @@ Background for chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status
|
||||
Color for status bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Color for status bar delimiters@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@@ -357,7 +360,7 @@ Color for window with highlight (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Color for window with new data (not messages) (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_more
|
||||
Color for window with new data (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@@ -375,7 +378,7 @@ Background for info bar window@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_input
|
||||
Color for input text@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_input_channel
|
||||
Color for input text (channel name)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@@ -387,7 +390,10 @@ Background for input window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick
|
||||
Color for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_away
|
||||
Color for away nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Color for operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@@ -405,7 +411,7 @@ Color for local nick@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_nick_private
|
||||
Color for other nick in private window@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_bg
|
||||
Background for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@@ -438,13 +444,13 @@ Maximum number of user commands in history (0 = unlimited)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 100@*
|
||||
@item log_auto_server
|
||||
Automatically log server messages@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_channel
|
||||
Automatically log channel chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_private
|
||||
Automatically log private chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_path
|
||||
Path for WeeChat log files@*
|
||||
Type: string (any string), default value: '~/.weechat/logs/'@*
|
||||
@@ -454,6 +460,30 @@ Type: string (any string), default value: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Hide password displayed by nickserv@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_display_away
|
||||
Display message to all channels when (un)marking as away@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Default message when away@*
|
||||
Type: string (any string), default value: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Default part message (leaving channel)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Default quit message ('%v' will be replaced by WeeChat version in string)@*
|
||||
Type: string (any string), default value: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Interval between two checks for away (in minutes, 0 = never check)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_check
|
||||
Interval between two checks for lag (in seconds)@*
|
||||
Type: integer (values: between 30 and 2147483647), default value: 60@*
|
||||
@item irc_lag_min_show
|
||||
Minimum lag to show (in seconds)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_disconnect
|
||||
Disconnect after important lag (in minutes, 0 = never disconnect)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Automatically accept incoming dcc files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@@ -531,7 +561,7 @@ First command to run when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_command_delay
|
||||
Delay (in seconds) after command was executed (example: give some time for authentication)@*
|
||||
Type: integer (values: between 0 and 3600), default value: 1@*
|
||||
Type: integer (values: between 0 and 5), default value: 0@*
|
||||
@item server_autojoin
|
||||
Comma separated list of channels to join when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@@ -571,8 +601,6 @@ Colors for Curses GUI are:@*
|
||||
@item
|
||||
@kbd{lightcyan}: light cyan
|
||||
@item
|
||||
@kbd{gray}: gray
|
||||
@item
|
||||
@kbd{white}: white
|
||||
@end itemize
|
||||
|
||||
|
||||
+47
-19
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.0.9 - 1er Janvier 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.0 - 12 F@'evrier 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -259,6 +259,12 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Jeu de caract@`eres pour d@'ecoder les messages du serveur, exemples: UTF-8, ISO-8859-1 (si non renseign@'e, les messages ne sont pas convertis)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_charset_encode
|
||||
Jeu de caract@`eres pour encoder les messages envoy@'es au serveur, exemples: UFT-8, ISO-8859-1 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -292,30 +298,27 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item look_nick_completor
|
||||
La cha@^ine affich@'ee apr@`es la compl@'etion des utilisateurs@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ':'@*
|
||||
@item look_display_away
|
||||
Affiche un message sur tous les canaux pour l'absence/le retour@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_infobar
|
||||
Active la barre d'infos@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Horodatage pour les conversations sauvegard@'ees@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %G - %H:%M'@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
D@'elai (en secondes) pour la notification des messages dans la barre d'infos (0 = d@'esactiver les notifications dans la barre d'infos)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 7@*
|
||||
@item col_title
|
||||
Couleur pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_title_bg
|
||||
Couleur de fond pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
|
||||
@item col_chat
|
||||
Couleur pour le texte de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time
|
||||
Couleur pour l'heure dans la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Couleur pour la s@'eparation de l'heure (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'brown'@*
|
||||
@@ -345,7 +348,7 @@ Couleur de fond pour la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status
|
||||
Couleur pour la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Couleur pour les d@'elimiteurs de la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@@ -357,7 +360,7 @@ Couleur pour une fen@^etre avec un highlight (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_more
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@@ -375,7 +378,7 @@ Couleur de fond pour la fen@^etre de barre d'infos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_input
|
||||
Couleur pour le texte saisi@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_input_channel
|
||||
Couleur pour le texte saisi (nom du canal)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@@ -387,7 +390,10 @@ Couleur de fond pour la fen@^etre de saisie@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick
|
||||
Couleur pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_away
|
||||
Couleur pour les pseudos absents@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Couleur pour le symbole op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@@ -405,7 +411,7 @@ Couleur pour le pseudo local@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_nick_private
|
||||
Couleur pour l'autre pseudo dans la fen@^etre priv@'ee@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_bg
|
||||
Couleur de fond pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@@ -438,13 +444,13 @@ Nombre maximum de commandes utilisateur dans l'historique (0 = sans limite)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 100@*
|
||||
@item log_auto_server
|
||||
Enregistrer automatiquement les messages du serveur@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_channel
|
||||
Enregistrer automatiquement les conversations des canaux@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_private
|
||||
Enregistrer automatiquement les conversations priv@'ees@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_path
|
||||
Chemin pour les conversations sauvegard@'ees par WeeChat@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
|
||||
@@ -454,6 +460,30 @@ Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Masquer le mot de passe affich@'e par nickserv@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_display_away
|
||||
Affiche un message sur tous les canaux pour l'absence/le retour@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Message par d@'efaut pour l'absence@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Message par d@'efaut pour le part (quitte un canal)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Message de fin par d@'efaut ('%v' sera remplac@'e par la version de WeeChat dans la cha@^ine)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Intervalle entre deux v@'erifications des absences (en minutes, 0 = ne jemais v@'erifier)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_check
|
||||
Intervalle entre deux mesures de lag (en secondes)@*
|
||||
Type: entier (valeurs: entre 30 et 2147483647), valeur par d@'efaut: 60@*
|
||||
@item irc_lag_min_show
|
||||
Lag minimum @`a afficher (en secondes)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_disconnect
|
||||
D@'econnexion apr@`es un lag important (en minutes, 0 = ne jamais se d@'econnecter)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Accepte automatiquement les fichiers dcc entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@@ -531,7 +561,7 @@ Commande @`a ex@'ecuter en premier lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_command_delay
|
||||
D@'elai (en secondes) apr@`es ex@'ecution de la commande (exemple: donner du temps pour l'authentification)@*
|
||||
Type: entier (valeurs: entre 0 et 3600), valeur par d@'efaut: 1@*
|
||||
Type: entier (valeurs: entre 0 et 5), valeur par d@'efaut: 0@*
|
||||
@item server_autojoin
|
||||
Liste des canaux (s@'epar@'es par des virgules) @`a rejoindre lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@@ -571,8 +601,6 @@ Les couleurs pour l'interface Curses sont :@*
|
||||
@item
|
||||
@kbd{lightcyan}: cyan clair
|
||||
@item
|
||||
@kbd{gray}: gris
|
||||
@item
|
||||
@kbd{white}: blanc
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.9 - 1 de Janeiro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.0 - 12 de Fevereiro de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
|
||||
+644
-562
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
command.h \
|
||||
completion.c \
|
||||
completion.h \
|
||||
weelist.c \
|
||||
weelist.h \
|
||||
weeconfig.c \
|
||||
weeconfig.h \
|
||||
history.c \
|
||||
|
||||
+542
-354
File diff suppressed because it is too large
Load Diff
+8
-12
@@ -21,6 +21,7 @@
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
@@ -48,22 +49,16 @@ struct t_weechat_alias
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
typedef struct t_index_command t_index_command;
|
||||
|
||||
struct t_index_command
|
||||
{
|
||||
char *command_name;
|
||||
t_index_command *prev_index;
|
||||
t_index_command *next_index;
|
||||
};
|
||||
extern t_weechat_command weechat_commands[];
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_index_command *index_commands;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern t_index_command *index_command_search (char *);
|
||||
extern t_index_command *index_command_new (char *);
|
||||
extern void index_command_build ();
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
@@ -77,6 +72,7 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
+622
-72
@@ -29,8 +29,10 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -40,8 +42,14 @@
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->base_command = NULL;
|
||||
completion->base_command_arg = 0;
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -51,8 +59,499 @@ completion_init (t_completion *completion)
|
||||
void
|
||||
completion_free (t_completion *completion)
|
||||
{
|
||||
if (completion->base_command)
|
||||
free (completion->base_command);
|
||||
completion->base_command = NULL;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = NULL;
|
||||
|
||||
while (completion->completion_list)
|
||||
weelist_remove (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
completion->completion_list);
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_stop: stop completion (for example after 1 arg of command with 1 arg)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_stop (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->position = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_build_list: build data list according to command and argument #
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char option_name[256];
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (strcasecmp (completion->base_command, "save") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "alias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_list->data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "buffer") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"move");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "connect") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
weechat_commands[i].command_name);
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "perl") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"load");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"autoload");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"unload");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "set") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s =",
|
||||
weechat_options[i][j].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s =",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "unalias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_alias->alias_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "window") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splith");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splitv");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"merge");
|
||||
return;
|
||||
}
|
||||
|
||||
if (completion->base_command_arg == 2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"down");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"up");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"left");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"right");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"all");
|
||||
return;
|
||||
}
|
||||
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* IRC commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (strcasecmp (completion->base_command, "who") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "away") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_away);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
&& (completion->base_command_arg == 2))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"action");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"version");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "dcc") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"chat");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
{
|
||||
/* arg1: nickname */
|
||||
if (completion->base_command_arg == 1)
|
||||
return;
|
||||
|
||||
/* arg > 2: not allowed */
|
||||
if (completion->base_command_arg > 2)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg2: channel */
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
{
|
||||
for (ptr_channel = SERVER(gui_current_window->buffer)->channels;
|
||||
ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_channel->name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kick") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kill") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "notice") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "part") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_part);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "query") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "quit") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_quit);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "topic") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
if (!channel || !((t_irc_channel *)channel)->topic
|
||||
|| !((t_irc_channel *)channel)->topic[0])
|
||||
completion_stop (completion);
|
||||
else
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->topic);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_find_context: find context for completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
command = (buffer[0] == '/') ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
{
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
command_arg++;
|
||||
i++;
|
||||
while ((i < pos) && (buffer[i] == ' ')) i++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (command)
|
||||
{
|
||||
if (command_arg > 0)
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND_ARG;
|
||||
completion->base_command_arg = command_arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND;
|
||||
completion->base_command_arg = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
completion->context = COMPLETION_NICK;
|
||||
else
|
||||
completion->context = COMPLETION_NULL;
|
||||
}
|
||||
|
||||
/* look for word to complete (base word) */
|
||||
completion->base_word_pos = 0;
|
||||
completion->position_replace = pos;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
i = pos;
|
||||
pos_start = i;
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
if ((i > 0) && (buffer[i-1] != ' '))
|
||||
{
|
||||
i--;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (pos_start <= pos_end)
|
||||
{
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->base_word)
|
||||
completion->base_word = strdup ("");
|
||||
|
||||
/* find command (for command argument completion only) */
|
||||
if (completion->context == COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
pos_start = 0;
|
||||
while ((pos_start < size) && (buffer[pos_start] != '/'))
|
||||
pos_start++;
|
||||
if (buffer[pos_start] == '/')
|
||||
{
|
||||
pos_start++;
|
||||
pos_end = pos_start;
|
||||
while ((pos_end < size) && (buffer[pos_end] != ' '))
|
||||
pos_end++;
|
||||
if (buffer[pos_end] == ' ')
|
||||
pos_end--;
|
||||
|
||||
completion->base_command = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel
|
||||
&& (((t_irc_channel *)channel)->type == CHAT_PRIVATE))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
SERVER(gui_current_window->buffer)->nick);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -62,23 +561,37 @@ completion_free (t_completion *completion)
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_index_command *ptr_index;
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0)
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_index->command_name;
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word + 1, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_index->command_name, completion->word_found) == 0))
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
@@ -88,6 +601,54 @@ completion_command (t_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command_arg: complete a command argument
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = completion->completion_list; ptr_weelist;
|
||||
ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command_arg (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
@@ -95,11 +656,21 @@ completion_command (t_completion *completion)
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_irc_nick *ptr_nick;
|
||||
int length, word_found_seen, other_completion;
|
||||
t_irc_nick *ptr_nick, *ptr_nick2;
|
||||
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
@@ -107,8 +678,21 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2;
|
||||
ptr_nick2 = ptr_nick2->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick2->nick,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
@@ -129,83 +713,49 @@ void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, pos_start, pos_end;
|
||||
char *old_word_found;
|
||||
|
||||
/* TODO: complete when no word is there with command according to context */
|
||||
if (size == 0)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if new complation => look for base word */
|
||||
/* if new completion => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
|
||||
if ((pos == size) || (buffer[pos-1] != ' '))
|
||||
pos--;
|
||||
if ((pos > 0) && (buffer[pos] == ' '))
|
||||
return;
|
||||
|
||||
i = pos;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
if (pos_start > pos_end)
|
||||
return;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
|
||||
if (completion->base_word[0] == '/')
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
if (completion->base_word[0] == '/')
|
||||
switch (completion->context)
|
||||
{
|
||||
completion_command (completion);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
case COMPLETION_NULL:
|
||||
/* should never be executed */
|
||||
return;
|
||||
case COMPLETION_NICK:
|
||||
if (channel)
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word) + 1;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
case COMPLETION_COMMAND:
|
||||
completion_command (completion);
|
||||
break;
|
||||
case COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list)
|
||||
completion_command_arg (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (channel)
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
{
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
}
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->diff_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-6
@@ -21,16 +21,33 @@
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
|
||||
#define COMPLETION_NULL 0
|
||||
#define COMPLETION_NICK 1
|
||||
#define COMPLETION_COMMAND 2
|
||||
#define COMPLETION_COMMAND_ARG 3
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where we shoud complete */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word should be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
/* completion context */
|
||||
int context; /* context: null, nick, command, cmd arg */
|
||||
char *base_command; /* command with arg to complete (can be NULL) */
|
||||
int base_command_arg; /* # arg to complete (if context is cmd arg) */
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where Tab was pressed */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
t_weelist *last_completion; /* last data element for completion */
|
||||
|
||||
/* completion found */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word has to be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
|
||||
@@ -136,3 +136,50 @@ history_add (void *buffer, char *string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_general_free: free general history
|
||||
*/
|
||||
|
||||
void
|
||||
history_general_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_general)
|
||||
{
|
||||
ptr_history = history_general->next_history;
|
||||
if (history_general->text)
|
||||
free (history_general->text);
|
||||
free (history_general);
|
||||
history_general = ptr_history;
|
||||
}
|
||||
history_general = NULL;
|
||||
history_general_last = NULL;
|
||||
history_general_ptr = NULL;
|
||||
num_history_general = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* history_buffer_free: free history for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
history_buffer_free (void *buffer)
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (((t_gui_buffer *)(buffer))->history)
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)(buffer))->history->next_history;
|
||||
if (((t_gui_buffer *)(buffer))->history->text)
|
||||
free (((t_gui_buffer *)(buffer))->history->text);
|
||||
free (((t_gui_buffer *)(buffer))->history);
|
||||
((t_gui_buffer *)(buffer))->history = ptr_history;
|
||||
}
|
||||
((t_gui_buffer *)(buffer))->history = NULL;
|
||||
((t_gui_buffer *)(buffer))->last_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->ptr_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->num_history = 0;
|
||||
}
|
||||
|
||||
@@ -31,5 +31,7 @@ struct t_history
|
||||
};
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_general_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
#endif /* history.h */
|
||||
|
||||
+100
-15
@@ -49,6 +49,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@@ -58,9 +60,11 @@
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
@@ -76,6 +80,68 @@ my_sigint ()
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@@ -198,26 +264,26 @@ wee_parse_args (int argc, char *argv[])
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
@@ -292,7 +358,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
@@ -301,7 +367,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
@@ -311,7 +377,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
@@ -364,6 +430,7 @@ wee_create_home_dirs ()
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
chmod (dir_name, 0700);
|
||||
|
||||
free (dir_name);
|
||||
}
|
||||
@@ -442,18 +509,32 @@ weechat_welcome_message ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown ()
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
fclose (weechat_log_file);
|
||||
exit (EXIT_SUCCESS);
|
||||
if (local_charset)
|
||||
free (local_charset);
|
||||
alias_free_all ();
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -469,13 +550,15 @@ main (int argc, char *argv[])
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
index_command_build (); /* build commands index for completion */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
@@ -503,7 +586,9 @@ main (int argc, char *argv[])
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
wee_shutdown (); /* quit WeeChat (oh no, why?) */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#include <locale.h>
|
||||
@@ -43,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define WEECHAT_COPYRIGHT PACKAGE_NAME " (c) 2003-2005 by Wee Team"
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
@@ -57,10 +58,7 @@
|
||||
|
||||
#define WEE_LICENSE \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@weeland.org>\n" \
|
||||
"Website: " WEECHAT_WEBSITE "\n\n" \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"This program is free software; you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation; either version 2 of the License, or\n" \
|
||||
@@ -78,7 +76,7 @@
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode, Bounga and Xahlexx - " WEECHAT_WEBSITE "\n\n" \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
@@ -102,8 +100,11 @@
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
+314
-111
@@ -33,6 +33,7 @@
|
||||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@@ -48,6 +49,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
|
||||
{ CONFIG_SECTION_COLORS, "colors" },
|
||||
{ CONFIG_SECTION_HISTORY, "history" },
|
||||
{ CONFIG_SECTION_LOG, "log" },
|
||||
{ CONFIG_SECTION_IRC, "irc" },
|
||||
{ CONFIG_SECTION_DCC, "dcc" },
|
||||
{ CONFIG_SECTION_PROXY, "proxy" },
|
||||
{ CONFIG_SECTION_ALIAS, "alias" },
|
||||
@@ -60,6 +62,9 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode;
|
||||
char *cfg_look_charset_encode;
|
||||
char *cfg_look_charset_internal;
|
||||
int cfg_look_color_nicks;
|
||||
int cfg_look_color_actions;
|
||||
int cfg_look_remove_colors_from_msgs;
|
||||
@@ -73,7 +78,6 @@ int cfg_look_nickmode;
|
||||
int cfg_look_nickmode_empty;
|
||||
char *cfg_look_no_nickname;
|
||||
char *cfg_look_completor;
|
||||
int cfg_look_display_away;
|
||||
int cfg_look_infobar;
|
||||
char *cfg_look_infobar_timestamp;
|
||||
int cfg_look_infobar_delay_highlight;
|
||||
@@ -95,6 +99,18 @@ t_config_option weechat_options_look[] =
|
||||
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, config_change_noop },
|
||||
{ "look_charset_decode", N_("charset for decoding messages from server"),
|
||||
N_("charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode, config_change_buffer_content },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content },
|
||||
{ "look_charset_internal", N_("internal WeeChat charset (should be ISO)"),
|
||||
N_("internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_internal, config_change_buffer_content },
|
||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||
N_("display nick names with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -141,10 +157,6 @@ t_config_option weechat_options_look[] =
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
":", NULL, NULL, &cfg_look_completor, config_change_noop },
|
||||
{ "look_display_away", N_("display message to all channels when away"),
|
||||
N_("display message to all channels when (un)marking as away"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_display_away, NULL, config_change_noop },
|
||||
{ "look_infobar", N_("enable info bar"),
|
||||
N_("enable info bar"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -191,6 +203,7 @@ int cfg_col_input_channel;
|
||||
int cfg_col_input_nick;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
int cfg_col_nick_op;
|
||||
int cfg_col_nick_halfop;
|
||||
int cfg_col_nick_voice;
|
||||
@@ -211,7 +224,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_title", N_("color for title bar"),
|
||||
N_("color for title bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_title, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_title, NULL, &config_change_color },
|
||||
{ "col_title_bg", N_("background for title bar"),
|
||||
N_("background for title bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -221,11 +234,11 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_chat", N_("color for chat text"),
|
||||
N_("color for chat text"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_chat, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_chat, NULL, &config_change_color },
|
||||
{ "col_chat_time", N_("color for time"),
|
||||
N_("color for time in chat window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_chat_time, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_chat_time, NULL, &config_change_color },
|
||||
{ "col_chat_time_sep", N_("color for time separator"),
|
||||
N_("color for time separator (chat window)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -267,7 +280,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_status", N_("color for status bar"),
|
||||
N_("color for status bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
{ "col_status_delimiters", N_("color for status bar delimiters"),
|
||||
N_("color for status bar delimiters"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -283,7 +296,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_status_data_other", N_("color for window with new data (not messages)"),
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -311,7 +324,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_input", N_("color for input text"),
|
||||
N_("color for input text"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_input, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_input, NULL, &config_change_color },
|
||||
{ "col_input_channel", N_("color for input text (channel name)"),
|
||||
N_("color for input text (channel name)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -329,7 +342,11 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_nick", N_("color for nicknames"),
|
||||
N_("color for nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_nick, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_nick, NULL, &config_change_color },
|
||||
{ "col_nick_away", N_("color for away nicknames"),
|
||||
N_("color for away nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_nick_away, NULL, &config_change_color },
|
||||
{ "col_nick_op", N_("color for operator symbol"),
|
||||
N_("color for operator symbol"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -353,7 +370,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_nick_private", N_("color for other nick in private window"),
|
||||
N_("color for other nick in private window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_nick_private, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_nick_private, NULL, &config_change_color },
|
||||
{ "col_nick_bg", N_("background for nicknames"),
|
||||
N_("background for nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -402,11 +419,11 @@ t_config_option weechat_options_history[] =
|
||||
N_("maximum number of lines in history "
|
||||
"for one server/channel/private window (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 4096,
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, NULL },
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, config_change_noop },
|
||||
{ "history_max_commands", N_("max user commands in history"),
|
||||
N_("maximum number of user commands in history (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 100,
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, NULL },
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -422,28 +439,75 @@ int cfg_log_hide_nickserv_pwd;
|
||||
t_config_option weechat_options_log[] =
|
||||
{ { "log_auto_server", N_("automatically log server messages"),
|
||||
N_("automatically log server messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_server, NULL, NULL },
|
||||
{ "log_auto_channel", N_("automatically log channel chats"),
|
||||
N_("automatically log channel chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_channel, NULL, NULL },
|
||||
{ "log_auto_private", N_("automatically log private chats"),
|
||||
N_("automatically log private chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
{ "log_path", N_("path for log files"),
|
||||
N_("path for WeeChat log files"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, NULL },
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, config_change_noop },
|
||||
{ "log_timestamp", N_("timestamp for log"),
|
||||
N_("timestamp for log (see man strftime for date/time specifiers)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, NULL },
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, config_change_noop },
|
||||
{ "log_hide_nickserv_pwd", N_("hide password displayed by nickserv"),
|
||||
N_("hide password displayed by nickserv"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* config, irc section */
|
||||
|
||||
int cfg_irc_display_away;
|
||||
char *cfg_irc_default_msg_away;
|
||||
char *cfg_irc_default_msg_part;
|
||||
char *cfg_irc_default_msg_quit;
|
||||
int cfg_irc_away_check;
|
||||
int cfg_irc_lag_check;
|
||||
int cfg_irc_lag_min_show;
|
||||
int cfg_irc_lag_disconnect;
|
||||
|
||||
t_config_option weechat_options_irc[] =
|
||||
{ { "irc_display_away", N_("display message to all channels when away"),
|
||||
N_("display message to all channels when (un)marking as away"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_irc_display_away, NULL, config_change_noop },
|
||||
{ "irc_default_msg_away", N_("default message when away"),
|
||||
N_("default message when away"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"away", NULL, NULL, &cfg_irc_default_msg_away, config_change_noop },
|
||||
{ "irc_default_msg_part", N_("default part message (leaving channel)"),
|
||||
N_("default part message (leaving channel)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_irc_default_msg_part, config_change_noop },
|
||||
{ "irc_default_msg_quit", N_("default quit message"),
|
||||
N_("default quit message ('%v' will be replaced by WeeChat version in string)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
|
||||
{ "irc_away_check", N_("interval between two checks for away"),
|
||||
N_("interval between two checks for away (in minutes, 0 = never check)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
NULL, NULL, &cfg_irc_away_check, NULL, config_change_away_check },
|
||||
{ "irc_lag_check", N_("interval between two checks for lag"),
|
||||
N_("interval between two checks for lag (in seconds)"),
|
||||
OPTION_TYPE_INT, 30, INT_MAX, 60,
|
||||
NULL, NULL, &cfg_irc_lag_check, NULL, config_change_noop },
|
||||
{ "irc_lag_min_show", N_("minimum lag to show"),
|
||||
N_("minimum lag to show (in seconds)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
NULL, NULL, &cfg_irc_lag_min_show, NULL, config_change_noop },
|
||||
{ "irc_lag_disconnect", N_("disconnect after important lag"),
|
||||
N_("disconnect after important lag (in minutes, 0 = never disconnect)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 5,
|
||||
NULL, NULL, &cfg_irc_lag_disconnect, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -505,19 +569,19 @@ t_config_option weechat_options_proxy[] =
|
||||
{ { "proxy_use", N_("use proxy"),
|
||||
N_("use a proxy server to connect to irc server"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_proxy_use, NULL, NULL },
|
||||
NULL, NULL, &cfg_proxy_use, NULL, config_change_noop },
|
||||
{ "proxy_address", N_("proxy address"),
|
||||
N_("proxy server address (IP or hostname)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_address, NULL },
|
||||
"", NULL, NULL, &cfg_proxy_address, config_change_noop },
|
||||
{ "proxy_port", N_("port for proxy"),
|
||||
N_("port for connecting to proxy server"),
|
||||
OPTION_TYPE_INT, 0, 65535, 1080,
|
||||
NULL, NULL, &cfg_proxy_port, NULL, NULL },
|
||||
NULL, NULL, &cfg_proxy_port, NULL, config_change_noop },
|
||||
{ "proxy_password", N_("proxy password"),
|
||||
N_("password for proxy server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_password, NULL },
|
||||
"", NULL, NULL, &cfg_proxy_password, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -580,7 +644,7 @@ t_config_option weechat_options_server[] =
|
||||
"", NULL, NULL, &(cfg_server.command), NULL },
|
||||
{ "server_command_delay", N_("delay (in seconds) after command was executed"),
|
||||
N_("delay (in seconds) after command was executed (example: give some time for authentication)"),
|
||||
OPTION_TYPE_INT, 0, 3600, 1,
|
||||
OPTION_TYPE_INT, 0, 5, 0,
|
||||
NULL, NULL, &(cfg_server.command_delay), NULL, 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"),
|
||||
@@ -597,8 +661,8 @@ 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,
|
||||
NULL, weechat_options_server
|
||||
weechat_options_log, weechat_options_irc, weechat_options_dcc,
|
||||
weechat_options_proxy, NULL, weechat_options_server
|
||||
};
|
||||
|
||||
|
||||
@@ -695,11 +759,26 @@ config_change_buffer_content ()
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_color()
|
||||
config_change_color ()
|
||||
{
|
||||
gui_init_colors ();
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_away_check: called when away check is changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_away_check ()
|
||||
{
|
||||
check_away = 0;
|
||||
if (cfg_irc_away_check == 0)
|
||||
{
|
||||
/* reset away flag for all nicks/chans/servers */
|
||||
server_remove_away ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_set_value: set new value for an option
|
||||
* return: 0 if success
|
||||
@@ -746,6 +825,117 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_get_server_option_ptr: get a pointer to a server config option
|
||||
*/
|
||||
|
||||
void *
|
||||
config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
{
|
||||
if (strcasecmp (option_name, "server_name") == 0)
|
||||
return (void *)(&server->name);
|
||||
if (strcasecmp (option_name, "server_autoconnect") == 0)
|
||||
return (void *)(&server->autoconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect") == 0)
|
||||
return (void *)(&server->autoreconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect_delay") == 0)
|
||||
return (void *)(&server->autoreconnect_delay);
|
||||
if (strcasecmp (option_name, "server_address") == 0)
|
||||
return (void *)(&server->address);
|
||||
if (strcasecmp (option_name, "server_port") == 0)
|
||||
return (void *)(&server->port);
|
||||
if (strcasecmp (option_name, "server_password") == 0)
|
||||
return (void *)(&server->password);
|
||||
if (strcasecmp (option_name, "server_nick1") == 0)
|
||||
return (void *)(&server->nick1);
|
||||
if (strcasecmp (option_name, "server_nick2") == 0)
|
||||
return (void *)(&server->nick2);
|
||||
if (strcasecmp (option_name, "server_nick3") == 0)
|
||||
return (void *)(&server->nick3);
|
||||
if (strcasecmp (option_name, "server_username") == 0)
|
||||
return (void *)(&server->username);
|
||||
if (strcasecmp (option_name, "server_realname") == 0)
|
||||
return (void *)(&server->realname);
|
||||
if (strcasecmp (option_name, "server_command") == 0)
|
||||
return (void *)(&server->command);
|
||||
if (strcasecmp (option_name, "server_command_delay") == 0)
|
||||
return (void *)(&server->command_delay);
|
||||
if (strcasecmp (option_name, "server_autojoin") == 0)
|
||||
return (void *)(&server->autojoin);
|
||||
if (strcasecmp (option_name, "server_autorejoin") == 0)
|
||||
return (void *)(&server->autorejoin);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_set_server_value: set new value for an option
|
||||
* return: 0 if success
|
||||
* -1 if option not found
|
||||
* -2 if bad value
|
||||
*/
|
||||
|
||||
int
|
||||
config_set_server_value (t_irc_server *server, char *option_name,
|
||||
char *value)
|
||||
{
|
||||
t_config_option *ptr_option;
|
||||
int i;
|
||||
void *ptr_data;
|
||||
int int_value;
|
||||
|
||||
ptr_data = config_get_server_option_ptr (server, option_name);
|
||||
if (!ptr_data)
|
||||
return -1;
|
||||
|
||||
ptr_option = NULL;
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
/* if option found, return pointer */
|
||||
if (strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0)
|
||||
{
|
||||
ptr_option = &weechat_options[CONFIG_SECTION_SERVER][i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ptr_option)
|
||||
return -1;
|
||||
|
||||
switch (ptr_option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (value, "on") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_TRUE;
|
||||
else if (strcasecmp (value, "off") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_FALSE;
|
||||
else
|
||||
return -2;
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
int_value = atoi (value);
|
||||
if ((int_value < ptr_option->min) || (int_value > ptr_option->max))
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (ptr_option->array_values, value);
|
||||
if (int_value < 0)
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
if (!gui_assign_color ((int *)ptr_data, value))
|
||||
return -2;
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
if (*((char **)ptr_data))
|
||||
free (*((char **)ptr_data));
|
||||
*((char **)ptr_data) = strdup (value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_search: look for an option and return pointer to this option
|
||||
* if option is not found, NULL is returned
|
||||
@@ -872,7 +1062,7 @@ config_default_values ()
|
||||
if (int_value < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s unable to assign default int with string (\"%s\")\n"),
|
||||
weechat_options[i][j].default_string);
|
||||
WEECHAT_WARNING, weechat_options[i][j].default_string);
|
||||
else
|
||||
*weechat_options[i][j].ptr_int =
|
||||
int_value;
|
||||
@@ -883,7 +1073,7 @@ config_default_values ()
|
||||
weechat_options[i][j].default_string))
|
||||
gui_printf (NULL,
|
||||
_("%s unable to assign default color (\"%s\")\n"),
|
||||
weechat_options[i][j].default_string);
|
||||
WEECHAT_WARNING, weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
*weechat_options[i][j].ptr_string =
|
||||
@@ -985,96 +1175,105 @@ config_read ()
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
if (section == CONFIG_SECTION_NONE)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
_("%s %s, line %d: invalid section for option, line is ignored\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
|
||||
if (section == CONFIG_SECTION_ALIAS)
|
||||
{
|
||||
if (alias_new (line, pos))
|
||||
index_command_new (line);
|
||||
}
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
else
|
||||
{
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
|
||||
if (section == CONFIG_SECTION_ALIAS)
|
||||
{
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
option_number = i;
|
||||
break;
|
||||
}
|
||||
if (alias_new (line, pos))
|
||||
weelist_add (&index_commands, &last_index_command, line);
|
||||
}
|
||||
if (option_number < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, ptr_line);
|
||||
else
|
||||
{
|
||||
if (config_option_set_value (&weechat_options[section][option_number], pos) < 0)
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
{
|
||||
switch (weechat_options[section]
|
||||
[option_number].option_type)
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for"
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line,
|
||||
weechat_options[section][option_number].min,
|
||||
weechat_options[section][option_number].max);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
i = 0;
|
||||
while (weechat_options[section][option_number].array_values[i])
|
||||
{
|
||||
gui_printf (NULL, "\"%s\" ",
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
i++;
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid color "
|
||||
"name for option '%s'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number,
|
||||
ptr_line);
|
||||
break;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1148,8 +1347,7 @@ config_create_default ()
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
|
||||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
|
||||
if (i == CONFIG_SECTION_PROXY)
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
@@ -1214,6 +1412,8 @@ config_create_default ()
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name=freenode\n");
|
||||
fprintf (file, "server_autoconnect=on\n");
|
||||
fprintf (file, "server_autoreconnect=on\n");
|
||||
fprintf (file, "server_autoreconnect_delay=30\n");
|
||||
fprintf (file, "server_address=irc.freenode.net\n");
|
||||
fprintf (file, "server_port=6667\n");
|
||||
fprintf (file, "server_password=\n");
|
||||
@@ -1258,10 +1458,12 @@ config_create_default ()
|
||||
}
|
||||
|
||||
fprintf (file, "server_command=\n");
|
||||
fprintf (file, "server_command_delay=0\n");
|
||||
fprintf (file, "server_autojoin=\n");
|
||||
fprintf (file, "server_autorejoin=on\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
@@ -1408,6 +1610,7 @@ config_write (char *config_name)
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+24
-6
@@ -21,6 +21,8 @@
|
||||
#ifndef __WEECHAT_CONFIG_H
|
||||
#define __WEECHAT_CONFIG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define WEECHAT_CONFIG_NAME "weechat.rc"
|
||||
|
||||
#define CONFIG_SECTION_NONE -1
|
||||
@@ -28,11 +30,12 @@
|
||||
#define CONFIG_SECTION_COLORS 1
|
||||
#define CONFIG_SECTION_HISTORY 2
|
||||
#define CONFIG_SECTION_LOG 3
|
||||
#define CONFIG_SECTION_DCC 4
|
||||
#define CONFIG_SECTION_PROXY 5
|
||||
#define CONFIG_SECTION_ALIAS 6
|
||||
#define CONFIG_SECTION_SERVER 7
|
||||
#define CONFIG_NUMBER_SECTIONS 8
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_ALIAS 7
|
||||
#define CONFIG_SECTION_SERVER 8
|
||||
#define CONFIG_NUMBER_SECTIONS 9
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -77,6 +80,9 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
@@ -88,7 +94,6 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern int cfg_look_display_away;
|
||||
extern int cfg_look_infobar;
|
||||
extern char *cfg_look_infobar_timestamp;
|
||||
extern int cfg_look_infobar_delay_highlight;
|
||||
@@ -121,6 +126,7 @@ extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
@@ -146,6 +152,15 @@ extern char *cfg_log_path;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
|
||||
extern int cfg_irc_display_away;
|
||||
extern char *cfg_irc_default_msg_away;
|
||||
extern char *cfg_irc_default_msg_part;
|
||||
extern char *cfg_irc_default_msg_quit;
|
||||
extern int cfg_irc_away_check;
|
||||
extern int cfg_irc_lag_check;
|
||||
extern int cfg_irc_lag_min_show;
|
||||
extern int cfg_irc_lag_disconnect;
|
||||
|
||||
extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
@@ -169,9 +184,12 @@ extern void config_change_title ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
extern void *config_get_server_option_ptr (t_irc_server *, char *);
|
||||
extern int config_set_server_value (t_irc_server *, char *, char *);
|
||||
extern int config_read ();
|
||||
extern int config_create_default ();
|
||||
extern int config_write ();
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weelist.c: sorted lists management */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weelist.h"
|
||||
|
||||
|
||||
/*
|
||||
* weelist_search: search date in a list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_search (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) == 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* word not found in list */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_find_pos: find position for data (keeping list sorted)
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_find_pos (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) < 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* position not found, best position is at the end */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_insert: insert an element to the list (at good position)
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *pos_weelist;
|
||||
|
||||
pos_weelist = weelist_find_pos (*weelist, element->data);
|
||||
|
||||
if (*weelist)
|
||||
{
|
||||
if (pos_weelist)
|
||||
{
|
||||
/* insert data into the list (before position found) */
|
||||
element->prev_weelist = pos_weelist->prev_weelist;
|
||||
element->next_weelist = pos_weelist;
|
||||
if (pos_weelist->prev_weelist)
|
||||
pos_weelist->prev_weelist->next_weelist = element;
|
||||
else
|
||||
*weelist = element;
|
||||
pos_weelist->prev_weelist = element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add data to the end */
|
||||
element->prev_weelist = *last_weelist;
|
||||
element->next_weelist = NULL;
|
||||
(*last_weelist)->next_weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element->prev_weelist = NULL;
|
||||
element->next_weelist = NULL;
|
||||
*weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_add: create new data and add it to list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
if (!data || (!data[0]))
|
||||
return NULL;
|
||||
|
||||
if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist)))))
|
||||
{
|
||||
new_weelist->data = strdup (data);
|
||||
weelist_insert (weelist, last_weelist, new_weelist);
|
||||
return new_weelist;
|
||||
}
|
||||
/* failed to allocate new element */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_remove: free an element in a list
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
/* remove element from list */
|
||||
if (*last_weelist == element)
|
||||
*last_weelist = element->prev_weelist;
|
||||
if (element->prev_weelist)
|
||||
{
|
||||
(element->prev_weelist)->next_weelist = element->next_weelist;
|
||||
new_weelist = *weelist;
|
||||
}
|
||||
else
|
||||
new_weelist = element->next_weelist;
|
||||
|
||||
if (element->next_weelist)
|
||||
(element->next_weelist)->prev_weelist = element->prev_weelist;
|
||||
|
||||
/* free data */
|
||||
if (element->data)
|
||||
free (element->data);
|
||||
free (element);
|
||||
*weelist = new_weelist;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_LIST_H
|
||||
#define __WEECHAT_LIST_H 1
|
||||
|
||||
typedef struct t_weelist t_weelist;
|
||||
|
||||
struct t_weelist
|
||||
{
|
||||
char *data;
|
||||
t_weelist *prev_weelist;
|
||||
t_weelist *next_weelist;
|
||||
};
|
||||
|
||||
t_weelist *weelist_search (t_weelist *, char *);
|
||||
t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
|
||||
void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
|
||||
|
||||
#endif /* weelist.h */
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
if GUI_CURSES
|
||||
if GUI_NCURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(CURSES_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_curses_SOURCES = ../gui.h \
|
||||
|
||||
+415
-144
@@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <curses.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
@@ -41,27 +41,26 @@
|
||||
|
||||
|
||||
t_gui_color gui_colors[] =
|
||||
{ { "default", -1 | A_NORMAL },
|
||||
{ "black", COLOR_BLACK | A_NORMAL },
|
||||
{ "red", COLOR_RED | A_NORMAL },
|
||||
{ "lightred", COLOR_RED | A_BOLD },
|
||||
{ "green", COLOR_GREEN | A_NORMAL },
|
||||
{ "lightgreen", COLOR_GREEN | A_BOLD },
|
||||
{ "brown", COLOR_YELLOW | A_NORMAL },
|
||||
{ "yellow", COLOR_YELLOW | A_BOLD },
|
||||
{ "blue", COLOR_BLUE | A_NORMAL },
|
||||
{ "lightblue", COLOR_BLUE | A_BOLD },
|
||||
{ "magenta", COLOR_MAGENTA | A_NORMAL },
|
||||
{ { "default", -1 | A_NORMAL },
|
||||
{ "black", COLOR_BLACK | A_NORMAL },
|
||||
{ "red", COLOR_RED | A_NORMAL },
|
||||
{ "lightred", COLOR_RED | A_BOLD },
|
||||
{ "green", COLOR_GREEN | A_NORMAL },
|
||||
{ "lightgreen", COLOR_GREEN | A_BOLD },
|
||||
{ "brown", COLOR_YELLOW | A_NORMAL },
|
||||
{ "yellow", COLOR_YELLOW | A_BOLD },
|
||||
{ "blue", COLOR_BLUE | A_NORMAL },
|
||||
{ "lightblue", COLOR_BLUE | A_BOLD },
|
||||
{ "magenta", COLOR_MAGENTA | A_NORMAL },
|
||||
{ "lightmagenta", COLOR_MAGENTA | A_BOLD },
|
||||
{ "cyan", COLOR_CYAN | A_NORMAL },
|
||||
{ "lightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "gray", COLOR_WHITE },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ "cyan", COLOR_CYAN | A_NORMAL },
|
||||
{ "lightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "gray",
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "default",
|
||||
"lightcyan", "lightmagenta", "lightgreen", "blue" };
|
||||
|
||||
int color_attr[NUM_COLORS];
|
||||
@@ -299,6 +298,29 @@ gui_curses_window_clear (WINDOW *window)
|
||||
wmove (window, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_separator: draw window separation
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_separator (t_gui_window *window)
|
||||
{
|
||||
if (window->win_separator)
|
||||
delwin (window->win_separator);
|
||||
|
||||
if (window->win_x > 0)
|
||||
{
|
||||
window->win_separator = newwin (window->win_height,
|
||||
1,
|
||||
window->win_y,
|
||||
window->win_x - 1);
|
||||
gui_window_set_color (window->win_separator, COLOR_WIN_TITLE);
|
||||
wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||
wrefresh (window->win_separator);
|
||||
refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_title: draw title window for a buffer
|
||||
*/
|
||||
@@ -307,7 +329,7 @@ void
|
||||
gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format[32];
|
||||
char format[32], *buf;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@@ -326,12 +348,18 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
wrefresh (ptr_win->win_title);
|
||||
refresh ();
|
||||
}
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer))
|
||||
{
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer)->topic)
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format,
|
||||
CHANNEL(buffer)->topic);
|
||||
{
|
||||
buf = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -339,10 +367,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
/* TODO: change this copyright as title? */
|
||||
mvwprintw (ptr_win->win_title, 0, 0,
|
||||
"%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
|
||||
mvwprintw (ptr_win->win_title, 0,
|
||||
ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
|
||||
"%s", WEECHAT_COPYRIGHT);
|
||||
format,
|
||||
PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE " - "
|
||||
WEECHAT_WEBSITE);
|
||||
}
|
||||
}
|
||||
wrefresh (ptr_win->win_title);
|
||||
@@ -416,6 +443,8 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||
{
|
||||
num_displayed = window->win_chat_width -
|
||||
window->win_chat_cursor_x;
|
||||
if (num_displayed < 0)
|
||||
return;
|
||||
saved_char = ptr_message->message[offset + num_displayed];
|
||||
ptr_message->message[offset + num_displayed] = '\0';
|
||||
if (lines_displayed >= num_lines - count)
|
||||
@@ -748,7 +777,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
if (gui_buffer_has_nicklist (buffer))
|
||||
{
|
||||
max_length = nick_get_max_length (CHANNEL(buffer));
|
||||
if ((buffer == gui_current_window->buffer) &&
|
||||
if ((buffer->num_displayed > 0) &&
|
||||
((max_length + 2) != ptr_win->win_nick_width))
|
||||
{
|
||||
gui_calculate_pos_size (ptr_win);
|
||||
@@ -776,31 +805,28 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
|
||||
if (has_colors ())
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
switch (cfg_look_nicklist_position)
|
||||
{
|
||||
case CFG_LOOK_NICKLIST_LEFT:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
i, ptr_win->win_nick_width - 1, " ");
|
||||
mvwvline (ptr_win->win_nick,
|
||||
0, ptr_win->win_nick_width - 1, ACS_VLINE,
|
||||
ptr_win->win_chat_height);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_RIGHT:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
i, 0, " ");
|
||||
mvwvline (ptr_win->win_nick,
|
||||
0, 0, ACS_VLINE,
|
||||
ptr_win->win_chat_height);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_TOP:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
for (i = 0; i < ptr_win->win_chat_width; i += 2)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
ptr_win->win_nick_height - 1, i, "-");
|
||||
mvwhline (ptr_win->win_nick,
|
||||
ptr_win->win_nick_height - 1, 0, ACS_HLINE,
|
||||
ptr_win->win_chat_width);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_BOTTOM:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
for (i = 0; i < ptr_win->win_chat_width; i += 2)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
0, i, "-");
|
||||
mvwhline (ptr_win->win_nick,
|
||||
0, 0, ACS_HLINE,
|
||||
ptr_win->win_chat_width);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -855,7 +881,9 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick,
|
||||
(ptr_nick->is_away) ?
|
||||
COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK);
|
||||
mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
|
||||
y++;
|
||||
if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
|
||||
@@ -885,9 +913,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
char format_more[32];
|
||||
char format_more[32], *string;
|
||||
int i, first_mode;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
@@ -923,6 +954,15 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name);
|
||||
if (SERVER(ptr_win->buffer)->is_away)
|
||||
{
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("(away)"));
|
||||
wprintw (ptr_win->win_status, string);
|
||||
free (string);
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "] ");
|
||||
@@ -1000,15 +1040,30 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
wprintw (ptr_win->win_status, "%d:<DCC> ",
|
||||
ptr_win->buffer->number);
|
||||
else
|
||||
wprintw (ptr_win->win_status, _("%d:[not connected] "),
|
||||
{
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("%d:[not connected] "));
|
||||
wprintw (ptr_win->win_status, string,
|
||||
ptr_win->buffer->number);
|
||||
free (string);
|
||||
}
|
||||
}
|
||||
|
||||
/* display list of other active windows (if any) with numbers */
|
||||
if (hotlist)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "[");
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, _("[Act: "));
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("Act: "));
|
||||
wprintw (ptr_win->win_status, string);
|
||||
free (string);
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
@@ -1039,21 +1094,48 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
wprintw (ptr_win->win_status, ",");
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, "]");
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "] ");
|
||||
}
|
||||
|
||||
/* display lag */
|
||||
if (SERVER(ptr_win->buffer))
|
||||
{
|
||||
if (SERVER(ptr_win->buffer)->lag / 1000 >= cfg_irc_lag_min_show)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "[");
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("Lag: %.1f"));
|
||||
wprintw (ptr_win->win_status, string,
|
||||
((float)(SERVER(ptr_win->buffer)->lag)) / 1000);
|
||||
free (string);
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "]");
|
||||
}
|
||||
}
|
||||
|
||||
/* display "-MORE-" if last line is not displayed */
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE);
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("-MORE-"));
|
||||
if (ptr_win->sub_lines > 0)
|
||||
mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
|
||||
_("-MORE-"));
|
||||
"%s", string);
|
||||
else
|
||||
{
|
||||
snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
|
||||
snprintf (format_more, 32, "%%-%ds", strlen (string));
|
||||
mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
|
||||
format_more, " ");
|
||||
}
|
||||
free (string);
|
||||
|
||||
wrefresh (ptr_win->win_status);
|
||||
refresh ();
|
||||
@@ -1552,49 +1634,6 @@ gui_move_page_down (t_gui_window *window)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_curses_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_curses_resize_handler ()
|
||||
{
|
||||
t_gui_window *ptr_win, *old_current_window;
|
||||
int old_width, old_height;
|
||||
int new_width, new_height;
|
||||
|
||||
getmaxyx (stdscr, old_height, old_width);
|
||||
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
old_current_window = gui_current_window;
|
||||
|
||||
/* TODO: manage when some windows are outside new term size */
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
ptr_win->dcc_first = NULL;
|
||||
ptr_win->dcc_selected = NULL;
|
||||
if (ptr_win->win_x + ptr_win->win_width == old_width)
|
||||
ptr_win->win_width = new_width - ptr_win->win_x;
|
||||
if (ptr_win->win_y + ptr_win->win_height == old_height)
|
||||
ptr_win->win_height = new_height - ptr_win->win_y;
|
||||
gui_switch_to_buffer (ptr_win, ptr_win->buffer);
|
||||
}
|
||||
|
||||
gui_current_window = old_current_window;
|
||||
if ((new_width > 5) && (new_height > 5))
|
||||
{
|
||||
gui_ok = 1;
|
||||
gui_calculate_pos_size (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
else
|
||||
gui_ok = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_init_subviews: init subviews for a WeeChat window
|
||||
*/
|
||||
@@ -1673,18 +1712,229 @@ gui_window_split_vertic (t_gui_window *window)
|
||||
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
|
||||
/* create & draw separator if window is not on the left */
|
||||
gui_current_window->win_separator = newwin (gui_current_window->win_height,
|
||||
1,
|
||||
gui_current_window->win_y,
|
||||
gui_current_window->win_x - 1);
|
||||
gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE);
|
||||
wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||
wrefresh (gui_current_window->win_separator);
|
||||
refresh ();
|
||||
/* create & draw separator */
|
||||
gui_draw_window_separator (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_down: merge window, direction down
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_down (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_y == window->win_y + window->win_height)
|
||||
&& (ptr_win->win_x == window->win_x)
|
||||
&& (ptr_win->win_width == window->win_width))
|
||||
{
|
||||
window->win_height += ptr_win->win_height;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found below current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_up: merge window, direction up
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_up (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_y + ptr_win->win_height == window->win_y)
|
||||
&& (ptr_win->win_x == window->win_x)
|
||||
&& (ptr_win->win_width == window->win_width))
|
||||
{
|
||||
window->win_height += ptr_win->win_height;
|
||||
window->win_y -= ptr_win->win_height;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found above current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_left: merge window, direction left
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_left (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_x + ptr_win->win_width + 1 == window->win_x)
|
||||
&& (ptr_win->win_y == window->win_y)
|
||||
&& (ptr_win->win_height == window->win_height))
|
||||
{
|
||||
window->win_width += ptr_win->win_width + 1;
|
||||
window->win_x -= ptr_win->win_width + 1;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found on the left of current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_right: merge window, direction right
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_right (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_x == window->win_x + window->win_width + 1)
|
||||
&& (ptr_win->win_y == window->win_y)
|
||||
&& (ptr_win->win_height == window->win_height))
|
||||
{
|
||||
window->win_width += ptr_win->win_width + 1;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found on the right of current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge: merge a window, direction auto
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_merge_auto (t_gui_window *window)
|
||||
{
|
||||
if (gui_window_merge_down (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_up (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_left (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_right (window) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_all: merge all windows
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_merge_all (t_gui_window *window)
|
||||
{
|
||||
while (gui_windows->next_window)
|
||||
{
|
||||
gui_window_free ((gui_windows == window) ? gui_windows->next_window : gui_windows);
|
||||
}
|
||||
window->win_x = 0;
|
||||
window->win_y = 0;
|
||||
window->win_width = COLS;
|
||||
window->win_height = LINES;
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_curses_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_curses_resize_handler ()
|
||||
{
|
||||
t_gui_window *ptr_win, *old_current_window;
|
||||
int old_width, old_height;
|
||||
int new_width, new_height;
|
||||
int merge_all_windows;
|
||||
|
||||
getmaxyx (stdscr, old_height, old_width);
|
||||
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
old_current_window = gui_current_window;
|
||||
|
||||
gui_ok = ((new_width > 5) && (new_height > 5));
|
||||
|
||||
merge_all_windows = 0;
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
ptr_win->dcc_first = NULL;
|
||||
ptr_win->dcc_selected = NULL;
|
||||
|
||||
if (!merge_all_windows)
|
||||
{
|
||||
if ((ptr_win->win_x > new_width - 5)
|
||||
|| (ptr_win->win_y > new_height - 5))
|
||||
merge_all_windows = 1;
|
||||
else
|
||||
{
|
||||
if (ptr_win->win_x + ptr_win->win_width == old_width)
|
||||
ptr_win->win_width = new_width - ptr_win->win_x;
|
||||
if (ptr_win->win_y + ptr_win->win_height == old_height)
|
||||
ptr_win->win_height = new_height - ptr_win->win_y;
|
||||
if ((ptr_win->win_width < 5) || (ptr_win->win_height < 5))
|
||||
merge_all_windows = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (merge_all_windows)
|
||||
gui_window_merge_all (gui_current_window);
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
gui_switch_to_buffer (ptr_win, ptr_win->buffer);
|
||||
gui_redraw_buffer (ptr_win->buffer);
|
||||
gui_draw_window_separator (ptr_win);
|
||||
}
|
||||
|
||||
gui_current_window = old_current_window;
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||
*/
|
||||
@@ -1757,6 +2007,8 @@ gui_init_colors ()
|
||||
cfg_col_input_nick & A_CHARTEXT, cfg_col_input_bg);
|
||||
init_pair (COLOR_WIN_NICK,
|
||||
cfg_col_nick & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_AWAY,
|
||||
cfg_col_nick_away & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_OP,
|
||||
cfg_col_nick_op & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_HALFOP,
|
||||
@@ -1764,7 +2016,7 @@ gui_init_colors ()
|
||||
init_pair (COLOR_WIN_NICK_VOICE,
|
||||
cfg_col_nick_voice & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_SEP,
|
||||
COLOR_BLACK & A_CHARTEXT, cfg_col_nick_sep);
|
||||
cfg_col_nick_sep & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_SELF,
|
||||
cfg_col_nick_self & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_PRIVATE,
|
||||
@@ -1774,8 +2026,7 @@ gui_init_colors ()
|
||||
{
|
||||
gui_assign_color (&color, nicks_colors[i]);
|
||||
init_pair (COLOR_WIN_NICK_FIRST + i, color & A_CHARTEXT, cfg_col_chat_bg);
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] =
|
||||
(color & A_BOLD) ? A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] = (color >= 0) ? color & A_BOLD : 0;
|
||||
}
|
||||
|
||||
init_pair (COLOR_DCC_SELECTED,
|
||||
@@ -1793,43 +2044,44 @@ gui_init_colors ()
|
||||
init_pair (COLOR_DCC_ABORTED,
|
||||
cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg);
|
||||
|
||||
color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_TIME - 1] = cfg_col_chat_time & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = cfg_col_chat_time_sep & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = cfg_col_chat_prefix1 & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = cfg_col_chat_prefix2 & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_NICK - 1] = cfg_col_chat_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = cfg_col_chat_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = cfg_col_status_delimiters & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = cfg_col_status_data_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD;
|
||||
color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD;
|
||||
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK - 1] = cfg_col_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_OP - 1] = cfg_col_nick_op & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_HALFOP - 1] = cfg_col_nick_halfop & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_VOICE - 1] = cfg_col_nick_voice & A_BOLD;
|
||||
color_attr[COLOR_WIN_TITLE - 1] = (cfg_col_title >= 0) ? cfg_col_title & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = (cfg_col_chat >= 0) ? cfg_col_chat & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_TIME - 1] = (cfg_col_chat_time >= 0) ? cfg_col_chat_time & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = (cfg_col_chat_time_sep >= 0) ? cfg_col_chat_time_sep & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_HOST - 1] = (cfg_col_chat_host >= 0) ? cfg_col_chat_host & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = (cfg_col_chat_channel >= 0) ? cfg_col_chat_channel & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = (cfg_col_chat_highlight >= 0) ? cfg_col_chat_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS - 1] = (cfg_col_status >= 0) ? cfg_col_status & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = (cfg_col_status_delimiters >= 0) ? cfg_col_status_delimiters & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = (cfg_col_status_data_msg >= 0) ? cfg_col_status_data_msg & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = (cfg_col_status_data_highlight >= 0) ? cfg_col_status_data_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = (cfg_col_status_data_other >= 0) ? cfg_col_status_data_other & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_MORE - 1] = (cfg_col_status_more >= 0) ? cfg_col_status_more & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INFOBAR - 1] = (cfg_col_infobar >= 0) ? cfg_col_infobar & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = (cfg_col_infobar_highlight >= 0) ? cfg_col_infobar_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT - 1] = (cfg_col_input >= 0) ? cfg_col_input & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = (cfg_col_input_channel >= 0) ? cfg_col_input_channel & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT_NICK - 1] = (cfg_col_input_nick >= 0) ? cfg_col_input_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK - 1] = (cfg_col_nick >= 0) ? cfg_col_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_AWAY - 1] = (cfg_col_nick_away >= 0) ? cfg_col_nick_away & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_OP - 1] = (cfg_col_nick_op >= 0) ? cfg_col_nick_op & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_HALFOP - 1] = (cfg_col_nick_halfop >= 0) ? cfg_col_nick_halfop & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_VOICE - 1] = (cfg_col_nick_voice >= 0) ? cfg_col_nick_voice & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_SEP - 1] = 0;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD;
|
||||
color_attr[COLOR_DCC_SELECTED - 1] = cfg_col_dcc_selected & A_BOLD;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD;
|
||||
color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = (cfg_col_nick_self >= 0) ? cfg_col_nick_self & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = (cfg_col_nick_private >= 0) ? cfg_col_nick_private & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_SELECTED - 1] = (cfg_col_dcc_selected >= 0) ? cfg_col_dcc_selected & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = (cfg_col_dcc_waiting >= 0) ? cfg_col_dcc_waiting & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = (cfg_col_dcc_connecting >= 0) ? cfg_col_dcc_connecting & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = (cfg_col_dcc_active >= 0) ? cfg_col_dcc_active & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_DONE - 1] = (cfg_col_dcc_done >= 0) ? cfg_col_dcc_done & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = (cfg_col_dcc_failed >= 0) ? cfg_col_dcc_failed & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = (cfg_col_dcc_aborted >= 0) ? cfg_col_dcc_aborted & A_BOLD : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1915,6 +2167,19 @@ gui_end ()
|
||||
gui_buffer_free (gui_buffers, 0);
|
||||
}
|
||||
|
||||
/* delete all windows */
|
||||
while (gui_windows)
|
||||
{
|
||||
gui_window_free (gui_windows);
|
||||
}
|
||||
|
||||
/* delete general history */
|
||||
history_general_free ();
|
||||
|
||||
/* delete infobar messages */
|
||||
while (gui_infobar)
|
||||
gui_infobar_remove ();
|
||||
|
||||
/* end of curses output */
|
||||
refresh ();
|
||||
endwin ();
|
||||
@@ -1993,7 +2258,7 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
{
|
||||
static char buf[8192];
|
||||
char timestamp[16];
|
||||
char *pos, *buf2;
|
||||
char *pos, *buf2, *buf3;
|
||||
int i, j;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@@ -2051,12 +2316,17 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
buf3 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buf2);
|
||||
|
||||
if (gui_init_ok)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buf2 - 1;
|
||||
pos = buf3 - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
@@ -2087,7 +2357,8 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
refresh ();*/
|
||||
}
|
||||
else
|
||||
printf ("%s", buf2);
|
||||
printf ("%s", buf3);
|
||||
|
||||
free (buf2);
|
||||
free (buf3);
|
||||
}
|
||||
|
||||
+100
-20
@@ -31,7 +31,7 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <curses.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
@@ -52,7 +52,7 @@ gui_read_keyb ()
|
||||
int key, i;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
char new_char[2];
|
||||
char new_char[3], *decoded_string;
|
||||
t_dcc *dcc_selected;
|
||||
|
||||
key = getch ();
|
||||
@@ -89,6 +89,7 @@ gui_read_keyb ()
|
||||
/* remove last infobar message */
|
||||
case KEY_F(10):
|
||||
gui_infobar_remove ();
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
break;
|
||||
/* cursor up */
|
||||
case KEY_UP:
|
||||
@@ -311,16 +312,16 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->input_buffer_size,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
|
||||
if (gui_current_window->buffer->completion.word_found)
|
||||
{
|
||||
/* replace word with new completed word into input buffer */
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
|
||||
if (gui_current_window->buffer->completion.diff_size > 0)
|
||||
{
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
for (i = gui_current_window->buffer->input_buffer_size - 1;
|
||||
i >= gui_current_window->buffer->completion.position_replace +
|
||||
(int)strlen (gui_current_window->buffer->completion.word_found); i--)
|
||||
@@ -336,6 +337,10 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
}
|
||||
|
||||
strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
|
||||
@@ -344,35 +349,45 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* position is < 0 this means only one word was found to complete,
|
||||
so reinit to stop completion */
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* add space or completor to the end of completion, if needed */
|
||||
if (gui_current_window->buffer->completion.base_word[0] == '/')
|
||||
if ((gui_current_window->buffer->completion.context == COMPLETION_COMMAND)
|
||||
|| (gui_current_window->buffer->completion.context == COMPLETION_COMMAND_ARG))
|
||||
{
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
/* add nick completor if position 0 and completing nick */
|
||||
if ((gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
&& (gui_current_window->buffer->completion.context == COMPLETION_NICK))
|
||||
{
|
||||
if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
|
||||
cfg_look_completor, strlen (cfg_look_completor)) != 0)
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
cfg_look_completor,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
@@ -531,9 +546,10 @@ gui_read_keyb ()
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -600,12 +616,28 @@ gui_read_keyb ()
|
||||
"[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
|
||||
new_char[0] = key;
|
||||
new_char[1] = '\0';
|
||||
decoded_string = NULL;
|
||||
|
||||
/* UTF-8 input */
|
||||
if (key == 0xC3)
|
||||
{
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
new_char[1] = key;
|
||||
new_char[2] = '\0';
|
||||
decoded_string = weechat_convert_encoding (local_charset, cfg_look_charset_internal, new_char);
|
||||
}
|
||||
}
|
||||
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
new_char,
|
||||
(decoded_string) ? decoded_string : new_char,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
|
||||
if (decoded_string)
|
||||
free (decoded_string);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -620,15 +652,17 @@ void
|
||||
gui_main_loop ()
|
||||
{
|
||||
fd_set read_fd;
|
||||
static struct timeval timeout;
|
||||
static struct timeval timeout, tv;
|
||||
static struct timezone tz;
|
||||
t_irc_server *ptr_server;
|
||||
int old_min, old_sec;
|
||||
int old_min, old_sec, diff;
|
||||
time_t new_time;
|
||||
struct tm *local_time;
|
||||
|
||||
quit_weechat = 0;
|
||||
old_min = -1;
|
||||
old_sec = -1;
|
||||
check_away = 0;
|
||||
while (!quit_weechat)
|
||||
{
|
||||
new_time = time (NULL);
|
||||
@@ -641,15 +675,31 @@ gui_main_loop ()
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* second has changed ? => count down time for infobar, if needed */
|
||||
/* second has changed ? */
|
||||
if (local_time->tm_sec != old_sec)
|
||||
{
|
||||
old_sec = local_time->tm_sec;
|
||||
|
||||
/* infobar count down */
|
||||
if (gui_infobar && gui_infobar->remaining_time > 0)
|
||||
{
|
||||
gui_infobar->remaining_time--;
|
||||
if (gui_infobar->remaining_time == 0)
|
||||
{
|
||||
gui_infobar_remove ();
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* away check */
|
||||
if (cfg_irc_away_check != 0)
|
||||
{
|
||||
check_away++;
|
||||
if (check_away >= (cfg_irc_away_check * 60))
|
||||
{
|
||||
check_away = 0;
|
||||
server_check_away ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,8 +716,38 @@ gui_main_loop ()
|
||||
&& (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay)))
|
||||
server_reconnect (ptr_server);
|
||||
else
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
/* check for lag */
|
||||
if ((ptr_server->lag_check_time.tv_sec == 0)
|
||||
&& (new_time >= ptr_server->lag_next_check))
|
||||
{
|
||||
server_sendf (ptr_server, "PING %s\r\n", ptr_server->address);
|
||||
gettimeofday (&(ptr_server->lag_check_time), &tz);
|
||||
}
|
||||
|
||||
/* lag timeout => disconnect */
|
||||
if ((ptr_server->lag_check_time.tv_sec != 0)
|
||||
&& (cfg_irc_lag_disconnect > 0))
|
||||
{
|
||||
gettimeofday (&tv, &tz);
|
||||
diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv);
|
||||
if (diff / 1000 > cfg_irc_lag_disconnect * 60)
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s lag is high, disconnecting from server...\n"),
|
||||
WEECHAT_WARNING);
|
||||
server_disconnect (ptr_server, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_server->sock4 >= 0)
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
}
|
||||
}
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout))
|
||||
{
|
||||
|
||||
+38
-7
@@ -145,8 +145,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
SERVER(gui_buffers) = server;
|
||||
CHANNEL(gui_buffers) = channel;
|
||||
gui_buffers->server = server;
|
||||
gui_buffers->channel = channel;
|
||||
if (cfg_log_auto_server)
|
||||
log_start (gui_buffers);
|
||||
return gui_buffers;
|
||||
@@ -158,8 +158,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
SERVER(new_buffer) = server;
|
||||
CHANNEL(new_buffer) = channel;
|
||||
new_buffer->server = server;
|
||||
new_buffer->channel = channel;
|
||||
new_buffer->dcc = dcc;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
@@ -299,17 +299,22 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
static char buffer[1024];
|
||||
va_list argptr;
|
||||
t_gui_infobar *ptr_infobar;
|
||||
char *pos;
|
||||
char *pos, *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buffer);
|
||||
|
||||
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
|
||||
if (ptr_infobar)
|
||||
{
|
||||
ptr_infobar->color = color;
|
||||
ptr_infobar->text = strdup (buffer);
|
||||
ptr_infobar->text = strdup (buf2);
|
||||
pos = strchr (ptr_infobar->text, '\n');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
@@ -321,6 +326,28 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
else
|
||||
wee_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
WEECHAT_ERROR);
|
||||
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -339,7 +366,6 @@ gui_infobar_remove ()
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +407,9 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (buffer_before_dcc == buffer)
|
||||
buffer_before_dcc = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
@@ -414,6 +443,8 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
history_buffer_free (buffer);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
|
||||
+27
-18
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 46
|
||||
#define NUM_COLORS 47
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -50,22 +50,23 @@
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_OP 24
|
||||
#define COLOR_WIN_NICK_HALFOP 25
|
||||
#define COLOR_WIN_NICK_VOICE 26
|
||||
#define COLOR_WIN_NICK_SEP 27
|
||||
#define COLOR_WIN_NICK_SELF 28
|
||||
#define COLOR_WIN_NICK_PRIVATE 29
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_OP 25
|
||||
#define COLOR_WIN_NICK_HALFOP 26
|
||||
#define COLOR_WIN_NICK_VOICE 27
|
||||
#define COLOR_WIN_NICK_SEP 28
|
||||
#define COLOR_WIN_NICK_SELF 29
|
||||
#define COLOR_WIN_NICK_PRIVATE 30
|
||||
#define COLOR_WIN_NICK_FIRST 31
|
||||
#define COLOR_WIN_NICK_LAST 40
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 40
|
||||
#define COLOR_DCC_WAITING 41
|
||||
#define COLOR_DCC_CONNECTING 42
|
||||
#define COLOR_DCC_ACTIVE 43
|
||||
#define COLOR_DCC_DONE 44
|
||||
#define COLOR_DCC_FAILED 45
|
||||
#define COLOR_DCC_ABORTED 46
|
||||
#define COLOR_DCC_SELECTED 41
|
||||
#define COLOR_DCC_WAITING 42
|
||||
#define COLOR_DCC_CONNECTING 43
|
||||
#define COLOR_DCC_ACTIVE 44
|
||||
#define COLOR_DCC_DONE 45
|
||||
#define COLOR_DCC_FAILED 46
|
||||
#define COLOR_DCC_ABORTED 47
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
@@ -246,14 +247,14 @@ extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_buffer *buffer_before_dcc;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* GUI independent functions */
|
||||
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
@@ -265,7 +266,9 @@ extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, 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);
|
||||
@@ -290,6 +293,12 @@ extern void gui_curses_resize_handler ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern int gui_window_merge_up (t_gui_window *);
|
||||
extern int gui_window_merge_down (t_gui_window *);
|
||||
extern int gui_window_merge_left (t_gui_window *);
|
||||
extern int gui_window_merge_right (t_gui_window *);
|
||||
extern void gui_window_merge_auto (t_gui_window *);
|
||||
extern void gui_window_merge_all (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
|
||||
@@ -59,6 +59,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
@@ -153,3 +154,53 @@ string_is_channel (char *string)
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_check_away: check for away on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ t_irc_command irc_commands[] =
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
{ "devoice", N_("removes voice from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
{ "die", N_("shutdown the server"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, irc_cmd_send_die, NULL },
|
||||
@@ -101,7 +101,7 @@ t_irc_command irc_commands[] =
|
||||
{ "me", N_("send a ctcp action to the current channel"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
{ "mode", N_("change channel or user mode"),
|
||||
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
|
||||
"{ nickname {[+|-]|i|w|s|o}"),
|
||||
@@ -136,7 +136,7 @@ t_irc_command irc_commands[] =
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
|
||||
{ "names", N_("list nicknames on channels"),
|
||||
N_("[channel[,channel]]"), N_("channel: channel name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL },
|
||||
0, 1, 1, NULL, irc_cmd_send_names, NULL },
|
||||
{ "nick", N_("change current nickname"),
|
||||
N_("nickname"), N_("nickname: new nickname for current IRC server"),
|
||||
1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
|
||||
@@ -145,7 +145,7 @@ t_irc_command irc_commands[] =
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice },
|
||||
{ "op", N_("gives channel operator status to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_op, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_op, NULL, NULL },
|
||||
{ "oper", N_("get operator privileges"),
|
||||
N_("user password"),
|
||||
N_("user/password: used to get privileges on current IRC server"),
|
||||
@@ -161,7 +161,7 @@ t_irc_command irc_commands[] =
|
||||
{ "pong", N_("answer to a ping message"),
|
||||
N_("daemon [daemon2]"), N_("daemon: daemon who has responded to Ping message\n"
|
||||
"daemon2: forward message to this daemon"),
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, NULL },
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong },
|
||||
{ "privmsg", N_("message received"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
|
||||
@@ -229,7 +229,7 @@ t_irc_command irc_commands[] =
|
||||
0, 1, 1, NULL, irc_cmd_send_version, NULL },
|
||||
{ "voice", N_("gives voice to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
{ "wallops", N_("send a message to all currently connected users who have "
|
||||
"set the 'w' user mode for themselves"),
|
||||
N_("text"), N_("text to send"),
|
||||
@@ -284,7 +284,7 @@ t_irc_command irc_commands[] =
|
||||
{ "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
|
||||
{ "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
|
||||
{ "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_315 },
|
||||
{ "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
|
||||
{ "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
|
||||
{ "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
|
||||
|
||||
@@ -133,3 +133,76 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_server: display server description
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
}
|
||||
|
||||
+16
-2
@@ -176,6 +176,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
new_nick->is_away = 0;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
@@ -339,8 +340,7 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
max_length = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
length = strlen (ptr_nick->nick);
|
||||
if (length > max_length)
|
||||
@@ -348,3 +348,17 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
}
|
||||
return max_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+134
-7
@@ -159,6 +159,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new channel \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
@@ -184,7 +185,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
|
||||
gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s\n", arguments);
|
||||
(void) nick_new (ptr_channel, host, 0, 0, 0);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -225,6 +226,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -257,6 +259,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -266,8 +269,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
/* my nick was kicked => free all nicks, channel is not active any more */
|
||||
nick_free_all (ptr_channel);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
if (server->autorejoin)
|
||||
irc_cmd_send_join (server, ptr_channel->name);
|
||||
}
|
||||
@@ -277,7 +280,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_nick)
|
||||
{
|
||||
nick_free (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -546,6 +549,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -560,6 +564,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
pos = strchr (arguments, ' ');
|
||||
if (!pos)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without channel or nickname\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -585,10 +590,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_channel)
|
||||
{
|
||||
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -598,6 +604,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
else
|
||||
{
|
||||
/* nickname modes */
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
|
||||
@@ -626,6 +633,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "nick");
|
||||
@@ -734,6 +742,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nickname not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
@@ -791,6 +800,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
if (host)
|
||||
{
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", host);
|
||||
@@ -825,6 +835,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (!host || !arguments)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host or channel\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -899,6 +910,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -925,6 +937,37 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_pong: 'pong' command received
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_recv_pong (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
int old_lag;
|
||||
|
||||
(void)host;
|
||||
(void)arguments;
|
||||
|
||||
if (server->lag_check_time.tv_sec != 0)
|
||||
{
|
||||
/* calculate lag (time diff with lag check) */
|
||||
old_lag = server->lag;
|
||||
gettimeofday (&tv, &tz);
|
||||
server->lag = (int) get_timeval_diff (&(server->lag_check_time), &tv);
|
||||
if (old_lag != server->lag)
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
|
||||
/* schedule next lag check */
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_privmsg: 'privmsg' command received
|
||||
*/
|
||||
@@ -941,6 +984,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1030,6 +1074,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1039,6 +1084,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1123,6 +1169,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (!pos2)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1137,6 +1184,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_size = strrchr (pos_file, ' ');
|
||||
if (!pos_size)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1152,6 +1200,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_port = strrchr (pos_file, ' ');
|
||||
if (!pos_port)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1167,6 +1216,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_addr = strrchr (pos_file, ' ');
|
||||
if (!pos_addr)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1190,6 +1240,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
@@ -1261,6 +1312,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1284,6 +1336,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "quit");
|
||||
@@ -1406,7 +1459,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
|
||||
pos2[0] = '\0';
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s%s",
|
||||
"%s%s\n",
|
||||
(first) ? "" : " ", pos);
|
||||
first = 0;
|
||||
pos = pos2 + 1;
|
||||
@@ -1436,6 +1489,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
|
||||
|
||||
if (!string_is_channel (arguments))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without channel\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
@@ -1522,6 +1576,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
|
||||
|
||||
/* connection to IRC server is ok! */
|
||||
server->is_connected = 1;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
gui_draw_buffer_status (server->buffer, 1);
|
||||
gui_draw_buffer_input (server->buffer, 1);
|
||||
|
||||
@@ -1712,6 +1767,7 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", arguments);
|
||||
}
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1737,6 +1793,7 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", arguments);
|
||||
}
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1971,6 +2028,46 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_315: '315' command (end of /who)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_recv_315 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) host;
|
||||
|
||||
/* skip nickname if at beginning of server message */
|
||||
if (strncmp (server->nick, arguments, strlen (server->nick)) == 0)
|
||||
{
|
||||
arguments += strlen (server->nick) + 1;
|
||||
while (arguments[0] == ' ')
|
||||
arguments++;
|
||||
}
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (ptr_channel && (ptr_channel->checking_away > 0))
|
||||
{
|
||||
ptr_channel->checking_away--;
|
||||
return 0;
|
||||
}
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", arguments);
|
||||
gui_printf (server->buffer, " %s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->buffer, "%s\n", arguments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_317: '317' command (whois, idle)
|
||||
*/
|
||||
@@ -2358,7 +2455,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_channel)
|
||||
{
|
||||
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2396,6 +2493,7 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT, _("No topic set for "));
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
@@ -2449,6 +2547,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "332");
|
||||
@@ -2458,6 +2557,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify channel for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "332");
|
||||
@@ -2514,6 +2614,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2522,6 +2623,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify date/time for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2530,6 +2632,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify nickname for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2538,6 +2641,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify channel for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2592,6 +2696,8 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
|
||||
char *pos_attr, *pos_hopcount, *pos_realname;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) host;
|
||||
@@ -2653,6 +2759,16 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
|
||||
while (pos_realname[0] == ' ')
|
||||
pos_realname++;
|
||||
|
||||
ptr_channel = channel_search (server, pos_channel);
|
||||
if (ptr_channel && (ptr_channel->checking_away > 0))
|
||||
{
|
||||
ptr_nick = nick_search (ptr_channel, pos_nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (ptr_channel, ptr_nick,
|
||||
(pos_attr[0] == 'G') ? 1 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
irc_display_prefix (server->buffer,
|
||||
PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer,
|
||||
@@ -2735,6 +2851,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
|
||||
pos++;
|
||||
if (pos[0] != ':')
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "353");
|
||||
@@ -2766,15 +2883,19 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
|
||||
pos++;
|
||||
}
|
||||
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create nick \"%s\" for channel \"%s\"\n"),
|
||||
WEECHAT_ERROR, pos_nick, ptr_channel->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "353");
|
||||
@@ -2890,6 +3011,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
|
||||
gui_printf_color (ptr_channel->buffer,
|
||||
COLOR_WIN_CHAT_DARK, ")\n");
|
||||
irc_cmd_send_mode (server, ptr_channel->name);
|
||||
if (cfg_irc_away_check > 0)
|
||||
channel_check_away (server, ptr_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2918,6 +3041,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick1) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 2nd nickname \"%s\"\n"),
|
||||
@@ -2929,6 +3053,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick2) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 3rd nickname \"%s\"\n"),
|
||||
@@ -2940,6 +3065,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick3) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: all declared nicknames are already in use, "
|
||||
"closing connection with server!\n"),
|
||||
@@ -2949,6 +3075,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 1st nickname \"%s\"\n"),
|
||||
|
||||
+125
-45
@@ -56,6 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
@@ -87,7 +88,8 @@ irc_cmd_send_admin (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char *pos, *ptr_away_msg;
|
||||
char *ptr_away_default_msg = "away";
|
||||
t_irc_server *ptr_server;
|
||||
time_t elapsed;
|
||||
char buffer[4096];
|
||||
@@ -105,64 +107,83 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
ptr_server->is_away = 1;
|
||||
ptr_server->away_time = time (NULL);
|
||||
server_sendf (ptr_server, "AWAY :%s\r\n", pos);
|
||||
if (cfg_look_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", pos);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ptr_server->is_away && (!pos))
|
||||
{
|
||||
server_sendf (ptr_server, "AWAY\r\n");
|
||||
ptr_server->is_away = 0;
|
||||
elapsed = time (NULL) - ptr_server->away_time;
|
||||
if (cfg_look_display_away)
|
||||
if (server->away_time != 0)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
elapsed = time (NULL) - ptr_server->away_time;
|
||||
ptr_server->away_time = 0;
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
}
|
||||
server_set_away (ptr_server, ptr_server->nick, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server->is_away = 1;
|
||||
ptr_server->away_time = time (NULL);
|
||||
ptr_away_msg = (pos) ? pos :
|
||||
((cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) ?
|
||||
cfg_irc_default_msg_away : ptr_away_default_msg);
|
||||
server_sendf (ptr_server, "AWAY :%s\r\n", ptr_away_msg);
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", ptr_away_msg);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
server_set_away (ptr_server, ptr_server->nick, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arguments)
|
||||
{
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
server_sendf (server, "AWAY :%s\r\n", arguments);
|
||||
if (cfg_look_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", arguments);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (server->is_away && (!arguments))
|
||||
{
|
||||
server_sendf (server, "AWAY\r\n");
|
||||
server->is_away = 0;
|
||||
elapsed = time (NULL) - server->away_time;
|
||||
if (cfg_look_display_away)
|
||||
if (server->away_time != 0)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
elapsed = time (NULL) - server->away_time;
|
||||
server->away_time = 0;
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
}
|
||||
server_set_away (server, server->nick, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
ptr_away_msg = (arguments) ? arguments :
|
||||
((cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) ?
|
||||
cfg_irc_default_msg_away : ptr_away_default_msg);
|
||||
server_sendf (server, "AWAY :%s\r\n", ptr_away_msg);
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", ptr_away_msg);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
server_set_away (server, server->nick, 1);
|
||||
}
|
||||
}
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -232,6 +253,14 @@ int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("This command is not developed!\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -252,9 +281,12 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -276,6 +308,7 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
@@ -376,6 +409,7 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -447,12 +481,14 @@ int
|
||||
irc_send_me (t_irc_server *server, t_irc_channel *channel, char *arguments)
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
channel->name, arguments);
|
||||
channel->name,
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
irc_display_prefix (channel->buffer, PREFIX_ACTION_ME);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT_NICK, "%s", server->nick);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n", arguments);
|
||||
COLOR_WIN_CHAT, " %s\n",
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -483,6 +519,7 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
@@ -549,6 +586,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
@@ -565,9 +603,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
}
|
||||
else
|
||||
@@ -587,9 +628,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
@@ -614,6 +658,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color_type (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
@@ -636,6 +681,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
@@ -666,6 +712,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
@@ -687,6 +734,7 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
@@ -728,15 +776,17 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
|
||||
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
@@ -763,6 +813,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
@@ -810,6 +861,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -823,6 +875,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -844,7 +897,14 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (pos_args)
|
||||
server_sendf (server, "PART %s :%s\r\n", channel_name, pos_args);
|
||||
else
|
||||
server_sendf (server, "PART %s\r\n", channel_name);
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
server_sendf (server, "PART %s :%s\r\n",
|
||||
channel_name, cfg_irc_default_msg_part);
|
||||
else
|
||||
server_sendf (server, "PART %s\r\n", channel_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -899,6 +959,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
@@ -949,17 +1010,34 @@ int
|
||||
irc_cmd_send_quit (t_irc_server *server, char *arguments)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
char *ptr_arg, *pos, buffer[4096];
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
|
||||
ptr_arg = (arguments) ? arguments :
|
||||
(cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) ?
|
||||
cfg_irc_default_msg_quit : NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (arguments)
|
||||
server_sendf (ptr_server, "QUIT :%s\r\n", arguments);
|
||||
if (ptr_arg)
|
||||
{
|
||||
pos = strstr (ptr_arg, "%v");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
snprintf (buffer, sizeof (buffer), "%s%s%s",
|
||||
ptr_arg, PACKAGE_VERSION, pos + 2);
|
||||
pos[0] = '%';
|
||||
}
|
||||
else
|
||||
snprintf (buffer, sizeof (buffer), "%s",
|
||||
ptr_arg);
|
||||
server_sendf (ptr_server, "QUIT :%s\r\n", buffer);
|
||||
}
|
||||
else
|
||||
server_sendf (ptr_server, "QUIT\r\n");
|
||||
}
|
||||
@@ -1130,6 +1208,7 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
@@ -1235,6 +1314,7 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
|
||||
+136
-27
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -47,9 +48,7 @@ t_irc_server *last_irc_server = NULL;
|
||||
|
||||
t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
|
||||
/* buffer containing beginning of message if not ending with \r\n */
|
||||
char *unterminated_message = NULL;
|
||||
|
||||
int check_away = 0;
|
||||
|
||||
/*
|
||||
* server_init: init server struct with default values
|
||||
@@ -59,7 +58,7 @@ void
|
||||
server_init (t_irc_server *server)
|
||||
{
|
||||
server->name = NULL;
|
||||
server->autoconnect = 1;
|
||||
server->autoconnect = 0;
|
||||
server->autoreconnect = 1;
|
||||
server->autoreconnect_delay = 30;
|
||||
server->command_line = 0;
|
||||
@@ -74,14 +73,20 @@ server_init (t_irc_server *server)
|
||||
server->command = NULL;
|
||||
server->command_delay = 1;
|
||||
server->autojoin = NULL;
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->is_connected = 0;
|
||||
server->reconnect_start = 0;
|
||||
server->reconnect_join = 0;
|
||||
server->sock4 = -1;
|
||||
server->is_away = 0;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
server->buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
@@ -369,6 +374,7 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@@ -384,14 +390,22 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
buffer[size_buf - 2] = '\0';
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -406,27 +420,31 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
if (!message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
message->server = server;
|
||||
if (unterminated_message)
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
message->data = (char *) malloc (strlen (unterminated_message) +
|
||||
message->data = (char *) malloc (strlen (server->unterminated_message) +
|
||||
strlen (msg) + 1);
|
||||
if (!message->data)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (message->data, unterminated_message);
|
||||
strcpy (message->data, server->unterminated_message);
|
||||
strcat (message->data, msg);
|
||||
}
|
||||
free (unterminated_message);
|
||||
unterminated_message = NULL;
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
}
|
||||
else
|
||||
message->data = strdup (msg);
|
||||
@@ -449,7 +467,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
*/
|
||||
|
||||
void
|
||||
server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
@@ -476,17 +494,21 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
pos = strchr (buffer, '\0');
|
||||
if (pos)
|
||||
{
|
||||
unterminated_message =
|
||||
(char *) realloc (unterminated_message,
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
if (!unterminated_message)
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcpy (unterminated_message, buffer);
|
||||
strcpy (server->unterminated_message, buffer);
|
||||
return;
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -561,19 +583,25 @@ server_msgq_flush ()
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Command '%s' failed!\n"), command);
|
||||
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
|
||||
break;
|
||||
case -2:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("No command to execute!\n"));
|
||||
_("%s No command to execute!\n"), WEECHAT_ERROR);
|
||||
break;
|
||||
case -3:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Unknown command: cmd=%s, args=%s\n"),
|
||||
command, args);
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_ERROR, command, args);
|
||||
break;
|
||||
}
|
||||
|
||||
if (command)
|
||||
free (command);
|
||||
}
|
||||
|
||||
free (entire_line);
|
||||
@@ -607,6 +635,7 @@ server_recv (t_irc_server *server)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot read data from socket, disconnecting from server...\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -628,6 +657,7 @@ server_connect (t_irc_server *server)
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
@@ -638,6 +668,7 @@ server_connect (t_irc_server *server)
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
@@ -652,21 +683,28 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
@@ -683,13 +721,15 @@ server_connect (t_irc_server *server)
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
|
||||
_("%s can't bind to hostname\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
} */
|
||||
}*/
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
@@ -700,12 +740,14 @@ server_connect (t_irc_server *server)
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
@@ -725,6 +767,7 @@ server_connect (t_irc_server *server)
|
||||
void
|
||||
server_reconnect (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server...\n"),
|
||||
PACKAGE_NAME);
|
||||
server->reconnect_start = 0;
|
||||
@@ -737,6 +780,7 @@ server_reconnect (t_irc_server *server)
|
||||
else
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
@@ -783,8 +827,6 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
@@ -796,22 +838,33 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
close (server->server_write);
|
||||
server->server_write = -1;
|
||||
|
||||
|
||||
if (server->sock4 >= 0)
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
|
||||
server->is_connected = 0;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
|
||||
if ((reconnect) && (server->autoreconnect))
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -881,3 +934,59 @@ server_name_already_exists (char *name)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_away: remove away for all chans/nicks (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_remove_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_check_away: check for away on all channels (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_check_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_away: set/unset away status for a server (all channels)
|
||||
*/
|
||||
|
||||
void
|
||||
server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-3
@@ -22,6 +22,7 @@
|
||||
#define __WEECHAT_IRC_H 1
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
@@ -79,7 +80,8 @@ struct t_irc_nick
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int color; /* color for nickname */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
@@ -100,6 +102,7 @@ struct t_irc_channel
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
@@ -133,15 +136,19 @@ struct t_irc_server
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int sock4; /* socket for server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
struct timeval lag_check_time; /* last time lag was checked (ping sent)*/
|
||||
time_t lag_next_check; /* time for next check */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
@@ -206,6 +213,7 @@ struct t_dcc
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern int check_away;
|
||||
extern t_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
@@ -232,6 +240,9 @@ 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 *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -240,6 +251,9 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
@@ -251,6 +265,7 @@ extern void nick_free_all (t_irc_channel *);
|
||||
extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
@@ -269,6 +284,7 @@ extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
@@ -336,6 +352,7 @@ extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
|
||||
@@ -352,6 +369,7 @@ 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_315 (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 *);
|
||||
|
||||
@@ -313,8 +313,8 @@ static XS (XS_IRC_add_command_handler)
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (!index_command_search (name))
|
||||
index_command_new (name);
|
||||
if (!weelist_search (index_commands, name))
|
||||
weelist_add (&index_commands, &last_index_command, name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
|
||||
@@ -92,6 +92,7 @@ plugin_auto_load (int plugin_type, char *directory)
|
||||
plugin_load (plugin_type, entry->d_name);
|
||||
}
|
||||
}
|
||||
closedir (dir);
|
||||
}
|
||||
|
||||
/* restore working directory */
|
||||
@@ -138,6 +139,10 @@ plugin_load (int plugin_type, char *filename)
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
(void) filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -293,6 +298,7 @@ plugin_event_msg (char *irc_command, char *arguments, char *server)
|
||||
/* make gcc happy */
|
||||
(void) irc_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -324,6 +330,7 @@ plugin_exec_command (char *user_command, char *arguments, char *server)
|
||||
/* make gcc happy */
|
||||
(void) user_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
|
||||
/* no command executed */
|
||||
@@ -337,6 +344,9 @@ plugin_exec_command (char *user_command, char *arguments, char *server)
|
||||
void
|
||||
plugin_unload (int plugin_type, char *scriptname)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) scriptname;
|
||||
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
@@ -354,6 +364,9 @@ plugin_unload (int plugin_type, char *scriptname)
|
||||
/* TODO: unload Ruby scripts */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "January 2005" "FlashCode"
|
||||
.TH WEECHAT 1 "February 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.9
|
||||
%define version 0.1.0
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Feb 12 2005 FlashCode <flashcode@flashtux.org> 0.1.0-1
|
||||
- Released version 0.1.0
|
||||
* Sat Jan 01 2005 FlashCode <flashcode@flashtux.org> 0.0.9-1
|
||||
- Released version 0.0.9
|
||||
* Sat Oct 30 2004 FlashCode <flashcode@flashtux.org> 0.0.8-1
|
||||
|
||||
+15
-9
@@ -1,29 +1,35 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
Developers:
|
||||
----------
|
||||
|
||||
All developers are connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
Developer:
|
||||
---------
|
||||
|
||||
FlashCode <flashcode@flashtux.org>
|
||||
Web : http://www.flashtux.org
|
||||
IRC : nick is "FlashCode"
|
||||
Web : http://weechat.flashtux.org
|
||||
IRC : nick is "FlashCode" @ irc.freenode.net
|
||||
Jabber: flashcode@jabber.org
|
||||
ICQ : 160677660
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
Testers:
|
||||
-------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga"
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx"
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
|
||||
|
||||
=====
|
||||
|
||||
Whole team is connected to IRC:
|
||||
server: irc.freenode.net, channel: #weechat
|
||||
|
||||
|
||||
See README file for licence detail.
|
||||
|
||||
+2
-5
@@ -1,15 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2005-01-01
|
||||
WeeChat known bugs, 2005-02-12
|
||||
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- problem when resizing terminal and that some windows are outside new term size
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(IRC protocol is under dev!)
|
||||
- too much nicks in the channel (> height of window) => some nicks are hidden
|
||||
- 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
|
||||
|
||||
+29
-1
@@ -1,9 +1,37 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-01-01
|
||||
ChangeLog - 2005-02-12
|
||||
|
||||
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
* added away indicator in status bar
|
||||
* added lag indicator (and auto-disconnect after a delay if important lag)
|
||||
* improved completion: now completes commands arguments (IRC and internal),
|
||||
when only one completion matches, completion mechanism is stoped (to
|
||||
complete command arg for example)
|
||||
* improved /set command: empty strings are allowed, new colors, server
|
||||
options can be changed while WeeChat is running
|
||||
* added default away/part/quit messages in config file
|
||||
* new [irc] section in config file, option "look_display_away" moved to
|
||||
"irc_display_away"
|
||||
* server messages & errors are all prefixed (by 3 chars, like '-@-')
|
||||
* added new options for charset (UTF-8 support): look_charset_decode,
|
||||
look_charset_encode and look_charset_internal
|
||||
* fixed many memory leaks
|
||||
* fixed colors bug: removed "gray" color (replaced by "default"), colors are
|
||||
ok when terminal has white (or light) background
|
||||
* fixed crash when resizing terminal to small size
|
||||
* fixed crash when multiple servers and big messages received from server
|
||||
* fixed crash when closing some private buffers
|
||||
* fixed crash when unknown section with option(s) in config file
|
||||
* fixed /op, /deop, /voice, /devoice (now ok with many nicks)
|
||||
* fixed /me command (now ok without parameter)
|
||||
* fixed /away command (now ok if not away)
|
||||
* logs are now disabled by default (server/channel/private)
|
||||
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
|
||||
+26
-14
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2004-05-31
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -53,7 +53,7 @@ A: Because WeeChat is very light and has new features.
|
||||
* developed from scratch (not based on any other IRC client)
|
||||
* multi-platform
|
||||
* 100% GPL and free
|
||||
This is the "geekest Irc client" ;)
|
||||
This is the "geekest" IRC client ;)
|
||||
|
||||
|
||||
2.2
|
||||
@@ -65,13 +65,24 @@ A: For help you can type /help. For help about a command, type /help command.
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: Today you can't do that. This will be available in a future version.
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: How can I customize key bindings?
|
||||
|
||||
A: Today you can't do that. This is planed for a future version.
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Perl scripts?
|
||||
Are Perl scripts compatible with X-chat or/and Irssi ?
|
||||
|
||||
@@ -79,21 +90,22 @@ A: You can use /perl command to load scripts
|
||||
(default path is ~/.weechat/perl).
|
||||
Note that scripts in ~/.weechat/perl/autoload are automatically loaded
|
||||
when WeeChat is starting up.
|
||||
WeeChat perl scripts are compatible with X-Chat, not with Irssi, sorry ;)
|
||||
|
||||
|
||||
2.5
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
|
||||
A: Today Python interface is not developed, so can't load any Python script.
|
||||
WeeChat perl scripts are compatible with X-Chat, but not with Irssi,
|
||||
sorry ;)
|
||||
|
||||
|
||||
2.6
|
||||
================================================================================
|
||||
Q: How can I load Python scripts?
|
||||
|
||||
A: Today Python interface is not developed, so you can't load any Python script.
|
||||
|
||||
|
||||
2.7
|
||||
================================================================================
|
||||
Q: How can I load Ruby scripts?
|
||||
|
||||
A: Today Ruby interface is not developed, so can't load any Ruby script.
|
||||
A: Today Ruby interface is not developed, so you can't load any Ruby script.
|
||||
|
||||
|
||||
3.1
|
||||
@@ -154,4 +166,4 @@ A: There's many tasks to do (code, documentation, ...)
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: No.
|
||||
A: Beer is welcome :)
|
||||
|
||||
+18
-7
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2004-05-31
|
||||
WeeChat FAQ, 2005-02-06
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -57,7 +57,7 @@ R: Parce que WeeChat est tr
|
||||
* développé à partir de zéro (non basé sur un quelconque client IRC)
|
||||
* multi-platformes
|
||||
* 100% GPL et libre
|
||||
C'est le client le plus "geek" ;)
|
||||
C'est le client IRC le plus "geek" ;)
|
||||
|
||||
|
||||
2.2
|
||||
@@ -70,13 +70,24 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
|
||||
2.3
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
|
||||
|
||||
2.4
|
||||
================================================================================
|
||||
Q: Comment puis-je configurer les raccourcis clavier ?
|
||||
|
||||
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
|
||||
version future.
|
||||
|
||||
|
||||
2.4
|
||||
2.5
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Perl ?
|
||||
Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ?
|
||||
@@ -85,11 +96,11 @@ R: La commande /perl permet de charger les scripts Perl
|
||||
(le chemin par défaut est ~/.weechat/perl).
|
||||
Notez que les scripts dans ~/.weechat/perl/autoload sont automatiquement
|
||||
chargés par WeeChat lorsqu'il démarre.
|
||||
Les scripts Perl WeeChat sont compatibles avec X-Chat, pas Irssi,
|
||||
Les scripts Perl WeeChat sont compatibles avec X-Chat, mais pas Irssi,
|
||||
désolé ;)
|
||||
|
||||
|
||||
2.5
|
||||
2.6
|
||||
================================================================================
|
||||
Q: Comment puis-je charger les scripts Python ?
|
||||
|
||||
@@ -97,7 +108,7 @@ R: Aujourd'hui l'interface Python n'est pas d
|
||||
Vous ne pouvez donc charger aucun script Python.
|
||||
|
||||
|
||||
2.6
|
||||
2.7
|
||||
================================================================================
|
||||
Q: Comment puis-je charger des scripts Ruby ?
|
||||
|
||||
@@ -169,4 +180,4 @@ R: Il y a plusieurs choses
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: Non.
|
||||
R: La bière est la bienvenue :)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ WeeChat - Installation instructions
|
||||
--disable-curses : do not build Curses interface
|
||||
--enable-gtk : build Gtk+ interface (under development!)
|
||||
--enable-qt : build Qt interface (not developed!)
|
||||
--with-debug : 1 for debug compilation, 2 for debug messages
|
||||
--with-debug=X : X=1 for debug compilation, 2 for debug messages
|
||||
|
||||
2) Run 'make'
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
* FlashCode, 2005-01-01
|
||||
|
||||
WeeChat 0.0.9 released.
|
||||
|
||||
+1
-4
@@ -22,10 +22,7 @@ Features
|
||||
Copyright
|
||||
---------
|
||||
|
||||
WeeChat (c) Copyright 2004
|
||||
by: FlashCode <flashcode@flashtux.org>
|
||||
Xahlexx <xahlex@weeland.org>
|
||||
Bounga <bounga@altern.org>
|
||||
WeeChat (c) Copyright 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
(see AUTHORS file if you want to contact authors)
|
||||
|
||||
WeeChat is distributed under GPL licence (see COPYING file for complete license):
|
||||
|
||||
+11
-16
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-01-01
|
||||
TODO - 2005-02-12
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,32 +10,29 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.9:
|
||||
v0.1.1:
|
||||
------
|
||||
|
||||
* General:
|
||||
- Windows version
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
- customizable CTCP version reply
|
||||
|
||||
* Interface:
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
(horizontally/vertically)
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
- add key bindings to config file
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
|
||||
|
||||
Future versions:
|
||||
---------------
|
||||
|
||||
* General:
|
||||
- *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
@@ -59,17 +56,12 @@ Future versions:
|
||||
- "/last": command to look for text in previous messages
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- add lag indicator
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- tab key with empty command line should switch to next window (like F7)
|
||||
? Qt GUI
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
- proxy support
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
@@ -79,3 +71,6 @@ Future versions:
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
* Configuration:
|
||||
- add key bindings to config file
|
||||
|
||||
+21
-21
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.9, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.0, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.9])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.0])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -34,7 +34,7 @@ ALL_LINGUAS="fr"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0)
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
@@ -55,11 +55,11 @@ AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
enable_plugins="no"
|
||||
enable_python="no"
|
||||
@@ -67,19 +67,19 @@ PYTHON_CFLAGS=
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
|
||||
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
if test "$LIBCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([ncurses library not found! Install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
CURSES_LIBS="-lcurses"
|
||||
AC_SUBST(CURSES_LIBS)
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
@@ -139,8 +139,8 @@ echo
|
||||
echo $PACKAGE $VERSION
|
||||
|
||||
listgui=
|
||||
if test "x$enable_curses" = "xyes" ; then
|
||||
listgui="$listgui Curses"
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
listgui="$listgui ncurses"
|
||||
fi
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
listgui="$listgui Gtk+"
|
||||
@@ -150,16 +150,16 @@ if test "x$enable_qt" = "xyes" ; then
|
||||
fi
|
||||
|
||||
if test "x$listgui" = "x" ; then
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
|
||||
AC_MSG_ERROR([No interface specified... Please specify at least ncurses, Gtk or Qt.])
|
||||
fi
|
||||
|
||||
msg_debug_compiler="No"
|
||||
msg_debug_verbose="No"
|
||||
msg_debug_compiler="no"
|
||||
msg_debug_verbose="no"
|
||||
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
|
||||
msg_debug_compiler="Yes"
|
||||
msg_debug_compiler="yes"
|
||||
fi
|
||||
if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="Yes"
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 12 Feb 2005 12:00:00 +0200
|
||||
|
||||
weechat (0.0.9-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.9, see ChangeLog for detail.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Source: weechat
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: FlashCode <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5 (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.5.8
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), perl (>= 5.6.0-16), libperl-dev
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: weechat
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Version}), weechat-gtk (= ${Source-Version})
|
||||
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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 01 Jan 2005 13:00:00 +0200.
|
||||
Sat, 12 Jan 2005 12:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
+17
-15
@@ -14,7 +14,8 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@ clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
-$(MAKE) clean
|
||||
-$(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
@@ -40,32 +41,33 @@ install: build
|
||||
$(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
|
||||
# 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
|
||||
dh_testdir -pweechat-common
|
||||
dh_testroot -pweechat-common
|
||||
dh_testdir -pweechat-common -pweechat
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installexamples -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
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
dh_fixperms -pweechat-common -pweechat
|
||||
dh_installdeb -pweechat-common -pweechat
|
||||
dh_shlibdeps -pweechat-common -pweechat
|
||||
dh_gencontrol -pweechat-common -pweechat
|
||||
dh_md5sums -pweechat-common -pweechat
|
||||
dh_builddeb -pweechat-common -pweechat
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir -a
|
||||
dh_testroot -a
|
||||
dh_installchangelogs -a
|
||||
dh_installdocs -a
|
||||
# dh_installchangelogs -a
|
||||
# dh_installdocs -a
|
||||
dh_installman weechat-curses.1 -pweechat-curses
|
||||
dh_link -a
|
||||
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
|
||||
dh_strip -a
|
||||
dh_compress -a
|
||||
dh_fixperms -a
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.0.9 - January, 01 2005
|
||||
@subtitle Documentation for WeeChat v0.1.0 - February, 12 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -259,6 +259,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
WeeChat slogan (if empty, slogan is not used)@*
|
||||
Type: string (any string), default value: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_charset_encode
|
||||
Charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -292,30 +298,27 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_nick_completor
|
||||
The string inserted after nick completion@*
|
||||
Type: string (any string), default value: ':'@*
|
||||
@item look_display_away
|
||||
Display message to all channels when (un)marking as away@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_infobar
|
||||
Enable info bar@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Timestamp for time in infobar@*
|
||||
Type: string (any string), default value: '%B, %A %d %G - %H:%M'@*
|
||||
Type: string (any string), default value: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
Delay (in seconds) for highlight messages in infobar (0 = disable highlight notifications in infobar)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 7@*
|
||||
@item col_title
|
||||
Color for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_title_bg
|
||||
Background for title bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'blue'@*
|
||||
@item col_chat
|
||||
Color for chat text@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time
|
||||
Color for time in chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Color for time separator (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'brown'@*
|
||||
@@ -345,7 +348,7 @@ Background for chat window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status
|
||||
Color for status bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Color for status bar delimiters@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@@ -357,7 +360,7 @@ Color for window with highlight (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Color for window with new data (not messages) (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status_more
|
||||
Color for window with new data (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@@ -375,7 +378,7 @@ Background for info bar window@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_input
|
||||
Color for input text@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_input_channel
|
||||
Color for input text (channel name)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@@ -387,7 +390,10 @@ Background for input window@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick
|
||||
Color for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_away
|
||||
Color for away nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Color for operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@@ -405,7 +411,7 @@ Color for local nick@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_nick_private
|
||||
Color for other nick in private window@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_bg
|
||||
Background for nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@@ -438,13 +444,13 @@ Maximum number of user commands in history (0 = unlimited)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 100@*
|
||||
@item log_auto_server
|
||||
Automatically log server messages@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_channel
|
||||
Automatically log channel chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_private
|
||||
Automatically log private chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_path
|
||||
Path for WeeChat log files@*
|
||||
Type: string (any string), default value: '~/.weechat/logs/'@*
|
||||
@@ -454,6 +460,30 @@ Type: string (any string), default value: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Hide password displayed by nickserv@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_display_away
|
||||
Display message to all channels when (un)marking as away@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Default message when away@*
|
||||
Type: string (any string), default value: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Default part message (leaving channel)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Default quit message ('%v' will be replaced by WeeChat version in string)@*
|
||||
Type: string (any string), default value: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Interval between two checks for away (in minutes, 0 = never check)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_check
|
||||
Interval between two checks for lag (in seconds)@*
|
||||
Type: integer (values: between 30 and 2147483647), default value: 60@*
|
||||
@item irc_lag_min_show
|
||||
Minimum lag to show (in seconds)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
@item irc_lag_disconnect
|
||||
Disconnect after important lag (in minutes, 0 = never disconnect)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Automatically accept incoming dcc files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@@ -531,7 +561,7 @@ First command to run when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_command_delay
|
||||
Delay (in seconds) after command was executed (example: give some time for authentication)@*
|
||||
Type: integer (values: between 0 and 3600), default value: 1@*
|
||||
Type: integer (values: between 0 and 5), default value: 0@*
|
||||
@item server_autojoin
|
||||
Comma separated list of channels to join when connected to server@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@@ -571,8 +601,6 @@ Colors for Curses GUI are:@*
|
||||
@item
|
||||
@kbd{lightcyan}: light cyan
|
||||
@item
|
||||
@kbd{gray}: gray
|
||||
@item
|
||||
@kbd{white}: white
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.0.9 - 1er Janvier 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.0 - 12 F@'evrier 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -259,6 +259,12 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_weechat_slogan
|
||||
Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Jeu de caract@`eres pour d@'ecoder les messages du serveur, exemples: UTF-8, ISO-8859-1 (si non renseign@'e, les messages ne sont pas convertis)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_charset_encode
|
||||
Jeu de caract@`eres pour encoder les messages envoy@'es au serveur, exemples: UFT-8, ISO-8859-1 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -292,30 +298,27 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item look_nick_completor
|
||||
La cha@^ine affich@'ee apr@`es la compl@'etion des utilisateurs@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ':'@*
|
||||
@item look_display_away
|
||||
Affiche un message sur tous les canaux pour l'absence/le retour@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_infobar
|
||||
Active la barre d'infos@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_infobar_timestamp
|
||||
Horodatage pour les conversations sauvegard@'ees@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %G - %H:%M'@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %Y - %H:%M'@*
|
||||
@item look_infobar_delay_highlight
|
||||
D@'elai (en secondes) pour la notification des messages dans la barre d'infos (0 = d@'esactiver les notifications dans la barre d'infos)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 7@*
|
||||
@item col_title
|
||||
Couleur pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_title_bg
|
||||
Couleur de fond pour la barre de titre@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
|
||||
@item col_chat
|
||||
Couleur pour le texte de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time
|
||||
Couleur pour l'heure dans la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_chat_time_sep
|
||||
Couleur pour la s@'eparation de l'heure (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'brown'@*
|
||||
@@ -345,7 +348,7 @@ Couleur de fond pour la fen@^etre de discussion@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status
|
||||
Couleur pour la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_delimiters
|
||||
Couleur pour les d@'elimiteurs de la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@@ -357,7 +360,7 @@ Couleur pour une fen@^etre avec un highlight (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@item col_status_data_other
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status_more
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@@ -375,7 +378,7 @@ Couleur de fond pour la fen@^etre de barre d'infos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_input
|
||||
Couleur pour le texte saisi@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_input_channel
|
||||
Couleur pour le texte saisi (nom du canal)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@@ -387,7 +390,10 @@ Couleur de fond pour la fen@^etre de saisie@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick
|
||||
Couleur pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_away
|
||||
Couleur pour les pseudos absents@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_nick_op
|
||||
Couleur pour le symbole op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@@ -405,7 +411,7 @@ Couleur pour le pseudo local@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_nick_private
|
||||
Couleur pour l'autre pseudo dans la fen@^etre priv@'ee@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_bg
|
||||
Couleur de fond pour les pseudos@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@@ -438,13 +444,13 @@ Nombre maximum de commandes utilisateur dans l'historique (0 = sans limite)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 100@*
|
||||
@item log_auto_server
|
||||
Enregistrer automatiquement les messages du serveur@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_channel
|
||||
Enregistrer automatiquement les conversations des canaux@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_private
|
||||
Enregistrer automatiquement les conversations priv@'ees@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_path
|
||||
Chemin pour les conversations sauvegard@'ees par WeeChat@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
|
||||
@@ -454,6 +460,30 @@ Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%Y %b %d %H:%M:%S'@*
|
||||
@item log_hide_nickserv_pwd
|
||||
Masquer le mot de passe affich@'e par nickserv@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_display_away
|
||||
Affiche un message sur tous les canaux pour l'absence/le retour@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item irc_default_msg_away
|
||||
Message par d@'efaut pour l'absence@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'away'@*
|
||||
@item irc_default_msg_part
|
||||
Message par d@'efaut pour le part (quitte un canal)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item irc_default_msg_quit
|
||||
Message de fin par d@'efaut ('%v' sera remplac@'e par la version de WeeChat dans la cha@^ine)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Intervalle entre deux v@'erifications des absences (en minutes, 0 = ne jemais v@'erifier)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_check
|
||||
Intervalle entre deux mesures de lag (en secondes)@*
|
||||
Type: entier (valeurs: entre 30 et 2147483647), valeur par d@'efaut: 60@*
|
||||
@item irc_lag_min_show
|
||||
Lag minimum @`a afficher (en secondes)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_disconnect
|
||||
D@'econnexion apr@`es un lag important (en minutes, 0 = ne jamais se d@'econnecter)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 5@*
|
||||
@item dcc_auto_accept_files
|
||||
Accepte automatiquement les fichiers dcc entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@@ -531,7 +561,7 @@ Commande @`a ex@'ecuter en premier lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_command_delay
|
||||
D@'elai (en secondes) apr@`es ex@'ecution de la commande (exemple: donner du temps pour l'authentification)@*
|
||||
Type: entier (valeurs: entre 0 et 3600), valeur par d@'efaut: 1@*
|
||||
Type: entier (valeurs: entre 0 et 5), valeur par d@'efaut: 0@*
|
||||
@item server_autojoin
|
||||
Liste des canaux (s@'epar@'es par des virgules) @`a rejoindre lorsque connect@'e au serveur@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@@ -571,8 +601,6 @@ Les couleurs pour l'interface Curses sont :@*
|
||||
@item
|
||||
@kbd{lightcyan}: cyan clair
|
||||
@item
|
||||
@kbd{gray}: gris
|
||||
@item
|
||||
@kbd{white}: blanc
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.9 - 1 de Janeiro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.0 - 12 de Fevereiro de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
|
||||
+679
-587
File diff suppressed because it is too large
Load Diff
+644
-562
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
command.h \
|
||||
completion.c \
|
||||
completion.h \
|
||||
weelist.c \
|
||||
weelist.h \
|
||||
weeconfig.c \
|
||||
weeconfig.h \
|
||||
history.c \
|
||||
|
||||
+542
-354
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@
|
||||
#ifndef __WEECHAT_COMMAND_H
|
||||
#define __WEECHAT_COMMAND_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
@@ -48,22 +49,16 @@ struct t_weechat_alias
|
||||
t_weechat_alias *next_alias;
|
||||
};
|
||||
|
||||
typedef struct t_index_command t_index_command;
|
||||
|
||||
struct t_index_command
|
||||
{
|
||||
char *command_name;
|
||||
t_index_command *prev_index;
|
||||
t_index_command *next_index;
|
||||
};
|
||||
extern t_weechat_command weechat_commands[];
|
||||
|
||||
extern t_weechat_alias *weechat_alias;
|
||||
extern t_index_command *index_commands;
|
||||
extern t_weelist *index_commands;
|
||||
extern t_weelist *last_index_command;
|
||||
|
||||
extern t_index_command *index_command_search (char *);
|
||||
extern t_index_command *index_command_new (char *);
|
||||
extern void index_command_build ();
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
@@ -77,6 +72,7 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
+622
-72
@@ -29,8 +29,10 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "command.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -40,8 +42,14 @@
|
||||
void
|
||||
completion_init (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->base_command = NULL;
|
||||
completion->base_command_arg = 0;
|
||||
completion->position = -1;
|
||||
completion->base_word = NULL;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -51,8 +59,499 @@ completion_init (t_completion *completion)
|
||||
void
|
||||
completion_free (t_completion *completion)
|
||||
{
|
||||
if (completion->base_command)
|
||||
free (completion->base_command);
|
||||
completion->base_command = NULL;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = NULL;
|
||||
|
||||
while (completion->completion_list)
|
||||
weelist_remove (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
completion->completion_list);
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_stop: stop completion (for example after 1 arg of command with 1 arg)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_stop (t_completion *completion)
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
completion->position = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_build_list: build data list according to command and argument #
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char option_name[256];
|
||||
t_weechat_alias *ptr_alias;
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (strcasecmp (completion->base_command, "save") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "alias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_list->data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "buffer") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"move");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "connect") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
weechat_commands[i].command_name);
|
||||
}
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "perl") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"load");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"autoload");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"unload");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "set") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s =",
|
||||
weechat_options[i][j].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s =",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "unalias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_alias->alias_name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "window") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"list");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splith");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"splitv");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"merge");
|
||||
return;
|
||||
}
|
||||
|
||||
if (completion->base_command_arg == 2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"down");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"up");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"left");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"right");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"all");
|
||||
return;
|
||||
}
|
||||
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* IRC commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (strcasecmp (completion->base_command, "who") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "away") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_away);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
&& (completion->base_command_arg == 2))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"action");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"version");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "dcc") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"chat");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
{
|
||||
/* arg1: nickname */
|
||||
if (completion->base_command_arg == 1)
|
||||
return;
|
||||
|
||||
/* arg > 2: not allowed */
|
||||
if (completion->base_command_arg > 2)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg2: channel */
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
{
|
||||
for (ptr_channel = SERVER(gui_current_window->buffer)->channels;
|
||||
ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_channel->name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kick") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kill") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "notice") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "part") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_part);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "query") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "quit") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
cfg_irc_default_msg_quit);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "topic") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
if (!channel || !((t_irc_channel *)channel)->topic
|
||||
|| !((t_irc_channel *)channel)->topic[0])
|
||||
completion_stop (completion);
|
||||
else
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->topic);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_find_context: find context for completion
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
command = (buffer[0] == '/') ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
while (i < pos)
|
||||
{
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
command_arg++;
|
||||
i++;
|
||||
while ((i < pos) && (buffer[i] == ' ')) i++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (command)
|
||||
{
|
||||
if (command_arg > 0)
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND_ARG;
|
||||
completion->base_command_arg = command_arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->context = COMPLETION_COMMAND;
|
||||
completion->base_command_arg = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel)
|
||||
completion->context = COMPLETION_NICK;
|
||||
else
|
||||
completion->context = COMPLETION_NULL;
|
||||
}
|
||||
|
||||
/* look for word to complete (base word) */
|
||||
completion->base_word_pos = 0;
|
||||
completion->position_replace = pos;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
i = pos;
|
||||
pos_start = i;
|
||||
if (buffer[i] == ' ')
|
||||
{
|
||||
if ((i > 0) && (buffer[i-1] != ' '))
|
||||
{
|
||||
i--;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
}
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (pos_start <= pos_end)
|
||||
{
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->base_word)
|
||||
completion->base_word = strdup ("");
|
||||
|
||||
/* find command (for command argument completion only) */
|
||||
if (completion->context == COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
pos_start = 0;
|
||||
while ((pos_start < size) && (buffer[pos_start] != '/'))
|
||||
pos_start++;
|
||||
if (buffer[pos_start] == '/')
|
||||
{
|
||||
pos_start++;
|
||||
pos_end = pos_start;
|
||||
while ((pos_end < size) && (buffer[pos_end] != ' '))
|
||||
pos_end++;
|
||||
if (buffer[pos_end] == ' ')
|
||||
pos_end--;
|
||||
|
||||
completion->base_command = (char *) malloc (pos_end - pos_start + 2);
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel
|
||||
&& (((t_irc_channel *)channel)->type == CHAT_PRIVATE))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
SERVER(gui_current_window->buffer)->nick);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -62,23 +561,37 @@ completion_free (t_completion *completion)
|
||||
void
|
||||
completion_command (t_completion *completion)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_index_command *ptr_index;
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word) - 1;
|
||||
word_found_seen = 0;
|
||||
for (ptr_index = index_commands; ptr_index; ptr_index = ptr_index->next_index)
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_index->command_name, completion->base_word + 1, length) == 0)
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_index->command_name;
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word + 1, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_index->command_name, completion->word_found) == 0))
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
@@ -88,6 +601,54 @@ completion_command (t_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command_arg: complete a command argument
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = completion->completion_list; ptr_weelist;
|
||||
ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_weelist->data;
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command_arg (completion, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nick: complete a nick
|
||||
*/
|
||||
@@ -95,11 +656,21 @@ completion_command (t_completion *completion)
|
||||
void
|
||||
completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
{
|
||||
int length, word_found_seen;
|
||||
t_irc_nick *ptr_nick;
|
||||
int length, word_found_seen, other_completion;
|
||||
t_irc_nick *ptr_nick, *ptr_nick2;
|
||||
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
length = strlen (completion->base_word);
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
@@ -107,8 +678,21 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
completion->word_found = ptr_nick->nick;
|
||||
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2;
|
||||
ptr_nick2 = ptr_nick2->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick2->nick,
|
||||
completion->base_word, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
completion->position = -1;
|
||||
else
|
||||
if (completion->position < 0)
|
||||
completion->position = 0;
|
||||
return;
|
||||
}
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
@@ -129,83 +713,49 @@ void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, pos_start, pos_end;
|
||||
char *old_word_found;
|
||||
|
||||
/* TODO: complete when no word is there with command according to context */
|
||||
if (size == 0)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if new complation => look for base word */
|
||||
/* if new completion => look for base word */
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
|
||||
if ((pos == size) || (buffer[pos-1] != ' '))
|
||||
pos--;
|
||||
if ((pos > 0) && (buffer[pos] == ' '))
|
||||
return;
|
||||
|
||||
i = pos;
|
||||
while ((i >= 0) && (buffer[i] != ' '))
|
||||
i--;
|
||||
pos_start = i + 1;
|
||||
i = pos;
|
||||
while ((i < size) && (buffer[i] != ' '))
|
||||
i++;
|
||||
pos_end = i - 1;
|
||||
|
||||
if (pos_start > pos_end)
|
||||
return;
|
||||
|
||||
completion->base_word_pos = pos_start;
|
||||
|
||||
if (completion->base_word)
|
||||
free (completion->base_word);
|
||||
completion->base_word = (char *) malloc (pos_end - pos_start + 2);
|
||||
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_word[i - pos_start] = buffer[i];
|
||||
completion->base_word[pos_end - pos_start + 1] = '\0';
|
||||
|
||||
if (completion->base_word[0] == '/')
|
||||
completion->position_replace = pos_start + 1;
|
||||
else
|
||||
completion->position_replace = pos_start;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
old_word_found = completion->word_found;
|
||||
if (completion->base_word[0] == '/')
|
||||
switch (completion->context)
|
||||
{
|
||||
completion_command (completion);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
case COMPLETION_NULL:
|
||||
/* should never be executed */
|
||||
return;
|
||||
case COMPLETION_NICK:
|
||||
if (channel)
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word) + 1;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
case COMPLETION_COMMAND:
|
||||
completion_command (completion);
|
||||
break;
|
||||
case COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list)
|
||||
completion_command_arg (completion, (t_irc_channel *)channel);
|
||||
else
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (channel)
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
{
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
else
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
}
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
completion->diff_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,16 +21,33 @@
|
||||
#ifndef __WEECHAT_COMPLETION_H
|
||||
#define __WEECHAT_COMPLETION_H 1
|
||||
|
||||
#include "weelist.h"
|
||||
|
||||
#define COMPLETION_NULL 0
|
||||
#define COMPLETION_NICK 1
|
||||
#define COMPLETION_COMMAND 2
|
||||
#define COMPLETION_COMMAND_ARG 3
|
||||
|
||||
typedef struct t_completion t_completion;
|
||||
|
||||
struct t_completion
|
||||
{
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where we shoud complete */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word should be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
/* completion context */
|
||||
int context; /* context: null, nick, command, cmd arg */
|
||||
char *base_command; /* command with arg to complete (can be NULL) */
|
||||
int base_command_arg; /* # arg to complete (if context is cmd arg) */
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where Tab was pressed */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
t_weelist *last_completion; /* last data element for completion */
|
||||
|
||||
/* completion found */
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word has to be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
|
||||
@@ -136,3 +136,50 @@ history_add (void *buffer, char *string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* history_general_free: free general history
|
||||
*/
|
||||
|
||||
void
|
||||
history_general_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_general)
|
||||
{
|
||||
ptr_history = history_general->next_history;
|
||||
if (history_general->text)
|
||||
free (history_general->text);
|
||||
free (history_general);
|
||||
history_general = ptr_history;
|
||||
}
|
||||
history_general = NULL;
|
||||
history_general_last = NULL;
|
||||
history_general_ptr = NULL;
|
||||
num_history_general = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* history_buffer_free: free history for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
history_buffer_free (void *buffer)
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (((t_gui_buffer *)(buffer))->history)
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)(buffer))->history->next_history;
|
||||
if (((t_gui_buffer *)(buffer))->history->text)
|
||||
free (((t_gui_buffer *)(buffer))->history->text);
|
||||
free (((t_gui_buffer *)(buffer))->history);
|
||||
((t_gui_buffer *)(buffer))->history = ptr_history;
|
||||
}
|
||||
((t_gui_buffer *)(buffer))->history = NULL;
|
||||
((t_gui_buffer *)(buffer))->last_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->ptr_history = NULL;
|
||||
((t_gui_buffer *)(buffer))->num_history = 0;
|
||||
}
|
||||
|
||||
@@ -31,5 +31,7 @@ struct t_history
|
||||
};
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_general_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
#endif /* history.h */
|
||||
|
||||
+100
-15
@@ -49,6 +49,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@@ -58,9 +60,11 @@
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
@@ -76,6 +80,68 @@ my_sigint ()
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@@ -198,26 +264,26 @@ wee_parse_args (int argc, char *argv[])
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-h") == 0)
|
||||
|| (strcmp (argv[i], "--help") == 0))
|
||||
{
|
||||
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
|
||||
printf ("%s", WEE_USAGE2);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
exit (EXIT_SUCCESS);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
@@ -292,7 +358,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to get HOME directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
dir_length = strlen (ptr_home) + 10;
|
||||
weechat_home =
|
||||
@@ -301,7 +367,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s not enough memory for home directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
|
||||
DIR_SEPARATOR);
|
||||
@@ -311,7 +377,7 @@ wee_create_home_dirs ()
|
||||
{
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
|
||||
WEECHAT_ERROR);
|
||||
exit (EXIT_FAILURE);
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
@@ -364,6 +430,7 @@ wee_create_home_dirs ()
|
||||
fprintf (stderr, _("%s unable to create ~/.weechat/logs directory\n"),
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
chmod (dir_name, 0700);
|
||||
|
||||
free (dir_name);
|
||||
}
|
||||
@@ -442,18 +509,32 @@ weechat_welcome_message ()
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
* wee_gui_shutdown: shutdown WeeChat GUI
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown ()
|
||||
wee_gui_shutdown ()
|
||||
{
|
||||
dcc_end ();
|
||||
server_free_all ();
|
||||
gui_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_shutdown: shutdown WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
fclose (weechat_log_file);
|
||||
exit (EXIT_SUCCESS);
|
||||
if (local_charset)
|
||||
free (local_charset);
|
||||
alias_free_all ();
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -469,13 +550,15 @@ main (int argc, char *argv[])
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
wee_create_home_dirs (); /* create WeeChat directories */
|
||||
wee_init_log (); /* init log file */
|
||||
index_command_build (); /* build commands index for completion */
|
||||
command_index_build (); /* build commands index for completion */
|
||||
|
||||
switch (config_read ()) /* read configuration */
|
||||
{
|
||||
@@ -503,7 +586,9 @@ main (int argc, char *argv[])
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
wee_shutdown (); /* quit WeeChat (oh no, why?) */
|
||||
command_index_free (); /* free commands index */
|
||||
wee_gui_shutdown (); /* shut down WeeChat GUI */
|
||||
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make gcc happy (never executed) */
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(ENABLE_NLS) && !defined(_)
|
||||
#include <locale.h>
|
||||
@@ -43,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define WEECHAT_COPYRIGHT PACKAGE_NAME " (c) 2003-2005 by Wee Team"
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
@@ -57,10 +58,7 @@
|
||||
|
||||
#define WEE_LICENSE \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org>\n" \
|
||||
" Bounga <bounga@altern.org>\n" \
|
||||
" Xahlexx <xahlexx@weeland.org>\n" \
|
||||
"Website: " WEECHAT_WEBSITE "\n\n" \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"This program is free software; you can redistribute it and/or modify\n" \
|
||||
"it under the terms of the GNU General Public License as published by\n" \
|
||||
"the Free Software Foundation; either version 2 of the License, or\n" \
|
||||
@@ -78,7 +76,7 @@
|
||||
|
||||
#define WEE_USAGE1 \
|
||||
PACKAGE_STRING " (c) Copyright 2003-2005, compiled on " __DATE__ " " __TIME__ \
|
||||
"\nDeveloped by FlashCode, Bounga and Xahlexx - " WEECHAT_WEBSITE "\n\n" \
|
||||
"\nDeveloped by FlashCode <flashcode@flashtux.org> - " WEECHAT_WEBSITE "\n\n" \
|
||||
"Usage: %s [options ...]\n" \
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
@@ -102,8 +100,11 @@
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
+314
-111
@@ -33,6 +33,7 @@
|
||||
#include <time.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@@ -48,6 +49,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
|
||||
{ CONFIG_SECTION_COLORS, "colors" },
|
||||
{ CONFIG_SECTION_HISTORY, "history" },
|
||||
{ CONFIG_SECTION_LOG, "log" },
|
||||
{ CONFIG_SECTION_IRC, "irc" },
|
||||
{ CONFIG_SECTION_DCC, "dcc" },
|
||||
{ CONFIG_SECTION_PROXY, "proxy" },
|
||||
{ CONFIG_SECTION_ALIAS, "alias" },
|
||||
@@ -60,6 +62,9 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode;
|
||||
char *cfg_look_charset_encode;
|
||||
char *cfg_look_charset_internal;
|
||||
int cfg_look_color_nicks;
|
||||
int cfg_look_color_actions;
|
||||
int cfg_look_remove_colors_from_msgs;
|
||||
@@ -73,7 +78,6 @@ int cfg_look_nickmode;
|
||||
int cfg_look_nickmode_empty;
|
||||
char *cfg_look_no_nickname;
|
||||
char *cfg_look_completor;
|
||||
int cfg_look_display_away;
|
||||
int cfg_look_infobar;
|
||||
char *cfg_look_infobar_timestamp;
|
||||
int cfg_look_infobar_delay_highlight;
|
||||
@@ -95,6 +99,18 @@ t_config_option weechat_options_look[] =
|
||||
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, config_change_noop },
|
||||
{ "look_charset_decode", N_("charset for decoding messages from server"),
|
||||
N_("charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode, config_change_buffer_content },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content },
|
||||
{ "look_charset_internal", N_("internal WeeChat charset (should be ISO)"),
|
||||
N_("internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_internal, config_change_buffer_content },
|
||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||
N_("display nick names with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -141,10 +157,6 @@ t_config_option weechat_options_look[] =
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
":", NULL, NULL, &cfg_look_completor, config_change_noop },
|
||||
{ "look_display_away", N_("display message to all channels when away"),
|
||||
N_("display message to all channels when (un)marking as away"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_display_away, NULL, config_change_noop },
|
||||
{ "look_infobar", N_("enable info bar"),
|
||||
N_("enable info bar"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -191,6 +203,7 @@ int cfg_col_input_channel;
|
||||
int cfg_col_input_nick;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
int cfg_col_nick_op;
|
||||
int cfg_col_nick_halfop;
|
||||
int cfg_col_nick_voice;
|
||||
@@ -211,7 +224,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_title", N_("color for title bar"),
|
||||
N_("color for title bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_title, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_title, NULL, &config_change_color },
|
||||
{ "col_title_bg", N_("background for title bar"),
|
||||
N_("background for title bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -221,11 +234,11 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_chat", N_("color for chat text"),
|
||||
N_("color for chat text"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_chat, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_chat, NULL, &config_change_color },
|
||||
{ "col_chat_time", N_("color for time"),
|
||||
N_("color for time in chat window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_chat_time, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_chat_time, NULL, &config_change_color },
|
||||
{ "col_chat_time_sep", N_("color for time separator"),
|
||||
N_("color for time separator (chat window)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -267,7 +280,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_status", N_("color for status bar"),
|
||||
N_("color for status bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
{ "col_status_delimiters", N_("color for status bar delimiters"),
|
||||
N_("color for status bar delimiters"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -283,7 +296,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_status_data_other", N_("color for window with new data (not messages)"),
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -311,7 +324,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_input", N_("color for input text"),
|
||||
N_("color for input text"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_input, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_input, NULL, &config_change_color },
|
||||
{ "col_input_channel", N_("color for input text (channel name)"),
|
||||
N_("color for input text (channel name)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -329,7 +342,11 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_nick", N_("color for nicknames"),
|
||||
N_("color for nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_nick, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_nick, NULL, &config_change_color },
|
||||
{ "col_nick_away", N_("color for away nicknames"),
|
||||
N_("color for away nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_nick_away, NULL, &config_change_color },
|
||||
{ "col_nick_op", N_("color for operator symbol"),
|
||||
N_("color for operator symbol"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -353,7 +370,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_nick_private", N_("color for other nick in private window"),
|
||||
N_("color for other nick in private window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_nick_private, NULL, &config_change_color },
|
||||
"default", NULL, &cfg_col_nick_private, NULL, &config_change_color },
|
||||
{ "col_nick_bg", N_("background for nicknames"),
|
||||
N_("background for nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -402,11 +419,11 @@ t_config_option weechat_options_history[] =
|
||||
N_("maximum number of lines in history "
|
||||
"for one server/channel/private window (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 4096,
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, NULL },
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, config_change_noop },
|
||||
{ "history_max_commands", N_("max user commands in history"),
|
||||
N_("maximum number of user commands in history (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 100,
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, NULL },
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -422,28 +439,75 @@ int cfg_log_hide_nickserv_pwd;
|
||||
t_config_option weechat_options_log[] =
|
||||
{ { "log_auto_server", N_("automatically log server messages"),
|
||||
N_("automatically log server messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_server, NULL, NULL },
|
||||
{ "log_auto_channel", N_("automatically log channel chats"),
|
||||
N_("automatically log channel chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_channel, NULL, NULL },
|
||||
{ "log_auto_private", N_("automatically log private chats"),
|
||||
N_("automatically log private chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
{ "log_path", N_("path for log files"),
|
||||
N_("path for WeeChat log files"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, NULL },
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, config_change_noop },
|
||||
{ "log_timestamp", N_("timestamp for log"),
|
||||
N_("timestamp for log (see man strftime for date/time specifiers)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, NULL },
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, config_change_noop },
|
||||
{ "log_hide_nickserv_pwd", N_("hide password displayed by nickserv"),
|
||||
N_("hide password displayed by nickserv"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* config, irc section */
|
||||
|
||||
int cfg_irc_display_away;
|
||||
char *cfg_irc_default_msg_away;
|
||||
char *cfg_irc_default_msg_part;
|
||||
char *cfg_irc_default_msg_quit;
|
||||
int cfg_irc_away_check;
|
||||
int cfg_irc_lag_check;
|
||||
int cfg_irc_lag_min_show;
|
||||
int cfg_irc_lag_disconnect;
|
||||
|
||||
t_config_option weechat_options_irc[] =
|
||||
{ { "irc_display_away", N_("display message to all channels when away"),
|
||||
N_("display message to all channels when (un)marking as away"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_irc_display_away, NULL, config_change_noop },
|
||||
{ "irc_default_msg_away", N_("default message when away"),
|
||||
N_("default message when away"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"away", NULL, NULL, &cfg_irc_default_msg_away, config_change_noop },
|
||||
{ "irc_default_msg_part", N_("default part message (leaving channel)"),
|
||||
N_("default part message (leaving channel)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_irc_default_msg_part, config_change_noop },
|
||||
{ "irc_default_msg_quit", N_("default quit message"),
|
||||
N_("default quit message ('%v' will be replaced by WeeChat version in string)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
|
||||
{ "irc_away_check", N_("interval between two checks for away"),
|
||||
N_("interval between two checks for away (in minutes, 0 = never check)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
NULL, NULL, &cfg_irc_away_check, NULL, config_change_away_check },
|
||||
{ "irc_lag_check", N_("interval between two checks for lag"),
|
||||
N_("interval between two checks for lag (in seconds)"),
|
||||
OPTION_TYPE_INT, 30, INT_MAX, 60,
|
||||
NULL, NULL, &cfg_irc_lag_check, NULL, config_change_noop },
|
||||
{ "irc_lag_min_show", N_("minimum lag to show"),
|
||||
N_("minimum lag to show (in seconds)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
NULL, NULL, &cfg_irc_lag_min_show, NULL, config_change_noop },
|
||||
{ "irc_lag_disconnect", N_("disconnect after important lag"),
|
||||
N_("disconnect after important lag (in minutes, 0 = never disconnect)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 5,
|
||||
NULL, NULL, &cfg_irc_lag_disconnect, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -505,19 +569,19 @@ t_config_option weechat_options_proxy[] =
|
||||
{ { "proxy_use", N_("use proxy"),
|
||||
N_("use a proxy server to connect to irc server"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_proxy_use, NULL, NULL },
|
||||
NULL, NULL, &cfg_proxy_use, NULL, config_change_noop },
|
||||
{ "proxy_address", N_("proxy address"),
|
||||
N_("proxy server address (IP or hostname)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_address, NULL },
|
||||
"", NULL, NULL, &cfg_proxy_address, config_change_noop },
|
||||
{ "proxy_port", N_("port for proxy"),
|
||||
N_("port for connecting to proxy server"),
|
||||
OPTION_TYPE_INT, 0, 65535, 1080,
|
||||
NULL, NULL, &cfg_proxy_port, NULL, NULL },
|
||||
NULL, NULL, &cfg_proxy_port, NULL, config_change_noop },
|
||||
{ "proxy_password", N_("proxy password"),
|
||||
N_("password for proxy server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_password, NULL },
|
||||
"", NULL, NULL, &cfg_proxy_password, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -580,7 +644,7 @@ t_config_option weechat_options_server[] =
|
||||
"", NULL, NULL, &(cfg_server.command), NULL },
|
||||
{ "server_command_delay", N_("delay (in seconds) after command was executed"),
|
||||
N_("delay (in seconds) after command was executed (example: give some time for authentication)"),
|
||||
OPTION_TYPE_INT, 0, 3600, 1,
|
||||
OPTION_TYPE_INT, 0, 5, 0,
|
||||
NULL, NULL, &(cfg_server.command_delay), NULL, 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"),
|
||||
@@ -597,8 +661,8 @@ 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,
|
||||
NULL, weechat_options_server
|
||||
weechat_options_log, weechat_options_irc, weechat_options_dcc,
|
||||
weechat_options_proxy, NULL, weechat_options_server
|
||||
};
|
||||
|
||||
|
||||
@@ -695,11 +759,26 @@ config_change_buffer_content ()
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_color()
|
||||
config_change_color ()
|
||||
{
|
||||
gui_init_colors ();
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_away_check: called when away check is changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_away_check ()
|
||||
{
|
||||
check_away = 0;
|
||||
if (cfg_irc_away_check == 0)
|
||||
{
|
||||
/* reset away flag for all nicks/chans/servers */
|
||||
server_remove_away ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_set_value: set new value for an option
|
||||
* return: 0 if success
|
||||
@@ -746,6 +825,117 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_get_server_option_ptr: get a pointer to a server config option
|
||||
*/
|
||||
|
||||
void *
|
||||
config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
{
|
||||
if (strcasecmp (option_name, "server_name") == 0)
|
||||
return (void *)(&server->name);
|
||||
if (strcasecmp (option_name, "server_autoconnect") == 0)
|
||||
return (void *)(&server->autoconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect") == 0)
|
||||
return (void *)(&server->autoreconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect_delay") == 0)
|
||||
return (void *)(&server->autoreconnect_delay);
|
||||
if (strcasecmp (option_name, "server_address") == 0)
|
||||
return (void *)(&server->address);
|
||||
if (strcasecmp (option_name, "server_port") == 0)
|
||||
return (void *)(&server->port);
|
||||
if (strcasecmp (option_name, "server_password") == 0)
|
||||
return (void *)(&server->password);
|
||||
if (strcasecmp (option_name, "server_nick1") == 0)
|
||||
return (void *)(&server->nick1);
|
||||
if (strcasecmp (option_name, "server_nick2") == 0)
|
||||
return (void *)(&server->nick2);
|
||||
if (strcasecmp (option_name, "server_nick3") == 0)
|
||||
return (void *)(&server->nick3);
|
||||
if (strcasecmp (option_name, "server_username") == 0)
|
||||
return (void *)(&server->username);
|
||||
if (strcasecmp (option_name, "server_realname") == 0)
|
||||
return (void *)(&server->realname);
|
||||
if (strcasecmp (option_name, "server_command") == 0)
|
||||
return (void *)(&server->command);
|
||||
if (strcasecmp (option_name, "server_command_delay") == 0)
|
||||
return (void *)(&server->command_delay);
|
||||
if (strcasecmp (option_name, "server_autojoin") == 0)
|
||||
return (void *)(&server->autojoin);
|
||||
if (strcasecmp (option_name, "server_autorejoin") == 0)
|
||||
return (void *)(&server->autorejoin);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_set_server_value: set new value for an option
|
||||
* return: 0 if success
|
||||
* -1 if option not found
|
||||
* -2 if bad value
|
||||
*/
|
||||
|
||||
int
|
||||
config_set_server_value (t_irc_server *server, char *option_name,
|
||||
char *value)
|
||||
{
|
||||
t_config_option *ptr_option;
|
||||
int i;
|
||||
void *ptr_data;
|
||||
int int_value;
|
||||
|
||||
ptr_data = config_get_server_option_ptr (server, option_name);
|
||||
if (!ptr_data)
|
||||
return -1;
|
||||
|
||||
ptr_option = NULL;
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
/* if option found, return pointer */
|
||||
if (strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0)
|
||||
{
|
||||
ptr_option = &weechat_options[CONFIG_SECTION_SERVER][i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ptr_option)
|
||||
return -1;
|
||||
|
||||
switch (ptr_option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (value, "on") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_TRUE;
|
||||
else if (strcasecmp (value, "off") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_FALSE;
|
||||
else
|
||||
return -2;
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
int_value = atoi (value);
|
||||
if ((int_value < ptr_option->min) || (int_value > ptr_option->max))
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (ptr_option->array_values, value);
|
||||
if (int_value < 0)
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
if (!gui_assign_color ((int *)ptr_data, value))
|
||||
return -2;
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
if (*((char **)ptr_data))
|
||||
free (*((char **)ptr_data));
|
||||
*((char **)ptr_data) = strdup (value);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_search: look for an option and return pointer to this option
|
||||
* if option is not found, NULL is returned
|
||||
@@ -872,7 +1062,7 @@ config_default_values ()
|
||||
if (int_value < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s unable to assign default int with string (\"%s\")\n"),
|
||||
weechat_options[i][j].default_string);
|
||||
WEECHAT_WARNING, weechat_options[i][j].default_string);
|
||||
else
|
||||
*weechat_options[i][j].ptr_int =
|
||||
int_value;
|
||||
@@ -883,7 +1073,7 @@ config_default_values ()
|
||||
weechat_options[i][j].default_string))
|
||||
gui_printf (NULL,
|
||||
_("%s unable to assign default color (\"%s\")\n"),
|
||||
weechat_options[i][j].default_string);
|
||||
WEECHAT_WARNING, weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
*weechat_options[i][j].ptr_string =
|
||||
@@ -985,96 +1175,105 @@ config_read ()
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
if (section == CONFIG_SECTION_NONE)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
_("%s %s, line %d: invalid section for option, line is ignored\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
|
||||
if (section == CONFIG_SECTION_ALIAS)
|
||||
{
|
||||
if (alias_new (line, pos))
|
||||
index_command_new (line);
|
||||
}
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
else
|
||||
{
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
|
||||
if (section == CONFIG_SECTION_ALIAS)
|
||||
{
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
option_number = i;
|
||||
break;
|
||||
}
|
||||
if (alias_new (line, pos))
|
||||
weelist_add (&index_commands, &last_index_command, line);
|
||||
}
|
||||
if (option_number < 0)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, ptr_line);
|
||||
else
|
||||
{
|
||||
if (config_option_set_value (&weechat_options[section][option_number], pos) < 0)
|
||||
option_number = -1;
|
||||
for (i = 0;
|
||||
weechat_options[section][i].option_name; i++)
|
||||
{
|
||||
switch (weechat_options[section]
|
||||
[option_number].option_type)
|
||||
if (strcmp
|
||||
(weechat_options[section][i].option_name,
|
||||
ptr_line) == 0)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for"
|
||||
"option '%s'\n"
|
||||
"Expected: boolean value: "
|
||||
"'off' or 'on'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: integer between %d "
|
||||
"and %d\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line,
|
||||
weechat_options[section][option_number].min,
|
||||
weechat_options[section][option_number].max);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid value for "
|
||||
"option '%s'\n"
|
||||
"Expected: one of these strings: "),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number, ptr_line);
|
||||
i = 0;
|
||||
while (weechat_options[section][option_number].array_values[i])
|
||||
{
|
||||
gui_printf (NULL, "\"%s\" ",
|
||||
weechat_options[section][option_number].array_values[i]);
|
||||
i++;
|
||||
}
|
||||
gui_printf (NULL, "\n");
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid color "
|
||||
"name for option '%s'\n"),
|
||||
WEECHAT_WARNING, filename,
|
||||
line_number,
|
||||
ptr_line);
|
||||
break;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1148,8 +1347,7 @@ config_create_default ()
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
|
||||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
|
||||
if (i == CONFIG_SECTION_PROXY)
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
@@ -1214,6 +1412,8 @@ config_create_default ()
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name=freenode\n");
|
||||
fprintf (file, "server_autoconnect=on\n");
|
||||
fprintf (file, "server_autoreconnect=on\n");
|
||||
fprintf (file, "server_autoreconnect_delay=30\n");
|
||||
fprintf (file, "server_address=irc.freenode.net\n");
|
||||
fprintf (file, "server_port=6667\n");
|
||||
fprintf (file, "server_password=\n");
|
||||
@@ -1258,10 +1458,12 @@ config_create_default ()
|
||||
}
|
||||
|
||||
fprintf (file, "server_command=\n");
|
||||
fprintf (file, "server_command_delay=0\n");
|
||||
fprintf (file, "server_autojoin=\n");
|
||||
fprintf (file, "server_autorejoin=on\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
@@ -1408,6 +1610,7 @@ config_write (char *config_name)
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef __WEECHAT_CONFIG_H
|
||||
#define __WEECHAT_CONFIG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#define WEECHAT_CONFIG_NAME "weechat.rc"
|
||||
|
||||
#define CONFIG_SECTION_NONE -1
|
||||
@@ -28,11 +30,12 @@
|
||||
#define CONFIG_SECTION_COLORS 1
|
||||
#define CONFIG_SECTION_HISTORY 2
|
||||
#define CONFIG_SECTION_LOG 3
|
||||
#define CONFIG_SECTION_DCC 4
|
||||
#define CONFIG_SECTION_PROXY 5
|
||||
#define CONFIG_SECTION_ALIAS 6
|
||||
#define CONFIG_SECTION_SERVER 7
|
||||
#define CONFIG_NUMBER_SECTIONS 8
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_ALIAS 7
|
||||
#define CONFIG_SECTION_SERVER 8
|
||||
#define CONFIG_NUMBER_SECTIONS 9
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -77,6 +80,9 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
@@ -88,7 +94,6 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern int cfg_look_display_away;
|
||||
extern int cfg_look_infobar;
|
||||
extern char *cfg_look_infobar_timestamp;
|
||||
extern int cfg_look_infobar_delay_highlight;
|
||||
@@ -121,6 +126,7 @@ extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
@@ -146,6 +152,15 @@ extern char *cfg_log_path;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
|
||||
extern int cfg_irc_display_away;
|
||||
extern char *cfg_irc_default_msg_away;
|
||||
extern char *cfg_irc_default_msg_part;
|
||||
extern char *cfg_irc_default_msg_quit;
|
||||
extern int cfg_irc_away_check;
|
||||
extern int cfg_irc_lag_check;
|
||||
extern int cfg_irc_lag_min_show;
|
||||
extern int cfg_irc_lag_disconnect;
|
||||
|
||||
extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
@@ -169,9 +184,12 @@ extern void config_change_title ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
extern void *config_get_server_option_ptr (t_irc_server *, char *);
|
||||
extern int config_set_server_value (t_irc_server *, char *, char *);
|
||||
extern int config_read ();
|
||||
extern int config_create_default ();
|
||||
extern int config_write ();
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* weelist.c: sorted lists management */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weelist.h"
|
||||
|
||||
|
||||
/*
|
||||
* weelist_search: search date in a list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_search (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) == 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* word not found in list */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_find_pos: find position for data (keeping list sorted)
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_find_pos (t_weelist *weelist, char *data)
|
||||
{
|
||||
t_weelist *ptr_weelist;
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) < 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* position not found, best position is at the end */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_insert: insert an element to the list (at good position)
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_insert (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *pos_weelist;
|
||||
|
||||
pos_weelist = weelist_find_pos (*weelist, element->data);
|
||||
|
||||
if (*weelist)
|
||||
{
|
||||
if (pos_weelist)
|
||||
{
|
||||
/* insert data into the list (before position found) */
|
||||
element->prev_weelist = pos_weelist->prev_weelist;
|
||||
element->next_weelist = pos_weelist;
|
||||
if (pos_weelist->prev_weelist)
|
||||
pos_weelist->prev_weelist->next_weelist = element;
|
||||
else
|
||||
*weelist = element;
|
||||
pos_weelist->prev_weelist = element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add data to the end */
|
||||
element->prev_weelist = *last_weelist;
|
||||
element->next_weelist = NULL;
|
||||
(*last_weelist)->next_weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
element->prev_weelist = NULL;
|
||||
element->next_weelist = NULL;
|
||||
*weelist = element;
|
||||
*last_weelist = element;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_add: create new data and add it to list
|
||||
*/
|
||||
|
||||
t_weelist *
|
||||
weelist_add (t_weelist **weelist, t_weelist **last_weelist, char *data)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
if (!data || (!data[0]))
|
||||
return NULL;
|
||||
|
||||
if ((new_weelist = ((t_weelist *) malloc (sizeof (t_weelist)))))
|
||||
{
|
||||
new_weelist->data = strdup (data);
|
||||
weelist_insert (weelist, last_weelist, new_weelist);
|
||||
return new_weelist;
|
||||
}
|
||||
/* failed to allocate new element */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weelist_remove: free an element in a list
|
||||
*/
|
||||
|
||||
void
|
||||
weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *element)
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
/* remove element from list */
|
||||
if (*last_weelist == element)
|
||||
*last_weelist = element->prev_weelist;
|
||||
if (element->prev_weelist)
|
||||
{
|
||||
(element->prev_weelist)->next_weelist = element->next_weelist;
|
||||
new_weelist = *weelist;
|
||||
}
|
||||
else
|
||||
new_weelist = element->next_weelist;
|
||||
|
||||
if (element->next_weelist)
|
||||
(element->next_weelist)->prev_weelist = element->prev_weelist;
|
||||
|
||||
/* free data */
|
||||
if (element->data)
|
||||
free (element->data);
|
||||
free (element);
|
||||
*weelist = new_weelist;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_LIST_H
|
||||
#define __WEECHAT_LIST_H 1
|
||||
|
||||
typedef struct t_weelist t_weelist;
|
||||
|
||||
struct t_weelist
|
||||
{
|
||||
char *data;
|
||||
t_weelist *prev_weelist;
|
||||
t_weelist *next_weelist;
|
||||
};
|
||||
|
||||
t_weelist *weelist_search (t_weelist *, char *);
|
||||
t_weelist *weelist_add (t_weelist **, t_weelist **, char *);
|
||||
void weelist_remove (t_weelist **, t_weelist **, t_weelist *);
|
||||
|
||||
#endif /* weelist.h */
|
||||
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
if GUI_CURSES
|
||||
if GUI_NCURSES
|
||||
curses_dir=curses
|
||||
endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ bin_PROGRAMS = weechat-curses
|
||||
|
||||
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(CURSES_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_curses_SOURCES = ../gui.h \
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <curses.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
@@ -41,27 +41,26 @@
|
||||
|
||||
|
||||
t_gui_color gui_colors[] =
|
||||
{ { "default", -1 | A_NORMAL },
|
||||
{ "black", COLOR_BLACK | A_NORMAL },
|
||||
{ "red", COLOR_RED | A_NORMAL },
|
||||
{ "lightred", COLOR_RED | A_BOLD },
|
||||
{ "green", COLOR_GREEN | A_NORMAL },
|
||||
{ "lightgreen", COLOR_GREEN | A_BOLD },
|
||||
{ "brown", COLOR_YELLOW | A_NORMAL },
|
||||
{ "yellow", COLOR_YELLOW | A_BOLD },
|
||||
{ "blue", COLOR_BLUE | A_NORMAL },
|
||||
{ "lightblue", COLOR_BLUE | A_BOLD },
|
||||
{ "magenta", COLOR_MAGENTA | A_NORMAL },
|
||||
{ { "default", -1 | A_NORMAL },
|
||||
{ "black", COLOR_BLACK | A_NORMAL },
|
||||
{ "red", COLOR_RED | A_NORMAL },
|
||||
{ "lightred", COLOR_RED | A_BOLD },
|
||||
{ "green", COLOR_GREEN | A_NORMAL },
|
||||
{ "lightgreen", COLOR_GREEN | A_BOLD },
|
||||
{ "brown", COLOR_YELLOW | A_NORMAL },
|
||||
{ "yellow", COLOR_YELLOW | A_BOLD },
|
||||
{ "blue", COLOR_BLUE | A_NORMAL },
|
||||
{ "lightblue", COLOR_BLUE | A_BOLD },
|
||||
{ "magenta", COLOR_MAGENTA | A_NORMAL },
|
||||
{ "lightmagenta", COLOR_MAGENTA | A_BOLD },
|
||||
{ "cyan", COLOR_CYAN | A_NORMAL },
|
||||
{ "lightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "gray", COLOR_WHITE },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ "cyan", COLOR_CYAN | A_NORMAL },
|
||||
{ "lightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "gray",
|
||||
{ "cyan", "magenta", "green", "brown", "lightblue", "default",
|
||||
"lightcyan", "lightmagenta", "lightgreen", "blue" };
|
||||
|
||||
int color_attr[NUM_COLORS];
|
||||
@@ -299,6 +298,29 @@ gui_curses_window_clear (WINDOW *window)
|
||||
wmove (window, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_window_separator: draw window separation
|
||||
*/
|
||||
|
||||
void
|
||||
gui_draw_window_separator (t_gui_window *window)
|
||||
{
|
||||
if (window->win_separator)
|
||||
delwin (window->win_separator);
|
||||
|
||||
if (window->win_x > 0)
|
||||
{
|
||||
window->win_separator = newwin (window->win_height,
|
||||
1,
|
||||
window->win_y,
|
||||
window->win_x - 1);
|
||||
gui_window_set_color (window->win_separator, COLOR_WIN_TITLE);
|
||||
wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||
wrefresh (window->win_separator);
|
||||
refresh ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_draw_buffer_title: draw title window for a buffer
|
||||
*/
|
||||
@@ -307,7 +329,7 @@ void
|
||||
gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format[32];
|
||||
char format[32], *buf;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@@ -326,12 +348,18 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
wrefresh (ptr_win->win_title);
|
||||
refresh ();
|
||||
}
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer))
|
||||
{
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer)->topic)
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format,
|
||||
CHANNEL(buffer)->topic);
|
||||
{
|
||||
buf = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -339,10 +367,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
/* TODO: change this copyright as title? */
|
||||
mvwprintw (ptr_win->win_title, 0, 0,
|
||||
"%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
|
||||
mvwprintw (ptr_win->win_title, 0,
|
||||
ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
|
||||
"%s", WEECHAT_COPYRIGHT);
|
||||
format,
|
||||
PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE " - "
|
||||
WEECHAT_WEBSITE);
|
||||
}
|
||||
}
|
||||
wrefresh (ptr_win->win_title);
|
||||
@@ -416,6 +443,8 @@ gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
|
||||
{
|
||||
num_displayed = window->win_chat_width -
|
||||
window->win_chat_cursor_x;
|
||||
if (num_displayed < 0)
|
||||
return;
|
||||
saved_char = ptr_message->message[offset + num_displayed];
|
||||
ptr_message->message[offset + num_displayed] = '\0';
|
||||
if (lines_displayed >= num_lines - count)
|
||||
@@ -748,7 +777,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
if (gui_buffer_has_nicklist (buffer))
|
||||
{
|
||||
max_length = nick_get_max_length (CHANNEL(buffer));
|
||||
if ((buffer == gui_current_window->buffer) &&
|
||||
if ((buffer->num_displayed > 0) &&
|
||||
((max_length + 2) != ptr_win->win_nick_width))
|
||||
{
|
||||
gui_calculate_pos_size (ptr_win);
|
||||
@@ -776,31 +805,28 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
|
||||
if (has_colors ())
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
switch (cfg_look_nicklist_position)
|
||||
{
|
||||
case CFG_LOOK_NICKLIST_LEFT:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
i, ptr_win->win_nick_width - 1, " ");
|
||||
mvwvline (ptr_win->win_nick,
|
||||
0, ptr_win->win_nick_width - 1, ACS_VLINE,
|
||||
ptr_win->win_chat_height);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_RIGHT:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
i, 0, " ");
|
||||
mvwvline (ptr_win->win_nick,
|
||||
0, 0, ACS_VLINE,
|
||||
ptr_win->win_chat_height);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_TOP:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
for (i = 0; i < ptr_win->win_chat_width; i += 2)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
ptr_win->win_nick_height - 1, i, "-");
|
||||
mvwhline (ptr_win->win_nick,
|
||||
ptr_win->win_nick_height - 1, 0, ACS_HLINE,
|
||||
ptr_win->win_chat_width);
|
||||
break;
|
||||
case CFG_LOOK_NICKLIST_BOTTOM:
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
for (i = 0; i < ptr_win->win_chat_width; i += 2)
|
||||
mvwprintw (ptr_win->win_nick,
|
||||
0, i, "-");
|
||||
mvwhline (ptr_win->win_nick,
|
||||
0, 0, ACS_HLINE,
|
||||
ptr_win->win_chat_width);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -855,7 +881,9 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick,
|
||||
(ptr_nick->is_away) ?
|
||||
COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK);
|
||||
mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
|
||||
y++;
|
||||
if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
|
||||
@@ -885,9 +913,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
char format_more[32];
|
||||
char format_more[32], *string;
|
||||
int i, first_mode;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) buffer;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
|
||||
@@ -923,6 +954,15 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name);
|
||||
if (SERVER(ptr_win->buffer)->is_away)
|
||||
{
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("(away)"));
|
||||
wprintw (ptr_win->win_status, string);
|
||||
free (string);
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "] ");
|
||||
@@ -1000,15 +1040,30 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
wprintw (ptr_win->win_status, "%d:<DCC> ",
|
||||
ptr_win->buffer->number);
|
||||
else
|
||||
wprintw (ptr_win->win_status, _("%d:[not connected] "),
|
||||
{
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("%d:[not connected] "));
|
||||
wprintw (ptr_win->win_status, string,
|
||||
ptr_win->buffer->number);
|
||||
free (string);
|
||||
}
|
||||
}
|
||||
|
||||
/* display list of other active windows (if any) with numbers */
|
||||
if (hotlist)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "[");
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, _("[Act: "));
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("Act: "));
|
||||
wprintw (ptr_win->win_status, string);
|
||||
free (string);
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist;
|
||||
ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
@@ -1039,21 +1094,48 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
wprintw (ptr_win->win_status, ",");
|
||||
}
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS);
|
||||
wprintw (ptr_win->win_status, "]");
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "] ");
|
||||
}
|
||||
|
||||
/* display lag */
|
||||
if (SERVER(ptr_win->buffer))
|
||||
{
|
||||
if (SERVER(ptr_win->buffer)->lag / 1000 >= cfg_irc_lag_min_show)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "[");
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("Lag: %.1f"));
|
||||
wprintw (ptr_win->win_status, string,
|
||||
((float)(SERVER(ptr_win->buffer)->lag)) / 1000);
|
||||
free (string);
|
||||
gui_window_set_color (ptr_win->win_status,
|
||||
COLOR_WIN_STATUS_DELIMITERS);
|
||||
wprintw (ptr_win->win_status, "]");
|
||||
}
|
||||
}
|
||||
|
||||
/* display "-MORE-" if last line is not displayed */
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE);
|
||||
string = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
_("-MORE-"));
|
||||
if (ptr_win->sub_lines > 0)
|
||||
mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
|
||||
_("-MORE-"));
|
||||
"%s", string);
|
||||
else
|
||||
{
|
||||
snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
|
||||
snprintf (format_more, 32, "%%-%ds", strlen (string));
|
||||
mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
|
||||
format_more, " ");
|
||||
}
|
||||
free (string);
|
||||
|
||||
wrefresh (ptr_win->win_status);
|
||||
refresh ();
|
||||
@@ -1552,49 +1634,6 @@ gui_move_page_down (t_gui_window *window)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_curses_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_curses_resize_handler ()
|
||||
{
|
||||
t_gui_window *ptr_win, *old_current_window;
|
||||
int old_width, old_height;
|
||||
int new_width, new_height;
|
||||
|
||||
getmaxyx (stdscr, old_height, old_width);
|
||||
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
old_current_window = gui_current_window;
|
||||
|
||||
/* TODO: manage when some windows are outside new term size */
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
ptr_win->dcc_first = NULL;
|
||||
ptr_win->dcc_selected = NULL;
|
||||
if (ptr_win->win_x + ptr_win->win_width == old_width)
|
||||
ptr_win->win_width = new_width - ptr_win->win_x;
|
||||
if (ptr_win->win_y + ptr_win->win_height == old_height)
|
||||
ptr_win->win_height = new_height - ptr_win->win_y;
|
||||
gui_switch_to_buffer (ptr_win, ptr_win->buffer);
|
||||
}
|
||||
|
||||
gui_current_window = old_current_window;
|
||||
if ((new_width > 5) && (new_height > 5))
|
||||
{
|
||||
gui_ok = 1;
|
||||
gui_calculate_pos_size (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
else
|
||||
gui_ok = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_init_subviews: init subviews for a WeeChat window
|
||||
*/
|
||||
@@ -1673,18 +1712,229 @@ gui_window_split_vertic (t_gui_window *window)
|
||||
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
|
||||
/* create & draw separator if window is not on the left */
|
||||
gui_current_window->win_separator = newwin (gui_current_window->win_height,
|
||||
1,
|
||||
gui_current_window->win_y,
|
||||
gui_current_window->win_x - 1);
|
||||
gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE);
|
||||
wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||
wrefresh (gui_current_window->win_separator);
|
||||
refresh ();
|
||||
/* create & draw separator */
|
||||
gui_draw_window_separator (gui_current_window);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_down: merge window, direction down
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_down (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_y == window->win_y + window->win_height)
|
||||
&& (ptr_win->win_x == window->win_x)
|
||||
&& (ptr_win->win_width == window->win_width))
|
||||
{
|
||||
window->win_height += ptr_win->win_height;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found below current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_up: merge window, direction up
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_up (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_y + ptr_win->win_height == window->win_y)
|
||||
&& (ptr_win->win_x == window->win_x)
|
||||
&& (ptr_win->win_width == window->win_width))
|
||||
{
|
||||
window->win_height += ptr_win->win_height;
|
||||
window->win_y -= ptr_win->win_height;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found above current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_left: merge window, direction left
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_left (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_x + ptr_win->win_width + 1 == window->win_x)
|
||||
&& (ptr_win->win_y == window->win_y)
|
||||
&& (ptr_win->win_height == window->win_height))
|
||||
{
|
||||
window->win_width += ptr_win->win_width + 1;
|
||||
window->win_x -= ptr_win->win_width + 1;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found on the left of current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_right: merge window, direction right
|
||||
*/
|
||||
|
||||
int
|
||||
gui_window_merge_right (t_gui_window *window)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win != window)
|
||||
{
|
||||
if ((ptr_win->win_x == window->win_x + window->win_width + 1)
|
||||
&& (ptr_win->win_y == window->win_y)
|
||||
&& (ptr_win->win_height == window->win_height))
|
||||
{
|
||||
window->win_width += ptr_win->win_width + 1;
|
||||
gui_window_free (ptr_win);
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* no window found on the right of current window */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge: merge a window, direction auto
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_merge_auto (t_gui_window *window)
|
||||
{
|
||||
if (gui_window_merge_down (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_up (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_left (window) == 0)
|
||||
return;
|
||||
if (gui_window_merge_right (window) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_merge_all: merge all windows
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_merge_all (t_gui_window *window)
|
||||
{
|
||||
while (gui_windows->next_window)
|
||||
{
|
||||
gui_window_free ((gui_windows == window) ? gui_windows->next_window : gui_windows);
|
||||
}
|
||||
window->win_x = 0;
|
||||
window->win_y = 0;
|
||||
window->win_width = COLS;
|
||||
window->win_height = LINES;
|
||||
gui_switch_to_buffer (window, window->buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_curses_resize_handler: called when term size is modified
|
||||
*/
|
||||
|
||||
void
|
||||
gui_curses_resize_handler ()
|
||||
{
|
||||
t_gui_window *ptr_win, *old_current_window;
|
||||
int old_width, old_height;
|
||||
int new_width, new_height;
|
||||
int merge_all_windows;
|
||||
|
||||
getmaxyx (stdscr, old_height, old_width);
|
||||
|
||||
endwin ();
|
||||
refresh ();
|
||||
|
||||
getmaxyx (stdscr, new_height, new_width);
|
||||
|
||||
old_current_window = gui_current_window;
|
||||
|
||||
gui_ok = ((new_width > 5) && (new_height > 5));
|
||||
|
||||
merge_all_windows = 0;
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
ptr_win->dcc_first = NULL;
|
||||
ptr_win->dcc_selected = NULL;
|
||||
|
||||
if (!merge_all_windows)
|
||||
{
|
||||
if ((ptr_win->win_x > new_width - 5)
|
||||
|| (ptr_win->win_y > new_height - 5))
|
||||
merge_all_windows = 1;
|
||||
else
|
||||
{
|
||||
if (ptr_win->win_x + ptr_win->win_width == old_width)
|
||||
ptr_win->win_width = new_width - ptr_win->win_x;
|
||||
if (ptr_win->win_y + ptr_win->win_height == old_height)
|
||||
ptr_win->win_height = new_height - ptr_win->win_y;
|
||||
if ((ptr_win->win_width < 5) || (ptr_win->win_height < 5))
|
||||
merge_all_windows = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (merge_all_windows)
|
||||
gui_window_merge_all (gui_current_window);
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
gui_switch_to_buffer (ptr_win, ptr_win->buffer);
|
||||
gui_redraw_buffer (ptr_win->buffer);
|
||||
gui_draw_window_separator (ptr_win);
|
||||
}
|
||||
|
||||
gui_current_window = old_current_window;
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_pre_init: pre-initialize GUI (called before gui_init)
|
||||
*/
|
||||
@@ -1757,6 +2007,8 @@ gui_init_colors ()
|
||||
cfg_col_input_nick & A_CHARTEXT, cfg_col_input_bg);
|
||||
init_pair (COLOR_WIN_NICK,
|
||||
cfg_col_nick & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_AWAY,
|
||||
cfg_col_nick_away & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_OP,
|
||||
cfg_col_nick_op & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_HALFOP,
|
||||
@@ -1764,7 +2016,7 @@ gui_init_colors ()
|
||||
init_pair (COLOR_WIN_NICK_VOICE,
|
||||
cfg_col_nick_voice & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_SEP,
|
||||
COLOR_BLACK & A_CHARTEXT, cfg_col_nick_sep);
|
||||
cfg_col_nick_sep & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_SELF,
|
||||
cfg_col_nick_self & A_CHARTEXT, cfg_col_nick_bg);
|
||||
init_pair (COLOR_WIN_NICK_PRIVATE,
|
||||
@@ -1774,8 +2026,7 @@ gui_init_colors ()
|
||||
{
|
||||
gui_assign_color (&color, nicks_colors[i]);
|
||||
init_pair (COLOR_WIN_NICK_FIRST + i, color & A_CHARTEXT, cfg_col_chat_bg);
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] =
|
||||
(color & A_BOLD) ? A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] = (color >= 0) ? color & A_BOLD : 0;
|
||||
}
|
||||
|
||||
init_pair (COLOR_DCC_SELECTED,
|
||||
@@ -1793,43 +2044,44 @@ gui_init_colors ()
|
||||
init_pair (COLOR_DCC_ABORTED,
|
||||
cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg);
|
||||
|
||||
color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_TIME - 1] = cfg_col_chat_time & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = cfg_col_chat_time_sep & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = cfg_col_chat_prefix1 & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = cfg_col_chat_prefix2 & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_NICK - 1] = cfg_col_chat_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_HOST - 1] = cfg_col_chat_host & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = cfg_col_chat_channel & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = cfg_col_chat_dark & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = cfg_col_chat_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS - 1] = cfg_col_status & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = cfg_col_status_delimiters & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = cfg_col_status_data_msg & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = cfg_col_status_data_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = cfg_col_status_data_other & A_BOLD;
|
||||
color_attr[COLOR_WIN_STATUS_MORE - 1] = cfg_col_status_more & A_BOLD;
|
||||
color_attr[COLOR_WIN_INFOBAR - 1] = cfg_col_infobar & A_BOLD;
|
||||
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = cfg_col_infobar_highlight & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT - 1] = cfg_col_input & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = cfg_col_input_channel & A_BOLD;
|
||||
color_attr[COLOR_WIN_INPUT_NICK - 1] = cfg_col_input_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK - 1] = cfg_col_nick & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_OP - 1] = cfg_col_nick_op & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_HALFOP - 1] = cfg_col_nick_halfop & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_VOICE - 1] = cfg_col_nick_voice & A_BOLD;
|
||||
color_attr[COLOR_WIN_TITLE - 1] = (cfg_col_title >= 0) ? cfg_col_title & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = (cfg_col_chat >= 0) ? cfg_col_chat & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_TIME - 1] = (cfg_col_chat_time >= 0) ? cfg_col_chat_time & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_TIME_SEP - 1] = (cfg_col_chat_time_sep >= 0) ? cfg_col_chat_time_sep & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_HOST - 1] = (cfg_col_chat_host >= 0) ? cfg_col_chat_host & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_CHANNEL - 1] = (cfg_col_chat_channel >= 0) ? cfg_col_chat_channel & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_CHAT_HIGHLIGHT - 1] = (cfg_col_chat_highlight >= 0) ? cfg_col_chat_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS - 1] = (cfg_col_status >= 0) ? cfg_col_status & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DELIMITERS - 1] = (cfg_col_status_delimiters >= 0) ? cfg_col_status_delimiters & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_MSG - 1] = (cfg_col_status_data_msg >= 0) ? cfg_col_status_data_msg & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_HIGHLIGHT - 1] = (cfg_col_status_data_highlight >= 0) ? cfg_col_status_data_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_DATA_OTHER - 1] = (cfg_col_status_data_other >= 0) ? cfg_col_status_data_other & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_STATUS_MORE - 1] = (cfg_col_status_more >= 0) ? cfg_col_status_more & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INFOBAR - 1] = (cfg_col_infobar >= 0) ? cfg_col_infobar & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INFOBAR_HIGHLIGHT - 1] = (cfg_col_infobar_highlight >= 0) ? cfg_col_infobar_highlight & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT - 1] = (cfg_col_input >= 0) ? cfg_col_input & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT_CHANNEL - 1] = (cfg_col_input_channel >= 0) ? cfg_col_input_channel & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_INPUT_NICK - 1] = (cfg_col_input_nick >= 0) ? cfg_col_input_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK - 1] = (cfg_col_nick >= 0) ? cfg_col_nick & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_AWAY - 1] = (cfg_col_nick_away >= 0) ? cfg_col_nick_away & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_OP - 1] = (cfg_col_nick_op >= 0) ? cfg_col_nick_op & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_HALFOP - 1] = (cfg_col_nick_halfop >= 0) ? cfg_col_nick_halfop & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_VOICE - 1] = (cfg_col_nick_voice >= 0) ? cfg_col_nick_voice & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_SEP - 1] = 0;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD;
|
||||
color_attr[COLOR_DCC_SELECTED - 1] = cfg_col_dcc_selected & A_BOLD;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD;
|
||||
color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = (cfg_col_nick_self >= 0) ? cfg_col_nick_self & A_BOLD : 0;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = (cfg_col_nick_private >= 0) ? cfg_col_nick_private & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_SELECTED - 1] = (cfg_col_dcc_selected >= 0) ? cfg_col_dcc_selected & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = (cfg_col_dcc_waiting >= 0) ? cfg_col_dcc_waiting & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = (cfg_col_dcc_connecting >= 0) ? cfg_col_dcc_connecting & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = (cfg_col_dcc_active >= 0) ? cfg_col_dcc_active & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_DONE - 1] = (cfg_col_dcc_done >= 0) ? cfg_col_dcc_done & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = (cfg_col_dcc_failed >= 0) ? cfg_col_dcc_failed & A_BOLD : 0;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = (cfg_col_dcc_aborted >= 0) ? cfg_col_dcc_aborted & A_BOLD : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1915,6 +2167,19 @@ gui_end ()
|
||||
gui_buffer_free (gui_buffers, 0);
|
||||
}
|
||||
|
||||
/* delete all windows */
|
||||
while (gui_windows)
|
||||
{
|
||||
gui_window_free (gui_windows);
|
||||
}
|
||||
|
||||
/* delete general history */
|
||||
history_general_free ();
|
||||
|
||||
/* delete infobar messages */
|
||||
while (gui_infobar)
|
||||
gui_infobar_remove ();
|
||||
|
||||
/* end of curses output */
|
||||
refresh ();
|
||||
endwin ();
|
||||
@@ -1993,7 +2258,7 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
{
|
||||
static char buf[8192];
|
||||
char timestamp[16];
|
||||
char *pos, *buf2;
|
||||
char *pos, *buf2, *buf3;
|
||||
int i, j;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@@ -2051,12 +2316,17 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
buf3 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buf2);
|
||||
|
||||
if (gui_init_ok)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buf2 - 1;
|
||||
pos = buf3 - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
@@ -2087,7 +2357,8 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
refresh ();*/
|
||||
}
|
||||
else
|
||||
printf ("%s", buf2);
|
||||
printf ("%s", buf3);
|
||||
|
||||
free (buf2);
|
||||
free (buf3);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <curses.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
@@ -52,7 +52,7 @@ gui_read_keyb ()
|
||||
int key, i;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
char new_char[2];
|
||||
char new_char[3], *decoded_string;
|
||||
t_dcc *dcc_selected;
|
||||
|
||||
key = getch ();
|
||||
@@ -89,6 +89,7 @@ gui_read_keyb ()
|
||||
/* remove last infobar message */
|
||||
case KEY_F(10):
|
||||
gui_infobar_remove ();
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
break;
|
||||
/* cursor up */
|
||||
case KEY_UP:
|
||||
@@ -311,16 +312,16 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->input_buffer_size,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
|
||||
if (gui_current_window->buffer->completion.word_found)
|
||||
{
|
||||
/* replace word with new completed word into input buffer */
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
|
||||
if (gui_current_window->buffer->completion.diff_size > 0)
|
||||
{
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
for (i = gui_current_window->buffer->input_buffer_size - 1;
|
||||
i >= gui_current_window->buffer->completion.position_replace +
|
||||
(int)strlen (gui_current_window->buffer->completion.word_found); i--)
|
||||
@@ -336,6 +337,10 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
}
|
||||
|
||||
strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
|
||||
@@ -344,35 +349,45 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* position is < 0 this means only one word was found to complete,
|
||||
so reinit to stop completion */
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* add space or completor to the end of completion, if needed */
|
||||
if (gui_current_window->buffer->completion.base_word[0] == '/')
|
||||
if ((gui_current_window->buffer->completion.context == COMPLETION_COMMAND)
|
||||
|| (gui_current_window->buffer->completion.context == COMPLETION_COMMAND_ARG))
|
||||
{
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
/* add nick completor if position 0 and completing nick */
|
||||
if ((gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
&& (gui_current_window->buffer->completion.context == COMPLETION_NICK))
|
||||
{
|
||||
if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
|
||||
cfg_look_completor, strlen (cfg_look_completor)) != 0)
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
cfg_look_completor,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
if (gui_current_window->buffer->completion.position >= 0)
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
@@ -531,9 +546,10 @@ gui_read_keyb ()
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -600,12 +616,28 @@ gui_read_keyb ()
|
||||
"[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
|
||||
new_char[0] = key;
|
||||
new_char[1] = '\0';
|
||||
decoded_string = NULL;
|
||||
|
||||
/* UTF-8 input */
|
||||
if (key == 0xC3)
|
||||
{
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
new_char[1] = key;
|
||||
new_char[2] = '\0';
|
||||
decoded_string = weechat_convert_encoding (local_charset, cfg_look_charset_internal, new_char);
|
||||
}
|
||||
}
|
||||
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
new_char,
|
||||
(decoded_string) ? decoded_string : new_char,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
|
||||
if (decoded_string)
|
||||
free (decoded_string);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -620,15 +652,17 @@ void
|
||||
gui_main_loop ()
|
||||
{
|
||||
fd_set read_fd;
|
||||
static struct timeval timeout;
|
||||
static struct timeval timeout, tv;
|
||||
static struct timezone tz;
|
||||
t_irc_server *ptr_server;
|
||||
int old_min, old_sec;
|
||||
int old_min, old_sec, diff;
|
||||
time_t new_time;
|
||||
struct tm *local_time;
|
||||
|
||||
quit_weechat = 0;
|
||||
old_min = -1;
|
||||
old_sec = -1;
|
||||
check_away = 0;
|
||||
while (!quit_weechat)
|
||||
{
|
||||
new_time = time (NULL);
|
||||
@@ -641,15 +675,31 @@ gui_main_loop ()
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* second has changed ? => count down time for infobar, if needed */
|
||||
/* second has changed ? */
|
||||
if (local_time->tm_sec != old_sec)
|
||||
{
|
||||
old_sec = local_time->tm_sec;
|
||||
|
||||
/* infobar count down */
|
||||
if (gui_infobar && gui_infobar->remaining_time > 0)
|
||||
{
|
||||
gui_infobar->remaining_time--;
|
||||
if (gui_infobar->remaining_time == 0)
|
||||
{
|
||||
gui_infobar_remove ();
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* away check */
|
||||
if (cfg_irc_away_check != 0)
|
||||
{
|
||||
check_away++;
|
||||
if (check_away >= (cfg_irc_away_check * 60))
|
||||
{
|
||||
check_away = 0;
|
||||
server_check_away ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,8 +716,38 @@ gui_main_loop ()
|
||||
&& (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay)))
|
||||
server_reconnect (ptr_server);
|
||||
else
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
/* check for lag */
|
||||
if ((ptr_server->lag_check_time.tv_sec == 0)
|
||||
&& (new_time >= ptr_server->lag_next_check))
|
||||
{
|
||||
server_sendf (ptr_server, "PING %s\r\n", ptr_server->address);
|
||||
gettimeofday (&(ptr_server->lag_check_time), &tz);
|
||||
}
|
||||
|
||||
/* lag timeout => disconnect */
|
||||
if ((ptr_server->lag_check_time.tv_sec != 0)
|
||||
&& (cfg_irc_lag_disconnect > 0))
|
||||
{
|
||||
gettimeofday (&tv, &tz);
|
||||
diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv);
|
||||
if (diff / 1000 > cfg_irc_lag_disconnect * 60)
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s lag is high, disconnecting from server...\n"),
|
||||
WEECHAT_WARNING);
|
||||
server_disconnect (ptr_server, 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_server->sock4 >= 0)
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
}
|
||||
}
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout))
|
||||
{
|
||||
|
||||
@@ -145,8 +145,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
SERVER(gui_buffers) = server;
|
||||
CHANNEL(gui_buffers) = channel;
|
||||
gui_buffers->server = server;
|
||||
gui_buffers->channel = channel;
|
||||
if (cfg_log_auto_server)
|
||||
log_start (gui_buffers);
|
||||
return gui_buffers;
|
||||
@@ -158,8 +158,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
SERVER(new_buffer) = server;
|
||||
CHANNEL(new_buffer) = channel;
|
||||
new_buffer->server = server;
|
||||
new_buffer->channel = channel;
|
||||
new_buffer->dcc = dcc;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
@@ -299,17 +299,22 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
static char buffer[1024];
|
||||
va_list argptr;
|
||||
t_gui_infobar *ptr_infobar;
|
||||
char *pos;
|
||||
char *pos, *buf2;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
buf2 = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
buffer);
|
||||
|
||||
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
|
||||
if (ptr_infobar)
|
||||
{
|
||||
ptr_infobar->color = color;
|
||||
ptr_infobar->text = strdup (buffer);
|
||||
ptr_infobar->text = strdup (buf2);
|
||||
pos = strchr (ptr_infobar->text, '\n');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
@@ -321,6 +326,28 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
else
|
||||
wee_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
WEECHAT_ERROR);
|
||||
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -339,7 +366,6 @@ gui_infobar_remove ()
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +407,9 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (buffer_before_dcc == buffer)
|
||||
buffer_before_dcc = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
@@ -414,6 +443,8 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
history_buffer_free (buffer);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
|
||||
+27
-18
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 46
|
||||
#define NUM_COLORS 47
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -50,22 +50,23 @@
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_OP 24
|
||||
#define COLOR_WIN_NICK_HALFOP 25
|
||||
#define COLOR_WIN_NICK_VOICE 26
|
||||
#define COLOR_WIN_NICK_SEP 27
|
||||
#define COLOR_WIN_NICK_SELF 28
|
||||
#define COLOR_WIN_NICK_PRIVATE 29
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_OP 25
|
||||
#define COLOR_WIN_NICK_HALFOP 26
|
||||
#define COLOR_WIN_NICK_VOICE 27
|
||||
#define COLOR_WIN_NICK_SEP 28
|
||||
#define COLOR_WIN_NICK_SELF 29
|
||||
#define COLOR_WIN_NICK_PRIVATE 30
|
||||
#define COLOR_WIN_NICK_FIRST 31
|
||||
#define COLOR_WIN_NICK_LAST 40
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 40
|
||||
#define COLOR_DCC_WAITING 41
|
||||
#define COLOR_DCC_CONNECTING 42
|
||||
#define COLOR_DCC_ACTIVE 43
|
||||
#define COLOR_DCC_DONE 44
|
||||
#define COLOR_DCC_FAILED 45
|
||||
#define COLOR_DCC_ABORTED 46
|
||||
#define COLOR_DCC_SELECTED 41
|
||||
#define COLOR_DCC_WAITING 42
|
||||
#define COLOR_DCC_CONNECTING 43
|
||||
#define COLOR_DCC_ACTIVE 44
|
||||
#define COLOR_DCC_DONE 45
|
||||
#define COLOR_DCC_FAILED 46
|
||||
#define COLOR_DCC_ABORTED 47
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
@@ -246,14 +247,14 @@ extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_buffer *buffer_before_dcc;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* GUI independent functions */
|
||||
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
@@ -265,7 +266,9 @@ extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, 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);
|
||||
@@ -290,6 +293,12 @@ extern void gui_curses_resize_handler ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern int gui_window_merge_up (t_gui_window *);
|
||||
extern int gui_window_merge_down (t_gui_window *);
|
||||
extern int gui_window_merge_left (t_gui_window *);
|
||||
extern int gui_window_merge_right (t_gui_window *);
|
||||
extern void gui_window_merge_auto (t_gui_window *);
|
||||
extern void gui_window_merge_all (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
|
||||
@@ -59,6 +59,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
|
||||
@@ -153,3 +154,53 @@ string_is_channel (char *string)
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_away (t_irc_channel *channel)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
ptr_nick->is_away = 0;
|
||||
}
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_check_away: check for away on a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_check_away (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
channel->checking_away++;
|
||||
server_sendf (server, "WHO %s\r\n", channel->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if (channel->type == CHAT_CHANNEL)
|
||||
{
|
||||
ptr_nick = nick_search (channel, nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ t_irc_command irc_commands[] =
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
{ "devoice", N_("removes voice from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
|
||||
{ "die", N_("shutdown the server"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, irc_cmd_send_die, NULL },
|
||||
@@ -101,7 +101,7 @@ t_irc_command irc_commands[] =
|
||||
{ "me", N_("send a ctcp action to the current channel"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
{ "mode", N_("change channel or user mode"),
|
||||
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
|
||||
"{ nickname {[+|-]|i|w|s|o}"),
|
||||
@@ -136,7 +136,7 @@ t_irc_command irc_commands[] =
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
|
||||
{ "names", N_("list nicknames on channels"),
|
||||
N_("[channel[,channel]]"), N_("channel: channel name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_names, NULL },
|
||||
0, 1, 1, NULL, irc_cmd_send_names, NULL },
|
||||
{ "nick", N_("change current nickname"),
|
||||
N_("nickname"), N_("nickname: new nickname for current IRC server"),
|
||||
1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
|
||||
@@ -145,7 +145,7 @@ t_irc_command irc_commands[] =
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice },
|
||||
{ "op", N_("gives channel operator status to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_op, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_op, NULL, NULL },
|
||||
{ "oper", N_("get operator privileges"),
|
||||
N_("user password"),
|
||||
N_("user/password: used to get privileges on current IRC server"),
|
||||
@@ -161,7 +161,7 @@ t_irc_command irc_commands[] =
|
||||
{ "pong", N_("answer to a ping message"),
|
||||
N_("daemon [daemon2]"), N_("daemon: daemon who has responded to Ping message\n"
|
||||
"daemon2: forward message to this daemon"),
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, NULL },
|
||||
1, 2, 1, NULL, irc_cmd_send_pong, irc_cmd_recv_pong },
|
||||
{ "privmsg", N_("message received"),
|
||||
"", "",
|
||||
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
|
||||
@@ -229,7 +229,7 @@ t_irc_command irc_commands[] =
|
||||
0, 1, 1, NULL, irc_cmd_send_version, NULL },
|
||||
{ "voice", N_("gives voice to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, 1, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL },
|
||||
{ "wallops", N_("send a message to all currently connected users who have "
|
||||
"set the 'w' user mode for themselves"),
|
||||
N_("text"), N_("text to send"),
|
||||
@@ -284,7 +284,7 @@ t_irc_command irc_commands[] =
|
||||
{ "312", N_("whois (server)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_312 },
|
||||
{ "313", N_("whois (operator)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_313 },
|
||||
{ "314", N_("whowas"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_314 },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "315", N_("end of /who list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_315 },
|
||||
{ "317", N_("whois (idle)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_317 },
|
||||
{ "318", N_("whois (end)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_318 },
|
||||
{ "319", N_("whois (channels)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_319 },
|
||||
|
||||
@@ -133,3 +133,76 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_display_server: display server description
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
new_nick->is_away = 0;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
@@ -339,8 +340,7 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
max_length = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
length = strlen (ptr_nick->nick);
|
||||
if (length > max_length)
|
||||
@@ -348,3 +348,17 @@ nick_get_max_length (t_irc_channel *channel)
|
||||
}
|
||||
return max_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_set_away: set/unset away status for a channel
|
||||
*/
|
||||
|
||||
void
|
||||
nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
{
|
||||
if (nick->is_away != is_away)
|
||||
{
|
||||
nick->is_away = is_away;
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+134
-7
@@ -159,6 +159,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new channel \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
@@ -184,7 +185,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
|
||||
gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s\n", arguments);
|
||||
(void) nick_new (ptr_channel, host, 0, 0, 0);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -225,6 +226,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -257,6 +259,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -266,8 +269,8 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
/* my nick was kicked => free all nicks, channel is not active any more */
|
||||
nick_free_all (ptr_channel);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 1);
|
||||
if (server->autorejoin)
|
||||
irc_cmd_send_join (server, ptr_channel->name);
|
||||
}
|
||||
@@ -277,7 +280,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_nick)
|
||||
{
|
||||
nick_free (ptr_channel, ptr_nick);
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -546,6 +549,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -560,6 +564,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
pos = strchr (arguments, ' ');
|
||||
if (!pos)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without channel or nickname\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -585,10 +590,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_channel)
|
||||
{
|
||||
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "mode");
|
||||
@@ -598,6 +604,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
|
||||
else
|
||||
{
|
||||
/* nickname modes */
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
|
||||
@@ -626,6 +633,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "nick");
|
||||
@@ -734,6 +742,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nickname not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
@@ -791,6 +800,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
if (host)
|
||||
{
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", host);
|
||||
@@ -825,6 +835,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (!host || !arguments)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host or channel\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -899,6 +910,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -925,6 +937,37 @@ irc_cmd_recv_ping (t_irc_server *server, char *host, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_pong: 'pong' command received
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_recv_pong (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
int old_lag;
|
||||
|
||||
(void)host;
|
||||
(void)arguments;
|
||||
|
||||
if (server->lag_check_time.tv_sec != 0)
|
||||
{
|
||||
/* calculate lag (time diff with lag check) */
|
||||
old_lag = server->lag;
|
||||
gettimeofday (&tv, &tz);
|
||||
server->lag = (int) get_timeval_diff (&(server->lag_check_time), &tv);
|
||||
if (old_lag != server->lag)
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
|
||||
/* schedule next lag check */
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_privmsg: 'privmsg' command received
|
||||
*/
|
||||
@@ -941,6 +984,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1030,6 +1074,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1039,6 +1084,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1123,6 +1169,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos2 = strchr (pos, '\01');
|
||||
if (!pos2)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1137,6 +1184,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_size = strrchr (pos_file, ' ');
|
||||
if (!pos_size)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1152,6 +1200,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_port = strrchr (pos_file, ' ');
|
||||
if (!pos_port)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1167,6 +1216,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos_addr = strrchr (pos_file, ' ');
|
||||
if (!pos_addr)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1190,6 +1240,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, host);
|
||||
@@ -1261,6 +1312,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "privmsg");
|
||||
@@ -1284,6 +1336,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without host\n"),
|
||||
WEECHAT_ERROR, "quit");
|
||||
@@ -1406,7 +1459,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
|
||||
pos2[0] = '\0';
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s%s",
|
||||
"%s%s\n",
|
||||
(first) ? "" : " ", pos);
|
||||
first = 0;
|
||||
pos = pos2 + 1;
|
||||
@@ -1436,6 +1489,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
|
||||
|
||||
if (!string_is_channel (arguments))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command received without channel\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
@@ -1522,6 +1576,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
|
||||
|
||||
/* connection to IRC server is ok! */
|
||||
server->is_connected = 1;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
gui_draw_buffer_status (server->buffer, 1);
|
||||
gui_draw_buffer_input (server->buffer, 1);
|
||||
|
||||
@@ -1712,6 +1767,7 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", arguments);
|
||||
}
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1737,6 +1793,7 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", arguments);
|
||||
}
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1971,6 +2028,46 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_315: '315' command (end of /who)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_recv_315 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) host;
|
||||
|
||||
/* skip nickname if at beginning of server message */
|
||||
if (strncmp (server->nick, arguments, strlen (server->nick)) == 0)
|
||||
{
|
||||
arguments += strlen (server->nick) + 1;
|
||||
while (arguments[0] == ' ')
|
||||
arguments++;
|
||||
}
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
ptr_channel = channel_search (server, arguments);
|
||||
if (ptr_channel && (ptr_channel->checking_away > 0))
|
||||
{
|
||||
ptr_channel->checking_away--;
|
||||
return 0;
|
||||
}
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", arguments);
|
||||
gui_printf (server->buffer, " %s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->buffer, "%s\n", arguments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_recv_317: '317' command (whois, idle)
|
||||
*/
|
||||
@@ -2358,7 +2455,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
|
||||
if (ptr_channel)
|
||||
{
|
||||
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
gui_draw_buffer_status (ptr_channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2396,6 +2493,7 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT, _("No topic set for "));
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
@@ -2449,6 +2547,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "332");
|
||||
@@ -2458,6 +2557,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify channel for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "332");
|
||||
@@ -2514,6 +2614,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s channel not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2522,6 +2623,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify date/time for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2530,6 +2632,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify nickname for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2538,6 +2641,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot identify channel for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "333");
|
||||
@@ -2592,6 +2696,8 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_user, *pos_host, *pos_server, *pos_nick;
|
||||
char *pos_attr, *pos_hopcount, *pos_realname;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) host;
|
||||
@@ -2653,6 +2759,16 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
|
||||
while (pos_realname[0] == ' ')
|
||||
pos_realname++;
|
||||
|
||||
ptr_channel = channel_search (server, pos_channel);
|
||||
if (ptr_channel && (ptr_channel->checking_away > 0))
|
||||
{
|
||||
ptr_nick = nick_search (ptr_channel, pos_nick);
|
||||
if (ptr_nick)
|
||||
nick_set_away (ptr_channel, ptr_nick,
|
||||
(pos_attr[0] == 'G') ? 1 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
irc_display_prefix (server->buffer,
|
||||
PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer,
|
||||
@@ -2735,6 +2851,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
|
||||
pos++;
|
||||
if (pos[0] != ':')
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "353");
|
||||
@@ -2766,15 +2883,19 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
|
||||
pos++;
|
||||
}
|
||||
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create nick \"%s\" for channel \"%s\"\n"),
|
||||
WEECHAT_ERROR, pos_nick, ptr_channel->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_draw_buffer_nick (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot parse \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "353");
|
||||
@@ -2890,6 +3011,8 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
|
||||
gui_printf_color (ptr_channel->buffer,
|
||||
COLOR_WIN_CHAT_DARK, ")\n");
|
||||
irc_cmd_send_mode (server, ptr_channel->name);
|
||||
if (cfg_irc_away_check > 0)
|
||||
channel_check_away (server, ptr_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2918,6 +3041,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick1) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 2nd nickname \"%s\"\n"),
|
||||
@@ -2929,6 +3053,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick2) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 3rd nickname \"%s\"\n"),
|
||||
@@ -2940,6 +3065,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
{
|
||||
if (strcmp (server->nick, server->nick3) == 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: all declared nicknames are already in use, "
|
||||
"closing connection with server!\n"),
|
||||
@@ -2949,6 +3075,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: nickname \"%s\" is already in use, "
|
||||
"trying 1st nickname \"%s\"\n"),
|
||||
|
||||
+125
-45
@@ -56,6 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
@@ -87,7 +88,8 @@ irc_cmd_send_admin (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char *pos, *ptr_away_msg;
|
||||
char *ptr_away_default_msg = "away";
|
||||
t_irc_server *ptr_server;
|
||||
time_t elapsed;
|
||||
char buffer[4096];
|
||||
@@ -105,64 +107,83 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
ptr_server->is_away = 1;
|
||||
ptr_server->away_time = time (NULL);
|
||||
server_sendf (ptr_server, "AWAY :%s\r\n", pos);
|
||||
if (cfg_look_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", pos);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (ptr_server->is_away && (!pos))
|
||||
{
|
||||
server_sendf (ptr_server, "AWAY\r\n");
|
||||
ptr_server->is_away = 0;
|
||||
elapsed = time (NULL) - ptr_server->away_time;
|
||||
if (cfg_look_display_away)
|
||||
if (server->away_time != 0)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
elapsed = time (NULL) - ptr_server->away_time;
|
||||
ptr_server->away_time = 0;
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
}
|
||||
server_set_away (ptr_server, ptr_server->nick, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_server->is_away = 1;
|
||||
ptr_server->away_time = time (NULL);
|
||||
ptr_away_msg = (pos) ? pos :
|
||||
((cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) ?
|
||||
cfg_irc_default_msg_away : ptr_away_default_msg);
|
||||
server_sendf (ptr_server, "AWAY :%s\r\n", ptr_away_msg);
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", ptr_away_msg);
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
}
|
||||
server_set_away (ptr_server, ptr_server->nick, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arguments)
|
||||
{
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
server_sendf (server, "AWAY :%s\r\n", arguments);
|
||||
if (cfg_look_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", arguments);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (server->is_away && (!arguments))
|
||||
{
|
||||
server_sendf (server, "AWAY\r\n");
|
||||
server->is_away = 0;
|
||||
elapsed = time (NULL) - server->away_time;
|
||||
if (cfg_look_display_away)
|
||||
if (server->away_time != 0)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
elapsed = time (NULL) - server->away_time;
|
||||
server->away_time = 0;
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer),
|
||||
"is back (gone %.2ld:%.2ld:%.2ld)",
|
||||
elapsed / 3600,
|
||||
(elapsed / 60) % 60,
|
||||
elapsed % 60);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
}
|
||||
server_set_away (server, server->nick, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->is_away = 1;
|
||||
server->away_time = time (NULL);
|
||||
ptr_away_msg = (arguments) ? arguments :
|
||||
((cfg_irc_default_msg_away && cfg_irc_default_msg_away[0]) ?
|
||||
cfg_irc_default_msg_away : ptr_away_default_msg);
|
||||
server_sendf (server, "AWAY :%s\r\n", ptr_away_msg);
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", ptr_away_msg);
|
||||
irc_send_me_all_channels (server, buffer);
|
||||
}
|
||||
server_set_away (server, server->nick, 1);
|
||||
}
|
||||
}
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -232,6 +253,14 @@ int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("This command is not developed!\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -252,9 +281,12 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -276,6 +308,7 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
@@ -376,6 +409,7 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -447,12 +481,14 @@ int
|
||||
irc_send_me (t_irc_server *server, t_irc_channel *channel, char *arguments)
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
channel->name, arguments);
|
||||
channel->name,
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
irc_display_prefix (channel->buffer, PREFIX_ACTION_ME);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT_NICK, "%s", server->nick);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n", arguments);
|
||||
COLOR_WIN_CHAT, " %s\n",
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -483,6 +519,7 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
@@ -549,6 +586,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
@@ -565,9 +603,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
}
|
||||
else
|
||||
@@ -587,9 +628,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
@@ -614,6 +658,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color_type (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
@@ -636,6 +681,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
@@ -666,6 +712,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
@@ -687,6 +734,7 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
@@ -728,15 +776,17 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
|
||||
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
@@ -763,6 +813,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
@@ -810,6 +861,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -823,6 +875,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -844,7 +897,14 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (pos_args)
|
||||
server_sendf (server, "PART %s :%s\r\n", channel_name, pos_args);
|
||||
else
|
||||
server_sendf (server, "PART %s\r\n", channel_name);
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
server_sendf (server, "PART %s :%s\r\n",
|
||||
channel_name, cfg_irc_default_msg_part);
|
||||
else
|
||||
server_sendf (server, "PART %s\r\n", channel_name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -899,6 +959,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
@@ -949,17 +1010,34 @@ int
|
||||
irc_cmd_send_quit (t_irc_server *server, char *arguments)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
char *ptr_arg, *pos, buffer[4096];
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
|
||||
ptr_arg = (arguments) ? arguments :
|
||||
(cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0]) ?
|
||||
cfg_irc_default_msg_quit : NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (arguments)
|
||||
server_sendf (ptr_server, "QUIT :%s\r\n", arguments);
|
||||
if (ptr_arg)
|
||||
{
|
||||
pos = strstr (ptr_arg, "%v");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
snprintf (buffer, sizeof (buffer), "%s%s%s",
|
||||
ptr_arg, PACKAGE_VERSION, pos + 2);
|
||||
pos[0] = '%';
|
||||
}
|
||||
else
|
||||
snprintf (buffer, sizeof (buffer), "%s",
|
||||
ptr_arg);
|
||||
server_sendf (ptr_server, "QUIT :%s\r\n", buffer);
|
||||
}
|
||||
else
|
||||
server_sendf (ptr_server, "QUIT\r\n");
|
||||
}
|
||||
@@ -1130,6 +1208,7 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
@@ -1235,6 +1314,7 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
|
||||
+136
-27
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@@ -47,9 +48,7 @@ t_irc_server *last_irc_server = NULL;
|
||||
|
||||
t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
|
||||
/* buffer containing beginning of message if not ending with \r\n */
|
||||
char *unterminated_message = NULL;
|
||||
|
||||
int check_away = 0;
|
||||
|
||||
/*
|
||||
* server_init: init server struct with default values
|
||||
@@ -59,7 +58,7 @@ void
|
||||
server_init (t_irc_server *server)
|
||||
{
|
||||
server->name = NULL;
|
||||
server->autoconnect = 1;
|
||||
server->autoconnect = 0;
|
||||
server->autoreconnect = 1;
|
||||
server->autoreconnect_delay = 30;
|
||||
server->command_line = 0;
|
||||
@@ -74,14 +73,20 @@ server_init (t_irc_server *server)
|
||||
server->command = NULL;
|
||||
server->command_delay = 1;
|
||||
server->autojoin = NULL;
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->is_connected = 0;
|
||||
server->reconnect_start = 0;
|
||||
server->reconnect_join = 0;
|
||||
server->sock4 = -1;
|
||||
server->is_away = 0;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
server->buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
@@ -369,6 +374,7 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@@ -384,14 +390,22 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
buffer[size_buf - 2] = '\0';
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -406,27 +420,31 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
if (!message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
message->server = server;
|
||||
if (unterminated_message)
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
message->data = (char *) malloc (strlen (unterminated_message) +
|
||||
message->data = (char *) malloc (strlen (server->unterminated_message) +
|
||||
strlen (msg) + 1);
|
||||
if (!message->data)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (message->data, unterminated_message);
|
||||
strcpy (message->data, server->unterminated_message);
|
||||
strcat (message->data, msg);
|
||||
}
|
||||
free (unterminated_message);
|
||||
unterminated_message = NULL;
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
}
|
||||
else
|
||||
message->data = strdup (msg);
|
||||
@@ -449,7 +467,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
*/
|
||||
|
||||
void
|
||||
server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
{
|
||||
char *pos;
|
||||
|
||||
@@ -476,17 +494,21 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
pos = strchr (buffer, '\0');
|
||||
if (pos)
|
||||
{
|
||||
unterminated_message =
|
||||
(char *) realloc (unterminated_message,
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
if (!unterminated_message)
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcpy (unterminated_message, buffer);
|
||||
strcpy (server->unterminated_message, buffer);
|
||||
return;
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -561,19 +583,25 @@ server_msgq_flush ()
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Command '%s' failed!\n"), command);
|
||||
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
|
||||
break;
|
||||
case -2:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("No command to execute!\n"));
|
||||
_("%s No command to execute!\n"), WEECHAT_ERROR);
|
||||
break;
|
||||
case -3:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Unknown command: cmd=%s, args=%s\n"),
|
||||
command, args);
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_ERROR, command, args);
|
||||
break;
|
||||
}
|
||||
|
||||
if (command)
|
||||
free (command);
|
||||
}
|
||||
|
||||
free (entire_line);
|
||||
@@ -607,6 +635,7 @@ server_recv (t_irc_server *server)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot read data from socket, disconnecting from server...\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -628,6 +657,7 @@ server_connect (t_irc_server *server)
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
@@ -638,6 +668,7 @@ server_connect (t_irc_server *server)
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
@@ -652,21 +683,28 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
@@ -683,13 +721,15 @@ server_connect (t_irc_server *server)
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
|
||||
_("%s can't bind to hostname\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
} */
|
||||
}*/
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
@@ -700,12 +740,14 @@ server_connect (t_irc_server *server)
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
@@ -725,6 +767,7 @@ server_connect (t_irc_server *server)
|
||||
void
|
||||
server_reconnect (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server...\n"),
|
||||
PACKAGE_NAME);
|
||||
server->reconnect_start = 0;
|
||||
@@ -737,6 +780,7 @@ server_reconnect (t_irc_server *server)
|
||||
else
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
@@ -783,8 +827,6 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
gui_draw_buffer_nick (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
@@ -796,22 +838,33 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
close (server->server_write);
|
||||
server->server_write = -1;
|
||||
|
||||
|
||||
if (server->sock4 >= 0)
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
|
||||
server->is_connected = 0;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
server->lag_check_time.tv_sec = 0;
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
|
||||
if ((reconnect) && (server->autoreconnect))
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -881,3 +934,59 @@ server_name_already_exists (char *name)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_away: remove away for all chans/nicks (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_remove_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_check_away: check for away on all channels (for all servers)
|
||||
*/
|
||||
|
||||
void
|
||||
server_check_away ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_away: set/unset away status for a server (all channels)
|
||||
*/
|
||||
|
||||
void
|
||||
server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-3
@@ -22,6 +22,7 @@
|
||||
#define __WEECHAT_IRC_H 1
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
@@ -79,7 +80,8 @@ struct t_irc_nick
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
int color; /* color for nickname */
|
||||
int is_away; /* = 1 if nick is away, otherwise 0 */
|
||||
int color; /* color for nickname in chat window */
|
||||
t_irc_nick *prev_nick; /* link to previous nick on the channel */
|
||||
t_irc_nick *next_nick; /* link to next nick on the channel */
|
||||
};
|
||||
@@ -100,6 +102,7 @@ struct t_irc_channel
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
@@ -133,15 +136,19 @@ struct t_irc_server
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int sock4; /* socket for server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
struct timeval lag_check_time; /* last time lag was checked (ping sent)*/
|
||||
time_t lag_next_check; /* time for next check */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
@@ -206,6 +213,7 @@ struct t_dcc
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern int check_away;
|
||||
extern t_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
@@ -232,6 +240,9 @@ 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 *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -240,6 +251,9 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
@@ -251,6 +265,7 @@ extern void nick_free_all (t_irc_channel *);
|
||||
extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
@@ -269,6 +284,7 @@ extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
@@ -336,6 +352,7 @@ extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
|
||||
@@ -352,6 +369,7 @@ 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_315 (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 *);
|
||||
|
||||
@@ -313,8 +313,8 @@ static XS (XS_IRC_add_command_handler)
|
||||
|
||||
name = SvPV (ST (0), integer);
|
||||
function = SvPV (ST (1), integer);
|
||||
if (!index_command_search (name))
|
||||
index_command_new (name);
|
||||
if (!weelist_search (index_commands, name))
|
||||
weelist_add (&index_commands, &last_index_command, name);
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
|
||||
@@ -92,6 +92,7 @@ plugin_auto_load (int plugin_type, char *directory)
|
||||
plugin_load (plugin_type, entry->d_name);
|
||||
}
|
||||
}
|
||||
closedir (dir);
|
||||
}
|
||||
|
||||
/* restore working directory */
|
||||
@@ -138,6 +139,10 @@ plugin_load (int plugin_type, char *filename)
|
||||
/* TODO: load Ruby script */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
(void) filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -293,6 +298,7 @@ plugin_event_msg (char *irc_command, char *arguments, char *server)
|
||||
/* make gcc happy */
|
||||
(void) irc_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -324,6 +330,7 @@ plugin_exec_command (char *user_command, char *arguments, char *server)
|
||||
/* make gcc happy */
|
||||
(void) user_command;
|
||||
(void) arguments;
|
||||
(void) server;
|
||||
#endif
|
||||
|
||||
/* no command executed */
|
||||
@@ -337,6 +344,9 @@ plugin_exec_command (char *user_command, char *arguments, char *server)
|
||||
void
|
||||
plugin_unload (int plugin_type, char *scriptname)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) scriptname;
|
||||
|
||||
#ifdef PLUGINS
|
||||
switch (plugin_type)
|
||||
{
|
||||
@@ -354,6 +364,9 @@ plugin_unload (int plugin_type, char *scriptname)
|
||||
/* TODO: unload Ruby scripts */
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) plugin_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "January 2005" "FlashCode"
|
||||
.TH WEECHAT 1 "February 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.9
|
||||
%define version 0.1.0
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Feb 12 2005 FlashCode <flashcode@flashtux.org> 0.1.0-1
|
||||
- Released version 0.1.0
|
||||
* Sat Jan 01 2005 FlashCode <flashcode@flashtux.org> 0.0.9-1
|
||||
- Released version 0.0.9
|
||||
* Sat Oct 30 2004 FlashCode <flashcode@flashtux.org> 0.0.8-1
|
||||
|
||||
Reference in New Issue
Block a user