1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-20 01:54:46 +02:00

Compare commits

...

56 Commits

Author SHA1 Message Date
Sebastien Helleu 89b955c79e Version 0.1.4 2005-07-30 08:28:43 +00:00
Sebastien Helleu 3d724fb634 Join and part/quit prefixes (arrows) now displayed with different colors 2005-07-22 08:11:39 +00:00
Sebastien Helleu 29d0225e4a Fixed CTCP ACTION bug and now replies to CTCP PING on channels 2005-07-20 15:04:49 +00:00
Sebastien Helleu 8416212077 Updated TODO 2005-07-20 13:49:33 +00:00
Sebastien Helleu c36f08d7d7 Highlights with "irc_highlight" setting now case insensitive 2005-07-19 19:50:10 +00:00
Sebastien Helleu 1230735c5f Added "irc_highlight" setting, fixed crash when doing /part on an active DCC chat buffer 2005-07-19 17:35:51 +00:00
Sebastien Helleu 77d7b703de Fixed typo (wrong accent) 2005-07-19 14:17:08 +00:00
Sebastien Helleu 60db73c19a Updated translations 2005-07-19 12:20:40 +00:00
Sebastien Helleu a9ca2987bb Commands /halfop, /voice, /deop, /dehalfop, /devoice are ok for self nick (no arg) 2005-07-19 12:19:06 +00:00
Sebastien Helleu 220308e1fa Fixed hotlist for privates: now quit message is displayed as part/join/quit, not standard message 2005-07-19 10:17:17 +00:00
Sebastien Helleu 8166d15235 Fixed auto-rejoin for channels with key 2005-07-19 09:46:23 +00:00
Sebastien Helleu 575525d965 Reverted to previous code 2005-07-18 09:30:55 +00:00
Emmanuel Bouthenot 6271304832 change signatures in proxy functions 2005-07-17 23:10:17 +00:00
Sebastien Helleu bdf9eadf43 Fixed /ctcp command (now any command/data allowed) 2005-07-17 11:03:00 +00:00
Julien Louis 15ea11b57b Update path of weechat-curses.1 manpages in debian/rules 2005-07-17 08:59:27 +00:00
Sebastien Helleu f3390da5e3 Previous behaviour restored for key "^" (now inserted in buffer) 2005-07-17 00:15:48 +00:00
Sebastien Helleu eeff957278 Added /amsg command (send text to all channels of all connected servers) 2005-07-17 00:02:40 +00:00
Sebastien Helleu 1eac6d8fdd Added /amsg command (send text to all channels of all connected servers) 2005-07-16 23:26:01 +00:00
Sebastien Helleu 23696b44da Documentation is now included in source package and installed with standard process 2005-07-16 22:46:01 +00:00
Sebastien Helleu 63ffae72af Image not used any more in pdf version of doc 2005-07-16 22:44:06 +00:00
Sebastien Helleu 376c8a29d6 Makefile replaced by Makefile.am 2005-07-16 22:40:42 +00:00
Sebastien Helleu 8b1e3b9890 Man page moved to doc/ directory 2005-07-16 22:38:49 +00:00
Julien Louis 1b2c5571e6 Add @documentencoding macro to enable localized info files 2005-07-16 16:51:59 +00:00
Sebastien Helleu 4c6c367557 - added alt-j + alt-l key (switch to last buffer)
- added message for +q mode changing on a nick
2005-07-16 12:37:30 +00:00
Sebastien Helleu 99ad719ab9 Fixed segfault when switching to DCC buffer 2005-07-16 11:32:23 +00:00
Sebastien Helleu a68a1f8192 Added alt-k key to grab a key and insert result into input buffer 2005-07-16 11:14:47 +00:00
Julien Louis 930c40eae1 Sync debian packaging with actual version 2005-07-16 08:58:23 +00:00
Sebastien Helleu 9238a37351 Fixed minor typos 2005-07-15 12:16:14 +00:00
Sebastien Helleu a7c4c7237c Added control in clipboard copy function 2005-07-14 16:35:59 +00:00
Sebastien Helleu a9912cd266 - fixed SIGSEGV handler (now write a core file by aborting program)
- fixed statusbar & infobar background refresh problem with some systems
2005-07-14 07:04:45 +00:00
Sebastien Helleu 1d07964d17 Added color for private in hotlist (different than color for highlight) 2005-07-13 17:40:20 +00:00
Sebastien Helleu 06bd0f9f0e Special chars (between 01 and 31 decimal) not displayed any more on buffers (replaced by spaces) 2005-07-13 16:40:42 +00:00
Sebastien Helleu 4b1679900a Setting "dcc_auto_resume" now used, and fixed address & pos conversion to unsigned long for DCC 2005-07-13 16:39:49 +00:00
Sebastien Helleu 99f03cd2a3 Added DCC resume 2005-07-13 16:24:47 +00:00
Emmanuel Bouthenot 3d41a3fa2f correct bugs in clipboard management 2005-07-13 08:32:02 +00:00
Emmanuel Bouthenot 089b167573 close bug when using delete_end_line in empty line 2005-07-13 07:33:29 +00:00
Sebastien Helleu fc2d9732e5 When DCC failed, do not display local filename if transfer failed before starting 2005-07-12 19:28:09 +00:00
Sebastien Helleu 94a3b5e1ae Added message on server buffer when DCC file transfer failed (or was aborted) 2005-07-12 17:17:37 +00:00
Sebastien Helleu 6b12f19083 - added DCC timeout
- fixed FIFO pipe (command now authorized on a buffer not connected to an IRC server)
- fixed Perl bug with info reading functions
2005-07-12 17:05:01 +00:00
Emmanuel Bouthenot 8a6d35cf12 change return type from tuple to list for get_info('dccs') feature 2005-07-12 14:58:42 +00:00
Emmanuel Bouthenot d286f3922c adding getinfo feature about dccs 2005-07-12 14:46:44 +00:00
Emmanuel Bouthenot 505b43d15b add some gui_input features : clipboard and a 'translate_chars' function 2005-07-12 10:06:10 +00:00
Sebastien Helleu 07a820ced6 Added function for Perl/Python to get DCC list 2005-07-12 08:35:58 +00:00
Sebastien Helleu df6a41566b Updated spanish translation 2005-07-12 08:20:25 +00:00
Sebastien Helleu 263606fffb Updated TODO 2005-07-11 15:05:10 +00:00
Sebastien Helleu d4d065253e Topic completion now decodes UTF-8 string 2005-07-11 14:34:20 +00:00
Sebastien Helleu 673e7680af Fixed bug with IRC URL on command line (irc://) 2005-07-11 12:14:57 +00:00
Sebastien Helleu ad1120c84c Updated doc with new kayboard management 2005-07-09 22:23:41 +00:00
Sebastien Helleu f2a78ebc16 Updated TODO 2005-07-09 22:01:26 +00:00
Sebastien Helleu fef0932c1d Changed two shortcuts (jump to server and jump to next server, now prefixed by meta-j) 2005-07-09 17:50:04 +00:00
Sebastien Helleu 96bd473887 Internal functions descriptions for keys are now displayed and translated 2005-07-09 17:08:26 +00:00
Sebastien Helleu 89d107c1a9 Fixed typo on a color number 2005-07-09 15:58:54 +00:00
Sebastien Helleu 54d4fc12a6 - new keyboard management: keys are setup in config file, new command /key was added and some new default keys were added
- added seconds in infobar time (optional with new config flag)
- fixed some curses refreshs
2005-07-09 15:30:51 +00:00
Sebastien Helleu 55125beee4 Channels auto-prefixed by "#" (if no prefix found) for /join command 2005-07-06 07:13:03 +00:00
Julien Louis a724278215 Update packaging stuff 2005-07-04 04:50:59 +00:00
Sebastien Helleu e3799797ef Version 0.1.4-cvs 2005-07-02 18:22:40 +00:00
106 changed files with 15624 additions and 8388 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2005-05-21
WeeChat known bugs, 2005-07-30
- ./configure does not check that Gtk 2.0 libraries are installed
- when quitting WeeChat term title is not restored (if look_set_title is ON)
+23 -1
View File
@@ -1,9 +1,31 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-06-30
ChangeLog - 2005-07-30
Version 0.1.4 (2005-07-30):
* join and part/quit prefixes (arrows) now displayed with different colors
* added "irc_highlight" setting, to get highlight with any word
* fixed auto-rejoin for channels with key
* fixed /ctcp command (now any command/data allowed)
* added /amsg command (send text to all channels of all connected servers)
* fixed SIGSEGV handler (now write a core file by aborting program)
* fixed statusbar & infobar background refresh problem with some systems
* added color for private in hotlist (different than color for highlight)
* added DCC resume and timeout
* added function for Perl/Python to get DCC list
* fixed FIFO pipe (command now authorized on a buffer not connected
to an IRC server)
* topic completion now decodes UTF-8 string
* fixed bug with IRC URL on command line (irc://)
* new keyboard management: keys are setup in config file, new command
/key was added and some new default keys were added, alt-k key is
used to grab key (useful for /key command)
* added seconds in infobar time (optional thanks to new setting)
* fixed some curses refreshs
* channels auto-prefixed by "#" (if no prefix found) for /join command
Version 0.1.3 (2005-07-02):
* proxy support (http, socks4, socks5) with authentification (http, socks5)
and ipv6 support (client to proxy)
+11 -5
View File
@@ -1,4 +1,4 @@
WeeChat FAQ, 2005-05-21
WeeChat FAQ, 2005-07-30
=======================
Intended audience:
@@ -50,8 +50,12 @@ Q: Why using WeeChat ? X-Chat and Irssi are so good...
A: Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, wxWidgets, Qt),
* extensible with scripts (Perl, Python, Ruby),
* many GUI (Curses, Gtk, wxWidgets, Qt)
* nicklist available in all GUI
* extensible with scripts (Perl, Python, Ruby)
* horizontal and vertical window split
* infobar highlight
* FIFO pipe for remote control
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
@@ -83,7 +87,9 @@ A: You have to setup charset used for decoding, encoding, and internal WeeChat
================================================================================
Q: How can I customize key bindings?
A: Today you can't do that. This is planed for a future version.
A: Key bindings are customizable with /key command.
Default key Meta-k (usually Alt-k) lets you grab key code and insert it
in input zone.
2.5
@@ -103,7 +109,7 @@ A: You can use /perl command to load scripts (default path is
Q: How can I load Python scripts?
Are Python scripts compatible with X-chat or/and Irssi ?
A: You can use /python command to load scripts (default path is
A: You can use /python command to load scripts (default path is
~/.weechat/python).
Note that scripts in ~/.weechat/python/autoload are automatically loaded
when WeeChat is starting up.
+10 -5
View File
@@ -1,4 +1,4 @@
WeeChat FAQ, 2005-05-21
WeeChat FAQ, 2005-07-30
=======================
Public concerné :
@@ -53,8 +53,12 @@ Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
Quelques nouvelles fonctionnalités :
* plusieurs interfaces (Curses, Gtk, wxWidgets, Qt),
* extensible par des scripts (Perl, Python, Ruby),
* plusieurs interfaces (Curses, Gtk, wxWidgets, Qt)
* liste des pseudos disponible dans toutes les interfaces
* extensible par des scripts (Perl, Python, Ruby)
* découpage de la fenêtre horizontalement et verticalement
* highlight dans la barre d'infos
* tube FIFO pour contrôle à distance
* développé à partir de zéro (non basé sur un quelconque client IRC)
* multi-platformes
* 100% GPL et libre
@@ -87,8 +91,9 @@ R: Il faut configurer le charset utilis
================================================================================
Q: Comment puis-je configurer les raccourcis clavier ?
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
version future.
R: Les raccourcis clavier sont modifiables avec la commande /key.
La touche par défaut Meta-k (souvent Alt-k) permet de capturer le code
d'une touche et de l'inclure dans la zone de saisie.
2.5
+2 -4
View File
@@ -15,9 +15,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SUBDIRS = po intl src
SUBDIRS = po doc intl src
EXTRA_DIST = config.rpath weechat-curses.1 BUGS FAQ FAQ.fr \
EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
debian/changelog debian/control \
debian/copyright \
debian/rules debian/weechat-common.docs \
@@ -25,6 +25,4 @@ EXTRA_DIST = config.rpath weechat-curses.1 BUGS FAQ FAQ.fr \
debian/weechat-curses.install debian/weechat-gtk.dirs \
debian/weechat-gtk.install
man_MANS = weechat-curses.1
ACLOCAL_AMFLAGS = -I m4
+4
View File
@@ -1,6 +1,10 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
* FlashCode, 2005-07-30
WeeChat 0.1.4 released.
* FlashCode, 2005-07-02
WeeChat 0.1.3 released.
+9 -7
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2005-07-02
TODO - 2005-07-20
Legend:
# done
@@ -10,7 +10,7 @@ Legend:
? is this really necessary?
v0.1.3:
v0.1.4:
------
* General:
@@ -27,8 +27,14 @@ v0.1.3:
# proxy support (http, socks4, socks5) with authentification
(http, socks5) and ipv6 support (client to proxy)
* WeeChat commands
- be able to bind a key on more than one command
- be able to make an alias running more than one command
* Configuration:
# irc_highlight setting to highlight custom words
# save buffer notify levels
# add key bindings to config file, and create /key command
Future versions:
@@ -46,11 +52,10 @@ Future versions:
nick/host connect to the given irc network
* WeeChat commands:
- "/highlight" command: highlight a given word when it appears on
channels/privates
- "/completion" command: do shortcuts (for example when we type "u"
in the text bar it send it to the server as "you")
- "/last": command to look for text in previous messages
- completion system for scripts arguments
* Interface:
- color for nicks (except own nick) when nick colors are disabled
@@ -61,6 +66,3 @@ Future versions:
* Plugins:
- Ruby plugin
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
* Configuration:
- add key bindings to config file
+3 -2
View File
@@ -19,10 +19,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 0.1.3, flashcode@flashtux.org)
AC_INIT(WeeChat, 0.1.4, flashcode@flashtux.org)
AC_CONFIG_SRCDIR([src/common/weechat.c])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([weechat], [0.1.3])
AM_INIT_AUTOMAKE([weechat], [0.1.4])
# Checks for programs.
AC_PROG_CC
@@ -265,6 +265,7 @@ LIBS="$LIBS $INTLLIBS"
CFLAGS="$CFLAGS $CPPFLAGS"
AC_OUTPUT([Makefile
doc/Makefile
src/Makefile
src/common/Makefile
src/irc/Makefile
+19
View File
@@ -1,3 +1,22 @@
weechat (0.1.3-2) unstable; urgency=low
* Update config.{guess,sub} to fix FTBFS on k*BSD (Closes: #316791)
-- Julien Louis <ptitlouis@sysif.net> Fri, 8 Jul 2005 21:30:38 +0200
weechat (0.1.3-1) unstable; urgency=low
* New upstream release.
-- Julien Louis <ptitlouis@sysif.net> Sat, 2 Jul 2005 20:06:29 +0200
weechat (0.1.2-3) unstable; urgency=low
* Apply patch against gui-display.c to fix curses color bug.
* remove dh_install --sourcedir to allow builds on woody.
-- Julien Louis <ptitlouis@sysif.net> Sun, 19 Jun 2005 22:37:11 +0200
weechat (0.1.2-2) unstable; urgency=low
* Patch src/gui/curse/gui-display.c to fix segfault
+2 -2
View File
@@ -3,8 +3,8 @@ Section: net
Priority: optional
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
Uploaders: Julien Louis <ptitlouis@sysif.net>
Build-Depends: debhelper (>> 4.0.4), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev
Standards-Version: 3.6.1
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls11-dev
Standards-Version: 3.6.2.1
Package: weechat
Architecture: all
+4 -4
View File
@@ -38,9 +38,9 @@ install: build
dh_testroot
dh_clean -k
dh_installdirs
$(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
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
dh_install
# 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
@@ -66,7 +66,7 @@ binary-arch: build install
dh_testroot -a
# dh_installchangelogs -a
# dh_installdocs -a
dh_installman weechat-curses.1 -pweechat-curses
dh_installman doc/weechat-curses.1 -pweechat-curses
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
dh_strip -a
dh_compress -a
+2
View File
@@ -0,0 +1,2 @@
version=2
http://weechat.flashtux.org/download/weechat-(\d.*)\.tar\.bz2
+1 -1
View File
@@ -1 +1 @@
usr/share/locale
debian/tmp/usr/share/locale/
+1 -1
View File
@@ -1 +1 @@
usr/bin/weechat-curses
debian/tmp/usr/bin/weechat-curses
-36
View File
@@ -1,36 +0,0 @@
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi weechat_doc_es.texi
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
export LANG=es_ES && makeinfo --html --no-split --number-sections weechat_doc_es.texi
export LANG=es_ES && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_es.texi >weechat_doc_es.txt
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
export LANG=en_EN && texi2pdf weechat_doc_en.texi
export LANG=es_ES && texi2pdf weechat_doc_es.texi
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
clean:
rm -rf weechat_doc_*.aux weechat_doc_*.cp weechat_doc_*.fn \
weechat_doc_*.html weechat_doc_*.ky weechat_doc_*.log \
weechat_doc_*.pdf weechat_doc_*.pg weechat_doc_*.toc \
weechat_doc_*.tp weechat_doc_*.txt weechat_doc_*.vr
+28
View File
@@ -0,0 +1,28 @@
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
man_MANS = weechat-curses.1
info_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
weechat_doc_es.texi weechat_doc_pt.texi
#weechat_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
# weechat_doc_es.texi weechat_doc_pt.texi
AM_MAKEINFOHTMLFLAGS = --no-split --number-sections
EXTRA_DIST = $(man_MANS)
@@ -23,6 +23,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.br
display config file help (list of options)
.TP
.B \-f, \-\-key\-functions
.br
display internal functions for keys
.TP
.B \-h, \-\-help
.br
display summary of options
@@ -31,6 +35,10 @@ display summary of options
.br
display IRC commands
.TP
.B \-k, \-\-keys
.br
display default keys
.TP
.B \-l, \-\-license
.br
display program license
+130 -17
View File
@@ -35,9 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.3 - July, 03 2005
@image{weechat_image}
@subtitle Documentation for WeeChat v0.1.4-cvs - July, 16 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -150,7 +148,7 @@ Binary packages are available for these distributions:
@itemize @bullet
@item
Debian (or any Debian compatible distribution)@*
To install: @kbd{dpkg -i /path/weechat_x.y.z-1_i386.deb}
To install: @kbd{apt-get install weechat-curses}
@item
Mandriva/Redhat (or any RPM compatible distribution)@*
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
@@ -220,6 +218,8 @@ Then follow instructions for source package - @xref{Source package}.
@table @code
@item -c, --config
Display config file help (list of options)@*
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Display help screen@*
@item -i, --irc-commands
@@ -315,7 +315,10 @@ 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 %Y - %H:%M'@*
Type: string (any string), default value: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@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@*
@@ -382,6 +385,9 @@ Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_delimiters
Color for infobar delimiters@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@@ -668,12 +674,21 @@ Go to the beginning of command line@*
@item End / Ctrl + E
Go to the end of command line@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Redraw whole window@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Erase previous word of command line@*
@*
@item Backspace / Delete
Erase previous / next char of command line@*
@*
@item Ctrl + Backspace / Ctrl + W
Erase previous word of command line@*
@*
@item Tab
Complete command or nick (@kbd{Tab} again: find next completion)@*
@*
@@ -701,30 +716,48 @@ Remove last infobar message@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Redraw whole window@*
@*
@item Alt + left arrow / Alt + right arrow
Same as F5 / F6@*
@*
@item Alt + A
Switch to next buffer with activity (with priority: highlight, message, other)@*
@*
@item Alt + D
Display current DCC@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Clear hotlist (activity notification on other buffers)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Display current DCC@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Switch to server buffer@*
@*
@item Alt + X
@item Alt + J then Alt + X
Switch to first channel of next server (or server buffer if no channel is opened)@*
@*
@item Alt + digit (1-9)
Switch to buffer by number@*
@*
@item Alt + J then number (01-99)
Switch to buffer by number@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -785,6 +818,15 @@ display help about commands@*
@*
command: name of a WeeChat or IRC command@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load filename] | [autoload] | [reload] | [unload]
@*
list/load/unload Perl scripts@*
@@ -1216,6 +1258,73 @@ target: reply should match this mask@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node FIFO pipe, , WeeChat commands, Usage
@section FIFO pipe
@@ -1234,15 +1343,19 @@ Some examples:
@item @bullet{} change your nick on freenode to "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on #weechat channel:
@*
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}
@*
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
@*
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
+149 -35
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage es
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.3 - 03 de Julio de 2005
@image{weechat_image}
@subtitle Documentaci@'on para WeeChat v0.1.4-cvs - 16 de Julio de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -150,7 +149,7 @@ Los paquetes binarios est@'an disponibles para las siguientes distribuciones:
@itemize @bullet
@item
Debian (o compatible con Debian)@*
Para instalar WeeChat: @kbd{dpkg -i /direccion/weechat_x.y.z-1_i386.deb}
Para instalar WeeChat: @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (o cualquier distribuci@'on compatible con los paquetes RPM)@*
Para instalar WeeChat: @kbd{rpm -i /direccion/weechat-x.y.z-1.i386.rpm}
@@ -187,7 +186,7 @@ Adquiere los derechos de root e instala WeeChat:@*
Atenci@'on: Las fuentes CVS est@'an reservadas para usuarios con experiencia: Es posible que WeeChat no
se instale o que se sea bastante inestable.
¡Ya te he avisado!@*
@exclamdown{}Ya te he avisado!@*
Para recuperar las fuentes CVS, escribe las l@'ineas siguientes:@*
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
@@ -221,6 +220,8 @@ Luego, lee las instructiones para Paquetes de fuentes - @xref{Paquetes de fuente
@table @code
@item -c, --config
Obtener la ayuda del fichero de configuraci@'on (lista de opciones)@*
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Obtener la ayuda@*
@item -i, --irc-commands
@@ -274,7 +275,7 @@ Typo: cadena (cualquier cadena), valor por defecto: ''@*
Juego de caracteres interno de WeeChat, deber@'ia ser ISO-xxxx aunque el locale sea UTF-8 (si no se especifica, se utiliza el juego de caracteres local)@*
Typo: cadena (cualquier cadena), valor por defecto: 'ISO-8859-1'@*
@item look_buffer_timestamp
Fecha y hora para las búfers@*
Fecha y hora para las b@'ufers@*
Typo: cadena (cualquier cadena), valor por defecto: '[%H:%M:%S]'@*
@item look_color_nicks
Mostrar nombres de usuario con colores diferentes@*
@@ -314,7 +315,10 @@ Activa la barra de informaci@'on@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_infobar_timestamp
Fecha y hora para las conversaciones guardadas@*
Typo: cadena (cualquier cadena), valor por defecto: '%B, %A %d %Y - %H:%M'@*
Typo: cadena (cualquier cadena), valor por defecto: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_infobar_delay_highlight
Retraso (en segundos) para la notificaci@'on de mensajes en la barra de informaci@'on (0 = desactivar las notificaciones en la barra de informaci@'on)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 7@*
@@ -381,6 +385,9 @@ Typo: color (color Curses @'o Gtk), valor por defecto: 'blue'@*
@item col_infobar
Color para el texto de la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'black'@*
@item col_infobar_delimiters
Color para los delimitadores de la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'blue'@*
@item col_infobar_highlight
Color para la notificaci@'on en la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'white'@*
@@ -457,10 +464,10 @@ Typo: color (color Curses @'o Gtk), valor por defecto: 'lightred'@*
Color para el estado dcc "abortado"@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'lightred'@*
@item history_max_lines
Número m@'aximo de l@'ineas en el hist@'orico para un servidor/canal/privado (0 = ilimitado)@*
N@'umero m@'aximo de l@'ineas en el hist@'orico para un servidor/canal/privado (0 = ilimitado)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 4096@*
@item history_max_commands
Número m@'aximo de comandos de usuario en el hist@'orico (0 = ilimitado)@*
N@'umero m@'aximo de comandos de usuario en el hist@'orico (0 = ilimitado)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 100@*
@item log_auto_server
Registrar autom@'aticamente los mensajes de servidor@*
@@ -514,7 +521,7 @@ Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
Aceptar autom@'aticamente los ficheros dcc entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item dcc_auto_accept_chats
Aceptar autom@'aticamente las peticiones de conversaci@'on dcc (¡utilizar con precauci@'on!)@*
Aceptar autom@'aticamente las peticiones de conversaci@'on dcc (@exclamdown{}utilizar con precauci@'on!)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item dcc_timeout
Tiempo de espera para la petici@'on dcc (en segundos)@*
@@ -667,12 +674,21 @@ Ir al inicio de la l@'inea de comandos@*
@item Fin / Ctrl + E
Ir al final de la l@'inea de comandos@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Refrescar toda la ventana@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Borrar la palabra anterior en la l@'inea de comandos@*
@*
@item Backspace / Supr
Borrar el caracter anterior / siguiente en la l@'inea de comandos@*
@*
@item Ctrl + Backspace / Ctrl + W
Borrar la palabra anterior en la l@'inea de comandos@*
@*
@item Tab
Completar el comando o el seud@'onimo (@kbd{Tab} de nuevo: encontrar la pr@'oxima autocompletaci@'on)@*
@*
@@ -700,30 +716,48 @@ Borrar el @'ultimo mensaje en la barra de informaciones@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Refrescar toda la ventana@*
@*
@item Alt + flecha izquierda / Alt + flecha derecha
Como F5 / F6@*
@*
@item Alt + A
Ir a la memoria temporal donde hay actividad (con el orden de prioridad siguiente: resaltado, mensaje, otros)@*
@*
@item Alt + D
Obtener la lista de DCC actual@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Borrar la 'hotlist' (notificaci@'on de actividad en otras memorias temporales)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Obtener la lista de DCC actual@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Ir a la memoria temporal del servidor@*
@*
@item Alt + X
@item Alt + J then Alt + X
Ir al primer canal del servidor siguiente (o a la memoria temporal del servidor si ning@'un canal est@'a abierto)@*
@*
@item Alt + (1-9)
Saltar a la memoria temporal con ese n@'umero@*
@*
@item Alt + J then number (01-99)
Saltar a la memoria temporal con ese n@'umero@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -743,16 +777,16 @@ nombre_alias: nombre del seud@'onimo@*
comando: nombre del comando (comando WeeChat @'o IRC, sin el primer '/')@*
argumentos: par@'ametros para el comando@*
@*
@item buffer [acci@'on | número]
@item buffer [acci@'on | n@'umero]
@*
gestionar los búfers@*
gestionar los b@'ufers@*
@*
acci@'on: acci@'on a efectuar:@*
move: desplaza el búfer en la lista (puede ser relativo, por ejemplo, -1)@*
close: cierra el búfer (para un canal equivale a /part sin el mensaje de fin)@*
list: lista los búfers abiertos (si no hay par@'ametros se supone esta lista)@*
move: desplaza el b@'ufer en la lista (puede ser relativo, por ejemplo, -1)@*
close: cierra el b@'ufer (para un canal equivale a /part sin el mensaje de fin)@*
list: lista los b@'ufers abiertos (si no hay par@'ametros se supone esta lista)@*
notify: fija el nivel de notificaci@'on (0=nunca, 1=highlight, 2=1+msg, 3=2+join/part)@*
número: saltar al búfer por número@*
n@'umero: saltar al b@'ufer por n@'umero@*
@*
@item clear [-all]
@*
@@ -784,6 +818,15 @@ mostrar ayuda sobre los comandos@*
@*
comando: nombre de un comando de Weechat @'o de IRC@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load fichero] | [autoload] | [reload] | [unload]
@*
lista/carga/descarga de los Perl scripts@*
@@ -858,7 +901,7 @@ target: servidor objetivo@*
revertir el estado ausente@*
@*
-all: revertir el estado ausente en todos los servidores conectados@*
mensaje: mensaje para el estado ausente (si no se da ningún mensaje, se elimina el estado ausente)@*
mensaje: mensaje para el estado ausente (si no se da ning@'un mensaje, se elimina el estado ausente)@*
@*
@item ban [canal] [usariio [usuario ...]]
@*
@@ -989,7 +1032,7 @@ modos del canal:@*
s: indicador de canal secreto@*
i: indicador de canal s@'olo con invitaci@'on@*
t: indicador de tema s@'olo modificable por operador de canal@*
n: ningún mensaje al canal desde el exterior@*
n: ning@'un mensaje al canal desde el exterior@*
m: canal moderado@*
l: fijar el l@'imite de usuarios para el canal@*
b: establecer una m@'ascara de baneo para mantener fuera a usuarios@*
@@ -1205,16 +1248,83 @@ pedir informaci@'on sobre el/los usuario(s)@*
servidor: nombre del servidor@*
usuario: nombre de usuario (puede que sea una m@'ascara)@*
@*
@item whowas usuario [,usuario [,usuario ...]] [número [destinatario]]
@item whowas usuario [,usuario [,usuario ...]] [n@'umero [destinatario]]
@*
pedir informaci@'on sobre un usuario que ya no existe@*
@*
usuario: nombre de usuario a buscar@*
número: número de respuestas a devolver (búsqueda completa si el número es negativo)@*
n@'umero: n@'umero de respuestas a devolver (b@'usqueda completa si el n@'umero es negativo)@*
destinatario: la respuesta deber@'ia concordar con esta m@'ascara@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node Canal FIFO, , Comandos WeeChat, Uso
@section Canal FIFO
@@ -1235,15 +1345,19 @@ Algunos ejemplos:
@item @bullet{} cambiar el seud@'onimo en freenode por "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} escribir texto en el canal #weechat:
@*
@command{echo "freenode,#weechat *@exclamdown{}Hola a todos!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} escribir texto en el canal corriente (el que se puede visualizar en WeeChat actualmente)
@*
@command{echo "*¡Hola!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*@exclamdown{}Hola!" >~/.weechat/weechat_fifo_12345}
@*
@b{Advertencia:} esto es peligroso y no deber@'ias hacerlo.. salvo si lo que est@'as haciendo.
@*
@item @bullet{} enviar dos comandos para descargar y recargar los scripts Perl (tienes que separarlos con un \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1370,7 +1484,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $mensaje) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($mascara, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("mascara=$mascara, canal=$canal, mensaje=$mensaje\n");}@*
@code{@ @ @ @ weechat::print ("masc=$mascara, canal=$canal, msj=$mensaje\n");}@*
@code{@} }@*
@*
@@ -1538,7 +1652,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*
@code{@ @ @ @ null, canal, mensaje = string.split(args, ":", 2)}@*
@code{@ @ @ @ mascara, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("mascara="+mascara+", canal="+canal+", mensaje="+mensaje)}@*
@code{@ @ @ @ weechat.prnt("masc="+mascara+", canal="+canal+", msj="+mensaje)}@*
@*
@item
@@ -1609,7 +1723,7 @@ Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
@node Programas Ruby, , Programas Python, Extensiones
@section Programas Ruby
¡No desarrollado!
@exclamdown{}No desarrollado!
@c **************************** Autores / Soporte *****************************
+137 -20
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage fr
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.3 - 03 Juillet 2005
@image{weechat_image}
@subtitle Documentation pour WeeChat v0.1.4-cvs - 16 Juillet 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -149,7 +148,7 @@ Les paquets binaires sont disponibles pour les distributions suivantes :
@itemize @bullet
@item
Debian (ou toute distribution compatible Debian)@*
Pour installer : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
Pour installer : @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
@@ -222,6 +221,8 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
Afficher l'aide sur le fichier de config (liste des options)@*
@item -h, --help
Afficher l'aide@*
@item -f, --key-functions
Afficher la liste des fonctions internes WeeChat pour les touches@*
@item -i, --irc-commands
Afficher la liste des commandes IRC@*
@item -l, --license
@@ -315,7 +316,10 @@ 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 %Y - %H:%M'@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %Y'@*
@item look_infobar_seconds
Afficher les secondes pour l'heure dans la barre d'infos@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@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@*
@@ -382,6 +386,9 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar
Couleur pour la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'black'@*
@item col_infobar_delimiters
Couleur pour les d@'elimiteurs de la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar_highlight
Couleur pour la notification dans la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@@ -668,12 +675,21 @@ Aller au d@'ebut de la ligne de commande@*
@item End / Ctrl + E
Aller @`a la fin de la ligne de commande@*
@*
@item Ctrl + K
Efface jusqu'@`a la fin de la ligne@*
@*
@item Ctrl + L
R@'eaffiche toute la fen@^etre@*
@*
@item Ctrl + U
Efface jusqu'au d@'ebut de la ligne@*
@*
@item Ctrl + W
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
@*
@item Backspace / Delete
Effacer le mot pr@'ec@'edent / suivant sur la ligne de commande@*
@*
@item Ctrl + Backspace / Ctrl + W
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
@*
@item Tab
Compl@'eter la commande ou le pseudo (@kbd{Tab} @`a nouveau : trouver la compl@'etion suivante)@*
@*
@@ -701,30 +717,48 @@ Effacer le dernier message de la barre d'infos@*
@item F11 / F12
Faire d@'efiler la liste des pseudos@*
@*
@item Ctrl + L
R@'eaffiche toute la fen@^etre@*
@*
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
Identique @`a F5 / F6@*
@*
@item Alt + A
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
@*
@item Alt + B
Aller au mot pr@'ec@'edent@*
@*
@item Alt + D
Effacer le mot suivant@*
@*
@item Alt + F
Aller au mot suivant@*
@*
@item Alt + H
Vide la hotlist (notification d'activit@'e sur les autres tampons)@*
@*
@item Alt + J puis Alt + D
Afficher les DCC en cours@*
@*
@item Alt + R
Vide la hotlist (notification d'activité sur les autres tampons)@*
@item Alt + J puis Alt + L
Sauter au dernier tampon@*
@*
@item Alt + S
@item Alt + J puis Alt + S
Sauter au tampon du serveur@*
@*
@item Alt + X
Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal ouvert)@*
@*
@item Alt + chiffre (1-9)
Sauter au tampon avec ce num@'ero@*
@*
@item Alt + J then Alt + X
Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal ouvert)@*
@*
@item Alt + K
Capturer une touche
@*
@item Alt + J puis nombre (01-99)
Sauter au tampon avec ce num@'ero@*
@*
@item Alt + R
Effacer la ligne enti@`ere@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Faire d@'efiler la liste des pseudos@*
@*
@@ -785,6 +819,15 @@ afficher l'aide sur les commandes@*
@*
commande: nom d'une commande WeeChat ou IRC@*
@*
@item key [touche fonction/commande] [unbind touche] [functions] [reset -yes]
@*
associer/lib@'erer des touches@*
@*
touche: associer cette touche @`a une fonction interne ou une commande (commen@,{c}ant par "/")@*
unbind: supprimer l'association @`a une touche (si "all", toutes les associations de touches par d@'efaut sont restaur@'ees)@*
functions: lister la liste des fonctions internes pour les associations de touches@*
reset: restaur les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
@*
@item perl [load fichier] | [autoload] | [reload] | [unload]
@*
liste/charge/d@'echarge des scripts Perl@*
@@ -1216,6 +1259,73 @@ cible: la r@'eponse doit correspondre @`a ce masque@*
@*
@end table
Fonctions internes pour les touches :@*
@table @kbd
@item return
terminer la ligne@*
@item tab
compl@'eter le mot@*
@item backspace
effacer le caract@`ere pr@'ec@'edent@*
@item delete
effacer le caract@`ere suivant@*
@item delete_end_line
effacer jusqu'@`a la fin de la ligne@*
@item delete_beginning_line
effacer jusqu'au d@'ebut de la ligne@*
@item delete_line
effacer la ligne enti@`ere@*
@item delete_previous_word
effacer le mot pr@'ec@'edent@*
@item delete_next_word
effacer le mot suivant@*
@item home
aller au d@'ebut de la ligne@*
@item end
aller @`a la fin de la ligne@*
@item left
se d@'eplacer d'un caract@`ere @`a gauche@*
@item previous_word
se d@'eplacer au mot pr@'ec@'edent@*
@item right
se d@'eplacer d'un caract@`ere @`a droite@*
@item next_word
se d@'eplacer au mot suivant@*
@item up
appeler la commande pr@'ec@'edente dans l'historique@*
@item down
appeler la commande suivante dans l'historique@*
@item page_up
faire d@'efiler d'une page vers le haut@*
@item page_down
faire d@'efiler d'une page vers le bas@*
@item infobar_clear
effacer la barre d'infos@*
@item nick_page_up
faire d@'efiler la liste des pseudos d'une page vers le haut@*
@item nick_page_down
faire d@'efiler la liste des pseudos d'une page vers le bas@*
@item nick_beginning
afficher le d@'ebut de la liste des pseudos@*
@item nick_end
afficher la fin de la liste des pseudos@*
@item refresh
rafraichir l'@'ecran@*
@item jump_smart
sauter au tampon avec de l'activit@'e@*
@item jump_dcc
sauter au tampon DCC@*
@item jump_server
sauter au tampon du serveur@*
@item jump_next_server
sauter au prochain serveur@*
@item hotlist_clear
effacer la liste d'activit@'e@*
@item grab_key
capturer une touche@*
@end table
@node Tube FIFO, , Commandes WeeChat, Utilisation
@section Tube FIFO
@@ -1235,14 +1345,21 @@ serveur doit l'@^etre aussi.@*
Quelques exemples :
@table @asis
@item @bullet{} changement du pseudo sur freenode en "pseudo|absent":
@*
@command{echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} affichage de texte sur le canal #weechat :
@*
@command{echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} affichage de texte sur le canal courant (le tampon affich@'e par WeeChat):
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}@*
@*
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}
@*
@b{Attention :} ceci est dangereux et vous ne devriez pas le faire sauf si vous savez ce que vous faites !
@item @bullet{} envoyer deux commandes pour décharger/recharger les scripts Perl (vous devez les séparer par \n):
@*
@item @bullet{} envoyer deux commandes pour d@'echarger/recharger les scripts Perl (vous devez les s@'eparer par \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1370,7 +1487,7 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, message=$message\n");}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, msg=$message\n");}@*
@code{@} }@*
@*
+132 -18
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage pt
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.3 - 03 de Julho de 2005
@image{weechat_image}
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.4-cvs - 16 de Julho de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -148,7 +147,7 @@ Os pacotes bin@'arios est@'ao dispon@'iveis para as seguintes distribui@,{c}@~oe
@itemize @bullet
@item
Debian (ou compat@'ivel)@*
Instala@,{c}@~ao : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
Instala@,{c}@~ao : @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
@@ -218,6 +217,8 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
@table @code
@item -c, --config
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Mostrar a ajuda@*
@item -i, --irc-commands
@@ -312,7 +313,10 @@ 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 %Y - %H:%M'@*
Type: string (any string), default value: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@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@*
@@ -379,6 +383,9 @@ Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_delimiters
Color for infobar delimiters@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@@ -665,12 +672,21 @@ Ir para o in@'icio da linha de comando@*
@item End / Ctrl + E
Ir para o fim da linha de comando@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Redesenhe a janela inteira@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Apagar a palavra anterior na linha de comando
@*
@item Backspace / Delete
Apagar o caractere anterior / seguinte na linha de comando@*
@*
@item Ctrl + Backspace / Ctrl + W
Apagar a palavra anterior na linha de comando
@*
@item Tab
Completar o comando ou o nick (@kbd{Tab} novamente : encontrar a pr@'oxima sugest@~ao)@*
@*
@@ -698,30 +714,48 @@ Apagar a @'ultima mensagem da barra do info@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Redesenhe a janela inteira@*
@*
@item Alt + Seta da esquerda / Alt + Seta da direita
Identico a F5 / F6@*
@*
@item Alt + A
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
@*
@item Alt + D
Exposi@,{c}@~ao DCC atual@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Hotlist desobstru@'ido (notifica@,{c}@~ao da atividade em outros amortecedores)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Exposi@,{c}@~ao DCC atual@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Comute ao amortecedor do servidor@*
@*
@item Alt + X
@item Alt + J then Alt + X
Comute @`a primeira canaleta do servidor seguinte (ou do amortecedor do servidor se nenhuma canaleta for aberta)@*
@*
@item Alt + d@'igito (1-9)
Comute ao amortecedor pelo n@'umero@*
@*
@item Alt + J then number (01-99)
Comute ao amortecedor pelo n@'umero@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -782,6 +816,15 @@ display help about commands@*
@*
command: name of a WeeChat or IRC command@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load filename] | [autoload] | [reload] | [unload]
@*
list/load/unload Perl scripts@*
@@ -1213,6 +1256,73 @@ target: reply should match this mask@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node FIFO pipe, , Comandos do WeeChat, Utilizacao
@section FIFO pipe
@@ -1231,15 +1341,19 @@ Some examples:
@item @bullet{} change your nick on freenode to "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on #weechat channel:
@*
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}
@*
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
@*
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1526,7 +1640,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", chan="+channel+", msg="+message)}@*
@*
@item
Binary file not shown.
+1
View File
@@ -18,6 +18,7 @@
./src/gui/gtk/gui-display.c
./src/gui/gtk/gui-input.c
./src/gui/gui-common.c
./src/gui/gui-keyboard.c
./src/gui/gui.h
./src/common/command.c
./src/common/command.h
+1147 -856
View File
File diff suppressed because it is too large Load Diff
+1098 -811
View File
File diff suppressed because it is too large Load Diff
+1096 -827
View File
File diff suppressed because it is too large Load Diff
+211 -49
View File
@@ -47,11 +47,11 @@ t_weechat_command weechat_commands[] =
{ "buffer", N_("manage buffers"),
N_("[action | number]"),
N_("action: action to do:\n"
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (for channel: same as /part without part message)\n"
" list: list opened buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"number: jump to buffer by number"),
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (for channel: same as /part without part message)\n"
" list: list opened buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"number: jump to buffer by number"),
0, MAX_ARGS, weechat_cmd_buffer, NULL },
{ "clear", N_("clear window(s)"),
N_("[-all]"),
@@ -72,33 +72,40 @@ t_weechat_command weechat_commands[] =
{ "help", N_("display help about commands"),
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
0, 1, weechat_cmd_help, NULL },
{ "key", N_("bind/unbind keys"),
N_("[key function/command] [unbind key] [functions] [reset -yes]"),
N_("key: bind this key to an internal function or a command (beginning by \"/\")\n"
"unbind: unbind a key (if \"all\", default bindings are restored)\n"
"functions: list internal functions for key bindings\n"
"reset: restore bindings to the default values and delete ALL personal binding (use carefully!)"),
0, MAX_ARGS, NULL, weechat_cmd_key },
{ "perl", N_("list/load/unload Perl scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Perl script (file) to load\n"
"Without argument, /perl command lists all loaded Perl scripts."),
"Without argument, /perl command lists all loaded Perl scripts."),
0, 2, weechat_cmd_perl, NULL },
{ "python", N_("list/load/unload Python scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Python script (file) to load\n"
"Without argument, /python command lists all loaded Python scripts."),
"Without argument, /python command lists all loaded Python scripts."),
0, 2, weechat_cmd_python, NULL },
{ "server", N_("list, add or remove servers"),
N_("[servername] | "
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 "
"[nick2 [nick3]]] [-username username] [-realname realname] "
"[-command command] [-autojoin channel[,channel]] ] | "
"[del servername]"),
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 "
"[nick2 [nick3]]] [-username username] [-realname realname] "
"[-command command] [-autojoin channel[,channel]] ] | "
"[del servername]"),
N_("servername: server name, for internal & display use\n"
"hostname: name or IP address of server\n"
"port: port for server (integer)\n"
"ipv6: use IPv6 protocol\n"
"ssl: use SSL protocol\n"
"password: password for server\n"
"nick1: first nick for server\n"
"nick2: alternate nick for server\n"
"nick3: second alternate nick for server\n"
"username: user name\n"
"realname: real name of user"),
"hostname: name or IP address of server\n"
"port: port for server (integer)\n"
"ipv6: use IPv6 protocol\n"
"ssl: use SSL protocol\n"
"password: password for server\n"
"nick1: first nick for server\n"
"nick2: alternate nick for server\n"
"nick3: second alternate nick for server\n"
"username: user name\n"
"realname: real name of user"),
0, MAX_ARGS, weechat_cmd_server, NULL },
{ "save", N_("save config to disk"),
N_("[file]"), N_("file: filename for writing config"),
@@ -111,11 +118,10 @@ t_weechat_command weechat_commands[] =
1, 1, NULL, weechat_cmd_unalias },
{ "window", N_("manage windows"),
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
N_(
"list: list opened windows (no parameter implies this list)\n"
"splith: split current window horizontally\n"
"splitv: split current window vertically\n"
"merge: merge window with another"),
N_("list: list opened windows (no parameter implies this list)\n"
"splith: split current window horizontally\n"
"splitv: split current window vertically\n"
"merge: merge window with another"),
0, 2, weechat_cmd_window, NULL },
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
};
@@ -877,6 +883,7 @@ weechat_cmd_buffer (int argc, char **argv)
t_irc_channel *ptr_channel;
long number;
char *error;
int target_buffer;
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
{
@@ -964,7 +971,9 @@ weechat_cmd_buffer (int argc, char **argv)
{
if (SERVER(gui_current_window->buffer))
{
if (SERVER(gui_current_window->buffer)->is_connected)
if (SERVER(gui_current_window->buffer)->is_connected
&& CHANNEL(gui_current_window->buffer)
&& CHANNEL(gui_current_window->buffer)->nicks)
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
else
{
@@ -1049,26 +1058,41 @@ weechat_cmd_buffer (int argc, char **argv)
{
/* jump to buffer by number */
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
if (argv[0][0] == '-')
{
if (!gui_switch_to_buffer_by_number (gui_current_window, (int) number))
/* relative jump '-' */
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s buffer \"%s\" not found for \"%s\" command\n"),
WEECHAT_ERROR, argv[0], "buffer");
return -1;
target_buffer = gui_current_window->buffer->number - (int) number;
if (target_buffer < 1)
target_buffer = (last_gui_buffer) ? last_gui_buffer->number + target_buffer : 1;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
}
}
else if (argv[0][0] == '+')
{
/* relative jump '+' */
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
{
target_buffer = gui_current_window->buffer->number + (int) number;
if (last_gui_buffer && target_buffer > last_gui_buffer->number)
target_buffer -= last_gui_buffer->number;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
}
}
else
{
/* invalid number */
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s incorrect buffer number\n"),
WEECHAT_ERROR);
return -1;
/* absolute jump by number */
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_buffer_by_number (gui_current_window, (int) number);
}
}
@@ -1178,7 +1202,7 @@ weechat_cmd_debug (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unknown option for \"%s\" command\n"),
WEECHAT_ERROR, "perl");
WEECHAT_ERROR, "debug");
return -1;
}
@@ -1322,6 +1346,139 @@ weechat_cmd_help (int argc, char **argv)
return 0;
}
/*
* weechat_cmd_key_display: display a key binding
*/
void
weechat_cmd_key_display (t_gui_key *key, int new_key)
{
char *expanded_name;
expanded_name = gui_key_get_expanded_name (key->key);
if (new_key)
{
gui_printf (NULL, _("New key binding:\n"));
gui_printf (NULL, " %s", (expanded_name) ? expanded_name : key->key);
}
else
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " => ");
gui_printf (NULL, "%s\n",
(key->function) ?
gui_key_function_search_by_ptr (key->function) : key->command);
if (expanded_name)
free (expanded_name);
}
/*
* weechat_cmd_key: bind/unbind keys
*/
int
weechat_cmd_key (char *arguments)
{
char *pos;
int i;
t_gui_key *ptr_key;
if (arguments)
{
while (arguments[0] == ' ')
arguments++;
}
if (!arguments || (arguments[0] == '\0'))
{
gui_printf (NULL, "\n");
gui_printf (NULL, _("Key bindings:\n"));
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
weechat_cmd_key_display (ptr_key, 0);
}
}
else if (strncasecmp (arguments, "unbind ", 7) == 0)
{
arguments += 7;
while (arguments[0] == ' ')
arguments++;
if (gui_key_unbind (arguments))
gui_printf (NULL, _("Key \"%s\" unbinded\n"), arguments);
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unable to unbind key \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
}
}
else if (strcasecmp (arguments, "functions") == 0)
{
gui_printf (NULL, "\n");
gui_printf (NULL, _("Internal key functions:\n"));
i = 0;
while (gui_key_functions[i].function_name)
{
gui_printf (NULL, "%25s %s\n",
gui_key_functions[i].function_name,
_(gui_key_functions[i].description));
i++;
}
}
else if (strncasecmp (arguments, "reset", 5) == 0)
{
arguments += 5;
while (arguments[0] == ' ')
arguments++;
if (strcasecmp (arguments, "-yes") == 0)
{
gui_key_free_all ();
gui_key_init ();
gui_printf (NULL, _("Default key bindings restored\n"));
}
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s \"-yes\" argument is required for keys reset (securuty reason)\n"),
WEECHAT_ERROR);
return -1;
}
}
else
{
while (arguments[0] == ' ')
arguments++;
pos = strchr (arguments, ' ');
if (!pos)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "key");
return -1;
}
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
ptr_key = gui_key_bind (arguments, pos);
if (ptr_key)
weechat_cmd_key_display (ptr_key, 1);
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unable to bind key \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
}
}
return 0;
}
/*
* weechat_cmd_perl: list/load/unload Perl scripts
*/
@@ -1892,11 +2049,11 @@ weechat_cmd_server (int argc, char **argv)
}
/*
* weechat_set_cmd_display_option: display config option
* weechat_cmd_set_display_option: display config option
*/
void
weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *value)
weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *value)
{
char *color_name, *pos_nickserv, *pos_pwd, *value2;
@@ -2039,7 +2196,7 @@ weechat_cmd_set (char *arguments)
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_server->name,
ptr_option_value);
}
@@ -2080,7 +2237,7 @@ weechat_cmd_set (char *arguments)
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", config_get_section (ptr_option));
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
weechat_set_cmd_display_option (ptr_option, NULL, NULL);
weechat_cmd_set_display_option (ptr_option, NULL, NULL);
}
else
{
@@ -2104,7 +2261,8 @@ weechat_cmd_set (char *arguments)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -2122,7 +2280,7 @@ weechat_cmd_set (char *arguments)
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
section_displayed = 1;
}
weechat_set_cmd_display_option (&weechat_options[i][j], NULL, NULL);
weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);
number_found++;
}
}
@@ -2155,7 +2313,7 @@ weechat_cmd_set (char *arguments)
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_server->name,
ptr_option_value);
number_found++;
@@ -2288,6 +2446,10 @@ weechat_cmd_window (int argc, char **argv)
else
gui_window_merge_auto (gui_current_window);
}
else if (strcasecmp (argv[0], "-1") == 0)
gui_switch_to_previous_window ();
else if (strcasecmp (argv[0], "+1") == 0)
gui_switch_to_next_window ();
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
+1
View File
@@ -69,6 +69,7 @@ extern int weechat_cmd_connect (int, char **);
extern int weechat_cmd_debug (int, char **);
extern int weechat_cmd_disconnect (int, char **);
extern int weechat_cmd_help (int, char **);
extern int weechat_cmd_key (char *);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_python (int, char **);
extern int weechat_cmd_save (int, char **);
+30 -3
View File
@@ -102,7 +102,7 @@ completion_build_list (t_completion *completion, void *channel)
int i, j;
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
char *pos, option_name[256];
char *pos, option_name[256], *string;
t_weechat_alias *ptr_alias;
t_config_option *option;
void *option_value;
@@ -201,6 +201,20 @@ completion_build_list (t_completion *completion, void *channel)
}
return;
}
if ((strcasecmp (completion->base_command, "key") == 0)
&& (completion->base_command_arg == 1))
{
weelist_add (&completion->completion_list,
&completion->last_completion,
"unbind");
weelist_add (&completion->completion_list,
&completion->last_completion,
"functions");
weelist_add (&completion->completion_list,
&completion->last_completion,
"reset");
return;
}
if (((strcasecmp (completion->base_command, "perl") == 0)
|| (strcasecmp (completion->base_command, "python") == 0))
&& (completion->base_command_arg == 1))
@@ -225,7 +239,8 @@ completion_build_list (t_completion *completion, void *channel)
{
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -307,6 +322,8 @@ completion_build_list (t_completion *completion, void *channel)
pos[0] = ' ';
}
}
else
completion_stop (completion);
return;
}
if ((strcasecmp (completion->base_command, "unalias") == 0)
@@ -407,6 +424,9 @@ completion_build_list (t_completion *completion, void *channel)
weelist_add (&completion->completion_list,
&completion->last_completion,
"action");
weelist_add (&completion->completion_list,
&completion->last_completion,
"ping");
weelist_add (&completion->completion_list,
&completion->last_completion,
"version");
@@ -507,9 +527,16 @@ completion_build_list (t_completion *completion, void *channel)
|| !((t_irc_channel *)channel)->topic[0])
completion_stop (completion);
else
{
string = weechat_convert_encoding (cfg_look_charset_decode,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
((t_irc_channel *)channel)->topic);
weelist_add (&completion->completion_list,
&completion->last_completion,
((t_irc_channel *)channel)->topic);
string);
free (string);
}
}
else
completion_stop (completion);
+3 -19
View File
@@ -112,16 +112,8 @@ fifo_exec (char *text)
if (text[0] == '*')
{
pos_msg = text + 1;
ptr_server = SERVER(gui_current_window->buffer);
ptr_buffer = gui_current_window->buffer;
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s invalid buffer for displaying text via FIFO pipe\n"),
WEECHAT_WARNING);
return;
}
ptr_buffer = (gui_current_window->buffer->has_input) ? gui_current_window->buffer : gui_buffers;
ptr_server = SERVER(ptr_buffer);
}
else
{
@@ -172,20 +164,12 @@ fifo_exec (char *text)
}
}
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
WEECHAT_WARNING);
return;
}
if (!ptr_buffer)
{
if (ptr_channel)
ptr_buffer = ptr_channel->buffer;
else
ptr_buffer = ptr_server->buffer;
ptr_buffer = gui_buffers;
}
user_command (ptr_server, ptr_buffer, pos_msg);
+6 -1
View File
@@ -23,12 +23,17 @@
#include "../irc/irc.h"
#define HOTLIST_LOW 0
#define HOTLIST_MSG 1
#define HOTLIST_PRIVATE 2
#define HOTLIST_HIGHLIGHT 3
typedef struct t_weechat_hotlist t_weechat_hotlist;
struct t_weechat_hotlist
{
int priority; /* 0=crappy msg (join/part), 1=msg, */
/* 2=nick highlight */
/* 2=pv, 3=nick highlight */
t_gui_buffer *buffer; /* associated buffer */
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
+78 -31
View File
@@ -313,6 +313,48 @@ void wee_display_commands (int weechat_cmd, int irc_cmd)
}
}
/*
* wee_display_key_functions: display WeeChat key functions
*/
void wee_display_key_functions ()
{
int i;
printf (_("Internal key functions:\n"));
printf ("\n");
i = 0;
while (gui_key_functions[i].function_name)
{
printf ("* %s: %s\n",
gui_key_functions[i].function_name,
_(gui_key_functions[i].description));
i++;
}
}
/*
* wee_display_keys: display WeeChat default keys
*/
void wee_display_keys ()
{
t_gui_key *ptr_key;
char *expanded_name;
printf (_("%s default keys:\n"), PACKAGE_NAME);
printf ("\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
printf ("* %s => %s\n",
(expanded_name) ? expanded_name : ptr_key->key,
(ptr_key->function) ? gui_key_function_search_by_ptr (ptr_key->function) : ptr_key->command);
if (expanded_name)
free (expanded_name);
}
}
/*
* wee_parse_args: parse command line args
*/
@@ -331,38 +373,50 @@ wee_parse_args (int argc, char *argv[])
|| (strcmp (argv[i], "--config") == 0))
{
wee_display_config_options ();
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-f") == 0)
|| (strcmp (argv[i], "--key-functions") == 0))
{
wee_display_key_functions ();
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
{
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
printf ("%s", WEE_USAGE2);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
if ((strcmp (argv[i], "-i") == 0)
else if ((strcmp (argv[i], "-i") == 0)
|| (strcmp (argv[i], "--irc-commands") == 0))
{
wee_display_commands (0, 1);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-k") == 0)
|| (strcmp (argv[i], "--keys") == 0))
{
wee_display_keys ();
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
printf ("\n%s%s", WEE_LICENSE);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-v") == 0)
|| (strcmp (argv[i], "--version") == 0))
{
printf (PACKAGE_VERSION "\n");
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
if ((strcmp (argv[i], "-w") == 0)
else if ((strcmp (argv[i], "-w") == 0)
|| (strcmp (argv[i], "--weechat-commands") == 0))
{
wee_display_commands (1, 0);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strncasecmp (argv[i], "irc", 3) == 0))
{
@@ -438,7 +492,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s unable to get HOME directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
dir_length = strlen (ptr_home) + 10;
weechat_home =
@@ -447,7 +501,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s not enough memory for home directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
DIR_SEPARATOR);
@@ -457,7 +511,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
dir_length = strlen (weechat_home) + 64;
@@ -527,11 +581,11 @@ wee_init_vars ()
msgq_last_msg = NULL;
/* init gnutls */
#ifdef HAVE_GNUTLS
#ifdef HAVE_GNUTLS
gnutls_global_init ();
gnutls_certificate_allocate_credentials (&gnutls_xcred);
gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
#endif
#endif
}
/*
@@ -615,7 +669,7 @@ wee_gui_shutdown ()
*/
void
wee_shutdown (int return_code)
wee_shutdown (int return_code, int crash)
{
fifo_remove ();
if (weechat_home)
@@ -626,12 +680,15 @@ wee_shutdown (int return_code)
free (local_charset);
alias_free_all ();
#ifdef HAVE_GNUTLS
#ifdef HAVE_GNUTLS
gnutls_certificate_free_credentials (gnutls_xcred);
gnutls_global_deinit();
#endif
#endif
exit (return_code);
if (crash)
abort();
else
exit (return_code);
}
/*
@@ -721,17 +778,6 @@ wee_dump (int crash)
wee_log_printf ("\n");
}
/*
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
* Prevents user for exiting with Ctrl-C
*/
void
my_sigint ()
{
/* do nothing */
}
/*
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
*/
@@ -747,7 +793,7 @@ my_sigsegv ()
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 1);
}
/*
@@ -767,10 +813,11 @@ main (int argc, char *argv[])
local_charset = strdup (nl_langinfo (CODESET));
#endif
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
wee_init_vars (); /* initialize some variables */
gui_key_init (); /* init keyboard (default key bindings) */
wee_parse_args (argc, argv); /* parse command line args */
wee_create_home_dirs (); /* create WeeChat directories */
wee_init_log (); /* init log file */
@@ -805,7 +852,7 @@ main (int argc, char *argv[])
(void) config_write (NULL); /* save config file */
command_index_free (); /* free commands index */
wee_gui_shutdown (); /* shut down WeeChat GUI */
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
return EXIT_SUCCESS; /* make gcc happy (never executed) */
}
+4 -2
View File
@@ -90,8 +90,10 @@
#define WEE_USAGE2 \
" -c, --config display config file options\n" \
" -h, --help this help screen\n" \
" -f, --key-functions display WeeChat internal functions for keys\n" \
" -h, --help this help\n" \
" -i, --irc-commands display IRC commands\n" \
" -k, --keys display WeeChat default keys\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n" \
" -w, --weechat-commands display WeeChat commands\n\n"
@@ -120,6 +122,6 @@ extern void wee_log_printf (char *, ...);
extern void wee_dump (int);
extern char *weechat_convert_encoding (char *, char *, char *);
extern long get_timeval_diff (struct timeval *, struct timeval *);
extern void wee_shutdown (int);
extern void wee_shutdown (int, int);
#endif /* weechat.h */
+109 -13
View File
@@ -53,6 +53,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
{ CONFIG_SECTION_IRC, "irc" },
{ CONFIG_SECTION_DCC, "dcc" },
{ CONFIG_SECTION_PROXY, "proxy" },
{ CONFIG_SECTION_KEYS, "keys" },
{ CONFIG_SECTION_ALIAS, "alias" },
{ CONFIG_SECTION_SERVER, "server" }
};
@@ -82,6 +83,7 @@ char *cfg_look_no_nickname;
char *cfg_look_completor;
int cfg_look_infobar;
char *cfg_look_infobar_timestamp;
int cfg_look_infobar_seconds;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] =
@@ -170,7 +172,11 @@ t_config_option weechat_options_look[] =
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %Y - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
"%B, %A %d %Y", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
{ "look_infobar_seconds", N_("display seconds in infobar time"),
N_("display seconds in infobar time"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_infobar_seconds, NULL, config_change_buffer_content },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
@@ -188,6 +194,8 @@ int cfg_col_chat_time;
int cfg_col_chat_time_sep;
int cfg_col_chat_prefix1;
int cfg_col_chat_prefix2;
int cfg_col_chat_join;
int cfg_col_chat_part;
int cfg_col_chat_nick;
int cfg_col_chat_host;
int cfg_col_chat_channel;
@@ -197,11 +205,13 @@ int cfg_col_chat_bg;
int cfg_col_status;
int cfg_col_status_delimiters;
int cfg_col_status_data_msg;
int cfg_col_status_data_private;
int cfg_col_status_data_highlight;
int cfg_col_status_data_other;
int cfg_col_status_more;
int cfg_col_status_bg;
int cfg_col_infobar;
int cfg_col_infobar_delimiters;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg;
int cfg_col_input;
@@ -260,6 +270,14 @@ t_config_option weechat_options_colors[] =
N_("color for middle char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color },
{ "col_chat_join", N_("color for join arrow (prefix)"),
N_("color for join arrow (prefix)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_chat_join, NULL, &config_change_color },
{ "col_chat_part", N_("color for part/quit arrow (prefix)"),
N_("color for part/quit arrow (prefix)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightred", NULL, &cfg_col_chat_part, NULL, &config_change_color },
{ "col_chat_nick", N_("color for nicks in actions"),
N_("color for nicks in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -298,10 +316,14 @@ t_config_option weechat_options_colors[] =
N_("color for window with new messages (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
{ "col_status_private", N_("color for window with private message"),
N_("color for window with private message (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_private, NULL, &config_change_color },
{ "col_status_highlight", N_("color for window with highlight"),
N_("color for window with highlight (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
"lightred", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
{ "col_status_data_other", N_("color for window with new data (not messages)"),
N_("color for window with new data (not messages) (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -320,6 +342,10 @@ t_config_option weechat_options_colors[] =
N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, &config_change_color },
{ "col_infobar_delimiters", N_("color for infobar delimiters"),
N_("color for infobar delimiters"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_infobar_delimiters, NULL, &config_change_color },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -501,6 +527,7 @@ int cfg_irc_lag_check;
int cfg_irc_lag_min_show;
int cfg_irc_lag_disconnect;
int cfg_irc_fifo_pipe;
char *cfg_irc_highlight;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message to all channels when away"),
@@ -539,6 +566,10 @@ t_config_option weechat_options_irc[] =
N_("create a FIFO pipe for remote control"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_irc_fifo_pipe, NULL, config_change_fifo_pipe },
{ "irc_highlight", N_("list of words to highlight"),
N_("comma separated list of words to highlight (case insensitive comparison)"),
OPTION_TYPE_STRING, 0, 0, 0,
"", NULL, NULL, &cfg_irc_highlight, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -727,7 +758,7 @@ t_config_option weechat_options_server[] =
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
{ weechat_options_look, weechat_options_colors, weechat_options_history,
weechat_options_log, weechat_options_irc, weechat_options_dcc,
weechat_options_proxy, NULL, weechat_options_server
weechat_options_proxy, NULL, NULL, weechat_options_server
};
@@ -763,7 +794,8 @@ config_get_section (t_config_option *ptr_option)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1057,7 +1089,8 @@ config_option_search (char *option_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1220,7 +1253,8 @@ config_default_values ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1375,8 +1409,22 @@ config_read ()
if (pos2 != NULL)
pos2[0] = '\0';
if (section == CONFIG_SECTION_ALIAS)
if (section == CONFIG_SECTION_KEYS)
{
if (pos[0])
{
/* bind key (overwrite any binding with same key) */
gui_key_bind (line, pos);
}
else
{
/* unbin key if no value given */
gui_key_unbind (line);
}
}
else if (section == CONFIG_SECTION_ALIAS)
{
/* create new alias */
if (alias_new (line, pos))
weelist_add (&index_commands, &last_index_command, line);
}
@@ -1493,6 +1541,8 @@ config_create_default ()
time_t current_time;
struct passwd *my_passwd;
char *realname, *pos;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
filename_length = strlen (weechat_home) + 64;
filename =
@@ -1520,7 +1570,8 @@ config_create_default ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1550,6 +1601,27 @@ config_create_default ()
}
}
/* default key bindings */
fprintf (file, "\n[keys]\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
if (ptr_key->function)
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
free (expanded_name);
}
/* default aliases */
/* TODO: remove comments when missing commands will be ok */
fprintf (file, "\n[alias]\n");
@@ -1560,20 +1632,20 @@ config_create_default ()
fprintf (file, "C=clear\n");
fprintf (file, "CL=clear\n");
fprintf (file, "CLOSE=buffer close\n");
fprintf (file, "# CHAT=dcc chat\n");
fprintf (file, "CHAT=dcc chat\n");
fprintf (file, "# GET=dcc get\n");
fprintf (file, "# IG=ignore\n");
fprintf (file, "J=join\n");
fprintf (file, "K=kick\n");
fprintf (file, "# KB=kickban\n");
fprintf (file, "KB=kickban\n");
fprintf (file, "# KN=knockout\n");
fprintf (file, "LEAVE=part\n");
fprintf (file, "M=msg\n");
fprintf (file, "# MUB=unban *\n");
fprintf (file, "MUB=unban *\n");
fprintf (file, "N=names\n");
fprintf (file, "Q=query\n");
fprintf (file, "T=topic\n");
fprintf (file, "# UB=unban\n");
fprintf (file, "UB=unban\n");
fprintf (file, "# UNIG=unignore\n");
fprintf (file, "W=who\n");
fprintf (file, "WC=part\n");
@@ -1658,6 +1730,8 @@ config_write (char *config_name)
time_t current_time;
t_irc_server *ptr_server;
t_weechat_alias *ptr_alias;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
if (config_name)
filename = strdup (config_name);
@@ -1690,7 +1764,8 @@ config_write (char *config_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1737,6 +1812,27 @@ config_write (char *config_name)
}
}
/* keys section */
fprintf (file, "\n[keys]\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
if (ptr_key->function)
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
free (expanded_name);
}
/* alias section */
fprintf (file, "\n[alias]\n");
for (ptr_alias = weechat_alias; ptr_alias;
+10 -3
View File
@@ -33,9 +33,10 @@
#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 CONFIG_SECTION_KEYS 7
#define CONFIG_SECTION_ALIAS 8
#define CONFIG_SECTION_SERVER 9
#define CONFIG_NUMBER_SECTIONS 10
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
#define OPTION_TYPE_INT 2 /* values: from min to max */
@@ -97,6 +98,7 @@ extern char *cfg_look_no_nickname;
extern char *cfg_look_completor;
extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_seconds;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title;
@@ -106,6 +108,8 @@ extern int cfg_col_chat_time;
extern int cfg_col_chat_time_sep;
extern int cfg_col_chat_prefix1;
extern int cfg_col_chat_prefix2;
extern int cfg_col_chat_join;
extern int cfg_col_chat_part;
extern int cfg_col_chat_nick;
extern int cfg_col_chat_host;
extern int cfg_col_chat_channel;
@@ -115,11 +119,13 @@ extern int cfg_col_chat_bg;
extern int cfg_col_status;
extern int cfg_col_status_delimiters;
extern int cfg_col_status_data_msg;
extern int cfg_col_status_data_private;
extern int cfg_col_status_data_highlight;
extern int cfg_col_status_data_other;
extern int cfg_col_status_more;
extern int cfg_col_status_bg;
extern int cfg_col_infobar;
extern int cfg_col_infobar_delimiters;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg;
extern int cfg_col_input;
@@ -166,6 +172,7 @@ extern int cfg_irc_lag_check;
extern int cfg_irc_lag_min_show;
extern int cfg_irc_lag_disconnect;
extern int cfg_irc_fifo_pipe;
extern char *cfg_irc_highlight;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;
+1
View File
@@ -20,6 +20,7 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
noinst_LIBRARIES = lib_weechat_gui_common.a
lib_weechat_gui_common_a_SOURCES = gui-common.c \
gui-keyboard.c \
gui.h
if GUI_NCURSES
+2 -2
View File
@@ -19,7 +19,7 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../lib_weechat_gui_common.a \
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(NCURSES_LIBS) \
@@ -27,4 +27,4 @@ weechat_curses_LDADD = ../lib_weechat_gui_common.a \
$(GNUTLS_LIBS)
weechat_curses_SOURCES = gui-display.c \
gui-input.c
gui-input.c
+250 -258
View File
@@ -318,7 +318,7 @@ gui_draw_window_separator (t_gui_window *window)
window->win_x - 1);
gui_window_set_color (window->win_separator, COLOR_WIN_TITLE);
wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_separator);
wnoutrefresh (window->win_separator);
refresh ();
}
}
@@ -341,15 +341,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
if (ptr_win->buffer == buffer)
{
if (erase)
gui_curses_window_clear (ptr_win->win_title);
gui_curses_window_clear (ptr_win->win_title);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
wborder (ptr_win->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_title);
refresh ();
}
gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
if (CHANNEL(buffer))
{
@@ -362,6 +356,8 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
free (buf);
}
else
mvwprintw (ptr_win->win_title, 0, 0, format, " ");
}
else
{
@@ -372,8 +368,10 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE " - "
WEECHAT_WEBSITE);
}
else
mvwprintw (ptr_win->win_title, 0, 0, format, " ");
}
wrefresh (ptr_win->win_title);
wnoutrefresh (ptr_win->win_title);
refresh ();
}
}
@@ -860,7 +858,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
ptr_win->win_chat_cursor_y = ptr_win->win_chat_height - 1;
}
}
wrefresh (ptr_win->win_chat);
wnoutrefresh (ptr_win->win_chat);
refresh ();
}
}
@@ -1058,7 +1056,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
}
}
}
wrefresh (ptr_win->win_nick);
wnoutrefresh (ptr_win->win_nick);
refresh ();
}
}
@@ -1084,15 +1082,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (has_colors ())
wbkgdset(ptr_win->win_status, ' ' | COLOR_PAIR (COLOR_WIN_STATUS));
if (erase)
gui_curses_window_clear (ptr_win->win_status);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_status);
}
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
/* wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */
wmove (ptr_win->win_status, 0, 0);
/* display number of buffers */
@@ -1223,18 +1220,21 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
}
if (!SERVER(ptr_win->buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wprintw (ptr_win->win_status, "%d",
ptr_win->buffer->number);
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);
if (ptr_win->buffer->dcc)
wprintw (ptr_win->win_status, "%d:<DCC> ",
ptr_win->buffer->number);
wprintw (ptr_win->win_status, "<DCC> ");
else
{
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);
_("[not connected]"));
wprintw (ptr_win->win_status, "%s " , string);
free (string);
}
}
@@ -1257,15 +1257,19 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
{
switch (ptr_hotlist->priority)
{
case 0:
case HOTLIST_LOW:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_OTHER);
break;
case 1:
case HOTLIST_MSG:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_MSG);
break;
case 2:
case HOTLIST_PRIVATE:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_PRIVATE);
break;
case HOTLIST_HIGHLIGHT:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_HIGHLIGHT);
break;
@@ -1344,11 +1348,48 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
}
free (string);
wrefresh (ptr_win->win_status);
wnoutrefresh (ptr_win->win_status);
refresh ();
}
}
/*
* gui_draw_buffer_infobar_time: draw time in infobar window
*/
void
gui_draw_buffer_infobar_time (t_gui_buffer *buffer)
{
t_gui_window *ptr_win;
time_t time_seconds;
struct tm *local_time;
/* make gcc happy */
(void) buffer;
if (!gui_ok)
return;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
if (local_time)
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
mvwprintw (ptr_win->win_infobar,
0, 1,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
if (cfg_look_infobar_seconds)
wprintw (ptr_win->win_infobar,
":%02d",
local_time->tm_sec);
}
wnoutrefresh (ptr_win->win_infobar);
}
}
/*
* gui_draw_buffer_infobar: draw infobar window for a buffer
*/
@@ -1369,15 +1410,14 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (has_colors ())
wbkgdset(ptr_win->win_infobar, ' ' | COLOR_PAIR (COLOR_WIN_INFOBAR));
if (erase)
gui_curses_window_clear (ptr_win->win_infobar);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_infobar);
}
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
/* wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */
wmove (ptr_win->win_infobar, 0, 0);
time_seconds = time (NULL);
@@ -1385,16 +1425,31 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
if (local_time)
{
strftime (text_time, 1024, cfg_look_infobar_timestamp, local_time);
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, "[");
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wprintw (ptr_win->win_infobar, "%s", text_time);
wprintw (ptr_win->win_infobar,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
if (cfg_look_infobar_seconds)
wprintw (ptr_win->win_infobar,
":%02d",
local_time->tm_sec);
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, "]");
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wprintw (ptr_win->win_infobar,
" %s", text_time);
}
if (gui_infobar)
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, " | ");
gui_window_set_color (ptr_win->win_infobar, gui_infobar->color);
wprintw (ptr_win->win_infobar, " | %s", gui_infobar->text);
wprintw (ptr_win->win_infobar, "%s", gui_infobar->text);
}
wrefresh (ptr_win->win_infobar);
wnoutrefresh (ptr_win->win_infobar);
refresh ();
}
}
@@ -1445,87 +1500,89 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
{
gui_window_set_color (ptr_win->win_input, COLOR_WIN_INPUT);
wborder (ptr_win->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_input);
wnoutrefresh (ptr_win->win_input);
}
if (buffer->input_buffer_size == 0)
buffer->input_buffer[0] = '\0';
input_width = gui_get_input_width (ptr_win);
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
input_width)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
input_width + 1;
else
if (buffer->dcc)
{
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
else
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : dcc_list;
wmove (ptr_win->win_input, 0, 0);
if (dcc_selected)
{
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1) < input_width)
switch (dcc_selected->status)
{
buffer->input_buffer_1st_display =
buffer->input_buffer_pos - input_width + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
case DCC_WAITING:
if (DCC_IS_RECV(dcc_selected->type))
wprintw (ptr_win->win_input, _(" [A] Accept"));
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_CONNECTING:
case DCC_ACTIVE:
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_DONE:
case DCC_FAILED:
case DCC_ABORTED:
wprintw (ptr_win->win_input, _(" [R] Remove"));
break;
}
}
}
if (CHANNEL(buffer))
{
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
if (ptr_win == gui_current_window)
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
buffer->input_buffer + buffer->input_buffer_1st_display);
else
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
"");
wprintw (ptr_win->win_input, _(" [P] Purge old DCC"));
wprintw (ptr_win->win_input, _(" [Q] Close DCC view"));
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + strlen (CHANNEL(buffer)->name) +
strlen (SERVER(buffer)->nick) + 3 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display));
ptr_win->win_x);
}
else
else if (buffer->has_input)
{
if (buffer->dcc)
if (buffer->input_buffer_size == 0)
buffer->input_buffer[0] = '\0';
input_width = gui_get_input_width (ptr_win);
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
input_width)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
input_width + 1;
else
{
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : dcc_list;
wmove (ptr_win->win_input, 0, 0);
if (dcc_selected)
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
else
{
switch (dcc_selected->status)
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1) < input_width)
{
case DCC_WAITING:
if (DCC_IS_RECV(dcc_selected->type))
wprintw (ptr_win->win_input, _(" [A] Accept"));
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_CONNECTING:
case DCC_ACTIVE:
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_DONE:
case DCC_FAILED:
case DCC_ABORTED:
wprintw (ptr_win->win_input, _(" [R] Remove"));
break;
buffer->input_buffer_1st_display =
buffer->input_buffer_pos - input_width + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
}
}
wprintw (ptr_win->win_input, _(" [P] Purge old DCC"));
wprintw (ptr_win->win_input, _(" [Q] Close DCC view"));
}
if (CHANNEL(buffer))
{
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
if (ptr_win == gui_current_window)
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
buffer->input_buffer + buffer->input_buffer_1st_display);
else
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
"");
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = strlen (CHANNEL(buffer)->name) +
strlen (SERVER(buffer)->nick) + 3 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display);
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
ptr_win->win_x + ptr_win->win_input_x);
}
else
{
@@ -1543,14 +1600,15 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
ptr_nickname,
"");
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = strlen (ptr_nickname) + 2 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display);
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + strlen (ptr_nickname) + 2 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display));
ptr_win->win_x + ptr_win->win_input_x);
}
}
wrefresh (ptr_win->win_input);
wnoutrefresh (ptr_win->win_input);
refresh ();
}
}
@@ -1701,242 +1759,143 @@ gui_get_dcc_buffer ()
}
/*
* gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
* gui_input_page_up: display previous page on buffer
*/
void
gui_switch_to_dcc_buffer ()
gui_input_page_up ()
{
t_gui_buffer *ptr_buffer;
if (!gui_ok)
return;
/* check if dcc buffer exists */
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
if (!gui_current_window->first_line_displayed)
{
if (ptr_buffer->dcc)
break;
}
if (ptr_buffer)
{
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (ptr_buffer);
}
else
gui_buffer_new (gui_current_window, NULL, NULL, 1, 1);
}
/*
* gui_switch_to_previous_buffer: switch to previous buffer
*/
void
gui_switch_to_previous_buffer (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
if (window->buffer->prev_buffer)
gui_switch_to_buffer (window, window->buffer->prev_buffer);
else
gui_switch_to_buffer (window, last_gui_buffer);
gui_redraw_buffer (window->buffer);
}
/*
* gui_switch_to_next_buffer: switch to next buffer
*/
void
gui_switch_to_next_buffer (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
if (window->buffer->next_buffer)
gui_switch_to_buffer (window, window->buffer->next_buffer);
else
gui_switch_to_buffer (window, gui_buffers);
gui_redraw_buffer (window->buffer);
}
/*
* gui_switch_to_previous_window: switch to previous window
*/
void
gui_switch_to_previous_window (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one window then return */
if (gui_windows == last_gui_window)
return;
gui_current_window = (window->prev_window) ? window->prev_window : last_gui_window;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_switch_to_next_window: switch to next window
*/
void
gui_switch_to_next_window (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one window then return */
if (gui_windows == last_gui_window)
return;
gui_current_window = (window->next_window) ? window->next_window : gui_windows;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_move_page_up: display previous page on buffer
*/
void
gui_move_page_up (t_gui_window *window)
{
if (!gui_ok)
return;
if (!window->first_line_displayed)
{
window->sub_lines += window->win_chat_height - 1;
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
gui_current_window->sub_lines +=
gui_current_window->win_chat_height - 1;
gui_draw_buffer_chat (gui_current_window->buffer, 0);
gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
/*
* gui_move_page_down: display next page on buffer
* gui_input_page_down: display next page on buffer
*/
void
gui_move_page_down (t_gui_window *window)
gui_input_page_down ()
{
if (!gui_ok)
return;
if (window->sub_lines > 0)
if (gui_current_window->sub_lines > 0)
{
window->sub_lines -= window->win_chat_height - 1;
if (window->sub_lines < 0)
window->sub_lines = 0;
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
gui_current_window->sub_lines -=
gui_current_window->win_chat_height - 1;
if (gui_current_window->sub_lines < 0)
gui_current_window->sub_lines = 0;
gui_draw_buffer_chat (gui_current_window->buffer, 0);
gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
/*
* gui_nick_move_beginning: go to beginning of nicklist
* gui_input_nick_beginning: go to beginning of nicklist
*/
void
gui_nick_move_beginning (t_gui_window *window)
gui_input_nick_beginning ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if (window->win_nick_start > 0)
if (gui_current_window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start = 0;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_end: go to the end of nicklist
* gui_input_nick_end: go to the end of nicklist
*/
void
gui_nick_move_end (t_gui_window *window)
gui_input_nick_end ()
{
int new_start;
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
new_start = CHANNEL(window->buffer)->nicks_count - window->win_nick_height;
new_start =
CHANNEL(gui_current_window->buffer)->nicks_count -
gui_current_window->win_nick_height;
if (new_start < 0)
new_start = 0;
else if (new_start >= 1)
new_start++;
if (new_start != window->win_nick_start)
if (new_start != gui_current_window->win_nick_start)
{
window->win_nick_start = new_start;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start = new_start;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_page_up: scroll one page up in nicklist
* gui_input_nick_page_up: scroll one page up in nicklist
*/
void
gui_nick_move_page_up (t_gui_window *window)
gui_input_nick_page_up ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if (window->win_nick_start > 0)
if (gui_current_window->win_nick_start > 0)
{
window->win_nick_start -= (window->win_nick_height - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start -=
(gui_current_window->win_nick_height - 1);
if (gui_current_window->win_nick_start <= 1)
gui_current_window->win_nick_start = 0;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_page_down: scroll one page down in nicklist
* gui_input_nick_page_down: scroll one page down in nicklist
*/
void
gui_nick_move_page_down (t_gui_window *window)
gui_input_nick_page_down ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if ((CHANNEL(window->buffer)->nicks_count > window->win_nick_height)
&& (window->win_nick_start + window->win_nick_height - 1 < CHANNEL(window->buffer)->nicks_count))
if ((CHANNEL(gui_current_window->buffer)->nicks_count >
gui_current_window->win_nick_height)
&& (gui_current_window->win_nick_start +
gui_current_window->win_nick_height - 1
< CHANNEL(gui_current_window->buffer)->nicks_count))
{
if (window->win_nick_start == 0)
window->win_nick_start += (window->win_nick_height - 1);
if (gui_current_window->win_nick_start == 0)
gui_current_window->win_nick_start +=
(gui_current_window->win_nick_height - 1);
else
window->win_nick_start += (window->win_nick_height - 2);
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start +=
(gui_current_window->win_nick_height - 2);
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
@@ -2282,6 +2241,10 @@ gui_init_colors ()
cfg_col_chat_prefix1, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_PREFIX2,
cfg_col_chat_prefix2, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_JOIN,
cfg_col_chat_join, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_PART,
cfg_col_chat_part, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_NICK,
cfg_col_chat_nick, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_HOST,
@@ -2298,6 +2261,8 @@ gui_init_colors ()
cfg_col_status_delimiters, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_MSG,
cfg_col_status_data_msg, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_PRIVATE,
cfg_col_status_data_private, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_HIGHLIGHT,
cfg_col_status_data_highlight, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_OTHER,
@@ -2306,6 +2271,8 @@ gui_init_colors ()
cfg_col_status_more, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_DELIMITERS,
cfg_col_infobar_delimiters, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT,
@@ -2366,6 +2333,8 @@ gui_init_colors ()
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_JOIN - 1] = (cfg_col_chat_join >= 0) ? cfg_col_chat_join & A_BOLD : 0;
color_attr[COLOR_WIN_CHAT_PART - 1] = (cfg_col_chat_part >= 0) ? cfg_col_chat_part & 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;
@@ -2374,10 +2343,12 @@ gui_init_colors ()
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_PRIVATE - 1] = (cfg_col_status_data_private >= 0) ? cfg_col_status_data_private & 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_DELIMITERS - 1] = (cfg_col_infobar_delimiters >= 0) ? cfg_col_infobar_delimiters & 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;
@@ -2427,16 +2398,20 @@ gui_init ()
initscr ();
curs_set (1);
keypad (stdscr, TRUE);
noecho ();
nodelay (stdscr, TRUE);
gui_init_colors ();
gui_infobar = NULL;
gui_ok = ((COLS > 5) && (LINES > 5));
refresh ();
/* init clipboard buffer */
gui_input_clipboard = NULL;
/* create new window/buffer */
if (gui_window_new (0, 0, COLS, LINES))
{
@@ -2461,6 +2436,10 @@ gui_end ()
{
t_gui_window *ptr_win;
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
/* delete all windows */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -2507,6 +2486,7 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
{
char *pos;
int length;
char *ptr_string;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (buffer->line_complete)
@@ -2527,6 +2507,13 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
buffer->line_complete = 1;
}
buffer->last_line->last_message->message = strdup (message);
ptr_string = buffer->last_line->last_message->message;
while (ptr_string[0])
{
if ((ptr_string[0] > 0) && (ptr_string[0] < 32))
ptr_string[0] = 32;
ptr_string++;
}
length = strlen (message);
buffer->last_line->length += length;
if (type & MSG_TYPE_MSG)
@@ -2548,9 +2535,14 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
buffer->last_line->line_with_highlight <=
buffer->notify_level)
{
hotlist_add (buffer->last_line->line_with_message +
buffer->last_line->line_with_highlight,
buffer);
if (buffer->last_line->line_with_highlight)
hotlist_add (HOTLIST_HIGHLIGHT, buffer);
else if (BUFFER_IS_PRIVATE(buffer) && (buffer->last_line->line_with_message))
hotlist_add (HOTLIST_PRIVATE, buffer);
else if (buffer->last_line->line_with_message)
hotlist_add (HOTLIST_MSG, buffer);
else
hotlist_add (HOTLIST_LOW, buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
+184 -634
View File
@@ -41,649 +41,191 @@
#include "../../common/fifo.h"
#include "../../irc/irc.h"
#define KEY_ESCAPE 27
/*
* gui_read_keyb: read keyboard line
* gui_input_default_key_bindings: create default key bindings
*/
void
gui_read_keyb ()
gui_input_default_key_bindings ()
{
int i;
char key_str[32], command[32];
/* keys binded with internal functions */
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
/* keys binded with commands */
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
{
sprintf (key_str, "meta-j%02d", i);
sprintf (command, "/buffer %d", i);
gui_key_bind (key_str, command);
}
}
/*
* gui_input_grab_end: insert grabbed key in input buffer
*/
void
gui_input_grab_end ()
{
char *expanded_key;
/* get expanded name (for example: ^U => ctrl-u) */
expanded_key = gui_key_get_expanded_name (gui_key_buffer);
if (expanded_key)
{
if (gui_current_window->buffer->has_input)
{
gui_input_insert_string (expanded_key, -1);
gui_current_window->buffer->input_buffer_pos += strlen (expanded_key);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
free (expanded_key);
}
/* end grab mode */
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_key_buffer[0] = '\0';
}
/*
* gui_input_read: read keyboard chars
*/
void
gui_input_read ()
{
int key, i;
t_gui_buffer *ptr_buffer;
t_irc_server *ptr_server;
t_irc_dcc *ptr_dcc, *ptr_dcc_next;
char new_char[3], *decoded_string;
t_irc_dcc *dcc_selected;
key = getch ();
if (key != ERR)
char key_str[32];
i = 0;
/* do not loop too much here (for example when big paste was made),
to read also socket & co */
while (i < 8)
{
switch (key)
if (gui_key_grab && (gui_key_grab_count > 10))
gui_input_grab_end ();
key = getch ();
if (key == ERR)
{
/* resize event */
case KEY_RESIZE:
gui_curses_resize_handler ();
break;
/* inactive function keys */
case KEY_F(1):
case KEY_F(2):
case KEY_F(3):
case KEY_F(4):
case KEY_F(9):
break;
/* previous buffer in window */
case KEY_F(5):
gui_switch_to_previous_buffer (gui_current_window);
break;
/* next buffer in window */
case KEY_F(6):
gui_switch_to_next_buffer (gui_current_window);
break;
/* previous window */
case KEY_F(7):
gui_switch_to_previous_window (gui_current_window);
break;
/* next window */
case KEY_F(8):
gui_switch_to_next_window (gui_current_window);
break;
/* remove last infobar message */
case KEY_F(10):
gui_infobar_remove ();
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
break;
case KEY_F(11):
gui_nick_move_page_up (gui_current_window);
break;
case KEY_F(12):
gui_nick_move_page_down (gui_current_window);
break;
/* cursor up */
case KEY_UP:
if (gui_current_window->buffer->dcc)
{
if (dcc_list)
{
if (gui_current_window->dcc_selected
&& ((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
{
if (gui_current_window->dcc_selected ==
gui_current_window->dcc_first)
gui_current_window->dcc_first =
((t_irc_dcc *)(gui_current_window->dcc_first))->prev_dcc;
gui_current_window->dcc_selected =
((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
gui_draw_buffer_chat (gui_current_window->buffer, 1);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
}
}
else
{
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->ptr_history->next_history;
if (!gui_current_window->buffer->ptr_history)
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
}
else
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->input_buffer_size =
strlen (gui_current_window->buffer->ptr_history->text);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor down */
case KEY_DOWN:
if (gui_current_window->buffer->dcc)
{
if (dcc_list)
{
if (!gui_current_window->dcc_selected
|| ((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc)
{
if (gui_current_window->dcc_last_displayed
&& (gui_current_window->dcc_selected ==
gui_current_window->dcc_last_displayed))
{
if (gui_current_window->dcc_first)
gui_current_window->dcc_first =
((t_irc_dcc *)(gui_current_window->dcc_first))->next_dcc;
else
gui_current_window->dcc_first =
dcc_list->next_dcc;
}
if (gui_current_window->dcc_selected)
gui_current_window->dcc_selected =
((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc;
else
gui_current_window->dcc_selected =
dcc_list->next_dcc;
gui_draw_buffer_chat (gui_current_window->buffer, 1);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
}
}
else
{
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->ptr_history->prev_history;
if (gui_current_window->buffer->ptr_history)
gui_current_window->buffer->input_buffer_size =
strlen (gui_current_window->buffer->ptr_history->text);
else
gui_current_window->buffer->input_buffer_size = 0;
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
if (gui_current_window->buffer->ptr_history)
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor left */
case KEY_LEFT:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
gui_current_window->buffer->input_buffer_pos--;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor right */
case KEY_RIGHT:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
gui_current_window->buffer->input_buffer_pos++;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* home key or Control + A */
case KEY_HOME:
case 0x01:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
gui_current_window->buffer->input_buffer_pos = 0;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* end key or Control + E */
case KEY_END:
case 0x05:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* page up */
case KEY_PPAGE:
if (!gui_current_window->buffer->dcc)
gui_move_page_up (gui_current_window);
break;
/* page down */
case KEY_NPAGE:
if (!gui_current_window->buffer->dcc)
gui_move_page_down (gui_current_window);
break;
/* erase before cursor and move cursor to the left */
case 127:
case KEY_BACKSPACE:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
i = gui_current_window->buffer->input_buffer_pos-1;
while (gui_current_window->buffer->input_buffer[i])
{
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i+1];
i++;
}
gui_current_window->buffer->input_buffer_size--;
gui_current_window->buffer->input_buffer_pos--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_draw_buffer_input (gui_current_window->buffer, 0);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->completion.position = -1;
}
}
break;
/* Control + Backspace or Control + W */
case 0x08:
case 0x17:
if (!gui_current_window->buffer->dcc)
gui_delete_previous_word (gui_current_window->buffer);
break;
/* Control + L */
case 0x0C:
gui_curses_resize_handler ();
break;
/* erase char under cursor */
case KEY_DC:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
i = gui_current_window->buffer->input_buffer_pos;
while (gui_current_window->buffer->input_buffer[i])
{
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i+1];
i++;
}
gui_current_window->buffer->input_buffer_size--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_draw_buffer_input (gui_current_window->buffer, 0);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->completion.position = -1;
}
}
break;
/* Tab : completion */
case '\t':
if (!gui_current_window->buffer->dcc)
{
completion_search (&(gui_current_window->buffer->completion),
CHANNEL(gui_current_window->buffer),
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 */
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--)
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i -
gui_current_window->buffer->completion.diff_size];
}
else
{
for (i = gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
i < gui_current_window->buffer->input_buffer_size; i++)
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,
gui_current_window->buffer->completion.word_found,
strlen (gui_current_window->buffer->completion.word_found));
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
/* 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.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);
if (gui_current_window->buffer->completion.position >= 0)
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
else
{
/* 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);
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);
if (gui_current_window->buffer->completion.position >= 0)
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
}
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* escape code (for control-key) */
case KEY_ESCAPE:
if ((key = getch()) != ERR)
{
/*gui_printf (gui_current_window->buffer,
"[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
switch (key)
{
/* Alt + left arrow */
case KEY_LEFT:
gui_switch_to_previous_buffer (gui_current_window);
break;
/* Alt + right arrow */
case KEY_RIGHT:
gui_switch_to_next_buffer (gui_current_window);
break;
/* Alt + home */
case KEY_HOME:
gui_nick_move_beginning (gui_current_window);
break;
/* Alt + end */
case KEY_END:
gui_nick_move_end (gui_current_window);
break;
/* Alt + page up */
case KEY_PPAGE:
gui_nick_move_page_up (gui_current_window);
break;
/* Alt + page down */
case KEY_NPAGE:
gui_nick_move_page_down (gui_current_window);
break;
case 79:
/* TODO: replace 79 by constant name! */
if ((key = getch()) != ERR)
{
switch (key)
{
/* Control + Right */
case 99:
if (!gui_current_window->buffer->dcc)
gui_move_next_word (gui_current_window->buffer);
break;
/* Control + Left */
case 100:
if (!gui_current_window->buffer->dcc)
gui_move_previous_word (gui_current_window->buffer);
break;
}
}
break;
/* Alt-number: jump to window by number */
case 48: /* Alt-0 */
case 49: /* Alt-1 */
case 50: /* Alt-2 */
case 51: /* Alt-3 */
case 52: /* Alt-4 */
case 53: /* Alt-5 */
case 54: /* Alt-6 */
case 55: /* Alt-7 */
case 56: /* Alt-8 */
case 57: /* Alt-9 */
gui_switch_to_buffer_by_number (gui_current_window, (key == 48) ? 10 : key - 48);
break;
/* Alt-A: jump to buffer with activity */
case 'a':
case 'A':
if (hotlist)
{
if (!hotlist_initial_buffer)
hotlist_initial_buffer = gui_current_window->buffer;
gui_switch_to_buffer (gui_current_window, hotlist->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
else
{
if (hotlist_initial_buffer)
{
gui_switch_to_buffer (gui_current_window, hotlist_initial_buffer);
gui_redraw_buffer (gui_current_window->buffer);
hotlist_initial_buffer = NULL;
}
}
break;
/* Alt-D: jump to DCC buffer */
case 'd':
case 'D':
if (gui_current_window->buffer->dcc)
{
if (buffer_before_dcc)
{
gui_switch_to_buffer (gui_current_window,
buffer_before_dcc);
gui_redraw_buffer (gui_current_window->buffer);
}
}
else
{
buffer_before_dcc = gui_current_window->buffer;
gui_switch_to_dcc_buffer ();
}
break;
/* Alt-R: clear hotlist */
case 'r':
case 'R':
if (hotlist)
{
hotlist_free_all ();
gui_redraw_buffer (gui_current_window->buffer);
}
hotlist_initial_buffer = gui_current_window->buffer;
break;
/* Alt-S: jump to server buffer */
case 's':
case 'S':
if (!gui_current_window->buffer->dcc)
{
if (SERVER(gui_current_window->buffer)->buffer !=
gui_current_window->buffer)
{
gui_switch_to_buffer (gui_current_window,
SERVER(gui_current_window->buffer)->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
}
break;
/* Alt-X: jump to first channel/private of next server */
case 'x':
case 'X':
if (!gui_current_window->buffer->dcc)
{
ptr_server = SERVER(gui_current_window->buffer)->next_server;
if (!ptr_server)
ptr_server = irc_servers;
while (ptr_server != SERVER(gui_current_window->buffer))
{
if (ptr_server->buffer)
break;
ptr_server = (ptr_server->next_server) ?
ptr_server->next_server : irc_servers;
}
if (ptr_server != SERVER(gui_current_window->buffer))
{
ptr_buffer = (ptr_server->channels) ?
ptr_server->channels->buffer : ptr_server->buffer;
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
}
break;
}
}
break;
/* send command/message */
case '\n':
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_pos = 0;
gui_current_window->buffer->input_buffer_1st_display = 0;
gui_current_window->buffer->completion.position = -1;
gui_current_window->buffer->ptr_history = NULL;
ptr_buffer = gui_current_window->buffer;
user_command (SERVER(gui_current_window->buffer),
gui_current_window->buffer,
gui_current_window->buffer->input_buffer);
if (ptr_buffer == gui_current_window->buffer)
{
ptr_buffer->input_buffer[0] = '\0';
gui_draw_buffer_input (ptr_buffer, 0);
}
}
}
break;
/* other key => add to input buffer */
default:
if (gui_current_window->buffer->dcc)
{
dcc_selected = (gui_current_window->dcc_selected) ?
(t_irc_dcc *) gui_current_window->dcc_selected : dcc_list;
switch (key)
{
/* accept DCC */
case 'a':
case 'A':
if (dcc_selected
&& (DCC_IS_RECV(dcc_selected->status))
&& (dcc_selected->status == DCC_WAITING))
{
dcc_accept (dcc_selected);
}
break;
/* cancel DCC */
case 'c':
case 'C':
if (dcc_selected
&& (!DCC_ENDED(dcc_selected->status)))
{
dcc_close (dcc_selected, DCC_ABORTED);
gui_redraw_buffer (gui_current_window->buffer);
}
break;
/* purge old DCC */
case 'p':
case 'P':
gui_current_window->dcc_selected = NULL;
ptr_dcc = dcc_list;
while (ptr_dcc)
{
ptr_dcc_next = ptr_dcc->next_dcc;
if (DCC_ENDED(ptr_dcc->status))
dcc_free (ptr_dcc);
ptr_dcc = ptr_dcc_next;
}
gui_redraw_buffer (gui_current_window->buffer);
break;
/* close DCC window */
case 'q':
case 'Q':
if (buffer_before_dcc)
{
gui_buffer_free (gui_current_window->buffer, 1);
gui_switch_to_buffer (gui_current_window,
buffer_before_dcc);
}
else
gui_buffer_free (gui_current_window->buffer, 1);
gui_redraw_buffer (gui_current_window->buffer);
break;
/* remove from DCC list */
case 'r':
case 'R':
if (dcc_selected
&& (DCC_ENDED(dcc_selected->status)))
{
if (dcc_selected->next_dcc)
gui_current_window->dcc_selected = dcc_selected->next_dcc;
else
gui_current_window->dcc_selected = NULL;
dcc_free (dcc_selected);
gui_redraw_buffer (gui_current_window->buffer);
}
break;
}
}
else
{
/*gui_printf (gui_current_window->buffer,
"[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,
(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;
if (gui_key_grab && (gui_key_grab_count > 0))
gui_input_grab_end ();
break;
}
if (key == KEY_RESIZE)
{
gui_curses_resize_handler ();
continue;
}
if (key < 32)
{
key_str[0] = '^';
key_str[1] = (char) key + '@';
key_str[2] = '\0';
}
else if (key == 127)
{
key_str[0] = '^';
key_str[1] = '?';
key_str[2] = '\0';
}
else
{
if (key > 0xff)
{
key_str[0] = (char) (key >> 8);
key_str[1] = (char) (key & 0xff);
key_str[2] = '\0';
}
else
{
key_str[0] = (char) key;
key_str[1] = '\0';
}
}
if (strcmp (key_str, "^") == 0)
{
key_str[1] = '^';
key_str[2] = '\0';
}
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
if (gui_key_pressed (key_str) != 0)
gui_input_insert_char (key);
i++;
}
}
@@ -723,6 +265,14 @@ gui_main_loop ()
{
old_sec = local_time->tm_sec;
if (cfg_look_infobar_seconds)
{
gui_draw_buffer_infobar_time (gui_current_window->buffer);
wmove (gui_current_window->win_input,
0, gui_current_window->win_input_x);
wrefresh (gui_current_window->win_input);
}
/* infobar count down */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
@@ -807,7 +357,7 @@ gui_main_loop ()
{
if (FD_ISSET (STDIN_FILENO, &read_fd))
{
gui_read_keyb ();
gui_input_read ();
}
if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd)))
{
+1036 -100
View File
File diff suppressed because it is too large Load Diff
+559
View File
@@ -0,0 +1,559 @@
/*
* 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
*/
/* gui-keyboard: keyboard functions (GUI independant) */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../common/weechat.h"
#include "gui.h"
#include "../common/command.h"
t_gui_key *gui_keys = NULL;
t_gui_key *last_gui_key = NULL;
char gui_key_buffer[128];
int gui_key_grab = 0;
int gui_key_grab_count = 0;
t_gui_key_function gui_key_functions[] =
{ { "return", gui_input_return,
N_("terminate line") },
{ "tab", gui_input_tab,
N_("complete word") },
{ "backspace", gui_input_backspace,
N_("delete previous char") },
{ "delete", gui_input_delete,
N_("delete next char") },
{ "delete_end_line", gui_input_delete_end_of_line,
N_("delete until end of line") },
{ "delete_beginning_line", gui_input_delete_begin_of_line,
N_("delete until beginning of line") },
{ "delete_line", gui_input_delete_line,
N_("delete entire line") },
{ "delete_previous_word", gui_input_delete_previous_word,
N_("delete previous word") },
{ "delete_next_word", gui_input_delete_next_word,
N_("delete next word") },
{ "clipboard_paste", gui_input_clipboard_paste,
N_("paste current clipboard content") },
{ "transpose_chars", gui_input_transpose_chars,
N_("transpose chars") },
{ "home", gui_input_home,
N_("go to beginning of line") },
{ "end", gui_input_end,
N_("go to end of line") },
{ "left", gui_input_left,
N_("move one char left") },
{ "previous_word", gui_input_previous_word,
N_("move to previous word") },
{ "right", gui_input_right,
N_("move one char right") },
{ "next_word", gui_input_next_word,
N_("move to next word") },
{ "up", gui_input_up,
N_("call previous command in history") },
{ "down", gui_input_down,
N_("call next command in history") },
{ "page_up", gui_input_page_up,
N_("scroll one page up") },
{ "page_down", gui_input_page_down,
N_("scroll one page down") },
{ "infobar_clear", gui_input_infobar_clear,
N_("clear infobar") },
{ "nick_page_up", gui_input_nick_page_up,
N_("scroll nicklist one page up") },
{ "nick_page_down", gui_input_nick_page_down,
N_("scroll nicklist one page down") },
{ "nick_beginning", gui_input_nick_beginning,
N_("display beginning of nicklist") },
{ "nick_end", gui_input_nick_end,
N_("display end of nicklist") },
{ "refresh", gui_curses_resize_handler,
N_("refresh screen") },
{ "jump_smart", gui_input_jump_smart,
N_("jump to buffer with activity") },
{ "jump_dcc", gui_input_jump_dcc,
N_("jump to DCC buffer") },
{ "jump_last_buffer", gui_input_jump_last_buffer,
N_("jump to last buffer") },
{ "jump_server", gui_input_jump_server,
N_("jump to server buffer") },
{ "jump_next_server", gui_input_jump_next_server,
N_("jump to next server") },
{ "hotlist_clear", gui_input_hotlist_clear,
N_("clear hotlist") },
{ "grab_key", gui_input_grab_key,
N_("grab a key") },
{ NULL, NULL, NULL }
};
/*
* gui_key_init: init keyboard (create default key bindings)
*/
void
gui_key_init ()
{
gui_key_buffer[0] = '\0';
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_input_default_key_bindings ();
}
/*
* gui_key_init_show: init "show mode"
*/
void
gui_key_init_grab ()
{
gui_key_grab = 1;
gui_key_grab_count = 0;
}
/*
* gui_key_get_internal_code: get internal code from user key name
* for example: return "^R" for "ctrl-R"
*/
char *
gui_key_get_internal_code (char *key)
{
char *result;
if ((result = (char *) malloc (strlen (key) + 1)))
{
result[0] = '\0';
while (key[0])
{
if (strncasecmp (key, "meta2-", 6) == 0)
{
strcat (result, "^[[");
key += 6;
}
if (strncasecmp (key, "meta-", 5) == 0)
{
strcat (result, "^[");
key += 5;
}
else if (strncasecmp (key, "ctrl-", 5) == 0)
{
strcat (result, "^");
key += 5;
}
else
{
strncat (result, key, 1);
key++;
}
}
}
else
return NULL;
return result;
}
/*
* gui_key_get_expanded_name: get expanded name from internal key code
* for example: return "ctrl-R" for "^R"
*/
char *
gui_key_get_expanded_name (char *key)
{
char *result;
if ((result = (char *) malloc ((strlen (key) * 5) + 1)))
{
result[0] = '\0';
while (key[0])
{
if (strncasecmp (key, "^[[", 3) == 0)
{
strcat (result, "meta2-");
key += 3;
}
if (strncasecmp (key, "^[", 2) == 0)
{
strcat (result, "meta-");
key += 2;
}
else if ((key[0] == '^') && (key[1]))
{
strcat (result, "ctrl-");
key++;
}
else
{
strncat (result, key, 1);
key++;
}
}
}
else
return NULL;
return result;
}
/*
* gui_key_find_pos: find position for a key (for sorting keys list)
*/
t_gui_key *
gui_key_find_pos (t_gui_key *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (strcasecmp (key->key, ptr_key->key) < 0)
return ptr_key;
}
return NULL;
}
/*
* gui_key_insert_sorted: insert key into sorted list
*/
void
gui_key_insert_sorted (t_gui_key *key)
{
t_gui_key *pos_key;
if (gui_keys)
{
pos_key = gui_key_find_pos (key);
if (pos_key)
{
/* insert key into the list (before key found) */
key->prev_key = pos_key->prev_key;
key->next_key = pos_key;
if (pos_key->prev_key)
pos_key->prev_key->next_key = key;
else
gui_keys = key;
pos_key->prev_key = key;
}
else
{
/* add key to the end */
key->prev_key = last_gui_key;
key->next_key = NULL;
last_gui_key->next_key = key;
last_gui_key = key;
}
}
else
{
key->prev_key = NULL;
key->next_key = NULL;
gui_keys = key;
last_gui_key = key;
}
}
/*
* gui_key_new: add a new key in keys list
*/
t_gui_key *
gui_key_new (char *key, char *command, void *function)
{
t_gui_key *new_key;
char *internal_code;
if ((new_key = (t_gui_key *) malloc (sizeof (t_gui_key))))
{
internal_code = gui_key_get_internal_code (key);
new_key->key = (internal_code) ? strdup (internal_code) : strdup (key);
if (internal_code)
free (internal_code);
new_key->command = (command) ? strdup (command) : NULL;
new_key->function = function;
gui_key_insert_sorted (new_key);
}
else
return NULL;
return new_key;
}
/*
* gui_key_search: search a key
*/
t_gui_key *
gui_key_search (char *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (strcasecmp (ptr_key->key, key) == 0)
return ptr_key;
}
/* key not found */
return NULL;
}
/*
* gui_key_cmp: compares 2 keys
*/
int
gui_key_cmp (char *key, char *search)
{
while (search[0])
{
if (toupper(key[0]) != toupper(search[0]))
return search[0] - key[0];
key++;
search++;
}
return 0;
}
/*
* gui_key_search_part: search a key (maybe part of string)
*/
t_gui_key *
gui_key_search_part (char *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (gui_key_cmp (ptr_key->key, key) == 0)
return ptr_key;
}
/* key not found */
return NULL;
}
/*
* gui_key_function_search_by_name: search a function by name
*/
void *
gui_key_function_search_by_name (char *name)
{
int i;
i = 0;
while (gui_key_functions[i].function_name)
{
if (strcasecmp (gui_key_functions[i].function_name, name) == 0)
return gui_key_functions[i].function;
i++;
}
/* function not found */
return NULL;
}
/*
* gui_key_function_search_by_ptr: search a function by pointer
*/
char *
gui_key_function_search_by_ptr (void *function)
{
int i;
i = 0;
while (gui_key_functions[i].function_name)
{
if (gui_key_functions[i].function == function)
return gui_key_functions[i].function_name;
i++;
}
/* function not found */
return NULL;
}
/*
* gui_key_bind: bind a key to a function (command or special function)
*/
t_gui_key *
gui_key_bind (char *key, char *command)
{
t_gui_key_function *ptr_function;
t_gui_key *new_key;
if (!key || !command)
{
wee_log_printf (_("%s unable to bind key \"%s\"\n"),
WEECHAT_ERROR, key);
return NULL;
}
ptr_function = NULL;
if (command[0] != '/')
{
ptr_function = gui_key_function_search_by_name (command);
if (!ptr_function)
{
wee_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
WEECHAT_ERROR, key, command);
return NULL;
}
}
gui_key_unbind (key);
new_key = gui_key_new (key,
(ptr_function) ? NULL : command,
ptr_function);
if (!new_key)
{
wee_log_printf (_("%s not enough memory for key binding\n"),
WEECHAT_ERROR);
return NULL;
}
return new_key;
}
/*
* gui_key_unbind: remove a key binding
*/
int
gui_key_unbind (char *key)
{
t_gui_key *ptr_key;
char *internal_code;
internal_code = gui_key_get_internal_code (key);
ptr_key = gui_key_search ((internal_code) ? internal_code : key);
if (ptr_key)
gui_key_free (ptr_key);
if (internal_code)
free (internal_code);
return (ptr_key != NULL);
}
/*
* gui_key_pressed: treat new key pressed
* return: 1 if key should be added to input buffer
* 0 otherwise
*/
int
gui_key_pressed (char *key_str)
{
int first_key;
t_gui_key *ptr_key;
/* add key to buffer */
first_key = (gui_key_buffer[0] == '\0');
strcat (gui_key_buffer, key_str);
/* if we are in "show mode", increase counter and return */
if (gui_key_grab)
{
gui_key_grab_count++;
return 0;
}
/* look for key combo in key table */
ptr_key = gui_key_search_part (gui_key_buffer);
if (ptr_key)
{
if (strcasecmp (ptr_key->key, gui_key_buffer) == 0)
{
/* exact combo found => execute function or command */
gui_key_buffer[0] = '\0';
if (ptr_key->command)
user_command (SERVER(gui_current_window->buffer),
gui_current_window->buffer,
ptr_key->command);
else
(void)(ptr_key->function)();
}
return 0;
}
gui_key_buffer[0] = '\0';
/* if this is first key and not found (even partial) => return 1
else return 0 (= silently discard sequence of bad keys) */
return first_key;
}
/*
* key_free: delete a key binding
*/
void
gui_key_free (t_gui_key *key)
{
/* free memory */
if (key->key)
free (key->key);
if (key->command)
free (key->command);
/* remove key from keys list */
if (key->prev_key)
key->prev_key->next_key = key->next_key;
if (key->next_key)
key->next_key->prev_key = key->prev_key;
if (gui_keys == key)
gui_keys = key->next_key;
if (last_gui_key == key)
last_gui_key = key->prev_key;
free (key);
}
/*
* gui_key_free_all: delete all key bindings
*/
void
gui_key_free_all ()
{
while (gui_keys)
gui_key_free (gui_keys);
}
+134 -55
View File
@@ -26,50 +26,54 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 50
#define NUM_COLORS 54
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
#define COLOR_WIN_CHAT_TIME_SEP 4
#define COLOR_WIN_CHAT_PREFIX1 5
#define COLOR_WIN_CHAT_PREFIX2 6
#define COLOR_WIN_CHAT_NICK 7
#define COLOR_WIN_CHAT_HOST 8
#define COLOR_WIN_CHAT_CHANNEL 9
#define COLOR_WIN_CHAT_DARK 10
#define COLOR_WIN_CHAT_HIGHLIGHT 11
#define COLOR_WIN_STATUS 12
#define COLOR_WIN_STATUS_DELIMITERS 13
#define COLOR_WIN_STATUS_DATA_MSG 14
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
#define COLOR_WIN_STATUS_DATA_OTHER 16
#define COLOR_WIN_STATUS_MORE 17
#define COLOR_WIN_INFOBAR 18
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
#define COLOR_WIN_INPUT 20
#define COLOR_WIN_INPUT_CHANNEL 21
#define COLOR_WIN_INPUT_NICK 22
#define COLOR_WIN_NICK 23
#define COLOR_WIN_NICK_AWAY 24
#define COLOR_WIN_NICK_CHANOWNER 25
#define COLOR_WIN_NICK_CHANADMIN 26
#define COLOR_WIN_NICK_OP 27
#define COLOR_WIN_NICK_HALFOP 28
#define COLOR_WIN_NICK_VOICE 29
#define COLOR_WIN_NICK_MORE 30
#define COLOR_WIN_NICK_SEP 31
#define COLOR_WIN_NICK_SELF 32
#define COLOR_WIN_NICK_PRIVATE 33
#define COLOR_WIN_NICK_FIRST 34
#define COLOR_WIN_NICK_LAST 43
#define COLOR_WIN_CHAT_JOIN 7
#define COLOR_WIN_CHAT_PART 8
#define COLOR_WIN_CHAT_NICK 9
#define COLOR_WIN_CHAT_HOST 10
#define COLOR_WIN_CHAT_CHANNEL 11
#define COLOR_WIN_CHAT_DARK 12
#define COLOR_WIN_CHAT_HIGHLIGHT 13
#define COLOR_WIN_STATUS 14
#define COLOR_WIN_STATUS_DELIMITERS 15
#define COLOR_WIN_STATUS_DATA_MSG 16
#define COLOR_WIN_STATUS_DATA_PRIVATE 17
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 18
#define COLOR_WIN_STATUS_DATA_OTHER 19
#define COLOR_WIN_STATUS_MORE 20
#define COLOR_WIN_INFOBAR 21
#define COLOR_WIN_INFOBAR_DELIMITERS 22
#define COLOR_WIN_INFOBAR_HIGHLIGHT 23
#define COLOR_WIN_INPUT 24
#define COLOR_WIN_INPUT_CHANNEL 25
#define COLOR_WIN_INPUT_NICK 26
#define COLOR_WIN_NICK 27
#define COLOR_WIN_NICK_AWAY 28
#define COLOR_WIN_NICK_CHANOWNER 29
#define COLOR_WIN_NICK_CHANADMIN 30
#define COLOR_WIN_NICK_OP 31
#define COLOR_WIN_NICK_HALFOP 32
#define COLOR_WIN_NICK_VOICE 33
#define COLOR_WIN_NICK_MORE 34
#define COLOR_WIN_NICK_SEP 35
#define COLOR_WIN_NICK_SELF 36
#define COLOR_WIN_NICK_PRIVATE 37
#define COLOR_WIN_NICK_FIRST 38
#define COLOR_WIN_NICK_LAST 47
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define COLOR_DCC_SELECTED 44
#define COLOR_DCC_WAITING 45
#define COLOR_DCC_CONNECTING 46
#define COLOR_DCC_ACTIVE 47
#define COLOR_DCC_DONE 48
#define COLOR_DCC_FAILED 49
#define COLOR_DCC_ABORTED 50
#define COLOR_DCC_SELECTED 48
#define COLOR_DCC_WAITING 49
#define COLOR_DCC_CONNECTING 50
#define COLOR_DCC_ACTIVE 51
#define COLOR_DCC_DONE 52
#define COLOR_DCC_FAILED 53
#define COLOR_DCC_ABORTED 54
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
@@ -102,6 +106,9 @@
#define NOTIFY_LEVEL_MAX 3
#define NOTIFY_LEVEL_DEFAULT NOTIFY_LEVEL_MAX
#define KEY_SHOW_MODE_DISPLAY 1
#define KEY_SHOW_MODE_BIND 2
typedef struct t_gui_message t_gui_message;
struct t_gui_message
@@ -178,6 +185,7 @@ struct t_gui_buffer
FILE *log_file; /* for logging buffer to file */
/* inupt buffer */
int has_input; /* = 1 if buffer has input (DCC has not)*/
char *input_buffer; /* input buffer */
int input_buffer_alloc; /* input buffer: allocated size in mem */
int input_buffer_size; /* buffer size (user input length) */
@@ -219,6 +227,9 @@ struct t_gui_window
int win_nick_height; /* height of nick window */
int win_nick_start; /* # of 1st nick for display (scroll) */
/* input window settings */
int win_input_x; /* position of cursor in input window */
/* windows for Curses GUI */
void *win_title; /* title window */
void *win_chat; /* chat window (example: channel) */
@@ -252,6 +263,26 @@ struct t_gui_window
t_gui_window *next_window; /* link to next window */
};
typedef struct t_gui_key t_gui_key;
struct t_gui_key
{
char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */
char *command; /* associated command (may be NULL) */
void (*function)(); /* associated function (if cmd is NULL) */
t_gui_key *prev_key; /* link to previous key */
t_gui_key *next_key; /* link to next key */
};
typedef struct t_gui_key_function t_gui_key_function;
struct t_gui_key_function
{
char *function_name; /* name of function */
void (*function)(); /* associated function */
char *description; /* description of function */
};
/* variables */
extern int gui_init_ok;
@@ -264,8 +295,15 @@ extern t_gui_buffer *gui_buffers;
extern t_gui_buffer *last_gui_buffer;
extern t_gui_buffer *buffer_before_dcc;
extern t_gui_infobar *gui_infobar;
extern t_gui_key *gui_keys;
extern t_gui_key *last_gui_key;
extern t_gui_key_function gui_key_functions[];
extern char gui_key_buffer[128];
extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
/* GUI independent functions */
/* GUI independent functions: windows & buffers */
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);
@@ -277,17 +315,61 @@ extern void gui_infobar_remove ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_new_line (t_gui_buffer *);
extern t_gui_message *gui_new_message (t_gui_buffer *);
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
extern void gui_delete_previous_word (t_gui_buffer *);
extern void gui_move_previous_word (t_gui_buffer *);
extern void gui_move_next_word (t_gui_buffer *);
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
extern void gui_input_clipboard_copy (char *, int);
extern void gui_input_clipboard_paste ();
extern void gui_input_insert_string (char *, int);
extern void gui_input_insert_char ();
extern void gui_input_return ();
extern void gui_input_tab ();
extern void gui_input_backspace ();
extern void gui_input_delete ();
extern void gui_input_delete_previous_word ();
extern void gui_input_delete_next_word ();
extern void gui_input_delete_begin_of_line ();
extern void gui_input_delete_end_of_line ();
extern void gui_input_delete_line ();
extern void gui_input_transpose_chars ();
extern void gui_input_home ();
extern void gui_input_end ();
extern void gui_input_left ();
extern void gui_input_previous_word ();
extern void gui_input_right ();
extern void gui_input_next_word ();
extern void gui_input_up ();
extern void gui_input_down ();
extern void gui_input_jump_smart ();
extern void gui_input_jump_dcc ();
extern void gui_input_jump_last_buffer ();
extern void gui_input_jump_server ();
extern void gui_input_jump_next_server ();
extern void gui_input_hotlist_clear ();
extern void gui_input_infobar_clear ();
extern void gui_input_grab_key ();
extern void gui_switch_to_previous_buffer ();
extern void gui_switch_to_next_buffer ();
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_switch_to_dcc_buffer ();
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);
extern void gui_window_print_log (t_gui_window *);
extern void gui_buffer_print_log (t_gui_buffer *);
/* GUI dependant functions */
/* GUI independent functions: keys */
extern void gui_key_init ();
extern void gui_key_init_grab ();
extern char *gui_key_get_internal_code (char *);
extern char *gui_key_get_expanded_name (char *);
extern void *gui_key_function_search_by_name (char *);
extern char *gui_key_function_search_by_ptr (void *);
extern t_gui_key *gui_key_bind (char *, char *);
extern int gui_key_unbind (char *);
extern int gui_key_pressed (char *);
extern void gui_key_free (t_gui_key *);
extern void gui_key_free_all ();
/* GUI dependant functions: display */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
@@ -298,22 +380,18 @@ extern void gui_draw_buffer_title (t_gui_buffer *, int);
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
extern void gui_draw_buffer_status (t_gui_buffer *, int);
extern void gui_draw_buffer_infobar_time (t_gui_buffer *);
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
extern void gui_draw_buffer_input (t_gui_buffer *, int);
extern void gui_redraw_buffer (t_gui_buffer *);
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
extern t_gui_buffer *gui_get_dcc_buffer ();
extern void gui_switch_to_dcc_buffer ();
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_previous_window (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_move_page_up (t_gui_window *);
extern void gui_move_page_down (t_gui_window *);
extern void gui_nick_move_beginning (t_gui_window *);
extern void gui_nick_move_end (t_gui_window *);
extern void gui_nick_move_page_up (t_gui_window *);
extern void gui_nick_move_page_down (t_gui_window *);
extern void gui_input_page_up ();
extern void gui_input_page_down ();
extern void gui_input_nick_beginning ();
extern void gui_input_nick_end ();
extern void gui_input_nick_page_up ();
extern void gui_input_nick_page_down ();
extern void gui_curses_resize_handler ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_window_split_horiz (t_gui_window *);
@@ -330,6 +408,7 @@ extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_end ();
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
extern void gui_input_default_key_bindings ();
extern void gui_main_loop ();
#endif /* gui.h */
+9 -9
View File
@@ -90,7 +90,15 @@ void
channel_free (t_irc_server *server, t_irc_channel *channel)
{
t_irc_channel *new_channels;
/* close DCC CHAT */
if ((t_irc_dcc *)(channel->dcc_chat) &&
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
{
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
dcc_redraw (1);
}
/* remove channel from queue */
if (server->last_channel == channel)
server->last_channel = channel->prev_channel;
@@ -104,14 +112,6 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
if (channel->next_channel)
(channel->next_channel)->prev_channel = channel->prev_channel;
/* close DCC CHAT */
if ((t_irc_dcc *)(channel->dcc_chat) &&
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
{
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
dcc_redraw (1);
}
/* free data */
if (channel->name)
+133 -104
View File
@@ -35,6 +35,10 @@ t_irc_command irc_commands[] =
N_("[target]"),
N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_admin, NULL },
{ "amsg", N_("send message to all channels of all connected servers"),
N_("text"),
N_("text: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_amsg, NULL },
{ "away", N_("toggle away status"),
N_("[-all] [message]"),
N_("-all: toggle away status on all connected servers\n"
@@ -42,11 +46,14 @@ t_irc_command irc_commands[] =
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
{ "ban", N_("bans nicks or hosts"),
N_("[channel] [nickname [nickname ...]]"),
N_("channel: channel for ban\nnickname: user or host to ban"),
N_("channel: channel for ban\n"
"nickname: user or host to ban"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
{ "ctcp", N_("send a ctcp message"),
N_("nickname type"),
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
N_("nickname type [arguments]"),
N_("nickname: user to send CTCP to\n"
"type: CTCP type (examples: \"version\", \"ping\", ..)\n"
"arguments: arguments for CTCP"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
{ "dcc", N_("starts DCC (file or chat) or close chat"),
N_("action [nickname [file]]"),
@@ -55,28 +62,29 @@ t_irc_command irc_commands[] =
"file: filename (on local host)"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL },
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
{ "deop", N_("removes channel operator status from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
{ "devoice", N_("removes voice from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
{ "die", N_("shutdown the server"),
"", "",
0, 0, 1, NULL, irc_cmd_send_die, NULL },
{ "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error },
{ "halfop", N_("gives half channel operator status to nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
{ "info", N_("get information describing the server"),
N_("[target]"),
N_("target: server name"),
0, 1, 1, NULL, irc_cmd_send_info, NULL },
{ "invite", N_("invite a nick on a channel"),
N_("nickname channel"),
N_("nickname: nick to invite\nchannel: channel to invite"),
N_("nickname: nick to invite\n"
"channel: channel to invite"),
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
{ "ison", N_("check if a nickname is currently on IRC"),
N_("nickname [nickname ...]"),
@@ -84,19 +92,25 @@ t_irc_command irc_commands[] =
1, MAX_ARGS, 1, NULL, irc_cmd_send_ison, NULL },
{ "join", N_("join a channel"),
N_("channel[,channel] [key[,key]]"),
N_("channel: channel name to join\nkey: key to join the channel"),
N_("channel: channel name to join\n"
"key: key to join the channel"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join },
{ "kick", N_("forcibly remove a user from a channel"),
N_("[channel] nickname [comment]"),
N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
N_("channel: channel where user is\n"
"nickname: nickname to kick\n"
"comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
{ "kickban", N_("kicks and bans a nick from a channel"),
N_("[channel] nickname [comment]"),
N_("channel: channel where user is\nnickname: nickname to kick and ban\ncomment: comment for kick"),
N_("channel: channel where user is\n"
"nickname: nickname to kick and ban\n"
"comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
{ "kill", N_("close client-server connection"),
N_("nickname comment"),
N_("nickname: nickname\ncomment: comment for kill"),
N_("nickname: nickname\n"
"comment: comment for kill"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill },
{ "links", N_("list all servernames which are known by the server answering the query"),
N_("[[server] server_mask]"),
@@ -145,8 +159,8 @@ t_irc_command irc_commands[] =
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
N_("receiver: nick or channel (may be mask, '*' = current channel)\n"
"text: text to send"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
{ "names", N_("list nicknames on channels"),
N_("[channel[,channel]]"), N_("channel: channel name"),
@@ -167,24 +181,26 @@ t_irc_command irc_commands[] =
N_("user/password: used to get privileges on current IRC server"),
2, 2, 1, NULL, irc_cmd_send_oper, NULL },
{ "part", N_("leave a channel"),
N_("[channel[,channel]] [part_message]"), N_("channel: channel name to leave\n"
"part_message: part message (displayed to other users)"),
N_("[channel[,channel]] [part_message]"),
N_("channel: channel name to leave\n"
"part_message: part message (displayed to other users)"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part },
{ "ping", N_("ping server"),
N_("server1 [server2]"),
N_("server1: server to ping\nserver2: forward ping to this server"),
1, 2, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping },
{ "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"),
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, irc_cmd_recv_pong },
{ "privmsg", N_("message received"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
N_("nickname: nickname for private conversation"
"\ntext: text to send"),
N_("nickname: nickname for private conversation\n"
"text: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
{ "quit", N_("close all connections & quit"),
N_("[quit_message]"),
@@ -206,14 +222,17 @@ t_irc_command irc_commands[] =
"type: reserved for future usage"),
6, 6, 1, NULL, irc_cmd_send_service, NULL },
{ "servlist", N_("list services currently connected to the network"),
N_("[mask [type]]"), N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
N_("[mask [type]]"),
N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
0, 2, 1, NULL, irc_cmd_send_servlist, NULL },
{ "squery", N_("deliver a message to a service"),
N_("service text"), N_("service: name of service\ntext: text to send"),
N_("service text"),
N_("service: name of service\ntext: text to send"),
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
{ "squit", N_("disconnect server links"),
N_("server comment"), N_("server: server name\ncomment: comment for quit"),
N_("server comment"),
N_("server: server name\ncomment: comment for quit"),
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
{ "stats", N_("query statistics about server"),
N_("[query [server]]"),
@@ -222,21 +241,24 @@ t_irc_command irc_commands[] =
{ "summon", N_("give users who are on a host running an IRC server a message "
"asking them to please join IRC"),
N_("user [target [channel]]"),
N_("user: username\ntarget: server name\nchannel: channel name"),
N_("user: username\ntarget: server name\n"
"channel: channel name"),
1, 3, 1, NULL, irc_cmd_send_summon, NULL },
{ "time", N_("query local time from server"),
N_("[target]"), N_("target: query time from specified server"),
0, 1, 1, NULL, irc_cmd_send_time, NULL },
{ "topic", N_("get/set channel topic"),
N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel "
"(if topic is \"-delete\" then topic is deleted)"),
N_("[channel] [topic]"),
N_("channel: channel name\ntopic: new topic for channel "
"(if topic is \"-delete\" then topic is deleted)"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic },
{ "trace", N_("find the route to specific server"),
N_("[target]"), N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_trace, NULL },
{ "unban", N_("unbans nicks or hosts"),
N_("[channel] nickname [nickname ...]"),
N_("channel: channel for unban\nnickname: user or host to unban"),
N_("channel: channel for unban\n"
"nickname: user or host to unban"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
{ "userhost", N_("return a list of information about nicknames"),
N_("nickname [nickname ...]"), N_("nickname: nickname"),
@@ -245,80 +267,85 @@ t_irc_command irc_commands[] =
N_("[target]"), N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_users, NULL },
{ "version", N_("gives the version info of nick or server (current or specified)"),
N_("[server | nickname]"), N_("server: server name\nnickname: nickname"),
N_("[server | nickname]"),
N_("server: server name\n"
"nickname: nickname"),
0, 1, 1, NULL, irc_cmd_send_version, NULL },
{ "voice", N_("gives voice to nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, 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"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
{ "who", N_("generate a query which returns a list of information"),
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
"o: only operators are returned according to the mask supplied"),
N_("[mask [\"o\"]]"),
N_("mask: only information which match this mask\n"
"o: only operators are returned according to the mask supplied"),
0, 2, 1, NULL, irc_cmd_send_who, NULL },
{ "whois", N_("query information about user(s)"),
N_("[server] nickname[,nickname]"), N_("server: server name\n"
"nickname: nickname (may be a mask)"),
N_("[server] nickname[,nickname]"),
N_("server: server name\n"
"nickname: nickname (may be a mask)"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whois, NULL },
{ "whowas", N_("ask for information about a nickname which no longer exists"),
N_("nickname [,nickname [,nickname ...]] [count [target]]"),
N_("nickname: nickname to search\ncount: number of replies to return "
"(full search if negative number)\n"
"target: reply should match this mask"),
N_("nickname: nickname to search\n"
"count: number of replies to return (full search if negative number)\n"
"target: reply should match this mask"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whowas, NULL },
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
{ "307", N_("whois (registered nick)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_307 },
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
{ "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_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 },
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
{ "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_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 },
{ "320", N_("whois (identified user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_320 },
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "332", N_("topic of channel"),
N_("channel :topic"),
N_("channel: name of channel\ntopic: topic of the channel"),
N_("channel: name of channel\n"
"topic: topic of the channel"),
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 },
{ "333", N_("infos about topic (nick & date changed)"),
"", "",
@@ -328,21 +355,22 @@ t_irc_command irc_commands[] =
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
{ "353", N_("list of nicks on channel"),
N_("channel :[[@|+]nick ...]"),
N_("channel: name of channel\nnick: nick on the channel"),
N_("channel: name of channel\n"
"nick: nick on the channel"),
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 },
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
{ "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
{ "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
{ "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
{ "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
{ "369", N_("end of /whowas list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "401", N_("no such nick/channel"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "402", N_("no such server"),
@@ -443,6 +471,7 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "502", N_("can't change mode for other users"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "671", N_("whois (secure connection)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
{ "671", N_("whois (secure connection)"),
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
{ NULL, NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL }
};
+341 -115
View File
@@ -63,6 +63,136 @@ dcc_redraw (int highlight)
}
}
/*
* dcc_search: search a DCC
*/
t_irc_dcc *
dcc_search (t_irc_server *server, int type, int status, int port)
{
t_irc_dcc *ptr_dcc;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
if ((ptr_dcc->server == server)
&& (ptr_dcc->type == type)
&& (ptr_dcc->status = status)
&& (ptr_dcc->port == port))
return ptr_dcc;
}
/* DCC not found */
return NULL;
}
/*
* dcc_file_is_resumable: check if a file can be used for resuming a download
*/
int
dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename)
{
struct stat st;
if (!cfg_dcc_auto_resume)
return 0;
if (access (filename, W_OK) == 0)
{
if (stat (filename, &st) != -1)
{
if ((unsigned long) st.st_size < ptr_dcc->size)
{
ptr_dcc->start_resume = (unsigned long) st.st_size;
ptr_dcc->pos = st.st_size;
ptr_dcc->last_check_pos = st.st_size;
return 1;
}
}
}
/* not resumable */
return 0;
}
/*
* dcc_find_filename: find local filename for a DCC
* if type if file/recv, add a suffix (like .1) if needed
* if download is resumable, set "start_resume" to good value
*/
void
dcc_find_filename (t_irc_dcc *ptr_dcc)
{
char *ptr_home, *filename2;
ptr_home = getenv ("HOME");
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
strlen (ptr_dcc->nick) +
strlen (ptr_dcc->filename) +
((cfg_dcc_download_path[0] == '~') ?
strlen (ptr_home) : 0) +
4);
if (!ptr_dcc->local_filename)
return;
if (cfg_dcc_download_path[0] == '~')
{
strcpy (ptr_dcc->local_filename, ptr_home);
strcat (ptr_dcc->local_filename, cfg_dcc_download_path + 1);
}
else
strcpy (ptr_dcc->local_filename, cfg_dcc_download_path);
if (ptr_dcc->local_filename[strlen (ptr_dcc->local_filename) - 1] != DIR_SEPARATOR_CHAR)
strcat (ptr_dcc->local_filename, DIR_SEPARATOR);
strcat (ptr_dcc->local_filename, ptr_dcc->nick);
strcat (ptr_dcc->local_filename, ".");
strcat (ptr_dcc->local_filename, ptr_dcc->filename);
/* file already exists? */
if (access (ptr_dcc->local_filename, F_OK) == 0)
{
if (dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename))
return;
/* if auto rename is not set, then abort DCC */
if (!cfg_dcc_auto_rename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return;
}
filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
if (!filename2)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return;
}
ptr_dcc->filename_suffix = 0;
do
{
ptr_dcc->filename_suffix++;
sprintf (filename2, "%s.%d",
ptr_dcc->local_filename,
ptr_dcc->filename_suffix);
if (access (filename2, F_OK) == 0)
{
if (dcc_file_is_resumable (ptr_dcc, filename2))
break;
}
else
break;
}
while (1);
free (ptr_dcc->local_filename);
ptr_dcc->local_filename = strdup (filename2);
free (filename2);
}
}
/*
* dcc_calculate_speed: calculate DCC speed (for files only)
*/
@@ -81,7 +211,7 @@ dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
elapsed = local_time - ptr_dcc->start_transfer;
if (elapsed == 0)
elapsed = 1;
ptr_dcc->bytes_per_sec = ptr_dcc->pos / elapsed;
ptr_dcc->bytes_per_sec = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
}
else
{
@@ -182,7 +312,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
ptr_dcc->status = status;
if (status == DCC_DONE)
if ((status == DCC_DONE) || (status == DCC_ABORTED) || (status == DCC_FAILED))
{
if (DCC_IS_FILE(ptr_dcc->type))
{
@@ -192,20 +322,25 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
if (ptr_dcc->local_filename)
{
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
gui_printf (ptr_dcc->server->buffer, ")");
}
if (ptr_dcc->type == DCC_FILE_SEND)
gui_printf (ptr_dcc->server->buffer, _(") sent to "));
gui_printf (ptr_dcc->server->buffer, _(" sent to "));
else
gui_printf (ptr_dcc->server->buffer, _(") received from "));
gui_printf (ptr_dcc->server->buffer, _(" received from "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_NICK,
"%s",
ptr_dcc->nick);
gui_printf (ptr_dcc->server->buffer, _(": ok!\n"));
gui_printf (ptr_dcc->server->buffer,
(status == DCC_DONE) ? _(": ok!\n") : _(": FAILED\n"));
}
}
if (status == DCC_ABORTED)
@@ -229,6 +364,14 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
}
}
/* remove empty file if received file failed and nothing was transfered */
if (((status == DCC_FAILED) || (status == DCC_ABORTED))
&& DCC_IS_FILE(ptr_dcc->type)
&& DCC_IS_RECV(ptr_dcc->type)
&& ptr_dcc->local_filename
&& ptr_dcc->pos == 0)
unlink (ptr_dcc->local_filename);
if (DCC_IS_CHAT(ptr_dcc->type))
channel_remove_dcc (ptr_dcc);
@@ -262,7 +405,7 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
"(maybe private buffer has already DCC CHAT?)\n"),
WEECHAT_ERROR);
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
return;
}
@@ -281,18 +424,16 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
}
/*
* dcc_accept: accepts a DCC file or chat request
* dcc_recv_connect_init: connect to sender and init file or chat
*/
void
dcc_accept (t_irc_dcc *ptr_dcc)
dcc_recv_connect_init (t_irc_dcc *ptr_dcc)
{
char *ptr_home, *filename2;
if (!dcc_connect (ptr_dcc))
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
else
{
@@ -301,68 +442,15 @@ dcc_accept (t_irc_dcc *ptr_dcc)
/* DCC file => look for local filename and open it in writing mode */
if (DCC_IS_FILE(ptr_dcc->type))
{
ptr_home = getenv ("HOME");
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
strlen (ptr_dcc->nick) +
strlen (ptr_dcc->filename) +
((cfg_dcc_download_path[0] == '~') ?
strlen (ptr_home) : 0) +
4);
if (!ptr_dcc->local_filename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
if (cfg_dcc_download_path[0] == '~')
{
strcpy (ptr_dcc->local_filename, ptr_home);
strcat (ptr_dcc->local_filename, cfg_dcc_download_path + 1);
}
if (ptr_dcc->start_resume > 0)
ptr_dcc->file = open (ptr_dcc->local_filename,
O_APPEND | O_WRONLY | O_NONBLOCK);
else
strcpy (ptr_dcc->local_filename, cfg_dcc_download_path);
if (ptr_dcc->local_filename[strlen (ptr_dcc->local_filename) - 1] != DIR_SEPARATOR_CHAR)
strcat (ptr_dcc->local_filename, DIR_SEPARATOR);
strcat (ptr_dcc->local_filename, ptr_dcc->nick);
strcat (ptr_dcc->local_filename, ".");
strcat (ptr_dcc->local_filename, ptr_dcc->filename);
/* file already exists? */
if (access (ptr_dcc->local_filename, F_OK) == 0)
{
/* if auto rename is not set, then abort DCC */
if (!cfg_dcc_auto_rename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
if (!filename2)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
ptr_dcc->filename_suffix = 0;
do
{
ptr_dcc->filename_suffix++;
sprintf (filename2, "%s.%d",
ptr_dcc->local_filename,
ptr_dcc->filename_suffix);
}
while (access (filename2, F_OK) == 0);
free (ptr_dcc->local_filename);
ptr_dcc->local_filename = strdup (filename2);
free (filename2);
}
ptr_dcc->file = open (ptr_dcc->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
ptr_dcc->file = open (ptr_dcc->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
ptr_dcc->start_transfer = time (NULL);
ptr_dcc->last_check_time = time (NULL);
}
else
{
@@ -370,7 +458,94 @@ dcc_accept (t_irc_dcc *ptr_dcc)
dcc_channel_for_chat (ptr_dcc);
}
}
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
/*
* dcc_accept: accepts a DCC file or chat request
*/
void
dcc_accept (t_irc_dcc *ptr_dcc)
{
if (DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0))
{
ptr_dcc->status = DCC_CONNECTING;
server_sendf (ptr_dcc->server,
(strchr (ptr_dcc->filename, ' ')) ?
"PRIVMSG %s :\01DCC RESUME \"%s\" %d %u\01\r\n" :
"PRIVMSG %s :\01DCC RESUME %s %d %u\01\r\n",
ptr_dcc->nick, ptr_dcc->filename,
ptr_dcc->port, ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
else
dcc_recv_connect_init (ptr_dcc);
}
/*
* dcc_accept_resume: accepts a resume and inform the receiver
*/
void
dcc_accept_resume (t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
t_irc_dcc *ptr_dcc;
ptr_dcc = dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port);
if (ptr_dcc)
{
ptr_dcc->pos = pos_start;
ptr_dcc->ack = pos_start;
ptr_dcc->start_resume = pos_start;
ptr_dcc->last_check_pos = pos_start;
server_sendf (ptr_dcc->server,
(strchr (ptr_dcc->filename, ' ')) ?
"PRIVMSG %s :\01DCC ACCEPT \"%s\" %d %u\01\r\n" :
"PRIVMSG %s :\01DCC ACCEPT %s %d %u\01\r\n",
ptr_dcc->nick, ptr_dcc->filename,
ptr_dcc->port, ptr_dcc->start_resume);
irc_display_prefix (ptr_dcc->server->buffer, PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _("resumed at position %u\n"),
ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
else
gui_printf (server->buffer,
_("%s can't resume file \"%s\" (port: %d, start position: %u): DCC not found or ended\n"),
WEECHAT_ERROR, filename, port, pos_start);
}
/*
* dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender)
*/
void
dcc_start_resume (t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
t_irc_dcc *ptr_dcc;
ptr_dcc = dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port);
if (ptr_dcc)
{
ptr_dcc->pos = pos_start;
ptr_dcc->ack = pos_start;
ptr_dcc->start_resume = pos_start;
ptr_dcc->last_check_pos = pos_start;
dcc_recv_connect_init (ptr_dcc);
}
else
gui_printf (server->buffer,
_("%s can't resume file \"%s\" (port: %d, start position: %u): DCC not found or ended\n"),
WEECHAT_ERROR, filename, port, pos_start);
}
/*
@@ -410,14 +585,20 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
new_dcc->filename = strdup (_("DCC chat"));
else
new_dcc->filename = (filename) ? strdup (filename) : NULL;
new_dcc->local_filename = (local_filename) ? strdup (local_filename) : NULL;
new_dcc->local_filename = NULL;
new_dcc->filename_suffix = -1;
new_dcc->size = size;
new_dcc->pos = 0;
new_dcc->ack = 0;
new_dcc->last_check_time = 0;
new_dcc->start_resume = 0;
new_dcc->last_check_time = time (NULL);
new_dcc->last_check_pos = 0;
new_dcc->bytes_per_sec = 0;
new_dcc->last_activity = time (NULL);
if (local_filename)
new_dcc->local_filename = strdup (local_filename);
else
dcc_find_filename (new_dcc);
new_dcc->prev_dcc = NULL;
new_dcc->next_dcc = dcc_list;
if (dcc_list)
@@ -443,6 +624,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
gui_printf (server->buffer, ", ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_FILE_SEND)
{
@@ -456,6 +638,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
gui_printf (server->buffer, "), ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_RECV)
{
@@ -467,12 +650,40 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")\n");
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_SEND)
{
irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC chat request to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s\n", nick);
dcc_redraw (HOTLIST_MSG);
}
if (DCC_IS_FILE(type) && (!new_dcc->local_filename))
{
dcc_close (new_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return NULL;
}
if (DCC_IS_FILE(type) && (new_dcc->start_resume > 0))
{
irc_display_prefix (new_dcc->server->buffer, PREFIX_INFO);
gui_printf (new_dcc->server->buffer, _("DCC: file "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->filename);
gui_printf (new_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->local_filename);
gui_printf (new_dcc->server->buffer, ") ");
gui_printf (new_dcc->server->buffer, _("will be resumed at position %u\n"),
new_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
/* connect if needed and redraw DCC buffer */
@@ -481,6 +692,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
if (!dcc_connect (new_dcc))
{
dcc_close (new_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return NULL;
}
}
@@ -489,7 +701,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|| ( (type == DCC_FILE_RECV) && (cfg_dcc_auto_accept_files) ) )
dcc_accept (new_dcc);
else
dcc_redraw (2);
dcc_redraw (HOTLIST_PRIVATE);
gui_draw_buffer_status (gui_current_window->buffer, 0);
return new_dcc;
@@ -518,9 +730,9 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
if (type == DCC_FILE_SEND)
{
/* add home if filename not beginning with '/' (not for Win32) */
#ifdef _WIN32
#ifdef _WIN32
filename2 = strdup (filename);
#else
#else
if (filename[0] == '/')
filename2 = strdup (filename);
else
@@ -550,7 +762,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
strcat (filename2, DIR_SEPARATOR);
strcat (filename2, filename);
}
#endif
#endif
/* check if file exists */
if (stat (filename2, &st) == -1)
@@ -705,11 +917,11 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
buffer[sizeof (buffer) - 1] = '\0';
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
size_buf = strlen (buffer);
#ifdef DEBUG
#ifdef DEBUG
buffer[size_buf - 2] = '\0';
gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer);
buffer[size_buf - 2] = '\r';
#endif
#endif
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
cfg_look_charset_encode,
@@ -786,7 +998,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (ptr_buf, ptr_dcc->server->nick))
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
@@ -821,7 +1033,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
else
{
dcc_close (ptr_dcc, DCC_ABORTED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
}
@@ -844,6 +1056,17 @@ dcc_handle ()
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
/* check DCC timeout */
if (DCC_IS_FILE(ptr_dcc->type) && !DCC_ENDED(ptr_dcc->status))
{
if ((cfg_dcc_timeout != 0) && (time (NULL) > ptr_dcc->last_activity + cfg_dcc_timeout))
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
continue;
}
}
if (ptr_dcc->status == DCC_CONNECTING)
{
if (ptr_dcc->type == DCC_FILE_SEND)
@@ -858,6 +1081,7 @@ dcc_handle ()
{
if (FD_ISSET (ptr_dcc->sock, &read_fd))
{
ptr_dcc->last_activity = time (NULL);
length = sizeof (addr);
sock = accept (ptr_dcc->sock, (struct sockaddr *) &addr, &length);
close (ptr_dcc->sock);
@@ -865,21 +1089,21 @@ dcc_handle ()
if (sock < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->sock = sock;
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
ptr_dcc->status = DCC_ACTIVE;
ptr_dcc->file = open (ptr_dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644);
ptr_dcc->start_transfer = time (NULL);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
}
}
@@ -906,19 +1130,19 @@ dcc_handle ()
if (sock < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->sock = sock;
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
ptr_dcc->status = DCC_ACTIVE;
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
dcc_channel_for_chat (ptr_dcc);
}
}
@@ -949,16 +1173,17 @@ dcc_handle ()
if (num_read == 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (write (ptr_dcc->file, buffer, num_read) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->last_activity = time (NULL);
ptr_dcc->pos += (unsigned long) num_read;
pos = htonl (ptr_dcc->pos);
send (ptr_dcc->sock, (char *) &pos, 4, 0);
@@ -966,10 +1191,10 @@ dcc_handle ()
if (ptr_dcc->pos >= ptr_dcc->size)
{
dcc_close (ptr_dcc, DCC_DONE);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
else
dcc_redraw (0);
dcc_redraw (HOTLIST_LOW);
}
}
if (ptr_dcc->type == DCC_FILE_SEND)
@@ -982,8 +1207,8 @@ dcc_handle ()
"max is %d.\n"),
sizeof (buffer));
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (ptr_dcc->pos > ptr_dcc->ack)
{
@@ -994,11 +1219,11 @@ dcc_handle ()
if (num_read == 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (num_read < 4)
return;
continue;
recv (ptr_dcc->sock, (char *) &pos, 4, 0);
ptr_dcc->ack = ntohl (pos);
@@ -1006,8 +1231,8 @@ dcc_handle ()
&& (ptr_dcc->ack >= ptr_dcc->size))
{
dcc_close (ptr_dcc, DCC_DONE);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
}
}
@@ -1018,19 +1243,20 @@ dcc_handle ()
if (num_read < 1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
num_sent = send (ptr_dcc->sock, buffer, num_read, 0);
if (num_sent < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->last_activity = time (NULL);
ptr_dcc->pos += (unsigned long) num_sent;
dcc_calculate_speed (ptr_dcc, 0);
dcc_redraw (0);
dcc_redraw (HOTLIST_LOW);
}
}
}
+8 -1
View File
@@ -57,7 +57,14 @@ irc_display_prefix (t_gui_buffer *buffer, char *prefix)
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
}
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
{
if (strcmp (prefix, PREFIX_JOIN) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_JOIN, "%s ", prefix);
else if (strcmp (prefix, PREFIX_PART) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_PART, "%s ", prefix);
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
}
}
/*
+420 -64
View File
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <time.h>
#include <sys/utsname.h>
@@ -42,6 +43,92 @@
#include "../plugins/plugins.h"
/*
* irc_is_highlight: returns 1 if given message contains highlight (with given nick
* or at least one of string in "irc_higlight" setting
*/
int
irc_is_highlight (char *message, char *nick)
{
char *msg, *highlight, *pos, *pos_end;
int end, length;
/* empty message ? */
if (!message || !message[0])
return 0;
/* highlight by nickname */
if (strstr (message, nick))
return 1;
/* no highlight by nickname and "irc_highlight" is empty */
if (!cfg_irc_highlight || !cfg_irc_highlight[0])
return 0;
/* convert both strings to lower case */
if ((msg = strdup (message)) == NULL)
return 0;
if ((highlight = strdup (cfg_irc_highlight)) == NULL)
{
free (msg);
return 0;
}
pos = msg;
while (pos[0])
{
pos[0] = tolower (pos[0]);
pos++;
}
pos = highlight;
while (pos[0])
{
pos[0] = tolower (pos[0]);
pos++;
}
/* look in "irc_highlight" for highlight */
pos = highlight;
end = 0;
while (!end)
{
pos_end = strchr (pos, ',');
if (!pos_end)
{
pos_end = strchr (pos, '\0');
end = 1;
}
/* error parsing string! */
if (!pos_end)
{
free (msg);
free (highlight);
return 0;
}
length = pos_end - pos;
pos_end[0] = '\0';
if (length > 0)
{
/* highlight found! */
if (strstr (msg, pos))
{
free (msg);
free (highlight);
return 1;
}
}
if (!end)
pos = pos_end + 1;
}
/* no highlight found with "irc_highlight" list */
free (msg);
free (highlight);
return 0;
}
/*
* irc_recv_command: executes action when receiving IRC command
* returns: 0 = all ok, command executed
@@ -185,7 +272,7 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *arguments)
gui_printf (server->buffer, _("by"));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
" %s\n", host);
hotlist_add (2, server->buffer);
hotlist_add (HOTLIST_HIGHLIGHT, server->buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
else
@@ -637,6 +724,31 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 'q':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "q", nick_host,
(set_flag == '+') ?
_("sets quiet on") :
_("removes quiet on"),
(parm) ? parm : NULL);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 's':
if (nick_host)
irc_display_mode (ptr_channel->buffer,
@@ -996,7 +1108,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
(strcasecmp (host, "chanserv") != 0) &&
(strcasecmp (host, "memoserv") != 0))
{
hotlist_add (2, server->buffer);
hotlist_add (HOTLIST_PRIVATE, server->buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
@@ -1159,7 +1271,7 @@ int
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
struct utsname *buf;
@@ -1207,7 +1319,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
@@ -1228,47 +1340,110 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
return 0;
}
else if (strncmp (pos, "\01SOUND ", 7) == 0)
if (strncmp (pos, "\01SOUND ", 7) == 0)
{
pos += 7;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf (ptr_channel->buffer,
_("Received a CTCP SOUND \"%s\" from "),
pos);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s\n", host);
return 0;
}
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "PING ");
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
/* unknown CTCP ? */
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
pos++;
pos2[0] = '\0';
pos2 = strchr (pos, ' ');
if (pos2)
{
pos2[0] = '\0';
pos2++;
while (pos2[0] == ' ')
pos2++;
if (!pos2[0])
pos2 = NULL;
}
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Unknown CTCP "));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (ptr_channel->buffer, "\n");
return 0;
}
/* other message */
ptr_nick = nick_search (ptr_channel, host);
if (irc_is_highlight (pos, server->nick))
{
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
1, -1, 0);
if ( (cfg_look_infobar)
&& (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
{
ptr_nick = nick_search (ptr_channel, host);
if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
1, -1, 0);
if ( (cfg_look_infobar)
&& (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
@@ -1297,8 +1472,19 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos++;
/* version asked by another user => answer with WeeChat version */
if (strcmp (pos, "\01VERSION\01") == 0)
if (strncmp (pos, "\01VERSION", 8) == 0)
{
pos2 = strchr (pos + 8, ' ');
if (pos2)
{
while (pos2[0] == ' ')
pos2++;
if (pos2[0] == '\01')
pos2 = NULL;
else if (!pos2[0])
pos2 = NULL;
}
buf = (struct utsname *) malloc (sizeof (struct utsname));
if (buf && (uname (buf) == 0))
{
@@ -1317,15 +1503,20 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
irc_display_prefix (server->buffer, PREFIX_INFO);
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Received a "));
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, _("CTCP VERSION "));
COLOR_WIN_CHAT_CHANNEL, "VERSION ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("from"));
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (server->buffer, "\n");
return 0;
}
@@ -1348,6 +1539,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, "PING ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
@@ -1419,9 +1619,123 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2--;
pos2[1] = '\0';
dcc_add (server, DCC_FILE_RECV, (unsigned long) atol (pos_addr),
dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
atoi (pos_port), host, -1, pos_file, NULL,
(unsigned long) atol (pos_size));
strtoul (pos_size, NULL, 10));
return 0;
}
/* incoming DCC RESUME (asked by receiver) */
if (strncmp (pos, "\01DCC RESUME", 11) == 0)
{
/* check if DCC RESUME is ok, i.e. with 0x01 at end */
pos2 = strchr (pos + 1, '\01');
if (!pos2)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
/* DCC filename */
pos_file = pos + 11;
while (pos_file[0] == ' ')
pos_file++;
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_start_resume;
pos_start_resume++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
dcc_accept_resume (server, pos_file, atoi (pos_port),
strtoul (pos_start_resume, NULL, 10));
return 0;
}
/* incoming DCC ACCEPT (resume accepted by sender) */
if (strncmp (pos, "\01DCC ACCEPT", 11) == 0)
{
/* check if DCC ACCEPT is ok, i.e. with 0x01 at end */
pos2 = strchr (pos + 1, '\01');
if (!pos2)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
/* DCC filename */
pos_file = pos + 11;
while (pos_file[0] == ' ')
pos_file++;
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_start_resume;
pos_start_resume++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
dcc_start_resume (server, pos_file, atoi (pos_port),
strtoul (pos_start_resume, NULL, 10));
return 0;
}
@@ -1487,7 +1801,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
return -1;
}
dcc_add (server, DCC_CHAT_RECV, (unsigned long) atol (pos_addr),
dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
atoi (pos_port), host, -1, NULL, NULL, 0);
return 0;
@@ -1517,7 +1831,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
@@ -1541,33 +1855,68 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
/* unknown CTCP ? */
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
pos++;
pos2[0] = '\0';
pos2 = strchr (pos, ' ');
if (pos2)
{
pos2[0] = '\0';
pos2++;
while (pos2[0] == ' ')
pos2++;
if (!pos2[0])
pos2 = NULL;
}
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Unknown CTCP "));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (server->buffer, "\n");
return 0;
}
else
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
COLOR_WIN_CHAT_DARK, "<");
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
}
}
else
@@ -1855,7 +2204,14 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == CHAT_CHANNEL)
server_sendf (server, "JOIN %s\r\n", ptr_channel->name);
{
if (ptr_channel->key)
server_sendf (server, "JOIN %s %s\r\n",
ptr_channel->name, ptr_channel->key);
else
server_sendf (server, "JOIN %s\r\n",
ptr_channel->name);
}
}
server->reconnect_join = 0;
}
+151 -43
View File
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <time.h>
#include <sys/utsname.h>
@@ -81,6 +82,61 @@ irc_cmd_send_admin (t_irc_server *server, char *arguments)
return 0;
}
/*
* irc_cmd_send_amsg: send message to all channels of all connected servers
*/
int
irc_cmd_send_amsg (t_irc_server *server, char *arguments)
{
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
/* make gcc happy */
(void) server;
if (arguments)
{
gui_add_hotlist = 0;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server->is_connected)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == CHAT_CHANNEL)
{
server_sendf (ptr_server, "PRIVMSG %s :%s\r\n",
ptr_channel->name, arguments);
ptr_nick = nick_search (ptr_channel, ptr_server->nick);
if (ptr_nick)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
}
else
{
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
gui_printf (ptr_server->buffer,
_("%s cannot find nick for sending message\n"),
WEECHAT_ERROR);
}
}
}
}
}
gui_add_hotlist = 1;
}
else
return -1;
return 0;
}
/*
* irc_cmd_send_away: toggle away status
*/
@@ -274,53 +330,67 @@ irc_cmd_send_ban (t_irc_server *server, char *arguments)
int
irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
{
char *pos, *pos2;
char *pos_type, *pos_args, *pos;
struct timeval tv;
struct timezone tz;
pos = strchr (arguments, ' ');
if (pos)
pos_type = strchr (arguments, ' ');
if (pos_type)
{
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, ' ');
if (pos2)
pos_type[0] = '\0';
pos_type++;
while (pos_type[0] == ' ')
pos_type++;
pos_args = strchr (pos_type, ' ');
if (pos_args)
{
pos2[0] = '\0';
pos2++;
while (pos2[0] == ' ')
pos2++;
pos_args[0] = '\0';
pos_args++;
while (pos_args[0] == ' ')
pos_args++;
}
else
pos2 = NULL;
pos_args = NULL;
if (strcasecmp (pos, "version") == 0)
pos = pos_type;
while (pos[0])
{
if (pos2)
server_sendf (server, "PRIVMSG %s :\01VERSION %s\01\r\n",
arguments, pos2);
else
server_sendf (server, "PRIVMSG %s :\01VERSION\01\r\n",
arguments);
pos[0] = toupper (pos[0]);
pos++;
}
if (strcasecmp (pos, "action") == 0)
{
if (pos2)
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
arguments, pos2);
else
server_sendf (server, "PRIVMSG %s :\01ACTION\01\r\n",
arguments);
}
if (strcasecmp (pos, "ping") == 0)
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP");
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, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type);
if ((strcasecmp (pos_type, "ping") == 0) && (!pos_args))
{
gettimeofday (&tv, &tz);
server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n",
arguments, tv.tv_sec, tv.tv_usec);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %d %d\n",
tv.tv_sec, tv.tv_usec);
}
else
{
if (pos_args)
{
server_sendf (server, "PRIVMSG %s :\01%s %s\01\r\n",
arguments, pos_type, pos_args);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %s\n",
pos_args);
}
else
{
server_sendf (server, "PRIVMSG %s :\01%s\01\r\n",
arguments, pos_type);
gui_printf (server->buffer, "\n");
}
}
}
return 0;
}
@@ -414,10 +484,17 @@ irc_cmd_send_dehalfop (t_irc_server *server, int argc, char **argv)
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
for (i = 0; i < argc; i++)
if (argc == 0)
server_sendf (server, "MODE %s -h %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
server->nick);
else
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s -h %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
}
else
{
@@ -440,10 +517,17 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
for (i = 0; i < argc; i++)
if (argc == 0)
server_sendf (server, "MODE %s -o %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
server->nick);
else
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s -o %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
}
else
{
@@ -466,10 +550,17 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
for (i = 0; i < argc; i++)
if (argc == 0)
server_sendf (server, "MODE %s -v %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
server->nick);
else
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s -v %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
}
else
{
@@ -507,10 +598,17 @@ irc_cmd_send_halfop (t_irc_server *server, int argc, char **argv)
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
for (i = 0; i < argc; i++)
if (argc == 0)
server_sendf (server, "MODE %s +h %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
server->nick);
else
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s +h %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
}
else
{
@@ -580,7 +678,10 @@ irc_cmd_send_ison (t_irc_server *server, char *arguments)
int
irc_cmd_send_join (t_irc_server *server, char *arguments)
{
server_sendf (server, "JOIN %s\r\n", arguments);
if (string_is_channel (arguments))
server_sendf (server, "JOIN %s\r\n", arguments);
else
server_sendf (server, "JOIN #%s\r\n", arguments);
return 0;
}
@@ -1690,10 +1791,17 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
for (i = 0; i < argc; i++)
if (argc == 0)
server_sendf (server, "MODE %s +v %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
server->nick);
else
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s +v %s\r\n",
CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
}
else
{
+4 -4
View File
@@ -150,7 +150,7 @@ server_init_with_url (char *irc_url, t_irc_server *server)
else
return -1;
url = strdup (irc_url);
url = strdup (pos);
pos_server = strchr (url, '@');
if (pos_server)
{
@@ -161,13 +161,13 @@ server_init_with_url (char *irc_url, t_irc_server *server)
free (url);
return -1;
}
pos2 = strchr (pos, ':');
pos2 = strchr (url, ':');
if (pos2)
{
pos2[0] = '\0';
server->password = strdup (pos2 + 1);
}
server->nick1 = strdup (pos);
server->nick1 = strdup (url);
}
else
{
@@ -182,7 +182,7 @@ server_init_with_url (char *irc_url, t_irc_server *server)
free (url);
return -1;
}
pos_server = url + 6;
pos_server = url;
}
if (!pos_server[0])
{
+9 -3
View File
@@ -98,7 +98,7 @@ struct t_irc_nick
int is_chanowner; /* chan owner? (specific to unrealircd) */
int is_chanadmin; /* chan admin? (specific to unrealircd) */
int is_op; /* operator privileges? */
int is_halfop; /* half operaor privileges? */
int is_halfop; /* half operator privileges? */
int has_voice; /* nick has voice? */
int is_away; /* = 1 if nick is away, otherwise 0 */
int color; /* color for nickname in chat window */
@@ -166,10 +166,10 @@ struct t_irc_server
int child_write; /* to write into child pipe */
int sock; /* socket for server (IPv4 or IPv6) */
int is_connected; /* 1 if WeeChat is connected to server */
#ifdef HAVE_GNUTLS
#ifdef HAVE_GNUTLS
int ssl_connected; /* = 1 if connected with SSL */
gnutls_session gnutls_sess; /* gnutls session (only if SSL is used) */
#endif
#endif
char *unterminated_message; /* beginning of a message in input buf */
char *nick; /* current nickname */
@@ -242,9 +242,11 @@ struct t_irc_dcc
unsigned long size; /* file size */
unsigned long pos; /* number of bytes received/sent */
unsigned long ack; /* number of bytes received OK */
unsigned long start_resume; /* start of resume (in bytes) */
time_t last_check_time; /* last time we looked at bytes sent/rcv*/
unsigned long last_check_pos; /* bytes sent/recv at last check */
unsigned long bytes_per_sec; /* bytes per second */
time_t last_activity; /* time of last byte received/sent */
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
};
@@ -330,6 +332,8 @@ extern void dcc_redraw (int);
extern void dcc_free (t_irc_dcc *);
extern void dcc_close (t_irc_dcc *, int);
extern void dcc_accept (t_irc_dcc *);
extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
char *, char *, unsigned long);
extern void dcc_send_request (t_irc_server *, int, char *, char *);
@@ -347,10 +351,12 @@ extern void irc_display_server (t_irc_server *ptr_server);
/* IRC protocol (irc-commands.c) */
extern int irc_is_highlight (char *, char *);
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
extern void irc_login (t_irc_server *);
/* IRC commands issued by user */
extern int irc_cmd_send_admin (t_irc_server *, char *);
extern int irc_cmd_send_amsg (t_irc_server *, char *);
extern int irc_cmd_send_away (t_irc_server *, char *);
extern int irc_cmd_send_ban (t_irc_server *, char *);
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
+47 -24
View File
@@ -354,7 +354,7 @@ static XS (XS_IRC_add_command_handler)
static XS (XS_IRC_get_info)
{
char *arg, *info = NULL, *server;
char *arg, *info = NULL, *server_name;
t_irc_server *ptr_server;
int integer;
dXSARGS;
@@ -364,13 +364,9 @@ static XS (XS_IRC_get_info)
if (items == 2)
{
server = SvPV (ST (0), integer);
server_name = SvPV (ST (0), integer);
arg = SvPV (ST (1), integer);
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
{
if (strcasecmp (ptr_server->name, server) == 0)
break;
}
ptr_server = server_search (server_name);
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
@@ -385,14 +381,13 @@ static XS (XS_IRC_get_info)
arg = SvPV (ST (0), integer);
}
if (ptr_server && arg)
if (arg)
{
if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) )
{
info = PACKAGE_STRING;
}
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) )
{
if (ptr_server->nick)
info = ptr_server->nick;
@@ -402,7 +397,7 @@ static XS (XS_IRC_get_info)
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
info = CHANNEL (gui_current_window->buffer)->name;
}
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) )
{
if (ptr_server->name)
info = ptr_server->name;
@@ -411,7 +406,7 @@ static XS (XS_IRC_get_info)
{
info = weechat_home;
}
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) )
{
XST_mIV (0, SERVER(gui_current_window->buffer)->is_away);
XSRETURN (1);
@@ -721,19 +716,18 @@ static XS (XS_weechat_get_info)
{
server_name = SvPV (ST (1), integer);
ptr_server = server_search (server_name);
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s error: server not found for \"%s\" function\n"),
"Perl", "get_info");
XSRETURN_NO;
}
}
else
ptr_server = SERVER(gui_current_window->buffer);
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s error: server not found for \"%s\" function\n"),
"Perl", "get_info");
XSRETURN_NO;
}
arg = SvPV (ST (0), integer);
if (arg)
{
@@ -741,7 +735,7 @@ static XS (XS_weechat_get_info)
{
info = PACKAGE_STRING;
}
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) ) )
{
if (ptr_server->nick)
info = ptr_server->nick;
@@ -751,7 +745,7 @@ static XS (XS_weechat_get_info)
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
info = CHANNEL (gui_current_window->buffer)->name;
}
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) ) )
{
if (ptr_server->name)
info = ptr_server->name;
@@ -760,12 +754,41 @@ static XS (XS_weechat_get_info)
{
info = weechat_home;
}
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
else if ( ptr_server && ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) ) )
{
XST_mIV (0, SERVER(gui_current_window->buffer)->is_away);
XSRETURN (1);
return;
}
else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) )
{
int nItems = 0;
t_irc_dcc *p = dcc_list;
POPs;
if (items == 2)
POPs;
for(; p; p = p->next_dcc)
{
HV *infohash = (HV *) sv_2mortal((SV *) newHV());
hv_store (infohash, "address32", 9, newSViv(p->addr), 0);
hv_store (infohash, "cps", 3, newSViv(p->bytes_per_sec), 0);
hv_store (infohash, "remote_file", 11, newSVpv(p->filename, 0), 0);
hv_store (infohash, "local_file", 10, newSVpv(p->local_filename, 0), 0);
hv_store (infohash, "nick", 4, newSVpv(p->nick, 0), 0);
hv_store (infohash, "port", 4, newSViv(p->port), 0);
hv_store (infohash, "pos", 3, newSVnv(p->pos), 0);
hv_store (infohash, "size", 4, newSVnv(p->size), 0);
hv_store (infohash, "status", 6, newSViv(p->status), 0);
hv_store (infohash, "type", 4, newSViv(p->type), 0);
XPUSHs(newRV((SV *) infohash));
++nItems;
}
XSRETURN(nItems);
return;
}
if (info)
XST_mPV (0, info);
+48
View File
@@ -362,6 +362,54 @@ wee_python_get_info (PyObject *self, PyObject *args)
{
return Py_BuildValue ("i", SERVER(gui_current_window->buffer)->is_away);
}
else if ( (strcasecmp (arg, "100") == 0) || (strcasecmp (arg, "dccs") == 0) )
{
t_irc_dcc *p = dcc_list;
int nbdccs = 0;
for(; p; p = p->next_dcc)
nbdccs++;
if (nbdccs == 0)
return Py_None;
PyObject *list = PyList_New(nbdccs);
if (!list)
return Py_None;
PyObject *listvalue;
int pos = 0;
for(; p; p = p->next_dcc)
{
listvalue = Py_BuildValue("{s:k,s:k,s:s,s:s,s:s,s:i,s:k,s:k,s:i,s:i}",
"address32", p->addr,
"cps", p->bytes_per_sec,
"remote_file", p->filename,
"local_file", p->local_filename,
"nick", p->nick,
"port", p->port,
"pos", p->pos,
"size", p->size,
"status", p->status,
"type", p->type);
if (listvalue)
{
if (PyList_SetItem(list, pos, listvalue) != 0)
{
PyMem_Free(listvalue);
PyMem_Free(list);
return Py_None;
}
}
else
return Py_None;
pos++;
}
return list;
}
if (info)
return Py_BuildValue ("s", info);
+6 -4
View File
@@ -1,5 +1,5 @@
%define name weechat
%define version 0.1.3
%define version 0.1.4
%define release 1
Name: %{name}
@@ -26,12 +26,12 @@ rm -rf $RPM_BUILD_ROOT
./configure --enable-perl --enable-python
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
%install
%install
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
%find_lang %name
%clean
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
@@ -40,7 +40,9 @@ rm -rf $RPM_BUILD_ROOT
/usr/local/man/man1/weechat-curses.1*
/usr/local/bin/weechat-curses
%changelog
%changelog
* Sat Jul 30 2005 FlashCode <flashcode@flashtux.org> 0.1.4-1
- Released version 0.1.4
* Sat Jul 02 2005 FlashCode <flashcode@flashtux.org> 0.1.3-1
- Released version 0.1.3
* Sat May 21 2005 FlashCode <flashcode@flashtux.org> 0.1.2-1
+1 -1
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2005-05-21
WeeChat known bugs, 2005-07-30
- ./configure does not check that Gtk 2.0 libraries are installed
- when quitting WeeChat term title is not restored (if look_set_title is ON)
+23 -1
View File
@@ -1,9 +1,31 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-06-30
ChangeLog - 2005-07-30
Version 0.1.4 (2005-07-30):
* join and part/quit prefixes (arrows) now displayed with different colors
* added "irc_highlight" setting, to get highlight with any word
* fixed auto-rejoin for channels with key
* fixed /ctcp command (now any command/data allowed)
* added /amsg command (send text to all channels of all connected servers)
* fixed SIGSEGV handler (now write a core file by aborting program)
* fixed statusbar & infobar background refresh problem with some systems
* added color for private in hotlist (different than color for highlight)
* added DCC resume and timeout
* added function for Perl/Python to get DCC list
* fixed FIFO pipe (command now authorized on a buffer not connected
to an IRC server)
* topic completion now decodes UTF-8 string
* fixed bug with IRC URL on command line (irc://)
* new keyboard management: keys are setup in config file, new command
/key was added and some new default keys were added, alt-k key is
used to grab key (useful for /key command)
* added seconds in infobar time (optional thanks to new setting)
* fixed some curses refreshs
* channels auto-prefixed by "#" (if no prefix found) for /join command
Version 0.1.3 (2005-07-02):
* proxy support (http, socks4, socks5) with authentification (http, socks5)
and ipv6 support (client to proxy)
+11 -5
View File
@@ -1,4 +1,4 @@
WeeChat FAQ, 2005-05-21
WeeChat FAQ, 2005-07-30
=======================
Intended audience:
@@ -50,8 +50,12 @@ Q: Why using WeeChat ? X-Chat and Irssi are so good...
A: Because WeeChat is very light and has new features.
Some new features:
* many GUI (Curses, Gtk, wxWidgets, Qt),
* extensible with scripts (Perl, Python, Ruby),
* many GUI (Curses, Gtk, wxWidgets, Qt)
* nicklist available in all GUI
* extensible with scripts (Perl, Python, Ruby)
* horizontal and vertical window split
* infobar highlight
* FIFO pipe for remote control
* developed from scratch (not based on any other IRC client)
* multi-platform
* 100% GPL and free
@@ -83,7 +87,9 @@ A: You have to setup charset used for decoding, encoding, and internal WeeChat
================================================================================
Q: How can I customize key bindings?
A: Today you can't do that. This is planed for a future version.
A: Key bindings are customizable with /key command.
Default key Meta-k (usually Alt-k) lets you grab key code and insert it
in input zone.
2.5
@@ -103,7 +109,7 @@ A: You can use /perl command to load scripts (default path is
Q: How can I load Python scripts?
Are Python scripts compatible with X-chat or/and Irssi ?
A: You can use /python command to load scripts (default path is
A: You can use /python command to load scripts (default path is
~/.weechat/python).
Note that scripts in ~/.weechat/python/autoload are automatically loaded
when WeeChat is starting up.
+10 -5
View File
@@ -1,4 +1,4 @@
WeeChat FAQ, 2005-05-21
WeeChat FAQ, 2005-07-30
=======================
Public concerné :
@@ -53,8 +53,12 @@ Q: Pourquoi utiliser WeeChat ? X-Chat et Irssi sont si bien...
R: Parce que WeeChat est très léger et a de nouvelles fonctionnalités.
Quelques nouvelles fonctionnalités :
* plusieurs interfaces (Curses, Gtk, wxWidgets, Qt),
* extensible par des scripts (Perl, Python, Ruby),
* plusieurs interfaces (Curses, Gtk, wxWidgets, Qt)
* liste des pseudos disponible dans toutes les interfaces
* extensible par des scripts (Perl, Python, Ruby)
* découpage de la fenêtre horizontalement et verticalement
* highlight dans la barre d'infos
* tube FIFO pour contrôle à distance
* développé à partir de zéro (non basé sur un quelconque client IRC)
* multi-platformes
* 100% GPL et libre
@@ -87,8 +91,9 @@ R: Il faut configurer le charset utilis
================================================================================
Q: Comment puis-je configurer les raccourcis clavier ?
R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une
version future.
R: Les raccourcis clavier sont modifiables avec la commande /key.
La touche par défaut Meta-k (souvent Alt-k) permet de capturer le code
d'une touche et de l'inclure dans la zone de saisie.
2.5
+2 -4
View File
@@ -15,9 +15,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SUBDIRS = po intl src
SUBDIRS = po doc intl src
EXTRA_DIST = config.rpath weechat-curses.1 BUGS FAQ FAQ.fr \
EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
debian/changelog debian/control \
debian/copyright \
debian/rules debian/weechat-common.docs \
@@ -25,6 +25,4 @@ EXTRA_DIST = config.rpath weechat-curses.1 BUGS FAQ FAQ.fr \
debian/weechat-curses.install debian/weechat-gtk.dirs \
debian/weechat-gtk.install
man_MANS = weechat-curses.1
ACLOCAL_AMFLAGS = -I m4
+4
View File
@@ -1,6 +1,10 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
* FlashCode, 2005-07-30
WeeChat 0.1.4 released.
* FlashCode, 2005-07-02
WeeChat 0.1.3 released.
+9 -7
View File
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2005-07-02
TODO - 2005-07-20
Legend:
# done
@@ -10,7 +10,7 @@ Legend:
? is this really necessary?
v0.1.3:
v0.1.4:
------
* General:
@@ -27,8 +27,14 @@ v0.1.3:
# proxy support (http, socks4, socks5) with authentification
(http, socks5) and ipv6 support (client to proxy)
* WeeChat commands
- be able to bind a key on more than one command
- be able to make an alias running more than one command
* Configuration:
# irc_highlight setting to highlight custom words
# save buffer notify levels
# add key bindings to config file, and create /key command
Future versions:
@@ -46,11 +52,10 @@ Future versions:
nick/host connect to the given irc network
* WeeChat commands:
- "/highlight" command: highlight a given word when it appears on
channels/privates
- "/completion" command: do shortcuts (for example when we type "u"
in the text bar it send it to the server as "you")
- "/last": command to look for text in previous messages
- completion system for scripts arguments
* Interface:
- color for nicks (except own nick) when nick colors are disabled
@@ -61,6 +66,3 @@ Future versions:
* Plugins:
- Ruby plugin
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
* Configuration:
- add key bindings to config file
+3 -2
View File
@@ -19,10 +19,10 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 0.1.3, flashcode@flashtux.org)
AC_INIT(WeeChat, 0.1.4, flashcode@flashtux.org)
AC_CONFIG_SRCDIR([src/common/weechat.c])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([weechat], [0.1.3])
AM_INIT_AUTOMAKE([weechat], [0.1.4])
# Checks for programs.
AC_PROG_CC
@@ -265,6 +265,7 @@ LIBS="$LIBS $INTLLIBS"
CFLAGS="$CFLAGS $CPPFLAGS"
AC_OUTPUT([Makefile
doc/Makefile
src/Makefile
src/common/Makefile
src/irc/Makefile
+19
View File
@@ -1,3 +1,22 @@
weechat (0.1.3-2) unstable; urgency=low
* Update config.{guess,sub} to fix FTBFS on k*BSD (Closes: #316791)
-- Julien Louis <ptitlouis@sysif.net> Fri, 8 Jul 2005 21:30:38 +0200
weechat (0.1.3-1) unstable; urgency=low
* New upstream release.
-- Julien Louis <ptitlouis@sysif.net> Sat, 2 Jul 2005 20:06:29 +0200
weechat (0.1.2-3) unstable; urgency=low
* Apply patch against gui-display.c to fix curses color bug.
* remove dh_install --sourcedir to allow builds on woody.
-- Julien Louis <ptitlouis@sysif.net> Sun, 19 Jun 2005 22:37:11 +0200
weechat (0.1.2-2) unstable; urgency=low
* Patch src/gui/curse/gui-display.c to fix segfault
+2 -2
View File
@@ -3,8 +3,8 @@ Section: net
Priority: optional
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
Uploaders: Julien Louis <ptitlouis@sysif.net>
Build-Depends: debhelper (>> 4.0.4), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev
Standards-Version: 3.6.1
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls11-dev
Standards-Version: 3.6.2.1
Package: weechat
Architecture: all
+4 -4
View File
@@ -38,9 +38,9 @@ install: build
dh_testroot
dh_clean -k
dh_installdirs
$(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
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
dh_install
# 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
@@ -66,7 +66,7 @@ binary-arch: build install
dh_testroot -a
# dh_installchangelogs -a
# dh_installdocs -a
dh_installman weechat-curses.1 -pweechat-curses
dh_installman doc/weechat-curses.1 -pweechat-curses
dh_link -a usr/share/doc/weechat-common usr/share/doc/weechat-curses
dh_strip -a
dh_compress -a
+2
View File
@@ -0,0 +1,2 @@
version=2
http://weechat.flashtux.org/download/weechat-(\d.*)\.tar\.bz2
+1 -1
View File
@@ -1 +1 @@
usr/share/locale
debian/tmp/usr/share/locale/
+1 -1
View File
@@ -1 +1 @@
usr/bin/weechat-curses
debian/tmp/usr/bin/weechat-curses
-36
View File
@@ -1,36 +0,0 @@
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi weechat_doc_es.texi
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
export LANG=es_ES && makeinfo --html --no-split --number-sections weechat_doc_es.texi
export LANG=es_ES && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_es.texi >weechat_doc_es.txt
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
export LANG=en_EN && texi2pdf weechat_doc_en.texi
export LANG=es_ES && texi2pdf weechat_doc_es.texi
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
clean:
rm -rf weechat_doc_*.aux weechat_doc_*.cp weechat_doc_*.fn \
weechat_doc_*.html weechat_doc_*.ky weechat_doc_*.log \
weechat_doc_*.pdf weechat_doc_*.pg weechat_doc_*.toc \
weechat_doc_*.tp weechat_doc_*.txt weechat_doc_*.vr
+28
View File
@@ -0,0 +1,28 @@
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
man_MANS = weechat-curses.1
info_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
weechat_doc_es.texi weechat_doc_pt.texi
#weechat_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \
# weechat_doc_es.texi weechat_doc_pt.texi
AM_MAKEINFOHTMLFLAGS = --no-split --number-sections
EXTRA_DIST = $(man_MANS)
@@ -23,6 +23,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.br
display config file help (list of options)
.TP
.B \-f, \-\-key\-functions
.br
display internal functions for keys
.TP
.B \-h, \-\-help
.br
display summary of options
@@ -31,6 +35,10 @@ display summary of options
.br
display IRC commands
.TP
.B \-k, \-\-keys
.br
display default keys
.TP
.B \-l, \-\-license
.br
display program license
+130 -17
View File
@@ -35,9 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.3 - July, 03 2005
@image{weechat_image}
@subtitle Documentation for WeeChat v0.1.4-cvs - July, 16 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -150,7 +148,7 @@ Binary packages are available for these distributions:
@itemize @bullet
@item
Debian (or any Debian compatible distribution)@*
To install: @kbd{dpkg -i /path/weechat_x.y.z-1_i386.deb}
To install: @kbd{apt-get install weechat-curses}
@item
Mandriva/Redhat (or any RPM compatible distribution)@*
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
@@ -220,6 +218,8 @@ Then follow instructions for source package - @xref{Source package}.
@table @code
@item -c, --config
Display config file help (list of options)@*
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Display help screen@*
@item -i, --irc-commands
@@ -315,7 +315,10 @@ 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 %Y - %H:%M'@*
Type: string (any string), default value: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@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@*
@@ -382,6 +385,9 @@ Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_delimiters
Color for infobar delimiters@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@@ -668,12 +674,21 @@ Go to the beginning of command line@*
@item End / Ctrl + E
Go to the end of command line@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Redraw whole window@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Erase previous word of command line@*
@*
@item Backspace / Delete
Erase previous / next char of command line@*
@*
@item Ctrl + Backspace / Ctrl + W
Erase previous word of command line@*
@*
@item Tab
Complete command or nick (@kbd{Tab} again: find next completion)@*
@*
@@ -701,30 +716,48 @@ Remove last infobar message@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Redraw whole window@*
@*
@item Alt + left arrow / Alt + right arrow
Same as F5 / F6@*
@*
@item Alt + A
Switch to next buffer with activity (with priority: highlight, message, other)@*
@*
@item Alt + D
Display current DCC@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Clear hotlist (activity notification on other buffers)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Display current DCC@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Switch to server buffer@*
@*
@item Alt + X
@item Alt + J then Alt + X
Switch to first channel of next server (or server buffer if no channel is opened)@*
@*
@item Alt + digit (1-9)
Switch to buffer by number@*
@*
@item Alt + J then number (01-99)
Switch to buffer by number@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -785,6 +818,15 @@ display help about commands@*
@*
command: name of a WeeChat or IRC command@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load filename] | [autoload] | [reload] | [unload]
@*
list/load/unload Perl scripts@*
@@ -1216,6 +1258,73 @@ target: reply should match this mask@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node FIFO pipe, , WeeChat commands, Usage
@section FIFO pipe
@@ -1234,15 +1343,19 @@ Some examples:
@item @bullet{} change your nick on freenode to "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on #weechat channel:
@*
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}
@*
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
@*
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
+149 -35
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage es
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.3 - 03 de Julio de 2005
@image{weechat_image}
@subtitle Documentaci@'on para WeeChat v0.1.4-cvs - 16 de Julio de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -150,7 +149,7 @@ Los paquetes binarios est@'an disponibles para las siguientes distribuciones:
@itemize @bullet
@item
Debian (o compatible con Debian)@*
Para instalar WeeChat: @kbd{dpkg -i /direccion/weechat_x.y.z-1_i386.deb}
Para instalar WeeChat: @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (o cualquier distribuci@'on compatible con los paquetes RPM)@*
Para instalar WeeChat: @kbd{rpm -i /direccion/weechat-x.y.z-1.i386.rpm}
@@ -187,7 +186,7 @@ Adquiere los derechos de root e instala WeeChat:@*
Atenci@'on: Las fuentes CVS est@'an reservadas para usuarios con experiencia: Es posible que WeeChat no
se instale o que se sea bastante inestable.
¡Ya te he avisado!@*
@exclamdown{}Ya te he avisado!@*
Para recuperar las fuentes CVS, escribe las l@'ineas siguientes:@*
@kbd{cvs -d:pserver:anoncvs@@subversions.gnu.org:/cvsroot/weechat login}@*
@@ -221,6 +220,8 @@ Luego, lee las instructiones para Paquetes de fuentes - @xref{Paquetes de fuente
@table @code
@item -c, --config
Obtener la ayuda del fichero de configuraci@'on (lista de opciones)@*
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Obtener la ayuda@*
@item -i, --irc-commands
@@ -274,7 +275,7 @@ Typo: cadena (cualquier cadena), valor por defecto: ''@*
Juego de caracteres interno de WeeChat, deber@'ia ser ISO-xxxx aunque el locale sea UTF-8 (si no se especifica, se utiliza el juego de caracteres local)@*
Typo: cadena (cualquier cadena), valor por defecto: 'ISO-8859-1'@*
@item look_buffer_timestamp
Fecha y hora para las búfers@*
Fecha y hora para las b@'ufers@*
Typo: cadena (cualquier cadena), valor por defecto: '[%H:%M:%S]'@*
@item look_color_nicks
Mostrar nombres de usuario con colores diferentes@*
@@ -314,7 +315,10 @@ Activa la barra de informaci@'on@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_infobar_timestamp
Fecha y hora para las conversaciones guardadas@*
Typo: cadena (cualquier cadena), valor por defecto: '%B, %A %d %Y - %H:%M'@*
Typo: cadena (cualquier cadena), valor por defecto: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_infobar_delay_highlight
Retraso (en segundos) para la notificaci@'on de mensajes en la barra de informaci@'on (0 = desactivar las notificaciones en la barra de informaci@'on)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 7@*
@@ -381,6 +385,9 @@ Typo: color (color Curses @'o Gtk), valor por defecto: 'blue'@*
@item col_infobar
Color para el texto de la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'black'@*
@item col_infobar_delimiters
Color para los delimitadores de la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'blue'@*
@item col_infobar_highlight
Color para la notificaci@'on en la barra de informaci@'on@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'white'@*
@@ -457,10 +464,10 @@ Typo: color (color Curses @'o Gtk), valor por defecto: 'lightred'@*
Color para el estado dcc "abortado"@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'lightred'@*
@item history_max_lines
Número m@'aximo de l@'ineas en el hist@'orico para un servidor/canal/privado (0 = ilimitado)@*
N@'umero m@'aximo de l@'ineas en el hist@'orico para un servidor/canal/privado (0 = ilimitado)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 4096@*
@item history_max_commands
Número m@'aximo de comandos de usuario en el hist@'orico (0 = ilimitado)@*
N@'umero m@'aximo de comandos de usuario en el hist@'orico (0 = ilimitado)@*
Typo: entero (valores: entre 0 y 2147483647), valor por defecto: 100@*
@item log_auto_server
Registrar autom@'aticamente los mensajes de servidor@*
@@ -514,7 +521,7 @@ Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
Aceptar autom@'aticamente los ficheros dcc entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item dcc_auto_accept_chats
Aceptar autom@'aticamente las peticiones de conversaci@'on dcc (¡utilizar con precauci@'on!)@*
Aceptar autom@'aticamente las peticiones de conversaci@'on dcc (@exclamdown{}utilizar con precauci@'on!)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item dcc_timeout
Tiempo de espera para la petici@'on dcc (en segundos)@*
@@ -667,12 +674,21 @@ Ir al inicio de la l@'inea de comandos@*
@item Fin / Ctrl + E
Ir al final de la l@'inea de comandos@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Refrescar toda la ventana@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Borrar la palabra anterior en la l@'inea de comandos@*
@*
@item Backspace / Supr
Borrar el caracter anterior / siguiente en la l@'inea de comandos@*
@*
@item Ctrl + Backspace / Ctrl + W
Borrar la palabra anterior en la l@'inea de comandos@*
@*
@item Tab
Completar el comando o el seud@'onimo (@kbd{Tab} de nuevo: encontrar la pr@'oxima autocompletaci@'on)@*
@*
@@ -700,30 +716,48 @@ Borrar el @'ultimo mensaje en la barra de informaciones@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Refrescar toda la ventana@*
@*
@item Alt + flecha izquierda / Alt + flecha derecha
Como F5 / F6@*
@*
@item Alt + A
Ir a la memoria temporal donde hay actividad (con el orden de prioridad siguiente: resaltado, mensaje, otros)@*
@*
@item Alt + D
Obtener la lista de DCC actual@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Borrar la 'hotlist' (notificaci@'on de actividad en otras memorias temporales)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Obtener la lista de DCC actual@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Ir a la memoria temporal del servidor@*
@*
@item Alt + X
@item Alt + J then Alt + X
Ir al primer canal del servidor siguiente (o a la memoria temporal del servidor si ning@'un canal est@'a abierto)@*
@*
@item Alt + (1-9)
Saltar a la memoria temporal con ese n@'umero@*
@*
@item Alt + J then number (01-99)
Saltar a la memoria temporal con ese n@'umero@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -743,16 +777,16 @@ nombre_alias: nombre del seud@'onimo@*
comando: nombre del comando (comando WeeChat @'o IRC, sin el primer '/')@*
argumentos: par@'ametros para el comando@*
@*
@item buffer [acci@'on | número]
@item buffer [acci@'on | n@'umero]
@*
gestionar los búfers@*
gestionar los b@'ufers@*
@*
acci@'on: acci@'on a efectuar:@*
move: desplaza el búfer en la lista (puede ser relativo, por ejemplo, -1)@*
close: cierra el búfer (para un canal equivale a /part sin el mensaje de fin)@*
list: lista los búfers abiertos (si no hay par@'ametros se supone esta lista)@*
move: desplaza el b@'ufer en la lista (puede ser relativo, por ejemplo, -1)@*
close: cierra el b@'ufer (para un canal equivale a /part sin el mensaje de fin)@*
list: lista los b@'ufers abiertos (si no hay par@'ametros se supone esta lista)@*
notify: fija el nivel de notificaci@'on (0=nunca, 1=highlight, 2=1+msg, 3=2+join/part)@*
número: saltar al búfer por número@*
n@'umero: saltar al b@'ufer por n@'umero@*
@*
@item clear [-all]
@*
@@ -784,6 +818,15 @@ mostrar ayuda sobre los comandos@*
@*
comando: nombre de un comando de Weechat @'o de IRC@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load fichero] | [autoload] | [reload] | [unload]
@*
lista/carga/descarga de los Perl scripts@*
@@ -858,7 +901,7 @@ target: servidor objetivo@*
revertir el estado ausente@*
@*
-all: revertir el estado ausente en todos los servidores conectados@*
mensaje: mensaje para el estado ausente (si no se da ningún mensaje, se elimina el estado ausente)@*
mensaje: mensaje para el estado ausente (si no se da ning@'un mensaje, se elimina el estado ausente)@*
@*
@item ban [canal] [usariio [usuario ...]]
@*
@@ -989,7 +1032,7 @@ modos del canal:@*
s: indicador de canal secreto@*
i: indicador de canal s@'olo con invitaci@'on@*
t: indicador de tema s@'olo modificable por operador de canal@*
n: ningún mensaje al canal desde el exterior@*
n: ning@'un mensaje al canal desde el exterior@*
m: canal moderado@*
l: fijar el l@'imite de usuarios para el canal@*
b: establecer una m@'ascara de baneo para mantener fuera a usuarios@*
@@ -1205,16 +1248,83 @@ pedir informaci@'on sobre el/los usuario(s)@*
servidor: nombre del servidor@*
usuario: nombre de usuario (puede que sea una m@'ascara)@*
@*
@item whowas usuario [,usuario [,usuario ...]] [número [destinatario]]
@item whowas usuario [,usuario [,usuario ...]] [n@'umero [destinatario]]
@*
pedir informaci@'on sobre un usuario que ya no existe@*
@*
usuario: nombre de usuario a buscar@*
número: número de respuestas a devolver (búsqueda completa si el número es negativo)@*
n@'umero: n@'umero de respuestas a devolver (b@'usqueda completa si el n@'umero es negativo)@*
destinatario: la respuesta deber@'ia concordar con esta m@'ascara@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node Canal FIFO, , Comandos WeeChat, Uso
@section Canal FIFO
@@ -1235,15 +1345,19 @@ Algunos ejemplos:
@item @bullet{} cambiar el seud@'onimo en freenode por "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} escribir texto en el canal #weechat:
@*
@command{echo "freenode,#weechat *@exclamdown{}Hola a todos!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} escribir texto en el canal corriente (el que se puede visualizar en WeeChat actualmente)
@*
@command{echo "*¡Hola!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*@exclamdown{}Hola!" >~/.weechat/weechat_fifo_12345}
@*
@b{Advertencia:} esto es peligroso y no deber@'ias hacerlo.. salvo si lo que est@'as haciendo.
@*
@item @bullet{} enviar dos comandos para descargar y recargar los scripts Perl (tienes que separarlos con un \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1370,7 +1484,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $mensaje) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($mascara, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("mascara=$mascara, canal=$canal, mensaje=$mensaje\n");}@*
@code{@ @ @ @ weechat::print ("masc=$mascara, canal=$canal, msj=$mensaje\n");}@*
@code{@} }@*
@*
@@ -1538,7 +1652,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*
@code{@ @ @ @ null, canal, mensaje = string.split(args, ":", 2)}@*
@code{@ @ @ @ mascara, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("mascara="+mascara+", canal="+canal+", mensaje="+mensaje)}@*
@code{@ @ @ @ weechat.prnt("masc="+mascara+", canal="+canal+", msj="+mensaje)}@*
@*
@item
@@ -1609,7 +1723,7 @@ Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
@node Programas Ruby, , Programas Python, Extensiones
@section Programas Ruby
¡No desarrollado!
@exclamdown{}No desarrollado!
@c **************************** Autores / Soporte *****************************
+137 -20
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage fr
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.3 - 03 Juillet 2005
@image{weechat_image}
@subtitle Documentation pour WeeChat v0.1.4-cvs - 16 Juillet 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -149,7 +148,7 @@ Les paquets binaires sont disponibles pour les distributions suivantes :
@itemize @bullet
@item
Debian (ou toute distribution compatible Debian)@*
Pour installer : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
Pour installer : @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
@@ -222,6 +221,8 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
Afficher l'aide sur le fichier de config (liste des options)@*
@item -h, --help
Afficher l'aide@*
@item -f, --key-functions
Afficher la liste des fonctions internes WeeChat pour les touches@*
@item -i, --irc-commands
Afficher la liste des commandes IRC@*
@item -l, --license
@@ -315,7 +316,10 @@ 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 %Y - %H:%M'@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '%B, %A %d %Y'@*
@item look_infobar_seconds
Afficher les secondes pour l'heure dans la barre d'infos@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@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@*
@@ -382,6 +386,9 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar
Couleur pour la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'black'@*
@item col_infobar_delimiters
Couleur pour les d@'elimiteurs de la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'blue'@*
@item col_infobar_highlight
Couleur pour la notification dans la barre d'infos@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
@@ -668,12 +675,21 @@ Aller au d@'ebut de la ligne de commande@*
@item End / Ctrl + E
Aller @`a la fin de la ligne de commande@*
@*
@item Ctrl + K
Efface jusqu'@`a la fin de la ligne@*
@*
@item Ctrl + L
R@'eaffiche toute la fen@^etre@*
@*
@item Ctrl + U
Efface jusqu'au d@'ebut de la ligne@*
@*
@item Ctrl + W
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
@*
@item Backspace / Delete
Effacer le mot pr@'ec@'edent / suivant sur la ligne de commande@*
@*
@item Ctrl + Backspace / Ctrl + W
Effacer le mot pr@'ec@'edent sur la ligne de commande@*
@*
@item Tab
Compl@'eter la commande ou le pseudo (@kbd{Tab} @`a nouveau : trouver la compl@'etion suivante)@*
@*
@@ -701,30 +717,48 @@ Effacer le dernier message de la barre d'infos@*
@item F11 / F12
Faire d@'efiler la liste des pseudos@*
@*
@item Ctrl + L
R@'eaffiche toute la fen@^etre@*
@*
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
Identique @`a F5 / F6@*
@*
@item Alt + A
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
@*
@item Alt + B
Aller au mot pr@'ec@'edent@*
@*
@item Alt + D
Effacer le mot suivant@*
@*
@item Alt + F
Aller au mot suivant@*
@*
@item Alt + H
Vide la hotlist (notification d'activit@'e sur les autres tampons)@*
@*
@item Alt + J puis Alt + D
Afficher les DCC en cours@*
@*
@item Alt + R
Vide la hotlist (notification d'activité sur les autres tampons)@*
@item Alt + J puis Alt + L
Sauter au dernier tampon@*
@*
@item Alt + S
@item Alt + J puis Alt + S
Sauter au tampon du serveur@*
@*
@item Alt + X
Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal ouvert)@*
@*
@item Alt + chiffre (1-9)
Sauter au tampon avec ce num@'ero@*
@*
@item Alt + J then Alt + X
Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal ouvert)@*
@*
@item Alt + K
Capturer une touche
@*
@item Alt + J puis nombre (01-99)
Sauter au tampon avec ce num@'ero@*
@*
@item Alt + R
Effacer la ligne enti@`ere@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Faire d@'efiler la liste des pseudos@*
@*
@@ -785,6 +819,15 @@ afficher l'aide sur les commandes@*
@*
commande: nom d'une commande WeeChat ou IRC@*
@*
@item key [touche fonction/commande] [unbind touche] [functions] [reset -yes]
@*
associer/lib@'erer des touches@*
@*
touche: associer cette touche @`a une fonction interne ou une commande (commen@,{c}ant par "/")@*
unbind: supprimer l'association @`a une touche (si "all", toutes les associations de touches par d@'efaut sont restaur@'ees)@*
functions: lister la liste des fonctions internes pour les associations de touches@*
reset: restaur les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
@*
@item perl [load fichier] | [autoload] | [reload] | [unload]
@*
liste/charge/d@'echarge des scripts Perl@*
@@ -1216,6 +1259,73 @@ cible: la r@'eponse doit correspondre @`a ce masque@*
@*
@end table
Fonctions internes pour les touches :@*
@table @kbd
@item return
terminer la ligne@*
@item tab
compl@'eter le mot@*
@item backspace
effacer le caract@`ere pr@'ec@'edent@*
@item delete
effacer le caract@`ere suivant@*
@item delete_end_line
effacer jusqu'@`a la fin de la ligne@*
@item delete_beginning_line
effacer jusqu'au d@'ebut de la ligne@*
@item delete_line
effacer la ligne enti@`ere@*
@item delete_previous_word
effacer le mot pr@'ec@'edent@*
@item delete_next_word
effacer le mot suivant@*
@item home
aller au d@'ebut de la ligne@*
@item end
aller @`a la fin de la ligne@*
@item left
se d@'eplacer d'un caract@`ere @`a gauche@*
@item previous_word
se d@'eplacer au mot pr@'ec@'edent@*
@item right
se d@'eplacer d'un caract@`ere @`a droite@*
@item next_word
se d@'eplacer au mot suivant@*
@item up
appeler la commande pr@'ec@'edente dans l'historique@*
@item down
appeler la commande suivante dans l'historique@*
@item page_up
faire d@'efiler d'une page vers le haut@*
@item page_down
faire d@'efiler d'une page vers le bas@*
@item infobar_clear
effacer la barre d'infos@*
@item nick_page_up
faire d@'efiler la liste des pseudos d'une page vers le haut@*
@item nick_page_down
faire d@'efiler la liste des pseudos d'une page vers le bas@*
@item nick_beginning
afficher le d@'ebut de la liste des pseudos@*
@item nick_end
afficher la fin de la liste des pseudos@*
@item refresh
rafraichir l'@'ecran@*
@item jump_smart
sauter au tampon avec de l'activit@'e@*
@item jump_dcc
sauter au tampon DCC@*
@item jump_server
sauter au tampon du serveur@*
@item jump_next_server
sauter au prochain serveur@*
@item hotlist_clear
effacer la liste d'activit@'e@*
@item grab_key
capturer une touche@*
@end table
@node Tube FIFO, , Commandes WeeChat, Utilisation
@section Tube FIFO
@@ -1235,14 +1345,21 @@ serveur doit l'@^etre aussi.@*
Quelques exemples :
@table @asis
@item @bullet{} changement du pseudo sur freenode en "pseudo|absent":
@*
@command{echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} affichage de texte sur le canal #weechat :
@*
@command{echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} affichage de texte sur le canal courant (le tampon affich@'e par WeeChat):
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}@*
@*
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}
@*
@b{Attention :} ceci est dangereux et vous ne devriez pas le faire sauf si vous savez ce que vous faites !
@item @bullet{} envoyer deux commandes pour décharger/recharger les scripts Perl (vous devez les séparer par \n):
@*
@item @bullet{} envoyer deux commandes pour d@'echarger/recharger les scripts Perl (vous devez les s@'eparer par \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1370,7 +1487,7 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, message=$message\n");}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, msg=$message\n");}@*
@code{@} }@*
@*
+132 -18
View File
@@ -30,14 +30,13 @@
@c end tex
@documentlanguage pt
@documentencoding ISO-8859-1
@titlepage
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.3 - 03 de Julho de 2005
@image{weechat_image}
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.4-cvs - 16 de Julho de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -148,7 +147,7 @@ Os pacotes bin@'arios est@'ao dispon@'iveis para as seguintes distribui@,{c}@~oe
@itemize @bullet
@item
Debian (ou compat@'ivel)@*
Instala@,{c}@~ao : @kbd{dpkg -i /chemin/weechat_x.y.z-1_i386.deb}
Instala@,{c}@~ao : @kbd{apt-get install weechat-curses}
@item
Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
@@ -218,6 +217,8 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
@table @code
@item -c, --config
Mostrar da lima dos config da exposi@,{c}@~ao (lista das op@,{c}@~oes)
@item -f, --key-functions
Display WeeChat internal functions for keys@*
@item -h, --help
Mostrar a ajuda@*
@item -i, --irc-commands
@@ -312,7 +313,10 @@ 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 %Y - %H:%M'@*
Type: string (any string), default value: '%B, %A %d %Y'@*
@item look_infobar_seconds
Display seconds in infobar time@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@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@*
@@ -379,6 +383,9 @@ Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar
Color for info bar text@*
Type: color (Curses or Gtk color), default value: 'black'@*
@item col_infobar_delimiters
Color for infobar delimiters@*
Type: color (Curses or Gtk color), default value: 'blue'@*
@item col_infobar_highlight
Color for info bar highlight notification@*
Type: color (Curses or Gtk color), default value: 'white'@*
@@ -665,12 +672,21 @@ Ir para o in@'icio da linha de comando@*
@item End / Ctrl + E
Ir para o fim da linha de comando@*
@*
@item Ctrl + K
Delete until end of line@*
@*
@item Ctrl + L
Redesenhe a janela inteira@*
@*
@item Ctrl + U
Delete until beginning of line@*
@*
@item Ctrl + W
Apagar a palavra anterior na linha de comando
@*
@item Backspace / Delete
Apagar o caractere anterior / seguinte na linha de comando@*
@*
@item Ctrl + Backspace / Ctrl + W
Apagar a palavra anterior na linha de comando
@*
@item Tab
Completar o comando ou o nick (@kbd{Tab} novamente : encontrar a pr@'oxima sugest@~ao)@*
@*
@@ -698,30 +714,48 @@ Apagar a @'ultima mensagem da barra do info@*
@item F11 / F12
Scroll nicklist@*
@*
@item Ctrl + L
Redesenhe a janela inteira@*
@*
@item Alt + Seta da esquerda / Alt + Seta da direita
Identico a F5 / F6@*
@*
@item Alt + A
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
@*
@item Alt + D
Exposi@,{c}@~ao DCC atual@*
@item Alt + B
Go to previous word@*
@*
@item Alt + R
@item Alt + D
Delete next word@*
@*
@item Alt + F
Go to next word@*
@*
@item Alt + H
Hotlist desobstru@'ido (notifica@,{c}@~ao da atividade em outros amortecedores)@*
@*
@item Alt + S
@item Alt + J then Alt + D
Exposi@,{c}@~ao DCC atual@*
@*
@item Alt + J then Alt + L
Switch to last buffer@*
@*
@item Alt + J then Alt + S
Comute ao amortecedor do servidor@*
@*
@item Alt + X
@item Alt + J then Alt + X
Comute @`a primeira canaleta do servidor seguinte (ou do amortecedor do servidor se nenhuma canaleta for aberta)@*
@*
@item Alt + d@'igito (1-9)
Comute ao amortecedor pelo n@'umero@*
@*
@item Alt + J then number (01-99)
Comute ao amortecedor pelo n@'umero@*
@*
@item Alt + K
Grab a key
@*
@item Alt + R
Delete entire line@*
@*
@item Alt + PageUp / Alt + PageDown / Alt + Home / Alt + End
Scroll nicklist@*
@*
@@ -782,6 +816,15 @@ display help about commands@*
@*
command: name of a WeeChat or IRC command@*
@*
@item key [key function/command] [unbind key] [functions] [reset -yes]
@*
bind/unbind keys@*
@*
key: bind this key to an internal function or a command (beginning by "/")@*
unbind: unbind a key (if "all", default bindings are restored)@*
functions: list internal functions for key bindings@*
reset: restore bindings to the default values and delete ALL personal binding (use carefully!)@*
@*
@item perl [load filename] | [autoload] | [reload] | [unload]
@*
list/load/unload Perl scripts@*
@@ -1213,6 +1256,73 @@ target: reply should match this mask@*
@*
@end table
Internal functions for keys:@*
@table @kbd
@item return
terminate line@*
@item tab
complete word@*
@item backspace
delete previous char@*
@item delete
delete next char@*
@item delete_end_line
delete until end of line@*
@item delete_beginning_line
delete until beginning of line@*
@item delete_line
delete entire line@*
@item delete_previous_word
delete previous word@*
@item delete_next_word
delete next word@*
@item home
go to beginning of line@*
@item end
go to end of line@*
@item left
move one char left@*
@item previous_word
move to previous word@*
@item right
move one char right@*
@item next_word
move to next word@*
@item up
call previous command in history@*
@item down
call next command in history@*
@item page_up
scroll one page up@*
@item page_down
scroll one page down@*
@item infobar_clear
clear infobar@*
@item nick_page_up
scroll nicklist one page up@*
@item nick_page_down
scroll nicklist one page down@*
@item nick_beginning
display beginning of nicklist@*
@item nick_end
display end of nicklist@*
@item refresh
refresh screen@*
@item jump_smart
jump to buffer with activity@*
@item jump_dcc
jump to DCC buffer@*
@item jump_server
jump to server buffer@*
@item jump_next_server
jump to next server@*
@item hotlist_clear
clear hotlist@*
@item grab_key
grab a key@*
@end table
@node FIFO pipe, , Comandos do WeeChat, Utilizacao
@section FIFO pipe
@@ -1231,15 +1341,19 @@ Some examples:
@item @bullet{} change your nick on freenode to "mynick|out":
@*
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on #weechat channel:
@*
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
@*
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}
@*
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
@*
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
@*
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
@end table
@*
@@ -1526,7 +1640,7 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", chan="+channel+", msg="+message)}@*
@*
@item
Binary file not shown.
+1
View File
@@ -18,6 +18,7 @@
./src/gui/gtk/gui-display.c
./src/gui/gtk/gui-input.c
./src/gui/gui-common.c
./src/gui/gui-keyboard.c
./src/gui/gui.h
./src/common/command.c
./src/common/command.h
+1147 -856
View File
File diff suppressed because it is too large Load Diff
+1098 -811
View File
File diff suppressed because it is too large Load Diff
+1096 -827
View File
File diff suppressed because it is too large Load Diff
+211 -49
View File
@@ -47,11 +47,11 @@ t_weechat_command weechat_commands[] =
{ "buffer", N_("manage buffers"),
N_("[action | number]"),
N_("action: action to do:\n"
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (for channel: same as /part without part message)\n"
" list: list opened buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"number: jump to buffer by number"),
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (for channel: same as /part without part message)\n"
" list: list opened buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"number: jump to buffer by number"),
0, MAX_ARGS, weechat_cmd_buffer, NULL },
{ "clear", N_("clear window(s)"),
N_("[-all]"),
@@ -72,33 +72,40 @@ t_weechat_command weechat_commands[] =
{ "help", N_("display help about commands"),
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
0, 1, weechat_cmd_help, NULL },
{ "key", N_("bind/unbind keys"),
N_("[key function/command] [unbind key] [functions] [reset -yes]"),
N_("key: bind this key to an internal function or a command (beginning by \"/\")\n"
"unbind: unbind a key (if \"all\", default bindings are restored)\n"
"functions: list internal functions for key bindings\n"
"reset: restore bindings to the default values and delete ALL personal binding (use carefully!)"),
0, MAX_ARGS, NULL, weechat_cmd_key },
{ "perl", N_("list/load/unload Perl scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Perl script (file) to load\n"
"Without argument, /perl command lists all loaded Perl scripts."),
"Without argument, /perl command lists all loaded Perl scripts."),
0, 2, weechat_cmd_perl, NULL },
{ "python", N_("list/load/unload Python scripts"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: Python script (file) to load\n"
"Without argument, /python command lists all loaded Python scripts."),
"Without argument, /python command lists all loaded Python scripts."),
0, 2, weechat_cmd_python, NULL },
{ "server", N_("list, add or remove servers"),
N_("[servername] | "
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 "
"[nick2 [nick3]]] [-username username] [-realname realname] "
"[-command command] [-autojoin channel[,channel]] ] | "
"[del servername]"),
"[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 "
"[nick2 [nick3]]] [-username username] [-realname realname] "
"[-command command] [-autojoin channel[,channel]] ] | "
"[del servername]"),
N_("servername: server name, for internal & display use\n"
"hostname: name or IP address of server\n"
"port: port for server (integer)\n"
"ipv6: use IPv6 protocol\n"
"ssl: use SSL protocol\n"
"password: password for server\n"
"nick1: first nick for server\n"
"nick2: alternate nick for server\n"
"nick3: second alternate nick for server\n"
"username: user name\n"
"realname: real name of user"),
"hostname: name or IP address of server\n"
"port: port for server (integer)\n"
"ipv6: use IPv6 protocol\n"
"ssl: use SSL protocol\n"
"password: password for server\n"
"nick1: first nick for server\n"
"nick2: alternate nick for server\n"
"nick3: second alternate nick for server\n"
"username: user name\n"
"realname: real name of user"),
0, MAX_ARGS, weechat_cmd_server, NULL },
{ "save", N_("save config to disk"),
N_("[file]"), N_("file: filename for writing config"),
@@ -111,11 +118,10 @@ t_weechat_command weechat_commands[] =
1, 1, NULL, weechat_cmd_unalias },
{ "window", N_("manage windows"),
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
N_(
"list: list opened windows (no parameter implies this list)\n"
"splith: split current window horizontally\n"
"splitv: split current window vertically\n"
"merge: merge window with another"),
N_("list: list opened windows (no parameter implies this list)\n"
"splith: split current window horizontally\n"
"splitv: split current window vertically\n"
"merge: merge window with another"),
0, 2, weechat_cmd_window, NULL },
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
};
@@ -877,6 +883,7 @@ weechat_cmd_buffer (int argc, char **argv)
t_irc_channel *ptr_channel;
long number;
char *error;
int target_buffer;
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
{
@@ -964,7 +971,9 @@ weechat_cmd_buffer (int argc, char **argv)
{
if (SERVER(gui_current_window->buffer))
{
if (SERVER(gui_current_window->buffer)->is_connected)
if (SERVER(gui_current_window->buffer)->is_connected
&& CHANNEL(gui_current_window->buffer)
&& CHANNEL(gui_current_window->buffer)->nicks)
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
else
{
@@ -1049,26 +1058,41 @@ weechat_cmd_buffer (int argc, char **argv)
{
/* jump to buffer by number */
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
if (argv[0][0] == '-')
{
if (!gui_switch_to_buffer_by_number (gui_current_window, (int) number))
/* relative jump '-' */
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s buffer \"%s\" not found for \"%s\" command\n"),
WEECHAT_ERROR, argv[0], "buffer");
return -1;
target_buffer = gui_current_window->buffer->number - (int) number;
if (target_buffer < 1)
target_buffer = (last_gui_buffer) ? last_gui_buffer->number + target_buffer : 1;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
}
}
else if (argv[0][0] == '+')
{
/* relative jump '+' */
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
{
target_buffer = gui_current_window->buffer->number + (int) number;
if (last_gui_buffer && target_buffer > last_gui_buffer->number)
target_buffer -= last_gui_buffer->number;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
}
}
else
{
/* invalid number */
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s incorrect buffer number\n"),
WEECHAT_ERROR);
return -1;
/* absolute jump by number */
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_buffer_by_number (gui_current_window, (int) number);
}
}
@@ -1178,7 +1202,7 @@ weechat_cmd_debug (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unknown option for \"%s\" command\n"),
WEECHAT_ERROR, "perl");
WEECHAT_ERROR, "debug");
return -1;
}
@@ -1322,6 +1346,139 @@ weechat_cmd_help (int argc, char **argv)
return 0;
}
/*
* weechat_cmd_key_display: display a key binding
*/
void
weechat_cmd_key_display (t_gui_key *key, int new_key)
{
char *expanded_name;
expanded_name = gui_key_get_expanded_name (key->key);
if (new_key)
{
gui_printf (NULL, _("New key binding:\n"));
gui_printf (NULL, " %s", (expanded_name) ? expanded_name : key->key);
}
else
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " => ");
gui_printf (NULL, "%s\n",
(key->function) ?
gui_key_function_search_by_ptr (key->function) : key->command);
if (expanded_name)
free (expanded_name);
}
/*
* weechat_cmd_key: bind/unbind keys
*/
int
weechat_cmd_key (char *arguments)
{
char *pos;
int i;
t_gui_key *ptr_key;
if (arguments)
{
while (arguments[0] == ' ')
arguments++;
}
if (!arguments || (arguments[0] == '\0'))
{
gui_printf (NULL, "\n");
gui_printf (NULL, _("Key bindings:\n"));
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
weechat_cmd_key_display (ptr_key, 0);
}
}
else if (strncasecmp (arguments, "unbind ", 7) == 0)
{
arguments += 7;
while (arguments[0] == ' ')
arguments++;
if (gui_key_unbind (arguments))
gui_printf (NULL, _("Key \"%s\" unbinded\n"), arguments);
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unable to unbind key \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
}
}
else if (strcasecmp (arguments, "functions") == 0)
{
gui_printf (NULL, "\n");
gui_printf (NULL, _("Internal key functions:\n"));
i = 0;
while (gui_key_functions[i].function_name)
{
gui_printf (NULL, "%25s %s\n",
gui_key_functions[i].function_name,
_(gui_key_functions[i].description));
i++;
}
}
else if (strncasecmp (arguments, "reset", 5) == 0)
{
arguments += 5;
while (arguments[0] == ' ')
arguments++;
if (strcasecmp (arguments, "-yes") == 0)
{
gui_key_free_all ();
gui_key_init ();
gui_printf (NULL, _("Default key bindings restored\n"));
}
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s \"-yes\" argument is required for keys reset (securuty reason)\n"),
WEECHAT_ERROR);
return -1;
}
}
else
{
while (arguments[0] == ' ')
arguments++;
pos = strchr (arguments, ' ');
if (!pos)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "key");
return -1;
}
pos[0] = '\0';
pos++;
while (pos[0] == ' ')
pos++;
ptr_key = gui_key_bind (arguments, pos);
if (ptr_key)
weechat_cmd_key_display (ptr_key, 1);
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s unable to bind key \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
}
}
return 0;
}
/*
* weechat_cmd_perl: list/load/unload Perl scripts
*/
@@ -1892,11 +2049,11 @@ weechat_cmd_server (int argc, char **argv)
}
/*
* weechat_set_cmd_display_option: display config option
* weechat_cmd_set_display_option: display config option
*/
void
weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *value)
weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *value)
{
char *color_name, *pos_nickserv, *pos_pwd, *value2;
@@ -2039,7 +2196,7 @@ weechat_cmd_set (char *arguments)
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_server->name,
ptr_option_value);
}
@@ -2080,7 +2237,7 @@ weechat_cmd_set (char *arguments)
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", config_get_section (ptr_option));
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
weechat_set_cmd_display_option (ptr_option, NULL, NULL);
weechat_cmd_set_display_option (ptr_option, NULL, NULL);
}
else
{
@@ -2104,7 +2261,8 @@ weechat_cmd_set (char *arguments)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
section_displayed = 0;
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -2122,7 +2280,7 @@ weechat_cmd_set (char *arguments)
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
section_displayed = 1;
}
weechat_set_cmd_display_option (&weechat_options[i][j], NULL, NULL);
weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);
number_found++;
}
}
@@ -2155,7 +2313,7 @@ weechat_cmd_set (char *arguments)
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
weechat_set_cmd_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
weechat_cmd_set_display_option (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_server->name,
ptr_option_value);
number_found++;
@@ -2288,6 +2446,10 @@ weechat_cmd_window (int argc, char **argv)
else
gui_window_merge_auto (gui_current_window);
}
else if (strcasecmp (argv[0], "-1") == 0)
gui_switch_to_previous_window ();
else if (strcasecmp (argv[0], "+1") == 0)
gui_switch_to_next_window ();
else
{
irc_display_prefix (NULL, PREFIX_ERROR);
+1
View File
@@ -69,6 +69,7 @@ extern int weechat_cmd_connect (int, char **);
extern int weechat_cmd_debug (int, char **);
extern int weechat_cmd_disconnect (int, char **);
extern int weechat_cmd_help (int, char **);
extern int weechat_cmd_key (char *);
extern int weechat_cmd_perl (int, char **);
extern int weechat_cmd_python (int, char **);
extern int weechat_cmd_save (int, char **);
+30 -3
View File
@@ -102,7 +102,7 @@ completion_build_list (t_completion *completion, void *channel)
int i, j;
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
char *pos, option_name[256];
char *pos, option_name[256], *string;
t_weechat_alias *ptr_alias;
t_config_option *option;
void *option_value;
@@ -201,6 +201,20 @@ completion_build_list (t_completion *completion, void *channel)
}
return;
}
if ((strcasecmp (completion->base_command, "key") == 0)
&& (completion->base_command_arg == 1))
{
weelist_add (&completion->completion_list,
&completion->last_completion,
"unbind");
weelist_add (&completion->completion_list,
&completion->last_completion,
"functions");
weelist_add (&completion->completion_list,
&completion->last_completion,
"reset");
return;
}
if (((strcasecmp (completion->base_command, "perl") == 0)
|| (strcasecmp (completion->base_command, "python") == 0))
&& (completion->base_command_arg == 1))
@@ -225,7 +239,8 @@ completion_build_list (t_completion *completion, void *channel)
{
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -307,6 +322,8 @@ completion_build_list (t_completion *completion, void *channel)
pos[0] = ' ';
}
}
else
completion_stop (completion);
return;
}
if ((strcasecmp (completion->base_command, "unalias") == 0)
@@ -407,6 +424,9 @@ completion_build_list (t_completion *completion, void *channel)
weelist_add (&completion->completion_list,
&completion->last_completion,
"action");
weelist_add (&completion->completion_list,
&completion->last_completion,
"ping");
weelist_add (&completion->completion_list,
&completion->last_completion,
"version");
@@ -507,9 +527,16 @@ completion_build_list (t_completion *completion, void *channel)
|| !((t_irc_channel *)channel)->topic[0])
completion_stop (completion);
else
{
string = weechat_convert_encoding (cfg_look_charset_decode,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
((t_irc_channel *)channel)->topic);
weelist_add (&completion->completion_list,
&completion->last_completion,
((t_irc_channel *)channel)->topic);
string);
free (string);
}
}
else
completion_stop (completion);
+3 -19
View File
@@ -112,16 +112,8 @@ fifo_exec (char *text)
if (text[0] == '*')
{
pos_msg = text + 1;
ptr_server = SERVER(gui_current_window->buffer);
ptr_buffer = gui_current_window->buffer;
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s invalid buffer for displaying text via FIFO pipe\n"),
WEECHAT_WARNING);
return;
}
ptr_buffer = (gui_current_window->buffer->has_input) ? gui_current_window->buffer : gui_buffers;
ptr_server = SERVER(ptr_buffer);
}
else
{
@@ -172,20 +164,12 @@ fifo_exec (char *text)
}
}
if (!ptr_server)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
WEECHAT_WARNING);
return;
}
if (!ptr_buffer)
{
if (ptr_channel)
ptr_buffer = ptr_channel->buffer;
else
ptr_buffer = ptr_server->buffer;
ptr_buffer = gui_buffers;
}
user_command (ptr_server, ptr_buffer, pos_msg);
+6 -1
View File
@@ -23,12 +23,17 @@
#include "../irc/irc.h"
#define HOTLIST_LOW 0
#define HOTLIST_MSG 1
#define HOTLIST_PRIVATE 2
#define HOTLIST_HIGHLIGHT 3
typedef struct t_weechat_hotlist t_weechat_hotlist;
struct t_weechat_hotlist
{
int priority; /* 0=crappy msg (join/part), 1=msg, */
/* 2=nick highlight */
/* 2=pv, 3=nick highlight */
t_gui_buffer *buffer; /* associated buffer */
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
+78 -31
View File
@@ -313,6 +313,48 @@ void wee_display_commands (int weechat_cmd, int irc_cmd)
}
}
/*
* wee_display_key_functions: display WeeChat key functions
*/
void wee_display_key_functions ()
{
int i;
printf (_("Internal key functions:\n"));
printf ("\n");
i = 0;
while (gui_key_functions[i].function_name)
{
printf ("* %s: %s\n",
gui_key_functions[i].function_name,
_(gui_key_functions[i].description));
i++;
}
}
/*
* wee_display_keys: display WeeChat default keys
*/
void wee_display_keys ()
{
t_gui_key *ptr_key;
char *expanded_name;
printf (_("%s default keys:\n"), PACKAGE_NAME);
printf ("\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
printf ("* %s => %s\n",
(expanded_name) ? expanded_name : ptr_key->key,
(ptr_key->function) ? gui_key_function_search_by_ptr (ptr_key->function) : ptr_key->command);
if (expanded_name)
free (expanded_name);
}
}
/*
* wee_parse_args: parse command line args
*/
@@ -331,38 +373,50 @@ wee_parse_args (int argc, char *argv[])
|| (strcmp (argv[i], "--config") == 0))
{
wee_display_config_options ();
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-f") == 0)
|| (strcmp (argv[i], "--key-functions") == 0))
{
wee_display_key_functions ();
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-h") == 0)
|| (strcmp (argv[i], "--help") == 0))
{
printf ("\n" WEE_USAGE1, argv[0], argv[0]);
printf ("%s", WEE_USAGE2);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
if ((strcmp (argv[i], "-i") == 0)
else if ((strcmp (argv[i], "-i") == 0)
|| (strcmp (argv[i], "--irc-commands") == 0))
{
wee_display_commands (0, 1);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-k") == 0)
|| (strcmp (argv[i], "--keys") == 0))
{
wee_display_keys ();
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-l") == 0)
|| (strcmp (argv[i], "--license") == 0))
{
printf ("\n%s%s", WEE_LICENSE);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strcmp (argv[i], "-v") == 0)
|| (strcmp (argv[i], "--version") == 0))
{
printf (PACKAGE_VERSION "\n");
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
if ((strcmp (argv[i], "-w") == 0)
else if ((strcmp (argv[i], "-w") == 0)
|| (strcmp (argv[i], "--weechat-commands") == 0))
{
wee_display_commands (1, 0);
wee_shutdown (EXIT_SUCCESS);
wee_shutdown (EXIT_SUCCESS, 0);
}
else if ((strncasecmp (argv[i], "irc", 3) == 0))
{
@@ -438,7 +492,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s unable to get HOME directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
dir_length = strlen (ptr_home) + 10;
weechat_home =
@@ -447,7 +501,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s not enough memory for home directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
DIR_SEPARATOR);
@@ -457,7 +511,7 @@ wee_create_home_dirs ()
{
fprintf (stderr, _("%s unable to create ~/.weechat directory\n"),
WEECHAT_ERROR);
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 0);
}
dir_length = strlen (weechat_home) + 64;
@@ -527,11 +581,11 @@ wee_init_vars ()
msgq_last_msg = NULL;
/* init gnutls */
#ifdef HAVE_GNUTLS
#ifdef HAVE_GNUTLS
gnutls_global_init ();
gnutls_certificate_allocate_credentials (&gnutls_xcred);
gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM);
#endif
#endif
}
/*
@@ -615,7 +669,7 @@ wee_gui_shutdown ()
*/
void
wee_shutdown (int return_code)
wee_shutdown (int return_code, int crash)
{
fifo_remove ();
if (weechat_home)
@@ -626,12 +680,15 @@ wee_shutdown (int return_code)
free (local_charset);
alias_free_all ();
#ifdef HAVE_GNUTLS
#ifdef HAVE_GNUTLS
gnutls_certificate_free_credentials (gnutls_xcred);
gnutls_global_deinit();
#endif
#endif
exit (return_code);
if (crash)
abort();
else
exit (return_code);
}
/*
@@ -721,17 +778,6 @@ wee_dump (int crash)
wee_log_printf ("\n");
}
/*
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
* Prevents user for exiting with Ctrl-C
*/
void
my_sigint ()
{
/* do nothing */
}
/*
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
*/
@@ -747,7 +793,7 @@ my_sigsegv ()
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
wee_shutdown (EXIT_FAILURE);
wee_shutdown (EXIT_FAILURE, 1);
}
/*
@@ -767,10 +813,11 @@ main (int argc, char *argv[])
local_charset = strdup (nl_langinfo (CODESET));
#endif
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
wee_init_vars (); /* initialize some variables */
gui_key_init (); /* init keyboard (default key bindings) */
wee_parse_args (argc, argv); /* parse command line args */
wee_create_home_dirs (); /* create WeeChat directories */
wee_init_log (); /* init log file */
@@ -805,7 +852,7 @@ main (int argc, char *argv[])
(void) config_write (NULL); /* save config file */
command_index_free (); /* free commands index */
wee_gui_shutdown (); /* shut down WeeChat GUI */
wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */
wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
return EXIT_SUCCESS; /* make gcc happy (never executed) */
}
+4 -2
View File
@@ -90,8 +90,10 @@
#define WEE_USAGE2 \
" -c, --config display config file options\n" \
" -h, --help this help screen\n" \
" -f, --key-functions display WeeChat internal functions for keys\n" \
" -h, --help this help\n" \
" -i, --irc-commands display IRC commands\n" \
" -k, --keys display WeeChat default keys\n" \
" -l, --license display WeeChat license\n" \
" -v, --version display WeeChat version\n" \
" -w, --weechat-commands display WeeChat commands\n\n"
@@ -120,6 +122,6 @@ extern void wee_log_printf (char *, ...);
extern void wee_dump (int);
extern char *weechat_convert_encoding (char *, char *, char *);
extern long get_timeval_diff (struct timeval *, struct timeval *);
extern void wee_shutdown (int);
extern void wee_shutdown (int, int);
#endif /* weechat.h */
+109 -13
View File
@@ -53,6 +53,7 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
{ CONFIG_SECTION_IRC, "irc" },
{ CONFIG_SECTION_DCC, "dcc" },
{ CONFIG_SECTION_PROXY, "proxy" },
{ CONFIG_SECTION_KEYS, "keys" },
{ CONFIG_SECTION_ALIAS, "alias" },
{ CONFIG_SECTION_SERVER, "server" }
};
@@ -82,6 +83,7 @@ char *cfg_look_no_nickname;
char *cfg_look_completor;
int cfg_look_infobar;
char *cfg_look_infobar_timestamp;
int cfg_look_infobar_seconds;
int cfg_look_infobar_delay_highlight;
t_config_option weechat_options_look[] =
@@ -170,7 +172,11 @@ t_config_option weechat_options_look[] =
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
N_("timestamp for time in infobar"),
OPTION_TYPE_STRING, 0, 0, 0,
"%B, %A %d %Y - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
"%B, %A %d %Y", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
{ "look_infobar_seconds", N_("display seconds in infobar time"),
N_("display seconds in infobar time"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_infobar_seconds, NULL, config_change_buffer_content },
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
N_("delay (in seconds) for highlight messages in infobar "
"(0 = disable highlight notifications in infobar)"),
@@ -188,6 +194,8 @@ int cfg_col_chat_time;
int cfg_col_chat_time_sep;
int cfg_col_chat_prefix1;
int cfg_col_chat_prefix2;
int cfg_col_chat_join;
int cfg_col_chat_part;
int cfg_col_chat_nick;
int cfg_col_chat_host;
int cfg_col_chat_channel;
@@ -197,11 +205,13 @@ int cfg_col_chat_bg;
int cfg_col_status;
int cfg_col_status_delimiters;
int cfg_col_status_data_msg;
int cfg_col_status_data_private;
int cfg_col_status_data_highlight;
int cfg_col_status_data_other;
int cfg_col_status_more;
int cfg_col_status_bg;
int cfg_col_infobar;
int cfg_col_infobar_delimiters;
int cfg_col_infobar_highlight;
int cfg_col_infobar_bg;
int cfg_col_input;
@@ -260,6 +270,14 @@ t_config_option weechat_options_colors[] =
N_("color for middle char of prefix"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_chat_prefix2, NULL, &config_change_color },
{ "col_chat_join", N_("color for join arrow (prefix)"),
N_("color for join arrow (prefix)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightgreen", NULL, &cfg_col_chat_join, NULL, &config_change_color },
{ "col_chat_part", N_("color for part/quit arrow (prefix)"),
N_("color for part/quit arrow (prefix)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightred", NULL, &cfg_col_chat_part, NULL, &config_change_color },
{ "col_chat_nick", N_("color for nicks in actions"),
N_("color for nicks in actions (chat window)"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -298,10 +316,14 @@ t_config_option weechat_options_colors[] =
N_("color for window with new messages (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
{ "col_status_private", N_("color for window with private message"),
N_("color for window with private message (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_private, NULL, &config_change_color },
{ "col_status_highlight", N_("color for window with highlight"),
N_("color for window with highlight (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"lightmagenta", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
"lightred", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
{ "col_status_data_other", N_("color for window with new data (not messages)"),
N_("color for window with new data (not messages) (status bar)"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -320,6 +342,10 @@ t_config_option weechat_options_colors[] =
N_("color for info bar text"),
OPTION_TYPE_COLOR, 0, 0, 0,
"black", NULL, &cfg_col_infobar, NULL, &config_change_color },
{ "col_infobar_delimiters", N_("color for infobar delimiters"),
N_("color for infobar delimiters"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_infobar_delimiters, NULL, &config_change_color },
{ "col_infobar_highlight", N_("color for info bar highlight notification"),
N_("color for info bar highlight notification"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -501,6 +527,7 @@ int cfg_irc_lag_check;
int cfg_irc_lag_min_show;
int cfg_irc_lag_disconnect;
int cfg_irc_fifo_pipe;
char *cfg_irc_highlight;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message to all channels when away"),
@@ -539,6 +566,10 @@ t_config_option weechat_options_irc[] =
N_("create a FIFO pipe for remote control"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_irc_fifo_pipe, NULL, config_change_fifo_pipe },
{ "irc_highlight", N_("list of words to highlight"),
N_("comma separated list of words to highlight (case insensitive comparison)"),
OPTION_TYPE_STRING, 0, 0, 0,
"", NULL, NULL, &cfg_irc_highlight, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -727,7 +758,7 @@ t_config_option weechat_options_server[] =
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
{ weechat_options_look, weechat_options_colors, weechat_options_history,
weechat_options_log, weechat_options_irc, weechat_options_dcc,
weechat_options_proxy, NULL, weechat_options_server
weechat_options_proxy, NULL, NULL, weechat_options_server
};
@@ -763,7 +794,8 @@ config_get_section (t_config_option *ptr_option)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1057,7 +1089,8 @@ config_option_search (char *option_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1220,7 +1253,8 @@ config_default_values ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
@@ -1375,8 +1409,22 @@ config_read ()
if (pos2 != NULL)
pos2[0] = '\0';
if (section == CONFIG_SECTION_ALIAS)
if (section == CONFIG_SECTION_KEYS)
{
if (pos[0])
{
/* bind key (overwrite any binding with same key) */
gui_key_bind (line, pos);
}
else
{
/* unbin key if no value given */
gui_key_unbind (line);
}
}
else if (section == CONFIG_SECTION_ALIAS)
{
/* create new alias */
if (alias_new (line, pos))
weelist_add (&index_commands, &last_index_command, line);
}
@@ -1493,6 +1541,8 @@ config_create_default ()
time_t current_time;
struct passwd *my_passwd;
char *realname, *pos;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
filename_length = strlen (weechat_home) + 64;
filename =
@@ -1520,7 +1570,8 @@ config_create_default ()
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1550,6 +1601,27 @@ config_create_default ()
}
}
/* default key bindings */
fprintf (file, "\n[keys]\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
if (ptr_key->function)
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
free (expanded_name);
}
/* default aliases */
/* TODO: remove comments when missing commands will be ok */
fprintf (file, "\n[alias]\n");
@@ -1560,20 +1632,20 @@ config_create_default ()
fprintf (file, "C=clear\n");
fprintf (file, "CL=clear\n");
fprintf (file, "CLOSE=buffer close\n");
fprintf (file, "# CHAT=dcc chat\n");
fprintf (file, "CHAT=dcc chat\n");
fprintf (file, "# GET=dcc get\n");
fprintf (file, "# IG=ignore\n");
fprintf (file, "J=join\n");
fprintf (file, "K=kick\n");
fprintf (file, "# KB=kickban\n");
fprintf (file, "KB=kickban\n");
fprintf (file, "# KN=knockout\n");
fprintf (file, "LEAVE=part\n");
fprintf (file, "M=msg\n");
fprintf (file, "# MUB=unban *\n");
fprintf (file, "MUB=unban *\n");
fprintf (file, "N=names\n");
fprintf (file, "Q=query\n");
fprintf (file, "T=topic\n");
fprintf (file, "# UB=unban\n");
fprintf (file, "UB=unban\n");
fprintf (file, "# UNIG=unignore\n");
fprintf (file, "W=who\n");
fprintf (file, "WC=part\n");
@@ -1658,6 +1730,8 @@ config_write (char *config_name)
time_t current_time;
t_irc_server *ptr_server;
t_weechat_alias *ptr_alias;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
if (config_name)
filename = strdup (config_name);
@@ -1690,7 +1764,8 @@ config_write (char *config_name)
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_SERVER))
{
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
for (j = 0; weechat_options[i][j].option_name; j++)
@@ -1737,6 +1812,27 @@ config_write (char *config_name)
}
}
/* keys section */
fprintf (file, "\n[keys]\n");
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_key_get_expanded_name (ptr_key->key);
if (ptr_key->function)
{
function_name = gui_key_function_search_by_ptr (ptr_key->function);
if (function_name)
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
function_name);
}
else
fprintf (file, "%s=%s\n",
(expanded_name) ? expanded_name : ptr_key->key,
ptr_key->command);
if (expanded_name)
free (expanded_name);
}
/* alias section */
fprintf (file, "\n[alias]\n");
for (ptr_alias = weechat_alias; ptr_alias;
+10 -3
View File
@@ -33,9 +33,10 @@
#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 CONFIG_SECTION_KEYS 7
#define CONFIG_SECTION_ALIAS 8
#define CONFIG_SECTION_SERVER 9
#define CONFIG_NUMBER_SECTIONS 10
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
#define OPTION_TYPE_INT 2 /* values: from min to max */
@@ -97,6 +98,7 @@ extern char *cfg_look_no_nickname;
extern char *cfg_look_completor;
extern int cfg_look_infobar;
extern char *cfg_look_infobar_timestamp;
extern int cfg_look_infobar_seconds;
extern int cfg_look_infobar_delay_highlight;
extern int cfg_col_title;
@@ -106,6 +108,8 @@ extern int cfg_col_chat_time;
extern int cfg_col_chat_time_sep;
extern int cfg_col_chat_prefix1;
extern int cfg_col_chat_prefix2;
extern int cfg_col_chat_join;
extern int cfg_col_chat_part;
extern int cfg_col_chat_nick;
extern int cfg_col_chat_host;
extern int cfg_col_chat_channel;
@@ -115,11 +119,13 @@ extern int cfg_col_chat_bg;
extern int cfg_col_status;
extern int cfg_col_status_delimiters;
extern int cfg_col_status_data_msg;
extern int cfg_col_status_data_private;
extern int cfg_col_status_data_highlight;
extern int cfg_col_status_data_other;
extern int cfg_col_status_more;
extern int cfg_col_status_bg;
extern int cfg_col_infobar;
extern int cfg_col_infobar_delimiters;
extern int cfg_col_infobar_highlight;
extern int cfg_col_infobar_bg;
extern int cfg_col_input;
@@ -166,6 +172,7 @@ extern int cfg_irc_lag_check;
extern int cfg_irc_lag_min_show;
extern int cfg_irc_lag_disconnect;
extern int cfg_irc_fifo_pipe;
extern char *cfg_irc_highlight;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;
+1
View File
@@ -20,6 +20,7 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
noinst_LIBRARIES = lib_weechat_gui_common.a
lib_weechat_gui_common_a_SOURCES = gui-common.c \
gui-keyboard.c \
gui.h
if GUI_NCURSES
+2 -2
View File
@@ -19,7 +19,7 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../lib_weechat_gui_common.a \
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(NCURSES_LIBS) \
@@ -27,4 +27,4 @@ weechat_curses_LDADD = ../lib_weechat_gui_common.a \
$(GNUTLS_LIBS)
weechat_curses_SOURCES = gui-display.c \
gui-input.c
gui-input.c
+250 -258
View File
@@ -318,7 +318,7 @@ gui_draw_window_separator (t_gui_window *window)
window->win_x - 1);
gui_window_set_color (window->win_separator, COLOR_WIN_TITLE);
wborder (window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (window->win_separator);
wnoutrefresh (window->win_separator);
refresh ();
}
}
@@ -341,15 +341,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
if (ptr_win->buffer == buffer)
{
if (erase)
gui_curses_window_clear (ptr_win->win_title);
gui_curses_window_clear (ptr_win->win_title);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
wborder (ptr_win->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_title);
refresh ();
}
gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
if (CHANNEL(buffer))
{
@@ -362,6 +356,8 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
free (buf);
}
else
mvwprintw (ptr_win->win_title, 0, 0, format, " ");
}
else
{
@@ -372,8 +368,10 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
PACKAGE_STRING " " WEECHAT_COPYRIGHT_DATE " - "
WEECHAT_WEBSITE);
}
else
mvwprintw (ptr_win->win_title, 0, 0, format, " ");
}
wrefresh (ptr_win->win_title);
wnoutrefresh (ptr_win->win_title);
refresh ();
}
}
@@ -860,7 +858,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
ptr_win->win_chat_cursor_y = ptr_win->win_chat_height - 1;
}
}
wrefresh (ptr_win->win_chat);
wnoutrefresh (ptr_win->win_chat);
refresh ();
}
}
@@ -1058,7 +1056,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
}
}
}
wrefresh (ptr_win->win_nick);
wnoutrefresh (ptr_win->win_nick);
refresh ();
}
}
@@ -1084,15 +1082,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (has_colors ())
wbkgdset(ptr_win->win_status, ' ' | COLOR_PAIR (COLOR_WIN_STATUS));
if (erase)
gui_curses_window_clear (ptr_win->win_status);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_status);
}
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
/* wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */
wmove (ptr_win->win_status, 0, 0);
/* display number of buffers */
@@ -1223,18 +1220,21 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
}
if (!SERVER(ptr_win->buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wprintw (ptr_win->win_status, "%d",
ptr_win->buffer->number);
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);
if (ptr_win->buffer->dcc)
wprintw (ptr_win->win_status, "%d:<DCC> ",
ptr_win->buffer->number);
wprintw (ptr_win->win_status, "<DCC> ");
else
{
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);
_("[not connected]"));
wprintw (ptr_win->win_status, "%s " , string);
free (string);
}
}
@@ -1257,15 +1257,19 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
{
switch (ptr_hotlist->priority)
{
case 0:
case HOTLIST_LOW:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_OTHER);
break;
case 1:
case HOTLIST_MSG:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_MSG);
break;
case 2:
case HOTLIST_PRIVATE:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_PRIVATE);
break;
case HOTLIST_HIGHLIGHT:
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS_DATA_HIGHLIGHT);
break;
@@ -1344,11 +1348,48 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
}
free (string);
wrefresh (ptr_win->win_status);
wnoutrefresh (ptr_win->win_status);
refresh ();
}
}
/*
* gui_draw_buffer_infobar_time: draw time in infobar window
*/
void
gui_draw_buffer_infobar_time (t_gui_buffer *buffer)
{
t_gui_window *ptr_win;
time_t time_seconds;
struct tm *local_time;
/* make gcc happy */
(void) buffer;
if (!gui_ok)
return;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
if (local_time)
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
mvwprintw (ptr_win->win_infobar,
0, 1,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
if (cfg_look_infobar_seconds)
wprintw (ptr_win->win_infobar,
":%02d",
local_time->tm_sec);
}
wnoutrefresh (ptr_win->win_infobar);
}
}
/*
* gui_draw_buffer_infobar: draw infobar window for a buffer
*/
@@ -1369,15 +1410,14 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (has_colors ())
wbkgdset(ptr_win->win_infobar, ' ' | COLOR_PAIR (COLOR_WIN_INFOBAR));
if (erase)
gui_curses_window_clear (ptr_win->win_infobar);
if (has_colors ())
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_infobar);
}
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
/* wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */
wmove (ptr_win->win_infobar, 0, 0);
time_seconds = time (NULL);
@@ -1385,16 +1425,31 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
if (local_time)
{
strftime (text_time, 1024, cfg_look_infobar_timestamp, local_time);
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, "[");
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wprintw (ptr_win->win_infobar, "%s", text_time);
wprintw (ptr_win->win_infobar,
"%02d:%02d",
local_time->tm_hour, local_time->tm_min);
if (cfg_look_infobar_seconds)
wprintw (ptr_win->win_infobar,
":%02d",
local_time->tm_sec);
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, "]");
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
wprintw (ptr_win->win_infobar,
" %s", text_time);
}
if (gui_infobar)
{
gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR_DELIMITERS);
wprintw (ptr_win->win_infobar, " | ");
gui_window_set_color (ptr_win->win_infobar, gui_infobar->color);
wprintw (ptr_win->win_infobar, " | %s", gui_infobar->text);
wprintw (ptr_win->win_infobar, "%s", gui_infobar->text);
}
wrefresh (ptr_win->win_infobar);
wnoutrefresh (ptr_win->win_infobar);
refresh ();
}
}
@@ -1445,87 +1500,89 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
{
gui_window_set_color (ptr_win->win_input, COLOR_WIN_INPUT);
wborder (ptr_win->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
wrefresh (ptr_win->win_input);
wnoutrefresh (ptr_win->win_input);
}
if (buffer->input_buffer_size == 0)
buffer->input_buffer[0] = '\0';
input_width = gui_get_input_width (ptr_win);
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
input_width)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
input_width + 1;
else
if (buffer->dcc)
{
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
else
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : dcc_list;
wmove (ptr_win->win_input, 0, 0);
if (dcc_selected)
{
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1) < input_width)
switch (dcc_selected->status)
{
buffer->input_buffer_1st_display =
buffer->input_buffer_pos - input_width + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
case DCC_WAITING:
if (DCC_IS_RECV(dcc_selected->type))
wprintw (ptr_win->win_input, _(" [A] Accept"));
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_CONNECTING:
case DCC_ACTIVE:
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_DONE:
case DCC_FAILED:
case DCC_ABORTED:
wprintw (ptr_win->win_input, _(" [R] Remove"));
break;
}
}
}
if (CHANNEL(buffer))
{
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
if (ptr_win == gui_current_window)
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
buffer->input_buffer + buffer->input_buffer_1st_display);
else
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
"");
wprintw (ptr_win->win_input, _(" [P] Purge old DCC"));
wprintw (ptr_win->win_input, _(" [Q] Close DCC view"));
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + strlen (CHANNEL(buffer)->name) +
strlen (SERVER(buffer)->nick) + 3 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display));
ptr_win->win_x);
}
else
else if (buffer->has_input)
{
if (buffer->dcc)
if (buffer->input_buffer_size == 0)
buffer->input_buffer[0] = '\0';
input_width = gui_get_input_width (ptr_win);
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
input_width)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
input_width + 1;
else
{
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : dcc_list;
wmove (ptr_win->win_input, 0, 0);
if (dcc_selected)
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
else
{
switch (dcc_selected->status)
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1) < input_width)
{
case DCC_WAITING:
if (DCC_IS_RECV(dcc_selected->type))
wprintw (ptr_win->win_input, _(" [A] Accept"));
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_CONNECTING:
case DCC_ACTIVE:
wprintw (ptr_win->win_input, _(" [C] Cancel"));
break;
case DCC_DONE:
case DCC_FAILED:
case DCC_ABORTED:
wprintw (ptr_win->win_input, _(" [R] Remove"));
break;
buffer->input_buffer_1st_display =
buffer->input_buffer_pos - input_width + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
}
}
wprintw (ptr_win->win_input, _(" [P] Purge old DCC"));
wprintw (ptr_win->win_input, _(" [Q] Close DCC view"));
}
if (CHANNEL(buffer))
{
snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
if (ptr_win == gui_current_window)
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
buffer->input_buffer + buffer->input_buffer_1st_display);
else
mvwprintw (ptr_win->win_input, 0, 0, format,
CHANNEL(buffer)->name,
SERVER(buffer)->nick,
"");
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = strlen (CHANNEL(buffer)->name) +
strlen (SERVER(buffer)->nick) + 3 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display);
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
ptr_win->win_x + ptr_win->win_input_x);
}
else
{
@@ -1543,14 +1600,15 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
ptr_nickname,
"");
wclrtoeol (ptr_win->win_input);
ptr_win->win_input_x = strlen (ptr_nickname) + 2 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display);
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + strlen (ptr_nickname) + 2 +
(buffer->input_buffer_pos - buffer->input_buffer_1st_display));
ptr_win->win_x + ptr_win->win_input_x);
}
}
wrefresh (ptr_win->win_input);
wnoutrefresh (ptr_win->win_input);
refresh ();
}
}
@@ -1701,242 +1759,143 @@ gui_get_dcc_buffer ()
}
/*
* gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
* gui_input_page_up: display previous page on buffer
*/
void
gui_switch_to_dcc_buffer ()
gui_input_page_up ()
{
t_gui_buffer *ptr_buffer;
if (!gui_ok)
return;
/* check if dcc buffer exists */
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
if (!gui_current_window->first_line_displayed)
{
if (ptr_buffer->dcc)
break;
}
if (ptr_buffer)
{
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (ptr_buffer);
}
else
gui_buffer_new (gui_current_window, NULL, NULL, 1, 1);
}
/*
* gui_switch_to_previous_buffer: switch to previous buffer
*/
void
gui_switch_to_previous_buffer (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
if (window->buffer->prev_buffer)
gui_switch_to_buffer (window, window->buffer->prev_buffer);
else
gui_switch_to_buffer (window, last_gui_buffer);
gui_redraw_buffer (window->buffer);
}
/*
* gui_switch_to_next_buffer: switch to next buffer
*/
void
gui_switch_to_next_buffer (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one buffer then return */
if (gui_buffers == last_gui_buffer)
return;
if (window->buffer->next_buffer)
gui_switch_to_buffer (window, window->buffer->next_buffer);
else
gui_switch_to_buffer (window, gui_buffers);
gui_redraw_buffer (window->buffer);
}
/*
* gui_switch_to_previous_window: switch to previous window
*/
void
gui_switch_to_previous_window (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one window then return */
if (gui_windows == last_gui_window)
return;
gui_current_window = (window->prev_window) ? window->prev_window : last_gui_window;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_switch_to_next_window: switch to next window
*/
void
gui_switch_to_next_window (t_gui_window *window)
{
if (!gui_ok)
return;
/* if only one window then return */
if (gui_windows == last_gui_window)
return;
gui_current_window = (window->next_window) ? window->next_window : gui_windows;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_move_page_up: display previous page on buffer
*/
void
gui_move_page_up (t_gui_window *window)
{
if (!gui_ok)
return;
if (!window->first_line_displayed)
{
window->sub_lines += window->win_chat_height - 1;
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
gui_current_window->sub_lines +=
gui_current_window->win_chat_height - 1;
gui_draw_buffer_chat (gui_current_window->buffer, 0);
gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
/*
* gui_move_page_down: display next page on buffer
* gui_input_page_down: display next page on buffer
*/
void
gui_move_page_down (t_gui_window *window)
gui_input_page_down ()
{
if (!gui_ok)
return;
if (window->sub_lines > 0)
if (gui_current_window->sub_lines > 0)
{
window->sub_lines -= window->win_chat_height - 1;
if (window->sub_lines < 0)
window->sub_lines = 0;
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
gui_current_window->sub_lines -=
gui_current_window->win_chat_height - 1;
if (gui_current_window->sub_lines < 0)
gui_current_window->sub_lines = 0;
gui_draw_buffer_chat (gui_current_window->buffer, 0);
gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
/*
* gui_nick_move_beginning: go to beginning of nicklist
* gui_input_nick_beginning: go to beginning of nicklist
*/
void
gui_nick_move_beginning (t_gui_window *window)
gui_input_nick_beginning ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if (window->win_nick_start > 0)
if (gui_current_window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start = 0;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_end: go to the end of nicklist
* gui_input_nick_end: go to the end of nicklist
*/
void
gui_nick_move_end (t_gui_window *window)
gui_input_nick_end ()
{
int new_start;
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
new_start = CHANNEL(window->buffer)->nicks_count - window->win_nick_height;
new_start =
CHANNEL(gui_current_window->buffer)->nicks_count -
gui_current_window->win_nick_height;
if (new_start < 0)
new_start = 0;
else if (new_start >= 1)
new_start++;
if (new_start != window->win_nick_start)
if (new_start != gui_current_window->win_nick_start)
{
window->win_nick_start = new_start;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start = new_start;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_page_up: scroll one page up in nicklist
* gui_input_nick_page_up: scroll one page up in nicklist
*/
void
gui_nick_move_page_up (t_gui_window *window)
gui_input_nick_page_up ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if (window->win_nick_start > 0)
if (gui_current_window->win_nick_start > 0)
{
window->win_nick_start -= (window->win_nick_height - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start -=
(gui_current_window->win_nick_height - 1);
if (gui_current_window->win_nick_start <= 1)
gui_current_window->win_nick_start = 0;
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
/*
* gui_nick_move_page_down: scroll one page down in nicklist
* gui_input_nick_page_down: scroll one page down in nicklist
*/
void
gui_nick_move_page_down (t_gui_window *window)
gui_input_nick_page_down ()
{
if (!gui_ok)
return;
if (gui_buffer_has_nicklist (window->buffer))
if (gui_buffer_has_nicklist (gui_current_window->buffer))
{
if ((CHANNEL(window->buffer)->nicks_count > window->win_nick_height)
&& (window->win_nick_start + window->win_nick_height - 1 < CHANNEL(window->buffer)->nicks_count))
if ((CHANNEL(gui_current_window->buffer)->nicks_count >
gui_current_window->win_nick_height)
&& (gui_current_window->win_nick_start +
gui_current_window->win_nick_height - 1
< CHANNEL(gui_current_window->buffer)->nicks_count))
{
if (window->win_nick_start == 0)
window->win_nick_start += (window->win_nick_height - 1);
if (gui_current_window->win_nick_start == 0)
gui_current_window->win_nick_start +=
(gui_current_window->win_nick_height - 1);
else
window->win_nick_start += (window->win_nick_height - 2);
gui_draw_buffer_nick (window->buffer, 1);
gui_current_window->win_nick_start +=
(gui_current_window->win_nick_height - 2);
gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
}
}
@@ -2282,6 +2241,10 @@ gui_init_colors ()
cfg_col_chat_prefix1, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_PREFIX2,
cfg_col_chat_prefix2, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_JOIN,
cfg_col_chat_join, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_PART,
cfg_col_chat_part, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_NICK,
cfg_col_chat_nick, cfg_col_chat_bg);
init_pair (COLOR_WIN_CHAT_HOST,
@@ -2298,6 +2261,8 @@ gui_init_colors ()
cfg_col_status_delimiters, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_MSG,
cfg_col_status_data_msg, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_PRIVATE,
cfg_col_status_data_private, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_HIGHLIGHT,
cfg_col_status_data_highlight, cfg_col_status_bg);
init_pair (COLOR_WIN_STATUS_DATA_OTHER,
@@ -2306,6 +2271,8 @@ gui_init_colors ()
cfg_col_status_more, cfg_col_status_bg);
init_pair (COLOR_WIN_INFOBAR,
cfg_col_infobar, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_DELIMITERS,
cfg_col_infobar_delimiters, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INFOBAR_HIGHLIGHT,
cfg_col_infobar_highlight, cfg_col_infobar_bg);
init_pair (COLOR_WIN_INPUT,
@@ -2366,6 +2333,8 @@ gui_init_colors ()
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_JOIN - 1] = (cfg_col_chat_join >= 0) ? cfg_col_chat_join & A_BOLD : 0;
color_attr[COLOR_WIN_CHAT_PART - 1] = (cfg_col_chat_part >= 0) ? cfg_col_chat_part & 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;
@@ -2374,10 +2343,12 @@ gui_init_colors ()
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_PRIVATE - 1] = (cfg_col_status_data_private >= 0) ? cfg_col_status_data_private & 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_DELIMITERS - 1] = (cfg_col_infobar_delimiters >= 0) ? cfg_col_infobar_delimiters & 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;
@@ -2427,16 +2398,20 @@ gui_init ()
initscr ();
curs_set (1);
keypad (stdscr, TRUE);
noecho ();
nodelay (stdscr, TRUE);
gui_init_colors ();
gui_infobar = NULL;
gui_ok = ((COLS > 5) && (LINES > 5));
refresh ();
/* init clipboard buffer */
gui_input_clipboard = NULL;
/* create new window/buffer */
if (gui_window_new (0, 0, COLS, LINES))
{
@@ -2461,6 +2436,10 @@ gui_end ()
{
t_gui_window *ptr_win;
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
/* delete all windows */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -2507,6 +2486,7 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
{
char *pos;
int length;
char *ptr_string;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (buffer->line_complete)
@@ -2527,6 +2507,13 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
buffer->line_complete = 1;
}
buffer->last_line->last_message->message = strdup (message);
ptr_string = buffer->last_line->last_message->message;
while (ptr_string[0])
{
if ((ptr_string[0] > 0) && (ptr_string[0] < 32))
ptr_string[0] = 32;
ptr_string++;
}
length = strlen (message);
buffer->last_line->length += length;
if (type & MSG_TYPE_MSG)
@@ -2548,9 +2535,14 @@ gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
buffer->last_line->line_with_highlight <=
buffer->notify_level)
{
hotlist_add (buffer->last_line->line_with_message +
buffer->last_line->line_with_highlight,
buffer);
if (buffer->last_line->line_with_highlight)
hotlist_add (HOTLIST_HIGHLIGHT, buffer);
else if (BUFFER_IS_PRIVATE(buffer) && (buffer->last_line->line_with_message))
hotlist_add (HOTLIST_PRIVATE, buffer);
else if (buffer->last_line->line_with_message)
hotlist_add (HOTLIST_MSG, buffer);
else
hotlist_add (HOTLIST_LOW, buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
+184 -634
View File
@@ -41,649 +41,191 @@
#include "../../common/fifo.h"
#include "../../irc/irc.h"
#define KEY_ESCAPE 27
/*
* gui_read_keyb: read keyboard line
* gui_input_default_key_bindings: create default key bindings
*/
void
gui_read_keyb ()
gui_input_default_key_bindings ()
{
int i;
char key_str[32], command[32];
/* keys binded with internal functions */
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
/* keys binded with commands */
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
{
sprintf (key_str, "meta-j%02d", i);
sprintf (command, "/buffer %d", i);
gui_key_bind (key_str, command);
}
}
/*
* gui_input_grab_end: insert grabbed key in input buffer
*/
void
gui_input_grab_end ()
{
char *expanded_key;
/* get expanded name (for example: ^U => ctrl-u) */
expanded_key = gui_key_get_expanded_name (gui_key_buffer);
if (expanded_key)
{
if (gui_current_window->buffer->has_input)
{
gui_input_insert_string (expanded_key, -1);
gui_current_window->buffer->input_buffer_pos += strlen (expanded_key);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
free (expanded_key);
}
/* end grab mode */
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_key_buffer[0] = '\0';
}
/*
* gui_input_read: read keyboard chars
*/
void
gui_input_read ()
{
int key, i;
t_gui_buffer *ptr_buffer;
t_irc_server *ptr_server;
t_irc_dcc *ptr_dcc, *ptr_dcc_next;
char new_char[3], *decoded_string;
t_irc_dcc *dcc_selected;
key = getch ();
if (key != ERR)
char key_str[32];
i = 0;
/* do not loop too much here (for example when big paste was made),
to read also socket & co */
while (i < 8)
{
switch (key)
if (gui_key_grab && (gui_key_grab_count > 10))
gui_input_grab_end ();
key = getch ();
if (key == ERR)
{
/* resize event */
case KEY_RESIZE:
gui_curses_resize_handler ();
break;
/* inactive function keys */
case KEY_F(1):
case KEY_F(2):
case KEY_F(3):
case KEY_F(4):
case KEY_F(9):
break;
/* previous buffer in window */
case KEY_F(5):
gui_switch_to_previous_buffer (gui_current_window);
break;
/* next buffer in window */
case KEY_F(6):
gui_switch_to_next_buffer (gui_current_window);
break;
/* previous window */
case KEY_F(7):
gui_switch_to_previous_window (gui_current_window);
break;
/* next window */
case KEY_F(8):
gui_switch_to_next_window (gui_current_window);
break;
/* remove last infobar message */
case KEY_F(10):
gui_infobar_remove ();
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
break;
case KEY_F(11):
gui_nick_move_page_up (gui_current_window);
break;
case KEY_F(12):
gui_nick_move_page_down (gui_current_window);
break;
/* cursor up */
case KEY_UP:
if (gui_current_window->buffer->dcc)
{
if (dcc_list)
{
if (gui_current_window->dcc_selected
&& ((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
{
if (gui_current_window->dcc_selected ==
gui_current_window->dcc_first)
gui_current_window->dcc_first =
((t_irc_dcc *)(gui_current_window->dcc_first))->prev_dcc;
gui_current_window->dcc_selected =
((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
gui_draw_buffer_chat (gui_current_window->buffer, 1);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
}
}
else
{
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->ptr_history->next_history;
if (!gui_current_window->buffer->ptr_history)
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
}
else
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->input_buffer_size =
strlen (gui_current_window->buffer->ptr_history->text);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor down */
case KEY_DOWN:
if (gui_current_window->buffer->dcc)
{
if (dcc_list)
{
if (!gui_current_window->dcc_selected
|| ((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc)
{
if (gui_current_window->dcc_last_displayed
&& (gui_current_window->dcc_selected ==
gui_current_window->dcc_last_displayed))
{
if (gui_current_window->dcc_first)
gui_current_window->dcc_first =
((t_irc_dcc *)(gui_current_window->dcc_first))->next_dcc;
else
gui_current_window->dcc_first =
dcc_list->next_dcc;
}
if (gui_current_window->dcc_selected)
gui_current_window->dcc_selected =
((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc;
else
gui_current_window->dcc_selected =
dcc_list->next_dcc;
gui_draw_buffer_chat (gui_current_window->buffer, 1);
gui_draw_buffer_input (gui_current_window->buffer, 1);
}
}
}
else
{
if (gui_current_window->buffer->ptr_history)
{
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->ptr_history->prev_history;
if (gui_current_window->buffer->ptr_history)
gui_current_window->buffer->input_buffer_size =
strlen (gui_current_window->buffer->ptr_history->text);
else
gui_current_window->buffer->input_buffer_size = 0;
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
if (gui_current_window->buffer->ptr_history)
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor left */
case KEY_LEFT:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
gui_current_window->buffer->input_buffer_pos--;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* cursor right */
case KEY_RIGHT:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
gui_current_window->buffer->input_buffer_pos++;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* home key or Control + A */
case KEY_HOME:
case 0x01:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
gui_current_window->buffer->input_buffer_pos = 0;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* end key or Control + E */
case KEY_END:
case 0x05:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* page up */
case KEY_PPAGE:
if (!gui_current_window->buffer->dcc)
gui_move_page_up (gui_current_window);
break;
/* page down */
case KEY_NPAGE:
if (!gui_current_window->buffer->dcc)
gui_move_page_down (gui_current_window);
break;
/* erase before cursor and move cursor to the left */
case 127:
case KEY_BACKSPACE:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos > 0)
{
i = gui_current_window->buffer->input_buffer_pos-1;
while (gui_current_window->buffer->input_buffer[i])
{
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i+1];
i++;
}
gui_current_window->buffer->input_buffer_size--;
gui_current_window->buffer->input_buffer_pos--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_draw_buffer_input (gui_current_window->buffer, 0);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->completion.position = -1;
}
}
break;
/* Control + Backspace or Control + W */
case 0x08:
case 0x17:
if (!gui_current_window->buffer->dcc)
gui_delete_previous_word (gui_current_window->buffer);
break;
/* Control + L */
case 0x0C:
gui_curses_resize_handler ();
break;
/* erase char under cursor */
case KEY_DC:
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_pos <
gui_current_window->buffer->input_buffer_size)
{
i = gui_current_window->buffer->input_buffer_pos;
while (gui_current_window->buffer->input_buffer[i])
{
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i+1];
i++;
}
gui_current_window->buffer->input_buffer_size--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
gui_draw_buffer_input (gui_current_window->buffer, 0);
gui_optimize_input_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->completion.position = -1;
}
}
break;
/* Tab : completion */
case '\t':
if (!gui_current_window->buffer->dcc)
{
completion_search (&(gui_current_window->buffer->completion),
CHANNEL(gui_current_window->buffer),
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 */
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--)
gui_current_window->buffer->input_buffer[i] =
gui_current_window->buffer->input_buffer[i -
gui_current_window->buffer->completion.diff_size];
}
else
{
for (i = gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
i < gui_current_window->buffer->input_buffer_size; i++)
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,
gui_current_window->buffer->completion.word_found,
strlen (gui_current_window->buffer->completion.word_found));
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
/* 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.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);
if (gui_current_window->buffer->completion.position >= 0)
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
else
{
/* 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);
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);
if (gui_current_window->buffer->completion.position >= 0)
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
}
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
break;
/* escape code (for control-key) */
case KEY_ESCAPE:
if ((key = getch()) != ERR)
{
/*gui_printf (gui_current_window->buffer,
"[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
switch (key)
{
/* Alt + left arrow */
case KEY_LEFT:
gui_switch_to_previous_buffer (gui_current_window);
break;
/* Alt + right arrow */
case KEY_RIGHT:
gui_switch_to_next_buffer (gui_current_window);
break;
/* Alt + home */
case KEY_HOME:
gui_nick_move_beginning (gui_current_window);
break;
/* Alt + end */
case KEY_END:
gui_nick_move_end (gui_current_window);
break;
/* Alt + page up */
case KEY_PPAGE:
gui_nick_move_page_up (gui_current_window);
break;
/* Alt + page down */
case KEY_NPAGE:
gui_nick_move_page_down (gui_current_window);
break;
case 79:
/* TODO: replace 79 by constant name! */
if ((key = getch()) != ERR)
{
switch (key)
{
/* Control + Right */
case 99:
if (!gui_current_window->buffer->dcc)
gui_move_next_word (gui_current_window->buffer);
break;
/* Control + Left */
case 100:
if (!gui_current_window->buffer->dcc)
gui_move_previous_word (gui_current_window->buffer);
break;
}
}
break;
/* Alt-number: jump to window by number */
case 48: /* Alt-0 */
case 49: /* Alt-1 */
case 50: /* Alt-2 */
case 51: /* Alt-3 */
case 52: /* Alt-4 */
case 53: /* Alt-5 */
case 54: /* Alt-6 */
case 55: /* Alt-7 */
case 56: /* Alt-8 */
case 57: /* Alt-9 */
gui_switch_to_buffer_by_number (gui_current_window, (key == 48) ? 10 : key - 48);
break;
/* Alt-A: jump to buffer with activity */
case 'a':
case 'A':
if (hotlist)
{
if (!hotlist_initial_buffer)
hotlist_initial_buffer = gui_current_window->buffer;
gui_switch_to_buffer (gui_current_window, hotlist->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
else
{
if (hotlist_initial_buffer)
{
gui_switch_to_buffer (gui_current_window, hotlist_initial_buffer);
gui_redraw_buffer (gui_current_window->buffer);
hotlist_initial_buffer = NULL;
}
}
break;
/* Alt-D: jump to DCC buffer */
case 'd':
case 'D':
if (gui_current_window->buffer->dcc)
{
if (buffer_before_dcc)
{
gui_switch_to_buffer (gui_current_window,
buffer_before_dcc);
gui_redraw_buffer (gui_current_window->buffer);
}
}
else
{
buffer_before_dcc = gui_current_window->buffer;
gui_switch_to_dcc_buffer ();
}
break;
/* Alt-R: clear hotlist */
case 'r':
case 'R':
if (hotlist)
{
hotlist_free_all ();
gui_redraw_buffer (gui_current_window->buffer);
}
hotlist_initial_buffer = gui_current_window->buffer;
break;
/* Alt-S: jump to server buffer */
case 's':
case 'S':
if (!gui_current_window->buffer->dcc)
{
if (SERVER(gui_current_window->buffer)->buffer !=
gui_current_window->buffer)
{
gui_switch_to_buffer (gui_current_window,
SERVER(gui_current_window->buffer)->buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
}
break;
/* Alt-X: jump to first channel/private of next server */
case 'x':
case 'X':
if (!gui_current_window->buffer->dcc)
{
ptr_server = SERVER(gui_current_window->buffer)->next_server;
if (!ptr_server)
ptr_server = irc_servers;
while (ptr_server != SERVER(gui_current_window->buffer))
{
if (ptr_server->buffer)
break;
ptr_server = (ptr_server->next_server) ?
ptr_server->next_server : irc_servers;
}
if (ptr_server != SERVER(gui_current_window->buffer))
{
ptr_buffer = (ptr_server->channels) ?
ptr_server->channels->buffer : ptr_server->buffer;
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
}
break;
}
}
break;
/* send command/message */
case '\n':
if (!gui_current_window->buffer->dcc)
{
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_pos = 0;
gui_current_window->buffer->input_buffer_1st_display = 0;
gui_current_window->buffer->completion.position = -1;
gui_current_window->buffer->ptr_history = NULL;
ptr_buffer = gui_current_window->buffer;
user_command (SERVER(gui_current_window->buffer),
gui_current_window->buffer,
gui_current_window->buffer->input_buffer);
if (ptr_buffer == gui_current_window->buffer)
{
ptr_buffer->input_buffer[0] = '\0';
gui_draw_buffer_input (ptr_buffer, 0);
}
}
}
break;
/* other key => add to input buffer */
default:
if (gui_current_window->buffer->dcc)
{
dcc_selected = (gui_current_window->dcc_selected) ?
(t_irc_dcc *) gui_current_window->dcc_selected : dcc_list;
switch (key)
{
/* accept DCC */
case 'a':
case 'A':
if (dcc_selected
&& (DCC_IS_RECV(dcc_selected->status))
&& (dcc_selected->status == DCC_WAITING))
{
dcc_accept (dcc_selected);
}
break;
/* cancel DCC */
case 'c':
case 'C':
if (dcc_selected
&& (!DCC_ENDED(dcc_selected->status)))
{
dcc_close (dcc_selected, DCC_ABORTED);
gui_redraw_buffer (gui_current_window->buffer);
}
break;
/* purge old DCC */
case 'p':
case 'P':
gui_current_window->dcc_selected = NULL;
ptr_dcc = dcc_list;
while (ptr_dcc)
{
ptr_dcc_next = ptr_dcc->next_dcc;
if (DCC_ENDED(ptr_dcc->status))
dcc_free (ptr_dcc);
ptr_dcc = ptr_dcc_next;
}
gui_redraw_buffer (gui_current_window->buffer);
break;
/* close DCC window */
case 'q':
case 'Q':
if (buffer_before_dcc)
{
gui_buffer_free (gui_current_window->buffer, 1);
gui_switch_to_buffer (gui_current_window,
buffer_before_dcc);
}
else
gui_buffer_free (gui_current_window->buffer, 1);
gui_redraw_buffer (gui_current_window->buffer);
break;
/* remove from DCC list */
case 'r':
case 'R':
if (dcc_selected
&& (DCC_ENDED(dcc_selected->status)))
{
if (dcc_selected->next_dcc)
gui_current_window->dcc_selected = dcc_selected->next_dcc;
else
gui_current_window->dcc_selected = NULL;
dcc_free (dcc_selected);
gui_redraw_buffer (gui_current_window->buffer);
}
break;
}
}
else
{
/*gui_printf (gui_current_window->buffer,
"[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,
(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;
if (gui_key_grab && (gui_key_grab_count > 0))
gui_input_grab_end ();
break;
}
if (key == KEY_RESIZE)
{
gui_curses_resize_handler ();
continue;
}
if (key < 32)
{
key_str[0] = '^';
key_str[1] = (char) key + '@';
key_str[2] = '\0';
}
else if (key == 127)
{
key_str[0] = '^';
key_str[1] = '?';
key_str[2] = '\0';
}
else
{
if (key > 0xff)
{
key_str[0] = (char) (key >> 8);
key_str[1] = (char) (key & 0xff);
key_str[2] = '\0';
}
else
{
key_str[0] = (char) key;
key_str[1] = '\0';
}
}
if (strcmp (key_str, "^") == 0)
{
key_str[1] = '^';
key_str[2] = '\0';
}
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
if (gui_key_pressed (key_str) != 0)
gui_input_insert_char (key);
i++;
}
}
@@ -723,6 +265,14 @@ gui_main_loop ()
{
old_sec = local_time->tm_sec;
if (cfg_look_infobar_seconds)
{
gui_draw_buffer_infobar_time (gui_current_window->buffer);
wmove (gui_current_window->win_input,
0, gui_current_window->win_input_x);
wrefresh (gui_current_window->win_input);
}
/* infobar count down */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
@@ -807,7 +357,7 @@ gui_main_loop ()
{
if (FD_ISSET (STDIN_FILENO, &read_fd))
{
gui_read_keyb ();
gui_input_read ();
}
if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd)))
{
+1036 -100
View File
File diff suppressed because it is too large Load Diff
+559
View File
@@ -0,0 +1,559 @@
/*
* 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
*/
/* gui-keyboard: keyboard functions (GUI independant) */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../common/weechat.h"
#include "gui.h"
#include "../common/command.h"
t_gui_key *gui_keys = NULL;
t_gui_key *last_gui_key = NULL;
char gui_key_buffer[128];
int gui_key_grab = 0;
int gui_key_grab_count = 0;
t_gui_key_function gui_key_functions[] =
{ { "return", gui_input_return,
N_("terminate line") },
{ "tab", gui_input_tab,
N_("complete word") },
{ "backspace", gui_input_backspace,
N_("delete previous char") },
{ "delete", gui_input_delete,
N_("delete next char") },
{ "delete_end_line", gui_input_delete_end_of_line,
N_("delete until end of line") },
{ "delete_beginning_line", gui_input_delete_begin_of_line,
N_("delete until beginning of line") },
{ "delete_line", gui_input_delete_line,
N_("delete entire line") },
{ "delete_previous_word", gui_input_delete_previous_word,
N_("delete previous word") },
{ "delete_next_word", gui_input_delete_next_word,
N_("delete next word") },
{ "clipboard_paste", gui_input_clipboard_paste,
N_("paste current clipboard content") },
{ "transpose_chars", gui_input_transpose_chars,
N_("transpose chars") },
{ "home", gui_input_home,
N_("go to beginning of line") },
{ "end", gui_input_end,
N_("go to end of line") },
{ "left", gui_input_left,
N_("move one char left") },
{ "previous_word", gui_input_previous_word,
N_("move to previous word") },
{ "right", gui_input_right,
N_("move one char right") },
{ "next_word", gui_input_next_word,
N_("move to next word") },
{ "up", gui_input_up,
N_("call previous command in history") },
{ "down", gui_input_down,
N_("call next command in history") },
{ "page_up", gui_input_page_up,
N_("scroll one page up") },
{ "page_down", gui_input_page_down,
N_("scroll one page down") },
{ "infobar_clear", gui_input_infobar_clear,
N_("clear infobar") },
{ "nick_page_up", gui_input_nick_page_up,
N_("scroll nicklist one page up") },
{ "nick_page_down", gui_input_nick_page_down,
N_("scroll nicklist one page down") },
{ "nick_beginning", gui_input_nick_beginning,
N_("display beginning of nicklist") },
{ "nick_end", gui_input_nick_end,
N_("display end of nicklist") },
{ "refresh", gui_curses_resize_handler,
N_("refresh screen") },
{ "jump_smart", gui_input_jump_smart,
N_("jump to buffer with activity") },
{ "jump_dcc", gui_input_jump_dcc,
N_("jump to DCC buffer") },
{ "jump_last_buffer", gui_input_jump_last_buffer,
N_("jump to last buffer") },
{ "jump_server", gui_input_jump_server,
N_("jump to server buffer") },
{ "jump_next_server", gui_input_jump_next_server,
N_("jump to next server") },
{ "hotlist_clear", gui_input_hotlist_clear,
N_("clear hotlist") },
{ "grab_key", gui_input_grab_key,
N_("grab a key") },
{ NULL, NULL, NULL }
};
/*
* gui_key_init: init keyboard (create default key bindings)
*/
void
gui_key_init ()
{
gui_key_buffer[0] = '\0';
gui_key_grab = 0;
gui_key_grab_count = 0;
gui_input_default_key_bindings ();
}
/*
* gui_key_init_show: init "show mode"
*/
void
gui_key_init_grab ()
{
gui_key_grab = 1;
gui_key_grab_count = 0;
}
/*
* gui_key_get_internal_code: get internal code from user key name
* for example: return "^R" for "ctrl-R"
*/
char *
gui_key_get_internal_code (char *key)
{
char *result;
if ((result = (char *) malloc (strlen (key) + 1)))
{
result[0] = '\0';
while (key[0])
{
if (strncasecmp (key, "meta2-", 6) == 0)
{
strcat (result, "^[[");
key += 6;
}
if (strncasecmp (key, "meta-", 5) == 0)
{
strcat (result, "^[");
key += 5;
}
else if (strncasecmp (key, "ctrl-", 5) == 0)
{
strcat (result, "^");
key += 5;
}
else
{
strncat (result, key, 1);
key++;
}
}
}
else
return NULL;
return result;
}
/*
* gui_key_get_expanded_name: get expanded name from internal key code
* for example: return "ctrl-R" for "^R"
*/
char *
gui_key_get_expanded_name (char *key)
{
char *result;
if ((result = (char *) malloc ((strlen (key) * 5) + 1)))
{
result[0] = '\0';
while (key[0])
{
if (strncasecmp (key, "^[[", 3) == 0)
{
strcat (result, "meta2-");
key += 3;
}
if (strncasecmp (key, "^[", 2) == 0)
{
strcat (result, "meta-");
key += 2;
}
else if ((key[0] == '^') && (key[1]))
{
strcat (result, "ctrl-");
key++;
}
else
{
strncat (result, key, 1);
key++;
}
}
}
else
return NULL;
return result;
}
/*
* gui_key_find_pos: find position for a key (for sorting keys list)
*/
t_gui_key *
gui_key_find_pos (t_gui_key *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (strcasecmp (key->key, ptr_key->key) < 0)
return ptr_key;
}
return NULL;
}
/*
* gui_key_insert_sorted: insert key into sorted list
*/
void
gui_key_insert_sorted (t_gui_key *key)
{
t_gui_key *pos_key;
if (gui_keys)
{
pos_key = gui_key_find_pos (key);
if (pos_key)
{
/* insert key into the list (before key found) */
key->prev_key = pos_key->prev_key;
key->next_key = pos_key;
if (pos_key->prev_key)
pos_key->prev_key->next_key = key;
else
gui_keys = key;
pos_key->prev_key = key;
}
else
{
/* add key to the end */
key->prev_key = last_gui_key;
key->next_key = NULL;
last_gui_key->next_key = key;
last_gui_key = key;
}
}
else
{
key->prev_key = NULL;
key->next_key = NULL;
gui_keys = key;
last_gui_key = key;
}
}
/*
* gui_key_new: add a new key in keys list
*/
t_gui_key *
gui_key_new (char *key, char *command, void *function)
{
t_gui_key *new_key;
char *internal_code;
if ((new_key = (t_gui_key *) malloc (sizeof (t_gui_key))))
{
internal_code = gui_key_get_internal_code (key);
new_key->key = (internal_code) ? strdup (internal_code) : strdup (key);
if (internal_code)
free (internal_code);
new_key->command = (command) ? strdup (command) : NULL;
new_key->function = function;
gui_key_insert_sorted (new_key);
}
else
return NULL;
return new_key;
}
/*
* gui_key_search: search a key
*/
t_gui_key *
gui_key_search (char *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (strcasecmp (ptr_key->key, key) == 0)
return ptr_key;
}
/* key not found */
return NULL;
}
/*
* gui_key_cmp: compares 2 keys
*/
int
gui_key_cmp (char *key, char *search)
{
while (search[0])
{
if (toupper(key[0]) != toupper(search[0]))
return search[0] - key[0];
key++;
search++;
}
return 0;
}
/*
* gui_key_search_part: search a key (maybe part of string)
*/
t_gui_key *
gui_key_search_part (char *key)
{
t_gui_key *ptr_key;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
if (gui_key_cmp (ptr_key->key, key) == 0)
return ptr_key;
}
/* key not found */
return NULL;
}
/*
* gui_key_function_search_by_name: search a function by name
*/
void *
gui_key_function_search_by_name (char *name)
{
int i;
i = 0;
while (gui_key_functions[i].function_name)
{
if (strcasecmp (gui_key_functions[i].function_name, name) == 0)
return gui_key_functions[i].function;
i++;
}
/* function not found */
return NULL;
}
/*
* gui_key_function_search_by_ptr: search a function by pointer
*/
char *
gui_key_function_search_by_ptr (void *function)
{
int i;
i = 0;
while (gui_key_functions[i].function_name)
{
if (gui_key_functions[i].function == function)
return gui_key_functions[i].function_name;
i++;
}
/* function not found */
return NULL;
}
/*
* gui_key_bind: bind a key to a function (command or special function)
*/
t_gui_key *
gui_key_bind (char *key, char *command)
{
t_gui_key_function *ptr_function;
t_gui_key *new_key;
if (!key || !command)
{
wee_log_printf (_("%s unable to bind key \"%s\"\n"),
WEECHAT_ERROR, key);
return NULL;
}
ptr_function = NULL;
if (command[0] != '/')
{
ptr_function = gui_key_function_search_by_name (command);
if (!ptr_function)
{
wee_log_printf (_("%s unable to bind key \"%s\" (invalid function name: \"%s\")\n"),
WEECHAT_ERROR, key, command);
return NULL;
}
}
gui_key_unbind (key);
new_key = gui_key_new (key,
(ptr_function) ? NULL : command,
ptr_function);
if (!new_key)
{
wee_log_printf (_("%s not enough memory for key binding\n"),
WEECHAT_ERROR);
return NULL;
}
return new_key;
}
/*
* gui_key_unbind: remove a key binding
*/
int
gui_key_unbind (char *key)
{
t_gui_key *ptr_key;
char *internal_code;
internal_code = gui_key_get_internal_code (key);
ptr_key = gui_key_search ((internal_code) ? internal_code : key);
if (ptr_key)
gui_key_free (ptr_key);
if (internal_code)
free (internal_code);
return (ptr_key != NULL);
}
/*
* gui_key_pressed: treat new key pressed
* return: 1 if key should be added to input buffer
* 0 otherwise
*/
int
gui_key_pressed (char *key_str)
{
int first_key;
t_gui_key *ptr_key;
/* add key to buffer */
first_key = (gui_key_buffer[0] == '\0');
strcat (gui_key_buffer, key_str);
/* if we are in "show mode", increase counter and return */
if (gui_key_grab)
{
gui_key_grab_count++;
return 0;
}
/* look for key combo in key table */
ptr_key = gui_key_search_part (gui_key_buffer);
if (ptr_key)
{
if (strcasecmp (ptr_key->key, gui_key_buffer) == 0)
{
/* exact combo found => execute function or command */
gui_key_buffer[0] = '\0';
if (ptr_key->command)
user_command (SERVER(gui_current_window->buffer),
gui_current_window->buffer,
ptr_key->command);
else
(void)(ptr_key->function)();
}
return 0;
}
gui_key_buffer[0] = '\0';
/* if this is first key and not found (even partial) => return 1
else return 0 (= silently discard sequence of bad keys) */
return first_key;
}
/*
* key_free: delete a key binding
*/
void
gui_key_free (t_gui_key *key)
{
/* free memory */
if (key->key)
free (key->key);
if (key->command)
free (key->command);
/* remove key from keys list */
if (key->prev_key)
key->prev_key->next_key = key->next_key;
if (key->next_key)
key->next_key->prev_key = key->prev_key;
if (gui_keys == key)
gui_keys = key->next_key;
if (last_gui_key == key)
last_gui_key = key->prev_key;
free (key);
}
/*
* gui_key_free_all: delete all key bindings
*/
void
gui_key_free_all ()
{
while (gui_keys)
gui_key_free (gui_keys);
}
+134 -55
View File
@@ -26,50 +26,54 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 50
#define NUM_COLORS 54
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
#define COLOR_WIN_CHAT_TIME_SEP 4
#define COLOR_WIN_CHAT_PREFIX1 5
#define COLOR_WIN_CHAT_PREFIX2 6
#define COLOR_WIN_CHAT_NICK 7
#define COLOR_WIN_CHAT_HOST 8
#define COLOR_WIN_CHAT_CHANNEL 9
#define COLOR_WIN_CHAT_DARK 10
#define COLOR_WIN_CHAT_HIGHLIGHT 11
#define COLOR_WIN_STATUS 12
#define COLOR_WIN_STATUS_DELIMITERS 13
#define COLOR_WIN_STATUS_DATA_MSG 14
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
#define COLOR_WIN_STATUS_DATA_OTHER 16
#define COLOR_WIN_STATUS_MORE 17
#define COLOR_WIN_INFOBAR 18
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
#define COLOR_WIN_INPUT 20
#define COLOR_WIN_INPUT_CHANNEL 21
#define COLOR_WIN_INPUT_NICK 22
#define COLOR_WIN_NICK 23
#define COLOR_WIN_NICK_AWAY 24
#define COLOR_WIN_NICK_CHANOWNER 25
#define COLOR_WIN_NICK_CHANADMIN 26
#define COLOR_WIN_NICK_OP 27
#define COLOR_WIN_NICK_HALFOP 28
#define COLOR_WIN_NICK_VOICE 29
#define COLOR_WIN_NICK_MORE 30
#define COLOR_WIN_NICK_SEP 31
#define COLOR_WIN_NICK_SELF 32
#define COLOR_WIN_NICK_PRIVATE 33
#define COLOR_WIN_NICK_FIRST 34
#define COLOR_WIN_NICK_LAST 43
#define COLOR_WIN_CHAT_JOIN 7
#define COLOR_WIN_CHAT_PART 8
#define COLOR_WIN_CHAT_NICK 9
#define COLOR_WIN_CHAT_HOST 10
#define COLOR_WIN_CHAT_CHANNEL 11
#define COLOR_WIN_CHAT_DARK 12
#define COLOR_WIN_CHAT_HIGHLIGHT 13
#define COLOR_WIN_STATUS 14
#define COLOR_WIN_STATUS_DELIMITERS 15
#define COLOR_WIN_STATUS_DATA_MSG 16
#define COLOR_WIN_STATUS_DATA_PRIVATE 17
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 18
#define COLOR_WIN_STATUS_DATA_OTHER 19
#define COLOR_WIN_STATUS_MORE 20
#define COLOR_WIN_INFOBAR 21
#define COLOR_WIN_INFOBAR_DELIMITERS 22
#define COLOR_WIN_INFOBAR_HIGHLIGHT 23
#define COLOR_WIN_INPUT 24
#define COLOR_WIN_INPUT_CHANNEL 25
#define COLOR_WIN_INPUT_NICK 26
#define COLOR_WIN_NICK 27
#define COLOR_WIN_NICK_AWAY 28
#define COLOR_WIN_NICK_CHANOWNER 29
#define COLOR_WIN_NICK_CHANADMIN 30
#define COLOR_WIN_NICK_OP 31
#define COLOR_WIN_NICK_HALFOP 32
#define COLOR_WIN_NICK_VOICE 33
#define COLOR_WIN_NICK_MORE 34
#define COLOR_WIN_NICK_SEP 35
#define COLOR_WIN_NICK_SELF 36
#define COLOR_WIN_NICK_PRIVATE 37
#define COLOR_WIN_NICK_FIRST 38
#define COLOR_WIN_NICK_LAST 47
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define COLOR_DCC_SELECTED 44
#define COLOR_DCC_WAITING 45
#define COLOR_DCC_CONNECTING 46
#define COLOR_DCC_ACTIVE 47
#define COLOR_DCC_DONE 48
#define COLOR_DCC_FAILED 49
#define COLOR_DCC_ABORTED 50
#define COLOR_DCC_SELECTED 48
#define COLOR_DCC_WAITING 49
#define COLOR_DCC_CONNECTING 50
#define COLOR_DCC_ACTIVE 51
#define COLOR_DCC_DONE 52
#define COLOR_DCC_FAILED 53
#define COLOR_DCC_ABORTED 54
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
@@ -102,6 +106,9 @@
#define NOTIFY_LEVEL_MAX 3
#define NOTIFY_LEVEL_DEFAULT NOTIFY_LEVEL_MAX
#define KEY_SHOW_MODE_DISPLAY 1
#define KEY_SHOW_MODE_BIND 2
typedef struct t_gui_message t_gui_message;
struct t_gui_message
@@ -178,6 +185,7 @@ struct t_gui_buffer
FILE *log_file; /* for logging buffer to file */
/* inupt buffer */
int has_input; /* = 1 if buffer has input (DCC has not)*/
char *input_buffer; /* input buffer */
int input_buffer_alloc; /* input buffer: allocated size in mem */
int input_buffer_size; /* buffer size (user input length) */
@@ -219,6 +227,9 @@ struct t_gui_window
int win_nick_height; /* height of nick window */
int win_nick_start; /* # of 1st nick for display (scroll) */
/* input window settings */
int win_input_x; /* position of cursor in input window */
/* windows for Curses GUI */
void *win_title; /* title window */
void *win_chat; /* chat window (example: channel) */
@@ -252,6 +263,26 @@ struct t_gui_window
t_gui_window *next_window; /* link to next window */
};
typedef struct t_gui_key t_gui_key;
struct t_gui_key
{
char *key; /* key combo (ex: a, ^W, ^W^C, meta-a) */
char *command; /* associated command (may be NULL) */
void (*function)(); /* associated function (if cmd is NULL) */
t_gui_key *prev_key; /* link to previous key */
t_gui_key *next_key; /* link to next key */
};
typedef struct t_gui_key_function t_gui_key_function;
struct t_gui_key_function
{
char *function_name; /* name of function */
void (*function)(); /* associated function */
char *description; /* description of function */
};
/* variables */
extern int gui_init_ok;
@@ -264,8 +295,15 @@ extern t_gui_buffer *gui_buffers;
extern t_gui_buffer *last_gui_buffer;
extern t_gui_buffer *buffer_before_dcc;
extern t_gui_infobar *gui_infobar;
extern t_gui_key *gui_keys;
extern t_gui_key *last_gui_key;
extern t_gui_key_function gui_key_functions[];
extern char gui_key_buffer[128];
extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
/* GUI independent functions */
/* GUI independent functions: windows & buffers */
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);
@@ -277,17 +315,61 @@ extern void gui_infobar_remove ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_new_line (t_gui_buffer *);
extern t_gui_message *gui_new_message (t_gui_buffer *);
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
extern void gui_delete_previous_word (t_gui_buffer *);
extern void gui_move_previous_word (t_gui_buffer *);
extern void gui_move_next_word (t_gui_buffer *);
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
extern void gui_input_clipboard_copy (char *, int);
extern void gui_input_clipboard_paste ();
extern void gui_input_insert_string (char *, int);
extern void gui_input_insert_char ();
extern void gui_input_return ();
extern void gui_input_tab ();
extern void gui_input_backspace ();
extern void gui_input_delete ();
extern void gui_input_delete_previous_word ();
extern void gui_input_delete_next_word ();
extern void gui_input_delete_begin_of_line ();
extern void gui_input_delete_end_of_line ();
extern void gui_input_delete_line ();
extern void gui_input_transpose_chars ();
extern void gui_input_home ();
extern void gui_input_end ();
extern void gui_input_left ();
extern void gui_input_previous_word ();
extern void gui_input_right ();
extern void gui_input_next_word ();
extern void gui_input_up ();
extern void gui_input_down ();
extern void gui_input_jump_smart ();
extern void gui_input_jump_dcc ();
extern void gui_input_jump_last_buffer ();
extern void gui_input_jump_server ();
extern void gui_input_jump_next_server ();
extern void gui_input_hotlist_clear ();
extern void gui_input_infobar_clear ();
extern void gui_input_grab_key ();
extern void gui_switch_to_previous_buffer ();
extern void gui_switch_to_next_buffer ();
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_switch_to_dcc_buffer ();
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);
extern void gui_window_print_log (t_gui_window *);
extern void gui_buffer_print_log (t_gui_buffer *);
/* GUI dependant functions */
/* GUI independent functions: keys */
extern void gui_key_init ();
extern void gui_key_init_grab ();
extern char *gui_key_get_internal_code (char *);
extern char *gui_key_get_expanded_name (char *);
extern void *gui_key_function_search_by_name (char *);
extern char *gui_key_function_search_by_ptr (void *);
extern t_gui_key *gui_key_bind (char *, char *);
extern int gui_key_unbind (char *);
extern int gui_key_pressed (char *);
extern void gui_key_free (t_gui_key *);
extern void gui_key_free_all ();
/* GUI dependant functions: display */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
@@ -298,22 +380,18 @@ extern void gui_draw_buffer_title (t_gui_buffer *, int);
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
extern void gui_draw_buffer_status (t_gui_buffer *, int);
extern void gui_draw_buffer_infobar_time (t_gui_buffer *);
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
extern void gui_draw_buffer_input (t_gui_buffer *, int);
extern void gui_redraw_buffer (t_gui_buffer *);
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
extern t_gui_buffer *gui_get_dcc_buffer ();
extern void gui_switch_to_dcc_buffer ();
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_previous_window (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_move_page_up (t_gui_window *);
extern void gui_move_page_down (t_gui_window *);
extern void gui_nick_move_beginning (t_gui_window *);
extern void gui_nick_move_end (t_gui_window *);
extern void gui_nick_move_page_up (t_gui_window *);
extern void gui_nick_move_page_down (t_gui_window *);
extern void gui_input_page_up ();
extern void gui_input_page_down ();
extern void gui_input_nick_beginning ();
extern void gui_input_nick_end ();
extern void gui_input_nick_page_up ();
extern void gui_input_nick_page_down ();
extern void gui_curses_resize_handler ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_window_split_horiz (t_gui_window *);
@@ -330,6 +408,7 @@ extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_end ();
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
extern void gui_input_default_key_bindings ();
extern void gui_main_loop ();
#endif /* gui.h */
+9 -9
View File
@@ -90,7 +90,15 @@ void
channel_free (t_irc_server *server, t_irc_channel *channel)
{
t_irc_channel *new_channels;
/* close DCC CHAT */
if ((t_irc_dcc *)(channel->dcc_chat) &&
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
{
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
dcc_redraw (1);
}
/* remove channel from queue */
if (server->last_channel == channel)
server->last_channel = channel->prev_channel;
@@ -104,14 +112,6 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
if (channel->next_channel)
(channel->next_channel)->prev_channel = channel->prev_channel;
/* close DCC CHAT */
if ((t_irc_dcc *)(channel->dcc_chat) &&
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
{
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
dcc_redraw (1);
}
/* free data */
if (channel->name)
+133 -104
View File
@@ -35,6 +35,10 @@ t_irc_command irc_commands[] =
N_("[target]"),
N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_admin, NULL },
{ "amsg", N_("send message to all channels of all connected servers"),
N_("text"),
N_("text: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_amsg, NULL },
{ "away", N_("toggle away status"),
N_("[-all] [message]"),
N_("-all: toggle away status on all connected servers\n"
@@ -42,11 +46,14 @@ t_irc_command irc_commands[] =
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
{ "ban", N_("bans nicks or hosts"),
N_("[channel] [nickname [nickname ...]]"),
N_("channel: channel for ban\nnickname: user or host to ban"),
N_("channel: channel for ban\n"
"nickname: user or host to ban"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
{ "ctcp", N_("send a ctcp message"),
N_("nickname type"),
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
{ "ctcp", N_("send a CTCP message (Client-To-Client Protocol)"),
N_("nickname type [arguments]"),
N_("nickname: user to send CTCP to\n"
"type: CTCP type (examples: \"version\", \"ping\", ..)\n"
"arguments: arguments for CTCP"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
{ "dcc", N_("starts DCC (file or chat) or close chat"),
N_("action [nickname [file]]"),
@@ -55,28 +62,29 @@ t_irc_command irc_commands[] =
"file: filename (on local host)"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL },
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
{ "deop", N_("removes channel operator status from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
{ "devoice", N_("removes voice from nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_devoice, NULL, NULL },
{ "die", N_("shutdown the server"),
"", "",
0, 0, 1, NULL, irc_cmd_send_die, NULL },
{ "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error },
{ "halfop", N_("gives half channel operator status to nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
{ "info", N_("get information describing the server"),
N_("[target]"),
N_("target: server name"),
0, 1, 1, NULL, irc_cmd_send_info, NULL },
{ "invite", N_("invite a nick on a channel"),
N_("nickname channel"),
N_("nickname: nick to invite\nchannel: channel to invite"),
N_("nickname: nick to invite\n"
"channel: channel to invite"),
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
{ "ison", N_("check if a nickname is currently on IRC"),
N_("nickname [nickname ...]"),
@@ -84,19 +92,25 @@ t_irc_command irc_commands[] =
1, MAX_ARGS, 1, NULL, irc_cmd_send_ison, NULL },
{ "join", N_("join a channel"),
N_("channel[,channel] [key[,key]]"),
N_("channel: channel name to join\nkey: key to join the channel"),
N_("channel: channel name to join\n"
"key: key to join the channel"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_join, irc_cmd_recv_join },
{ "kick", N_("forcibly remove a user from a channel"),
N_("[channel] nickname [comment]"),
N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
N_("channel: channel where user is\n"
"nickname: nickname to kick\n"
"comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
{ "kickban", N_("kicks and bans a nick from a channel"),
N_("[channel] nickname [comment]"),
N_("channel: channel where user is\nnickname: nickname to kick and ban\ncomment: comment for kick"),
N_("channel: channel where user is\n"
"nickname: nickname to kick and ban\n"
"comment: comment for kick"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
{ "kill", N_("close client-server connection"),
N_("nickname comment"),
N_("nickname: nickname\ncomment: comment for kill"),
N_("nickname: nickname\n"
"comment: comment for kill"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill },
{ "links", N_("list all servernames which are known by the server answering the query"),
N_("[[server] server_mask]"),
@@ -145,8 +159,8 @@ t_irc_command irc_commands[] =
0, 1, 1, NULL, irc_cmd_send_motd, NULL },
{ "msg", N_("send message to a nick or channel"),
N_("receiver[,receiver] text"),
N_("receiver: nick or channel (may be mask, '*' = current channel)"
"\ntext: text to send"),
N_("receiver: nick or channel (may be mask, '*' = current channel)\n"
"text: text to send"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_msg, NULL },
{ "names", N_("list nicknames on channels"),
N_("[channel[,channel]]"), N_("channel: channel name"),
@@ -167,24 +181,26 @@ t_irc_command irc_commands[] =
N_("user/password: used to get privileges on current IRC server"),
2, 2, 1, NULL, irc_cmd_send_oper, NULL },
{ "part", N_("leave a channel"),
N_("[channel[,channel]] [part_message]"), N_("channel: channel name to leave\n"
"part_message: part message (displayed to other users)"),
N_("[channel[,channel]] [part_message]"),
N_("channel: channel name to leave\n"
"part_message: part message (displayed to other users)"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_part, irc_cmd_recv_part },
{ "ping", N_("ping server"),
N_("server1 [server2]"),
N_("server1: server to ping\nserver2: forward ping to this server"),
1, 2, 1, NULL, irc_cmd_send_ping, irc_cmd_recv_ping },
{ "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"),
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, irc_cmd_recv_pong },
{ "privmsg", N_("message received"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_privmsg },
{ "query", N_("send a private message to a nick"),
N_("nickname [text]"),
N_("nickname: nickname for private conversation"
"\ntext: text to send"),
N_("nickname: nickname for private conversation\n"
"text: text to send"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
{ "quit", N_("close all connections & quit"),
N_("[quit_message]"),
@@ -206,14 +222,17 @@ t_irc_command irc_commands[] =
"type: reserved for future usage"),
6, 6, 1, NULL, irc_cmd_send_service, NULL },
{ "servlist", N_("list services currently connected to the network"),
N_("[mask [type]]"), N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
N_("[mask [type]]"),
N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
0, 2, 1, NULL, irc_cmd_send_servlist, NULL },
{ "squery", N_("deliver a message to a service"),
N_("service text"), N_("service: name of service\ntext: text to send"),
N_("service text"),
N_("service: name of service\ntext: text to send"),
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
{ "squit", N_("disconnect server links"),
N_("server comment"), N_("server: server name\ncomment: comment for quit"),
N_("server comment"),
N_("server: server name\ncomment: comment for quit"),
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
{ "stats", N_("query statistics about server"),
N_("[query [server]]"),
@@ -222,21 +241,24 @@ t_irc_command irc_commands[] =
{ "summon", N_("give users who are on a host running an IRC server a message "
"asking them to please join IRC"),
N_("user [target [channel]]"),
N_("user: username\ntarget: server name\nchannel: channel name"),
N_("user: username\ntarget: server name\n"
"channel: channel name"),
1, 3, 1, NULL, irc_cmd_send_summon, NULL },
{ "time", N_("query local time from server"),
N_("[target]"), N_("target: query time from specified server"),
0, 1, 1, NULL, irc_cmd_send_time, NULL },
{ "topic", N_("get/set channel topic"),
N_("[channel] [topic]"), N_("channel: channel name\ntopic: new topic for channel "
"(if topic is \"-delete\" then topic is deleted)"),
N_("[channel] [topic]"),
N_("channel: channel name\ntopic: new topic for channel "
"(if topic is \"-delete\" then topic is deleted)"),
0, MAX_ARGS, 1, NULL, irc_cmd_send_topic, irc_cmd_recv_topic },
{ "trace", N_("find the route to specific server"),
N_("[target]"), N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_trace, NULL },
{ "unban", N_("unbans nicks or hosts"),
N_("[channel] nickname [nickname ...]"),
N_("channel: channel for unban\nnickname: user or host to unban"),
N_("channel: channel for unban\n"
"nickname: user or host to unban"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
{ "userhost", N_("return a list of information about nicknames"),
N_("nickname [nickname ...]"), N_("nickname: nickname"),
@@ -245,80 +267,85 @@ t_irc_command irc_commands[] =
N_("[target]"), N_("target: server"),
0, 1, 1, NULL, irc_cmd_send_users, NULL },
{ "version", N_("gives the version info of nick or server (current or specified)"),
N_("[server | nickname]"), N_("server: server name\nnickname: nickname"),
N_("[server | nickname]"),
N_("server: server name\n"
"nickname: nickname"),
0, 1, 1, NULL, irc_cmd_send_version, NULL },
{ "voice", N_("gives voice to nickname(s)"),
N_("nickname [nickname]"), "",
1, MAX_ARGS, 1, irc_cmd_send_voice, NULL, NULL },
N_("[nickname [nickname]]"), "",
0, 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"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
{ "who", N_("generate a query which returns a list of information"),
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
"o: only operators are returned according to the mask supplied"),
N_("[mask [\"o\"]]"),
N_("mask: only information which match this mask\n"
"o: only operators are returned according to the mask supplied"),
0, 2, 1, NULL, irc_cmd_send_who, NULL },
{ "whois", N_("query information about user(s)"),
N_("[server] nickname[,nickname]"), N_("server: server name\n"
"nickname: nickname (may be a mask)"),
N_("[server] nickname[,nickname]"),
N_("server: server name\n"
"nickname: nickname (may be a mask)"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whois, NULL },
{ "whowas", N_("ask for information about a nickname which no longer exists"),
N_("nickname [,nickname [,nickname ...]] [count [target]]"),
N_("nickname: nickname to search\ncount: number of replies to return "
"(full search if negative number)\n"
"target: reply should match this mask"),
N_("nickname: nickname to search\n"
"count: number of replies to return (full search if negative number)\n"
"target: reply should match this mask"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_whowas, NULL },
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
{ "001", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "002", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "003", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "004", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_004 },
{ "005", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "253", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "254", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "255", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "256", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "257", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "258", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "259", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "260", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "261", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "262", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "263", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "264", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "265", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "266", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "267", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "268", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "269", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "301", N_("away message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_301 },
{ "302", N_("userhost"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_302 },
{ "303", N_("ison"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_303 },
{ "305", N_("unaway"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_305 },
{ "306", N_("now away"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_306 },
{ "307", N_("whois (registered nick)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_307 },
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
{ "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_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 },
{ "311", N_("whois (user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_311 },
{ "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_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 },
{ "320", N_("whois (identified user)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_320 },
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "321", N_("/list start"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_321 },
{ "322", N_("channel (for /list)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_322 },
{ "323", N_("/list end"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_323 },
{ "324", N_("channel mode"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_324 },
{ "329", "???", "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_329 },
{ "331", N_("no topic for channel"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_331 },
{ "332", N_("topic of channel"),
N_("channel :topic"),
N_("channel: name of channel\ntopic: topic of the channel"),
N_("channel: name of channel\n"
"topic: topic of the channel"),
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_332 },
{ "333", N_("infos about topic (nick & date changed)"),
"", "",
@@ -328,21 +355,22 @@ t_irc_command irc_commands[] =
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
{ "353", N_("list of nicks on channel"),
N_("channel :[[@|+]nick ...]"),
N_("channel: name of channel\nnick: nick on the channel"),
N_("channel: name of channel\n"
"nick: nick on the channel"),
2, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_353 },
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
{ "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
{ "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
{ "364", N_("links"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "365", N_("end of /links list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "366", N_("end of /names list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_366 },
{ "367", N_("banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_367 },
{ "368", N_("end of banlist"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_368 },
{ "369", N_("end of /whowas list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "371", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "372", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "373", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "374", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "401", N_("no such nick/channel"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "402", N_("no such server"),
@@ -443,6 +471,7 @@ t_irc_command irc_commands[] =
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "502", N_("can't change mode for other users"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
{ "671", N_("whois (secure connection)"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
{ "671", N_("whois (secure connection)"),
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
{ NULL, NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL }
};
+341 -115
View File
@@ -63,6 +63,136 @@ dcc_redraw (int highlight)
}
}
/*
* dcc_search: search a DCC
*/
t_irc_dcc *
dcc_search (t_irc_server *server, int type, int status, int port)
{
t_irc_dcc *ptr_dcc;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
if ((ptr_dcc->server == server)
&& (ptr_dcc->type == type)
&& (ptr_dcc->status = status)
&& (ptr_dcc->port == port))
return ptr_dcc;
}
/* DCC not found */
return NULL;
}
/*
* dcc_file_is_resumable: check if a file can be used for resuming a download
*/
int
dcc_file_is_resumable (t_irc_dcc *ptr_dcc, char *filename)
{
struct stat st;
if (!cfg_dcc_auto_resume)
return 0;
if (access (filename, W_OK) == 0)
{
if (stat (filename, &st) != -1)
{
if ((unsigned long) st.st_size < ptr_dcc->size)
{
ptr_dcc->start_resume = (unsigned long) st.st_size;
ptr_dcc->pos = st.st_size;
ptr_dcc->last_check_pos = st.st_size;
return 1;
}
}
}
/* not resumable */
return 0;
}
/*
* dcc_find_filename: find local filename for a DCC
* if type if file/recv, add a suffix (like .1) if needed
* if download is resumable, set "start_resume" to good value
*/
void
dcc_find_filename (t_irc_dcc *ptr_dcc)
{
char *ptr_home, *filename2;
ptr_home = getenv ("HOME");
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
strlen (ptr_dcc->nick) +
strlen (ptr_dcc->filename) +
((cfg_dcc_download_path[0] == '~') ?
strlen (ptr_home) : 0) +
4);
if (!ptr_dcc->local_filename)
return;
if (cfg_dcc_download_path[0] == '~')
{
strcpy (ptr_dcc->local_filename, ptr_home);
strcat (ptr_dcc->local_filename, cfg_dcc_download_path + 1);
}
else
strcpy (ptr_dcc->local_filename, cfg_dcc_download_path);
if (ptr_dcc->local_filename[strlen (ptr_dcc->local_filename) - 1] != DIR_SEPARATOR_CHAR)
strcat (ptr_dcc->local_filename, DIR_SEPARATOR);
strcat (ptr_dcc->local_filename, ptr_dcc->nick);
strcat (ptr_dcc->local_filename, ".");
strcat (ptr_dcc->local_filename, ptr_dcc->filename);
/* file already exists? */
if (access (ptr_dcc->local_filename, F_OK) == 0)
{
if (dcc_file_is_resumable (ptr_dcc, ptr_dcc->local_filename))
return;
/* if auto rename is not set, then abort DCC */
if (!cfg_dcc_auto_rename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return;
}
filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
if (!filename2)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return;
}
ptr_dcc->filename_suffix = 0;
do
{
ptr_dcc->filename_suffix++;
sprintf (filename2, "%s.%d",
ptr_dcc->local_filename,
ptr_dcc->filename_suffix);
if (access (filename2, F_OK) == 0)
{
if (dcc_file_is_resumable (ptr_dcc, filename2))
break;
}
else
break;
}
while (1);
free (ptr_dcc->local_filename);
ptr_dcc->local_filename = strdup (filename2);
free (filename2);
}
}
/*
* dcc_calculate_speed: calculate DCC speed (for files only)
*/
@@ -81,7 +211,7 @@ dcc_calculate_speed (t_irc_dcc *ptr_dcc, int ended)
elapsed = local_time - ptr_dcc->start_transfer;
if (elapsed == 0)
elapsed = 1;
ptr_dcc->bytes_per_sec = ptr_dcc->pos / elapsed;
ptr_dcc->bytes_per_sec = (ptr_dcc->pos - ptr_dcc->start_resume) / elapsed;
}
else
{
@@ -182,7 +312,7 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
ptr_dcc->status = status;
if (status == DCC_DONE)
if ((status == DCC_DONE) || (status == DCC_ABORTED) || (status == DCC_FAILED))
{
if (DCC_IS_FILE(ptr_dcc->type))
{
@@ -192,20 +322,25 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
if (ptr_dcc->local_filename)
{
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
gui_printf (ptr_dcc->server->buffer, ")");
}
if (ptr_dcc->type == DCC_FILE_SEND)
gui_printf (ptr_dcc->server->buffer, _(") sent to "));
gui_printf (ptr_dcc->server->buffer, _(" sent to "));
else
gui_printf (ptr_dcc->server->buffer, _(") received from "));
gui_printf (ptr_dcc->server->buffer, _(" received from "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_NICK,
"%s",
ptr_dcc->nick);
gui_printf (ptr_dcc->server->buffer, _(": ok!\n"));
gui_printf (ptr_dcc->server->buffer,
(status == DCC_DONE) ? _(": ok!\n") : _(": FAILED\n"));
}
}
if (status == DCC_ABORTED)
@@ -229,6 +364,14 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
}
}
/* remove empty file if received file failed and nothing was transfered */
if (((status == DCC_FAILED) || (status == DCC_ABORTED))
&& DCC_IS_FILE(ptr_dcc->type)
&& DCC_IS_RECV(ptr_dcc->type)
&& ptr_dcc->local_filename
&& ptr_dcc->pos == 0)
unlink (ptr_dcc->local_filename);
if (DCC_IS_CHAT(ptr_dcc->type))
channel_remove_dcc (ptr_dcc);
@@ -262,7 +405,7 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
"(maybe private buffer has already DCC CHAT?)\n"),
WEECHAT_ERROR);
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
return;
}
@@ -281,18 +424,16 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
}
/*
* dcc_accept: accepts a DCC file or chat request
* dcc_recv_connect_init: connect to sender and init file or chat
*/
void
dcc_accept (t_irc_dcc *ptr_dcc)
dcc_recv_connect_init (t_irc_dcc *ptr_dcc)
{
char *ptr_home, *filename2;
if (!dcc_connect (ptr_dcc))
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
else
{
@@ -301,68 +442,15 @@ dcc_accept (t_irc_dcc *ptr_dcc)
/* DCC file => look for local filename and open it in writing mode */
if (DCC_IS_FILE(ptr_dcc->type))
{
ptr_home = getenv ("HOME");
ptr_dcc->local_filename = (char *) malloc (strlen (cfg_dcc_download_path) +
strlen (ptr_dcc->nick) +
strlen (ptr_dcc->filename) +
((cfg_dcc_download_path[0] == '~') ?
strlen (ptr_home) : 0) +
4);
if (!ptr_dcc->local_filename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
if (cfg_dcc_download_path[0] == '~')
{
strcpy (ptr_dcc->local_filename, ptr_home);
strcat (ptr_dcc->local_filename, cfg_dcc_download_path + 1);
}
if (ptr_dcc->start_resume > 0)
ptr_dcc->file = open (ptr_dcc->local_filename,
O_APPEND | O_WRONLY | O_NONBLOCK);
else
strcpy (ptr_dcc->local_filename, cfg_dcc_download_path);
if (ptr_dcc->local_filename[strlen (ptr_dcc->local_filename) - 1] != DIR_SEPARATOR_CHAR)
strcat (ptr_dcc->local_filename, DIR_SEPARATOR);
strcat (ptr_dcc->local_filename, ptr_dcc->nick);
strcat (ptr_dcc->local_filename, ".");
strcat (ptr_dcc->local_filename, ptr_dcc->filename);
/* file already exists? */
if (access (ptr_dcc->local_filename, F_OK) == 0)
{
/* if auto rename is not set, then abort DCC */
if (!cfg_dcc_auto_rename)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
filename2 = (char *) malloc (strlen (ptr_dcc->local_filename) + 16);
if (!filename2)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
}
ptr_dcc->filename_suffix = 0;
do
{
ptr_dcc->filename_suffix++;
sprintf (filename2, "%s.%d",
ptr_dcc->local_filename,
ptr_dcc->filename_suffix);
}
while (access (filename2, F_OK) == 0);
free (ptr_dcc->local_filename);
ptr_dcc->local_filename = strdup (filename2);
free (filename2);
}
ptr_dcc->file = open (ptr_dcc->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
ptr_dcc->file = open (ptr_dcc->local_filename,
O_CREAT | O_TRUNC | O_WRONLY | O_NONBLOCK,
0644);
ptr_dcc->start_transfer = time (NULL);
ptr_dcc->last_check_time = time (NULL);
}
else
{
@@ -370,7 +458,94 @@ dcc_accept (t_irc_dcc *ptr_dcc)
dcc_channel_for_chat (ptr_dcc);
}
}
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
/*
* dcc_accept: accepts a DCC file or chat request
*/
void
dcc_accept (t_irc_dcc *ptr_dcc)
{
if (DCC_IS_FILE(ptr_dcc->type) && (ptr_dcc->start_resume > 0))
{
ptr_dcc->status = DCC_CONNECTING;
server_sendf (ptr_dcc->server,
(strchr (ptr_dcc->filename, ' ')) ?
"PRIVMSG %s :\01DCC RESUME \"%s\" %d %u\01\r\n" :
"PRIVMSG %s :\01DCC RESUME %s %d %u\01\r\n",
ptr_dcc->nick, ptr_dcc->filename,
ptr_dcc->port, ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
else
dcc_recv_connect_init (ptr_dcc);
}
/*
* dcc_accept_resume: accepts a resume and inform the receiver
*/
void
dcc_accept_resume (t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
t_irc_dcc *ptr_dcc;
ptr_dcc = dcc_search (server, DCC_FILE_SEND, DCC_CONNECTING, port);
if (ptr_dcc)
{
ptr_dcc->pos = pos_start;
ptr_dcc->ack = pos_start;
ptr_dcc->start_resume = pos_start;
ptr_dcc->last_check_pos = pos_start;
server_sendf (ptr_dcc->server,
(strchr (ptr_dcc->filename, ' ')) ?
"PRIVMSG %s :\01DCC ACCEPT \"%s\" %d %u\01\r\n" :
"PRIVMSG %s :\01DCC ACCEPT %s %d %u\01\r\n",
ptr_dcc->nick, ptr_dcc->filename,
ptr_dcc->port, ptr_dcc->start_resume);
irc_display_prefix (ptr_dcc->server->buffer, PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _("resumed at position %u\n"),
ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
else
gui_printf (server->buffer,
_("%s can't resume file \"%s\" (port: %d, start position: %u): DCC not found or ended\n"),
WEECHAT_ERROR, filename, port, pos_start);
}
/*
* dcc_start_resume: called when "DCC ACCEPT" is received (resume accepted by sender)
*/
void
dcc_start_resume (t_irc_server *server, char *filename, int port,
unsigned long pos_start)
{
t_irc_dcc *ptr_dcc;
ptr_dcc = dcc_search (server, DCC_FILE_RECV, DCC_CONNECTING, port);
if (ptr_dcc)
{
ptr_dcc->pos = pos_start;
ptr_dcc->ack = pos_start;
ptr_dcc->start_resume = pos_start;
ptr_dcc->last_check_pos = pos_start;
dcc_recv_connect_init (ptr_dcc);
}
else
gui_printf (server->buffer,
_("%s can't resume file \"%s\" (port: %d, start position: %u): DCC not found or ended\n"),
WEECHAT_ERROR, filename, port, pos_start);
}
/*
@@ -410,14 +585,20 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
new_dcc->filename = strdup (_("DCC chat"));
else
new_dcc->filename = (filename) ? strdup (filename) : NULL;
new_dcc->local_filename = (local_filename) ? strdup (local_filename) : NULL;
new_dcc->local_filename = NULL;
new_dcc->filename_suffix = -1;
new_dcc->size = size;
new_dcc->pos = 0;
new_dcc->ack = 0;
new_dcc->last_check_time = 0;
new_dcc->start_resume = 0;
new_dcc->last_check_time = time (NULL);
new_dcc->last_check_pos = 0;
new_dcc->bytes_per_sec = 0;
new_dcc->last_activity = time (NULL);
if (local_filename)
new_dcc->local_filename = strdup (local_filename);
else
dcc_find_filename (new_dcc);
new_dcc->prev_dcc = NULL;
new_dcc->next_dcc = dcc_list;
if (dcc_list)
@@ -443,6 +624,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
gui_printf (server->buffer, ", ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_FILE_SEND)
{
@@ -456,6 +638,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
gui_printf (server->buffer, "), ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_RECV)
{
@@ -467,12 +650,40 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")\n");
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_SEND)
{
irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC chat request to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s\n", nick);
dcc_redraw (HOTLIST_MSG);
}
if (DCC_IS_FILE(type) && (!new_dcc->local_filename))
{
dcc_close (new_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return NULL;
}
if (DCC_IS_FILE(type) && (new_dcc->start_resume > 0))
{
irc_display_prefix (new_dcc->server->buffer, PREFIX_INFO);
gui_printf (new_dcc->server->buffer, _("DCC: file "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->filename);
gui_printf (new_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->local_filename);
gui_printf (new_dcc->server->buffer, ") ");
gui_printf (new_dcc->server->buffer, _("will be resumed at position %u\n"),
new_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
/* connect if needed and redraw DCC buffer */
@@ -481,6 +692,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
if (!dcc_connect (new_dcc))
{
dcc_close (new_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
return NULL;
}
}
@@ -489,7 +701,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|| ( (type == DCC_FILE_RECV) && (cfg_dcc_auto_accept_files) ) )
dcc_accept (new_dcc);
else
dcc_redraw (2);
dcc_redraw (HOTLIST_PRIVATE);
gui_draw_buffer_status (gui_current_window->buffer, 0);
return new_dcc;
@@ -518,9 +730,9 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
if (type == DCC_FILE_SEND)
{
/* add home if filename not beginning with '/' (not for Win32) */
#ifdef _WIN32
#ifdef _WIN32
filename2 = strdup (filename);
#else
#else
if (filename[0] == '/')
filename2 = strdup (filename);
else
@@ -550,7 +762,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
strcat (filename2, DIR_SEPARATOR);
strcat (filename2, filename);
}
#endif
#endif
/* check if file exists */
if (stat (filename2, &st) == -1)
@@ -705,11 +917,11 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
buffer[sizeof (buffer) - 1] = '\0';
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
size_buf = strlen (buffer);
#ifdef DEBUG
#ifdef DEBUG
buffer[size_buf - 2] = '\0';
gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer);
buffer[size_buf - 2] = '\r';
#endif
#endif
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
cfg_look_charset_encode,
@@ -786,7 +998,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (ptr_buf, ptr_dcc->server->nick))
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
@@ -821,7 +1033,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
else
{
dcc_close (ptr_dcc, DCC_ABORTED);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
}
@@ -844,6 +1056,17 @@ dcc_handle ()
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
/* check DCC timeout */
if (DCC_IS_FILE(ptr_dcc->type) && !DCC_ENDED(ptr_dcc->status))
{
if ((cfg_dcc_timeout != 0) && (time (NULL) > ptr_dcc->last_activity + cfg_dcc_timeout))
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (HOTLIST_MSG);
continue;
}
}
if (ptr_dcc->status == DCC_CONNECTING)
{
if (ptr_dcc->type == DCC_FILE_SEND)
@@ -858,6 +1081,7 @@ dcc_handle ()
{
if (FD_ISSET (ptr_dcc->sock, &read_fd))
{
ptr_dcc->last_activity = time (NULL);
length = sizeof (addr);
sock = accept (ptr_dcc->sock, (struct sockaddr *) &addr, &length);
close (ptr_dcc->sock);
@@ -865,21 +1089,21 @@ dcc_handle ()
if (sock < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->sock = sock;
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
ptr_dcc->status = DCC_ACTIVE;
ptr_dcc->file = open (ptr_dcc->local_filename, O_RDONLY | O_NONBLOCK, 0644);
ptr_dcc->start_transfer = time (NULL);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
}
}
@@ -906,19 +1130,19 @@ dcc_handle ()
if (sock < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->sock = sock;
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->addr = ntohl (addr.sin_addr.s_addr);
ptr_dcc->status = DCC_ACTIVE;
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
dcc_channel_for_chat (ptr_dcc);
}
}
@@ -949,16 +1173,17 @@ dcc_handle ()
if (num_read == 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (write (ptr_dcc->file, buffer, num_read) == -1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->last_activity = time (NULL);
ptr_dcc->pos += (unsigned long) num_read;
pos = htonl (ptr_dcc->pos);
send (ptr_dcc->sock, (char *) &pos, 4, 0);
@@ -966,10 +1191,10 @@ dcc_handle ()
if (ptr_dcc->pos >= ptr_dcc->size)
{
dcc_close (ptr_dcc, DCC_DONE);
dcc_redraw (1);
dcc_redraw (HOTLIST_MSG);
}
else
dcc_redraw (0);
dcc_redraw (HOTLIST_LOW);
}
}
if (ptr_dcc->type == DCC_FILE_SEND)
@@ -982,8 +1207,8 @@ dcc_handle ()
"max is %d.\n"),
sizeof (buffer));
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (ptr_dcc->pos > ptr_dcc->ack)
{
@@ -994,11 +1219,11 @@ dcc_handle ()
if (num_read == 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
if (num_read < 4)
return;
continue;
recv (ptr_dcc->sock, (char *) &pos, 4, 0);
ptr_dcc->ack = ntohl (pos);
@@ -1006,8 +1231,8 @@ dcc_handle ()
&& (ptr_dcc->ack >= ptr_dcc->size))
{
dcc_close (ptr_dcc, DCC_DONE);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
}
}
@@ -1018,19 +1243,20 @@ dcc_handle ()
if (num_read < 1)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
num_sent = send (ptr_dcc->sock, buffer, num_read, 0);
if (num_sent < 0)
{
dcc_close (ptr_dcc, DCC_FAILED);
dcc_redraw (1);
return;
dcc_redraw (HOTLIST_MSG);
continue;
}
ptr_dcc->last_activity = time (NULL);
ptr_dcc->pos += (unsigned long) num_sent;
dcc_calculate_speed (ptr_dcc, 0);
dcc_redraw (0);
dcc_redraw (HOTLIST_LOW);
}
}
}
+8 -1
View File
@@ -57,7 +57,14 @@ irc_display_prefix (t_gui_buffer *buffer, char *prefix)
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
}
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
{
if (strcmp (prefix, PREFIX_JOIN) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_JOIN, "%s ", prefix);
else if (strcmp (prefix, PREFIX_PART) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_PART, "%s ", prefix);
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
}
}
/*
+420 -64
View File
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <time.h>
#include <sys/utsname.h>
@@ -42,6 +43,92 @@
#include "../plugins/plugins.h"
/*
* irc_is_highlight: returns 1 if given message contains highlight (with given nick
* or at least one of string in "irc_higlight" setting
*/
int
irc_is_highlight (char *message, char *nick)
{
char *msg, *highlight, *pos, *pos_end;
int end, length;
/* empty message ? */
if (!message || !message[0])
return 0;
/* highlight by nickname */
if (strstr (message, nick))
return 1;
/* no highlight by nickname and "irc_highlight" is empty */
if (!cfg_irc_highlight || !cfg_irc_highlight[0])
return 0;
/* convert both strings to lower case */
if ((msg = strdup (message)) == NULL)
return 0;
if ((highlight = strdup (cfg_irc_highlight)) == NULL)
{
free (msg);
return 0;
}
pos = msg;
while (pos[0])
{
pos[0] = tolower (pos[0]);
pos++;
}
pos = highlight;
while (pos[0])
{
pos[0] = tolower (pos[0]);
pos++;
}
/* look in "irc_highlight" for highlight */
pos = highlight;
end = 0;
while (!end)
{
pos_end = strchr (pos, ',');
if (!pos_end)
{
pos_end = strchr (pos, '\0');
end = 1;
}
/* error parsing string! */
if (!pos_end)
{
free (msg);
free (highlight);
return 0;
}
length = pos_end - pos;
pos_end[0] = '\0';
if (length > 0)
{
/* highlight found! */
if (strstr (msg, pos))
{
free (msg);
free (highlight);
return 1;
}
}
if (!end)
pos = pos_end + 1;
}
/* no highlight found with "irc_highlight" list */
free (msg);
free (highlight);
return 0;
}
/*
* irc_recv_command: executes action when receiving IRC command
* returns: 0 = all ok, command executed
@@ -185,7 +272,7 @@ irc_cmd_recv_invite (t_irc_server *server, char *host, char *arguments)
gui_printf (server->buffer, _("by"));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
" %s\n", host);
hotlist_add (2, server->buffer);
hotlist_add (HOTLIST_HIGHLIGHT, server->buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
else
@@ -637,6 +724,31 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
SET_CHANNEL_MODE(ptr_channel, (set_flag == '+'),
CHANNEL_MODE_SECRET);
break;
case 'q':
pos = NULL;
if (parm)
{
pos = strchr (parm, ' ');
if (pos)
pos[0] = '\0';
}
if (nick_host)
irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "q", nick_host,
(set_flag == '+') ?
_("sets quiet on") :
_("removes quiet on"),
(parm) ? parm : NULL);
/* look for next parameter */
if (parm && pos)
{
pos++;
while (pos[0] == ' ')
pos++;
parm = pos;
}
break;
case 's':
if (nick_host)
irc_display_mode (ptr_channel->buffer,
@@ -996,7 +1108,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
(strcasecmp (host, "chanserv") != 0) &&
(strcasecmp (host, "memoserv") != 0))
{
hotlist_add (2, server->buffer);
hotlist_add (HOTLIST_PRIVATE, server->buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
@@ -1159,7 +1271,7 @@ int
irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos2, *host2;
char *pos_file, *pos_addr, *pos_port, *pos_size; /* for DCC */
char *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
struct utsname *buf;
@@ -1207,7 +1319,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
@@ -1228,47 +1340,110 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
return 0;
}
else if (strncmp (pos, "\01SOUND ", 7) == 0)
if (strncmp (pos, "\01SOUND ", 7) == 0)
{
pos += 7;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf (ptr_channel->buffer,
_("Received a CTCP SOUND \"%s\" from "),
pos);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s\n", host);
return 0;
}
if (strncmp (pos, "\01PING", 5) == 0)
{
pos += 5;
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
else
pos = NULL;
if (pos && !pos[0])
pos = NULL;
if (pos)
server_sendf (server, "NOTICE %s :\01PING %s\01\r\n",
host, pos);
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "PING ");
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
/* unknown CTCP ? */
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
pos++;
pos2[0] = '\0';
pos2 = strchr (pos, ' ');
if (pos2)
{
pos2[0] = '\0';
pos2++;
while (pos2[0] == ' ')
pos2++;
if (!pos2[0])
pos2 = NULL;
}
irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Unknown CTCP "));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (ptr_channel->buffer, "\n");
return 0;
}
/* other message */
ptr_nick = nick_search (ptr_channel, host);
if (irc_is_highlight (pos, server->nick))
{
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
1, -1, 0);
if ( (cfg_look_infobar)
&& (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
{
ptr_nick = nick_search (ptr_channel, host);
if (strstr (pos, server->nick))
{
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
1, -1, 0);
if ( (cfg_look_infobar)
&& (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
ptr_channel->name,
host, pos);
}
else
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
irc_display_nick (ptr_channel->buffer, ptr_nick,
(ptr_nick) ? NULL : host,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
@@ -1297,8 +1472,19 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos++;
/* version asked by another user => answer with WeeChat version */
if (strcmp (pos, "\01VERSION\01") == 0)
if (strncmp (pos, "\01VERSION", 8) == 0)
{
pos2 = strchr (pos + 8, ' ');
if (pos2)
{
while (pos2[0] == ' ')
pos2++;
if (pos2[0] == '\01')
pos2 = NULL;
else if (!pos2[0])
pos2 = NULL;
}
buf = (struct utsname *) malloc (sizeof (struct utsname));
if (buf && (uname (buf) == 0))
{
@@ -1317,15 +1503,20 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
irc_display_prefix (server->buffer, PREFIX_INFO);
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Received a "));
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, _("CTCP VERSION "));
COLOR_WIN_CHAT_CHANNEL, "VERSION ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("from"));
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (server->buffer, "\n");
return 0;
}
@@ -1348,6 +1539,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
else
server_sendf (server, "NOTICE %s :\01PING\01\r\n",
host);
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "CTCP ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, "PING ");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
@@ -1419,9 +1619,123 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2--;
pos2[1] = '\0';
dcc_add (server, DCC_FILE_RECV, (unsigned long) atol (pos_addr),
dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
atoi (pos_port), host, -1, pos_file, NULL,
(unsigned long) atol (pos_size));
strtoul (pos_size, NULL, 10));
return 0;
}
/* incoming DCC RESUME (asked by receiver) */
if (strncmp (pos, "\01DCC RESUME", 11) == 0)
{
/* check if DCC RESUME is ok, i.e. with 0x01 at end */
pos2 = strchr (pos + 1, '\01');
if (!pos2)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
/* DCC filename */
pos_file = pos + 11;
while (pos_file[0] == ' ')
pos_file++;
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_start_resume;
pos_start_resume++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
dcc_accept_resume (server, pos_file, atoi (pos_port),
strtoul (pos_start_resume, NULL, 10));
return 0;
}
/* incoming DCC ACCEPT (resume accepted by sender) */
if (strncmp (pos, "\01DCC ACCEPT", 11) == 0)
{
/* check if DCC ACCEPT is ok, i.e. with 0x01 at end */
pos2 = strchr (pos + 1, '\01');
if (!pos2)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2[0] = '\0';
/* DCC filename */
pos_file = pos + 11;
while (pos_file[0] == ' ')
pos_file++;
/* look for resume start position */
pos_start_resume = strrchr (pos_file, ' ');
if (!pos_start_resume)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_start_resume;
pos_start_resume++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
/* look for DCC port */
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
}
pos2 = pos_port;
pos_port++;
while (pos2[0] == ' ')
pos2--;
pos2[1] = '\0';
dcc_start_resume (server, pos_file, atoi (pos_port),
strtoul (pos_start_resume, NULL, 10));
return 0;
}
@@ -1487,7 +1801,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
return -1;
}
dcc_add (server, DCC_CHAT_RECV, (unsigned long) atol (pos_addr),
dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
atoi (pos_port), host, -1, NULL, NULL, 0);
return 0;
@@ -1517,7 +1831,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (pos2)
pos2[0] = '\0';
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG | MSG_TYPE_HIGHLIGHT,
@@ -1541,33 +1855,68 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
/* unknown CTCP ? */
pos2 = strchr (pos + 1, '\01');
if ((pos[0] == '\01') && pos2 && (pos2[1] == '\0'))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
pos++;
pos2[0] = '\0';
pos2 = strchr (pos, ' ');
if (pos2)
{
pos2[0] = '\0';
pos2++;
while (pos2[0] == ' ')
pos2++;
if (!pos2[0])
pos2 = NULL;
}
irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Unknown CTCP "));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s ", pos);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("received from"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s", host);
if (pos2)
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
else
gui_printf (server->buffer, "\n");
return 0;
}
else
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
COLOR_WIN_CHAT_DARK, "<");
if (irc_is_highlight (pos, server->nick))
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
}
}
else
@@ -1855,7 +2204,14 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel->type == CHAT_CHANNEL)
server_sendf (server, "JOIN %s\r\n", ptr_channel->name);
{
if (ptr_channel->key)
server_sendf (server, "JOIN %s %s\r\n",
ptr_channel->name, ptr_channel->key);
else
server_sendf (server, "JOIN %s\r\n",
ptr_channel->name);
}
}
server->reconnect_join = 0;
}

Some files were not shown because too many files have changed in this diff Show More