mirror of
https://github.com/weechat/weechat.git
synced 2026-06-20 18:14:46 +02:00
Compare commits
175 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5a20d282e | |||
| ed76104d42 | |||
| 04206f8032 | |||
| 54a5f181b5 | |||
| dd735af7f8 | |||
| 87fb462f35 | |||
| b3018f8ae7 | |||
| 1f363eeb24 | |||
| f5ecafd6a8 | |||
| c8361419b8 | |||
| 10161cd16c | |||
| a83507eb77 | |||
| 159371cbd9 | |||
| 78c110ace2 | |||
| 83b7741ef2 | |||
| 64c1dbba0e | |||
| 6eb449b370 | |||
| 2bbc2d53eb | |||
| 68cf327088 | |||
| bf3f696830 | |||
| 3bca573d49 | |||
| ba98dca08a | |||
| 4812123dc5 | |||
| ed1755eacc | |||
| bd80891676 | |||
| 8a2a0ec0ae | |||
| e49b4131f2 | |||
| a164b85e3a | |||
| b0758b6fac | |||
| 5830b0ab40 | |||
| d94a7d05ea | |||
| bea5769a05 | |||
| fd562722d0 | |||
| 639d8b3ba9 | |||
| b536a8a491 | |||
| 51cacc0fdb | |||
| e07859395f | |||
| 7cf7e5b9ff | |||
| 87e934766b | |||
| e4b59681b2 | |||
| dd8ce32004 | |||
| b575a4f578 | |||
| 6b1f5a4a92 | |||
| dd3977367f | |||
| 8a9e8ecc88 | |||
| 5dfab7643d | |||
| cea0851071 | |||
| 6919005d74 | |||
| 8497d25d34 | |||
| 4ea734a376 | |||
| 3369a00959 | |||
| a6d93cf432 | |||
| e6a1bb4694 | |||
| 6b6def5890 | |||
| be1c9be925 | |||
| e5754e1fe6 | |||
| c0e4ba60d7 | |||
| 5f101c3833 | |||
| 079e4a4028 | |||
| 24ceb3bb95 | |||
| dec92aeba6 | |||
| 5551542566 | |||
| 9411a2fad0 | |||
| ee4f5716d3 | |||
| e26772dcdb | |||
| 232b5684ca | |||
| 93b2be7a41 | |||
| b86c95e7dc | |||
| 9d52621c44 | |||
| 0e6b0a3b0c | |||
| e081a6af17 | |||
| 3f3a202739 | |||
| 0f055b087a | |||
| 0e531f5e6a | |||
| c2f4bdd0fc | |||
| 32a7fbb767 | |||
| b7484eeea7 | |||
| f7872a9dd8 | |||
| cde66456fb | |||
| 6beb8b6465 | |||
| 1a140ab8b5 | |||
| e148a40ae1 | |||
| ee2951bf11 | |||
| 73359fcc05 | |||
| 0bc32f561b | |||
| d179625e52 | |||
| bd9cdeec5c | |||
| a9f04c5fd9 | |||
| 1e382ab9bd | |||
| 2855b71520 | |||
| 7b4453a507 | |||
| aeb7170024 | |||
| 357d7c5a2f | |||
| b2ec60110c | |||
| 9eb142036e | |||
| fa54807ef6 | |||
| 11d77e6168 | |||
| 2ca5b4f651 | |||
| 38e2003a17 | |||
| 7bb815a540 | |||
| 5a3976d6a5 | |||
| cdc33d08b0 | |||
| 5130b1dc4f | |||
| cdfc5b6c5a | |||
| 50ef2b0306 | |||
| b25824eb4f | |||
| 97a1d0e79d | |||
| 219e9d443a | |||
| 77d50aef98 | |||
| eea49832ea | |||
| 16389e0728 | |||
| 4a7b3436ae | |||
| 799bb14928 | |||
| 75c58c423c | |||
| 63e73b30ad | |||
| 29006d8cec | |||
| 85b1702077 | |||
| caff3dd011 | |||
| 9d4300c0d7 | |||
| 8aa7e3e3e6 | |||
| 150c5e9749 | |||
| 6bec96cd4d | |||
| 068284dd19 | |||
| 38a8c321c0 | |||
| 0094d143b3 | |||
| 530dc9fb67 | |||
| 96a69fd7f3 | |||
| 938915d387 | |||
| 25bbe3d284 | |||
| 9c7d05f605 | |||
| c953db4d64 | |||
| 9d6ca20478 | |||
| 7f4a213239 | |||
| e18f14e5d3 | |||
| 8f3455d0a9 | |||
| dfbea2850a | |||
| 8a299adb3b | |||
| a29416e352 | |||
| c346216e34 | |||
| da7df57b1a | |||
| 61fac4d49e | |||
| 4f5c1b6e09 | |||
| 2962a8e6c8 | |||
| 76263dc7cf | |||
| 554fa728ae | |||
| 5881048405 | |||
| c517253a72 | |||
| fe16f6d48f | |||
| f276fd9494 | |||
| 517de7ab94 | |||
| 06463e5937 | |||
| d80c8e9e57 | |||
| f74b280a1f | |||
| cd4f50c136 | |||
| 767e378c53 | |||
| 60503d9383 | |||
| 11321acb96 | |||
| 84b1a27265 | |||
| 51322e7917 | |||
| d256d72eef | |||
| 8a61b0eee0 | |||
| d4ecb032d4 | |||
| 3f946e304d | |||
| 97b6bbcb9e | |||
| 357edc193e | |||
| ace03b808d | |||
| 428cfbc297 | |||
| 02cd829c4c | |||
| 17973de52a | |||
| 364667f788 | |||
| 10d7c6c34a | |||
| 38fa7c93ac | |||
| 9e328d3fef | |||
| 312d8015f5 | |||
| 110aa59ca8 |
@@ -14,7 +14,7 @@ Developers:
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
* Python plugin
|
||||
* Scripts plugins
|
||||
|
||||
Kolter <kolter@free.fr>
|
||||
Web : http://kolter.free.fr
|
||||
@@ -26,22 +26,16 @@ Debian packager:
|
||||
---------------
|
||||
|
||||
Julien Louis <ptitlouis@sysif.net>
|
||||
IRC : nicks are "ptitlouis" or "tioui" @ irc.freenode.net
|
||||
IRC : nick is "ptitlouis" @ irc.freenode.net
|
||||
Jabber: ptitlouis@amessage.info
|
||||
|
||||
|
||||
Testers:
|
||||
-------
|
||||
Contributors:
|
||||
------------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
Rudolf Polzer <rpolzer-rp@durchnull.de> (IRC: "divVerent")
|
||||
Jiri Golembiovsky <golemj@gmail.com> (IRC: "GolemJ")
|
||||
Jim Ramsay <i.am@jimramsay.com> (IRC: "lack")
|
||||
|
||||
|
||||
=====
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2005-07-30
|
||||
WeeChat known bugs, 2005-11-11
|
||||
|
||||
- some refresh bugs with splited windows
|
||||
- ./configure does not check that Ruby libraries are installed
|
||||
- ./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)
|
||||
- command name for /server can not contain spaces
|
||||
- wrong alias is not created and not saved when quitting WeeChat
|
||||
- when many WeeChat are launched, log file is not properly written (cleared by
|
||||
each WeeChat at startup)
|
||||
- display problems with old Konsole versions (Kde terminal) (???)
|
||||
- WeeChat may crash if too much nicks in nicklist when position is top or bottom
|
||||
|
||||
@@ -1,9 +1,58 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-07-30
|
||||
ChangeLog - 2005-11-11
|
||||
|
||||
|
||||
Version 0.1.6 (2005-11-11):
|
||||
* new color management system, IRC colors are now correctly
|
||||
displayed and can be removed by new options irc_colors_receive
|
||||
and irc_colors_send
|
||||
* fixed scroll problem when one line is bigger than screen size
|
||||
* added setting for having one server buffer for all servers
|
||||
(look_one_server_buffer)
|
||||
* added setting for ignoring some chars when completing nicks
|
||||
* fixed IRC message parser bug
|
||||
* signal SIGPIPE is now ignored
|
||||
* added partial match for highlights
|
||||
* added dcc_own_ip and dcc_port_range settings
|
||||
* full UTF-8 support, auto-detection of UTF-8 usage (locale)
|
||||
* added "Day changed to [date]" message when day changes
|
||||
* new plugin interface, rewritten from scratch: now loads dynamic C
|
||||
library, and perl/python are plugin scripts
|
||||
* log options (for server/channel/private) can now be set while
|
||||
WeeChat is running
|
||||
* added channel modes +e and +f
|
||||
* added some missing IRC commands, fixed command 367
|
||||
* added colors for input buffer and current channel of status bar
|
||||
* added online help for config options (with /set full_option_name)
|
||||
* enhanced "smart" hotlist, with names (new options:
|
||||
look_hotlist_names_{count|level|length})
|
||||
|
||||
Version 0.1.5 (2005-09-24):
|
||||
* added /ame command (send CTCP action to all channels of all
|
||||
connected servers)
|
||||
* added setting "irc_notice_as_pv" to see notices as pv
|
||||
* added nicks colors in setup file
|
||||
* fixed DCC bug: delete failed file only if really empty (on disk)
|
||||
* fixed IRC message parser bug
|
||||
* fixed scroll problem (screen moving when scrolling and new line
|
||||
displayed)
|
||||
* fixed infinite loop when scrolling back and displaying long lines
|
||||
* fixed crash when closing a buffer used by more than one window
|
||||
* added some missing IRC commands
|
||||
* fixed DCC display bug (now decodes string according to charset)
|
||||
* added /ignore and /unignore commands
|
||||
* fixed bug with strings comparison (str[n]casecmp) and some locales
|
||||
(like turkish), now using ASCII comparison (thanks to roktas)
|
||||
* signal SIGQUIT is now ignored
|
||||
* fixed refresh bug when one line is bigger than screen size
|
||||
* fixed look_nicklist_min_size and look_nicklist_max_size options
|
||||
* fixed refresh bug when changing channel modes
|
||||
* jump to next server now saves current channel buffer for each server
|
||||
* ctrl-up/ctrl-down keys added to call previous/next command in global
|
||||
history (common to all buffers)
|
||||
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2005-07-30
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -76,11 +76,10 @@ A: For help you can type /help. For help about a command, type /help command.
|
||||
================================================================================
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
A: You have to setup charset used for decoding (ISO and UTF), encoding, and
|
||||
internal WeeChat charset.
|
||||
Internal charset should be empty value, except if WeeChat failed to
|
||||
detect your locale (WeeChat looks for "UTF-8" in your locale name).
|
||||
|
||||
|
||||
2.4
|
||||
@@ -195,5 +194,5 @@ A: There's many tasks to do (code, documentation, ...)
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: Beer is welcome :)
|
||||
Otherwise Paypal account is: flashcode@free.fr (no limit for gifts :)
|
||||
A: You can give us money to help development.
|
||||
Details on http://weechat.flashtux.org/donate.php?lang=en
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2005-07-30
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -80,11 +80,11 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
R: Il faut configurer le charset utilisé pour le décodage (ISO et UTF),
|
||||
l'encodage ainsi que le charset interne Ă WeeChat.
|
||||
Le charset interne Ă WeeChat doit ĂŞtre une valeur vide, sauf si WeeChat
|
||||
n'arrive pas à déterminer votre locale (WeeChat recherche "UTF-8" dans
|
||||
le nom de la locale).
|
||||
|
||||
|
||||
2.4
|
||||
@@ -206,6 +206,5 @@ R: Il y a plusieurs choses
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: La bière est la bienvenue :)
|
||||
Sinon le compte Paypal est: flashcode@free.fr (il n'y a pas de limite pour
|
||||
les dons :)
|
||||
R: Vous pouvez donner de l'argent pour aider le développement.
|
||||
Plus de détails sur http://weechat.flashtux.org/donate.php
|
||||
|
||||
+3
-3
@@ -19,10 +19,10 @@ SUBDIRS = po doc intl src
|
||||
|
||||
EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
|
||||
debian/changelog debian/control \
|
||||
debian/copyright \
|
||||
debian/copyright debian/compat \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-gtk.dirs \
|
||||
debian/weechat-gtk.install
|
||||
debian/weechat-curses.install \
|
||||
weechat_icon_32.png
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-11-11
|
||||
|
||||
WeeChat 0.1.6 released.
|
||||
|
||||
Important release notes:
|
||||
|
||||
- incompatibility with some old scripts: now all handlers have to return
|
||||
a code for completion, and to do some actions about message to ignore
|
||||
(please look at documentation for detail)
|
||||
|
||||
- on OpenBSD, the new option "plugins_extension" should be set to ".so.0.0"
|
||||
since the plugins names are ending by ".so.0.0" and not ".so"
|
||||
|
||||
- with new and full UTF-8 support, the option "look_charset_internal"
|
||||
should be set to blank for most cases. Forces it only if your locale is
|
||||
not properly detected by WeeChat (you can set "UTF-8" or "ISO-8859-15"
|
||||
for example, depending on your locale). WeeChat is looking for "UTF-8" in
|
||||
your locale name at startup.
|
||||
|
||||
* FlashCode, 2005-09-24
|
||||
|
||||
WeeChat 0.1.5 released.
|
||||
|
||||
* FlashCode, 2005-07-30
|
||||
|
||||
WeeChat 0.1.4 released.
|
||||
|
||||
@@ -12,10 +12,10 @@ Features
|
||||
* IRC chat client with multi-server connection
|
||||
* many GUI (curses, Gtk, Qt) (1)
|
||||
* small, fast and very light
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* customizable and extensible with plugins (scripts Perl, Python, Ruby) (2)
|
||||
* compliant with RFC 1459,2810,2811,2812,2813
|
||||
* developed from scratch
|
||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||
* multi-platform (GNU/Linux, *BSD, Mac OS X, QNX, Windows & other) (3)
|
||||
* 100% GPL & free
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---
|
||||
(1) only Curses interface is available today
|
||||
(2) only Perl and Python interfaces are available today
|
||||
(3) only GNU/Linux and *BSD versions are available today
|
||||
(2) only Perl and Python plugins are available today
|
||||
(3) Windows is under construction
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-07-20
|
||||
TODO - 2005-11-11
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,59 +10,46 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.1.4:
|
||||
------
|
||||
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
# Solaris version
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
# SSL support
|
||||
# IPv6 protocol implementation
|
||||
# proxy support (http, socks4, socks5) with authentification
|
||||
(http, socks5) and ipv6 support (client to proxy)
|
||||
# highlight should not occur on partial words
|
||||
# one buffer for all servers
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- allow decode/encode charsets for servers or chan (not globally)
|
||||
# interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
? Qt GUI
|
||||
|
||||
* 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:
|
||||
---------------
|
||||
- host with "*" possible with /ignore command
|
||||
- "/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
|
||||
# "/uptime" command
|
||||
- "/upgrade" command: reload WeeChat himself without disconnecting from server
|
||||
|
||||
* IRC protocol:
|
||||
- customizable CTCP version reply
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||
When we come back from our away it should print it to the current window
|
||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||
nick/host connect to the given irc network
|
||||
|
||||
* WeeChat commands:
|
||||
- "/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
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
? Qt GUI
|
||||
* Configuration:
|
||||
- be able to launch more than one command when connecting to server
|
||||
|
||||
* Plugins:
|
||||
# dynamically load plugins as a separate library
|
||||
- allow print function to write on all buffers or all channels of a server
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
@@ -6,6 +6,7 @@ cp Makefile.am Makefile.am.old
|
||||
gettextize --copy --force --intl --no-changelog &&
|
||||
mv Makefile.am.old Makefile.am
|
||||
mv configure.in.old configure.in
|
||||
libtoolize --automake --force --copy &&
|
||||
aclocal &&
|
||||
# autoheader creates config.h.in needed by autoconf
|
||||
autoheader &&
|
||||
|
||||
+201
-87
@@ -19,28 +19,42 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.4, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.6, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.4])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.6])
|
||||
|
||||
# Checks for programs.
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Add some flags for some OS
|
||||
case "$host_os" in
|
||||
freebsd* | openbsd*)
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
;;
|
||||
netbsd*)
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr es"
|
||||
ALL_LINGUAS="fr es cs"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
# Checks for libraries
|
||||
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
# Checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
# Checks for typedefs, structures, and compiler characteristics
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
@@ -63,68 +77,87 @@ AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
# Variables in config.h
|
||||
|
||||
AH_VERBATIM([PREFIX], [#undef PREFIX])
|
||||
AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
|
||||
AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
|
||||
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets,[ --enable-wxwidgets Turn on WxWidgets interface (default=no)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=$enableval,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python plugins (default=no)],enable_python=$enableval,enable_python=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=auto)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
# Arguments for ./configure
|
||||
|
||||
enable_plugins="no"
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python script plugin (default=no Python plugin)],enable_python=$enableval,enable_python=no)
|
||||
AC_ARG_ENABLE(ruby, [ --enable-ruby Turn on Ruby script plugin (default=no Ruby script)],enable_ruby=$enableval,enable_ruby=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGINS, test "$enable_plugins" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# GUI
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([
|
||||
if test "$LIBNCURSESW_FOUND" = "0" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([
|
||||
*** ncurses library not found!
|
||||
*** Please install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
AC_MSG_WARN([
|
||||
*** ncursesw library not found! Falling back to "ncurses"
|
||||
*** Be careful, UTF-8 display may not work properly if your locale is UTF-8.])
|
||||
NCURSES_LIBS="-lncurses"
|
||||
else
|
||||
NCURSES_LIBS="-lncursesw"
|
||||
AC_CHECK_HEADERS(ncursesw/curses.h)
|
||||
fi
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
AM_OPTIONS_WXCONFIG
|
||||
AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
|
||||
if test "$wxWin" != 1; then
|
||||
AC_MSG_ERROR([
|
||||
*** wxWindows must be installed on your system
|
||||
*** but wx-config script couldn't be found.
|
||||
|
||||
*** Please check that wx-config is in path, the directory
|
||||
*** where wxWindows libraries are installed (returned by
|
||||
*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
*** equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
|
||||
WXWIDGETS_CFLAGS=""
|
||||
WXWIDGETS_LIBS=""
|
||||
fi
|
||||
#if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
# AM_OPTIONS_WXCONFIG
|
||||
# AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
#
|
||||
# if test "$wxWin" != 1; then
|
||||
# AC_MSG_ERROR([
|
||||
#*** wxWindows must be installed on your system
|
||||
#*** but wx-config script couldn't be found.
|
||||
#
|
||||
#*** Please check that wx-config is in path, the directory
|
||||
#*** where wxWindows libraries are installed (returned by
|
||||
#*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
#*** equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
# ])
|
||||
# fi
|
||||
#
|
||||
# CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
# CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
# CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
# LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
#
|
||||
# WXWIDGETS_CFLAGS=""
|
||||
# WXWIDGETS_LIBS=""
|
||||
#fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
@@ -136,6 +169,10 @@ if test "x$enable_gtk" = "xyes" ; then
|
||||
AC_SUBST(GTK_LIBS)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# plugins
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
PLUGINS_LIBS=
|
||||
|
||||
if test "x$enable_perl" = "xyes" ; then
|
||||
@@ -169,7 +206,7 @@ it with your software package manager.])
|
||||
PERL_LIB_TEST=`PT=perltest.c ; echo "int main() { return 0; }" > $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
|
||||
|
||||
if test "x$PERL_LIB_TEST" = "x0" ; then
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `$PERL -MExtUtils::Embed -e ldopts`"
|
||||
PERL_LFLAGS=`$PERL -MExtUtils::Embed -e ldopts`
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Perl library couldn't be found in your system.
|
||||
@@ -178,6 +215,7 @@ it with your software package manager.])
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_SUBST(PERL_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PERL)
|
||||
fi
|
||||
|
||||
@@ -196,11 +234,11 @@ if test "x$enable_python" = "xyes" ; then
|
||||
|
||||
PYTHON_SYSPREFIX=`$PYTHON -c 'import sys; print "%s" % sys.prefix'`
|
||||
PYTHON_VERSION=`$PYTHON -c 'import sys ; print sys.version[[:3]]'`
|
||||
PYTHON_INCLUDE="$PYTHON_SYSPREFIX/include/python$PYTHON_VERSION"
|
||||
PYTHON_INCLUDE=`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python header files)
|
||||
if test -r "$PYTHON_INCLUDE/Python.h"; then
|
||||
PYTHON_CFLAGS=-I`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python header files couldn't be found in your system.
|
||||
@@ -208,11 +246,16 @@ if test "x$enable_python" = "xyes" ; then
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PYTHON_LIB="$PYTHON_SYSPREFIX/lib/python$PYTHON_VERSION/config"
|
||||
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
|
||||
PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('SYSLIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python library)
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so" -o -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-lpython$PYTHON_VERSION -lpthread -lutil"
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python library couldn't be found in your system.
|
||||
@@ -220,17 +263,44 @@ if test "x$enable_python" = "xyes" ; then
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/python/lib_weechat_python.a $PYTHON_LFLAGS"
|
||||
AC_SUBST(PYTHON_CFLAGS)
|
||||
AC_SUBST(PYTHON_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PYTHON)
|
||||
fi
|
||||
|
||||
if test "x$enable_ruby" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
# TODO: check that ruby lib and headers are installed
|
||||
|
||||
RUBY_CFLAGS=-I`ruby -rrbconfig -e "puts Config::CONFIG[['archdir']]"`
|
||||
RUBY_LFLAGS=`ruby -rrbconfig -e "puts Config::CONFIG[['LIBRUBYARG_SHARED']]"`
|
||||
AC_SUBST(RUBY_CFLAGS)
|
||||
AC_SUBST(RUBY_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_RUBY)
|
||||
fi
|
||||
|
||||
if test "x$enable_plugins" = "xyes" ; then
|
||||
AC_CHECK_FUNCS(dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" != "yes"; then
|
||||
AC_CHECK_LIB(dl, dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" = "yes"; then
|
||||
PLUGINS_LIBS="-ldl"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** "dl" library (dynamic library loader) couldn't be found in your system.
|
||||
*** Try to install it with your software package manager or disable plugins.])
|
||||
fi
|
||||
fi
|
||||
AC_DEFINE(PLUGINS)
|
||||
fi
|
||||
|
||||
AC_SUBST(PLUGINS_LIBS)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# gnutls
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_gnutls" = "xyes" ; then
|
||||
found_gnutls="no"
|
||||
AM_PATH_LIBGNUTLS( 1.0.0, found_gnutls=yes, AC_MSG_WARN([[
|
||||
@@ -238,13 +308,38 @@ if test "x$enable_gnutls" = "xyes" ; then
|
||||
*** ftp://ftp.gnutls.org/pub/gnutls/
|
||||
*** WeeChat will be built without GnuTLS support.]]))
|
||||
if test "x$found_gnutls" = "xyes" ; then
|
||||
GNUTLS_LIBS="-lgnutls"
|
||||
AC_SUBST(GNUTLS_LIBS)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
GNUTLS_CFLAGS=`libgnutls-config --cflags`
|
||||
GNUTLS_LFLAGS=`libgnutls-config --libs`
|
||||
AC_SUBST(GNUTLS_CFLAGS)
|
||||
AC_SUBST(GNUTLS_LFLAGS)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
else
|
||||
enable_gnutls="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# general vars
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$prefix" = "xNONE" ; then
|
||||
prefix="$ac_default_prefix"
|
||||
fi
|
||||
|
||||
if test "x$exec_prefix" = "xNONE" ; then
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
|
||||
|
||||
WEECHAT_LIBDIR=`eval echo ${libdir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_LIBDIR, "$WEECHAT_LIBDIR")
|
||||
|
||||
WEECHAT_SHAREDIR=`eval echo ${datadir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_SHAREDIR, "$WEECHAT_SHAREDIR")
|
||||
|
||||
weechat_libdir=${libdir}/weechat
|
||||
AC_SUBST(weechat_libdir)
|
||||
|
||||
CFLAGS=`echo $CFLAGS | sed s/-g//g`
|
||||
if test "x$CFLAGS" = "x" ; then
|
||||
@@ -260,9 +355,27 @@ if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
dnl For FreeBSD
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
|
||||
case "$host_os" in
|
||||
freebsd* | netbsd*)
|
||||
if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
;;
|
||||
openbsd*)
|
||||
if test "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# output Makefiles
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
doc/Makefile
|
||||
@@ -270,8 +383,10 @@ AC_OUTPUT([Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/plugins/python/Makefile
|
||||
src/plugins/scripts/Makefile
|
||||
src/plugins/scripts/perl/Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/wxwidgets/Makefile
|
||||
@@ -280,8 +395,9 @@ AC_OUTPUT([Makefile
|
||||
intl/Makefile
|
||||
po/Makefile.in])
|
||||
|
||||
echo
|
||||
echo $PACKAGE $VERSION
|
||||
# ------------------------------------------------------------------------------
|
||||
# end message
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
listgui=
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
@@ -312,19 +428,17 @@ if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Interfaces.................... :$listgui
|
||||
echo
|
||||
echo Build with Plugin support..... : $enable_plugins
|
||||
echo Build with Perl support....... : $enable_perl
|
||||
echo Build with Python support..... : $enable_python
|
||||
echo Build with Ruby support....... : $enable_ruby
|
||||
echo Build with GNUtls support..... : $enable_gnutls
|
||||
echo
|
||||
echo Compile with debug info....... : $msg_debug_compiler
|
||||
echo Print debugging messages...... : $msg_debug_verbose
|
||||
echo
|
||||
eval eval echo WeeChat will be installed in $bindir.
|
||||
echo
|
||||
echo configure complete, now type \'make\' to build WeeChat
|
||||
echo
|
||||
echo ""
|
||||
echo "Interfaces.................................... :$listgui"
|
||||
echo "Build with GNUtls support..................... : $enable_gnutls"
|
||||
echo "Build with Plugin support..................... : $enable_plugins"
|
||||
echo " Perl plugin..................... : $enable_perl"
|
||||
echo " Python plugin................... : $enable_python"
|
||||
echo " Ruby plugin..................... : $enable_ruby"
|
||||
echo "Compile with debug info....................... : $msg_debug_compiler"
|
||||
echo "Print debugging messages...................... : $msg_debug_verbose"
|
||||
echo ""
|
||||
eval echo "WeeChat will be installed in $bindir."
|
||||
echo ""
|
||||
echo "configure complete, now type 'make' to build WeeChat $VERSION"
|
||||
echo ""
|
||||
|
||||
Vendored
+21
@@ -1,3 +1,24 @@
|
||||
weechat (0.1.5-1) unstable; urgency=low
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 24 Sep 2005 14:08:55 +0200
|
||||
|
||||
weechat (0.1.4-2) unstable; urgency=low
|
||||
|
||||
* Add autotools-dev to Build-Depends.
|
||||
* update autotools stuff automatically to always
|
||||
have up-to-date config.{guess,sub}
|
||||
* Update Build-Depends: libgnutls11-dev -> libgnutls-dev
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Mon, 1 Aug 2005 11:46:39 +0200
|
||||
|
||||
weechat (0.1.4-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 30 Jul 2005 16:26:55 +0200
|
||||
|
||||
weechat (0.1.3-2) unstable; urgency=low
|
||||
|
||||
* Update config.{guess,sub} to fix FTBFS on k*BSD (Closes: #316791)
|
||||
|
||||
Vendored
+23
-5
@@ -3,7 +3,7 @@ Section: net
|
||||
Priority: optional
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Uploaders: Julien Louis <ptitlouis@sysif.net>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls11-dev
|
||||
Build-Depends: debhelper (>> 4.0.0), libncursesw5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls-dev, libtool, texinfo
|
||||
Standards-Version: 3.6.2.1
|
||||
|
||||
Package: weechat
|
||||
@@ -12,7 +12,16 @@ Depends: weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Versio
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-curses
|
||||
Architecture: any
|
||||
@@ -20,12 +29,21 @@ Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
Recommends: weechat-curses | weechat-gtk
|
||||
Recommends: weechat-curses
|
||||
Description: Common files for WeeChat
|
||||
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||
extensible IRC client. It is useless without weechat-curses.
|
||||
|
||||
Vendored
+2
-1
@@ -15,7 +15,7 @@ configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl --enable-python
|
||||
--infodir=\$${prefix}/share/info --enable-perl --enable-python
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ binary-indep: build install
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installinfo -pweechat-common
|
||||
dh_installexamples -pweechat-common
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
|
||||
Vendored
+1
@@ -1 +1,2 @@
|
||||
debian/tmp/usr/bin/weechat-curses
|
||||
debian/tmp/usr/lib/weechat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "July 2005" "FlashCode"
|
||||
.TH WEECHAT 1 "November 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
@@ -19,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a, \-\-no\-connect
|
||||
.br
|
||||
disable auto-connect to servers at startup
|
||||
.TP
|
||||
.B \-c, \-\-config
|
||||
.br
|
||||
display config file help (list of options)
|
||||
@@ -43,6 +47,10 @@ display default keys
|
||||
.br
|
||||
display program license
|
||||
.TP
|
||||
.B \-p, \-\-no\-plugin
|
||||
.br
|
||||
don't load any plugin at startup
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
.br
|
||||
display WeeChat version
|
||||
|
||||
+1236
-249
File diff suppressed because it is too large
Load Diff
+1377
-394
File diff suppressed because it is too large
Load Diff
+1277
-253
File diff suppressed because it is too large
Load Diff
+1291
-300
File diff suppressed because it is too large
Load Diff
+8
-4
@@ -6,17 +6,19 @@
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/irc/irc-ignore.c
|
||||
./src/irc/irc.h
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/python/wee-python.c
|
||||
./src/plugins/python/wee-python.h
|
||||
./src/plugins/plugins.c
|
||||
./src/plugins/plugins.h
|
||||
./src/plugins/plugins-config.c
|
||||
./src/plugins/plugins-config.h
|
||||
./src/plugins/plugins-interface.c
|
||||
./src/plugins/weechat-plugin.h
|
||||
./src/gui/curses/gui-input.c
|
||||
./src/gui/curses/gui-display.c
|
||||
./src/gui/gtk/gui-display.c
|
||||
./src/gui/gtk/gui-input.c
|
||||
./src/gui/gui-action.c
|
||||
./src/gui/gui-common.c
|
||||
./src/gui/gui-keyboard.c
|
||||
./src/gui/gui.h
|
||||
@@ -32,6 +34,8 @@
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/utf8.c
|
||||
./src/common/utf8.h
|
||||
./src/common/weechat.c
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.c
|
||||
|
||||
+1615
-1217
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GNUTLS_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_main.a
|
||||
|
||||
@@ -36,4 +36,6 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
log.c \
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h
|
||||
fifo.h \
|
||||
utf8.c \
|
||||
utf8.h
|
||||
|
||||
+943
-590
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,8 @@ extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
@@ -69,14 +71,16 @@ 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 void weechat_cmd_ignore_display (char *, t_irc_ignore *);
|
||||
extern int weechat_cmd_ignore (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_plugin (int, char **);
|
||||
extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_unignore (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
+296
-86
@@ -30,10 +30,15 @@
|
||||
#include "weechat.h"
|
||||
#include "completion.h"
|
||||
#include "command.h"
|
||||
#include "utf8.h"
|
||||
#include "weelist.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* completion_init: init completion
|
||||
@@ -102,22 +107,27 @@ 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], *string;
|
||||
t_irc_nick *ptr_nick;
|
||||
char *pos, option_name[256], *string, *string2;
|
||||
t_weechat_alias *ptr_alias;
|
||||
t_config_option *option;
|
||||
void *option_value;
|
||||
char option_string[2048];
|
||||
#ifdef PLUGINS
|
||||
t_weechat_plugin *ptr_plugin;
|
||||
t_plugin_handler *ptr_handler;
|
||||
#endif
|
||||
|
||||
/* WeeChat internal commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (strcasecmp (completion->base_command, "save") == 0))
|
||||
if ((ascii_strcasecmp (completion->base_command, "server") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "save") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "alias") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "alias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_list = index_commands; ptr_list; ptr_list = ptr_list->next_weelist)
|
||||
@@ -128,7 +138,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "buffer") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "buffer") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -145,7 +155,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "clear") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -153,8 +163,8 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "disconnect") == 0))
|
||||
if ((ascii_strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "disconnect") == 0))
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
@@ -173,7 +183,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "debug") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "debug") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -183,7 +193,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "help") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
@@ -199,24 +209,133 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
}
|
||||
#ifdef PLUGINS
|
||||
for (ptr_plugin = weechat_plugins; ptr_plugin;
|
||||
ptr_plugin = ptr_plugin->next_plugin)
|
||||
{
|
||||
for (ptr_handler = ptr_plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if (ptr_handler->type == HANDLER_COMMAND)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_handler->command);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "key") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
if (ascii_strcasecmp (completion->base_command, "ignore") == 0)
|
||||
{
|
||||
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;
|
||||
/* arg 1: nicks of current channel and "*" */
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
if (channel)
|
||||
{
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
{
|
||||
for (ptr_nick = ((t_irc_channel *)channel)->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_nick->nick);
|
||||
}
|
||||
}
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg 2: type / command and "*" */
|
||||
if (completion->base_command_arg == 2)
|
||||
{
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
i = 0;
|
||||
while (ignore_types[i])
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ignore_types[i]);
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while (irc_commands[i].command_name)
|
||||
{
|
||||
if (irc_commands[i].recv_function)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
irc_commands[i].command_name);
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg 3: channel and "*" */
|
||||
if (completion->base_command_arg == 3)
|
||||
{
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
if (((t_irc_channel *)channel)->type == CHAT_CHANNEL)
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
((t_irc_channel *)channel)->name);
|
||||
return;
|
||||
}
|
||||
|
||||
/* arg 4: server */
|
||||
if (completion->base_command_arg == 4)
|
||||
{
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"*");
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
weelist_add(&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
SERVER(gui_current_window->buffer)->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "perl") == 0)
|
||||
|| (strcasecmp (completion->base_command, "python") == 0))
|
||||
if (ascii_strcasecmp (completion->base_command, "key") == 0)
|
||||
{
|
||||
if (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 (completion->base_command_arg == 2)
|
||||
{
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
gui_key_functions[i].function_name);
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((ascii_strcasecmp (completion->base_command, "plugin") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -233,14 +352,14 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"unload");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "set") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "set") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
@@ -306,7 +425,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
(option_value) ?
|
||||
gui_get_color_by_value (*((int *)(option_value))) :
|
||||
gui_get_color_name (*((int *)(option_value))) :
|
||||
option->default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
@@ -326,7 +445,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "unalias") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "unalias") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
for (ptr_alias = weechat_alias; ptr_alias; ptr_alias = ptr_alias->next_alias)
|
||||
@@ -337,7 +456,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "window") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "window") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
@@ -383,33 +502,33 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
/* IRC commands */
|
||||
|
||||
/* no completion for some commands */
|
||||
if ((strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (strcasecmp (completion->base_command, "who") == 0))
|
||||
if ((ascii_strcasecmp (completion->base_command, "admin") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "die") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "info") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "join") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "links") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "list") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "lusers") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "motd") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "oper") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "rehash") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "restart") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "service") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "servlist") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "squery") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "squit") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "stats") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "summon") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "time") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "trace") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "users") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "wallops") == 0)
|
||||
|| (ascii_strcasecmp (completion->base_command, "who") == 0))
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "away") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "away") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_away && cfg_irc_default_msg_away[0])
|
||||
@@ -418,7 +537,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
cfg_irc_default_msg_away);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "ctcp") == 0)
|
||||
&& (completion->base_command_arg == 2))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -432,7 +551,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"version");
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "dcc") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "dcc") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -446,7 +565,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"close");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "invite") == 0)
|
||||
{
|
||||
/* arg1: nickname */
|
||||
if (completion->base_command_arg == 1)
|
||||
@@ -472,30 +591,30 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kick") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "kick") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "kill") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "kill") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "me") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "me") == 0)
|
||||
{
|
||||
completion->context = COMPLETION_NICK;
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "notice") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "notice") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "part") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "part") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_part && cfg_irc_default_msg_part[0])
|
||||
@@ -504,13 +623,13 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
cfg_irc_default_msg_part);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "query") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "query") == 0)
|
||||
{
|
||||
if (completion->base_command_arg != 1)
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "quit") == 0)
|
||||
if ((ascii_strcasecmp (completion->base_command, "quit") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
if (cfg_irc_default_msg_quit && cfg_irc_default_msg_quit[0])
|
||||
@@ -519,7 +638,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
cfg_irc_default_msg_quit);
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "topic") == 0)
|
||||
if (ascii_strcasecmp (completion->base_command, "topic") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
@@ -528,14 +647,22 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
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);
|
||||
if (cfg_irc_colors_send)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)channel)->topic);
|
||||
else
|
||||
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)channel)->topic, 0);
|
||||
string2 = weechat_convert_encoding ((local_utf8) ?
|
||||
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
(string) ? string : ((t_irc_channel *)channel)->topic);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
string);
|
||||
free (string);
|
||||
(string2) ? string2 : ((t_irc_channel *)channel)->topic);
|
||||
if (string)
|
||||
free (string);
|
||||
if (string2)
|
||||
free (string2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -703,7 +830,7 @@ completion_command (t_completion *completion)
|
||||
other_completion = 0;
|
||||
for (ptr_weelist = index_commands; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
if (ascii_strncasecmp (ptr_weelist->data, completion->base_word + 1, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
@@ -711,7 +838,7 @@ completion_command (t_completion *completion)
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
if (ascii_strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word + 1, length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
@@ -725,7 +852,7 @@ completion_command (t_completion *completion)
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
(ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
@@ -735,12 +862,82 @@ completion_command (t_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_is_only_alphanum: return 1 if there is only alpha/num chars
|
||||
* in a string
|
||||
*/
|
||||
|
||||
int
|
||||
completion_is_only_alphanum (char *string)
|
||||
{
|
||||
while (string[0])
|
||||
{
|
||||
if (strchr (cfg_look_nick_completion_ignore, string[0]))
|
||||
return 0;
|
||||
string++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_strdup_alphanum: duplicate alpha/num chars in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
completion_strdup_alphanum (char *string)
|
||||
{
|
||||
char *result, *pos;
|
||||
|
||||
result = (char *)malloc (strlen (string) + 1);
|
||||
pos = result;
|
||||
while (string[0])
|
||||
{
|
||||
if (!strchr (cfg_look_nick_completion_ignore, string[0]))
|
||||
{
|
||||
pos[0] = string[0];
|
||||
pos++;
|
||||
}
|
||||
string++;
|
||||
}
|
||||
pos[0] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_nickncmp: locale and case independent string comparison
|
||||
* with max length for nicks (alpha or digits only)
|
||||
*/
|
||||
|
||||
int
|
||||
completion_nickncmp (char *base_word, char *nick, int max)
|
||||
{
|
||||
char *base_word2, *nick2;
|
||||
int return_cmp;
|
||||
|
||||
if (!cfg_look_nick_completion_ignore
|
||||
|| !cfg_look_nick_completion_ignore[0]
|
||||
|| !base_word || !nick || !base_word[0] || !nick[0]
|
||||
|| (!completion_is_only_alphanum (base_word)))
|
||||
return ascii_strncasecmp (base_word, nick, max);
|
||||
|
||||
base_word2 = completion_strdup_alphanum (base_word);
|
||||
nick2 = completion_strdup_alphanum (nick);
|
||||
|
||||
return_cmp = ascii_strncasecmp (base_word2, nick2, strlen (base_word2));
|
||||
|
||||
free (base_word2);
|
||||
free (nick2);
|
||||
|
||||
return return_cmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* completion_command_arg: complete a command argument
|
||||
*/
|
||||
|
||||
void
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
completion_command_arg (t_completion *completion, t_irc_channel *channel,
|
||||
int nick_completion)
|
||||
{
|
||||
int length, word_found_seen, other_completion;
|
||||
t_weelist *ptr_weelist, *ptr_weelist2;
|
||||
@@ -751,7 +948,8 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
for (ptr_weelist = completion->completion_list; ptr_weelist;
|
||||
ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist->data, completion->base_word, length) == 0)
|
||||
if ((nick_completion && (completion_nickncmp (completion->base_word, ptr_weelist->data, length) == 0))
|
||||
|| ((!nick_completion) && (ascii_strncasecmp (completion->base_word, ptr_weelist->data, length) == 0)))
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
@@ -759,8 +957,10 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
for (ptr_weelist2 = ptr_weelist->next_weelist; ptr_weelist2;
|
||||
ptr_weelist2 = ptr_weelist2->next_weelist)
|
||||
{
|
||||
if (strncasecmp (ptr_weelist2->data,
|
||||
completion->base_word, length) == 0)
|
||||
if ((nick_completion
|
||||
&& (completion_nickncmp (completion->base_word, ptr_weelist2->data, length) == 0))
|
||||
|| ((!nick_completion)
|
||||
&& (ascii_strncasecmp (completion->base_word, ptr_weelist2->data, length) == 0)))
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
@@ -773,13 +973,13 @@ completion_command_arg (t_completion *completion, t_irc_channel *channel)
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
(ascii_strcasecmp (ptr_weelist->data, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_command_arg (completion, channel);
|
||||
completion_command_arg (completion, channel, nick_completion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +998,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
|
||||
if (((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
{
|
||||
completion_command_arg (completion, channel);
|
||||
completion_command_arg (completion, channel, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -807,7 +1007,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
other_completion = 0;
|
||||
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick->nick, completion->base_word, length) == 0)
|
||||
if (completion_nickncmp (completion->base_word, ptr_nick->nick, length) == 0)
|
||||
{
|
||||
if ((!completion->word_found) || word_found_seen)
|
||||
{
|
||||
@@ -815,8 +1015,9 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
for (ptr_nick2 = ptr_nick->next_nick; ptr_nick2;
|
||||
ptr_nick2 = ptr_nick2->next_nick)
|
||||
{
|
||||
if (strncasecmp (ptr_nick2->nick,
|
||||
completion->base_word, length) == 0)
|
||||
if (completion_nickncmp (completion->base_word,
|
||||
ptr_nick2->nick,
|
||||
length) == 0)
|
||||
other_completion++;
|
||||
}
|
||||
if (other_completion == 0)
|
||||
@@ -829,7 +1030,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
other_completion++;
|
||||
}
|
||||
if (completion->word_found &&
|
||||
(strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
(ascii_strcasecmp (ptr_nick->nick, completion->word_found) == 0))
|
||||
word_found_seen = 1;
|
||||
}
|
||||
if (completion->word_found)
|
||||
@@ -874,7 +1075,7 @@ completion_search (t_completion *completion, void *channel,
|
||||
break;
|
||||
case COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list)
|
||||
completion_command_arg (completion, (t_irc_channel *)channel);
|
||||
completion_command_arg (completion, (t_irc_channel *)channel, 0);
|
||||
else
|
||||
completion_nick (completion, (t_irc_channel *)channel);
|
||||
break;
|
||||
@@ -882,14 +1083,23 @@ completion_search (t_completion *completion, void *channel,
|
||||
if (completion->word_found)
|
||||
{
|
||||
if (old_word_found)
|
||||
{
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (old_word_found);
|
||||
strlen (old_word_found);
|
||||
completion->diff_length = utf8_strlen (completion->word_found) -
|
||||
utf8_strlen (old_word_found);
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->diff_size = strlen (completion->word_found) -
|
||||
strlen (completion->base_word);
|
||||
strlen (completion->base_word);
|
||||
completion->diff_length = utf8_strlen (completion->word_found) -
|
||||
utf8_strlen (completion->base_word);
|
||||
if (completion->context == COMPLETION_COMMAND)
|
||||
{
|
||||
completion->diff_size++;
|
||||
completion->diff_length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ struct t_completion
|
||||
char *word_found; /* word found (to replace base word) */
|
||||
int position_replace; /* position where word has to be replaced */
|
||||
int diff_size; /* size difference (< 0 = char(s) deleted) */
|
||||
int diff_length; /* length difference (<= diff_size) */
|
||||
};
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
|
||||
+5
-4
@@ -120,7 +120,7 @@ fifo_exec (char *text)
|
||||
pos_msg = strstr (text, " *");
|
||||
if (!pos_msg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
@@ -142,7 +142,7 @@ fifo_exec (char *text)
|
||||
ptr_server = server_search (text);
|
||||
if (!ptr_server || !ptr_server->buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s server \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, text);
|
||||
return;
|
||||
@@ -154,8 +154,9 @@ fifo_exec (char *text)
|
||||
ptr_channel = channel_search (ptr_server, pos + 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s channel \"%s\" not found (FIFO pipe data)\n"),
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s channel \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, pos + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
+32
-32
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* history.c: memorize and call again commands or text */
|
||||
/* history.c: memorize commands or text */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -33,10 +33,10 @@
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_last = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
int num_history_general = 0;
|
||||
t_history *history_global = NULL;
|
||||
t_history *history_global_last = NULL;
|
||||
t_history *history_global_ptr = NULL;
|
||||
int num_history_global = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -74,7 +74,7 @@ history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to general history */
|
||||
/* add history to global history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
@@ -82,26 +82,26 @@ history_add (void *buffer, char *string)
|
||||
if (cfg_log_hide_nickserv_pwd)
|
||||
history_hide_password (new_history->text);
|
||||
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
if (history_global)
|
||||
history_global->prev_history = new_history;
|
||||
else
|
||||
history_general_last = new_history;
|
||||
new_history->next_history = history_general;
|
||||
history_global_last = new_history;
|
||||
new_history->next_history = history_global;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
num_history_general++;
|
||||
history_global = new_history;
|
||||
num_history_global++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_general > cfg_history_max_commands))
|
||||
&& (num_history_global > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_general_last->prev_history;
|
||||
history_general_last->prev_history->next_history = NULL;
|
||||
if (history_general_last->text)
|
||||
free (history_general_last->text);
|
||||
free (history_general_last);
|
||||
history_general_last = ptr_history;
|
||||
num_history_general--;
|
||||
ptr_history = history_global_last->prev_history;
|
||||
history_global_last->prev_history->next_history = NULL;
|
||||
if (history_global_last->text)
|
||||
free (history_global_last->text);
|
||||
free (history_global_last);
|
||||
history_global_last = ptr_history;
|
||||
num_history_global--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,26 +138,26 @@ history_add (void *buffer, char *string)
|
||||
}
|
||||
|
||||
/*
|
||||
* history_general_free: free general history
|
||||
* history_global_free: free global history
|
||||
*/
|
||||
|
||||
void
|
||||
history_general_free ()
|
||||
history_global_free ()
|
||||
{
|
||||
t_history *ptr_history;
|
||||
|
||||
while (history_general)
|
||||
while (history_global)
|
||||
{
|
||||
ptr_history = history_general->next_history;
|
||||
if (history_general->text)
|
||||
free (history_general->text);
|
||||
free (history_general);
|
||||
history_general = ptr_history;
|
||||
ptr_history = history_global->next_history;
|
||||
if (history_global->text)
|
||||
free (history_global->text);
|
||||
free (history_global);
|
||||
history_global = ptr_history;
|
||||
}
|
||||
history_general = NULL;
|
||||
history_general_last = NULL;
|
||||
history_general_ptr = NULL;
|
||||
num_history_general = 0;
|
||||
history_global = NULL;
|
||||
history_global_last = NULL;
|
||||
history_global_ptr = NULL;
|
||||
num_history_global = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,12 @@ struct t_history
|
||||
t_history *prev_history; /* link to previous text/command */
|
||||
};
|
||||
|
||||
extern t_history *history_global;
|
||||
extern t_history *history_global_last;
|
||||
extern t_history *history_global_ptr;
|
||||
|
||||
extern void history_add (void *, char *);
|
||||
extern void history_general_free ();
|
||||
extern void history_global_free ();
|
||||
extern void history_buffer_free (void *);
|
||||
|
||||
#endif /* history.h */
|
||||
|
||||
+28
-23
@@ -58,6 +58,27 @@ log_write_date (t_gui_buffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write_line: writes a line to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_line (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
char *msg_no_color;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
log_write_date (buffer);
|
||||
fprintf (buffer->log_file, "%s\n",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write: writes a message to log file
|
||||
*/
|
||||
@@ -65,32 +86,16 @@ log_write_date (t_gui_buffer *buffer)
|
||||
void
|
||||
log_write (t_gui_buffer *buffer, char *message)
|
||||
{
|
||||
if (buffer->log_file)
|
||||
{
|
||||
fprintf (buffer->log_file, "%s", message);
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_write_line: writes a WeeChat line to log file
|
||||
*/
|
||||
|
||||
void
|
||||
log_write_line (t_gui_buffer *buffer, t_gui_line *line)
|
||||
{
|
||||
t_gui_message *ptr_msg;
|
||||
char *msg_no_color;
|
||||
|
||||
if (buffer->log_file)
|
||||
{
|
||||
log_write_date (buffer);
|
||||
for (ptr_msg = line->messages; ptr_msg; ptr_msg = ptr_msg->next_message)
|
||||
{
|
||||
if (ptr_msg->type != MSG_TYPE_TIME)
|
||||
fprintf (buffer->log_file, "%s", ptr_msg->message);
|
||||
}
|
||||
fprintf (buffer->log_file, "\n");
|
||||
{
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
|
||||
fprintf (buffer->log_file, "%s",
|
||||
(msg_no_color) ? msg_no_color : message);
|
||||
fflush (buffer->log_file);
|
||||
if (msg_no_color)
|
||||
free (msg_no_color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,8 +25,8 @@
|
||||
#include "../gui/gui.h"
|
||||
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
extern void log_write_line (t_gui_buffer *, char *);
|
||||
extern void log_write (t_gui_buffer *, char *);
|
||||
extern void log_write_line (t_gui_buffer *, t_gui_line *);
|
||||
extern void log_start (t_gui_buffer *);
|
||||
extern void log_end (t_gui_buffer *);
|
||||
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* utf8.c: UTF-8 string functions for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "utf8.h"
|
||||
#include "weeconfig.h"
|
||||
|
||||
|
||||
int local_utf8 = 0;
|
||||
|
||||
|
||||
/*
|
||||
* utf8_init: initializes UTF-8 in WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
utf8_init ()
|
||||
{
|
||||
local_utf8 = 0;
|
||||
|
||||
if (cfg_look_charset_internal && cfg_look_charset_internal[0])
|
||||
{
|
||||
if (strstr (cfg_look_charset_internal, "UTF-8")
|
||||
|| strstr (cfg_look_charset_internal, "utf-8"))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
else if ((local_charset)
|
||||
&& ((strstr (local_charset, "UTF-8")
|
||||
|| strstr (local_charset, "utf-8"))))
|
||||
local_utf8 = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_is_valid: return 1 if UTF-8 string is valid, 0 otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
{
|
||||
while (string[0])
|
||||
{
|
||||
/* UTF-8, 2 bytes, should be: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes, should be: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
|
||||
{
|
||||
if (!string[1] || !string[2]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes, should be: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
|
||||
{
|
||||
if (!string[1] || !string[2] || !string[3]
|
||||
|| (((unsigned char)(string[1]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[2]) & 0xC0) != 0x80)
|
||||
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
|
||||
return 0;
|
||||
string += 4;
|
||||
}
|
||||
/* UTF-8, 1 byte, should be: 0vvvvvvv */
|
||||
else if ((unsigned char)(string[0]) >= 0x80)
|
||||
return 0;
|
||||
else
|
||||
string++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_prev_char: return previous UTF-8 char in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_prev_char (char *string_start, char *string)
|
||||
{
|
||||
if (!string || (string <= string_start))
|
||||
return NULL;
|
||||
|
||||
string--;
|
||||
|
||||
if (!local_utf8)
|
||||
return string;
|
||||
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 2 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, at least 3 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
|
||||
{
|
||||
/* UTF-8, 4 bytes */
|
||||
string--;
|
||||
if (string < string_start)
|
||||
return string + 1;
|
||||
return string;
|
||||
}
|
||||
else
|
||||
return string;
|
||||
}
|
||||
else
|
||||
return string;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_next_char: return next UTF-8 char in a string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_next_char (char *string)
|
||||
{
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + 1;
|
||||
|
||||
/* UTF-8, 2 bytes: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
return string + 2;
|
||||
}
|
||||
/* UTF-8, 3 bytes: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
if (!string[2])
|
||||
return string + 2;
|
||||
return string + 3;
|
||||
}
|
||||
/* UTF-8, 4 bytes: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
|
||||
{
|
||||
if (!string[1])
|
||||
return string + 1;
|
||||
if (!string[2])
|
||||
return string + 2;
|
||||
if (!string[3])
|
||||
return string + 3;
|
||||
return string + 4;
|
||||
}
|
||||
/* UTF-8, 1 byte: 0vvvvvvv */
|
||||
return string + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_char_size: return UTF-8 char size
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_char_size (char *string)
|
||||
{
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
return utf8_next_char (string) - string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_strlen: return length of an UTF-8 string (<= strlen(string))
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_strlen (char *string)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string[0])
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_strlen: return length of an UTF-8 string, for N bytes
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_strnlen (char *string, int bytes)
|
||||
{
|
||||
char *start;
|
||||
int length;
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
if (!local_utf8)
|
||||
{
|
||||
length = strlen (string);
|
||||
if (bytes > length)
|
||||
return length;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string[0] && (string - start < bytes))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_add_offset: moves forward N chars in an UTF-8 string
|
||||
*/
|
||||
|
||||
char *
|
||||
utf8_add_offset (char *string, int offset)
|
||||
{
|
||||
int count;
|
||||
|
||||
if (!string)
|
||||
return string;
|
||||
|
||||
if (!local_utf8)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string[0] && (count < offset))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_real_pos: get real position in UTF-8
|
||||
* for example: ("aébc", 2) returns 3
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_real_pos (char *string, int pos)
|
||||
{
|
||||
int count, real_pos;
|
||||
char *next_char;
|
||||
|
||||
if (!string || !local_utf8)
|
||||
return pos;
|
||||
|
||||
count = 0;
|
||||
real_pos = 0;
|
||||
while (string[0] && (count < pos))
|
||||
{
|
||||
next_char = utf8_next_char (string);
|
||||
real_pos += (next_char - string);
|
||||
string = next_char;
|
||||
count++;
|
||||
}
|
||||
return real_pos;
|
||||
}
|
||||
|
||||
/*
|
||||
* utf8_pos: get position in UTF-8
|
||||
* for example: ("aébc", 3) returns 2
|
||||
*/
|
||||
|
||||
int
|
||||
utf8_pos (char *string, int real_pos)
|
||||
{
|
||||
int count;
|
||||
char *limit;
|
||||
|
||||
if (!string || !local_charset)
|
||||
return real_pos;
|
||||
|
||||
count = 0;
|
||||
limit = string + real_pos;
|
||||
while (string[0] && (string < limit))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -18,17 +18,20 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PERL_H
|
||||
#define __WEECHAT_PERL_H 1
|
||||
#ifndef __WEECHAT_UTF8_H
|
||||
#define __WEECHAT_UTF8_H 1
|
||||
|
||||
#include "../plugins.h"
|
||||
extern int local_utf8;
|
||||
|
||||
extern void wee_perl_init ();
|
||||
extern t_plugin_script *wee_perl_search (char *);
|
||||
extern int wee_perl_exec (char *, char *, char *);
|
||||
extern int wee_perl_load (char *);
|
||||
extern void wee_perl_unload (t_plugin_script *);
|
||||
extern void wee_perl_unload_all ();
|
||||
extern void wee_perl_end ();
|
||||
extern void utf8_init ();
|
||||
extern int utf8_is_valid (char *);
|
||||
extern char *utf8_prev_char (char *, char *);
|
||||
extern char *utf8_next_char (char *);
|
||||
extern int utf8_char_size (char *);
|
||||
extern int utf8_strlen (char *);
|
||||
extern int utf8_strnlen (char *, int);
|
||||
extern char *utf8_add_offset (char *, int);
|
||||
extern int utf8_real_pos (char *, int);
|
||||
extern int utf8_pos (char *, int);
|
||||
|
||||
#endif /* wee-perl.h */
|
||||
#endif /* utf8.h */
|
||||
+151
-69
@@ -9,7 +9,7 @@
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
### ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
@@ -64,25 +64,104 @@
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "utf8.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#ifdef PLUGINS
|
||||
#include "../plugins/plugins.h"
|
||||
#endif
|
||||
|
||||
|
||||
time_t weechat_start_time; /* WeeChat start time (used by /uptime command) */
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
int sigsegv = 0; /* SIGSEGV received? */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1, UTF-8 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
int auto_connect; /* enabled by default, can by disabled on cmd line */
|
||||
int auto_load_plugins; /* enabled by default, can by disabled on cmd line */
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* ascii_strcasecmp: locale and case independent string comparison
|
||||
*/
|
||||
|
||||
int
|
||||
ascii_strcasecmp (char *string1, char *string2)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
if (!string1 || !string2)
|
||||
return (string1) ? 1 : ((string2) ? -1 : 0);
|
||||
|
||||
while (string1[0] && string2[0])
|
||||
{
|
||||
c1 = (int)((unsigned char) string1[0]);
|
||||
c2 = (int)((unsigned char) string2[0]);
|
||||
|
||||
if ((c1 >= 'A') && (c1 <= 'Z'))
|
||||
c1 += ('a' - 'A');
|
||||
|
||||
if ((c2 >= 'A') && (c2 <= 'Z'))
|
||||
c2 += ('a' - 'A');
|
||||
|
||||
if ((c1 - c2) != 0)
|
||||
return c1 - c2;
|
||||
|
||||
string1++;
|
||||
string2++;
|
||||
}
|
||||
|
||||
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ascii_strncasecmp: locale and case independent string comparison
|
||||
* with max length
|
||||
*/
|
||||
|
||||
int
|
||||
ascii_strncasecmp (char *string1, char *string2, int max)
|
||||
{
|
||||
int c1, c2, count;
|
||||
|
||||
if (!string1 || !string2)
|
||||
return (string1) ? 1 : ((string2) ? -1 : 0);
|
||||
|
||||
count = 0;
|
||||
while ((count < max) && string1[0] && string2[0])
|
||||
{
|
||||
c1 = (int)((unsigned char) string1[0]);
|
||||
c2 = (int)((unsigned char) string2[0]);
|
||||
|
||||
if ((c1 >= 'A') && (c1 <= 'Z'))
|
||||
c1 += ('a' - 'A');
|
||||
|
||||
if ((c2 >= 'A') && (c2 <= 'Z'))
|
||||
c2 += ('a' - 'A');
|
||||
|
||||
if ((c1 - c2) != 0)
|
||||
return c1 - c2;
|
||||
|
||||
string1++;
|
||||
string2++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count >= max)
|
||||
return 0;
|
||||
else
|
||||
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@@ -91,6 +170,7 @@ void
|
||||
wee_log_printf (char *message, ...)
|
||||
{
|
||||
static char buffer[4096];
|
||||
char *ptr_buffer;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
struct tm *date_tmp;
|
||||
@@ -102,6 +182,17 @@ wee_log_printf (char *message, ...)
|
||||
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
/* keep only valid chars */
|
||||
ptr_buffer = buffer;
|
||||
while (ptr_buffer[0])
|
||||
{
|
||||
if ((ptr_buffer[0] != '\n')
|
||||
&& (ptr_buffer[0] != '\r')
|
||||
&& ((unsigned char)(ptr_buffer[0]) < 32))
|
||||
ptr_buffer[0] = '.';
|
||||
ptr_buffer++;
|
||||
}
|
||||
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
@@ -131,7 +222,7 @@ weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
size_t inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
&& (ascii_strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
@@ -249,8 +340,9 @@ void wee_display_config_options ()
|
||||
weechat_options[i][j].default_string : _("empty"));
|
||||
break;
|
||||
}
|
||||
printf (_(" . description: %s\n\n"),
|
||||
gettext (weechat_options[i][j].long_description));
|
||||
printf (_(" . description: %s\n"),
|
||||
_(weechat_options[i][j].long_description));
|
||||
printf ("\n");
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -337,7 +429,8 @@ void wee_display_key_functions ()
|
||||
* wee_display_keys: display WeeChat default keys
|
||||
*/
|
||||
|
||||
void wee_display_keys ()
|
||||
void
|
||||
wee_display_keys ()
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name;
|
||||
@@ -366,10 +459,15 @@ wee_parse_args (int argc, char *argv[])
|
||||
t_irc_server server_tmp;
|
||||
|
||||
server_cmd_line = 0;
|
||||
auto_connect = 1;
|
||||
auto_load_plugins = 1;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if ((strcmp (argv[i], "-c") == 0)
|
||||
if ((strcmp (argv[i], "-a") == 0)
|
||||
|| (strcmp (argv[i], "--no-connect") == 0))
|
||||
auto_connect = 0;
|
||||
else if ((strcmp (argv[i], "-c") == 0)
|
||||
|| (strcmp (argv[i], "--config") == 0))
|
||||
{
|
||||
wee_display_config_options ();
|
||||
@@ -406,6 +504,9 @@ wee_parse_args (int argc, char *argv[])
|
||||
printf ("\n%s%s", WEE_LICENSE);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-p") == 0)
|
||||
|| (strcmp (argv[i], "--no-plugin") == 0))
|
||||
auto_load_plugins = 0;
|
||||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
@@ -418,7 +519,7 @@ wee_parse_args (int argc, char *argv[])
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc", 3) == 0))
|
||||
else if ((ascii_strncasecmp (argv[i], "irc", 3) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
{
|
||||
@@ -517,45 +618,6 @@ wee_create_home_dirs ()
|
||||
dir_length = strlen (weechat_home) + 64;
|
||||
dir_name = (char *) malloc (dir_length * sizeof (char));
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
/* create "~/.weechat/perl" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"perl");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/perl/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "perl", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
/* create "~/.weechat/python" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"python");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/python/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "python", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_RUBY
|
||||
/* create "~/.weechat/ruby" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"ruby");
|
||||
if (wee_create_dir (dir_name))
|
||||
{
|
||||
/* create "~/.weechat/ruby/autoload" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s%s%s", weechat_home,
|
||||
DIR_SEPARATOR, "ruby", DIR_SEPARATOR, "autoload");
|
||||
wee_create_dir (dir_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* create "~/.weechat/logs" */
|
||||
snprintf (dir_name, dir_length, "%s%s%s", weechat_home, DIR_SEPARATOR,
|
||||
"logs");
|
||||
@@ -576,6 +638,9 @@ wee_create_home_dirs ()
|
||||
void
|
||||
wee_init_vars ()
|
||||
{
|
||||
/* start time, used by /uptime command */
|
||||
weechat_start_time = time (NULL);
|
||||
|
||||
/* init received messages queue */
|
||||
recv_msgq = NULL;
|
||||
msgq_last_msg = NULL;
|
||||
@@ -618,35 +683,42 @@ weechat_welcome_message ()
|
||||
{
|
||||
if (cfg_look_startup_logo)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
" ___ __ ______________ _____ \n"
|
||||
" __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
|
||||
gui_printf (NULL,
|
||||
"%s ___ __ ______________ _____ \n"
|
||||
"%s __ | / /___________ ____/__ /_______ __ /_\n"
|
||||
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
|
||||
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
|
||||
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
}
|
||||
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s\n", cfg_look_weechat_slogan);
|
||||
gui_printf (NULL, _("%sWelcome to %s%s%s, %s\n"),
|
||||
(cfg_look_startup_logo) ? " " : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
PACKAGE_NAME,
|
||||
GUI_NO_COLOR,
|
||||
cfg_look_weechat_slogan);
|
||||
}
|
||||
if (cfg_look_startup_version)
|
||||
{
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
|
||||
"%s" PACKAGE_STRING,
|
||||
(cfg_look_startup_logo) ? " " : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
", %s %s %s\n",
|
||||
_("compiled on"), __DATE__, __TIME__);
|
||||
gui_printf (NULL, "%s%s%s%s, %s %s %s\n",
|
||||
(cfg_look_startup_logo) ? " " : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
PACKAGE_STRING,
|
||||
GUI_NO_COLOR,
|
||||
_("compiled on"), __DATE__, __TIME__);
|
||||
}
|
||||
if (cfg_look_startup_logo ||
|
||||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
|
||||
cfg_look_startup_version)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
|
||||
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
|
||||
gui_printf (NULL,
|
||||
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK));
|
||||
|
||||
wee_log_printf ("%s (%s %s %s)\n",
|
||||
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
|
||||
@@ -772,6 +844,9 @@ wee_dump (int crash)
|
||||
wee_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
ignore_print_log ();
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
@@ -814,6 +889,8 @@ main (int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */
|
||||
signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal */
|
||||
signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE 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 */
|
||||
@@ -838,16 +915,21 @@ main (int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
utf8_init (); /* init UTF-8 in WeeChat */
|
||||
gui_init (); /* init WeeChat interface */
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
plugin_init (); /* init plugin interface(s) */
|
||||
#ifdef PLUGINS
|
||||
plugin_init (auto_load_plugins);/* init plugin interface(s) */
|
||||
#endif
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
server_auto_connect (auto_connect, server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
#ifdef PLUGINS
|
||||
plugin_end (); /* end plugin interface(s) */
|
||||
#endif
|
||||
server_disconnect_all (); /* disconnect from all servers */
|
||||
(void) config_write (NULL); /* save config file */
|
||||
command_index_free (); /* free commands index */
|
||||
|
||||
@@ -89,12 +89,14 @@
|
||||
" or: %s [irc[6][s]://[nickname[:password]@]irc.example.org[:port][/channel][,channel[...]]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -a, --no-connect disable auto-connect to servers at startup\n" \
|
||||
" -c, --config display config file options\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" \
|
||||
" -p, --no-plugin don't load any plugin at startup\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
@@ -110,6 +112,7 @@
|
||||
|
||||
/* global variables and functions */
|
||||
|
||||
extern time_t weechat_start_time;
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
@@ -118,6 +121,8 @@ extern char *local_charset;
|
||||
extern gnutls_certificate_credentials gnutls_xcred;
|
||||
#endif
|
||||
|
||||
extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
|
||||
+404
-101
@@ -39,6 +39,8 @@
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "log.h"
|
||||
#include "utf8.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -53,8 +55,10 @@ t_config_section config_sections[CONFIG_NUMBER_SECTIONS] =
|
||||
{ CONFIG_SECTION_IRC, "irc" },
|
||||
{ CONFIG_SECTION_DCC, "dcc" },
|
||||
{ CONFIG_SECTION_PROXY, "proxy" },
|
||||
{ CONFIG_SECTION_PLUGINS, "plugins" },
|
||||
{ CONFIG_SECTION_KEYS, "keys" },
|
||||
{ CONFIG_SECTION_ALIAS, "alias" },
|
||||
{ CONFIG_SECTION_IGNORE, "ignore" },
|
||||
{ CONFIG_SECTION_SERVER, "server" }
|
||||
};
|
||||
|
||||
@@ -64,13 +68,15 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode;
|
||||
char *cfg_look_charset_decode_iso;
|
||||
char *cfg_look_charset_decode_utf;
|
||||
char *cfg_look_charset_encode;
|
||||
char *cfg_look_charset_internal;
|
||||
int cfg_look_one_server_buffer;
|
||||
char *cfg_look_buffer_timestamp;
|
||||
int cfg_look_color_nicks;
|
||||
int cfg_look_color_nicks_number;
|
||||
int cfg_look_color_actions;
|
||||
int cfg_look_remove_colors_from_msgs;
|
||||
int cfg_look_nicklist;
|
||||
int cfg_look_nicklist_position;
|
||||
char *cfg_look_nicklist_position_values[] =
|
||||
@@ -81,10 +87,16 @@ int cfg_look_nickmode;
|
||||
int cfg_look_nickmode_empty;
|
||||
char *cfg_look_no_nickname;
|
||||
char *cfg_look_completor;
|
||||
char *cfg_look_nick_completion_ignore;
|
||||
int cfg_look_infobar;
|
||||
char *cfg_look_infobar_timestamp;
|
||||
int cfg_look_infobar_seconds;
|
||||
int cfg_look_infobar_delay_highlight;
|
||||
int cfg_look_hotlist_names_count;
|
||||
int cfg_look_hotlist_names_level;
|
||||
int cfg_look_hotlist_names_length;
|
||||
int cfg_look_day_change;
|
||||
char *cfg_look_day_change_timestamp;
|
||||
|
||||
t_config_option weechat_options_look[] =
|
||||
{ { "look_set_title", N_("set title for window (terminal for Curses GUI) with name & version"),
|
||||
@@ -103,18 +115,28 @@ t_config_option weechat_options_look[] =
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
|
||||
{ "look_charset_decode", N_("charset for decoding messages from server"),
|
||||
N_("charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
{ "look_charset_decode_iso", N_("ISO charset for decoding messages from server (used only if locale is UTF-8)"),
|
||||
N_("ISO charset for decoding messages from server (used only if locale is UTF-8) "
|
||||
"(if empty, messages are not converted if locale is UTF-8"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode, config_change_buffer_content },
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_decode_iso, config_change_charset },
|
||||
{ "look_charset_decode_utf", N_("UTF charset for decoding messages from server (used only if locale is not UTF-8)"),
|
||||
N_("UTF charset for decoding messages from server (used only if locale is not UTF-8) "
|
||||
"(if empty, messages are not converted if locale is not UTF-8"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"UTF-8", NULL, NULL, &cfg_look_charset_decode_utf, config_change_charset },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content },
|
||||
{ "look_charset_internal", N_("internal WeeChat charset (should be ISO)"),
|
||||
N_("internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)"),
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_charset },
|
||||
{ "look_charset_internal", N_("forces internal WeeChat charset (should be empty in most cases)"),
|
||||
N_("forces internal WeeChat charset (should be empty in most cases, that means detected charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"ISO-8859-1", NULL, NULL, &cfg_look_charset_internal, config_change_buffer_content },
|
||||
"", NULL, NULL, &cfg_look_charset_internal, config_change_charset },
|
||||
{ "look_one_server_buffer", N_("use same buffer for all servers"),
|
||||
N_("use same buffer for all servers"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_look_one_server_buffer, NULL, config_change_one_server_buffer },
|
||||
{ "look_buffer_timestamp", N_("timestamp for buffers"),
|
||||
N_("timestamp for buffers"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -123,14 +145,14 @@ t_config_option weechat_options_look[] =
|
||||
N_("display nick names with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop },
|
||||
{ "look_color_nicks_number", N_("number of colors to use for nicks colors"),
|
||||
N_("number of colors to use for nicks colors"),
|
||||
OPTION_TYPE_INT, 1, 10, 10,
|
||||
NULL, NULL, &cfg_look_color_nicks_number, NULL, config_change_nicks_colors },
|
||||
{ "look_color_actions", N_("display actions with different colors"),
|
||||
N_("display actions with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop },
|
||||
{ "look_remove_colors_from_msgs", N_("remove colors from incoming messages"),
|
||||
N_("remove colors from incoming messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop },
|
||||
{ "look_nicklist", N_("display nicklist window"),
|
||||
N_("display nicklist window (for channel windows)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -141,12 +163,12 @@ t_config_option weechat_options_look[] =
|
||||
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_buffers },
|
||||
{ "look_nicklist_min_size", N_("min size for nicklist"),
|
||||
N_("min size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no min size))"),
|
||||
"(0 = no min size))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_max_size", N_("max size for nicklist"),
|
||||
N_("max size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers },
|
||||
{ "look_no_nickname", N_("text to display instead of nick when not connected"),
|
||||
@@ -165,6 +187,10 @@ t_config_option weechat_options_look[] =
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
":", NULL, NULL, &cfg_look_completor, config_change_noop },
|
||||
{ "look_nick_completion_ignore", N_("chars ignored for nick completion"),
|
||||
N_("chars ignored for nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"[]-", NULL, NULL, &cfg_look_nick_completion_ignore, config_change_noop },
|
||||
{ "look_infobar", N_("enable info bar"),
|
||||
N_("enable info bar"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
@@ -179,14 +205,36 @@ t_config_option weechat_options_look[] =
|
||||
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)"),
|
||||
"(0 = disable highlight notifications in infobar)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 7,
|
||||
NULL, NULL, &cfg_look_infobar_delay_highlight, NULL, config_change_noop },
|
||||
{ "look_hotlist_names_count", N_("max number of names in hotlist"),
|
||||
N_("max number of names in hotlist (0 = no name displayed, only buffer numbers)"),
|
||||
OPTION_TYPE_INT, 0, 32, 3,
|
||||
NULL, NULL, &cfg_look_hotlist_names_count, NULL, config_change_buffer_content },
|
||||
{ "look_hotlist_names_level", N_("level for displaying names in hotlist"),
|
||||
N_("level for displaying names in hotlist (combination of: 1=join/part, 2=message, "
|
||||
"4=private, 8=highlight, for example: 12=private+highlight)"),
|
||||
OPTION_TYPE_INT, 1, 15, 12,
|
||||
NULL, NULL, &cfg_look_hotlist_names_level, NULL, config_change_buffer_content },
|
||||
{ "look_hotlist_names_length", N_("max length of names in hotlist"),
|
||||
N_("max length of names in hotlist (0 = no limit)"),
|
||||
OPTION_TYPE_INT, 0, 32, 0,
|
||||
NULL, NULL, &cfg_look_hotlist_names_length, NULL, config_change_buffer_content },
|
||||
{ "look_day_change", N_("display special message when day changes"),
|
||||
N_("display special message when day changes"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_day_change, NULL, config_change_noop },
|
||||
{ "look_day_change_timestamp", N_("timestamp for date displayed when day changed"),
|
||||
N_("timestamp for date displayed when day changed"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%a, %d %b %Y", NULL, NULL, &cfg_look_day_change_timestamp, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* config, colors section */
|
||||
|
||||
int cfg_col_real_white;
|
||||
int cfg_col_title;
|
||||
int cfg_col_title_bg;
|
||||
int cfg_col_chat;
|
||||
@@ -194,6 +242,7 @@ 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_server;
|
||||
int cfg_col_chat_join;
|
||||
int cfg_col_chat_part;
|
||||
int cfg_col_chat_nick;
|
||||
@@ -204,6 +253,7 @@ int cfg_col_chat_highlight;
|
||||
int cfg_col_chat_bg;
|
||||
int cfg_col_status;
|
||||
int cfg_col_status_delimiters;
|
||||
int cfg_col_status_channel;
|
||||
int cfg_col_status_data_msg;
|
||||
int cfg_col_status_data_private;
|
||||
int cfg_col_status_data_highlight;
|
||||
@@ -217,6 +267,7 @@ int cfg_col_infobar_bg;
|
||||
int cfg_col_input;
|
||||
int cfg_col_input_channel;
|
||||
int cfg_col_input_nick;
|
||||
int cfg_col_input_delimiters;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
@@ -228,6 +279,7 @@ int cfg_col_nick_voice;
|
||||
int cfg_col_nick_more;
|
||||
int cfg_col_nick_sep;
|
||||
int cfg_col_nick_self;
|
||||
int cfg_col_nick_colors[COLOR_WIN_NICK_NUMBER];
|
||||
int cfg_col_nick_private;
|
||||
int cfg_col_nick_bg;
|
||||
int cfg_col_dcc_selected;
|
||||
@@ -239,7 +291,14 @@ int cfg_col_dcc_failed;
|
||||
int cfg_col_dcc_aborted;
|
||||
|
||||
t_config_option weechat_options_colors[] =
|
||||
{ /* title window */
|
||||
{ /* general color settings */
|
||||
{ "col_real_white", N_("if set, uses real white color"),
|
||||
N_("if set, uses real white color, disabled by default for terms with white "
|
||||
"background (if you never use white background, you should turn on "
|
||||
"this option to see real white instead of default term foreground color)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_col_real_white, NULL, config_change_color },
|
||||
/* title window */
|
||||
{ "col_title", N_("color for title bar"),
|
||||
N_("color for title bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -270,6 +329,10 @@ 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_server", N_("color for server name"),
|
||||
N_("color for server name"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"brown", NULL, &cfg_col_chat_server, 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,
|
||||
@@ -312,6 +375,10 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for status bar delimiters"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_status_delimiters, NULL, &config_change_color },
|
||||
{ "col_status_channel", N_("color for current channel in status bar"),
|
||||
N_("color for current channel in status bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_status_channel, NULL, &config_change_color },
|
||||
{ "col_status_data_msg", N_("color for window with new messages"),
|
||||
N_("color for window with new messages (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -367,7 +434,11 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_input_nick", N_("color for input text (nick name)"),
|
||||
N_("color for input text (nick name)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_input_nick, NULL, &config_change_color },
|
||||
"lightcyan", NULL, &cfg_col_input_nick, NULL, &config_change_color },
|
||||
{ "col_input_delimiters", N_("color for input text (delimiters)"),
|
||||
N_("color for input text (delimiters)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_input_delimiters, NULL, &config_change_color },
|
||||
{ "col_input_bg", N_("background for input window"),
|
||||
N_("background for input window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -414,6 +485,46 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for local nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_nick_self, NULL, &config_change_color },
|
||||
{ "col_nick_color1", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_nick_colors[0], NULL, &config_change_color },
|
||||
{ "col_nick_color2", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"magenta", NULL, &cfg_col_nick_colors[1], NULL, &config_change_color },
|
||||
{ "col_nick_color3", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"green", NULL, &cfg_col_nick_colors[2], NULL, &config_change_color },
|
||||
{ "col_nick_color4", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"brown", NULL, &cfg_col_nick_colors[3], NULL, &config_change_color },
|
||||
{ "col_nick_color5", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightblue", NULL, &cfg_col_nick_colors[4], NULL, &config_change_color },
|
||||
{ "col_nick_color6", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"default", NULL, &cfg_col_nick_colors[5], NULL, &config_change_color },
|
||||
{ "col_nick_color7", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightcyan", NULL, &cfg_col_nick_colors[6], NULL, &config_change_color },
|
||||
{ "col_nick_color8", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightmagenta", NULL, &cfg_col_nick_colors[7], NULL, &config_change_color },
|
||||
{ "col_nick_color9", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_nick_colors[8], NULL, &config_change_color },
|
||||
{ "col_nick_color10", N_("color for nick"),
|
||||
N_("color for nick"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"blue", NULL, &cfg_col_nick_colors[9], NULL, &config_change_color },
|
||||
{ "col_nick_private", N_("color for other nick in private window"),
|
||||
N_("color for other nick in private window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -466,11 +577,11 @@ t_config_option weechat_options_history[] =
|
||||
N_("maximum number of lines in history "
|
||||
"for one server/channel/private window (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 4096,
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_history_max_lines, NULL, &config_change_noop },
|
||||
{ "history_max_commands", N_("max user commands in history"),
|
||||
N_("maximum number of user commands in history (0 = unlimited)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 100,
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_history_max_commands, NULL, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -488,31 +599,31 @@ t_config_option weechat_options_log[] =
|
||||
{ { "log_auto_server", N_("automatically log server messages"),
|
||||
N_("automatically log server messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_server, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_auto_server, NULL, &config_change_log },
|
||||
{ "log_auto_channel", N_("automatically log channel chats"),
|
||||
N_("automatically log channel chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_channel, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_auto_channel, NULL, &config_change_log },
|
||||
{ "log_auto_private", N_("automatically log private chats"),
|
||||
N_("automatically log private chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, &config_change_log },
|
||||
{ "log_plugin_msg", N_("log messages from plugins (scripts)"),
|
||||
N_("log messages from plugins (scripts)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_plugin_msg, NULL, NULL },
|
||||
NULL, NULL, &cfg_log_plugin_msg, NULL, &config_change_noop },
|
||||
{ "log_path", N_("path for log files"),
|
||||
N_("path for WeeChat log files"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, config_change_noop },
|
||||
"~/.weechat/logs/", NULL, NULL, &cfg_log_path, &config_change_noop },
|
||||
{ "log_timestamp", N_("timestamp for log"),
|
||||
N_("timestamp for log (see man strftime for date/time specifiers)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, config_change_noop },
|
||||
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, &config_change_noop },
|
||||
{ "log_hide_nickserv_pwd", N_("hide password displayed by nickserv"),
|
||||
N_("hide password displayed by nickserv"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -522,54 +633,72 @@ int cfg_irc_display_away;
|
||||
char *cfg_irc_default_msg_away;
|
||||
char *cfg_irc_default_msg_part;
|
||||
char *cfg_irc_default_msg_quit;
|
||||
int cfg_irc_notice_as_pv;
|
||||
int cfg_irc_away_check;
|
||||
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;
|
||||
int cfg_irc_colors_receive;
|
||||
int cfg_irc_colors_send;
|
||||
|
||||
t_config_option weechat_options_irc[] =
|
||||
{ { "irc_display_away", N_("display message to all channels when away"),
|
||||
N_("display message to all channels when (un)marking as away"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_irc_display_away, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_irc_display_away, NULL, &config_change_noop },
|
||||
{ "irc_default_msg_away", N_("default message when away"),
|
||||
N_("default message when away"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"away", NULL, NULL, &cfg_irc_default_msg_away, config_change_noop },
|
||||
"away", NULL, NULL, &cfg_irc_default_msg_away, &config_change_noop },
|
||||
{ "irc_default_msg_part", N_("default part message (leaving channel)"),
|
||||
N_("default part message (leaving channel)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_part, config_change_noop },
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_part, &config_change_noop },
|
||||
{ "irc_default_msg_quit", N_("default quit message"),
|
||||
N_("default quit message ('%v' will be replaced by WeeChat version in string)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, &config_change_noop },
|
||||
{ "irc_notice_as_pv", N_("display notices as private messages"),
|
||||
N_("display notices as private messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_irc_notice_as_pv, NULL, &config_change_noop },
|
||||
{ "irc_away_check", N_("interval between two checks for away"),
|
||||
N_("interval between two checks for away (in minutes, 0 = never check)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 0,
|
||||
NULL, NULL, &cfg_irc_away_check, NULL, config_change_away_check },
|
||||
NULL, NULL, &cfg_irc_away_check, NULL, &config_change_away_check },
|
||||
{ "irc_lag_check", N_("interval between two checks for lag"),
|
||||
N_("interval between two checks for lag (in seconds)"),
|
||||
OPTION_TYPE_INT, 30, INT_MAX, 60,
|
||||
NULL, NULL, &cfg_irc_lag_check, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_irc_lag_check, NULL, &config_change_noop },
|
||||
{ "irc_lag_min_show", N_("minimum lag to show"),
|
||||
N_("minimum lag to show (in seconds)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
NULL, NULL, &cfg_irc_lag_min_show, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_irc_lag_min_show, NULL, &config_change_noop },
|
||||
{ "irc_lag_disconnect", N_("disconnect after important lag"),
|
||||
N_("disconnect after important lag (in minutes, 0 = never disconnect)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 5,
|
||||
NULL, NULL, &cfg_irc_lag_disconnect, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_irc_lag_disconnect, NULL, &config_change_noop },
|
||||
{ "irc_fifo_pipe", N_("create a FIFO pipe for remote control"),
|
||||
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 },
|
||||
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)"),
|
||||
N_("comma separated list of words to highlight (case insensitive comparison, "
|
||||
"words may begin or end with \"*\" for partial match)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_irc_highlight, config_change_noop },
|
||||
"", NULL, NULL, &cfg_irc_highlight, &config_change_noop },
|
||||
{ "irc_colors_receive", N_("when off, colors codes are ignored in "
|
||||
"incoming messages"),
|
||||
N_("when off, colors codes are ignored in incoming messages"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_irc_colors_receive, NULL, config_change_noop },
|
||||
{ "irc_colors_send", N_("allow user to send colors"),
|
||||
N_("allow user to send colors with special codes (%B=bold, %Cxx,yy=color, "
|
||||
"%U=underline, %R=reverse)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -579,6 +708,8 @@ int cfg_dcc_auto_accept_files;
|
||||
int cfg_dcc_auto_accept_chats;
|
||||
int cfg_dcc_timeout;
|
||||
int cfg_dcc_blocksize;
|
||||
char *cfg_dcc_port_range;
|
||||
char *cfg_dcc_own_ip;
|
||||
char *cfg_dcc_download_path;
|
||||
char *cfg_dcc_upload_path;
|
||||
int cfg_dcc_convert_spaces;
|
||||
@@ -589,39 +720,50 @@ t_config_option weechat_options_dcc[] =
|
||||
{ { "dcc_auto_accept_files", N_("automatically accept dcc files"),
|
||||
N_("automatically accept incoming dcc files"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_dcc_auto_accept_files, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_auto_accept_files, NULL, &config_change_noop },
|
||||
{ "dcc_auto_accept_chats", N_("automatically accept dcc chats"),
|
||||
N_("automatically accept dcc chats (use carefully!)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_dcc_auto_accept_chats, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_auto_accept_chats, NULL, &config_change_noop },
|
||||
{ "dcc_timeout", N_("timeout for dcc request"),
|
||||
N_("timeout for dcc request (in seconds)"),
|
||||
OPTION_TYPE_INT, 1, INT_MAX, 300,
|
||||
NULL, NULL, &cfg_dcc_timeout, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_timeout, NULL, &config_change_noop },
|
||||
{ "dcc_blocksize", N_("block size for dcc packets"),
|
||||
N_("block size for dcc packets in bytes (default: 65536)"),
|
||||
OPTION_TYPE_INT, 1024, 102400, 65536,
|
||||
NULL, NULL, &cfg_dcc_blocksize, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_blocksize, NULL, &config_change_noop },
|
||||
{ "dcc_port_range", N_("allowed ports for outgoing dcc"),
|
||||
N_("restricts outgoing dcc to use only ports in the given range "
|
||||
"(useful for NAT) (syntax: a single port, ie. 5000 or a port "
|
||||
"range, ie. 5000-5015, empty value means any port)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0, "",
|
||||
NULL, NULL, &cfg_dcc_port_range, &config_change_noop },
|
||||
{ "dcc_own_ip", N_("IP address for outgoing dcc"),
|
||||
N_("IP or DNS address used for outgoing dcc "
|
||||
"(if empty, local interface IP is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0, "",
|
||||
NULL, NULL, &cfg_dcc_own_ip, &config_change_noop },
|
||||
{ "dcc_download_path", N_("path for incoming files with dcc"),
|
||||
N_("path for writing incoming files with dcc (default: user home)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~", NULL, NULL, &cfg_dcc_download_path, config_change_noop },
|
||||
"~", NULL, NULL, &cfg_dcc_download_path, &config_change_noop },
|
||||
{ "dcc_upload_path", N_("default path for sending files with dcc"),
|
||||
N_("path for reading files when sending thru dcc (when no path is specified)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0, "~",
|
||||
NULL, NULL, &cfg_dcc_upload_path, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_upload_path, &config_change_noop },
|
||||
{ "dcc_convert_spaces", N_("convert spaces to underscores when sending files"),
|
||||
N_("convert spaces to underscores when sending files"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_dcc_convert_spaces, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_convert_spaces, NULL, &config_change_noop },
|
||||
{ "dcc_auto_rename", N_("automatically rename dcc files if already exists"),
|
||||
N_("rename incoming files if already exists (add '.1', '.2', ...)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_dcc_auto_rename, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_auto_rename, NULL, &config_change_noop },
|
||||
{ "dcc_auto_resume", N_("automatically resume aborted transfers"),
|
||||
N_("automatically resume dcc transfer if connection with remote host is loosed"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_dcc_auto_resume, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_dcc_auto_resume, NULL, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -641,31 +783,61 @@ t_config_option weechat_options_proxy[] =
|
||||
{ { "proxy_use", N_("use proxy"),
|
||||
N_("use a proxy server to connect to irc server"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_proxy_use, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_proxy_use, NULL, &config_change_noop },
|
||||
{ "proxy_type", N_("proxy type"),
|
||||
N_("proxy type (http (default), socks4, socks5)"),
|
||||
OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
|
||||
"http", cfg_proxy_type_values, &cfg_proxy_type, NULL, config_change_noop },
|
||||
"http", cfg_proxy_type_values, &cfg_proxy_type, NULL, &config_change_noop },
|
||||
{ "proxy_ipv6", N_("use ipv6 proxy"),
|
||||
N_("connect to proxy in ipv6"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_proxy_ipv6, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_proxy_ipv6, NULL, &config_change_noop },
|
||||
{ "proxy_address", N_("proxy address"),
|
||||
N_("proxy server address (IP or hostname)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_address, config_change_noop },
|
||||
"", NULL, NULL, &cfg_proxy_address, &config_change_noop },
|
||||
{ "proxy_port", N_("port for proxy"),
|
||||
N_("port for connecting to proxy server"),
|
||||
OPTION_TYPE_INT, 0, 65535, 3128,
|
||||
NULL, NULL, &cfg_proxy_port, NULL, config_change_noop },
|
||||
NULL, NULL, &cfg_proxy_port, NULL, &config_change_noop },
|
||||
{ "proxy_username", N_("proxy username"),
|
||||
N_("username for proxy server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_username, config_change_noop },
|
||||
"", NULL, NULL, &cfg_proxy_username, &config_change_noop },
|
||||
{ "proxy_password", N_("proxy password"),
|
||||
N_("password for proxy server"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_proxy_password, config_change_noop },
|
||||
"", NULL, NULL, &cfg_proxy_password, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
/* config, plugins section */
|
||||
|
||||
char *cfg_plugins_path;
|
||||
char *cfg_plugins_autoload;
|
||||
char *cfg_plugins_extension;
|
||||
|
||||
t_config_option weechat_options_plugins[] =
|
||||
{ { "plugins_path", N_("path for searching plugins"),
|
||||
N_("path for searching plugins"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"~/.weechat/plugins", NULL, NULL, &cfg_plugins_path, &config_change_noop },
|
||||
{ "plugins_autoload", N_("list of plugins to load automatically"),
|
||||
N_("comma separated list of plugins to load automatically at startup, "
|
||||
"\"*\" means all plugins found "
|
||||
"(names may be partial, for example \"perl\" is ok for \"libperl.so\")"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"*", NULL, NULL, &cfg_plugins_autoload, &config_change_noop },
|
||||
{ "plugins_extension", N_("standard plugins extension in filename"),
|
||||
N_("standard plugins extension in filename, used for autoload "
|
||||
"(if empty, then all files are loaded when autoload is \"*\")"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
#ifdef WIN32
|
||||
".dll",
|
||||
#else
|
||||
".so",
|
||||
#endif
|
||||
NULL, NULL, &cfg_plugins_extension, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -739,7 +911,7 @@ t_config_option weechat_options_server[] =
|
||||
OPTION_TYPE_INT, 0, 5, 0,
|
||||
NULL, NULL, &(cfg_server.command_delay), NULL, NULL },
|
||||
{ "server_autojoin", N_("list of channels to join when connected to server"),
|
||||
N_("comma separated list of channels to join when connected to server"),
|
||||
N_("comma separated list of channels to join when connected to server (example: \"#chan1,#chan2,#chan3 key1,key2\")"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.autojoin), NULL },
|
||||
{ "server_autorejoin", N_("automatically rejoin channels when kicked"),
|
||||
@@ -758,7 +930,8 @@ t_config_option weechat_options_server[] =
|
||||
t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
||||
{ weechat_options_look, weechat_options_colors, weechat_options_history,
|
||||
weechat_options_log, weechat_options_irc, weechat_options_dcc,
|
||||
weechat_options_proxy, NULL, NULL, weechat_options_server
|
||||
weechat_options_proxy, weechat_options_plugins, NULL, NULL, NULL,
|
||||
weechat_options_server
|
||||
};
|
||||
|
||||
|
||||
@@ -775,7 +948,7 @@ get_pos_array_values (char **array, char *string)
|
||||
i = 0;
|
||||
while (array[i])
|
||||
{
|
||||
if (strcasecmp (array[i], string) == 0)
|
||||
if (ascii_strcasecmp (array[i], string) == 0)
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
@@ -795,7 +968,7 @@ config_get_section (t_config_option *ptr_option)
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
@@ -851,6 +1024,31 @@ config_change_buffer_content ()
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_charset: called when charset changes
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_charset ()
|
||||
{
|
||||
utf8_init ();
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_one_server_buffer: called when the "one server buffer"
|
||||
* setting is changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_one_server_buffer ()
|
||||
{
|
||||
if (cfg_look_one_server_buffer)
|
||||
gui_merge_servers (gui_current_window);
|
||||
else
|
||||
gui_split_server (gui_current_window);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_color: called when a color is changed by /set command
|
||||
*/
|
||||
@@ -858,7 +1056,42 @@ config_change_buffer_content ()
|
||||
void
|
||||
config_change_color ()
|
||||
{
|
||||
gui_init_colors ();
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
gui_init_color_pairs ();
|
||||
gui_rebuild_weechat_colors ();
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
gui_redraw_buffer (ptr_win->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_nicks_colors: called when number of nicks color changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_nicks_colors ()
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
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)
|
||||
{
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (ptr_nick->color != COLOR_WIN_NICK_SELF)
|
||||
ptr_nick->color = nick_find_color (ptr_nick);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -912,6 +1145,42 @@ config_change_notify_levels ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_log: called when log settings are changed (for server/channel/private logging)
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_log ()
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(ptr_buffer))
|
||||
{
|
||||
if (cfg_log_auto_server && !ptr_buffer->log_file)
|
||||
log_start (ptr_buffer);
|
||||
else if (!cfg_log_auto_server && ptr_buffer->log_file)
|
||||
log_end (ptr_buffer);
|
||||
}
|
||||
if (BUFFER_IS_CHANNEL(ptr_buffer))
|
||||
{
|
||||
if (cfg_log_auto_channel && !ptr_buffer->log_file)
|
||||
log_start (ptr_buffer);
|
||||
else if (!cfg_log_auto_channel && ptr_buffer->log_file)
|
||||
log_end (ptr_buffer);
|
||||
}
|
||||
if (BUFFER_IS_PRIVATE(ptr_buffer))
|
||||
{
|
||||
if (cfg_log_auto_private && !ptr_buffer->log_file)
|
||||
log_start (ptr_buffer);
|
||||
else if (!cfg_log_auto_private && ptr_buffer->log_file)
|
||||
log_end (ptr_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_set_value: set new value for an option
|
||||
* return: 0 if success
|
||||
@@ -926,9 +1195,9 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
switch (option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (value, "on") == 0)
|
||||
if (ascii_strcasecmp (value, "on") == 0)
|
||||
*(option->ptr_int) = BOOL_TRUE;
|
||||
else if (strcasecmp (value, "off") == 0)
|
||||
else if (ascii_strcasecmp (value, "off") == 0)
|
||||
*(option->ptr_int) = BOOL_FALSE;
|
||||
else
|
||||
return -1;
|
||||
@@ -965,43 +1234,43 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
void *
|
||||
config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
{
|
||||
if (strcasecmp (option_name, "server_name") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_name") == 0)
|
||||
return (void *)(&server->name);
|
||||
if (strcasecmp (option_name, "server_autoconnect") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_autoconnect") == 0)
|
||||
return (void *)(&server->autoconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_autoreconnect") == 0)
|
||||
return (void *)(&server->autoreconnect);
|
||||
if (strcasecmp (option_name, "server_autoreconnect_delay") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_autoreconnect_delay") == 0)
|
||||
return (void *)(&server->autoreconnect_delay);
|
||||
if (strcasecmp (option_name, "server_address") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_address") == 0)
|
||||
return (void *)(&server->address);
|
||||
if (strcasecmp (option_name, "server_port") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_port") == 0)
|
||||
return (void *)(&server->port);
|
||||
if (strcasecmp (option_name, "server_ipv6") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_ipv6") == 0)
|
||||
return (void *)(&server->ipv6);
|
||||
if (strcasecmp (option_name, "server_ssl") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_ssl") == 0)
|
||||
return (void *)(&server->ssl);
|
||||
if (strcasecmp (option_name, "server_password") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_password") == 0)
|
||||
return (void *)(&server->password);
|
||||
if (strcasecmp (option_name, "server_nick1") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_nick1") == 0)
|
||||
return (void *)(&server->nick1);
|
||||
if (strcasecmp (option_name, "server_nick2") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_nick2") == 0)
|
||||
return (void *)(&server->nick2);
|
||||
if (strcasecmp (option_name, "server_nick3") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_nick3") == 0)
|
||||
return (void *)(&server->nick3);
|
||||
if (strcasecmp (option_name, "server_username") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_username") == 0)
|
||||
return (void *)(&server->username);
|
||||
if (strcasecmp (option_name, "server_realname") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_realname") == 0)
|
||||
return (void *)(&server->realname);
|
||||
if (strcasecmp (option_name, "server_command") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_command") == 0)
|
||||
return (void *)(&server->command);
|
||||
if (strcasecmp (option_name, "server_command_delay") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_command_delay") == 0)
|
||||
return (void *)(&server->command_delay);
|
||||
if (strcasecmp (option_name, "server_autojoin") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_autojoin") == 0)
|
||||
return (void *)(&server->autojoin);
|
||||
if (strcasecmp (option_name, "server_autorejoin") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_autorejoin") == 0)
|
||||
return (void *)(&server->autorejoin);
|
||||
if (strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
if (ascii_strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
return (void *)(&server->notify_levels);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
@@ -1031,7 +1300,7 @@ config_set_server_value (t_irc_server *server, char *option_name,
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
/* if option found, return pointer */
|
||||
if (strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0)
|
||||
if (ascii_strcasecmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, option_name) == 0)
|
||||
{
|
||||
ptr_option = &weechat_options[CONFIG_SECTION_SERVER][i];
|
||||
break;
|
||||
@@ -1043,9 +1312,9 @@ config_set_server_value (t_irc_server *server, char *option_name,
|
||||
switch (ptr_option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
if (strcasecmp (value, "on") == 0)
|
||||
if (ascii_strcasecmp (value, "on") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_TRUE;
|
||||
else if (strcasecmp (value, "off") == 0)
|
||||
else if (ascii_strcasecmp (value, "off") == 0)
|
||||
*((int *)(ptr_data)) = BOOL_FALSE;
|
||||
else
|
||||
return -2;
|
||||
@@ -1090,12 +1359,12 @@ config_option_search (char *option_name)
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
/* if option found, return pointer */
|
||||
if (strcasecmp (weechat_options[i][j].option_name, option_name) == 0)
|
||||
if (ascii_strcasecmp (weechat_options[i][j].option_name, option_name) == 0)
|
||||
return &weechat_options[i][j];
|
||||
}
|
||||
}
|
||||
@@ -1254,7 +1523,7 @@ config_default_values ()
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
@@ -1312,7 +1581,8 @@ config_read ()
|
||||
int server_found;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
@@ -1428,6 +1698,21 @@ config_read ()
|
||||
if (alias_new (line, pos))
|
||||
weelist_add (&index_commands, &last_index_command, line);
|
||||
}
|
||||
else if (section == CONFIG_SECTION_IGNORE)
|
||||
{
|
||||
/* create new ignore */
|
||||
if (ascii_strcasecmp (line, "ignore") != 0)
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid option \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, line);
|
||||
else
|
||||
{
|
||||
if (!ignore_add_from_config (pos))
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid ignore options \"%s\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number, pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
option_number = -1;
|
||||
@@ -1544,7 +1829,8 @@ config_create_default ()
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name, *function_name;
|
||||
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
@@ -1564,14 +1850,16 @@ config_create_default ()
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s#\n"),
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
@@ -1623,7 +1911,6 @@ config_create_default ()
|
||||
}
|
||||
|
||||
/* default aliases */
|
||||
/* TODO: remove comments when missing commands will be ok */
|
||||
fprintf (file, "\n[alias]\n");
|
||||
fprintf (file, "SAY=msg *\n");
|
||||
fprintf (file, "BYE=quit\n");
|
||||
@@ -1633,12 +1920,10 @@ config_create_default ()
|
||||
fprintf (file, "CL=clear\n");
|
||||
fprintf (file, "CLOSE=buffer close\n");
|
||||
fprintf (file, "CHAT=dcc chat\n");
|
||||
fprintf (file, "# GET=dcc get\n");
|
||||
fprintf (file, "# IG=ignore\n");
|
||||
fprintf (file, "IG=ignore\n");
|
||||
fprintf (file, "J=join\n");
|
||||
fprintf (file, "K=kick\n");
|
||||
fprintf (file, "KB=kickban\n");
|
||||
fprintf (file, "# KN=knockout\n");
|
||||
fprintf (file, "LEAVE=part\n");
|
||||
fprintf (file, "M=msg\n");
|
||||
fprintf (file, "MUB=unban *\n");
|
||||
@@ -1646,12 +1931,14 @@ config_create_default ()
|
||||
fprintf (file, "Q=query\n");
|
||||
fprintf (file, "T=topic\n");
|
||||
fprintf (file, "UB=unban\n");
|
||||
fprintf (file, "# UNIG=unignore\n");
|
||||
fprintf (file, "UNIG=unignore\n");
|
||||
fprintf (file, "W=who\n");
|
||||
fprintf (file, "WC=part\n");
|
||||
fprintf (file, "WI=whois\n");
|
||||
fprintf (file, "WW=whowas\n");
|
||||
|
||||
/* no ignore by default */
|
||||
|
||||
/* default server is freenode */
|
||||
fprintf (file, "\n[server]\n");
|
||||
fprintf (file, "server_name=freenode\n");
|
||||
@@ -1730,14 +2017,16 @@ config_write (char *config_name)
|
||||
time_t current_time;
|
||||
t_irc_server *ptr_server;
|
||||
t_weechat_alias *ptr_alias;
|
||||
t_irc_ignore *ptr_ignore;
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name, *function_name;
|
||||
|
||||
|
||||
if (config_name)
|
||||
filename = strdup (config_name);
|
||||
else
|
||||
{
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
@@ -1758,14 +2047,16 @@ config_write (char *config_name)
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s configuration file, created by "
|
||||
"%s v%s on %s#\n"),
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when exiting.\n#\n"));
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_SERVER))
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
@@ -1797,7 +2088,7 @@ config_write (char *config_name)
|
||||
fprintf (file, "%s=%s\n",
|
||||
weechat_options[i][j].option_name,
|
||||
(weechat_options[i][j].ptr_int) ?
|
||||
gui_get_color_by_value (*weechat_options[i][j].ptr_int) :
|
||||
gui_get_color_name (*weechat_options[i][j].ptr_int) :
|
||||
weechat_options[i][j].default_string);
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
@@ -1842,6 +2133,18 @@ config_write (char *config_name)
|
||||
ptr_alias->alias_name, ptr_alias->alias_command + 1);
|
||||
}
|
||||
|
||||
/* ignore section */
|
||||
fprintf (file, "\n[ignore]\n");
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
fprintf (file, "ignore=%s,%s,%s,%s\n",
|
||||
ptr_ignore->mask,
|
||||
ptr_ignore->type,
|
||||
ptr_ignore->channel_name,
|
||||
ptr_ignore->server_name);
|
||||
}
|
||||
|
||||
/* server section */
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
|
||||
+34
-6
@@ -33,10 +33,12 @@
|
||||
#define CONFIG_SECTION_IRC 4
|
||||
#define CONFIG_SECTION_DCC 5
|
||||
#define CONFIG_SECTION_PROXY 6
|
||||
#define CONFIG_SECTION_KEYS 7
|
||||
#define CONFIG_SECTION_ALIAS 8
|
||||
#define CONFIG_SECTION_SERVER 9
|
||||
#define CONFIG_NUMBER_SECTIONS 10
|
||||
#define CONFIG_SECTION_PLUGINS 7
|
||||
#define CONFIG_SECTION_KEYS 8
|
||||
#define CONFIG_SECTION_ALIAS 9
|
||||
#define CONFIG_SECTION_IGNORE 10
|
||||
#define CONFIG_SECTION_SERVER 11
|
||||
#define CONFIG_NUMBER_SECTIONS 12
|
||||
|
||||
#define OPTION_TYPE_BOOLEAN 1 /* values: on/off */
|
||||
#define OPTION_TYPE_INT 2 /* values: from min to max */
|
||||
@@ -81,13 +83,15 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_decode_iso;
|
||||
extern char *cfg_look_charset_decode_utf;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern char *cfg_look_charset_internal;
|
||||
extern int cfg_look_one_server_buffer;
|
||||
extern char *cfg_look_buffer_timestamp;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_nicks_number;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
extern int cfg_look_nicklist;
|
||||
extern int cfg_look_nicklist_position;
|
||||
extern int cfg_look_nicklist_min_size;
|
||||
@@ -96,11 +100,18 @@ extern int cfg_look_nickmode;
|
||||
extern int cfg_look_nickmode_empty;
|
||||
extern char *cfg_look_no_nickname;
|
||||
extern char *cfg_look_completor;
|
||||
extern char *cfg_look_nick_completion_ignore;
|
||||
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_look_hotlist_names_count;
|
||||
extern int cfg_look_hotlist_names_level;
|
||||
extern int cfg_look_hotlist_names_length;
|
||||
extern int cfg_look_day_change;
|
||||
extern char *cfg_look_day_change_timestamp;
|
||||
|
||||
extern int cfg_col_real_white;
|
||||
extern int cfg_col_title;
|
||||
extern int cfg_col_title_bg;
|
||||
extern int cfg_col_chat;
|
||||
@@ -108,6 +119,7 @@ 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_server;
|
||||
extern int cfg_col_chat_join;
|
||||
extern int cfg_col_chat_part;
|
||||
extern int cfg_col_chat_nick;
|
||||
@@ -118,6 +130,7 @@ extern int cfg_col_chat_highlight;
|
||||
extern int cfg_col_chat_bg;
|
||||
extern int cfg_col_status;
|
||||
extern int cfg_col_status_delimiters;
|
||||
extern int cfg_col_status_channel;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_private;
|
||||
extern int cfg_col_status_data_highlight;
|
||||
@@ -131,6 +144,7 @@ extern int cfg_col_infobar_bg;
|
||||
extern int cfg_col_input;
|
||||
extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_delimiters;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
@@ -142,6 +156,7 @@ extern int cfg_col_nick_voice;
|
||||
extern int cfg_col_nick_more;
|
||||
extern int cfg_col_nick_sep;
|
||||
extern int cfg_col_nick_self;
|
||||
extern int cfg_col_nick_colors[COLOR_WIN_NICK_NUMBER];
|
||||
extern int cfg_col_nick_private;
|
||||
extern int cfg_col_nick_bg;
|
||||
extern int cfg_col_dcc_selected;
|
||||
@@ -167,17 +182,22 @@ extern int cfg_irc_display_away;
|
||||
extern char *cfg_irc_default_msg_away;
|
||||
extern char *cfg_irc_default_msg_part;
|
||||
extern char *cfg_irc_default_msg_quit;
|
||||
extern int cfg_irc_notice_as_pv;
|
||||
extern int cfg_irc_away_check;
|
||||
extern int cfg_irc_lag_check;
|
||||
extern int cfg_irc_lag_min_show;
|
||||
extern int cfg_irc_lag_disconnect;
|
||||
extern int cfg_irc_fifo_pipe;
|
||||
extern char *cfg_irc_highlight;
|
||||
extern int cfg_irc_colors_receive;
|
||||
extern int cfg_irc_colors_send;
|
||||
|
||||
extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_port_range;
|
||||
extern char *cfg_dcc_own_ip;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_convert_spaces;
|
||||
@@ -193,6 +213,10 @@ extern int cfg_proxy_port;
|
||||
extern char *cfg_proxy_username;
|
||||
extern char *cfg_proxy_password;
|
||||
|
||||
extern char *cfg_plugins_path;
|
||||
extern char *cfg_plugins_autoload;
|
||||
extern char *cfg_plugins_extension;
|
||||
|
||||
extern t_config_section config_sections [CONFIG_NUMBER_SECTIONS];
|
||||
extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
|
||||
@@ -201,10 +225,14 @@ extern void config_change_noop ();
|
||||
extern void config_change_title ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_charset ();
|
||||
extern void config_change_one_server_buffer ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_nicks_colors ();
|
||||
extern void config_change_away_check ();
|
||||
extern void config_change_fifo_pipe ();
|
||||
extern void config_change_notify_levels ();
|
||||
extern void config_change_log ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern void config_option_search_option_value (char *, t_config_option **, void **);
|
||||
|
||||
@@ -42,7 +42,7 @@ weelist_search (t_weelist *weelist, char *data)
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) == 0)
|
||||
if (ascii_strcasecmp (data, ptr_weelist->data) == 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* word not found in list */
|
||||
@@ -60,7 +60,7 @@ weelist_find_pos (t_weelist *weelist, char *data)
|
||||
|
||||
for (ptr_weelist = weelist; ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
|
||||
{
|
||||
if (strcasecmp (data, ptr_weelist->data) < 0)
|
||||
if (ascii_strcasecmp (data, ptr_weelist->data) < 0)
|
||||
return ptr_weelist;
|
||||
}
|
||||
/* position not found, best position is at the end */
|
||||
@@ -140,6 +140,9 @@ weelist_remove (t_weelist **weelist, t_weelist **last_weelist, t_weelist *elemen
|
||||
{
|
||||
t_weelist *new_weelist;
|
||||
|
||||
if (!element)
|
||||
return;
|
||||
|
||||
/* remove element from list */
|
||||
if (*last_weelist == element)
|
||||
*last_weelist = element->prev_weelist;
|
||||
|
||||
@@ -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-action.c \
|
||||
gui-keyboard.c \
|
||||
gui.h
|
||||
|
||||
|
||||
@@ -19,12 +19,24 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = weechat-curses
|
||||
|
||||
if PLUGINS
|
||||
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
../../plugins/lib_weechat_plugins.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS) \
|
||||
$(GNUTLS_LIBS)
|
||||
$(GNUTLS_LFLAGS)
|
||||
else
|
||||
weechat_curses_LDADD = ../gui-common.o ../gui-keyboard.o \
|
||||
../gui-action.o \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(PLUGINS_LIBS) \
|
||||
$(NCURSES_LIBS) \
|
||||
$(GNUTLS_LFLAGS)
|
||||
endif
|
||||
|
||||
weechat_curses_SOURCES = gui-display.c \
|
||||
gui-input.c
|
||||
|
||||
+1632
-1016
File diff suppressed because it is too large
Load Diff
+87
-11
@@ -31,7 +31,12 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef HAVE_NCURSESW_CURSES_H
|
||||
#include <ncursesw/ncurses.h>
|
||||
#else
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "../../common/weechat.h"
|
||||
#include "../gui.h"
|
||||
@@ -39,6 +44,7 @@
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
|
||||
@@ -75,7 +81,9 @@ gui_input_default_key_bindings ()
|
||||
gui_key_bind ( /* left */ "meta2-D", "left");
|
||||
gui_key_bind ( /* right */ "meta2-C", "right");
|
||||
gui_key_bind ( /* up */ "meta2-A", "up");
|
||||
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_key_bind ( /* down */ "meta2-B", "down");
|
||||
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
@@ -97,6 +105,7 @@ gui_input_default_key_bindings ()
|
||||
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");
|
||||
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
@@ -141,7 +150,7 @@ gui_input_grab_end ()
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_input_insert_string (expanded_key, -1);
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (expanded_key);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
@@ -161,7 +170,7 @@ gui_input_grab_end ()
|
||||
void
|
||||
gui_input_read ()
|
||||
{
|
||||
int key, i;
|
||||
int key, i, insert_ok;
|
||||
char key_str[32];
|
||||
|
||||
i = 0;
|
||||
@@ -173,6 +182,7 @@ gui_input_read ()
|
||||
gui_input_grab_end ();
|
||||
|
||||
key = getch ();
|
||||
insert_ok = 1;
|
||||
|
||||
if (key == ERR)
|
||||
{
|
||||
@@ -183,12 +193,13 @@ gui_input_read ()
|
||||
|
||||
if (key == KEY_RESIZE)
|
||||
{
|
||||
gui_curses_resize_handler ();
|
||||
gui_refresh_screen ();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key < 32)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
@@ -201,11 +212,38 @@ gui_input_read ()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key > 0xff)
|
||||
if (local_utf8)
|
||||
{
|
||||
key_str[0] = (char) (key >> 8);
|
||||
key_str[1] = (char) (key & 0xff);
|
||||
key_str[2] = '\0';
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -222,8 +260,21 @@ gui_input_read ()
|
||||
|
||||
/*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);
|
||||
if ((gui_key_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
if (gui_current_window->buffer->dcc)
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
else
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (key_str);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -240,11 +291,18 @@ gui_main_loop ()
|
||||
static struct timeval timeout, tv;
|
||||
static struct timezone tz;
|
||||
t_irc_server *ptr_server;
|
||||
int old_min, old_sec, diff;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
int old_day, old_min, old_sec, diff;
|
||||
char text_time[1024];
|
||||
time_t new_time;
|
||||
struct tm *local_time;
|
||||
|
||||
quit_weechat = 0;
|
||||
|
||||
new_time = time (NULL);
|
||||
local_time = localtime (&new_time);
|
||||
old_day = local_time->tm_mday;
|
||||
|
||||
old_min = -1;
|
||||
old_sec = -1;
|
||||
check_away = 0;
|
||||
@@ -258,6 +316,24 @@ gui_main_loop ()
|
||||
{
|
||||
old_min = local_time->tm_min;
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
|
||||
if (cfg_look_day_change
|
||||
&& (local_time->tm_mday != old_day))
|
||||
{
|
||||
strftime (text_time, sizeof (text_time),
|
||||
cfg_look_day_change_timestamp, local_time);
|
||||
gui_add_hotlist = 0;
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer;
|
||||
ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (!ptr_buffer->dcc)
|
||||
gui_printf_nolog_notime (ptr_buffer,
|
||||
_("Day changed to %s\n"),
|
||||
text_time);
|
||||
}
|
||||
gui_add_hotlist = 1;
|
||||
}
|
||||
old_day = local_time->tm_mday;
|
||||
}
|
||||
|
||||
/* second has changed ? */
|
||||
@@ -333,7 +409,7 @@ gui_main_loop ()
|
||||
diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv);
|
||||
if (diff / 1000 > cfg_irc_lag_disconnect * 60)
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (ptr_server, ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s lag is high, disconnecting from server...\n"),
|
||||
WEECHAT_WARNING);
|
||||
|
||||
@@ -89,7 +89,7 @@ gui_assign_color (int *color, char *color_name)
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
{
|
||||
*color = gui_colors[i].color;
|
||||
return 1;
|
||||
@@ -114,7 +114,7 @@ gui_get_color_by_name (char *color_name)
|
||||
i = 0;
|
||||
while (gui_colors[i].name)
|
||||
{
|
||||
if (strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
if (ascii_strcasecmp (gui_colors[i].name, color_name) == 0)
|
||||
return gui_colors[i].color;
|
||||
i++;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+674
-1019
File diff suppressed because it is too large
Load Diff
+54
-48
@@ -41,73 +41,79 @@ int gui_key_grab = 0;
|
||||
int gui_key_grab_count = 0;
|
||||
|
||||
t_gui_key_function gui_key_functions[] =
|
||||
{ { "return", gui_input_return,
|
||||
{ { "return", gui_action_return,
|
||||
N_("terminate line") },
|
||||
{ "tab", gui_input_tab,
|
||||
{ "tab", gui_action_tab,
|
||||
N_("complete word") },
|
||||
{ "backspace", gui_input_backspace,
|
||||
{ "backspace", gui_action_backspace,
|
||||
N_("delete previous char") },
|
||||
{ "delete", gui_input_delete,
|
||||
{ "delete", gui_action_delete,
|
||||
N_("delete next char") },
|
||||
{ "delete_end_line", gui_input_delete_end_of_line,
|
||||
{ "delete_end_line", gui_action_delete_end_of_line,
|
||||
N_("delete until end of line") },
|
||||
{ "delete_beginning_line", gui_input_delete_begin_of_line,
|
||||
{ "delete_beginning_line", gui_action_delete_begin_of_line,
|
||||
N_("delete until beginning of line") },
|
||||
{ "delete_line", gui_input_delete_line,
|
||||
{ "delete_line", gui_action_delete_line,
|
||||
N_("delete entire line") },
|
||||
{ "delete_previous_word", gui_input_delete_previous_word,
|
||||
{ "delete_previous_word", gui_action_delete_previous_word,
|
||||
N_("delete previous word") },
|
||||
{ "delete_next_word", gui_input_delete_next_word,
|
||||
{ "delete_next_word", gui_action_delete_next_word,
|
||||
N_("delete next word") },
|
||||
{ "clipboard_paste", gui_input_clipboard_paste,
|
||||
{ "clipboard_paste", gui_action_clipboard_paste,
|
||||
N_("paste current clipboard content") },
|
||||
{ "transpose_chars", gui_input_transpose_chars,
|
||||
{ "transpose_chars", gui_action_transpose_chars,
|
||||
N_("transpose chars") },
|
||||
{ "home", gui_input_home,
|
||||
{ "home", gui_action_home,
|
||||
N_("go to beginning of line") },
|
||||
{ "end", gui_input_end,
|
||||
{ "end", gui_action_end,
|
||||
N_("go to end of line") },
|
||||
{ "left", gui_input_left,
|
||||
{ "left", gui_action_left,
|
||||
N_("move one char left") },
|
||||
{ "previous_word", gui_input_previous_word,
|
||||
{ "previous_word", gui_action_previous_word,
|
||||
N_("move to previous word") },
|
||||
{ "right", gui_input_right,
|
||||
{ "right", gui_action_right,
|
||||
N_("move one char right") },
|
||||
{ "next_word", gui_input_next_word,
|
||||
{ "next_word", gui_action_next_word,
|
||||
N_("move to next word") },
|
||||
{ "up", gui_input_up,
|
||||
{ "up", gui_action_up,
|
||||
N_("call previous command in history") },
|
||||
{ "down", gui_input_down,
|
||||
{ "up_global", gui_action_up_global,
|
||||
N_("call previous command in global history") },
|
||||
{ "down", gui_action_down,
|
||||
N_("call next command in history") },
|
||||
{ "page_up", gui_input_page_up,
|
||||
{ "down_global", gui_action_down_global,
|
||||
N_("call next command in global history") },
|
||||
{ "page_up", gui_action_page_up,
|
||||
N_("scroll one page up") },
|
||||
{ "page_down", gui_input_page_down,
|
||||
{ "page_down", gui_action_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,
|
||||
{ "nick_beginning", gui_action_nick_beginning,
|
||||
N_("display beginning of nicklist") },
|
||||
{ "nick_end", gui_input_nick_end,
|
||||
{ "nick_end", gui_action_nick_end,
|
||||
N_("display end of nicklist") },
|
||||
{ "refresh", gui_curses_resize_handler,
|
||||
N_("refresh screen") },
|
||||
{ "jump_smart", gui_input_jump_smart,
|
||||
{ "nick_page_up", gui_action_nick_page_up,
|
||||
N_("scroll nicklist one page up") },
|
||||
{ "nick_page_down", gui_action_nick_page_down,
|
||||
N_("scroll nicklist one page down") },
|
||||
{ "jump_smart", gui_action_jump_smart,
|
||||
N_("jump to buffer with activity") },
|
||||
{ "jump_dcc", gui_input_jump_dcc,
|
||||
{ "jump_dcc", gui_action_jump_dcc,
|
||||
N_("jump to DCC buffer") },
|
||||
{ "jump_last_buffer", gui_input_jump_last_buffer,
|
||||
{ "jump_last_buffer", gui_action_jump_last_buffer,
|
||||
N_("jump to last buffer") },
|
||||
{ "jump_server", gui_input_jump_server,
|
||||
{ "jump_server", gui_action_jump_server,
|
||||
N_("jump to server buffer") },
|
||||
{ "jump_next_server", gui_input_jump_next_server,
|
||||
{ "jump_next_server", gui_action_jump_next_server,
|
||||
N_("jump to next server") },
|
||||
{ "hotlist_clear", gui_input_hotlist_clear,
|
||||
{ "switch_server", gui_action_switch_server,
|
||||
N_("switch active server on servers buffer") },
|
||||
{ "hotlist_clear", gui_action_hotlist_clear,
|
||||
N_("clear hotlist") },
|
||||
{ "grab_key", gui_input_grab_key,
|
||||
{ "infobar_clear", gui_action_infobar_clear,
|
||||
N_("clear infobar") },
|
||||
{ "refresh", gui_action_refresh_screen,
|
||||
N_("refresh screen") },
|
||||
{ "grab_key", gui_action_grab_key,
|
||||
N_("grab a key") },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
@@ -153,17 +159,17 @@ gui_key_get_internal_code (char *key)
|
||||
result[0] = '\0';
|
||||
while (key[0])
|
||||
{
|
||||
if (strncasecmp (key, "meta2-", 6) == 0)
|
||||
if (ascii_strncasecmp (key, "meta2-", 6) == 0)
|
||||
{
|
||||
strcat (result, "^[[");
|
||||
key += 6;
|
||||
}
|
||||
if (strncasecmp (key, "meta-", 5) == 0)
|
||||
if (ascii_strncasecmp (key, "meta-", 5) == 0)
|
||||
{
|
||||
strcat (result, "^[");
|
||||
key += 5;
|
||||
}
|
||||
else if (strncasecmp (key, "ctrl-", 5) == 0)
|
||||
else if (ascii_strncasecmp (key, "ctrl-", 5) == 0)
|
||||
{
|
||||
strcat (result, "^");
|
||||
key += 5;
|
||||
@@ -196,12 +202,12 @@ gui_key_get_expanded_name (char *key)
|
||||
result[0] = '\0';
|
||||
while (key[0])
|
||||
{
|
||||
if (strncasecmp (key, "^[[", 3) == 0)
|
||||
if (ascii_strncasecmp (key, "^[[", 3) == 0)
|
||||
{
|
||||
strcat (result, "meta2-");
|
||||
key += 3;
|
||||
}
|
||||
if (strncasecmp (key, "^[", 2) == 0)
|
||||
if (ascii_strncasecmp (key, "^[", 2) == 0)
|
||||
{
|
||||
strcat (result, "meta-");
|
||||
key += 2;
|
||||
@@ -235,7 +241,7 @@ gui_key_find_pos (t_gui_key *key)
|
||||
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
if (strcasecmp (key->key, ptr_key->key) < 0)
|
||||
if (ascii_strcasecmp (key->key, ptr_key->key) < 0)
|
||||
return ptr_key;
|
||||
}
|
||||
return NULL;
|
||||
@@ -320,7 +326,7 @@ gui_key_search (char *key)
|
||||
|
||||
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
|
||||
{
|
||||
if (strcasecmp (ptr_key->key, key) == 0)
|
||||
if (ascii_strcasecmp (ptr_key->key, key) == 0)
|
||||
return ptr_key;
|
||||
}
|
||||
|
||||
@@ -377,7 +383,7 @@ gui_key_function_search_by_name (char *name)
|
||||
i = 0;
|
||||
while (gui_key_functions[i].function_name)
|
||||
{
|
||||
if (strcasecmp (gui_key_functions[i].function_name, name) == 0)
|
||||
if (ascii_strcasecmp (gui_key_functions[i].function_name, name) == 0)
|
||||
return gui_key_functions[i].function;
|
||||
i++;
|
||||
}
|
||||
@@ -500,7 +506,7 @@ gui_key_pressed (char *key_str)
|
||||
ptr_key = gui_key_search_part (gui_key_buffer);
|
||||
if (ptr_key)
|
||||
{
|
||||
if (strcasecmp (ptr_key->key, gui_key_buffer) == 0)
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0)
|
||||
{
|
||||
/* exact combo found => execute function or command */
|
||||
gui_key_buffer[0] = '\0';
|
||||
@@ -509,7 +515,7 @@ gui_key_pressed (char *key_str)
|
||||
gui_current_window->buffer,
|
||||
ptr_key->command);
|
||||
else
|
||||
(void)(ptr_key->function)();
|
||||
(void)(ptr_key->function)(gui_current_window);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+222
-135
@@ -26,62 +26,124 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#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_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 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
|
||||
/* shift ncurses colors for compatibility with colors
|
||||
in IRC messages (same as other IRC clients) */
|
||||
|
||||
#define WEECHAT_COLOR_BLACK COLOR_BLACK
|
||||
#define WEECHAT_COLOR_RED COLOR_BLUE
|
||||
#define WEECHAT_COLOR_GREEN COLOR_GREEN
|
||||
#define WEECHAT_COLOR_YELLOW COLOR_CYAN
|
||||
#define WEECHAT_COLOR_BLUE COLOR_RED
|
||||
#define WEECHAT_COLOR_MAGENTA COLOR_MAGENTA
|
||||
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
|
||||
#define WEECHAT_COLOR_WHITE COLOR_WHITE
|
||||
|
||||
#define COLOR_WIN_NICK_NUMBER 10
|
||||
|
||||
typedef enum t_weechat_color t_weechat_color;
|
||||
|
||||
enum t_weechat_color
|
||||
{
|
||||
COLOR_WIN_TITLE = 0,
|
||||
COLOR_WIN_CHAT,
|
||||
COLOR_WIN_CHAT_TIME,
|
||||
COLOR_WIN_CHAT_TIME_SEP,
|
||||
COLOR_WIN_CHAT_PREFIX1,
|
||||
COLOR_WIN_CHAT_PREFIX2,
|
||||
COLOR_WIN_CHAT_SERVER,
|
||||
COLOR_WIN_CHAT_JOIN,
|
||||
COLOR_WIN_CHAT_PART,
|
||||
COLOR_WIN_CHAT_NICK,
|
||||
COLOR_WIN_CHAT_HOST,
|
||||
COLOR_WIN_CHAT_CHANNEL,
|
||||
COLOR_WIN_CHAT_DARK,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
COLOR_WIN_STATUS,
|
||||
COLOR_WIN_STATUS_DELIMITERS,
|
||||
COLOR_WIN_STATUS_CHANNEL,
|
||||
COLOR_WIN_STATUS_DATA_MSG,
|
||||
COLOR_WIN_STATUS_DATA_PRIVATE,
|
||||
COLOR_WIN_STATUS_DATA_HIGHLIGHT,
|
||||
COLOR_WIN_STATUS_DATA_OTHER,
|
||||
COLOR_WIN_STATUS_MORE,
|
||||
COLOR_WIN_INFOBAR,
|
||||
COLOR_WIN_INFOBAR_DELIMITERS,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
COLOR_WIN_INPUT,
|
||||
COLOR_WIN_INPUT_CHANNEL,
|
||||
COLOR_WIN_INPUT_NICK,
|
||||
COLOR_WIN_INPUT_DELIMITERS,
|
||||
COLOR_WIN_NICK,
|
||||
COLOR_WIN_NICK_AWAY,
|
||||
COLOR_WIN_NICK_CHANOWNER,
|
||||
COLOR_WIN_NICK_CHANADMIN,
|
||||
COLOR_WIN_NICK_OP,
|
||||
COLOR_WIN_NICK_HALFOP,
|
||||
COLOR_WIN_NICK_VOICE,
|
||||
COLOR_WIN_NICK_MORE,
|
||||
COLOR_WIN_NICK_SEP,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
COLOR_WIN_NICK_1,
|
||||
COLOR_WIN_NICK_2,
|
||||
COLOR_WIN_NICK_3,
|
||||
COLOR_WIN_NICK_4,
|
||||
COLOR_WIN_NICK_5,
|
||||
COLOR_WIN_NICK_6,
|
||||
COLOR_WIN_NICK_7,
|
||||
COLOR_WIN_NICK_8,
|
||||
COLOR_WIN_NICK_9,
|
||||
COLOR_WIN_NICK_10,
|
||||
COLOR_DCC_SELECTED,
|
||||
COLOR_DCC_WAITING,
|
||||
COLOR_DCC_CONNECTING,
|
||||
COLOR_DCC_ACTIVE,
|
||||
COLOR_DCC_DONE,
|
||||
COLOR_DCC_FAILED,
|
||||
COLOR_DCC_ABORTED,
|
||||
NUM_COLORS
|
||||
};
|
||||
|
||||
/* attributes in IRC messages for color & style (bold, ..) */
|
||||
|
||||
#define GUI_ATTR_BOLD_CHAR '\x02'
|
||||
#define GUI_ATTR_BOLD_STR "\x02"
|
||||
#define GUI_ATTR_COLOR_CHAR '\x03'
|
||||
#define GUI_ATTR_COLOR_STR "\x03"
|
||||
#define GUI_ATTR_RESET_CHAR '\x0F'
|
||||
#define GUI_ATTR_RESET_STR "\x0F"
|
||||
#define GUI_ATTR_FIXED_CHAR '\x11'
|
||||
#define GUI_ATTR_FIXED_STR "\x11"
|
||||
#define GUI_ATTR_REVERSE_CHAR '\x12'
|
||||
#define GUI_ATTR_REVERSE_STR "\x12"
|
||||
#define GUI_ATTR_REVERSE2_CHAR '\x16'
|
||||
#define GUI_ATTR_REVERSE2_STR "\x16"
|
||||
#define GUI_ATTR_ITALIC_CHAR '\x1D'
|
||||
#define GUI_ATTR_ITALIC_STR "\x1D"
|
||||
#define GUI_ATTR_UNDERLINE_CHAR '\x1F'
|
||||
#define GUI_ATTR_UNDERLINE_STR "\x1F"
|
||||
|
||||
/* WeeChat internal attributes (should never be in IRC messages) */
|
||||
|
||||
#define GUI_ATTR_WEECHAT_COLOR_CHAR '\x19'
|
||||
#define GUI_ATTR_WEECHAT_COLOR_STR "\x19"
|
||||
#define GUI_ATTR_WEECHAT_SET_CHAR '\x1A'
|
||||
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
|
||||
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
|
||||
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
|
||||
|
||||
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
|
||||
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_SERVER(buffer) ((SERVER(buffer) || (buffer->all_servers)) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
|
||||
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_PREFIX 2
|
||||
#define MSG_TYPE_NICK 4
|
||||
@@ -90,17 +152,17 @@
|
||||
#define MSG_TYPE_HIGHLIGHT 32
|
||||
#define MSG_TYPE_NOLOG 64
|
||||
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, fmt, ##argz)
|
||||
|
||||
#define gui_printf_type(buffer, type, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, type, -1, fmt, ##argz)
|
||||
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
gui_printf_internal(buffer, 1, type, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
|
||||
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
|
||||
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, fmt, ##argz)
|
||||
|
||||
#define NOTIFY_LEVEL_MIN 0
|
||||
#define NOTIFY_LEVEL_MAX 3
|
||||
@@ -109,38 +171,14 @@
|
||||
#define KEY_SHOW_MODE_DISPLAY 1
|
||||
#define KEY_SHOW_MODE_BIND 2
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
struct t_gui_message
|
||||
{
|
||||
int type; /* type of message (time, nick, other) */
|
||||
int color; /* color of message */
|
||||
char *message; /* message content */
|
||||
t_gui_message *prev_message; /* link to previous message for line */
|
||||
t_gui_message *next_message; /* link to next message for line */
|
||||
};
|
||||
|
||||
typedef struct t_gui_line t_gui_line;
|
||||
|
||||
struct t_gui_line
|
||||
{
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int log_write; /* = 1 if line will be written to log */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
t_gui_message *messages; /* messages for the line */
|
||||
t_gui_message *last_message; /* last message of the line */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
t_gui_line *next_line; /* link to next line */
|
||||
};
|
||||
|
||||
typedef struct t_gui_color t_gui_color;
|
||||
|
||||
struct t_gui_color
|
||||
{
|
||||
char *name;
|
||||
int color;
|
||||
int foreground; /* foreground color */
|
||||
int background; /* background color */
|
||||
int attributes; /* attributes (bold, ..) */
|
||||
char *string; /* WeeChat color: "\x19??", ?? is #color*/
|
||||
};
|
||||
|
||||
typedef struct t_gui_infobar t_gui_infobar;
|
||||
@@ -155,6 +193,21 @@ struct t_gui_infobar
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_line t_gui_line;
|
||||
|
||||
struct t_gui_line
|
||||
{
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int log_write; /* = 1 if line will be written to log */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
char *data; /* line content */
|
||||
int ofs_after_date; /* offset to first char after date */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
t_gui_line *next_line; /* link to next line */
|
||||
};
|
||||
|
||||
typedef struct t_gui_buffer t_gui_buffer;
|
||||
|
||||
struct t_gui_buffer
|
||||
@@ -165,6 +218,7 @@ struct t_gui_buffer
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* buffer's server */
|
||||
int all_servers; /* =1 if all servers are displayed here */
|
||||
void *channel; /* buffer's channel */
|
||||
int dcc; /* buffer is dcc status */
|
||||
|
||||
@@ -188,7 +242,8 @@ struct t_gui_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) */
|
||||
int input_buffer_size; /* buffer size in bytes */
|
||||
int input_buffer_length; /* number of chars in buffer */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
@@ -249,6 +304,11 @@ struct t_gui_window
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
int current_style_fg;; /* current color used for foreground */
|
||||
int current_style_bg;; /* current color used for background */
|
||||
int current_style_attr; /* current attributes (bold, ..) */
|
||||
int current_color_attr; /* attr sum of last color(s) displayed */
|
||||
|
||||
/* DCC */
|
||||
void *dcc_first; /* first dcc displayed */
|
||||
void *dcc_selected; /* selected dcc */
|
||||
@@ -257,7 +317,8 @@ struct t_gui_window
|
||||
t_gui_buffer *buffer; /* buffer currently displayed in window */
|
||||
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
t_gui_line *start_line; /* pointer to line if scrolling */
|
||||
int start_line_pos; /* position in first line displayed */
|
||||
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
@@ -269,7 +330,8 @@ 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) */
|
||||
void (*function)(t_gui_window *);
|
||||
/* associated function (if cmd is NULL) */
|
||||
t_gui_key *prev_key; /* link to previous key */
|
||||
t_gui_key *next_key; /* link to next key */
|
||||
};
|
||||
@@ -303,6 +365,8 @@ extern int gui_key_grab;
|
||||
extern int gui_key_grab_count;
|
||||
extern char *gui_input_clipboard;
|
||||
|
||||
extern t_gui_color *gui_color[NUM_COLORS];
|
||||
|
||||
/* GUI independent functions: windows & buffers */
|
||||
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
@@ -314,47 +378,67 @@ extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_infobar_remove ();
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_message *gui_new_message (t_gui_buffer *);
|
||||
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 int gui_word_strlen (t_gui_window *, char *);
|
||||
extern int gui_word_real_pos (t_gui_window *, char *, int);
|
||||
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_exec_action_dcc (t_gui_window *, char *);
|
||||
extern int gui_insert_string_input (t_gui_window *, char *, int);
|
||||
extern void gui_merge_servers (t_gui_window *);
|
||||
extern void gui_split_server (t_gui_window *);
|
||||
extern void gui_window_switch_server (t_gui_window *);
|
||||
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_switch_to_window_by_buffer (t_gui_window *, int);
|
||||
extern void gui_switch_to_dcc_buffer (t_gui_window *);
|
||||
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 independent functions: actions */
|
||||
|
||||
extern void gui_action_clipboard_copy (char *, int);
|
||||
extern void gui_action_clipboard_paste (t_gui_window *);
|
||||
extern void gui_action_return (t_gui_window *);
|
||||
extern void gui_action_tab (t_gui_window *);
|
||||
extern void gui_action_backspace (t_gui_window *);
|
||||
extern void gui_action_delete (t_gui_window *);
|
||||
extern void gui_action_delete_previous_word (t_gui_window *);
|
||||
extern void gui_action_delete_next_word (t_gui_window *);
|
||||
extern void gui_action_delete_begin_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_end_of_line (t_gui_window *);
|
||||
extern void gui_action_delete_line (t_gui_window *);
|
||||
extern void gui_action_transpose_chars (t_gui_window *);
|
||||
extern void gui_action_home (t_gui_window *);
|
||||
extern void gui_action_end (t_gui_window *);
|
||||
extern void gui_action_left (t_gui_window *);
|
||||
extern void gui_action_previous_word (t_gui_window *);
|
||||
extern void gui_action_right (t_gui_window *);
|
||||
extern void gui_action_next_word (t_gui_window *);
|
||||
extern void gui_action_up (t_gui_window *);
|
||||
extern void gui_action_up_global (t_gui_window *);
|
||||
extern void gui_action_down (t_gui_window *);
|
||||
extern void gui_action_down_global (t_gui_window *);
|
||||
extern void gui_action_page_up (t_gui_window *);
|
||||
extern void gui_action_page_down (t_gui_window *);
|
||||
extern void gui_action_nick_beginning (t_gui_window *);
|
||||
extern void gui_action_nick_end (t_gui_window *);
|
||||
extern void gui_action_nick_page_up (t_gui_window *);
|
||||
extern void gui_action_nick_page_down (t_gui_window *);
|
||||
extern void gui_action_jump_smart (t_gui_window *);
|
||||
extern void gui_action_jump_dcc (t_gui_window *);
|
||||
extern void gui_action_jump_last_buffer (t_gui_window *);
|
||||
extern void gui_action_jump_server (t_gui_window *);
|
||||
extern void gui_action_jump_next_server (t_gui_window *);
|
||||
extern void gui_action_switch_server (t_gui_window *);
|
||||
extern void gui_action_hotlist_clear (t_gui_window *);
|
||||
extern void gui_action_infobar_clear (t_gui_window *);
|
||||
extern void gui_action_refresh_screen ();
|
||||
extern void gui_action_grab_key (t_gui_window *);
|
||||
|
||||
/* GUI independent functions: keys */
|
||||
|
||||
extern void gui_key_init ();
|
||||
@@ -372,11 +456,14 @@ 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 *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
extern char *gui_get_color_name (int);
|
||||
extern unsigned char *gui_color_decode (unsigned char *, int);
|
||||
extern unsigned char *gui_color_decode_for_user_entry (unsigned char *);
|
||||
extern unsigned char *gui_color_encode (unsigned char *);
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, 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);
|
||||
@@ -385,14 +472,13 @@ 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_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 t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
|
||||
extern void gui_window_page_up (t_gui_window *);
|
||||
extern void gui_window_page_down (t_gui_window *);
|
||||
extern void gui_window_nick_beginning (t_gui_window *);
|
||||
extern void gui_window_nick_end (t_gui_window *);
|
||||
extern void gui_window_nick_page_up (t_gui_window *);
|
||||
extern void gui_window_nick_page_down (t_gui_window *);
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
@@ -402,12 +488,13 @@ extern int gui_window_merge_left (t_gui_window *);
|
||||
extern int gui_window_merge_right (t_gui_window *);
|
||||
extern void gui_window_merge_auto (t_gui_window *);
|
||||
extern void gui_window_merge_all (t_gui_window *);
|
||||
extern void gui_refresh_screen ();
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_init_color_pairs ();
|
||||
extern void gui_rebuild_weechat_colors ();
|
||||
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 ();
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ bin_PROGRAMS = weechat-wxwidgets
|
||||
weechat_wxwidgets_LDADD = ../lib_weechat_gui_common.a \
|
||||
../../common/lib_weechat_main.a \
|
||||
../../irc/lib_weechat_irc.a \
|
||||
$(WXWIDGETS_LIBS) \
|
||||
../../plugins/lib_weechat_plugins.a $(PLUGINS_LIBS)
|
||||
|
||||
weechat_wxwidgets_SOURCES = gui-display.c \
|
||||
|
||||
+2
-1
@@ -15,7 +15,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GNUTLS_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_irc.a
|
||||
|
||||
@@ -27,4 +27,5 @@ lib_weechat_irc_a_SOURCES = irc.h \
|
||||
irc-channel.c \
|
||||
irc-nick.c \
|
||||
irc-dcc.c \
|
||||
irc-ignore.c \
|
||||
irc-display.c
|
||||
|
||||
@@ -143,11 +143,14 @@ t_irc_channel *
|
||||
channel_search (t_irc_server *server, char *channel_name)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
|
||||
if (!server || !channel_name)
|
||||
return NULL;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel_name) == 0)
|
||||
if (ascii_strcasecmp (ptr_channel->name, channel_name) == 0)
|
||||
return ptr_channel;
|
||||
}
|
||||
return NULL;
|
||||
@@ -162,6 +165,9 @@ string_is_channel (char *string)
|
||||
{
|
||||
char first_char[2];
|
||||
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
first_char[0] = string[0];
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
|
||||
+34
-16
@@ -35,6 +35,10 @@ t_irc_command irc_commands[] =
|
||||
N_("[target]"),
|
||||
N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_admin, NULL },
|
||||
{ "ame", N_("send a CTCP action to all channels of all connected servers"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_ame, NULL },
|
||||
{ "amsg", N_("send message to all channels of all connected servers"),
|
||||
N_("text"),
|
||||
N_("text: text to send"),
|
||||
@@ -126,7 +130,7 @@ t_irc_command irc_commands[] =
|
||||
N_("mask: servers matching the mask only\n"
|
||||
"target: server for forwarding request"),
|
||||
0, 2, 1, NULL, irc_cmd_send_lusers, NULL },
|
||||
{ "me", N_("send a ctcp action to the current channel"),
|
||||
{ "me", N_("send a CTCP action to the current channel"),
|
||||
N_("message"),
|
||||
N_("message: message to send"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
@@ -144,6 +148,7 @@ t_irc_command irc_commands[] =
|
||||
" m: moderated channel\n"
|
||||
" l: set the user limit to channel\n"
|
||||
" b: set a ban mask to keep users out\n"
|
||||
" e: set exception mask\n"
|
||||
" v: give/take the ability to speak on a moderated channel\n"
|
||||
" k: set a channel key (password)\n"
|
||||
"user modes:\n"
|
||||
@@ -299,8 +304,12 @@ t_irc_command irc_commands[] =
|
||||
{ "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 },
|
||||
{ "008", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "020", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "042", 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 },
|
||||
{ "221", N_("user mode string"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_221 },
|
||||
{ "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 },
|
||||
@@ -351,6 +360,10 @@ t_irc_command irc_commands[] =
|
||||
"", "",
|
||||
0, 0, 1, NULL, NULL, irc_cmd_recv_333 },
|
||||
{ "341", N_("inviting"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_341 },
|
||||
{ "344", N_("channel reop"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_344 },
|
||||
{ "345", N_("end of channel reop list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_345 },
|
||||
{ "348", N_("channel exception list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_348 },
|
||||
{ "349", N_("end of channel exception list"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_349 },
|
||||
{ "351", N_("server version"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_351 },
|
||||
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
|
||||
{ "353", N_("list of nicks on channel"),
|
||||
@@ -358,19 +371,21 @@ t_irc_command irc_commands[] =
|
||||
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 },
|
||||
{ "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 },
|
||||
{ "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 },
|
||||
{ "381", N_("you are now an IRC operator"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "382", N_("rehashing"), "", "", 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"),
|
||||
@@ -383,8 +398,6 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "406", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "406", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "407", N_("was no such nick"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "409", N_("no origin"),
|
||||
@@ -443,6 +456,8 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "467", N_("channel key already set"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "470", N_("forwarding to another channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "471", N_("channel is already full"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "472", N_("unknown mode char to me"),
|
||||
@@ -463,6 +478,8 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "483", N_("you can't kill a server!"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "484", N_("your connection is restricted!"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "485", N_("user is immune from kick/deop"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "491", N_("no O-lines for your host"),
|
||||
@@ -471,6 +488,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 },
|
||||
{ "505", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
|
||||
{ "671", N_("whois (secure connection)"),
|
||||
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_671 },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL }
|
||||
|
||||
+293
-146
@@ -34,6 +34,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
@@ -55,10 +57,10 @@ char *dcc_status_string[] = /* strings for DCC status */
|
||||
void
|
||||
dcc_redraw (int highlight)
|
||||
{
|
||||
gui_redraw_buffer (gui_get_dcc_buffer ());
|
||||
gui_redraw_buffer (gui_get_dcc_buffer (gui_current_window));
|
||||
if (highlight)
|
||||
{
|
||||
hotlist_add (highlight, gui_get_dcc_buffer ());
|
||||
hotlist_add (highlight, gui_get_dcc_buffer (gui_current_window));
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 0);
|
||||
}
|
||||
}
|
||||
@@ -85,6 +87,26 @@ dcc_search (t_irc_server *server, int type, int status, int port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_port_in_use: return 1 if a port is in used (by an active or connecting DCC)
|
||||
*/
|
||||
|
||||
int
|
||||
dcc_port_in_use (int port)
|
||||
{
|
||||
t_irc_dcc *ptr_dcc;
|
||||
|
||||
/* skip any currently used ports */
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if ((ptr_dcc->port == port) && (!DCC_ENDED(ptr_dcc->status)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* port not in use */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_file_is_resumable: check if a file can be used for resuming a download
|
||||
*/
|
||||
@@ -233,6 +255,8 @@ int
|
||||
dcc_connect (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
struct hostent *hostent;
|
||||
char *ip4;
|
||||
|
||||
if (ptr_dcc->type == DCC_CHAT_SEND)
|
||||
ptr_dcc->status = DCC_WAITING;
|
||||
@@ -245,12 +269,12 @@ dcc_connect (t_irc_dcc *ptr_dcc)
|
||||
if (ptr_dcc->sock == -1)
|
||||
return 0;
|
||||
}
|
||||
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
|
||||
return 0;
|
||||
|
||||
|
||||
/* for sending (chat or file), listen to socket for a connection */
|
||||
if (DCC_IS_SEND(ptr_dcc->type))
|
||||
{
|
||||
{
|
||||
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
|
||||
return 0;
|
||||
if (listen (ptr_dcc->sock, 1) == -1)
|
||||
return 0;
|
||||
if (fcntl (ptr_dcc->sock, F_SETFL, 0) == -1)
|
||||
@@ -260,11 +284,32 @@ dcc_connect (t_irc_dcc *ptr_dcc)
|
||||
/* for receiving (chat or file), connect to listening host */
|
||||
if (DCC_IS_RECV(ptr_dcc->type))
|
||||
{
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr.sin_port = htons (ptr_dcc->port);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
|
||||
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
|
||||
return 0;
|
||||
if (cfg_proxy_use)
|
||||
{
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
|
||||
ip4 = inet_ntoa(addr.sin_addr);
|
||||
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr.sin_port = htons (cfg_proxy_port);
|
||||
addr.sin_family = AF_INET;
|
||||
if ((hostent = gethostbyname (cfg_proxy_address)) == NULL)
|
||||
return 0;
|
||||
memcpy(&(addr.sin_addr),*(hostent->h_addr_list), sizeof(struct in_addr));
|
||||
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (pass_proxy(ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr.sin_port = htons (ptr_dcc->port);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
|
||||
connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -309,6 +354,7 @@ void
|
||||
dcc_close (t_irc_dcc *ptr_dcc, int status)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
struct stat st;
|
||||
|
||||
ptr_dcc->status = status;
|
||||
|
||||
@@ -316,31 +362,28 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
|
||||
{
|
||||
if (DCC_IS_FILE(ptr_dcc->type))
|
||||
{
|
||||
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);
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
PREFIX_INFO);
|
||||
gui_printf (ptr_dcc->server->buffer,
|
||||
_("DCC: file %s%s%s"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
ptr_dcc->filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
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, ")");
|
||||
}
|
||||
gui_printf (ptr_dcc->server->buffer,
|
||||
_(" (local filename: %s%s%s)"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
ptr_dcc->local_filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
if (ptr_dcc->type == DCC_FILE_SEND)
|
||||
gui_printf (ptr_dcc->server->buffer, _(" sent to "));
|
||||
else
|
||||
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,
|
||||
(status == DCC_DONE) ? _(": ok!\n") : _(": FAILED\n"));
|
||||
gui_printf (ptr_dcc->server->buffer, "%s%s%s: %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
ptr_dcc->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(status == DCC_DONE) ? _("OK") : _("FAILED"));
|
||||
}
|
||||
}
|
||||
if (status == DCC_ABORTED)
|
||||
@@ -351,16 +394,18 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
|
||||
ptr_buffer = ptr_dcc->channel->buffer;
|
||||
else
|
||||
ptr_buffer = ptr_dcc->server->buffer;
|
||||
irc_display_prefix (ptr_buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_buffer, _("DCC chat closed with "));
|
||||
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_NICK,
|
||||
"%s", ptr_dcc->nick);
|
||||
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, " (");
|
||||
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_HOST,
|
||||
"%d.%d.%d.%d",
|
||||
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
|
||||
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
|
||||
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, ")\n");
|
||||
irc_display_prefix (ptr_dcc->server, ptr_buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_buffer,
|
||||
_("DCC chat closed with %s%s %s(%s%d.%d.%d.%d%s)\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
ptr_dcc->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
ptr_dcc->addr >> 24,
|
||||
(ptr_dcc->addr >> 16) & 0xff,
|
||||
(ptr_dcc->addr >> 8) & 0xff,
|
||||
ptr_dcc->addr & 0xff,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +415,16 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
|
||||
&& DCC_IS_RECV(ptr_dcc->type)
|
||||
&& ptr_dcc->local_filename
|
||||
&& ptr_dcc->pos == 0)
|
||||
unlink (ptr_dcc->local_filename);
|
||||
{
|
||||
/* erase file only if really empty on disk */
|
||||
if (stat (ptr_dcc->local_filename, &st) != -1)
|
||||
{
|
||||
if ((unsigned long) st.st_size == 0)
|
||||
unlink (ptr_dcc->local_filename);
|
||||
}
|
||||
}
|
||||
|
||||
ptr_dcc->channel = NULL;
|
||||
|
||||
if (DCC_IS_CHAT(ptr_dcc->type))
|
||||
channel_remove_dcc (ptr_dcc);
|
||||
@@ -399,7 +453,8 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
if (!channel_create_dcc (ptr_dcc))
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
PREFIX_ERROR);
|
||||
gui_printf (ptr_dcc->server->buffer,
|
||||
_("%s can't associate DCC chat with private buffer "
|
||||
"(maybe private buffer has already DCC CHAT?)\n"),
|
||||
@@ -409,18 +464,20 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
|
||||
return;
|
||||
}
|
||||
|
||||
irc_display_prefix (ptr_dcc->channel->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->channel->buffer,
|
||||
PREFIX_INFO);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
|
||||
_("Connected to "));
|
||||
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_NICK,
|
||||
"%s", ptr_dcc->nick);
|
||||
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, " (");
|
||||
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_HOST,
|
||||
"%d.%d.%d.%d",
|
||||
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
|
||||
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
|
||||
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, ") ");
|
||||
gui_printf (ptr_dcc->channel->buffer, _("via DCC chat\n"));
|
||||
_("Connected to %s%s %s(%s%d.%d.%d.%d%s)%s via DCC chat\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
ptr_dcc->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
ptr_dcc->addr >> 24,
|
||||
(ptr_dcc->addr >> 16) & 0xff,
|
||||
(ptr_dcc->addr >> 8) & 0xff,
|
||||
ptr_dcc->addr & 0xff,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -507,13 +564,13 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port,
|
||||
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"),
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
PREFIX_INFO);
|
||||
gui_printf (ptr_dcc->server->buffer,
|
||||
_("DCC: file %s%s%s resumed at position %u\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
ptr_dcc->filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
ptr_dcc->start_resume);
|
||||
dcc_redraw (HOTLIST_MSG);
|
||||
}
|
||||
@@ -561,7 +618,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
/* create new DCC struct */
|
||||
if ((new_dcc = (t_irc_dcc *) malloc (sizeof (t_irc_dcc))) == NULL)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for new DCC\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -611,52 +668,71 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
/* write info message on server buffer */
|
||||
if (type == DCC_FILE_RECV)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Incoming DCC file from "));
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
|
||||
"%d.%d.%d.%d",
|
||||
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
|
||||
gui_printf (server->buffer, ": ");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
|
||||
gui_printf (server->buffer, ", ");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
|
||||
gui_printf (server->buffer, _(" bytes\n"));
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("Incoming DCC file from %s%s%s (%s%d.%d.%d.%d%s)%s: %s%s%s, %s%lu%s bytes\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
addr >> 24,
|
||||
(addr >> 16) & 0xff,
|
||||
(addr >> 8) & 0xff,
|
||||
addr & 0xff,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
size,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
dcc_redraw (HOTLIST_MSG);
|
||||
}
|
||||
if (type == DCC_FILE_SEND)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Sending DCC file to "));
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
|
||||
gui_printf (server->buffer, ": ");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
|
||||
gui_printf (server->buffer, _(" (local filename: "));
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", local_filename);
|
||||
gui_printf (server->buffer, "), ");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
|
||||
gui_printf (server->buffer, _(" bytes\n"));
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("Sending DCC file to %s%s%s: %s%s%s "
|
||||
"(local filename: %s%s%s), %s%lu%s bytes\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
local_filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
size,
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
dcc_redraw (HOTLIST_MSG);
|
||||
}
|
||||
if (type == DCC_CHAT_RECV)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Incoming DCC chat request from "));
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
|
||||
"%d.%d.%d.%d",
|
||||
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")\n");
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("Incoming DCC chat request from %s%s%s "
|
||||
"(%s%d.%d.%d.%d%s)\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
addr >> 24,
|
||||
(addr >> 16) & 0xff,
|
||||
(addr >> 8) & 0xff,
|
||||
addr & 0xff,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
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);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("Sending DCC chat request to %s%s\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
dcc_redraw (HOTLIST_MSG);
|
||||
}
|
||||
|
||||
@@ -669,19 +745,17 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
|
||||
|
||||
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"),
|
||||
irc_display_prefix (new_dcc->server, new_dcc->server->buffer,
|
||||
PREFIX_INFO);
|
||||
gui_printf (new_dcc->server->buffer,
|
||||
_("DCC: file %s%s%s (local filename: %s%s%s) "
|
||||
"will be resumed at position %u\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
new_dcc->filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
new_dcc->local_filename,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
new_dcc->start_resume);
|
||||
dcc_redraw (HOTLIST_MSG);
|
||||
}
|
||||
@@ -715,9 +789,11 @@ void
|
||||
dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
{
|
||||
char *ptr_home, *filename2, *short_filename, *pos;
|
||||
int spaces;
|
||||
int spaces, args, port_start, port_end;
|
||||
struct stat st;
|
||||
int sock, port;
|
||||
struct hostent *host;
|
||||
struct in_addr tmpaddr;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t length;
|
||||
unsigned long local_addr;
|
||||
@@ -745,7 +821,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
4);
|
||||
if (!filename2)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for DCC SEND\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -767,7 +843,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
/* check if file exists */
|
||||
if (stat (filename2, &st) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot access file \"%s\"\n"),
|
||||
WEECHAT_ERROR, filename2);
|
||||
@@ -778,17 +854,38 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
}
|
||||
|
||||
/* get local IP address */
|
||||
|
||||
/* look up the IP address from dcc_own_ip, if set */
|
||||
local_addr = 0;
|
||||
if (cfg_dcc_own_ip && cfg_dcc_own_ip[0])
|
||||
{
|
||||
host = gethostbyname (cfg_dcc_own_ip);
|
||||
if (host)
|
||||
{
|
||||
memcpy (&tmpaddr, host->h_addr_list[0], sizeof(struct in_addr));
|
||||
local_addr = ntohl (tmpaddr.s_addr);
|
||||
}
|
||||
else
|
||||
gui_printf (server->buffer,
|
||||
_("%s could not find address for '%s'. Falling back to local IP.\n"),
|
||||
WEECHAT_WARNING, cfg_dcc_own_ip);
|
||||
}
|
||||
|
||||
/* use the local interface, from the server socket */
|
||||
memset (&addr, 0, sizeof (struct sockaddr_in));
|
||||
length = sizeof (addr);
|
||||
getsockname (server->sock, (struct sockaddr *) &addr, &length);
|
||||
addr.sin_family = AF_INET;
|
||||
local_addr = ntohl (addr.sin_addr.s_addr);
|
||||
|
||||
/* fallback to the local IP address on the interface, if required */
|
||||
if (local_addr == 0)
|
||||
local_addr = ntohl (addr.sin_addr.s_addr);
|
||||
|
||||
/* open socket for DCC */
|
||||
sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create socket for DCC\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -797,22 +894,64 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
/* find port automatically */
|
||||
addr.sin_port = 0;
|
||||
if (bind (sock, (struct sockaddr *) &addr, sizeof (addr)) == -1)
|
||||
/* look for port */
|
||||
|
||||
port = 0;
|
||||
|
||||
if (cfg_dcc_port_range && cfg_dcc_port_range[0])
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
/* find a free port in the specified range */
|
||||
args = sscanf (cfg_dcc_port_range, "%d-%d", &port_start, &port_end);
|
||||
if (args > 0)
|
||||
{
|
||||
port = port_start;
|
||||
if (args == 1)
|
||||
port_end = port_start;
|
||||
|
||||
/* loop through the entire allowed port range */
|
||||
while (port <= port_end)
|
||||
{
|
||||
if (!dcc_port_in_use (port))
|
||||
{
|
||||
/* attempt to bind to the free port */
|
||||
addr.sin_port = htons (port);
|
||||
if (bind (sock, (struct sockaddr *) &addr, sizeof (addr)) == 0)
|
||||
break;
|
||||
}
|
||||
port++;
|
||||
}
|
||||
|
||||
if (port > port_end)
|
||||
port = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (port == 0)
|
||||
{
|
||||
/* find port automatically */
|
||||
addr.sin_port = 0;
|
||||
if (bind (sock, (struct sockaddr *) &addr, sizeof (addr)) == 0)
|
||||
{
|
||||
length = sizeof (addr);
|
||||
getsockname (sock, (struct sockaddr *) &addr, &length);
|
||||
port = ntohs (addr.sin_port);
|
||||
}
|
||||
else
|
||||
port = -1;
|
||||
}
|
||||
|
||||
if (port == -1)
|
||||
{
|
||||
/* Could not find any port to bind */
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot find port for DCC\n"),
|
||||
_("%s cannot find available port for DCC\n"),
|
||||
WEECHAT_ERROR);
|
||||
close (sock);
|
||||
if (filename2)
|
||||
free (filename2);
|
||||
return;
|
||||
}
|
||||
length = sizeof (addr);
|
||||
getsockname (sock, (struct sockaddr *) &addr, &length);
|
||||
port = ntohs (addr.sin_port);
|
||||
|
||||
if (type == DCC_FILE_SEND)
|
||||
{
|
||||
@@ -848,7 +987,7 @@ dcc_send_request (t_irc_server *server, int type, char *nick, char *filename)
|
||||
short_filename, filename2, st.st_size);
|
||||
if (!ptr_dcc)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot send DCC\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -928,8 +1067,10 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
buffer);
|
||||
if (dcc_chat_send (ptr_dcc, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_dcc->server->buffer, _("%s error sending data to \"%s\" via DCC CHAT\n"),
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
PREFIX_ERROR);
|
||||
gui_printf (ptr_dcc->server->buffer,
|
||||
_("%s error sending data to \"%s\" via DCC CHAT\n"),
|
||||
WEECHAT_ERROR, ptr_dcc->nick);
|
||||
dcc_close (ptr_dcc, DCC_FAILED);
|
||||
}
|
||||
@@ -945,6 +1086,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
char *ptr_buf_color;
|
||||
int num_read;
|
||||
|
||||
num_read = recv (ptr_dcc->sock, buffer, sizeof (buffer) - 2, 0);
|
||||
@@ -995,40 +1137,45 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
|
||||
if (ptr_buf)
|
||||
{
|
||||
gui_printf_type_color (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
|
||||
cfg_irc_colors_receive);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
"%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
|
||||
{
|
||||
gui_printf_type_color (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", ptr_dcc->nick);
|
||||
gui_printf_type (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
|
||||
ptr_dcc->nick);
|
||||
if ( (cfg_look_infobar_delay_highlight > 0)
|
||||
&& (ptr_dcc->channel->buffer != gui_current_window->buffer) )
|
||||
gui_infobar_printf (cfg_look_infobar_delay_highlight,
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
ptr_dcc->nick, ptr_buf);
|
||||
ptr_dcc->nick,
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
}
|
||||
else
|
||||
gui_printf_type_color (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_PRIVATE,
|
||||
"%s", ptr_dcc->nick);
|
||||
gui_printf_type_color (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_type_color (ptr_dcc->channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", ptr_buf);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
|
||||
ptr_dcc->nick);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
"%s> ", GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
if (ptr_buf_color)
|
||||
free (ptr_buf_color);
|
||||
}
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1047,7 +1194,7 @@ dcc_handle ()
|
||||
t_irc_dcc *ptr_dcc;
|
||||
int num_read, num_sent;
|
||||
static char buffer[102400];
|
||||
u_int32_t pos;
|
||||
uint32_t pos;
|
||||
fd_set read_fd;
|
||||
static struct timeval timeout;
|
||||
int sock;
|
||||
@@ -1201,7 +1348,7 @@ dcc_handle ()
|
||||
{
|
||||
if (cfg_dcc_blocksize > (int) sizeof (buffer))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s DCC failed because blocksize is too "
|
||||
"big. Check value of \"dcc_blocksize\" option, "
|
||||
"max is %d.\n"),
|
||||
|
||||
+125
-117
@@ -36,12 +36,12 @@
|
||||
|
||||
|
||||
/*
|
||||
* irc_display_prefix: display prefix for action or info message
|
||||
* irc_display_prefix: display a prefix for action/info/error msg
|
||||
* prefix must be 3 chars length
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
int type;
|
||||
|
||||
@@ -52,19 +52,34 @@ irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
gui_printf_type (buffer, type, "%s%c%s%c%s%c ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
|
||||
prefix[0],
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX2),
|
||||
prefix[1],
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
|
||||
prefix[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (prefix, PREFIX_JOIN) == 0)
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_JOIN, "%s ", prefix);
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_JOIN), prefix);
|
||||
else if (strcmp (prefix, PREFIX_PART) == 0)
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PART, "%s ", prefix);
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PART), prefix);
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
gui_printf_type (buffer, type, "%s%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1), prefix);
|
||||
}
|
||||
if (server && (server->buffer == buffer) && buffer->all_servers)
|
||||
{
|
||||
gui_printf_type (buffer, type, "%s[%s%s%s] ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_SERVER), server->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
}
|
||||
gui_printf_type (buffer, type, GUI_NO_COLOR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -74,58 +89,51 @@ irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
int message_type, int display_around, int color_nick, int no_nickmode)
|
||||
int type, int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK,
|
||||
(nick) ? "<" : ">");
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
(nick) ? "<" : ">");
|
||||
if (nick && cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_chanowner)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "~");
|
||||
gui_printf_type (buffer, type, "%s~",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_chanadmin)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "&");
|
||||
gui_printf_type (buffer, type, "%s&",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_op)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
gui_printf_type (buffer, type, "%s@",
|
||||
GUI_COLOR(COLOR_WIN_NICK_OP));
|
||||
else if (nick->is_halfop)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
gui_printf_type (buffer, type, "%s%%",
|
||||
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
|
||||
else if (nick->has_voice)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
gui_printf_type (buffer, type, "%s+",
|
||||
GUI_COLOR(COLOR_WIN_NICK_VOICE));
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
gui_printf_type (buffer, type, "%s ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", (nick) ? nick->nick : nickname);
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
else
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
(nick && color_nick) ?
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR((nick && color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT,
|
||||
"%s", (nick) ? nick->nick : nickname);
|
||||
nick->color : COLOR_WIN_CHAT) :
|
||||
COLOR_WIN_CHAT),
|
||||
(nick) ? nick->nick : nickname);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK,
|
||||
(nick) ? "> " : "< ");
|
||||
gui_printf_type (buffer, type, "%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
(nick) ? "> " : "< ");
|
||||
gui_printf_type (buffer, type, GUI_NO_COLOR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -133,23 +141,32 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
irc_display_mode (t_irc_server *server, t_gui_buffer *buffer,
|
||||
char *channel_name, char set_flag,
|
||||
char *symbol, char *nick_host, char *message, char *param)
|
||||
{
|
||||
irc_display_prefix (buffer, PREFIX_INFO);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
irc_display_prefix (server, buffer, PREFIX_INFO);
|
||||
gui_printf (buffer, "%s[%s%s%s/%s%c%s%s] %s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
channel_name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
set_flag,
|
||||
symbol,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick_host);
|
||||
if (param)
|
||||
{
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
}
|
||||
gui_printf (buffer, " %s%s %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
message,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
param);
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf (buffer, " %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
message);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -160,65 +177,56 @@ void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_ipv6 . . . . . . .: %s\n",
|
||||
(server->ipv6) ? _("yes") : _("no"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_ssl . . . . . . . .: %s\n",
|
||||
(server->ssl) ? _("yes") : _("no"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_notify_levels . . .: %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
server->name,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
|
||||
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
|
||||
(server->autoconnect) ? _("on") : _("off"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
gui_printf (NULL, " server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
gui_printf (NULL, " server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
|
||||
(server->ipv6) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
|
||||
(server->ssl) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
|
||||
server->nick1,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick2,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick3);
|
||||
gui_printf (NULL, " server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
gui_printf (NULL, " server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
gui_printf (NULL, " server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf (NULL, " server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
gui_printf (NULL, " server_notify_levels . . .: %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* irc-ignore.c: manages IRC ignore list */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/command.h"
|
||||
|
||||
|
||||
char *ignore_types[] =
|
||||
{ IGNORE_ACTION, IGNORE_CTCP, IGNORE_DCC, IGNORE_PRIVATE, NULL };
|
||||
|
||||
t_irc_ignore *irc_ignore = NULL;
|
||||
t_irc_ignore *last_irc_ignore = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* ignore_check_mask: returns 1 is mask1 and mask2 are the same host
|
||||
* anyone or both strings may have user and/or host after
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_check_mask (char *mask1, char *mask2)
|
||||
{
|
||||
char *m1, *m2, *pos;
|
||||
int match;
|
||||
|
||||
if (!mask1 || !mask1[0] || !mask2 || !mask2[0])
|
||||
return 0;
|
||||
|
||||
m1 = strdup (mask1);
|
||||
m2 = strdup (mask2);
|
||||
|
||||
pos = strchr (m1, '!');
|
||||
if (!pos)
|
||||
{
|
||||
/* remove '!' from m2 */
|
||||
pos = strchr (m2, '!');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
}
|
||||
pos = strchr (m2, '!');
|
||||
if (!pos)
|
||||
{
|
||||
/* remove '!' from m1 */
|
||||
pos = strchr (m1, '!');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
}
|
||||
|
||||
/* TODO: use regexp to match both masks */
|
||||
match = ascii_strcasecmp (m1, m2);
|
||||
|
||||
free (m1);
|
||||
free (m2);
|
||||
|
||||
return (match == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_match: check if pointed ignore matches with arguments
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_match (t_irc_ignore *ptr_ignore, char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
/* check mask */
|
||||
if ((strcmp (mask, "*") != 0) && (strcmp (ptr_ignore->mask, "*") != 0)
|
||||
&& (!ignore_check_mask (ptr_ignore->mask, mask)))
|
||||
return 0;
|
||||
|
||||
/* mask is matching, go on with type */
|
||||
if ((strcmp (type, "*") != 0) && (strcmp (ptr_ignore->type, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->type, type) != 0))
|
||||
return 0;
|
||||
|
||||
/* mask and type matching, go on with server */
|
||||
if (server_name && server_name[0])
|
||||
{
|
||||
if ((strcmp (server_name, "*") != 0) && (strcmp (ptr_ignore->server_name, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->server_name, server_name) != 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (ptr_ignore->server_name, "*") != 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* mask, type and server matching, go on with channel */
|
||||
if (channel_name && channel_name[0])
|
||||
{
|
||||
if ((strcmp (channel_name, "*") != 0) && (strcmp (ptr_ignore->channel_name, "*") != 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) != 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (ptr_ignore->channel_name, "*") != 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* all is matching => we find a ignore! */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_check: check if an ignore is set for arguments
|
||||
* returns 1 if at least one ignore exists (message should NOT be displayed)
|
||||
* 0 if no ignore found (message will be displayed)
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_check (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
if (!mask || !mask[0] || !type || !type[0])
|
||||
return 0;
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* no ignore found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search: search for an ignore
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_search (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
if ((ascii_strcasecmp (ptr_ignore->mask, mask) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->type, type) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->channel_name, channel_name) == 0)
|
||||
&& (ascii_strcasecmp (ptr_ignore->server_name, server_name) == 0))
|
||||
return ptr_ignore;
|
||||
}
|
||||
|
||||
/* ignore not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_add: add an ignore in list
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_add (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
int i, type_index;
|
||||
t_irc_command *command_ptr;
|
||||
t_irc_ignore *new_ignore;
|
||||
|
||||
if (!mask || !mask[0] || !type || !type[0] || !channel_name || !channel_name[0]
|
||||
|| !server_name || !server_name[0])
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s too few arguments for ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("Adding ignore: mask:'%s', type:'%s', channel:'%s', server:'%s'\n",
|
||||
mask, type, channel_name, server_name);
|
||||
#endif
|
||||
|
||||
type_index = -1;
|
||||
command_ptr = NULL;
|
||||
|
||||
if ((strcmp (mask, "*") == 0) && (strcmp (type, "*") == 0))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s mask or type/command should be non generic value for ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ignore_search (mask, type, channel_name, server_name))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s ignore already exists\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp (type, "*") != 0)
|
||||
{
|
||||
/* look for type in pre-defined ignore types */
|
||||
for (i = 0; ignore_types[i]; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (type, ignore_types[i]) == 0)
|
||||
{
|
||||
type_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* not a pre-defined ignore type, so it MUST be an IRC command */
|
||||
if (type_index < 0)
|
||||
{
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].recv_function &&
|
||||
(ascii_strcasecmp (type, irc_commands[i].command_name) == 0))
|
||||
{
|
||||
command_ptr = &irc_commands[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* not a pre-defined command and not an IRC command => error */
|
||||
if ((type_index < 0) && (!command_ptr))
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown type or IRC command \"%s\" for ignore\n"),
|
||||
WEECHAT_ERROR, type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* create new ignore */
|
||||
new_ignore = (t_irc_ignore *) malloc (sizeof (t_irc_ignore));
|
||||
if (new_ignore)
|
||||
{
|
||||
new_ignore->mask = strdup (mask);
|
||||
new_ignore->type = strdup (type);
|
||||
new_ignore->server_name = strdup (server_name);
|
||||
new_ignore->channel_name = strdup (channel_name);
|
||||
|
||||
/* add new ignore to queue */
|
||||
new_ignore->prev_ignore = last_irc_ignore;
|
||||
new_ignore->next_ignore = NULL;
|
||||
if (irc_ignore)
|
||||
last_irc_ignore->next_ignore = new_ignore;
|
||||
else
|
||||
irc_ignore = new_ignore;
|
||||
last_irc_ignore = new_ignore;
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s not enough memory to create ignore\n"),
|
||||
WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_add_from_config: add an ignore to list, read from config file
|
||||
* (comma serparated values)
|
||||
*/
|
||||
|
||||
t_irc_ignore *
|
||||
ignore_add_from_config (char *string)
|
||||
{
|
||||
t_irc_ignore *new_ignore;
|
||||
char *string2;
|
||||
char *pos_mask, *pos_type, *pos_channel, *pos_server;
|
||||
|
||||
if (!string || !string[0])
|
||||
return NULL;
|
||||
|
||||
new_ignore = NULL;
|
||||
string2 = strdup (string);
|
||||
|
||||
pos_mask = string2;
|
||||
pos_type = strchr (pos_mask, ',');
|
||||
if (pos_type)
|
||||
{
|
||||
pos_type[0] = '\0';
|
||||
pos_type++;
|
||||
pos_channel = strchr (pos_type, ',');
|
||||
if (pos_channel)
|
||||
{
|
||||
pos_channel[0] = '\0';
|
||||
pos_channel++;
|
||||
pos_server = strchr (pos_channel, ',');
|
||||
if (pos_server)
|
||||
{
|
||||
pos_server[0] = '\0';
|
||||
pos_server++;
|
||||
new_ignore = ignore_add (pos_mask, pos_type, pos_channel, pos_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free (string2);
|
||||
return new_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_free: free an ignore
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_free (t_irc_ignore *ptr_ignore)
|
||||
{
|
||||
t_irc_ignore *new_irc_ignore;
|
||||
|
||||
/* free data */
|
||||
if (ptr_ignore->mask)
|
||||
free (ptr_ignore->mask);
|
||||
if (ptr_ignore->type)
|
||||
free (ptr_ignore->type);
|
||||
if (ptr_ignore->channel_name)
|
||||
free (ptr_ignore->channel_name);
|
||||
if (ptr_ignore->server_name)
|
||||
free (ptr_ignore->server_name);
|
||||
|
||||
/* remove ignore from queue */
|
||||
if (last_irc_ignore == ptr_ignore)
|
||||
last_irc_ignore = ptr_ignore->prev_ignore;
|
||||
if (ptr_ignore->prev_ignore)
|
||||
{
|
||||
(ptr_ignore->prev_ignore)->next_ignore = ptr_ignore->next_ignore;
|
||||
new_irc_ignore = irc_ignore;
|
||||
}
|
||||
else
|
||||
new_irc_ignore = ptr_ignore->next_ignore;
|
||||
|
||||
if (ptr_ignore->next_ignore)
|
||||
(ptr_ignore->next_ignore)->prev_ignore = ptr_ignore->prev_ignore;
|
||||
|
||||
free (ptr_ignore);
|
||||
irc_ignore = new_irc_ignore;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_free_all: free all ignores
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_free_all ()
|
||||
{
|
||||
while (irc_ignore)
|
||||
ignore_free (irc_ignore);
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search_free: search and free ignore(s)
|
||||
* return: number of ignore found and deleted
|
||||
* 0 if no ignore found
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_search_free (char *mask, char *type, char *channel_name, char *server_name)
|
||||
{
|
||||
int found;
|
||||
t_irc_ignore *ptr_ignore, *next_ignore;
|
||||
|
||||
found = 0;
|
||||
ptr_ignore = irc_ignore;
|
||||
while (ptr_ignore)
|
||||
{
|
||||
if (ignore_match (ptr_ignore, mask, type, channel_name, server_name))
|
||||
{
|
||||
found++;
|
||||
if (found == 1)
|
||||
gui_printf (NULL, "\n");
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
|
||||
next_ignore = ptr_ignore->next_ignore;
|
||||
ignore_free (ptr_ignore);
|
||||
ptr_ignore = next_ignore;
|
||||
}
|
||||
else
|
||||
ptr_ignore = ptr_ignore->next_ignore;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_search_free_by_number: search and free ignore(s) by number
|
||||
* return: 1 if ignore found and deleted
|
||||
* 0 if ignore not found
|
||||
*/
|
||||
|
||||
int
|
||||
ignore_search_free_by_number (int number)
|
||||
{
|
||||
int i;
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
if (number < 1)
|
||||
return 0;
|
||||
|
||||
i = 0;
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
i++;
|
||||
if (i == number)
|
||||
{
|
||||
gui_printf (NULL, "\n");
|
||||
irc_display_prefix (NULL, NULL, PREFIX_INFO);
|
||||
weechat_cmd_ignore_display (_("Removing ignore:"), ptr_ignore);
|
||||
ignore_free (ptr_ignore);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ignore number not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ignore_print_log: print ignore list in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
ignore_print_log ()
|
||||
{
|
||||
t_irc_ignore *ptr_ignore;
|
||||
|
||||
wee_log_printf ("[ignore list]\n");
|
||||
|
||||
for (ptr_ignore = irc_ignore; ptr_ignore;
|
||||
ptr_ignore = ptr_ignore->next_ignore)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" -> ignore at 0x%X:\n", ptr_ignore);
|
||||
wee_log_printf (" mask. . . . . . . : %s\n", ptr_ignore->mask);
|
||||
wee_log_printf (" type. . . . . . . : %s\n", ptr_ignore->type);
|
||||
wee_log_printf (" channel_name. . . : %s\n", ptr_ignore->channel_name);
|
||||
wee_log_printf (" server_name . . . : %s\n", ptr_ignore->server_name);
|
||||
wee_log_printf (" prev_ignore . . . : 0x%X\n", ptr_ignore->prev_ignore);
|
||||
wee_log_printf (" next_ignore . . . : 0x%X\n", ptr_ignore->next_ignore);
|
||||
}
|
||||
}
|
||||
+13
-10
@@ -30,10 +30,11 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
|
||||
|
||||
/*
|
||||
* nick_find_color: find a color for a nick (less used will be better!)
|
||||
* nick_find_color: find a color for a nick (according to nick letters)
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -46,9 +47,9 @@ nick_find_color (t_irc_nick *nick)
|
||||
{
|
||||
color += (int)(nick->nick[i]);
|
||||
}
|
||||
color = (color % COLOR_WIN_NICK_NUMBER);
|
||||
color = (color % cfg_look_color_nicks_number);
|
||||
|
||||
return COLOR_WIN_NICK_FIRST + color;
|
||||
return COLOR_WIN_NICK_1 + color;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -87,12 +88,11 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
score1 = nick_score_for_sort (nick1);
|
||||
score2 = nick_score_for_sort (nick2);
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
comp = ascii_strcasecmp (nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
score1++;
|
||||
else
|
||||
if (comp < 0)
|
||||
score2++;
|
||||
if (comp < 0)
|
||||
score2++;
|
||||
|
||||
/* nick1 > nick2 */
|
||||
if (score1 > score2)
|
||||
@@ -202,7 +202,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
new_nick->is_away = 0;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
if (ascii_strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
|
||||
new_nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
new_nick->color = nick_find_color (new_nick);
|
||||
@@ -315,11 +315,14 @@ t_irc_nick *
|
||||
nick_search (t_irc_channel *channel, char *nickname)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
|
||||
if (!nickname)
|
||||
return NULL;
|
||||
|
||||
for (ptr_nick = channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
if (strcasecmp (ptr_nick->nick, nickname) == 0)
|
||||
if (ascii_strcasecmp (ptr_nick->nick, nickname) == 0)
|
||||
return ptr_nick;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
+2225
-1534
File diff suppressed because it is too large
Load Diff
+182
-108
@@ -57,7 +57,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
@@ -82,6 +82,52 @@ irc_cmd_send_admin (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_ame: send a ctcp action to all channels of all connected servers
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_ame (t_irc_server *server, char *arguments)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
char *string;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
|
||||
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 :\01ACTION %s\01\r\n",
|
||||
ptr_channel->name,
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_ACTION_ME);
|
||||
string = (arguments && arguments[0]) ?
|
||||
(char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL;
|
||||
gui_printf (ptr_channel->buffer, "%s%s %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
ptr_server->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gui_add_hotlist = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_amsg: send message to all channels of all connected servers
|
||||
*/
|
||||
@@ -92,6 +138,7 @@ 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;
|
||||
char *string;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
@@ -116,12 +163,14 @@ irc_cmd_send_amsg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
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);
|
||||
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
|
||||
gui_printf (ptr_channel->buffer, "%s\n", (string) ? string : arguments);
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (ptr_server, ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s cannot find nick for sending message\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -149,6 +198,7 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
t_irc_server *ptr_server;
|
||||
time_t elapsed;
|
||||
char buffer[4096];
|
||||
char *string;
|
||||
|
||||
gui_add_hotlist = 0;
|
||||
if (arguments && (strncmp (arguments, "-all", 4) == 0))
|
||||
@@ -194,8 +244,11 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
server_sendf (ptr_server, "AWAY :%s\r\n", ptr_away_msg);
|
||||
if (cfg_irc_display_away)
|
||||
{
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", ptr_away_msg);
|
||||
string = (char *)gui_color_decode ((unsigned char *)ptr_away_msg, 1);
|
||||
snprintf (buffer, sizeof (buffer), "is away: %s", (string) ? string : "");
|
||||
irc_send_me_all_channels (ptr_server, buffer);
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
server_set_away (ptr_server, ptr_server->nick, 1);
|
||||
}
|
||||
@@ -283,7 +336,7 @@ irc_cmd_send_ban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
@@ -311,7 +364,7 @@ irc_cmd_send_ban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
@@ -359,21 +412,24 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
pos++;
|
||||
}
|
||||
|
||||
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);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
|
||||
gui_printf (server->buffer, "CTCP%s(%s%s%s)%s: %s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
arguments,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
|
||||
pos_type);
|
||||
|
||||
if ((strcasecmp (pos_type, "ping") == 0) && (!pos_args))
|
||||
if ((ascii_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);
|
||||
gui_printf (server->buffer, " %s%d %d\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
tv.tv_sec, tv.tv_usec);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -381,8 +437,9 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
{
|
||||
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);
|
||||
gui_printf (server->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -410,7 +467,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
@@ -422,7 +479,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
pos_file = strchr (pos_nick, ' ');
|
||||
if (!pos_file)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
@@ -440,7 +497,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc chat");
|
||||
@@ -451,7 +508,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
|
||||
dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL);
|
||||
}
|
||||
else if (strcasecmp (arguments, "close") == 0)
|
||||
else if (ascii_strcasecmp (arguments, "close") == 0)
|
||||
{
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer) &&
|
||||
CHANNEL(gui_current_window->buffer)->dcc_chat)
|
||||
@@ -463,7 +520,7 @@ irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc");
|
||||
@@ -498,7 +555,7 @@ irc_cmd_send_dehalfop (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "dehalfop");
|
||||
@@ -531,7 +588,7 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
@@ -564,7 +621,7 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
@@ -612,7 +669,7 @@ irc_cmd_send_halfop (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "halfop");
|
||||
@@ -648,7 +705,7 @@ irc_cmd_send_invite (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "invite");
|
||||
@@ -700,7 +757,7 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -715,7 +772,7 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
@@ -757,7 +814,7 @@ irc_cmd_send_kickban (t_irc_server *server, char *arguments)
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
@@ -772,7 +829,7 @@ irc_cmd_send_kickban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
@@ -861,15 +918,21 @@ irc_cmd_send_lusers (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_send_me (t_irc_server *server, t_irc_channel *channel, char *arguments)
|
||||
{
|
||||
char *string;
|
||||
|
||||
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
channel->name,
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
irc_display_prefix (channel->buffer, PREFIX_ACTION_ME);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT_NICK, "%s", server->nick);
|
||||
gui_printf_color (channel->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n",
|
||||
(arguments && arguments[0]) ? arguments : "");
|
||||
irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME);
|
||||
string = (arguments && arguments[0]) ?
|
||||
(char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL;
|
||||
gui_printf (channel->buffer, "%s%s %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
server->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -900,7 +963,7 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
@@ -946,6 +1009,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
char *msg_pwd_hidden, *pos_pwd;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
char *string;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
@@ -967,7 +1031,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
@@ -979,13 +1043,15 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n",
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
@@ -1004,13 +1070,15 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n",
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
@@ -1039,18 +1107,19 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_color (server->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n", msg_pwd_hidden);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
|
||||
gui_printf_type (server->buffer, MSG_TYPE_NICK,
|
||||
"%s-%s%s%s- ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
arguments,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
string = (char *)gui_color_decode ((unsigned char *)msg_pwd_hidden, 1);
|
||||
gui_printf (server->buffer, "%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
free (msg_pwd_hidden);
|
||||
return 0;
|
||||
@@ -1062,7 +1131,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
@@ -1071,19 +1140,19 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
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);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s<%s%s%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_NICK_SELF),
|
||||
server->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1161,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
@@ -1114,7 +1183,7 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
@@ -1166,7 +1235,7 @@ irc_cmd_send_nick (t_irc_server *server, int argc, char **argv)
|
||||
int
|
||||
irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char *pos, *string;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
@@ -1175,17 +1244,22 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
|
||||
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
|
||||
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
|
||||
gui_printf (server->buffer, "notice%s(%s%s%s)%s: %s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
arguments,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
@@ -1212,7 +1286,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
@@ -1260,7 +1334,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -1274,7 +1348,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
@@ -1348,7 +1422,7 @@ irc_cmd_send_pong (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
char *pos, *string;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
@@ -1370,7 +1444,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
@@ -1394,19 +1468,19 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
{
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
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);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s<%s%s%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_NICK_SELF),
|
||||
server->nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
(string) ? string : "");
|
||||
if (string)
|
||||
free (string);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
}
|
||||
return 0;
|
||||
@@ -1618,7 +1692,7 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
@@ -1691,7 +1765,7 @@ irc_cmd_send_unban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
@@ -1717,7 +1791,7 @@ irc_cmd_send_unban (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
@@ -1771,7 +1845,7 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s, compiled on %s %s\n"),
|
||||
PACKAGE_STRING,
|
||||
__DATE__, __TIME__);
|
||||
@@ -1805,7 +1879,7 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (NULL, server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
|
||||
+361
-299
@@ -105,6 +105,7 @@ server_init (t_irc_server *server)
|
||||
server->lag_check_time.tv_usec = 0;
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
server->buffer = NULL;
|
||||
server->saved_buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
}
|
||||
@@ -462,7 +463,7 @@ server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
@@ -477,11 +478,14 @@ void
|
||||
server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
{
|
||||
t_irc_message *message;
|
||||
|
||||
|
||||
if (!server->unterminated_message && !msg[0])
|
||||
return;
|
||||
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
if (!message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -494,7 +498,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
strlen (msg) + 1);
|
||||
if (!message->data)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -523,6 +527,45 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_msgq_add_unterminated: add an unterminated message to queue
|
||||
*/
|
||||
|
||||
void
|
||||
server_msgq_add_unterminated (t_irc_server *server, char *string)
|
||||
{
|
||||
if (!string[0])
|
||||
return;
|
||||
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (server->unterminated_message) +
|
||||
strlen (string) + 1);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcat (server->unterminated_message, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->unterminated_message = strdup (string);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_msgq_add_buffer: explode received buffer, creating queued messages
|
||||
*/
|
||||
@@ -530,58 +573,33 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
void
|
||||
server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
{
|
||||
char *pos;
|
||||
char *pos_cr, *pos_lf;
|
||||
|
||||
while (buffer[0])
|
||||
{
|
||||
pos = strstr (buffer, "\r\n");
|
||||
if (pos)
|
||||
pos_cr = strchr (buffer, '\r');
|
||||
pos_lf = strchr (buffer, '\n');
|
||||
|
||||
if (!pos_cr && !pos_lf)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
server_msgq_add_msg (server, buffer);
|
||||
buffer = pos + 2;
|
||||
/* no CR/LF found => add to unterminated and return */
|
||||
server_msgq_add_unterminated (server, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pos_cr && ((!pos_lf) || (pos_lf > pos_cr)))
|
||||
{
|
||||
/* found '\r' first => ignore this char */
|
||||
pos_cr[0] = '\0';
|
||||
server_msgq_add_unterminated (server, buffer);
|
||||
buffer = pos_cr + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strstr (buffer, "\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
server_msgq_add_msg (server, buffer);
|
||||
buffer = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (server->unterminated_message) +
|
||||
strlen (buffer) + 1);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcat (server->unterminated_message, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->unterminated_message = strdup (buffer);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
/* found: '\n' first => terminate message */
|
||||
pos_lf[0] = '\0';
|
||||
server_msgq_add_msg (server, buffer);
|
||||
buffer = pos_lf + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -611,7 +629,7 @@ server_msgq_flush ()
|
||||
while (ptr_data[0] == ' ')
|
||||
ptr_data++;
|
||||
|
||||
if (ptr_data)
|
||||
if (ptr_data && ptr_data[0])
|
||||
{
|
||||
#ifdef DEBUG
|
||||
gui_printf (NULL, "[DEBUG] data received from server: %s\n", ptr_data);
|
||||
@@ -631,12 +649,12 @@ server_msgq_flush ()
|
||||
else
|
||||
pos = ptr_data;
|
||||
|
||||
if (pos != NULL)
|
||||
if (pos && pos[0])
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2 != NULL)
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
command = strdup (pos);
|
||||
@@ -651,20 +669,23 @@ server_msgq_flush ()
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (recv_msgq->server,
|
||||
recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
|
||||
_("%s Command \"%s\" failed!\n"), WEECHAT_ERROR, command);
|
||||
break;
|
||||
case -2:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (recv_msgq->server,
|
||||
recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s No command to execute!\n"), WEECHAT_ERROR);
|
||||
break;
|
||||
case -3:
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (recv_msgq->server,
|
||||
recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_WARNING, command, args);
|
||||
_("%s Unknown command: cmd=\"%s\", host=\"%s\", args=\"%s\"\n"),
|
||||
WEECHAT_WARNING, command, host, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -712,7 +733,7 @@ server_recv (t_irc_server *server)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot read data from socket, disconnecting from server...\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -796,7 +817,7 @@ server_reconnect_schedule (t_irc_server *server)
|
||||
if (server->autoreconnect)
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
@@ -825,10 +846,11 @@ server_child_read (t_irc_server *server)
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (server->ssl_connected)
|
||||
{
|
||||
gnutls_transport_set_ptr (server->gnutls_sess, (gnutls_transport_ptr) server->sock);
|
||||
gnutls_transport_set_ptr (server->gnutls_sess,
|
||||
(gnutls_transport_ptr) server->sock);
|
||||
if (gnutls_handshake (server->gnutls_sess) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s gnutls handshake failed\n"),
|
||||
WEECHAT_ERROR);
|
||||
@@ -844,7 +866,7 @@ server_child_read (t_irc_server *server)
|
||||
break;
|
||||
/* adress not found */
|
||||
case '1':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
if (cfg_proxy_use)
|
||||
gui_printf (server->buffer,
|
||||
_("%s proxy address \"%s\" not found\n"),
|
||||
@@ -858,7 +880,7 @@ server_child_read (t_irc_server *server)
|
||||
break;
|
||||
/* IP address not found */
|
||||
case '2':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
if (cfg_proxy_use)
|
||||
gui_printf (server->buffer,
|
||||
_("%s proxy IP address not found\n"), WEECHAT_ERROR);
|
||||
@@ -870,7 +892,7 @@ server_child_read (t_irc_server *server)
|
||||
break;
|
||||
/* connection refused */
|
||||
case '3':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
if (cfg_proxy_use)
|
||||
gui_printf (server->buffer,
|
||||
_("%s proxy connection refused\n"), WEECHAT_ERROR);
|
||||
@@ -882,9 +904,11 @@ server_child_read (t_irc_server *server)
|
||||
break;
|
||||
/* proxy fails to connect to server */
|
||||
case '4':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s proxy fails to establish connection to server (check username/password if used)\n"), WEECHAT_ERROR);
|
||||
_("%s proxy fails to establish connection to "
|
||||
"server (check username/password if used)\n"),
|
||||
WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
@@ -900,12 +924,12 @@ void
|
||||
convbase64_8x3_to_6x4(char *from, char* to)
|
||||
{
|
||||
|
||||
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
to[0] = base64_table [ (from[0] & 0xfc) >> 2 ];
|
||||
to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ];
|
||||
to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ];
|
||||
to[3] = base64_table [ from[2] & 0x3f ];
|
||||
to[0] = base64_table [ (from[0] & 0xfc) >> 2 ];
|
||||
to[1] = base64_table [ ((from[0] & 0x03) << 4) + ((from[1] & 0xf0) >> 4) ];
|
||||
to[2] = base64_table [ ((from[1] & 0x0f) << 2) + ((from[2] & 0xc0) >> 6) ];
|
||||
to[3] = base64_table [ from[2] & 0x3f ];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -916,91 +940,92 @@ void
|
||||
base64encode(char *from, char *to)
|
||||
{
|
||||
|
||||
char *f, *t;
|
||||
int from_len;
|
||||
char *f, *t;
|
||||
int from_len;
|
||||
|
||||
from_len = strlen(from);
|
||||
from_len = strlen(from);
|
||||
|
||||
f = from;
|
||||
t = to;
|
||||
f = from;
|
||||
t = to;
|
||||
|
||||
while(from_len >= 3)
|
||||
while(from_len >= 3)
|
||||
{
|
||||
convbase64_8x3_to_6x4(f, t);
|
||||
f += 3 * sizeof(*f);
|
||||
t += 4 * sizeof(*t);
|
||||
from_len -= 3;
|
||||
convbase64_8x3_to_6x4(f, t);
|
||||
f += 3 * sizeof(*f);
|
||||
t += 4 * sizeof(*t);
|
||||
from_len -= 3;
|
||||
}
|
||||
|
||||
if (from_len > 0)
|
||||
if (from_len > 0)
|
||||
{
|
||||
char rest[3] = { 0, 0, 0 };
|
||||
switch(from_len)
|
||||
char rest[3] = { 0, 0, 0 };
|
||||
switch(from_len)
|
||||
{
|
||||
case 1 :
|
||||
rest[0] = f[0];
|
||||
convbase64_8x3_to_6x4(rest, t);
|
||||
t[2] = t[3] = '=';
|
||||
break;
|
||||
rest[0] = f[0];
|
||||
convbase64_8x3_to_6x4(rest, t);
|
||||
t[2] = t[3] = '=';
|
||||
break;
|
||||
case 2 :
|
||||
rest[0] = f[0];
|
||||
rest[1] = f[1];
|
||||
convbase64_8x3_to_6x4(rest, t);
|
||||
t[3] = '=';
|
||||
break;
|
||||
rest[0] = f[0];
|
||||
rest[1] = f[1];
|
||||
convbase64_8x3_to_6x4(rest, t);
|
||||
t[3] = '=';
|
||||
break;
|
||||
}
|
||||
t[4] = 0;
|
||||
t[4] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* pass_httpproxy: establish connection/authentification to an http proxy
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
*/
|
||||
|
||||
int
|
||||
pass_httpproxy(t_irc_server *server)
|
||||
pass_httpproxy(int sock, char *address, int port)
|
||||
{
|
||||
|
||||
char buffer[256];
|
||||
char authbuf[128]; // seems to be enougth to store username + password
|
||||
char authbuf_base64[196]; // enougth to store base64 encoded authbuf
|
||||
int n, m;
|
||||
char buffer[256];
|
||||
char authbuf[128]; // seems to be enougth to store username + password
|
||||
char authbuf_base64[196]; // enougth to store base64 encoded authbuf
|
||||
int n, m;
|
||||
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
{
|
||||
// authentification
|
||||
snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password);
|
||||
base64encode(authbuf, authbuf_base64);
|
||||
n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", server->address, server->port, authbuf_base64);
|
||||
// authentification
|
||||
snprintf(authbuf, sizeof(authbuf), "%s:%s", cfg_proxy_username, cfg_proxy_password);
|
||||
base64encode(authbuf, authbuf_base64);
|
||||
n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\nProxy-Authorization: Basic %s\r\n\r\n", address, port, authbuf_base64);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// no authentification
|
||||
n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", server->address, server->port);
|
||||
// no authentification
|
||||
n = snprintf(buffer, sizeof(buffer), "CONNECT %s:%d HTTP/1.0\r\n\r\n", address, port);
|
||||
}
|
||||
|
||||
m = send (server->sock, buffer, n, 0);
|
||||
if (n != m)
|
||||
return 1;
|
||||
m = send (sock, buffer, n, 0);
|
||||
if (n != m)
|
||||
return 1;
|
||||
|
||||
n = recv(server->sock, buffer, sizeof(buffer), 0);
|
||||
n = recv(sock, buffer, sizeof(buffer), 0);
|
||||
|
||||
/* success result must be like : "HTTP/1.0 200 OK" */
|
||||
if (n < 12)
|
||||
return 1;
|
||||
/* success result must be like : "HTTP/1.0 200 OK" */
|
||||
if (n < 12)
|
||||
return 1;
|
||||
|
||||
if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3))
|
||||
return 1;
|
||||
if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* resolve: resolve hostname on its IP address
|
||||
* (works with ipv4 and ipv6)
|
||||
* return :
|
||||
* return :
|
||||
* - 0 if resolution was successful
|
||||
* - 1 if resolution fails
|
||||
*/
|
||||
@@ -1042,207 +1067,210 @@ resolve (char *hostname, char *ip, int *version)
|
||||
|
||||
/*
|
||||
* pass_socks4proxy: establish connection/authentification throw a socks4 proxy
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
*/
|
||||
|
||||
int
|
||||
pass_socks4proxy(t_irc_server *server)
|
||||
pass_socks4proxy(int sock, char *address, int port, char *username)
|
||||
{
|
||||
/*
|
||||
* socks4 protocol is explain here:
|
||||
* http://archive.socks.permeo.com/protocol/socks4.protocol
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* socks4 protocol is explain here:
|
||||
* http://archive.socks.permeo.com/protocol/socks4.protocol
|
||||
*
|
||||
*/
|
||||
|
||||
struct s_socks4
|
||||
{
|
||||
char version; /* 1 byte */ /* socks version : 4 or 5 */
|
||||
char method; /* 1 byte */ /* socks method : connect (1) or bind (2) */
|
||||
unsigned short port; /* 2 bytes */ /* destination port */
|
||||
unsigned long address; /* 4 bytes */ /* destination address */
|
||||
char user[64]; /* username (64 characters seems to be enought) */
|
||||
} socks4;
|
||||
unsigned char buffer[24];
|
||||
char ip_addr[NI_MAXHOST];
|
||||
struct s_socks4
|
||||
{
|
||||
char version; /* 1 byte */ /* socks version : 4 or 5 */
|
||||
char method; /* 1 byte */ /* socks method : connect (1) or bind (2) */
|
||||
unsigned short port; /* 2 bytes */ /* destination port */
|
||||
unsigned long address; /* 4 bytes */ /* destination address */
|
||||
char user[64]; /* username (64 characters seems to be enought) */
|
||||
} socks4;
|
||||
unsigned char buffer[24];
|
||||
char ip_addr[NI_MAXHOST];
|
||||
|
||||
socks4.version = 4;
|
||||
socks4.method = 1;
|
||||
socks4.port = htons (server->port);
|
||||
resolve(server->address, ip_addr, NULL);
|
||||
socks4.address = inet_addr (ip_addr);
|
||||
strncpy (socks4.user, server->username, sizeof(socks4.user) - 1);
|
||||
socks4.version = 4;
|
||||
socks4.method = 1;
|
||||
socks4.port = htons (port);
|
||||
resolve(address, ip_addr, NULL);
|
||||
socks4.address = inet_addr (ip_addr);
|
||||
strncpy (socks4.user, username, sizeof(socks4.user) - 1);
|
||||
|
||||
send (server->sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0);
|
||||
recv (server->sock, buffer, sizeof(buffer), 0);
|
||||
send (sock, (char *) &socks4, 8 + strlen(socks4.user) + 1, 0);
|
||||
recv (sock, buffer, sizeof(buffer), 0);
|
||||
|
||||
if (buffer[0] == 0 && buffer[1] == 90)
|
||||
return 0;
|
||||
if (buffer[0] == 0 && buffer[1] == 90)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* pass_socks5proxy: establish connection/authentification throw a socks5 proxy
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
*/
|
||||
|
||||
int
|
||||
pass_socks5proxy(t_irc_server *server)
|
||||
pass_socks5proxy(int sock, char *address, int port)
|
||||
{
|
||||
/*
|
||||
* socks5 protocol is explained in RFC 1928
|
||||
* socks5 authentication with username/pass is explained in RFC 1929
|
||||
*/
|
||||
/*
|
||||
* socks5 protocol is explained in RFC 1928
|
||||
* socks5 authentication with username/pass is explained in RFC 1929
|
||||
*/
|
||||
|
||||
struct s_sock5
|
||||
{
|
||||
char version; /* 1 byte */ /* socks version : 4 or 5 */
|
||||
char nmethods; /* 1 byte */ /* size in byte(s) of field 'method', here 1 byte */
|
||||
char method; /* 1-255 bytes */ /* socks method : noauth (0), auth(user/pass) (2), ... */
|
||||
} socks5;
|
||||
unsigned char buffer[288];
|
||||
int username_len, password_len, addr_len, addr_buffer_len;
|
||||
unsigned char *addr_buffer;
|
||||
|
||||
socks5.version = 5;
|
||||
socks5.nmethods = 1;
|
||||
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
/* with authentication */
|
||||
socks5.method = 2;
|
||||
else
|
||||
/* without authentication */
|
||||
socks5.method = 0;
|
||||
|
||||
send (server->sock, (char *) &socks5, sizeof(socks5), 0);
|
||||
/* server socks5 must respond with 2 bytes */
|
||||
if (recv (server->sock, buffer, 2, 0) != 2)
|
||||
return 1;
|
||||
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
struct s_sock5
|
||||
{
|
||||
/* with authentication */
|
||||
/* -> socks server must respond with :
|
||||
* - socks version (buffer[0]) = 5 => socks5
|
||||
* - socks method (buffer[1]) = 2 => authentication
|
||||
*/
|
||||
char version; /* 1 byte */ /* socks version : 4 or 5 */
|
||||
char nmethods; /* 1 byte */ /* size in byte(s) of field 'method', here 1 byte */
|
||||
char method; /* 1-255 bytes */ /* socks method : noauth (0), auth(user/pass) (2), ... */
|
||||
} socks5;
|
||||
unsigned char buffer[288];
|
||||
int username_len, password_len, addr_len, addr_buffer_len;
|
||||
unsigned char *addr_buffer;
|
||||
|
||||
socks5.version = 5;
|
||||
socks5.nmethods = 1;
|
||||
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
/* with authentication */
|
||||
socks5.method = 2;
|
||||
else
|
||||
/* without authentication */
|
||||
socks5.method = 0;
|
||||
|
||||
send (sock, (char *) &socks5, sizeof(socks5), 0);
|
||||
/* server socks5 must respond with 2 bytes */
|
||||
if (recv (sock, buffer, 2, 0) != 2)
|
||||
return 1;
|
||||
|
||||
if (strlen(cfg_proxy_username) > 0)
|
||||
{
|
||||
/* with authentication */
|
||||
/* -> socks server must respond with :
|
||||
* - socks version (buffer[0]) = 5 => socks5
|
||||
* - socks method (buffer[1]) = 2 => authentication
|
||||
*/
|
||||
|
||||
//if (!(buffer[0] == 5 && buffer[1] == 2))
|
||||
if (buffer[0] != 5 || buffer[1] != 2)
|
||||
return 1;
|
||||
//if (!(buffer[0] == 5 && buffer[1] == 2))
|
||||
if (buffer[0] != 5 || buffer[1] != 2)
|
||||
return 1;
|
||||
|
||||
/* authentication as in RFC 1929 */
|
||||
username_len = strlen(cfg_proxy_username);
|
||||
password_len = strlen(cfg_proxy_password);
|
||||
/* authentication as in RFC 1929 */
|
||||
username_len = strlen(cfg_proxy_username);
|
||||
password_len = strlen(cfg_proxy_password);
|
||||
|
||||
/* make username/password buffer */
|
||||
buffer[0] = 1;
|
||||
buffer[1] = (unsigned char) username_len;
|
||||
memcpy(buffer + 2, cfg_proxy_username, username_len);
|
||||
buffer[2 + username_len] = (unsigned char) password_len;
|
||||
memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len);
|
||||
/* make username/password buffer */
|
||||
buffer[0] = 1;
|
||||
buffer[1] = (unsigned char) username_len;
|
||||
memcpy(buffer + 2, cfg_proxy_username, username_len);
|
||||
buffer[2 + username_len] = (unsigned char) password_len;
|
||||
memcpy(buffer + 3 + username_len, cfg_proxy_password, password_len);
|
||||
|
||||
send (server->sock, buffer, 3 + username_len + password_len, 0);
|
||||
send (sock, buffer, 3 + username_len + password_len, 0);
|
||||
|
||||
/* server socks5 must respond with 2 bytes */
|
||||
if (recv (server->sock, buffer, 2, 0) != 2)
|
||||
return 1;
|
||||
/* server socks5 must respond with 2 bytes */
|
||||
if (recv (sock, buffer, 2, 0) != 2)
|
||||
return 1;
|
||||
|
||||
/* buffer[1] = auth state, must be 0 for success */
|
||||
if (buffer[1] != 0)
|
||||
return 1;
|
||||
/* buffer[1] = auth state, must be 0 for success */
|
||||
if (buffer[1] != 0)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* without authentication */
|
||||
/* -> socks server must respond with :
|
||||
* - socks version (buffer[0]) = 5 => socks5
|
||||
* - socks method (buffer[1]) = 0 => no authentication
|
||||
*/
|
||||
if (!(buffer[0] == 5 && buffer[1] == 0))
|
||||
return 1;
|
||||
/* without authentication */
|
||||
/* -> socks server must respond with :
|
||||
* - socks version (buffer[0]) = 5 => socks5
|
||||
* - socks method (buffer[1]) = 0 => no authentication
|
||||
*/
|
||||
if (!(buffer[0] == 5 && buffer[1] == 0))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* authentication successful then giving address/port to connect */
|
||||
addr_len = strlen(server->address);
|
||||
addr_buffer_len = 4 + 1 + addr_len + 2;
|
||||
addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer));
|
||||
if (!addr_buffer)
|
||||
return 1;
|
||||
addr_buffer[0] = 5; /* version 5 */
|
||||
addr_buffer[1] = 1; /* command: 1 for connect */
|
||||
addr_buffer[2] = 0; /* reserved */
|
||||
addr_buffer[3] = 3; /* address type : ipv4 (1), domainname (3), ipv6 (4) */
|
||||
addr_buffer[4] = (unsigned char) addr_len;
|
||||
memcpy (addr_buffer + 5, server->address, addr_len); /* server address */
|
||||
*((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (server->port); /* server port */
|
||||
/* authentication successful then giving address/port to connect */
|
||||
addr_len = strlen(address);
|
||||
addr_buffer_len = 4 + 1 + addr_len + 2;
|
||||
addr_buffer = (unsigned char *) malloc ( addr_buffer_len * sizeof(*addr_buffer));
|
||||
if (!addr_buffer)
|
||||
return 1;
|
||||
addr_buffer[0] = 5; /* version 5 */
|
||||
addr_buffer[1] = 1; /* command: 1 for connect */
|
||||
addr_buffer[2] = 0; /* reserved */
|
||||
addr_buffer[3] = 3; /* address type : ipv4 (1), domainname (3), ipv6 (4) */
|
||||
addr_buffer[4] = (unsigned char) addr_len;
|
||||
memcpy (addr_buffer + 5, address, addr_len); /* server address */
|
||||
*((unsigned short *) (addr_buffer + 5 + addr_len)) = htons (port); /* server port */
|
||||
|
||||
send (server->sock, addr_buffer, addr_buffer_len, 0);
|
||||
free(addr_buffer);
|
||||
send (sock, addr_buffer, addr_buffer_len, 0);
|
||||
free(addr_buffer);
|
||||
|
||||
/* dialog with proxy server */
|
||||
if (recv (server->sock, buffer, 4, 0) != 4)
|
||||
return 1;
|
||||
/* dialog with proxy server */
|
||||
if (recv (sock, buffer, 4, 0) != 4)
|
||||
return 1;
|
||||
|
||||
if (!(buffer[0] == 5 && buffer[1] == 0))
|
||||
return 1;
|
||||
if (!(buffer[0] == 5 && buffer[1] == 0))
|
||||
return 1;
|
||||
|
||||
switch(buffer[3]) {
|
||||
/* buffer[3] = address type */
|
||||
case 1 :
|
||||
/* ipv4
|
||||
* server socks return server bound address and port
|
||||
* address of 4 bytes and port of 2 bytes (= 6 bytes)
|
||||
*/
|
||||
if (recv (server->sock, buffer, 6, 0) != 6)
|
||||
return 1;
|
||||
break;
|
||||
case 3:
|
||||
/* domainname
|
||||
* server socks return server bound address and port
|
||||
*/
|
||||
/* reading address length */
|
||||
if (recv (server->sock, buffer, 1, 0) != 1)
|
||||
return 1;
|
||||
addr_len = buffer[0];
|
||||
/* reading address + port = addr_len + 2 */
|
||||
if (recv (server->sock, buffer, addr_len + 2, 0) != (addr_len + 2))
|
||||
return 1;
|
||||
break;
|
||||
case 4 :
|
||||
/* ipv6
|
||||
* server socks return server bound address and port
|
||||
* address of 16 bytes and port of 2 bytes (= 18 bytes)
|
||||
*/
|
||||
if (recv (server->sock, buffer, 18, 0) != 18)
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
switch(buffer[3]) {
|
||||
/* buffer[3] = address type */
|
||||
case 1 :
|
||||
/* ipv4
|
||||
* server socks return server bound address and port
|
||||
* address of 4 bytes and port of 2 bytes (= 6 bytes)
|
||||
*/
|
||||
if (recv (sock, buffer, 6, 0) != 6)
|
||||
return 1;
|
||||
break;
|
||||
case 3:
|
||||
/* domainname
|
||||
* server socks return server bound address and port
|
||||
*/
|
||||
/* reading address length */
|
||||
if (recv (sock, buffer, 1, 0) != 1)
|
||||
return 1;
|
||||
addr_len = buffer[0];
|
||||
/* reading address + port = addr_len + 2 */
|
||||
if (recv (sock, buffer, addr_len + 2, 0) != (addr_len + 2))
|
||||
return 1;
|
||||
break;
|
||||
case 4 :
|
||||
/* ipv6
|
||||
* server socks return server bound address and port
|
||||
* address of 16 bytes and port of 2 bytes (= 18 bytes)
|
||||
*/
|
||||
if (recv (sock, buffer, 18, 0) != 18)
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* pass_proxy: establish connection/authentification to a proxy
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
* return :
|
||||
* - 0 if connexion throw proxy was successful
|
||||
* - 1 if connexion fails
|
||||
*/
|
||||
int
|
||||
pass_proxy(t_irc_server *server)
|
||||
{
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "http") == 0)
|
||||
return pass_httpproxy(server);
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0)
|
||||
return pass_socks4proxy(server);
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0)
|
||||
return pass_socks5proxy(server);
|
||||
|
||||
return 1;
|
||||
int
|
||||
pass_proxy(int sock, char *address, int port, char *username)
|
||||
{
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "http") == 0)
|
||||
return pass_httpproxy(sock, address, port);
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks4") == 0)
|
||||
return pass_socks4proxy(sock, address, port, username);
|
||||
if (strcmp(cfg_proxy_type_values[cfg_proxy_type], "socks5") == 0)
|
||||
return pass_socks5proxy(sock, address, port);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1291,7 +1319,7 @@ server_child (t_irc_server *server)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pass_proxy(server))
|
||||
if (pass_proxy(server->sock, server->address, server->port, server->username))
|
||||
{
|
||||
write(server->child_write, "4", 1);
|
||||
freeaddrinfo (res);
|
||||
@@ -1355,14 +1383,14 @@ server_connect (t_irc_server *server)
|
||||
#ifndef HAVE_GNUTLS
|
||||
if (server->ssl)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect with SSL since WeeChat was not built "
|
||||
"with GNUtls support\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
if (cfg_proxy_use)
|
||||
{
|
||||
gui_printf (server->buffer,
|
||||
@@ -1402,7 +1430,7 @@ server_connect (t_irc_server *server)
|
||||
{
|
||||
if (gnutls_init (&server->gnutls_sess, GNUTLS_CLIENT) != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s gnutls init error\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
@@ -1417,7 +1445,7 @@ server_connect (t_irc_server *server)
|
||||
/* create pipe for child process */
|
||||
if (pipe (child_pipe) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
@@ -1426,10 +1454,13 @@ server_connect (t_irc_server *server)
|
||||
server->child_write = child_pipe[1];
|
||||
|
||||
/* create socket and set options */
|
||||
server->sock = socket ((server->ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
|
||||
if (cfg_proxy_use)
|
||||
server->sock = socket ((cfg_proxy_ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
|
||||
else
|
||||
server->sock = socket ((server->ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0);
|
||||
if (server->sock == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create socket\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
@@ -1440,7 +1471,7 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_WARNING);
|
||||
@@ -1451,7 +1482,7 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_WARNING);
|
||||
@@ -1483,7 +1514,7 @@ server_connect (t_irc_server *server)
|
||||
void
|
||||
server_reconnect (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server...\n"),
|
||||
PACKAGE_NAME);
|
||||
server->reconnect_start = 0;
|
||||
@@ -1499,7 +1530,7 @@ server_reconnect (t_irc_server *server)
|
||||
*/
|
||||
|
||||
void
|
||||
server_auto_connect (int command_line)
|
||||
server_auto_connect (int auto_connect, int command_line)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
@@ -1507,7 +1538,7 @@ server_auto_connect (int command_line)
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if ( ((command_line) && (ptr_server->command_line))
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
|| ((!command_line) && (auto_connect) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
@@ -1533,7 +1564,7 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
nick_free_all (ptr_channel);
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
}
|
||||
@@ -1542,7 +1573,7 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
|
||||
if (server->buffer)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
irc_display_prefix (server, server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
|
||||
@@ -1583,6 +1614,9 @@ server_search (char *servername)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
if (!servername)
|
||||
return NULL;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
@@ -1611,6 +1645,31 @@ server_get_number_connected ()
|
||||
return number;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_number_buffer: returns position of a server and total number of
|
||||
* buffers with a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
server_get_number_buffer (t_irc_server *server,
|
||||
int *server_pos, int *server_total)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
*server_pos = 0;
|
||||
*server_total = 0;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (ptr_server->buffer)
|
||||
{
|
||||
(*server_total)++;
|
||||
if (ptr_server == server)
|
||||
*server_pos = *server_total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_name_already_exists: return 1 if server name already exists
|
||||
* otherwise return 0
|
||||
@@ -1621,6 +1680,9 @@ server_name_already_exists (char *name)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
if (!name)
|
||||
return 0;
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (strcmp (ptr_server->name, name) == 0)
|
||||
|
||||
+110
-63
@@ -181,6 +181,7 @@ struct t_irc_server
|
||||
struct timeval lag_check_time; /* last time lag was checked (ping sent)*/
|
||||
time_t lag_next_check; /* time for next check */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_gui_buffer *saved_buffer; /* channel before jumping to next server*/
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
t_irc_server *prev_server; /* link to previous server */
|
||||
@@ -203,7 +204,7 @@ struct t_irc_command
|
||||
/* function called when user enters cmd */
|
||||
int (*cmd_function_1arg)(t_irc_server *, char *);
|
||||
/* function called when user enters cmd */
|
||||
int (*recv_function)(t_irc_server *, char *, char *);
|
||||
int (*recv_function)(t_irc_server *, char *, char *, char *);
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
@@ -218,7 +219,7 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC */
|
||||
/* DCC types */
|
||||
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
@@ -251,6 +252,30 @@ struct t_irc_dcc
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
/* ignore types */
|
||||
|
||||
/* pre-defined ignore types, all other types are made with IRC commands */
|
||||
/* for example: part join quit notice invite ... */
|
||||
|
||||
#define IGNORE_ACTION "action"
|
||||
#define IGNORE_CTCP "ctcp"
|
||||
#define IGNORE_DCC "dcc"
|
||||
#define IGNORE_PRIVATE "pv"
|
||||
|
||||
typedef struct t_irc_ignore t_irc_ignore;
|
||||
|
||||
struct t_irc_ignore
|
||||
{
|
||||
char *mask; /* nickname or mask */
|
||||
char *type; /* type of ignore */
|
||||
char *channel_name; /* name of channel, "*" == all */
|
||||
char *server_name; /* name of server, "*" == all */
|
||||
t_irc_ignore *prev_ignore; /* pointer to previous ignore */
|
||||
t_irc_ignore *next_ignore; /* pointer to next ignore */
|
||||
};
|
||||
|
||||
/* variables */
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
@@ -258,6 +283,9 @@ extern int check_away;
|
||||
extern t_irc_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
extern char *ignore_types[];
|
||||
extern t_irc_ignore *irc_ignore;
|
||||
extern t_irc_ignore *irc_last_ignore;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
|
||||
@@ -276,11 +304,12 @@ extern void server_recv (t_irc_server *);
|
||||
extern void server_child_read (t_irc_server *);
|
||||
extern int server_connect (t_irc_server *);
|
||||
extern void server_reconnect (t_irc_server *);
|
||||
extern void server_auto_connect (int);
|
||||
extern void server_auto_connect (int, int);
|
||||
extern void server_disconnect (t_irc_server *, int);
|
||||
extern void server_disconnect_all ();
|
||||
extern t_irc_server *server_search (char *);
|
||||
extern int server_get_number_connected ();
|
||||
extern void server_get_number_buffer (t_irc_server *, int *, int *);
|
||||
extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
@@ -290,11 +319,11 @@ extern void server_print_log (t_irc_server *);
|
||||
/* proxy functions (irc-server.c) */
|
||||
extern void convbase64_8x3_to_6x4(char *from, char* to);
|
||||
extern void base64encode(char *from, char *to);
|
||||
extern int pass_httpproxy(t_irc_server *server);
|
||||
extern int pass_httpproxy(int, char*, int);
|
||||
extern int resolve(char *hostname, char *ip, int *version);
|
||||
extern int pass_socks4proxy(t_irc_server *server);
|
||||
extern int pass_socks5proxy(t_irc_server *server);
|
||||
extern int pass_proxy(t_irc_server *server);
|
||||
extern int pass_socks4proxy(int, char*, int, char*);
|
||||
extern int pass_socks5proxy(int, char*, int);
|
||||
extern int pass_proxy(int, char*, int, char*);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -315,6 +344,7 @@ extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern int nick_find_color (t_irc_nick *);
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
|
||||
extern void nick_resort (t_irc_channel *, t_irc_nick *);
|
||||
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);
|
||||
@@ -343,10 +373,11 @@ extern void dcc_end ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
extern void irc_display_prefix (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, char *, int,
|
||||
int, int, int);
|
||||
extern void irc_display_mode (t_irc_server *, t_gui_buffer *, char *, char,
|
||||
char *, char *, char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
@@ -356,6 +387,7 @@ 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_ame (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 *);
|
||||
@@ -414,57 +446,72 @@ extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_kick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_kill (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_mode (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_nick (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_topic (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_307 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_315 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_320 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_341 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_367 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_368 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_438 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_671 (t_irc_server *, char *, char *);
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_kick (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_kill (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_mode (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_nick (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_notice (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_part (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_ping (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_pong (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_privmsg (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_quit (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_server_msg (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_221 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_305 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_306 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_307 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_311 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_312 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_313 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_314 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_315 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_317 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_318 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_319 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_320 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_321 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_322 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_323 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_324 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_329 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_341 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_344 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_345 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_348 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_349 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_365 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_366 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_367 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_368 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_433 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_438 (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_671 (t_irc_server *, char *, char *, char *);
|
||||
|
||||
/* ignore functions (irc-ignore.c) */
|
||||
|
||||
extern int ignore_check (char *, char *, char *, char *);
|
||||
extern t_irc_ignore *ignore_add (char *, char *, char *, char *);
|
||||
extern t_irc_ignore *ignore_add_from_config (char *);
|
||||
extern void ignore_free_all ();
|
||||
extern int ignore_search_free (char *, char *, char *, char *);
|
||||
extern int ignore_search_free_by_number (int);
|
||||
extern void ignore_print_log ();
|
||||
|
||||
#endif /* irc.h */
|
||||
|
||||
+12
-9
@@ -18,21 +18,24 @@
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
# if PLUGIN_RUBY
|
||||
# ruby_dir = ruby
|
||||
# endif
|
||||
if PLUGIN_RUBY
|
||||
script_dir = scripts
|
||||
endif
|
||||
|
||||
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
SUBDIRS = $(perl_dir) $(python_dir)
|
||||
SUBDIRS = $(script_dir)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_plugins.a
|
||||
|
||||
lib_weechat_plugins_a_SOURCES = plugins.h \
|
||||
plugins.c
|
||||
lib_weechat_plugins_a_SOURCES = weechat-plugin.h \
|
||||
plugins.h \
|
||||
plugins.c \
|
||||
plugins-interface.c \
|
||||
plugins-config.h \
|
||||
plugins-config.c
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
This is plugins directory for WeeChat.
|
||||
|
||||
Today, Perl interface is developed.
|
||||
|
||||
In the future, you'll find there interfaces with other famous languages for
|
||||
writing extensions to WeeChat:
|
||||
- Python interface,
|
||||
- Ruby interface.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* plugins-config.c: plugins configuration */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "weechat-plugin.h"
|
||||
#include "plugins-config.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
t_plugin_option *plugin_options = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* plugin_config_search_internal: search a plugin option (internal function)
|
||||
* This function should not be called directly.
|
||||
*/
|
||||
|
||||
t_plugin_option *
|
||||
plugin_config_search_internal (char *option)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
|
||||
ptr_plugin_option = ptr_plugin_option->next_option)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_plugin_option->option_name,
|
||||
option) == 0)
|
||||
{
|
||||
return ptr_plugin_option;
|
||||
}
|
||||
}
|
||||
|
||||
/* plugin option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_search: search a plugin option
|
||||
*/
|
||||
|
||||
t_plugin_option *
|
||||
plugin_config_search (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
char *internal_option;
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
internal_option = (char *)malloc (strlen (plugin->name) +
|
||||
strlen (option) + 2);
|
||||
if (!internal_option)
|
||||
return NULL;
|
||||
|
||||
strcpy (internal_option, plugin->name);
|
||||
strcat (internal_option, ".");
|
||||
strcat (internal_option, option);
|
||||
|
||||
ptr_plugin_option = plugin_config_search_internal (internal_option);
|
||||
|
||||
free (internal_option);
|
||||
|
||||
return ptr_plugin_option;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_set_internal: set value for a plugin option (internal function)
|
||||
* This function should not be called directly.
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_set_internal (char *option, char *value)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
ptr_plugin_option = plugin_config_search_internal (option);
|
||||
if (ptr_plugin_option)
|
||||
{
|
||||
if (!value || !value[0])
|
||||
{
|
||||
/* remove option from list */
|
||||
if (ptr_plugin_option->prev_option)
|
||||
(ptr_plugin_option->prev_option)->next_option =
|
||||
ptr_plugin_option->next_option;
|
||||
else
|
||||
plugin_options = ptr_plugin_option->next_option;
|
||||
if (ptr_plugin_option->next_option)
|
||||
(ptr_plugin_option->next_option)->prev_option =
|
||||
ptr_plugin_option->prev_option;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* replace old value by new one */
|
||||
if (ptr_plugin_option->value)
|
||||
free (ptr_plugin_option->value);
|
||||
ptr_plugin_option->value = strdup (value);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_plugin_option = (t_plugin_option *)malloc (sizeof (t_plugin_option));
|
||||
if (ptr_plugin_option)
|
||||
{
|
||||
/* create new option */
|
||||
ptr_plugin_option->option_name = strdup (option);
|
||||
ptr_plugin_option->value = strdup (value);
|
||||
if (plugin_options)
|
||||
plugin_options->prev_option = ptr_plugin_option;
|
||||
ptr_plugin_option->prev_option = NULL;
|
||||
ptr_plugin_option->next_option = plugin_options;
|
||||
plugin_options = ptr_plugin_option;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* failed to set plugin option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_set: set value for a plugin option (create it if not found)
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_set (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
char *internal_option;
|
||||
int return_code;
|
||||
|
||||
internal_option = (char *)malloc (strlen (plugin->name) +
|
||||
strlen (option) + 2);
|
||||
if (!internal_option)
|
||||
return 0;
|
||||
|
||||
strcpy (internal_option, plugin->name);
|
||||
strcat (internal_option, ".");
|
||||
strcat (internal_option, option);
|
||||
|
||||
return_code = plugin_config_set_internal (internal_option, value);
|
||||
free (internal_option);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_read: read WeeChat plugins configuration
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_config_read ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
FILE *file;
|
||||
int line_number;
|
||||
char line[1024], *ptr_line, *pos, *pos2;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
if ((file = fopen (filename, "rt")) == NULL)
|
||||
return;
|
||||
|
||||
line_number = 0;
|
||||
while (!feof (file))
|
||||
{
|
||||
ptr_line = fgets (line, sizeof (line) - 1, file);
|
||||
line_number++;
|
||||
if (ptr_line)
|
||||
{
|
||||
/* skip spaces */
|
||||
while (ptr_line[0] == ' ')
|
||||
ptr_line++;
|
||||
/* not a comment and not an empty line */
|
||||
if ((ptr_line[0] != '#') && (ptr_line[0] != '\r')
|
||||
&& (ptr_line[0] != '\n'))
|
||||
{
|
||||
pos = strchr (line, '=');
|
||||
if (pos == NULL)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
|
||||
WEECHAT_WARNING, filename, line_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos++;
|
||||
pos2 = strchr (pos, '\r');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
pos2 = strchr (pos, '\n');
|
||||
if (pos2 != NULL)
|
||||
pos2[0] = '\0';
|
||||
plugin_config_set_internal (ptr_line, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_config_write: write WeeChat configurtion
|
||||
* return: 0 if ok
|
||||
* < 0 if error
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_config_write ()
|
||||
{
|
||||
int filename_length;
|
||||
char *filename;
|
||||
FILE *file;
|
||||
time_t current_time;
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
filename_length = strlen (weechat_home) +
|
||||
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
|
||||
filename =
|
||||
(char *) malloc (filename_length * sizeof (char));
|
||||
if (!filename)
|
||||
return -2;
|
||||
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
|
||||
weechat_home, DIR_SEPARATOR);
|
||||
|
||||
if ((file = fopen (filename, "wt")) == NULL)
|
||||
{
|
||||
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
|
||||
WEECHAT_ERROR, filename);
|
||||
free (filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
current_time = time (NULL);
|
||||
fprintf (file, _("#\n# %s plugins configuration file, created by "
|
||||
"%s v%s on %s"),
|
||||
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
|
||||
ctime (¤t_time));
|
||||
fprintf (file, _("# WARNING! Be careful when editing this file, "
|
||||
"WeeChat writes this file when options are updated.\n#\n"));
|
||||
|
||||
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
|
||||
ptr_plugin_option = ptr_plugin_option->next_option)
|
||||
{
|
||||
fprintf (file, "%s=%s\n",
|
||||
ptr_plugin_option->option_name,
|
||||
ptr_plugin_option->value);
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
@@ -18,17 +18,24 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_PYTHON_H
|
||||
#define __WEECHAT_PYTHON_H 1
|
||||
#ifndef __WEECHAT_PLUGINS_CONFIG_H
|
||||
#define __WEECHAT_PLUGINS_CONFIG_H 1
|
||||
|
||||
#include "../plugins.h"
|
||||
#define WEECHAT_PLUGINS_CONFIG_NAME "plugins.rc"
|
||||
|
||||
extern void wee_python_init ();
|
||||
extern t_plugin_script *wee_python_search (char *);
|
||||
extern int wee_python_exec (char *, char *, char *);
|
||||
extern int wee_python_load (char *);
|
||||
extern void wee_python_unload (t_plugin_script *);
|
||||
extern void wee_python_unload_all ();
|
||||
extern void wee_python_end ();
|
||||
typedef struct t_plugin_option t_plugin_option;
|
||||
|
||||
#endif /* wee-python.h */
|
||||
struct t_plugin_option
|
||||
{
|
||||
char *option_name; /* option name in config file */
|
||||
char *value; /* value of option */
|
||||
t_plugin_option *prev_option; /* link to previous option */
|
||||
t_plugin_option *next_option; /* link to next option */
|
||||
};
|
||||
|
||||
extern t_plugin_option *plugin_config_search (t_weechat_plugin *, char *);
|
||||
extern int plugin_config_set (t_weechat_plugin *, char *, char *);
|
||||
extern void plugin_config_read ();
|
||||
extern int plugin_config_write ();
|
||||
|
||||
#endif /* plugins-config.h */
|
||||
@@ -0,0 +1,646 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* plugins-interface.c: WeeChat plugins interface */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "../common/weechat.h"
|
||||
#include "plugins.h"
|
||||
#include "plugins-config.h"
|
||||
#include "../common/command.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* weechat_ascii_strcasecmp: locale and case independent string comparison
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strcasecmp (string1, string2);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ascii_strncasecmp: locale and case independent string comparison
|
||||
* with max length
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
|
||||
char *string1, char *string2, int max)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
return ascii_strncasecmp (string1, string2, max);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_explode_string: explode a string
|
||||
*/
|
||||
|
||||
char **
|
||||
weechat_explode_string (t_weechat_plugin *plugin, char *string,
|
||||
char *separators, int num_items_max,
|
||||
int *num_items)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!plugin || !string || !separators || !num_items)
|
||||
return NULL;
|
||||
|
||||
return explode_string (string, separators, num_items_max, num_items);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_free_exploded_string: free exploded string
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
free_exploded_string (exploded_string);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
|
||||
{
|
||||
char *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!path)
|
||||
return 0;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_length = strlen (weechat_home) + strlen (path) + 2;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!dir_name)
|
||||
return 0;
|
||||
|
||||
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
|
||||
|
||||
if (mkdir (dir_name, 0755) < 0)
|
||||
{
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
free (dir_name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
free (dir_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_exec_on_files: find files in a directory and execute a
|
||||
* function on each file
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
|
||||
int (*callback)(t_weechat_plugin *, char *))
|
||||
{
|
||||
if (directory && callback)
|
||||
plugin_exec_on_files (plugin, directory, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_printf: print a message on a server or channel buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_printf (t_weechat_plugin *plugin,
|
||||
char *server, char *channel, char *message, ...)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
|
||||
ptr_buffer = plugin_find_buffer (server, channel);
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s\n", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_printf_server: print a message on server buffer
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[8192];
|
||||
|
||||
if (!plugin || !message)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "%s\n", buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_infobar_printf: print a message in infobar
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[1024];
|
||||
|
||||
if (!plugin || (time_displayed < 0) || !message)
|
||||
return;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
|
||||
va_end (argptr);
|
||||
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_msg_handler_add: add a message handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
if (plugin && message && handler_func)
|
||||
return plugin_msg_handler_add (plugin, message, handler_func,
|
||||
handler_args, handler_pointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_cmd_handler_add: add a command handler
|
||||
*/
|
||||
|
||||
t_plugin_handler *
|
||||
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
|
||||
char *description, char *arguments,
|
||||
char *arguments_description,
|
||||
t_plugin_handler_func *handler_func,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
if (plugin && command && handler_func)
|
||||
return plugin_cmd_handler_add (plugin, command, description, arguments,
|
||||
arguments_description,
|
||||
handler_func,
|
||||
handler_args, handler_pointer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_handler_remove: remove a WeeChat handler
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
t_plugin_handler *handler)
|
||||
{
|
||||
if (plugin && handler)
|
||||
plugin_handler_remove (plugin, handler);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_handler_remove_all: remove all WeeChat handlers
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_handler_remove_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
if (plugin)
|
||||
plugin_handler_remove_all (plugin);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_exec_command: execute a command (simulate user entry)
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
char *server, char *channel, char *command)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
if (!plugin || !command)
|
||||
return;
|
||||
|
||||
plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel);
|
||||
if (ptr_server && ptr_channel)
|
||||
user_command (ptr_server, ptr_channel->buffer, command);
|
||||
else if (ptr_server && (ptr_server->buffer))
|
||||
user_command (ptr_server, ptr_server->buffer, command);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_info: get info about WeeChat
|
||||
* WARNING: caller should free string returned
|
||||
* by this function after use
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
if (!plugin || !info)
|
||||
return NULL;
|
||||
|
||||
/* below are infos that do NOT need server to return info */
|
||||
|
||||
if (ascii_strcasecmp (info, "version") == 0)
|
||||
{
|
||||
return strdup (PACKAGE_VERSION);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechatdir") == 0)
|
||||
{
|
||||
/* WARNING: deprecated info, you should use "weechat_dir" */
|
||||
/* will be removed in a future version */
|
||||
return strdup (weechat_home);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
|
||||
{
|
||||
return strdup (weechat_home);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
|
||||
{
|
||||
return strdup (WEECHAT_LIBDIR);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
|
||||
{
|
||||
return strdup (WEECHAT_SHAREDIR);
|
||||
}
|
||||
|
||||
/* below are infos that need server to return value */
|
||||
|
||||
plugin_find_server_channel (server, NULL, &ptr_server, &ptr_channel);
|
||||
if (!ptr_server)
|
||||
return NULL;
|
||||
|
||||
if (ascii_strcasecmp (info, "nick") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->nick)
|
||||
return strdup (ptr_server->nick);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "channel") == 0)
|
||||
{
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
return strdup (CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "server") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->name)
|
||||
return strdup (ptr_server->name);
|
||||
}
|
||||
else if (ascii_strcasecmp (info, "away") == 0)
|
||||
{
|
||||
if (ptr_server->is_connected && ptr_server->is_away)
|
||||
return strdup ("1");
|
||||
else
|
||||
return strdup ("0");
|
||||
}
|
||||
|
||||
/* info not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
|
||||
*/
|
||||
|
||||
t_plugin_dcc_info *
|
||||
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
|
||||
{
|
||||
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
|
||||
if (!plugin)
|
||||
return NULL;
|
||||
|
||||
if (dcc_list)
|
||||
{
|
||||
dcc_info = NULL;
|
||||
last_dcc_info = NULL;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
|
||||
if (new_dcc_info)
|
||||
{
|
||||
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
|
||||
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
|
||||
new_dcc_info->type = ptr_dcc->type;
|
||||
new_dcc_info->status = ptr_dcc->status;
|
||||
new_dcc_info->start_time = ptr_dcc->start_time;
|
||||
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
|
||||
new_dcc_info->addr = ptr_dcc->addr;
|
||||
new_dcc_info->port = ptr_dcc->port;
|
||||
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
|
||||
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
|
||||
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
|
||||
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
|
||||
new_dcc_info->size = ptr_dcc->size;
|
||||
new_dcc_info->pos = ptr_dcc->pos;
|
||||
new_dcc_info->start_resume = ptr_dcc->start_resume;
|
||||
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
|
||||
|
||||
new_dcc_info->prev_dcc = last_dcc_info;
|
||||
new_dcc_info->next_dcc = NULL;
|
||||
if (!dcc_info)
|
||||
{
|
||||
dcc_info = new_dcc_info;
|
||||
last_dcc_info = new_dcc_info;
|
||||
}
|
||||
else
|
||||
last_dcc_info->next_dcc = new_dcc_info;
|
||||
}
|
||||
}
|
||||
|
||||
return dcc_info;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_free_dcc_info: free dcc info struct list
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
|
||||
{
|
||||
t_plugin_dcc_info *new_dcc_info;
|
||||
|
||||
if (!plugin || !dcc_info)
|
||||
return;
|
||||
|
||||
while (dcc_info)
|
||||
{
|
||||
if (dcc_info->server)
|
||||
free (dcc_info->server);
|
||||
if (dcc_info->channel)
|
||||
free (dcc_info->channel);
|
||||
if (dcc_info->nick)
|
||||
free (dcc_info->nick);
|
||||
if (dcc_info->filename)
|
||||
free (dcc_info->filename);
|
||||
if (dcc_info->local_filename)
|
||||
free (dcc_info->local_filename);
|
||||
new_dcc_info = dcc_info->next_dcc;
|
||||
free (dcc_info);
|
||||
dcc_info = new_dcc_info;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_config_str_value: return string value for any option
|
||||
* This function should never be called directly
|
||||
* (only used by weechat_get_config)
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
|
||||
{
|
||||
char buf_temp[1024], *color_name;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
if (option->option_type == OPTION_TYPE_STRING)
|
||||
value = option->ptr_string;
|
||||
else
|
||||
value = option->ptr_int;
|
||||
}
|
||||
|
||||
switch (option->option_type)
|
||||
{
|
||||
case OPTION_TYPE_BOOLEAN:
|
||||
return (*((int *)value)) ?
|
||||
strdup ("on") : strdup ("off");
|
||||
break;
|
||||
case OPTION_TYPE_INT:
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%d",
|
||||
*((int *)value));
|
||||
return strdup (buf_temp);
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
return option->array_values[*((int *)value)];
|
||||
break;
|
||||
case OPTION_TYPE_COLOR:
|
||||
color_name = gui_get_color_name (*((int *)value));
|
||||
return (color_name) ? strdup (color_name) : strdup ("");
|
||||
break;
|
||||
case OPTION_TYPE_STRING:
|
||||
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
|
||||
break;
|
||||
}
|
||||
|
||||
/* should never be executed! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_config: get value of a config option
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
int i, j;
|
||||
t_irc_server *ptr_server;
|
||||
char option_name[256];
|
||||
void *ptr_option_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
|
||||
{
|
||||
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
|
||||
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
if ((!option) ||
|
||||
((option) && (option[0])
|
||||
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
|
||||
{
|
||||
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
if ((!option) ||
|
||||
((option) && (option[0])
|
||||
&& (strstr (option_name, option) != NULL)))
|
||||
{
|
||||
ptr_option_value = config_get_server_option_ptr (ptr_server,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
if (ptr_option_value)
|
||||
{
|
||||
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
|
||||
ptr_option_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_set_config: set value of a config option
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
char *pos, *server_name;
|
||||
t_irc_server *ptr_server;
|
||||
t_config_option *ptr_option;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!option || !value)
|
||||
return 0;
|
||||
|
||||
pos = strchr (option, '.');
|
||||
if (pos)
|
||||
{
|
||||
/* server config option modification */
|
||||
server_name = (char *)malloc (pos - option + 1);
|
||||
strncpy (server_name, option, pos - option);
|
||||
if (server_name)
|
||||
{
|
||||
ptr_server = server_search (server_name);
|
||||
free (server_name);
|
||||
if (ptr_server)
|
||||
return (config_set_server_value (ptr_server, pos + 1, value) == 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_option = config_option_search (option);
|
||||
if (ptr_option)
|
||||
{
|
||||
if (ptr_option->handler_change)
|
||||
{
|
||||
if (config_option_set_value (ptr_option, value) == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* failed to set config option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_get_plugin_config: get value of a plugin config option
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_plugin_get_plugin_config (t_weechat_plugin *plugin, char *option)
|
||||
{
|
||||
t_plugin_option *ptr_plugin_option;
|
||||
|
||||
if (!option)
|
||||
return NULL;
|
||||
|
||||
ptr_plugin_option = plugin_config_search (plugin, option);
|
||||
if (ptr_plugin_option)
|
||||
return (ptr_plugin_option->value) ? strdup (ptr_plugin_option->value) : NULL;
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_set_plugin_config: set value of a plugin config option
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char *value)
|
||||
{
|
||||
if (!option)
|
||||
return 0;
|
||||
|
||||
if (plugin_config_set (plugin, option, value))
|
||||
{
|
||||
plugin_config_write ();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+851
-410
File diff suppressed because it is too large
Load Diff
+30
-53
@@ -21,64 +21,41 @@
|
||||
#ifndef __WEECHAT_PLUGINS_H
|
||||
#define __WEECHAT_PLUGINS_H 1
|
||||
|
||||
#include "weechat-plugin.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#define PLUGIN_TYPE_PERL 0
|
||||
#define PLUGIN_TYPE_PYTHON 1
|
||||
#define PLUGIN_TYPE_RUBY 2
|
||||
typedef int (t_weechat_init_func) (t_weechat_plugin *);
|
||||
typedef void (t_weechat_end_func) (t_weechat_plugin *);
|
||||
|
||||
typedef struct t_plugin_script t_plugin_script;
|
||||
extern t_weechat_plugin *weechat_plugins;
|
||||
extern t_weechat_plugin *last_weechat_plugin;
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
char *name; /* name of script */
|
||||
char *version; /* version of script */
|
||||
char *shutdown_func; /* function when script ends */
|
||||
char *description; /* description of script */
|
||||
t_plugin_script *prev_script; /* link to previous Perl script */
|
||||
t_plugin_script *next_script; /* link to next Perl script */
|
||||
};
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
struct t_plugin_handler
|
||||
{
|
||||
int plugin_type; /* plugin type (Perl, Python, Ruby) */
|
||||
char *name; /* name of IRC command (PRIVMSG, ..)
|
||||
or command (without first '/') */
|
||||
char *function_name; /* name of function (handler) */
|
||||
int running; /* 1 if currently running */
|
||||
/* (used to prevent circular call) */
|
||||
t_plugin_handler *prev_handler; /* link to previous handler */
|
||||
t_plugin_handler *next_handler; /* link to next handler */
|
||||
};
|
||||
|
||||
extern t_plugin_handler *plugin_msg_handlers;
|
||||
extern t_plugin_handler *last_plugin_msg_handler;
|
||||
|
||||
extern t_plugin_handler *plugin_cmd_handlers;
|
||||
extern t_plugin_handler *last_plugin_cmd_handler;
|
||||
|
||||
#ifdef PLUGIN_PERL
|
||||
extern t_plugin_script *perl_scripts;
|
||||
#endif
|
||||
|
||||
#ifdef PLUGIN_PYTHON
|
||||
extern t_plugin_script *python_scripts;
|
||||
#endif
|
||||
|
||||
extern void plugin_auto_load (int, char *);
|
||||
extern void plugin_init ();
|
||||
extern void plugin_load (int, char *);
|
||||
extern void plugin_unload (int, char *);
|
||||
extern t_plugin_handler *plugin_handler_search (t_plugin_handler *, char *);
|
||||
extern void plugin_handler_add (t_plugin_handler **, t_plugin_handler **,
|
||||
int, char *, char *);
|
||||
extern void plugin_handler_free_all_type (t_plugin_handler **,
|
||||
t_plugin_handler **, int);
|
||||
extern void plugin_event_msg (char *, char *, char *);
|
||||
extern int plugin_exec_command (char *, char *, char *);
|
||||
extern t_gui_buffer *plugin_find_buffer (char *, char *);
|
||||
extern void plugin_find_server_channel (char *, char *,
|
||||
t_irc_server **, t_irc_channel **);
|
||||
extern void plugin_exec_on_files (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
extern t_weechat_plugin *plugin_search (char *);
|
||||
extern t_plugin_handler *plugin_msg_handler_add (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern t_plugin_handler *plugin_cmd_handler_add (t_weechat_plugin *, char *,
|
||||
char *, char *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern int plugin_msg_handler_exec (char *, char *, char *);
|
||||
extern int plugin_cmd_handler_exec (char *, char *, char *);
|
||||
extern void plugin_handler_remove (t_weechat_plugin *,
|
||||
t_plugin_handler *);
|
||||
extern void plugin_handler_remove_all (t_weechat_plugin *);
|
||||
extern t_weechat_plugin *plugin_load (char *);
|
||||
extern void plugin_auto_load ();
|
||||
extern void plugin_remove (t_weechat_plugin *);
|
||||
extern void plugin_unload (t_weechat_plugin *);
|
||||
extern void plugin_unload_name (char *);
|
||||
extern void plugin_unload_all ();
|
||||
extern void plugin_init (int);
|
||||
extern void plugin_end ();
|
||||
|
||||
#endif /* plugins.h */
|
||||
|
||||
@@ -1,736 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* wee-python.c: Python plugin support for WeeChat */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Python.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#undef _
|
||||
#include "../../common/weechat.h"
|
||||
#include "../plugins.h"
|
||||
#include "wee-python.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../irc/irc.h"
|
||||
#include "../../gui/gui.h"
|
||||
|
||||
|
||||
t_plugin_script *python_scripts = NULL;
|
||||
t_plugin_script *last_python_script = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* weechat.register: startup function for all WeeChat Python scripts
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_register (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *name, *version, *shutdown_func, *description;
|
||||
t_plugin_script *ptr_python_script, *python_script_found, *new_python_script;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ssss", &name, &version, &shutdown_func, &description))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "register");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
python_script_found = NULL;
|
||||
for (ptr_python_script = python_scripts; ptr_python_script;
|
||||
ptr_python_script = ptr_python_script->next_script)
|
||||
{
|
||||
if (strcasecmp (ptr_python_script->name, name) == 0)
|
||||
{
|
||||
python_script_found = ptr_python_script;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (python_script_found)
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: unable to register \"%s\" script (another script "
|
||||
"already exists with this name)\n"),
|
||||
"Python", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* registering script */
|
||||
new_python_script = (t_plugin_script *)malloc (sizeof (t_plugin_script));
|
||||
if (new_python_script)
|
||||
{
|
||||
new_python_script->name = strdup (name);
|
||||
new_python_script->version = strdup (version);
|
||||
new_python_script->shutdown_func = strdup (shutdown_func);
|
||||
new_python_script->description = strdup (description);
|
||||
|
||||
/* add new script to list */
|
||||
new_python_script->prev_script = last_python_script;
|
||||
new_python_script->next_script = NULL;
|
||||
if (python_scripts)
|
||||
last_python_script->next_script = new_python_script;
|
||||
else
|
||||
python_scripts = new_python_script;
|
||||
last_python_script = new_python_script;
|
||||
|
||||
wee_log_printf (_("Registered %s script: \"%s\", version %s (%s)\n"),
|
||||
"Python", name, version, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: unable to load script \"%s\" (not enough memory)\n"),
|
||||
"Python", name);
|
||||
}
|
||||
}
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_print (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *message, *channel_name, *server_name;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
message = NULL;
|
||||
channel_name = NULL;
|
||||
server_name = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &message, &channel_name, &server_name))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "prnt");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_buffer = plugin_find_buffer (server_name, channel_name);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s\n", message);
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.print_infobar: print message to infobar
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_print_infobar (PyObject *self, PyObject *args)
|
||||
{
|
||||
int delay;
|
||||
char *message;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
delay = 1;
|
||||
message = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "is", &delay, &message))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "print_infobar");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gui_infobar_printf (delay, COLOR_WIN_INFOBAR, message);
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.command: send command to server
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_command (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *command, *channel_name, *server_name;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
command = NULL;
|
||||
channel_name = NULL;
|
||||
server_name = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &command, &channel_name, &server_name))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr_buffer = plugin_find_buffer (server_name, channel_name);
|
||||
if (ptr_buffer)
|
||||
{
|
||||
user_command (SERVER(ptr_buffer), ptr_buffer, command);
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return Py_BuildValue ("i", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.add_message_handler: add handler for messages
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_add_message_handler (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *message, *function;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &message, &function))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "add_message_handler");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plugin_handler_add (&plugin_msg_handlers, &last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PYTHON, message, function);
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.add_command_handler: define/redefines commands
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_add_command_handler(PyObject *self, PyObject *args)
|
||||
{
|
||||
char *name, *function;
|
||||
t_plugin_handler *ptr_plugin_handler;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &name, &function))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "add_command_handler");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!weelist_search (index_commands, name))
|
||||
weelist_add (&index_commands, &last_index_command, name);
|
||||
|
||||
ptr_plugin_handler = plugin_handler_search (plugin_cmd_handlers, name);
|
||||
if (ptr_plugin_handler)
|
||||
{
|
||||
free (ptr_plugin_handler->function_name);
|
||||
ptr_plugin_handler->function_name = strdup (function);
|
||||
}
|
||||
else
|
||||
plugin_handler_add (&plugin_cmd_handlers, &last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PYTHON, name, function);
|
||||
|
||||
Py_INCREF (Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat.get_info: get various infos
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
wee_python_get_info (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *arg, *info = NULL, *server = NULL;
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) self;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|s", &arg, &server))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: wrong parameters for \"%s\" function\n"),
|
||||
"Python", "get_info");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (server == NULL)
|
||||
{
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (strcasecmp (ptr_server->name, server) == 0)
|
||||
break;
|
||||
}
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: server not found for \"%s\" function\n"),
|
||||
"Python", "get_info");
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_server && arg)
|
||||
{
|
||||
if ( (strcasecmp (arg, "0") == 0) || (strcasecmp (arg, "version") == 0) )
|
||||
{
|
||||
info = PACKAGE_STRING;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "1") == 0) || (strcasecmp (arg, "nick") == 0) )
|
||||
{
|
||||
if (ptr_server->nick)
|
||||
info = ptr_server->nick;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||
{
|
||||
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) )
|
||||
{
|
||||
if (ptr_server->name)
|
||||
info = ptr_server->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "4") == 0) || (strcasecmp (arg, "weechatdir") == 0) )
|
||||
{
|
||||
info = weechat_home;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "5") == 0) || (strcasecmp (arg, "away") == 0) )
|
||||
{
|
||||
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);
|
||||
else
|
||||
return Py_BuildValue ("s", "");
|
||||
}
|
||||
|
||||
return Py_BuildValue ("i", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Python subroutines
|
||||
*/
|
||||
|
||||
static
|
||||
PyMethodDef weechat_funcs[] = {
|
||||
{ "register", wee_python_register, METH_VARARGS, "" },
|
||||
{ "prnt", wee_python_print, METH_VARARGS, "" },
|
||||
{ "print_infobar", wee_python_print_infobar, METH_VARARGS, "" },
|
||||
{ "command", wee_python_command, METH_VARARGS, "" },
|
||||
{ "add_message_handler", wee_python_add_message_handler, METH_VARARGS, "" },
|
||||
{ "add_command_handler", wee_python_add_command_handler, METH_VARARGS, "" },
|
||||
{ "get_info", wee_python_get_info, METH_VARARGS, "" },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* wee_python_init: initialize Python interface for WeeChat
|
||||
*/
|
||||
|
||||
void
|
||||
wee_python_init ()
|
||||
{
|
||||
|
||||
Py_Initialize ();
|
||||
if (Py_IsInitialized () == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("%s error: error while launching interpreter\n"),
|
||||
"Python");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("Loading %s module \"weechat\"\n"), "Python");
|
||||
Py_InitModule ("weechat", weechat_funcs);
|
||||
|
||||
if (PyRun_SimpleString (
|
||||
"import weechat, sys, string\n"
|
||||
|
||||
"class weechatStdout:\n"
|
||||
"\tdef write(self, str):\n"
|
||||
"\t\tstr = string.strip(str)\n"
|
||||
"\t\tif str != \"\":\n"
|
||||
"\t\t\tweechat.prnt(\"Python stdout : \" + str, \"\")\n"
|
||||
|
||||
"class weechatStderr:\n"
|
||||
"\tdef write(self, str):\n"
|
||||
"\t\tstr = string.strip(str)\n"
|
||||
"\t\tif str != \"\":\n"
|
||||
"\t\t\tweechat.prnt(\"Python stderr : \" + str, \"\")\n"
|
||||
|
||||
"sys.stdout = weechatStdout()\n"
|
||||
"sys.stderr = weechatStderr()\n"
|
||||
) != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL,
|
||||
_("%s error: error while redirecting stdout and stderr\n"),
|
||||
"Python");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_search: search a (loaded) Python script by name
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
wee_python_search (char *name)
|
||||
{
|
||||
t_plugin_script *ptr_python_script;
|
||||
|
||||
for (ptr_python_script = python_scripts; ptr_python_script;
|
||||
ptr_python_script = ptr_python_script->next_script)
|
||||
{
|
||||
if (strcmp (ptr_python_script->name, name) == 0)
|
||||
return ptr_python_script;
|
||||
}
|
||||
|
||||
/* script not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_exec: execute a Python script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_python_exec (char *function, char *server, char *arguments)
|
||||
{
|
||||
int len, return_code, i, j, alen;
|
||||
char *srv, *args, *runstring;
|
||||
|
||||
return_code = 1;
|
||||
|
||||
if (arguments == NULL)
|
||||
{
|
||||
alen = 0;
|
||||
args = strdup ("");
|
||||
}
|
||||
else
|
||||
{
|
||||
alen = (int) strlen (arguments);
|
||||
args = (char *) malloc ( 2 * alen * sizeof (*args));
|
||||
}
|
||||
|
||||
if (!args)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: unable to run function \"%s\" in script (not enough memory)\n"),
|
||||
"Python", function);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// copy arguments in args to escape double quotes
|
||||
j = 0;
|
||||
for (i=0; i < alen; ++i)
|
||||
{
|
||||
if (arguments[i] == '"' || arguments[i] == '\\')
|
||||
{
|
||||
args[j] = '\\';
|
||||
++j;
|
||||
}
|
||||
args[j] = arguments[i];
|
||||
++j;
|
||||
}
|
||||
args[j] = 0;
|
||||
|
||||
if (server == NULL)
|
||||
srv = strdup ("");
|
||||
else
|
||||
srv = strdup (server);
|
||||
|
||||
if (!srv)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: unable to run function \"%s\" in script (not enough memory)\n"),
|
||||
"Python", function);
|
||||
free (args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = (int) strlen (function);
|
||||
len += (int) strlen ("(\"\",\"\")");
|
||||
len += (int) strlen (srv);
|
||||
len += (int) strlen (args);
|
||||
len += 1;
|
||||
|
||||
runstring = (char *) malloc ( len * sizeof (*runstring));
|
||||
|
||||
if (runstring)
|
||||
{
|
||||
sprintf (runstring, "%s(\"%s\",\"%s\")", function, srv, args);
|
||||
|
||||
if (PyRun_SimpleString (runstring) != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: error while running function \"%s\"\n"),
|
||||
"Python", function);
|
||||
return_code = 0;
|
||||
}
|
||||
free (runstring);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: unable to run function \"%s\" in script (not enough memory)\n"),
|
||||
"Python", function);
|
||||
return_code = 0;
|
||||
}
|
||||
|
||||
free (args);
|
||||
free (srv);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_load: load a Python script
|
||||
*/
|
||||
|
||||
int
|
||||
wee_python_load (char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
/* execute Python script */
|
||||
wee_log_printf (_("Loading %s script \"%s\"\n"), "Python", filename);
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("Loading %s script \"%s\"\n"), "Python", filename);
|
||||
|
||||
if ((fp = fopen (filename, "r")) == NULL)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: error while opening file \"%s\"\n"),
|
||||
"Python", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (PyRun_SimpleFile (fp, filename) != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s error: error while parsing file \"%s\"\n"),
|
||||
"Python", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_script_free: free a Python script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_python_script_free (t_plugin_script *ptr_python_script)
|
||||
{
|
||||
t_plugin_script *new_python_scripts;
|
||||
|
||||
/* remove script from list */
|
||||
if (last_python_script == ptr_python_script)
|
||||
last_python_script = ptr_python_script->prev_script;
|
||||
if (ptr_python_script->prev_script)
|
||||
{
|
||||
(ptr_python_script->prev_script)->next_script = ptr_python_script->next_script;
|
||||
new_python_scripts = python_scripts;
|
||||
}
|
||||
else
|
||||
new_python_scripts = ptr_python_script->next_script;
|
||||
|
||||
if (ptr_python_script->next_script)
|
||||
(ptr_python_script->next_script)->prev_script = ptr_python_script->prev_script;
|
||||
|
||||
/* free data */
|
||||
if (ptr_python_script->name)
|
||||
free (ptr_python_script->name);
|
||||
if (ptr_python_script->version)
|
||||
free (ptr_python_script->version);
|
||||
if (ptr_python_script->shutdown_func)
|
||||
free (ptr_python_script->shutdown_func);
|
||||
if (ptr_python_script->description)
|
||||
free (ptr_python_script->description);
|
||||
free (ptr_python_script);
|
||||
python_scripts = new_python_scripts;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_unload: unload a Python script
|
||||
*/
|
||||
|
||||
void
|
||||
wee_python_unload (t_plugin_script *ptr_python_script)
|
||||
{
|
||||
if (ptr_python_script)
|
||||
{
|
||||
wee_log_printf (_("Unloading %s script \"%s\"\n"),
|
||||
"Python", ptr_python_script->name);
|
||||
|
||||
/* call shutdown callback function */
|
||||
if (ptr_python_script->shutdown_func[0])
|
||||
wee_python_exec (ptr_python_script->shutdown_func, "", "");
|
||||
wee_python_script_free (ptr_python_script);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_unload_all: unload all Python scripts
|
||||
*/
|
||||
|
||||
void
|
||||
wee_python_unload_all ()
|
||||
{
|
||||
wee_log_printf (_("Unloading all %s scripts...\n"), "Python");
|
||||
while (python_scripts)
|
||||
wee_python_unload (python_scripts);
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("%s scripts unloaded\n"), "Python");
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_python_end: shutdown Python interface
|
||||
*/
|
||||
|
||||
void
|
||||
wee_python_end ()
|
||||
{
|
||||
/* unload all scripts */
|
||||
wee_python_unload_all ();
|
||||
|
||||
/* free all handlers */
|
||||
plugin_handler_free_all_type (&plugin_msg_handlers,
|
||||
&last_plugin_msg_handler,
|
||||
PLUGIN_TYPE_PYTHON);
|
||||
plugin_handler_free_all_type (&plugin_cmd_handlers,
|
||||
&last_plugin_cmd_handler,
|
||||
PLUGIN_TYPE_PYTHON);
|
||||
|
||||
/* free Python interpreter */
|
||||
Py_Finalize ();
|
||||
if (Py_IsInitialized () != 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, _("%s error: error while freeing interpreter\n"),
|
||||
"Python");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
noinst_LTLIBRARIES = lib_weechat_plugins_scripts.la
|
||||
|
||||
lib_weechat_plugins_scripts_la_SOURCES = weechat-script.h \
|
||||
weechat-script.c
|
||||
|
||||
if PLUGIN_PERL
|
||||
perl_dir = perl
|
||||
endif
|
||||
|
||||
if PLUGIN_PYTHON
|
||||
python_dir = python
|
||||
endif
|
||||
|
||||
if PLUGIN_RUBY
|
||||
ruby_dir = ruby
|
||||
endif
|
||||
|
||||
SUBDIRS = . $(perl_dir) $(python_dir) $(ruby_dir)
|
||||
@@ -17,7 +17,10 @@
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PERL_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_perl.a
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_weechat_perl_a_SOURCES = wee-perl.h \
|
||||
wee-perl.c
|
||||
lib_LTLIBRARIES = libperl.la
|
||||
|
||||
libperl_la_SOURCES = weechat-perl.c
|
||||
libperl_la_LDFLAGS = -module
|
||||
libperl_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PERL_LFLAGS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,10 @@
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(PYTHON_CFLAGS)
|
||||
|
||||
noinst_LIBRARIES = lib_weechat_python.a
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_weechat_python_a_SOURCES = wee-python.h \
|
||||
wee-python.c
|
||||
lib_LTLIBRARIES = libpython.la
|
||||
|
||||
libpython_la_SOURCES = weechat-python.c
|
||||
libpython_la_LDFLAGS = -module
|
||||
libpython_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PYTHON_LFLAGS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
# 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
|
||||
#
|
||||
|
||||
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(RUBY_CFLAGS)
|
||||
|
||||
libdir = ${weechat_libdir}/plugins
|
||||
|
||||
lib_LTLIBRARIES = libruby.la
|
||||
|
||||
libruby_la_SOURCES = weechat-ruby.c
|
||||
libruby_la_LDFLAGS = -module
|
||||
libruby_la_LIBADD = ../lib_weechat_plugins_scripts.la $(RUBY_LFLAGS)
|
||||
@@ -0,0 +1,976 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* wee-ruby.c: Ruby plugin support for WeeChat */
|
||||
|
||||
|
||||
#include <ruby.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#undef _
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../weechat-script.h"
|
||||
|
||||
|
||||
char plugin_name[] = "Ruby";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Ruby scripts support";
|
||||
|
||||
t_weechat_plugin *ruby_plugin;
|
||||
|
||||
t_plugin_script *ruby_scripts = NULL;
|
||||
t_plugin_script *ruby_current_script = NULL;
|
||||
char *ruby_current_script_filename = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* weechat_ruby_exec: execute a Ruby script
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_exec (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *function, char *server, char *arguments)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) script;
|
||||
(void) function;
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
|
||||
/* TODO: exec Ruby script */
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_handler: general message and command handler for Ruby
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_handler (t_weechat_plugin *plugin,
|
||||
char *server, char *command, char *arguments,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) command;
|
||||
|
||||
return weechat_ruby_exec (plugin, (t_plugin_script *)handler_pointer,
|
||||
handler_args, server, arguments);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_register: startup function for all WeeChat Ruby scripts
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_register (VALUE class, VALUE name, VALUE version,
|
||||
VALUE shutdown_func, VALUE description)
|
||||
{
|
||||
char *c_name, *c_version, *c_shutdown_func, *c_description;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (NIL_P (name) || NIL_P (version) || NIL_P (shutdown_func) || NIL_P (description))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"register\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (name, T_STRING);
|
||||
Check_Type (version, T_STRING);
|
||||
Check_Type (shutdown_func, T_STRING);
|
||||
Check_Type (description, T_STRING);
|
||||
|
||||
c_name = STR2CSTR (name);
|
||||
c_version = STR2CSTR (version);
|
||||
c_shutdown_func = STR2CSTR (shutdown_func);
|
||||
c_description = STR2CSTR (description);
|
||||
|
||||
if (weechat_script_search (ruby_plugin, &ruby_scripts, c_name))
|
||||
{
|
||||
/* error: another scripts already exists with this name! */
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to register "
|
||||
"\"%s\" script (another script "
|
||||
"already exists with this name)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/* register script */
|
||||
ruby_current_script = weechat_script_add (ruby_plugin,
|
||||
&ruby_scripts,
|
||||
(ruby_current_script_filename) ?
|
||||
ruby_current_script_filename : "",
|
||||
c_name, c_version, c_shutdown_func,
|
||||
c_description);
|
||||
if (ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby: registered script \"%s\", "
|
||||
"version %s (%s)",
|
||||
c_name, c_version, c_description);
|
||||
}
|
||||
else
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to load script "
|
||||
"\"%s\" (not enough memory)",
|
||||
c_name);
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_print: print message into a buffer (current or specified one)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_print (VALUE class, VALUE message, VALUE channel_name,
|
||||
VALUE server_name)
|
||||
{
|
||||
char *c_message, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_message = NULL;
|
||||
c_channel_name = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (message, T_STRING);
|
||||
if (!NIL_P (channel_name))
|
||||
Check_Type (channel_name, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_message = STR2CSTR (message);
|
||||
if (!NIL_P (channel_name))
|
||||
c_channel_name = STR2CSTR (channel_name);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
ruby_plugin->printf (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
"%s", c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_print_infobar: print message to infobar
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_print_infobar (VALUE class, VALUE delay, VALUE message)
|
||||
{
|
||||
int c_delay;
|
||||
char *c_message;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to print infobar message, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_delay = 1;
|
||||
c_message = NULL;
|
||||
|
||||
if (NIL_P (delay) || NIL_P (message))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"print_infobar\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (delay, T_FIXNUM);
|
||||
Check_Type (message, T_STRING);
|
||||
|
||||
c_delay = FIX2INT (delay);
|
||||
c_message = STR2CSTR (message);
|
||||
|
||||
ruby_plugin->infobar_printf (ruby_plugin, c_delay, c_message);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_command: send command to server
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_command (VALUE class, VALUE command, VALUE channel_name,
|
||||
VALUE server_name)
|
||||
{
|
||||
char *c_command, *c_channel_name, *c_server_name;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to run command, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_channel_name = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (command))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"command\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
if (!NIL_P (channel_name))
|
||||
Check_Type (channel_name, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
if (!NIL_P (channel_name))
|
||||
c_channel_name = STR2CSTR (channel_name);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
ruby_plugin->exec_command (ruby_plugin,
|
||||
c_server_name, c_channel_name,
|
||||
c_command);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_add_message_handler: add handler for messages
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_add_message_handler (VALUE class, VALUE message, VALUE function)
|
||||
{
|
||||
char *c_message, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add message handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_message = NULL;
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (message) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_message_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (message, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_message = STR2CSTR (message);
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
if (ruby_plugin->msg_handler_add (ruby_plugin, c_message,
|
||||
weechat_ruby_handler, c_function,
|
||||
(void *)ruby_current_script))
|
||||
return INT2FIX (1);
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_add_command_handler: define/redefines commands
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_add_command_handler (VALUE class, VALUE command, VALUE function,
|
||||
VALUE description, VALUE arguments,
|
||||
VALUE arguments_description)
|
||||
{
|
||||
char *c_command, *c_function, *c_description, *c_arguments;
|
||||
char *c_arguments_description;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to add command handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_function = NULL;
|
||||
c_description = NULL;
|
||||
c_arguments = NULL;
|
||||
c_arguments_description = NULL;
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"add_command_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
if (!NIL_P (description))
|
||||
Check_Type (description, T_STRING);
|
||||
if (!NIL_P (arguments))
|
||||
Check_Type (arguments, T_STRING);
|
||||
if (!NIL_P (arguments_description))
|
||||
Check_Type (arguments_description, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
c_function = STR2CSTR (function);
|
||||
if (!NIL_P (description))
|
||||
c_description = STR2CSTR (description);
|
||||
if (!NIL_P (arguments))
|
||||
c_arguments = STR2CSTR (arguments);
|
||||
if (!NIL_P (arguments_description))
|
||||
c_arguments_description = STR2CSTR (arguments_description);
|
||||
|
||||
if (ruby_plugin->cmd_handler_add (ruby_plugin,
|
||||
c_command,
|
||||
c_description,
|
||||
c_arguments,
|
||||
c_arguments_description,
|
||||
weechat_ruby_handler,
|
||||
c_function,
|
||||
(void *)ruby_current_script))
|
||||
return INT2FIX (1);
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_remove_handler: remove a handler
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
{
|
||||
char *c_command, *c_function;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to remove handler, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_command = NULL;
|
||||
c_function = NULL;
|
||||
|
||||
if (NIL_P (command) || NIL_P (function))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"remove_handler\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (command, T_STRING);
|
||||
Check_Type (function, T_STRING);
|
||||
|
||||
c_command = STR2CSTR (command);
|
||||
c_function = STR2CSTR (function);
|
||||
|
||||
weechat_script_remove_handler (ruby_plugin, ruby_current_script,
|
||||
c_command, c_function);
|
||||
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_info: get various infos
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name)
|
||||
{
|
||||
char *c_arg, *c_server_name, *info;
|
||||
VALUE return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_arg = NULL;
|
||||
c_server_name = NULL;
|
||||
|
||||
if (NIL_P (arg))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_info\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (arg, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
|
||||
c_arg = STR2CSTR (arg);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
|
||||
if (c_arg)
|
||||
{
|
||||
info = ruby_plugin->get_info (ruby_plugin, c_arg, c_server_name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
return_value = rb_str_new2 (info);
|
||||
free (info);
|
||||
return return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_dcc_info: get infos about DCC
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_dcc_info (VALUE class)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get DCC info, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/* TODO: get dcc info for Ruby */
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_config: get value of a WeeChat config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_config (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
if (c_option)
|
||||
{
|
||||
return_value = ruby_plugin->get_config (ruby_plugin, c_option);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
ruby_return_value = rb_str_new2 (return_value);
|
||||
free (return_value);
|
||||
return ruby_return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_set_config: set value of a WeeChat config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_set_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
c_value = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
if (c_option && c_value)
|
||||
{
|
||||
if (ruby_plugin->set_config (ruby_plugin, c_option, c_value))
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_get_plugin_config: get value of a plugin config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_plugin_config (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *return_value;
|
||||
VALUE ruby_return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to get plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"get_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
if (c_option)
|
||||
{
|
||||
return_value = weechat_script_get_plugin_config (ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
ruby_return_value = rb_str_new2 (return_value);
|
||||
free (return_value);
|
||||
return ruby_return_value;
|
||||
}
|
||||
}
|
||||
|
||||
return rb_str_new2 ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_set_plugin_config: set value of a plugin config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_set_plugin_config (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: unable to set plugin config option, "
|
||||
"script not initialized");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
c_value = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby error: wrong parameters for "
|
||||
"\"set_plugin_config\" function");
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
if (c_option && c_value)
|
||||
{
|
||||
if (weechat_script_set_plugin_config (ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option, c_value))
|
||||
return INT2FIX (1);
|
||||
}
|
||||
|
||||
return INT2FIX (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ruby subroutines
|
||||
*/
|
||||
|
||||
/* TODO: write Ruby functions interface */
|
||||
|
||||
/*
|
||||
* weechat_ruby_load: load a Ruby script
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) filename;
|
||||
|
||||
/* TODO: load & exec Ruby script */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload: unload a Ruby script
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload (t_weechat_plugin *plugin, t_plugin_script *script)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) script;
|
||||
|
||||
/* TODO: unload a Ruby script */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload_name: unload a Ruby script by name
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload_name (t_weechat_plugin *plugin, char *name)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
(void) name;
|
||||
|
||||
/* TODO: unload a Ruby script by name */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_unload_all: unload all Ruby scripts
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_ruby_unload_all (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
/* TODO: unload all Ruby scripts */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_cmd: /ruby command handler
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
char *server, char *command, char *arguments,
|
||||
char *handler_args, void *handler_pointer)
|
||||
{
|
||||
int argc, path_length, handler_found;
|
||||
char **argv, *path_script, *dir_home;
|
||||
t_plugin_script *ptr_script;
|
||||
t_plugin_handler *ptr_handler;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) command;
|
||||
(void) handler_args;
|
||||
(void) handler_pointer;
|
||||
|
||||
if (arguments)
|
||||
argv = plugin->explode_string (plugin, arguments, " ", 0, &argc);
|
||||
else
|
||||
{
|
||||
argv = NULL;
|
||||
argc = 0;
|
||||
}
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Ruby scripts */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Registered Ruby scripts:");
|
||||
if (ruby_scripts)
|
||||
{
|
||||
for (ptr_script = ruby_scripts;
|
||||
ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
plugin->printf_server (plugin, " %s v%s%s%s",
|
||||
ptr_script->name,
|
||||
ptr_script->version,
|
||||
(ptr_script->description[0]) ? " - " : "",
|
||||
ptr_script->description);
|
||||
}
|
||||
}
|
||||
else
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby message handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby message handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == HANDLER_MESSAGE)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " IRC(%s) => Ruby(%s)",
|
||||
ptr_handler->irc_command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
|
||||
/* list Ruby command handlers */
|
||||
plugin->printf_server (plugin, "");
|
||||
plugin->printf_server (plugin, "Ruby command handlers:");
|
||||
handler_found = 0;
|
||||
for (ptr_handler = plugin->handlers;
|
||||
ptr_handler; ptr_handler = ptr_handler->next_handler)
|
||||
{
|
||||
if ((ptr_handler->type == HANDLER_COMMAND)
|
||||
&& (ptr_handler->handler_args))
|
||||
{
|
||||
handler_found = 1;
|
||||
plugin->printf_server (plugin, " /%s => Ruby(%s)",
|
||||
ptr_handler->command,
|
||||
ptr_handler->handler_args);
|
||||
}
|
||||
}
|
||||
if (!handler_found)
|
||||
plugin->printf_server (plugin, " (none)");
|
||||
break;
|
||||
case 1:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "autoload") == 0)
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "reload") == 0)
|
||||
{
|
||||
weechat_ruby_unload_all (plugin);
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
}
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "unload") == 0)
|
||||
weechat_ruby_unload_all (plugin);
|
||||
break;
|
||||
case 2:
|
||||
if (plugin->ascii_strcasecmp (plugin, argv[0], "load") == 0)
|
||||
{
|
||||
/* load Ruby script */
|
||||
if ((strstr (argv[1], "/")) || (strstr (argv[1], "\\")))
|
||||
path_script = NULL;
|
||||
else
|
||||
{
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (dir_home)
|
||||
{
|
||||
path_length = strlen (dir_home) + strlen (argv[1]) + 16;
|
||||
path_script = (char *) malloc (path_length * sizeof (char));
|
||||
if (path_script)
|
||||
snprintf (path_script, path_length, "%s/ruby/%s",
|
||||
dir_home, argv[1]);
|
||||
else
|
||||
path_script = NULL;
|
||||
free (dir_home);
|
||||
}
|
||||
else
|
||||
path_script = NULL;
|
||||
}
|
||||
weechat_ruby_load (plugin, (path_script) ? path_script : argv[1]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
}
|
||||
else if (plugin->ascii_strcasecmp (plugin, argv[0], "unload") == 0)
|
||||
{
|
||||
/* unload Ruby script */
|
||||
weechat_ruby_unload_name (plugin, argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: unknown option for "
|
||||
"\"ruby\" command");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
plugin->printf_server (plugin,
|
||||
"Ruby error: wrong argument count for \"ruby\" command");
|
||||
}
|
||||
|
||||
if (argv)
|
||||
plugin->free_exploded_string (plugin, argv);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_init: initialize Ruby plugin
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_plugin_init (t_weechat_plugin *plugin)
|
||||
{
|
||||
ruby_plugin = plugin;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Ruby module \"weechat\"");
|
||||
|
||||
/* TODO: initialize Ruby interpreter */
|
||||
|
||||
|
||||
plugin->cmd_handler_add (plugin, "ruby",
|
||||
"list/load/unload Ruby scripts",
|
||||
"[load filename] | [autoload] | [reload] | [unload]",
|
||||
"filename: Ruby script (file) to load\n\n"
|
||||
"Without argument, /ruby command lists all loaded Ruby scripts.",
|
||||
weechat_ruby_cmd, NULL, NULL);
|
||||
|
||||
plugin->mkdir_home (plugin, "ruby");
|
||||
plugin->mkdir_home (plugin, "ruby/autoload");
|
||||
|
||||
weechat_script_auto_load (plugin, "ruby", weechat_ruby_load);
|
||||
|
||||
/* init ok */
|
||||
return PLUGIN_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_plugin_end: shutdown Ruby interface
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_plugin_end (t_weechat_plugin *plugin)
|
||||
{
|
||||
/* unload all scripts */
|
||||
weechat_ruby_unload_all (plugin);
|
||||
|
||||
/* TODO: free interpreter */
|
||||
|
||||
|
||||
ruby_plugin->printf_server (ruby_plugin,
|
||||
"Ruby plugin ended");
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* scripts.c: script interface for WeeChat plugins */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "weechat-script.h"
|
||||
|
||||
|
||||
/*
|
||||
* weechat_script_auto_load: auto-load all scripts in a directory
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
int (*callback)(t_weechat_plugin *, char *))
|
||||
{
|
||||
char *dir_home, *dir_name;
|
||||
int dir_length;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (!dir_home)
|
||||
return;
|
||||
dir_length = strlen (dir_home) + strlen (language) + 16;
|
||||
dir_name =
|
||||
(char *) malloc (dir_length * sizeof (char));
|
||||
if (!dir_name)
|
||||
{
|
||||
free (dir_home);
|
||||
return;
|
||||
}
|
||||
snprintf (dir_name, dir_length, "%s/%s/autoload", dir_home, language);
|
||||
|
||||
plugin->exec_on_files (plugin, dir_name, callback);
|
||||
|
||||
free (dir_name);
|
||||
free (dir_home);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_search: search a script in list
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
weechat_script_search (t_weechat_plugin *plugin,
|
||||
t_plugin_script **list, char *name)
|
||||
{
|
||||
t_plugin_script *ptr_script;
|
||||
|
||||
for (ptr_script = *list; ptr_script;
|
||||
ptr_script = ptr_script->next_script)
|
||||
{
|
||||
if (plugin->ascii_strcasecmp (plugin, ptr_script->name, name) == 0)
|
||||
return ptr_script;
|
||||
}
|
||||
|
||||
/* script not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_add: add a script to list of scripts
|
||||
*/
|
||||
|
||||
t_plugin_script *
|
||||
weechat_script_add (t_weechat_plugin *plugin,
|
||||
t_plugin_script **script_list,
|
||||
char *filename,
|
||||
char *name, char *version,
|
||||
char *shutdown_func, char *description)
|
||||
{
|
||||
t_plugin_script *new_script;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) plugin;
|
||||
|
||||
new_script = (t_plugin_script *)malloc (sizeof (t_plugin_script));
|
||||
if (new_script)
|
||||
{
|
||||
new_script->filename = strdup (filename);
|
||||
new_script->interpreter = NULL;
|
||||
new_script->name = strdup (name);
|
||||
new_script->version = strdup (version);
|
||||
new_script->shutdown_func = strdup (shutdown_func);
|
||||
new_script->description = strdup (description);
|
||||
|
||||
/* add new script to list */
|
||||
if ((*script_list))
|
||||
(*script_list)->prev_script = new_script;
|
||||
new_script->prev_script = NULL;
|
||||
new_script->next_script = (*script_list);
|
||||
(*script_list) = new_script;
|
||||
return new_script;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_remove: remove a script from list of scripts
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove (t_weechat_plugin *plugin,
|
||||
t_plugin_script **script_list, t_plugin_script *script)
|
||||
{
|
||||
t_plugin_handler *ptr_handler, *next_handler;
|
||||
|
||||
/* remove all handlers pointing to script */
|
||||
ptr_handler = plugin->handlers;
|
||||
while (ptr_handler)
|
||||
{
|
||||
if ((t_plugin_script *)ptr_handler->handler_pointer == script)
|
||||
{
|
||||
next_handler = ptr_handler->next_handler;
|
||||
plugin->handler_remove (plugin, ptr_handler);
|
||||
ptr_handler = next_handler;
|
||||
}
|
||||
else
|
||||
ptr_handler = ptr_handler->next_handler;
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (script->filename)
|
||||
free (script->filename);
|
||||
if (script->name)
|
||||
free (script->name);
|
||||
if (script->description)
|
||||
free (script->description);
|
||||
if (script->version)
|
||||
free (script->version);
|
||||
if (script->shutdown_func)
|
||||
free (script->shutdown_func);
|
||||
|
||||
/* remove script from list */
|
||||
if (script->prev_script)
|
||||
(script->prev_script)->next_script = script->next_script;
|
||||
else
|
||||
(*script_list) = script->next_script;
|
||||
if (script->next_script)
|
||||
(script->next_script)->prev_script = script->prev_script;
|
||||
|
||||
/* free script */
|
||||
free (script);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_remove_handler: remove a handler for a script
|
||||
* for a msg handler, arg1=irc command, arg2=function
|
||||
* for a cmd handler, arg1=command, arg2=function
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_script_remove_handler (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *arg1, char *arg2)
|
||||
{
|
||||
t_plugin_handler *ptr_handler, *next_handler;
|
||||
char *ptr_arg1;
|
||||
|
||||
/* search and remove message handlers */
|
||||
ptr_handler = plugin->handlers;
|
||||
while (ptr_handler)
|
||||
{
|
||||
ptr_arg1 = NULL;
|
||||
if (ptr_handler->type == HANDLER_MESSAGE)
|
||||
ptr_arg1 = ptr_handler->irc_command;
|
||||
else if (ptr_handler->type == HANDLER_COMMAND)
|
||||
ptr_arg1 = ptr_handler->command;
|
||||
|
||||
if ((ptr_arg1)
|
||||
&& ((t_plugin_script *)ptr_handler->handler_pointer == script)
|
||||
&& (plugin->ascii_strcasecmp (plugin, ptr_arg1, arg1) == 0)
|
||||
&& (plugin->ascii_strcasecmp (plugin, ptr_handler->handler_args, arg2) == 0))
|
||||
{
|
||||
next_handler = ptr_handler->next_handler;
|
||||
plugin->handler_remove (plugin, ptr_handler);
|
||||
ptr_handler = next_handler;
|
||||
}
|
||||
else
|
||||
ptr_handler = ptr_handler->next_handler;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_get_plugin_config: get a value of a script option
|
||||
* format in file is: plugin.script.option=value
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_script_get_plugin_config (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *option)
|
||||
{
|
||||
char *option_fullname, *return_value;
|
||||
|
||||
option_fullname = (char *)malloc (strlen (script->name) +
|
||||
strlen (option) + 2);
|
||||
if (!option_fullname)
|
||||
return NULL;
|
||||
|
||||
strcpy (option_fullname, script->name);
|
||||
strcat (option_fullname, ".");
|
||||
strcat (option_fullname, option);
|
||||
|
||||
return_value = plugin->get_plugin_config (plugin, option_fullname);
|
||||
free (option_fullname);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_script_set_plugin_config: set value of a script config option
|
||||
* format in file is: plugin.script.option=value
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_script_set_plugin_config (t_weechat_plugin *plugin,
|
||||
t_plugin_script *script,
|
||||
char *option, char *value)
|
||||
{
|
||||
char *option_fullname;
|
||||
int return_code;
|
||||
|
||||
option_fullname = (char *)malloc (strlen (script->name) +
|
||||
strlen (option) + 2);
|
||||
if (!option_fullname)
|
||||
return 0;
|
||||
|
||||
strcpy (option_fullname, script->name);
|
||||
strcat (option_fullname, ".");
|
||||
strcat (option_fullname, option);
|
||||
|
||||
return_code = plugin->set_plugin_config (plugin, option_fullname, value);
|
||||
free (option_fullname);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* This header is designed to be distributed with WeeChat plugins, if scripts
|
||||
management is needed */
|
||||
|
||||
#ifndef __WEECHAT_WEECHAT_SCRIPT_H
|
||||
#define __WEECHAT_WEECHAT_SCRIPT_H 1
|
||||
|
||||
typedef struct t_plugin_script t_plugin_script;
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
/* script variables */
|
||||
char *filename; /* name of script on disk */
|
||||
void *interpreter; /* interpreter for script */
|
||||
char *name; /* script name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *shutdown_func; /* function when script is unloaded */
|
||||
|
||||
t_plugin_script *prev_script; /* link to previous script */
|
||||
t_plugin_script *next_script; /* link to next script */
|
||||
};
|
||||
|
||||
extern void weechat_script_auto_load (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
extern t_plugin_script *weechat_script_search (t_weechat_plugin *,
|
||||
t_plugin_script **, char *);
|
||||
extern t_plugin_script *weechat_script_add (t_weechat_plugin *,
|
||||
t_plugin_script **, char *, char *,
|
||||
char *, char *, char *);
|
||||
extern void weechat_script_remove (t_weechat_plugin *,
|
||||
t_plugin_script **, t_plugin_script *);
|
||||
extern void weechat_script_remove_handler (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
extern char *weechat_script_get_plugin_config (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *);
|
||||
extern int weechat_script_set_plugin_config (t_weechat_plugin *,
|
||||
t_plugin_script *,
|
||||
char *, char *);
|
||||
|
||||
#endif /* weechat-script.h */
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* This header is designed to be distributed with WeeChat plugins */
|
||||
|
||||
#ifndef __WEECHAT_WEECHAT_PLUGIN_H
|
||||
#define __WEECHAT_WEECHAT_PLUGIN_H 1
|
||||
|
||||
/* return codes for init function and handlers */
|
||||
#define PLUGIN_RC_KO -1 /* function/handler failed */
|
||||
#define PLUGIN_RC_OK 0 /* function/handler ok */
|
||||
|
||||
/* return codes specific to message handlers: messages can be discarded for
|
||||
WeeChat, for plugins, or both */
|
||||
#define PLUGIN_RC_OK_IGNORE_WEECHAT 1 /* ignore WeeChat for this message */
|
||||
#define PLUGIN_RC_OK_IGNORE_PLUGINS 2 /* ignore other plugins for this msg */
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \
|
||||
| PLUGIN_RC_OK_IGNORE_PLUGINS)
|
||||
/* ignore WeeChat and other plugins */
|
||||
|
||||
typedef struct t_plugin_dcc_info t_plugin_dcc_info;
|
||||
|
||||
struct t_plugin_dcc_info
|
||||
{
|
||||
char *server; /* irc server */
|
||||
char *channel; /* irc channel (for DCC chat only) */
|
||||
int type; /* DCC type (send or receive) */
|
||||
int status; /* DCC status (waiting, sending, ..) */
|
||||
time_t start_time; /* the time when DCC started */
|
||||
time_t start_transfer; /* the time when DCC transfer started */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
char *filename; /* filename (given by sender) */
|
||||
char *local_filename; /* local filename (with path) */
|
||||
int filename_suffix; /* suffix (.1 for ex) if renaming file */
|
||||
unsigned long size; /* file size */
|
||||
unsigned long pos; /* number of bytes received/sent */
|
||||
unsigned long start_resume; /* start of resume (in bytes) */
|
||||
unsigned long bytes_per_sec; /* bytes per second */
|
||||
t_plugin_dcc_info *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_plugin_dcc_info *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
typedef struct t_weechat_plugin t_weechat_plugin;
|
||||
|
||||
typedef int (t_plugin_handler_func) (t_weechat_plugin *, char *, char *, char *, char *, void *);
|
||||
|
||||
/* handlers */
|
||||
|
||||
typedef enum t_handler_type t_handler_type;
|
||||
|
||||
enum t_handler_type
|
||||
{
|
||||
HANDLER_MESSAGE,
|
||||
HANDLER_COMMAND
|
||||
};
|
||||
|
||||
typedef struct t_plugin_handler t_plugin_handler;
|
||||
|
||||
struct t_plugin_handler
|
||||
{
|
||||
t_handler_type type; /* handler type */
|
||||
|
||||
/* data for message handler */
|
||||
char *irc_command; /* name of IRC command (PRIVMSG, ..) */
|
||||
|
||||
/* data for command handler */
|
||||
char *command; /* name of command (without first '/') */
|
||||
char *description; /* (for /help) short cmd description */
|
||||
char *arguments; /* (for /help) command arguments */
|
||||
char *arguments_description; /* (for /help) args long description */
|
||||
|
||||
/* data common to all handlers */
|
||||
t_plugin_handler_func *handler; /* pointer to handler */
|
||||
char *handler_args; /* arguments sent to handler */
|
||||
void *handler_pointer; /* pointer sent to handler */
|
||||
|
||||
/* for internal use */
|
||||
int running; /* 1 if currently running */
|
||||
/* (used to prevent circular call) */
|
||||
t_plugin_handler *prev_handler; /* link to previous handler */
|
||||
t_plugin_handler *next_handler; /* link to next handler */
|
||||
};
|
||||
|
||||
/* plugin, a WeeChat plugin, which is a dynamic library */
|
||||
|
||||
struct t_weechat_plugin
|
||||
{
|
||||
/* plugin variables */
|
||||
char *filename; /* name of plugin on disk */
|
||||
void *handle; /* handle of plugin (given by dlopen) */
|
||||
char *name; /* plugin name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
|
||||
/* plugin handlers */
|
||||
t_plugin_handler *handlers; /* pointer to first handler */
|
||||
t_plugin_handler *last_handler; /* pointer to last handler */
|
||||
|
||||
/* links to previous/next plugins */
|
||||
t_weechat_plugin *prev_plugin; /* link to previous plugin */
|
||||
t_weechat_plugin *next_plugin; /* link to next plugin */
|
||||
|
||||
/* plugin functions (interface) */
|
||||
|
||||
/* IMPORTANT NOTE for WeeChat developers: always add new interface functions
|
||||
at the END of functions, for keeping backward compatibility with
|
||||
existing plugins */
|
||||
|
||||
int (*ascii_strcasecmp) (t_weechat_plugin *, char *, char *);
|
||||
int (*ascii_strncasecmp) (t_weechat_plugin *, char *, char *, int);
|
||||
char **(*explode_string) (t_weechat_plugin *, char *, char *, int, int *);
|
||||
void (*free_exploded_string) (t_weechat_plugin *, char **);
|
||||
int (*mkdir_home) (t_weechat_plugin *, char *);
|
||||
void (*exec_on_files) (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
|
||||
void (*printf) (t_weechat_plugin *, char *, char *, char *, ...);
|
||||
void (*printf_server) (t_weechat_plugin *, char *, ...);
|
||||
void (*infobar_printf) (t_weechat_plugin *, int, char *, ...);
|
||||
|
||||
t_plugin_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
t_plugin_handler *(*cmd_handler_add) (t_weechat_plugin *, char *,
|
||||
char *, char *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
void (*handler_remove) (t_weechat_plugin *, t_plugin_handler *);
|
||||
void (*handler_remove_all) (t_weechat_plugin *);
|
||||
|
||||
void (*exec_command) (t_weechat_plugin *, char *, char *, char *);
|
||||
char *(*get_info) (t_weechat_plugin *, char *, char *);
|
||||
t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *);
|
||||
void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *);
|
||||
char *(*get_config) (t_weechat_plugin *, char *);
|
||||
int (*set_config) (t_weechat_plugin *, char *, char *);
|
||||
char *(*get_plugin_config) (t_weechat_plugin *, char *);
|
||||
int (*set_plugin_config) (t_weechat_plugin *, char *, char *);
|
||||
|
||||
/* WeeChat developers: ALWAYS add new functions at the end */
|
||||
};
|
||||
|
||||
/* general useful functions */
|
||||
extern int weechat_ascii_strcasecmp (t_weechat_plugin *,char *, char *);
|
||||
extern int weechat_ascii_strncasecmp (t_weechat_plugin *,char *, char *, int);
|
||||
extern char **weechat_explode_string (t_weechat_plugin *, char *, char *, int, int *);
|
||||
extern void weechat_free_exploded_string (t_weechat_plugin *, char **);
|
||||
extern int weechat_plugin_mkdir_home (t_weechat_plugin *, char *);
|
||||
extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *,
|
||||
int (*)(t_weechat_plugin *, char *));
|
||||
|
||||
/* display functions */
|
||||
extern void weechat_plugin_printf (t_weechat_plugin *, char *, char *, char *, ...);
|
||||
extern void weechat_plugin_printf_server (t_weechat_plugin *, char *, ...);
|
||||
extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...);
|
||||
|
||||
/* handler functions */
|
||||
extern t_plugin_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern t_plugin_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *, char *,
|
||||
char *, char *, char *,
|
||||
t_plugin_handler_func *,
|
||||
char *, void *);
|
||||
extern void weechat_plugin_handler_remove (t_weechat_plugin *, t_plugin_handler *);
|
||||
extern void weechat_plugin_handler_remove_all (t_weechat_plugin *);
|
||||
|
||||
/* other functions */
|
||||
extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *);
|
||||
extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *);
|
||||
extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *);
|
||||
extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *);
|
||||
extern char *weechat_plugin_get_config (t_weechat_plugin *, char *);
|
||||
extern int weechat_plugin_set_config (t_weechat_plugin *, char *, char *);
|
||||
extern char *weechat_plugin_get_plugin_config (t_weechat_plugin *, char *);
|
||||
extern int weechat_plugin_set_plugin_config (t_weechat_plugin *, char *, char *);
|
||||
|
||||
#endif /* weechat-plugin.h */
|
||||
+21
-8
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.1.4
|
||||
%define version 0.1.6
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -9,9 +9,11 @@ Release: %{release}
|
||||
Source: http://weechat.flashtux.org/download/%{name}-%{version}.tar.gz
|
||||
URL: http://weechat.flashtux.org
|
||||
Group: Networking/IRC
|
||||
BuildRoot: %{_tmppath}/%{name}-buildroot
|
||||
Requires: perl, python, libgnutls
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
Requires: perl, python, gnutls
|
||||
License: GPL
|
||||
Distribution: Any RPM based distro
|
||||
Vendor: FlashCode <flashcode@flashtux.org>
|
||||
|
||||
%description
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a portable, fast, light and
|
||||
@@ -23,11 +25,13 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure --enable-perl --enable-python
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local"
|
||||
./configure --prefix=/usr --enable-perl --enable-python
|
||||
make
|
||||
|
||||
%install
|
||||
make DESTDIR="$RPM_BUILD_ROOT" LOCALRPM="local" install
|
||||
%makeinstall
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}/weechat/plugins/
|
||||
mv $RPM_BUILD_ROOT%{_libdir}/lib* $RPM_BUILD_ROOT%{_libdir}/weechat/plugins/
|
||||
|
||||
%find_lang %name
|
||||
|
||||
@@ -37,10 +41,19 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%files -f %{name}.lang
|
||||
%defattr(-,root,root,0755)
|
||||
%doc AUTHORS BUGS ChangeLog COPYING FAQ FAQ.fr INSTALL NEWS README TODO
|
||||
/usr/local/man/man1/weechat-curses.1*
|
||||
/usr/local/bin/weechat-curses
|
||||
%{_mandir}/man1/weechat-curses.1*
|
||||
%{_bindir}/weechat-curses
|
||||
%{_libdir}/weechat/plugins/*
|
||||
%{_infodir}/weechat_doc_en.info*
|
||||
%{_infodir}/weechat_doc_es.info*
|
||||
%{_infodir}/weechat_doc_fr.info*
|
||||
%{_infodir}/weechat_doc_pt.info*
|
||||
|
||||
%changelog
|
||||
* Fri Nov 11 2005 FlashCode <flashcode@flashtux.org> 0.1.6-1
|
||||
- Released version 0.1.6
|
||||
* Sat Sep 24 2005 FlashCode <flashcode@flashtux.org> 0.1.5-1
|
||||
- Released version 0.1.5
|
||||
* 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
|
||||
|
||||
+7
-13
@@ -14,7 +14,7 @@ Developers:
|
||||
AIM : FlashCode AIM
|
||||
Yahoo : FlashCode_Y
|
||||
|
||||
* Python plugin
|
||||
* Scripts plugins
|
||||
|
||||
Kolter <kolter@free.fr>
|
||||
Web : http://kolter.free.fr
|
||||
@@ -26,22 +26,16 @@ Debian packager:
|
||||
---------------
|
||||
|
||||
Julien Louis <ptitlouis@sysif.net>
|
||||
IRC : nicks are "ptitlouis" or "tioui" @ irc.freenode.net
|
||||
IRC : nick is "ptitlouis" @ irc.freenode.net
|
||||
Jabber: ptitlouis@amessage.info
|
||||
|
||||
|
||||
Testers:
|
||||
-------
|
||||
Contributors:
|
||||
------------
|
||||
|
||||
Bounga <bounga@altern.org>
|
||||
Web : http://bounga.ath.cx
|
||||
IRC : nick is "Bounga" @ irc.freenode.net
|
||||
Jabber: Bounga@jabber.org
|
||||
ICQ : 178297842
|
||||
|
||||
Xahlexx <xahlexx@weeland.org>
|
||||
Web : http://www.weeland.org
|
||||
IRC : nick is "xahlexx" @ irc.freenode.net
|
||||
Rudolf Polzer <rpolzer-rp@durchnull.de> (IRC: "divVerent")
|
||||
Jiri Golembiovsky <golemj@gmail.com> (IRC: "GolemJ")
|
||||
Jim Ramsay <i.am@jimramsay.com> (IRC: "lack")
|
||||
|
||||
|
||||
=====
|
||||
|
||||
+4
-3
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2005-07-30
|
||||
WeeChat known bugs, 2005-11-11
|
||||
|
||||
- some refresh bugs with splited windows
|
||||
- ./configure does not check that Ruby libraries are installed
|
||||
- ./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)
|
||||
- command name for /server can not contain spaces
|
||||
- wrong alias is not created and not saved when quitting WeeChat
|
||||
- when many WeeChat are launched, log file is not properly written (cleared by
|
||||
each WeeChat at startup)
|
||||
- display problems with old Konsole versions (Kde terminal) (???)
|
||||
- WeeChat may crash if too much nicks in nicklist when position is top or bottom
|
||||
|
||||
+50
-1
@@ -1,9 +1,58 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-07-30
|
||||
ChangeLog - 2005-11-11
|
||||
|
||||
|
||||
Version 0.1.6 (2005-11-11):
|
||||
* new color management system, IRC colors are now correctly
|
||||
displayed and can be removed by new options irc_colors_receive
|
||||
and irc_colors_send
|
||||
* fixed scroll problem when one line is bigger than screen size
|
||||
* added setting for having one server buffer for all servers
|
||||
(look_one_server_buffer)
|
||||
* added setting for ignoring some chars when completing nicks
|
||||
* fixed IRC message parser bug
|
||||
* signal SIGPIPE is now ignored
|
||||
* added partial match for highlights
|
||||
* added dcc_own_ip and dcc_port_range settings
|
||||
* full UTF-8 support, auto-detection of UTF-8 usage (locale)
|
||||
* added "Day changed to [date]" message when day changes
|
||||
* new plugin interface, rewritten from scratch: now loads dynamic C
|
||||
library, and perl/python are plugin scripts
|
||||
* log options (for server/channel/private) can now be set while
|
||||
WeeChat is running
|
||||
* added channel modes +e and +f
|
||||
* added some missing IRC commands, fixed command 367
|
||||
* added colors for input buffer and current channel of status bar
|
||||
* added online help for config options (with /set full_option_name)
|
||||
* enhanced "smart" hotlist, with names (new options:
|
||||
look_hotlist_names_{count|level|length})
|
||||
|
||||
Version 0.1.5 (2005-09-24):
|
||||
* added /ame command (send CTCP action to all channels of all
|
||||
connected servers)
|
||||
* added setting "irc_notice_as_pv" to see notices as pv
|
||||
* added nicks colors in setup file
|
||||
* fixed DCC bug: delete failed file only if really empty (on disk)
|
||||
* fixed IRC message parser bug
|
||||
* fixed scroll problem (screen moving when scrolling and new line
|
||||
displayed)
|
||||
* fixed infinite loop when scrolling back and displaying long lines
|
||||
* fixed crash when closing a buffer used by more than one window
|
||||
* added some missing IRC commands
|
||||
* fixed DCC display bug (now decodes string according to charset)
|
||||
* added /ignore and /unignore commands
|
||||
* fixed bug with strings comparison (str[n]casecmp) and some locales
|
||||
(like turkish), now using ASCII comparison (thanks to roktas)
|
||||
* signal SIGQUIT is now ignored
|
||||
* fixed refresh bug when one line is bigger than screen size
|
||||
* fixed look_nicklist_min_size and look_nicklist_max_size options
|
||||
* fixed refresh bug when changing channel modes
|
||||
* jump to next server now saves current channel buffer for each server
|
||||
* ctrl-up/ctrl-down keys added to call previous/next command in global
|
||||
history (common to all buffers)
|
||||
|
||||
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
|
||||
|
||||
+7
-8
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2005-07-30
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
Intended audience:
|
||||
@@ -76,11 +76,10 @@ A: For help you can type /help. For help about a command, type /help command.
|
||||
================================================================================
|
||||
Q: I don't see come chars with accents, what can I do?
|
||||
|
||||
A: You have to setup charset used for decoding, encoding, and internal WeeChat
|
||||
charset.
|
||||
Change value of option "look_charset_decode" to "UTF-8".
|
||||
Option "look_charset_internal" should not be changed (default is
|
||||
"ISO-8859-1").
|
||||
A: You have to setup charset used for decoding (ISO and UTF), encoding, and
|
||||
internal WeeChat charset.
|
||||
Internal charset should be empty value, except if WeeChat failed to
|
||||
detect your locale (WeeChat looks for "UTF-8" in your locale name).
|
||||
|
||||
|
||||
2.4
|
||||
@@ -195,5 +194,5 @@ A: There's many tasks to do (code, documentation, ...)
|
||||
================================================================================
|
||||
Q: Can I give money or other things to WeeChat developers?
|
||||
|
||||
A: Beer is welcome :)
|
||||
Otherwise Paypal account is: flashcode@free.fr (no limit for gifts :)
|
||||
A: You can give us money to help development.
|
||||
Details on http://weechat.flashtux.org/donate.php?lang=en
|
||||
|
||||
+8
-9
@@ -1,4 +1,4 @@
|
||||
WeeChat FAQ, 2005-07-30
|
||||
WeeChat FAQ, 2005-11-11
|
||||
=======================
|
||||
|
||||
Public concerné :
|
||||
@@ -80,11 +80,11 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande,
|
||||
================================================================================
|
||||
Q: Je ne vois pas bien certains accents dans WeeChat, que faire ?
|
||||
|
||||
R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que
|
||||
le charset interne Ă WeeChat.
|
||||
Modifiez la valeur de l'option "look_charset_decode" en "UTF-8".
|
||||
L'option "look_charset_internal" ne devrait pas être modifiée (par défaut
|
||||
"ISO-8859-1").
|
||||
R: Il faut configurer le charset utilisé pour le décodage (ISO et UTF),
|
||||
l'encodage ainsi que le charset interne Ă WeeChat.
|
||||
Le charset interne Ă WeeChat doit ĂŞtre une valeur vide, sauf si WeeChat
|
||||
n'arrive pas à déterminer votre locale (WeeChat recherche "UTF-8" dans
|
||||
le nom de la locale).
|
||||
|
||||
|
||||
2.4
|
||||
@@ -206,6 +206,5 @@ R: Il y a plusieurs choses
|
||||
================================================================================
|
||||
Q: Puis-je donner de l'argent ou d'autres choses aux développeurs WeeChat ?
|
||||
|
||||
R: La bière est la bienvenue :)
|
||||
Sinon le compte Paypal est: flashcode@free.fr (il n'y a pas de limite pour
|
||||
les dons :)
|
||||
R: Vous pouvez donner de l'argent pour aider le développement.
|
||||
Plus de détails sur http://weechat.flashtux.org/donate.php
|
||||
|
||||
+3
-3
@@ -19,10 +19,10 @@ SUBDIRS = po doc intl src
|
||||
|
||||
EXTRA_DIST = config.rpath BUGS FAQ FAQ.fr \
|
||||
debian/changelog debian/control \
|
||||
debian/copyright \
|
||||
debian/copyright debian/compat \
|
||||
debian/rules debian/weechat-common.docs \
|
||||
debian/weechat-common.install debian/weechat-curses.dirs \
|
||||
debian/weechat-curses.install debian/weechat-gtk.dirs \
|
||||
debian/weechat-gtk.install
|
||||
debian/weechat-curses.install \
|
||||
weechat_icon_32.png
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-11-11
|
||||
|
||||
WeeChat 0.1.6 released.
|
||||
|
||||
Important release notes:
|
||||
|
||||
- incompatibility with some old scripts: now all handlers have to return
|
||||
a code for completion, and to do some actions about message to ignore
|
||||
(please look at documentation for detail)
|
||||
|
||||
- on OpenBSD, the new option "plugins_extension" should be set to ".so.0.0"
|
||||
since the plugins names are ending by ".so.0.0" and not ".so"
|
||||
|
||||
- with new and full UTF-8 support, the option "look_charset_internal"
|
||||
should be set to blank for most cases. Forces it only if your locale is
|
||||
not properly detected by WeeChat (you can set "UTF-8" or "ISO-8859-15"
|
||||
for example, depending on your locale). WeeChat is looking for "UTF-8" in
|
||||
your locale name at startup.
|
||||
|
||||
* FlashCode, 2005-09-24
|
||||
|
||||
WeeChat 0.1.5 released.
|
||||
|
||||
* FlashCode, 2005-07-30
|
||||
|
||||
WeeChat 0.1.4 released.
|
||||
|
||||
+4
-4
@@ -12,10 +12,10 @@ Features
|
||||
* IRC chat client with multi-server connection
|
||||
* many GUI (curses, Gtk, Qt) (1)
|
||||
* small, fast and very light
|
||||
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
|
||||
* customizable and extensible with plugins (scripts Perl, Python, Ruby) (2)
|
||||
* compliant with RFC 1459,2810,2811,2812,2813
|
||||
* developed from scratch
|
||||
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
|
||||
* multi-platform (GNU/Linux, *BSD, Mac OS X, QNX, Windows & other) (3)
|
||||
* 100% GPL & free
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
---
|
||||
(1) only Curses interface is available today
|
||||
(2) only Perl and Python interfaces are available today
|
||||
(3) only GNU/Linux and *BSD versions are available today
|
||||
(2) only Perl and Python plugins are available today
|
||||
(3) Windows is under construction
|
||||
|
||||
+20
-33
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-07-20
|
||||
TODO - 2005-11-11
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,59 +10,46 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.1.4:
|
||||
------
|
||||
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
# Solaris version
|
||||
|
||||
* Interface:
|
||||
+ Gtk GUI
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
# SSL support
|
||||
# IPv6 protocol implementation
|
||||
# proxy support (http, socks4, socks5) with authentification
|
||||
(http, socks5) and ipv6 support (client to proxy)
|
||||
# highlight should not occur on partial words
|
||||
# one buffer for all servers
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- allow decode/encode charsets for servers or chan (not globally)
|
||||
# interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
? Qt GUI
|
||||
|
||||
* 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:
|
||||
---------------
|
||||
- host with "*" possible with /ignore command
|
||||
- "/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
|
||||
# "/uptime" command
|
||||
- "/upgrade" command: reload WeeChat himself without disconnecting from server
|
||||
|
||||
* IRC protocol:
|
||||
- customizable CTCP version reply
|
||||
- complete "/list" command: add regexp search, display only channels that
|
||||
match regexp
|
||||
- "/ignore" and "/unignore" commands: hide all that is write by a given
|
||||
nick/host
|
||||
- when we're away, WeeChat should log all the lines begenning by our nick.
|
||||
When we come back from our away it should print it to the current window
|
||||
- "/notify" and "/unnotify" command to be warn by WeeChat when a given
|
||||
nick/host connect to the given irc network
|
||||
|
||||
* WeeChat commands:
|
||||
- "/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
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
? Qt GUI
|
||||
* Configuration:
|
||||
- be able to launch more than one command when connecting to server
|
||||
|
||||
* Plugins:
|
||||
# dynamically load plugins as a separate library
|
||||
- allow print function to write on all buffers or all channels of a server
|
||||
- Ruby plugin
|
||||
- "/ruby load" and "/ruby unload" commands to (un)load Ruby scripts
|
||||
|
||||
@@ -6,6 +6,7 @@ cp Makefile.am Makefile.am.old
|
||||
gettextize --copy --force --intl --no-changelog &&
|
||||
mv Makefile.am.old Makefile.am
|
||||
mv configure.in.old configure.in
|
||||
libtoolize --automake --force --copy &&
|
||||
aclocal &&
|
||||
# autoheader creates config.h.in needed by autoconf
|
||||
autoheader &&
|
||||
|
||||
+201
-87
@@ -19,28 +19,42 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.4, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.6, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.4])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.6])
|
||||
|
||||
# Checks for programs.
|
||||
# Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# Add some flags for some OS
|
||||
case "$host_os" in
|
||||
freebsd* | openbsd*)
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
;;
|
||||
netbsd*)
|
||||
CFLAGS="$CFLAGS -I/usr/pkg/include"
|
||||
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr es"
|
||||
ALL_LINGUAS="fr es cs"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([ncurses], [initscr], LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
# Checks for libraries
|
||||
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
|
||||
AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0)
|
||||
|
||||
# Checks for header files.
|
||||
# Checks for header files
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
# Checks for typedefs, structures, and compiler characteristics
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
@@ -63,68 +77,87 @@ AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
# Variables in config.h
|
||||
|
||||
AH_VERBATIM([PREFIX], [#undef PREFIX])
|
||||
AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
|
||||
AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
|
||||
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
|
||||
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
|
||||
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
|
||||
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
|
||||
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
|
||||
AH_VERBATIM([DEBUG], [#undef DEBUG])
|
||||
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=auto)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets,[ --enable-wxwidgets Turn on WxWidgets interface (default=no)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=$enableval,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python plugins (default=no)],enable_python=$enableval,enable_python=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=auto)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
# Arguments for ./configure
|
||||
|
||||
enable_plugins="no"
|
||||
enable_ruby="no"
|
||||
RUBY_CFLAGS=
|
||||
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
|
||||
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
|
||||
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
|
||||
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
|
||||
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
|
||||
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
|
||||
AC_ARG_ENABLE(python, [ --enable-python Turn on Python script plugin (default=no Python plugin)],enable_python=$enableval,enable_python=no)
|
||||
AC_ARG_ENABLE(ruby, [ --enable-ruby Turn on Ruby script plugin (default=no Ruby script)],enable_ruby=$enableval,enable_ruby=no)
|
||||
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
|
||||
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
|
||||
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
|
||||
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
|
||||
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
|
||||
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
|
||||
AM_CONDITIONAL(PLUGINS, test "$enable_plugins" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
|
||||
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
|
||||
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# GUI
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([
|
||||
if test "$LIBNCURSESW_FOUND" = "0" ; then
|
||||
if test "$LIBNCURSES_FOUND" = "0" ; then
|
||||
AC_MSG_ERROR([
|
||||
*** ncurses library not found!
|
||||
*** Please install ncurses library or run ./configure with --disable-ncurses parameter.])
|
||||
fi
|
||||
AC_MSG_WARN([
|
||||
*** ncursesw library not found! Falling back to "ncurses"
|
||||
*** Be careful, UTF-8 display may not work properly if your locale is UTF-8.])
|
||||
NCURSES_LIBS="-lncurses"
|
||||
else
|
||||
NCURSES_LIBS="-lncursesw"
|
||||
AC_CHECK_HEADERS(ncursesw/curses.h)
|
||||
fi
|
||||
NCURSES_LIBS="-lncurses"
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
fi
|
||||
|
||||
if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
AM_OPTIONS_WXCONFIG
|
||||
AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
|
||||
if test "$wxWin" != 1; then
|
||||
AC_MSG_ERROR([
|
||||
*** wxWindows must be installed on your system
|
||||
*** but wx-config script couldn't be found.
|
||||
|
||||
*** Please check that wx-config is in path, the directory
|
||||
*** where wxWindows libraries are installed (returned by
|
||||
*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
*** equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
])
|
||||
fi
|
||||
|
||||
CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
|
||||
WXWIDGETS_CFLAGS=""
|
||||
WXWIDGETS_LIBS=""
|
||||
fi
|
||||
#if test "x$enable_wxwidgets" = "xyes" ; then
|
||||
# AM_OPTIONS_WXCONFIG
|
||||
# AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
#
|
||||
# if test "$wxWin" != 1; then
|
||||
# AC_MSG_ERROR([
|
||||
#*** wxWindows must be installed on your system
|
||||
#*** but wx-config script couldn't be found.
|
||||
#
|
||||
#*** Please check that wx-config is in path, the directory
|
||||
#*** where wxWindows libraries are installed (returned by
|
||||
#*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
#*** equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
# ])
|
||||
# fi
|
||||
#
|
||||
# CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
# CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
# CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
# LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
#
|
||||
# WXWIDGETS_CFLAGS=""
|
||||
# WXWIDGETS_LIBS=""
|
||||
#fi
|
||||
|
||||
if test "x$enable_gtk" = "xyes" ; then
|
||||
#if test "$LIBGTK_FOUND" = "0" ; then
|
||||
@@ -136,6 +169,10 @@ if test "x$enable_gtk" = "xyes" ; then
|
||||
AC_SUBST(GTK_LIBS)
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# plugins
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
PLUGINS_LIBS=
|
||||
|
||||
if test "x$enable_perl" = "xyes" ; then
|
||||
@@ -169,7 +206,7 @@ it with your software package manager.])
|
||||
PERL_LIB_TEST=`PT=perltest.c ; echo "int main() { return 0; }" > $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
|
||||
|
||||
if test "x$PERL_LIB_TEST" = "x0" ; then
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/perl/lib_weechat_perl.a `$PERL -MExtUtils::Embed -e ldopts`"
|
||||
PERL_LFLAGS=`$PERL -MExtUtils::Embed -e ldopts`
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Perl library couldn't be found in your system.
|
||||
@@ -178,6 +215,7 @@ it with your software package manager.])
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
AC_SUBST(PERL_CFLAGS)
|
||||
AC_SUBST(PERL_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PERL)
|
||||
fi
|
||||
|
||||
@@ -196,11 +234,11 @@ if test "x$enable_python" = "xyes" ; then
|
||||
|
||||
PYTHON_SYSPREFIX=`$PYTHON -c 'import sys; print "%s" % sys.prefix'`
|
||||
PYTHON_VERSION=`$PYTHON -c 'import sys ; print sys.version[[:3]]'`
|
||||
PYTHON_INCLUDE="$PYTHON_SYSPREFIX/include/python$PYTHON_VERSION"
|
||||
PYTHON_INCLUDE=`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python header files)
|
||||
if test -r "$PYTHON_INCLUDE/Python.h"; then
|
||||
PYTHON_CFLAGS=-I`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
|
||||
PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python header files couldn't be found in your system.
|
||||
@@ -208,11 +246,16 @@ if test "x$enable_python" = "xyes" ; then
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PYTHON_LIB="$PYTHON_SYSPREFIX/lib/python$PYTHON_VERSION/config"
|
||||
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
|
||||
PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('SYSLIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED')"`
|
||||
|
||||
AC_MSG_CHECKING(for Python library)
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so" -o -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-lpython$PYTHON_VERSION -lpthread -lutil"
|
||||
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
|
||||
elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
|
||||
PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** Python library couldn't be found in your system.
|
||||
@@ -220,17 +263,44 @@ if test "x$enable_python" = "xyes" ; then
|
||||
fi
|
||||
AC_MSG_RESULT(found)
|
||||
|
||||
PLUGINS_LIBS="$PLUGINS_LIBS ../../plugins/python/lib_weechat_python.a $PYTHON_LFLAGS"
|
||||
AC_SUBST(PYTHON_CFLAGS)
|
||||
AC_SUBST(PYTHON_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_PYTHON)
|
||||
fi
|
||||
|
||||
if test "x$enable_ruby" = "xyes" ; then
|
||||
enable_plugins="yes"
|
||||
|
||||
# TODO: check that ruby lib and headers are installed
|
||||
|
||||
RUBY_CFLAGS=-I`ruby -rrbconfig -e "puts Config::CONFIG[['archdir']]"`
|
||||
RUBY_LFLAGS=`ruby -rrbconfig -e "puts Config::CONFIG[['LIBRUBYARG_SHARED']]"`
|
||||
AC_SUBST(RUBY_CFLAGS)
|
||||
AC_SUBST(RUBY_LFLAGS)
|
||||
AC_DEFINE(PLUGIN_RUBY)
|
||||
fi
|
||||
|
||||
if test "x$enable_plugins" = "xyes" ; then
|
||||
AC_CHECK_FUNCS(dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" != "yes"; then
|
||||
AC_CHECK_LIB(dl, dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
|
||||
if test "$LIBDL_FOUND" = "yes"; then
|
||||
PLUGINS_LIBS="-ldl"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** "dl" library (dynamic library loader) couldn't be found in your system.
|
||||
*** Try to install it with your software package manager or disable plugins.])
|
||||
fi
|
||||
fi
|
||||
AC_DEFINE(PLUGINS)
|
||||
fi
|
||||
|
||||
AC_SUBST(PLUGINS_LIBS)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# gnutls
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$enable_gnutls" = "xyes" ; then
|
||||
found_gnutls="no"
|
||||
AM_PATH_LIBGNUTLS( 1.0.0, found_gnutls=yes, AC_MSG_WARN([[
|
||||
@@ -238,13 +308,38 @@ if test "x$enable_gnutls" = "xyes" ; then
|
||||
*** ftp://ftp.gnutls.org/pub/gnutls/
|
||||
*** WeeChat will be built without GnuTLS support.]]))
|
||||
if test "x$found_gnutls" = "xyes" ; then
|
||||
GNUTLS_LIBS="-lgnutls"
|
||||
AC_SUBST(GNUTLS_LIBS)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
GNUTLS_CFLAGS=`libgnutls-config --cflags`
|
||||
GNUTLS_LFLAGS=`libgnutls-config --libs`
|
||||
AC_SUBST(GNUTLS_CFLAGS)
|
||||
AC_SUBST(GNUTLS_LFLAGS)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
else
|
||||
enable_gnutls="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# general vars
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if test "x$prefix" = "xNONE" ; then
|
||||
prefix="$ac_default_prefix"
|
||||
fi
|
||||
|
||||
if test "x$exec_prefix" = "xNONE" ; then
|
||||
exec_prefix="$prefix"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
|
||||
|
||||
WEECHAT_LIBDIR=`eval echo ${libdir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_LIBDIR, "$WEECHAT_LIBDIR")
|
||||
|
||||
WEECHAT_SHAREDIR=`eval echo ${datadir}/weechat`
|
||||
AC_DEFINE_UNQUOTED(WEECHAT_SHAREDIR, "$WEECHAT_SHAREDIR")
|
||||
|
||||
weechat_libdir=${libdir}/weechat
|
||||
AC_SUBST(weechat_libdir)
|
||||
|
||||
CFLAGS=`echo $CFLAGS | sed s/-g//g`
|
||||
if test "x$CFLAGS" = "x" ; then
|
||||
@@ -260,9 +355,27 @@ if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
dnl For FreeBSD
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
|
||||
case "$host_os" in
|
||||
freebsd* | netbsd*)
|
||||
if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
CFLAGS="$CFLAGS $CPPFLAGS"
|
||||
;;
|
||||
openbsd*)
|
||||
if test "x$enable_python" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# output Makefiles
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
doc/Makefile
|
||||
@@ -270,8 +383,10 @@ AC_OUTPUT([Makefile
|
||||
src/common/Makefile
|
||||
src/irc/Makefile
|
||||
src/plugins/Makefile
|
||||
src/plugins/perl/Makefile
|
||||
src/plugins/python/Makefile
|
||||
src/plugins/scripts/Makefile
|
||||
src/plugins/scripts/perl/Makefile
|
||||
src/plugins/scripts/python/Makefile
|
||||
src/plugins/scripts/ruby/Makefile
|
||||
src/gui/Makefile
|
||||
src/gui/curses/Makefile
|
||||
src/gui/wxwidgets/Makefile
|
||||
@@ -280,8 +395,9 @@ AC_OUTPUT([Makefile
|
||||
intl/Makefile
|
||||
po/Makefile.in])
|
||||
|
||||
echo
|
||||
echo $PACKAGE $VERSION
|
||||
# ------------------------------------------------------------------------------
|
||||
# end message
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
listgui=
|
||||
if test "x$enable_ncurses" = "xyes" ; then
|
||||
@@ -312,19 +428,17 @@ if test "x$debug" = "x2" ; then
|
||||
msg_debug_verbose="yes"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo Interfaces.................... :$listgui
|
||||
echo
|
||||
echo Build with Plugin support..... : $enable_plugins
|
||||
echo Build with Perl support....... : $enable_perl
|
||||
echo Build with Python support..... : $enable_python
|
||||
echo Build with Ruby support....... : $enable_ruby
|
||||
echo Build with GNUtls support..... : $enable_gnutls
|
||||
echo
|
||||
echo Compile with debug info....... : $msg_debug_compiler
|
||||
echo Print debugging messages...... : $msg_debug_verbose
|
||||
echo
|
||||
eval eval echo WeeChat will be installed in $bindir.
|
||||
echo
|
||||
echo configure complete, now type \'make\' to build WeeChat
|
||||
echo
|
||||
echo ""
|
||||
echo "Interfaces.................................... :$listgui"
|
||||
echo "Build with GNUtls support..................... : $enable_gnutls"
|
||||
echo "Build with Plugin support..................... : $enable_plugins"
|
||||
echo " Perl plugin..................... : $enable_perl"
|
||||
echo " Python plugin................... : $enable_python"
|
||||
echo " Ruby plugin..................... : $enable_ruby"
|
||||
echo "Compile with debug info....................... : $msg_debug_compiler"
|
||||
echo "Print debugging messages...................... : $msg_debug_verbose"
|
||||
echo ""
|
||||
eval echo "WeeChat will be installed in $bindir."
|
||||
echo ""
|
||||
echo "configure complete, now type 'make' to build WeeChat $VERSION"
|
||||
echo ""
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
weechat (0.1.5-1) unstable; urgency=low
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 24 Sep 2005 14:08:55 +0200
|
||||
|
||||
weechat (0.1.4-2) unstable; urgency=low
|
||||
|
||||
* Add autotools-dev to Build-Depends.
|
||||
* update autotools stuff automatically to always
|
||||
have up-to-date config.{guess,sub}
|
||||
* Update Build-Depends: libgnutls11-dev -> libgnutls-dev
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Mon, 1 Aug 2005 11:46:39 +0200
|
||||
|
||||
weechat (0.1.4-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Julien Louis <ptitlouis@sysif.net> Sat, 30 Jul 2005 16:26:55 +0200
|
||||
|
||||
weechat (0.1.3-2) unstable; urgency=low
|
||||
|
||||
* Update config.{guess,sub} to fix FTBFS on k*BSD (Closes: #316791)
|
||||
|
||||
+23
-5
@@ -3,7 +3,7 @@ Section: net
|
||||
Priority: optional
|
||||
Maintainer: Sebastien Helleu <flashcode@flashtux.org>
|
||||
Uploaders: Julien Louis <ptitlouis@sysif.net>
|
||||
Build-Depends: debhelper (>> 4.0.0), libncurses5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls11-dev
|
||||
Build-Depends: debhelper (>> 4.0.0), libncursesw5-dev (>= 5.2.20020112a-7), libperl-dev, python-dev, libgnutls-dev, libtool, texinfo
|
||||
Standards-Version: 3.6.2.1
|
||||
|
||||
Package: weechat
|
||||
@@ -12,7 +12,16 @@ Depends: weechat-common (= ${Source-Version}), weechat-curses (= ${Source-Versio
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-curses
|
||||
Architecture: any
|
||||
@@ -20,12 +29,21 @@ Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
It is customizable and extensible with plugins/scripts, and includes:
|
||||
- nicklist
|
||||
- smart hotlist
|
||||
- infobar with highlight notification
|
||||
- horizontal and vertical split
|
||||
- double charset support (decode/encode)
|
||||
- FIFO pipe for remote control
|
||||
- and much more!
|
||||
.
|
||||
Homepage: http://weechat.flashtux.org/
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
Recommends: weechat-curses | weechat-gtk
|
||||
Recommends: weechat-curses
|
||||
Description: Common files for WeeChat
|
||||
Documentation, examples, and locale files for WeeChat - fast, light and
|
||||
extensible IRC client. It is useless without weechat-curses or weechat-gtk.
|
||||
extensible IRC client. It is useless without weechat-curses.
|
||||
|
||||
@@ -15,7 +15,7 @@ configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man \
|
||||
--enable-perl --enable-python
|
||||
--infodir=\$${prefix}/share/info --enable-perl --enable-python
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ binary-indep: build install
|
||||
dh_testroot -pweechat-common -pweechat
|
||||
dh_installchangelogs ChangeLog -pweechat-common
|
||||
dh_installdocs -pweechat-common
|
||||
dh_installinfo -pweechat-common
|
||||
dh_installexamples -pweechat-common
|
||||
dh_compress -pweechat-common -pweechat
|
||||
dh_link -pweechat usr/share/doc/weechat-common usr/share/doc/weechat
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
debian/tmp/usr/bin/weechat-curses
|
||||
debian/tmp/usr/lib/weechat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "July 2005" "FlashCode"
|
||||
.TH WEECHAT 1 "November 2005" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
|
||||
@@ -19,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a, \-\-no\-connect
|
||||
.br
|
||||
disable auto-connect to servers at startup
|
||||
.TP
|
||||
.B \-c, \-\-config
|
||||
.br
|
||||
display config file help (list of options)
|
||||
@@ -43,6 +47,10 @@ display default keys
|
||||
.br
|
||||
display program license
|
||||
.TP
|
||||
.B \-p, \-\-no\-plugin
|
||||
.br
|
||||
don't load any plugin at startup
|
||||
.TP
|
||||
.B \-v, \-\-version
|
||||
.br
|
||||
display WeeChat version
|
||||
|
||||
+1236
-249
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user