mirror of
https://github.com/weechat/weechat.git
synced 2026-06-23 03:16:37 +02:00
Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5074da156 | |||
| a23af790df | |||
| 6d1d1a7b90 | |||
| 0b78294f1a | |||
| 2580406aa7 | |||
| bbd4011020 | |||
| 1524432007 | |||
| 09242c3ba6 | |||
| bba97304a0 | |||
| 32851b7758 | |||
| 4322501ebd | |||
| 39d14185a1 | |||
| c3f5e88286 | |||
| 89c311646f | |||
| bcd4623a6d | |||
| 8270b50548 | |||
| 6e253245fe | |||
| 47d03e7dee | |||
| 9fbd33faaf | |||
| 5301c75021 | |||
| 7f165b4c7c | |||
| 9526e4a79d | |||
| 2b79d0fe5c | |||
| de43c7984a | |||
| f78eb88e5a | |||
| 4b5b5354da | |||
| ac446e9c1f | |||
| 951ec2e7be | |||
| bce7a0e961 | |||
| 7433015842 | |||
| 57daa68be5 | |||
| d310a8e960 | |||
| 4281d09a95 | |||
| 7dedba18bf | |||
| 90e4e34f8c | |||
| 12026ef17e | |||
| 46234f0504 | |||
| 4d4d697b17 | |||
| 3686d92cb5 | |||
| 64c33a8295 | |||
| 7596736ae9 | |||
| 8f55d297e6 | |||
| 5238dba084 | |||
| 81e700ea43 | |||
| a13f301d49 | |||
| 575565371b | |||
| 24d0c49ae4 | |||
| 559b651669 | |||
| 6199f9b629 | |||
| 6e60c95056 | |||
| 73f6606771 | |||
| e3088336ab | |||
| 3e81666752 | |||
| 6d0be7db4b | |||
| 5cdcfdebb7 | |||
| ca50f2c8fc | |||
| 84f84823c9 | |||
| 0d21ca207d | |||
| 235d96d728 | |||
| 58417dddc6 | |||
| b3d66118b4 | |||
| 0473d2c8db | |||
| 34ce958df9 |
@@ -1,9 +1,30 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-02-12
|
||||
ChangeLog - 2005-03-20
|
||||
|
||||
|
||||
Version 0.1.1 (2005-03-20):
|
||||
* added nicks count for channel buffers
|
||||
* added FIFO pipe for remote control
|
||||
* added crash dump when WeeChat receives SIGSEGV (Segmentation fault)
|
||||
* added new display engine: doesn't cut words at end of lines
|
||||
* added DCC send and DCC chat
|
||||
* added /halfop & /dehalfop commands, fixed halfop display bug in nicklist
|
||||
* added /ban, /unban and /kickban commands
|
||||
* added spanish translation
|
||||
* added --irc-commands and --weechat-commands command line options
|
||||
* connection to IRC server is now made by child process (non blocking)
|
||||
* added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
|
||||
* new key for window switch (now: F5/F6=switch buffer, F7/F8=switch window)
|
||||
* on server buffer, only server messages are logged
|
||||
* improved /help command output
|
||||
* plugins messages are logged with new config option (log_plugin_msg)
|
||||
* fixed /kick command
|
||||
* fixed /invite command (and now invite requests are displayed)
|
||||
* fixed /buffer close command (now ok when disconnected from server)
|
||||
* fixed display bugs when many windows are opened
|
||||
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-03-20
|
||||
|
||||
WeeChat 0.1.1 released.
|
||||
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-02-12
|
||||
TODO - 2005-03-20
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -16,10 +16,11 @@ v0.1.1:
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
- *BSD version
|
||||
+ *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
# "/dcc send" command
|
||||
# "/dcc chat" command (and incoming DCC chats)
|
||||
- customizable CTCP version reply
|
||||
|
||||
* Interface:
|
||||
@@ -27,7 +28,7 @@ v0.1.1:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
# connect to server with child process (background)
|
||||
|
||||
|
||||
Future versions:
|
||||
|
||||
+3
-5
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.0, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.1, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.0])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.1])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -30,7 +30,7 @@ AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr"
|
||||
ALL_LINGUAS="fr es"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
@@ -45,8 +45,6 @@ AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
weechat (0.1.1-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.1, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 20 Mar 2005 08:00:00 +0200
|
||||
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 12 Jan 2005 12:00:00 +0200.
|
||||
Sat, 20 Mar 2005 08:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
+5
-2
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# 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
|
||||
@@ -15,15 +15,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi weechat_doc_es.texi
|
||||
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
|
||||
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
|
||||
export LANG=es_ES && makeinfo --html --no-split --number-sections weechat_doc_es.texi
|
||||
export LANG=es_ES && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_es.texi >weechat_doc_es.txt
|
||||
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
|
||||
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
|
||||
export LANG=en_EN && texi2pdf weechat_doc_en.texi
|
||||
export LANG=es_ES && texi2pdf weechat_doc_es.texi
|
||||
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
|
||||
|
||||
clean:
|
||||
|
||||
+552
-22
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.0 - February, 12 2005
|
||||
@subtitle Documentation for WeeChat v0.1.1 - March, 20 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
This manual documents WeeChat IRC client, it is part of WeeChat.@*
|
||||
@*
|
||||
Latest version of this document can be found on this page:@*
|
||||
@uref{http://weechat.flashtux.org/doc.php?lang=en}@*
|
||||
@uref{http://weechat.flashtux.org/doc.php}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@@ -209,6 +209,7 @@ Then follow instructions for source package - @xref{Source package}.
|
||||
* Config file::
|
||||
* Key bindings::
|
||||
* WeeChat commands::
|
||||
* FIFO pipe::
|
||||
@end menu
|
||||
|
||||
@node Run WeeChat, Config file, Usage, Usage
|
||||
@@ -244,9 +245,10 @@ set parameters with @kbd{/set} command in WeeChat - @xref{WeeChat commands}.
|
||||
@node Config file, Key bindings, Run WeeChat, Usage
|
||||
@section Config file
|
||||
|
||||
Here is a list of all options for config file:@*
|
||||
List of options for config file:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item look_set_title
|
||||
Set title for window (terminal for Curses GUI) with name & version@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -261,10 +263,13 @@ WeeChat slogan (if empty, slogan is not used)@*
|
||||
Type: string (any string), default value: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
Type: string (any string), default value: 'UTF-8'@*
|
||||
@item look_charset_encode
|
||||
Charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_charset_internal
|
||||
Internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: 'ISO-8859-1'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -394,6 +399,12 @@ Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_away
|
||||
Color for away nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_nick_chanowner
|
||||
Color for chan owner symbol (specific to unrealircd)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_nick_chanadmin
|
||||
Color for chan admin symbol (specific to unrealircd)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_nick_op
|
||||
Color for operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@@ -420,7 +431,7 @@ Color for selected DCC (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Color for "waiting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
|
||||
@item col_dcc_connecting
|
||||
Color for "connecting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@@ -451,6 +462,9 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_private
|
||||
Automatically log private chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_plugin_msg
|
||||
Log messages from plugins (scripts)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_path
|
||||
Path for WeeChat log files@*
|
||||
Type: string (any string), default value: '~/.weechat/logs/'@*
|
||||
@@ -474,7 +488,7 @@ Default quit message ('%v' will be replaced by WeeChat version in string)@*
|
||||
Type: string (any string), default value: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Interval between two checks for away (in minutes, 0 = never check)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 0@*
|
||||
@item irc_lag_check
|
||||
Interval between two checks for lag (in seconds)@*
|
||||
Type: integer (values: between 30 and 2147483647), default value: 60@*
|
||||
@@ -489,19 +503,22 @@ Automatically accept incoming dcc files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Automatically accept dcc chats (use carefully!)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item dcc_timeout
|
||||
Timeout for dcc request (in seconds)@*
|
||||
Type: integer (values: between 1 and 2147483647), default value: 300@*
|
||||
@item dcc_blocksize
|
||||
Block size for dcc packets in bytes (default: 1024)@*
|
||||
Type: integer (values: between 1024 and 102400), default value: 1024@*
|
||||
Block size for dcc packets in bytes (default: 65536)@*
|
||||
Type: integer (values: between 1024 and 102400), default value: 65536@*
|
||||
@item dcc_download_path
|
||||
Path for writing incoming files with dcc (default: user home)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_upload_path
|
||||
Path for reading files when sending thru dcc (when no path is specified)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_convert_spaces
|
||||
Convert spaces to underscores when sending files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item dcc_auto_rename
|
||||
Rename incoming files if already exists (add '.1', '.2', ...)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -530,7 +547,7 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Automatically reconnect to server when disconnected@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_autoreconnect_delay
|
||||
Delay (in deconds) before trying again to reconnect to server@*
|
||||
Delay (in seconds) before trying again to reconnect to server@*
|
||||
Type: integer (values: between 0 and 65535), default value: 30@*
|
||||
@item server_address
|
||||
IP address or hostname of IRC server@*
|
||||
@@ -568,6 +585,7 @@ Type: string (any string), default value: ''@*
|
||||
@item server_autorejoin
|
||||
Automatically rejoin channels when kicked@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@@ -641,11 +659,11 @@ Call again last commands/messages@*
|
||||
@item PageUp / PageDown
|
||||
Show buffer history@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
@item F5 / F6
|
||||
Switch to previous / next buffer@*
|
||||
@*
|
||||
@item F8
|
||||
Switch to next window@*
|
||||
@item F7 / F8
|
||||
Switch to previous / next window@*
|
||||
@*
|
||||
@item F10
|
||||
Remove last infobar message@*
|
||||
@@ -654,7 +672,7 @@ Remove last infobar message@*
|
||||
Redraw whole window@*
|
||||
@*
|
||||
@item Alt + left arrow / Alt + right arrow
|
||||
Same as F6 / F7@*
|
||||
Same as F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Switch to next buffer with activity (with priority: highlight, message, other)@*
|
||||
@@ -676,10 +694,528 @@ Switch to buffer by number@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node WeeChat commands, , Key bindings, Usage
|
||||
@node WeeChat commands, FIFO pipe, Key bindings, Usage
|
||||
@section WeeChat commands
|
||||
|
||||
NOT WRITTEN!
|
||||
WeeChat internal commands:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item alias [alias_name [command [arguments]]
|
||||
@*
|
||||
create an alias for a command@*
|
||||
@*
|
||||
alias_name: name of alias@*
|
||||
command: command name (WeeChat or IRC command, without first '/')@*
|
||||
arguments: arguments for command@*
|
||||
@*
|
||||
@item buffer [action | number]
|
||||
@*
|
||||
manage buffers@*
|
||||
@*
|
||||
action: action to do:@*
|
||||
move: move buffer in the list (may be relative, for example -1)@*
|
||||
close: close buffer (for channel: same as /part without part message)@*
|
||||
list: list opened buffers (no parameter implies this list)@*
|
||||
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
@*
|
||||
-all: clear all windows@*
|
||||
@*
|
||||
@item connect [servername]
|
||||
@*
|
||||
connect to a server@*
|
||||
@*
|
||||
servername: server name to connect@*
|
||||
@*
|
||||
@item disconnect [servername]
|
||||
@*
|
||||
disconnect from a server@*
|
||||
@*
|
||||
servername: server name to disconnect@*
|
||||
@*
|
||||
@item debug dump
|
||||
@*
|
||||
print debug messages@*
|
||||
@*
|
||||
dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)@*
|
||||
@*
|
||||
@item help [command]
|
||||
@*
|
||||
display help about commands@*
|
||||
@*
|
||||
command: name of a WeeChat or IRC command@*
|
||||
@*
|
||||
@item perl [load filename] | [autoload] | [unload]
|
||||
@*
|
||||
list/load/unload Perl scripts@*
|
||||
@*
|
||||
filename: Perl script (file) to load@*
|
||||
Without argument, /perl command lists all loaded Perl scripts.@*
|
||||
@*
|
||||
@item server [servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-command command] [-autojoin channel[,channel]] ] | [del servername]
|
||||
@*
|
||||
list, add or remove servers@*
|
||||
@*
|
||||
servername: server name, for internal & display use@*
|
||||
hostname: name or IP address of server@*
|
||||
port: port for server (integer)@*
|
||||
password: password for server@*
|
||||
nick1: first nick for server@*
|
||||
nick2: alternate nick for server@*
|
||||
nick3: second alternate nick for server@*
|
||||
username: user name@*
|
||||
realname: real name of user@*
|
||||
@*
|
||||
@item save [file]
|
||||
@*
|
||||
save config to disk@*
|
||||
@*
|
||||
file: filename for writing config@*
|
||||
@*
|
||||
@item set [option[=value]]
|
||||
@*
|
||||
set config parameters@*
|
||||
@*
|
||||
option: name of an option@*
|
||||
value: value for option@*
|
||||
@*
|
||||
@item unalias alias_name
|
||||
@*
|
||||
remove an alias@*
|
||||
@*
|
||||
alias_name: name of alias to remove@*
|
||||
@*
|
||||
@item window [list | splith | splitv | [merge [down | up | left | right | all]]]
|
||||
@*
|
||||
manage windows@*
|
||||
@*
|
||||
list: list opened windows (no parameter implies this list)@*
|
||||
splith: split current window horizontally@*
|
||||
splitv: split current window vertically@*
|
||||
merge: merge window with another@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
IRC commands:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item admin [target]
|
||||
@*
|
||||
find information about the administrator of the server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item away [-all] [message]
|
||||
@*
|
||||
toggle away status@*
|
||||
@*
|
||||
-all: toggle away status on all connected servers@*
|
||||
message: message for away (if no message is given, away status is removed)@*
|
||||
@*
|
||||
@item ban [channel] [nickname [nickname ...]]
|
||||
@*
|
||||
bans nicks or hosts@*
|
||||
@*
|
||||
channel: channel for ban@*
|
||||
nickname: user or host to ban@*
|
||||
@*
|
||||
@item ctcp nickname type
|
||||
@*
|
||||
send a ctcp message@*
|
||||
@*
|
||||
nickname: user to send ctcp to@*
|
||||
type: "action" or "version"@*
|
||||
@*
|
||||
@item dcc action [nickname [file]]
|
||||
@*
|
||||
starts DCC (file or chat) or close chat@*
|
||||
@*
|
||||
action: 'send' (file) or 'chat' or 'close' (chat)@*
|
||||
nickname: nickname to send file or chat@*
|
||||
file: filename (on local host)@*
|
||||
@*
|
||||
@item dehalfop nickname [nickname]
|
||||
@*
|
||||
removes half channel operator status from nickname(s)@*
|
||||
@*
|
||||
@item deop nickname [nickname]
|
||||
@*
|
||||
removes channel operator status from nickname(s)@*
|
||||
@*
|
||||
@item devoice nickname [nickname]
|
||||
@*
|
||||
removes voice from nickname(s)@*
|
||||
@*
|
||||
@item die
|
||||
@*
|
||||
shutdown the server@*
|
||||
@*
|
||||
@item halfop nickname [nickname]
|
||||
@*
|
||||
gives half channel operator status to nickname(s)@*
|
||||
@*
|
||||
@item info [target]
|
||||
@*
|
||||
get information describing the server@*
|
||||
@*
|
||||
target: server name@*
|
||||
@*
|
||||
@item invite nickname channel
|
||||
@*
|
||||
invite a nick on a channel@*
|
||||
@*
|
||||
nickname: nick to invite@*
|
||||
channel: channel to invite@*
|
||||
@*
|
||||
@item ison nickname [nickname ...]
|
||||
@*
|
||||
check if a nickname is currently on IRC@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item join channel[,channel] [key[,key]]
|
||||
@*
|
||||
join a channel@*
|
||||
@*
|
||||
channel: channel name to join@*
|
||||
key: key to join the channel@*
|
||||
@*
|
||||
@item kick [channel] nickname [comment]
|
||||
@*
|
||||
forcibly remove a user from a channel@*
|
||||
@*
|
||||
channel: channel where user is@*
|
||||
nickname: nickname to kick@*
|
||||
comment: comment for kick@*
|
||||
@*
|
||||
@item kickban [channel] nickname [comment]
|
||||
@*
|
||||
kicks and bans a nick from a channel@*
|
||||
@*
|
||||
channel: channel where user is@*
|
||||
nickname: nickname to kick and ban@*
|
||||
comment: comment for kick@*
|
||||
@*
|
||||
@item kill nickname comment
|
||||
@*
|
||||
close client-server connection@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
comment: comment for kill@*
|
||||
@*
|
||||
@item links [[server] server_mask]
|
||||
@*
|
||||
list all servernames which are known by the server answering the query@*
|
||||
@*
|
||||
server: this server should answer the query@*
|
||||
server_mask: list of servers must match this mask@*
|
||||
@*
|
||||
@item list [channel[,channel] [server]]
|
||||
@*
|
||||
list channels and their topic@*
|
||||
@*
|
||||
channel: channel to list@*
|
||||
server: server name@*
|
||||
@*
|
||||
@item lusers [mask [target]]
|
||||
@*
|
||||
get statistics about the size of the IRC network@*
|
||||
@*
|
||||
mask: servers matching the mask only@*
|
||||
target: server for forwarding request@*
|
||||
@*
|
||||
@item me message
|
||||
@*
|
||||
send a ctcp action to the current channel@*
|
||||
@*
|
||||
message: message to send@*
|
||||
@*
|
||||
@item mode @{ channel @{[+|-]|o|p|s|i|t|n|b|v@} [limit] [user] [ban mask] @} | @{ nickname @{[+|-]|i|w|s|o@} @}
|
||||
@*
|
||||
change channel or user mode@*
|
||||
@*
|
||||
channel modes:@*
|
||||
channel: channel name to modify@*
|
||||
o: give/take channel operator privileges@*
|
||||
p: private channel flag@*
|
||||
s: secret channel flag@*
|
||||
i: invite-only channel flag@*
|
||||
t: topic settable by channel operator only flag@*
|
||||
n: no messages to channel from clients on the outside@*
|
||||
m: moderated channel@*
|
||||
l: set the user limit to channel@*
|
||||
b: set a ban mask to keep users out@*
|
||||
v: give/take the ability to speak on a moderated channel@*
|
||||
k: set a channel key (password)@*
|
||||
user modes:@*
|
||||
nickname: nickname to modify@*
|
||||
i: mark a user as invisible@*
|
||||
s: mark a user for receive server notices@*
|
||||
w: user receives wallops@*
|
||||
o: operator flag@*
|
||||
@*
|
||||
@item motd [target]
|
||||
@*
|
||||
get the "Message Of The Day"@*
|
||||
@*
|
||||
target: server name@*
|
||||
@*
|
||||
@item msg receiver[,receiver] text
|
||||
@*
|
||||
send message to a nick or channel@*
|
||||
@*
|
||||
receiver: nick or channel (may be mask, '*' = current channel)@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item names [channel[,channel]]
|
||||
@*
|
||||
list nicknames on channels@*
|
||||
@*
|
||||
channel: channel name@*
|
||||
@*
|
||||
@item nick nickname
|
||||
@*
|
||||
change current nickname@*
|
||||
@*
|
||||
nickname: new nickname for current IRC server@*
|
||||
@*
|
||||
@item notice nickname text
|
||||
@*
|
||||
send notice message to user@*
|
||||
@*
|
||||
nickname: user to send notice to@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item op nickname [nickname]
|
||||
@*
|
||||
gives channel operator status to nickname(s)@*
|
||||
@*
|
||||
@item oper user password
|
||||
@*
|
||||
get operator privileges@*
|
||||
@*
|
||||
user/password: used to get privileges on current IRC server@*
|
||||
@*
|
||||
@item part [channel[,channel]] [part_message]
|
||||
@*
|
||||
leave a channel@*
|
||||
@*
|
||||
channel: channel name to leave@*
|
||||
part_message: part message (displayed to other users)@*
|
||||
@*
|
||||
@item ping server1 [server2]
|
||||
@*
|
||||
ping server@*
|
||||
@*
|
||||
server1: server to ping@*
|
||||
server2: forward ping to this server@*
|
||||
@*
|
||||
@item pong daemon [daemon2]
|
||||
@*
|
||||
answer to a ping message@*
|
||||
@*
|
||||
daemon: daemon who has responded to Ping message@*
|
||||
daemon2: forward message to this daemon@*
|
||||
@*
|
||||
@item query nickname [text]
|
||||
@*
|
||||
send a private message to a nick@*
|
||||
@*
|
||||
nickname: nickname for private conversation@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item quit [quit_message]
|
||||
@*
|
||||
close all connections & quit@*
|
||||
@*
|
||||
quit_message: quit message (displayed to other users)@*
|
||||
@*
|
||||
@item quote data
|
||||
@*
|
||||
send raw data to server without parsing@*
|
||||
@*
|
||||
data: raw data to send@*
|
||||
@*
|
||||
@item rehash
|
||||
@*
|
||||
tell the server to reload its config file@*
|
||||
@*
|
||||
@item restart
|
||||
@*
|
||||
tell the server to restart itself@*
|
||||
@*
|
||||
@item service nickname reserved distribution type reserved info
|
||||
@*
|
||||
register a new service@*
|
||||
@*
|
||||
distribution: visibility of service@*
|
||||
type: reserved for future usage@*
|
||||
@*
|
||||
@item servlist [mask [type]]
|
||||
@*
|
||||
list services currently connected to the network@*
|
||||
@*
|
||||
mask: list only services matching this mask@*
|
||||
type: list only services of this type@*
|
||||
@*
|
||||
@item squery service text
|
||||
@*
|
||||
deliver a message to a service@*
|
||||
@*
|
||||
service: name of service@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item squit server comment
|
||||
@*
|
||||
disconnect server links@*
|
||||
@*
|
||||
server: server name@*
|
||||
comment: comment for quit@*
|
||||
@*
|
||||
@item stats [query [server]]
|
||||
@*
|
||||
query statistics about server@*
|
||||
@*
|
||||
query: c/h/i/k/l/m/o/y/u (see RFC1459)@*
|
||||
server: server name@*
|
||||
@*
|
||||
@item summon user [target [channel]]
|
||||
@*
|
||||
give users who are on a host running an IRC server a message asking them to please join IRC@*
|
||||
@*
|
||||
user: username@*
|
||||
target: server name@*
|
||||
channel: channel name@*
|
||||
@*
|
||||
@item time [target]
|
||||
@*
|
||||
query local time from server@*
|
||||
@*
|
||||
target: query time from specified server@*
|
||||
@*
|
||||
@item topic [channel] [topic]
|
||||
@*
|
||||
get/set channel topic@*
|
||||
@*
|
||||
channel: channel name@*
|
||||
topic: new topic for channel (if topic is "-delete" then topic is deleted)@*
|
||||
@*
|
||||
@item trace [target]
|
||||
@*
|
||||
find the route to specific server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item unban [channel] nickname [nickname ...]
|
||||
@*
|
||||
unbans nicks or hosts@*
|
||||
@*
|
||||
channel: channel for unban@*
|
||||
nickname: user or host to unban@*
|
||||
@*
|
||||
@item userhost nickname [nickname ...]
|
||||
@*
|
||||
return a list of information about nicknames@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item users [target]
|
||||
@*
|
||||
list of users logged into the server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item version [server | nickname]
|
||||
@*
|
||||
gives the version info of nick or server (current or specified)@*
|
||||
@*
|
||||
server: server name@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item voice nickname [nickname]
|
||||
@*
|
||||
gives voice to nickname(s)@*
|
||||
@*
|
||||
@item wallops text
|
||||
@*
|
||||
send a message to all currently connected users who have set the 'w' user mode for themselves@*
|
||||
@*
|
||||
text to send@*
|
||||
@*
|
||||
@item who [mask ["o"]]
|
||||
@*
|
||||
generate a query which returns a list of information@*
|
||||
@*
|
||||
mask: only information which match this mask@*
|
||||
o: only operators are returned according to the mask supplied@*
|
||||
@*
|
||||
@item whois [server] nickname[,nickname]
|
||||
@*
|
||||
query information about user(s)@*
|
||||
@*
|
||||
server: server name@*
|
||||
nickname: nickname (may be a mask)@*
|
||||
@*
|
||||
@item whowas nickname [,nickname [,nickname ...]] [count [target]]
|
||||
@*
|
||||
ask for information about a nickname which no longer exists@*
|
||||
@*
|
||||
nickname: nickname to search@*
|
||||
count: number of replies to return (full search if negative number)@*
|
||||
target: reply should match this mask@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
@node FIFO pipe, , WeeChat commands, Usage
|
||||
@section FIFO pipe
|
||||
|
||||
You can remote control WeeChat, by sending commands or text to a FIFO pipe
|
||||
(you have to enable option "irc_fifo_pipe", it is disabled by default).@*
|
||||
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx"
|
||||
(where xxxxx is the process ID (PID) of running WeeChat).@*
|
||||
So if many WeeChat are running, you have many FIFO pipe, one for each session.@*
|
||||
@*
|
||||
The syntax for the FIFO pipe commands/text is:@*
|
||||
@command{server,channel *text or command here}@*
|
||||
where server and channel are optional, but if channel is here, server should be too.@*
|
||||
@*
|
||||
Some examples:
|
||||
@table @asis
|
||||
@item @bullet{} change your nick on freenode to "mynick|out":
|
||||
@*
|
||||
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on #weechat channel:
|
||||
@*
|
||||
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
|
||||
@*
|
||||
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
|
||||
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
You can write a script to send command to all running WeeChat at same time, for example:@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
If the script is called "auto_weechat_command", you can run it with:@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *hello"}
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
@@ -896,12 +1432,6 @@ WeeChat is developed by:@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+554
-20
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.0 - 12 F@'evrier 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.1 - 20 Mars 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -209,6 +209,7 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
|
||||
* Fichier de configuration::
|
||||
* Raccourcis clavier::
|
||||
* Commandes WeeChat::
|
||||
* Tube FIFO::
|
||||
@end menu
|
||||
|
||||
@node Lancer WeeChat, Fichier de configuration, Utilisation, Utilisation
|
||||
@@ -247,6 +248,7 @@ vous pouvez modifier les param@`etres dans WeeChat avec la commande @kbd{/set} -
|
||||
Liste des options du fichier de configuration :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item look_set_title
|
||||
D@'efinit le titre de la fen@^etre (terminal pour l'interface Curses) avec le nom et la version@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -261,10 +263,13 @@ Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Jeu de caract@`eres pour d@'ecoder les messages du serveur, exemples: UTF-8, ISO-8859-1 (si non renseign@'e, les messages ne sont pas convertis)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'UTF-8'@*
|
||||
@item look_charset_encode
|
||||
Jeu de caract@`eres pour encoder les messages envoy@'es au serveur, exemples: UFT-8, ISO-8859-1 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_charset_internal
|
||||
Jeu de caract@`eres interne @`a WeeChat, devrait @^etre ISO-xxxx m@^eme si la locale est UTF-8 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'ISO-8859-1'@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -394,6 +399,12 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_away
|
||||
Couleur pour les pseudos absents@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_nick_chanowner
|
||||
Couleur pour le symbole du propri@'etaire du canal (sp@'ecifique @`a unrealircd)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_nick_chanadmin
|
||||
Couleur pour le symbole administrateur du canal (sp@'ecifique @`a unrealircd)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_nick_op
|
||||
Couleur pour le symbole op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@@ -420,7 +431,7 @@ Couleur pour le DCC s@'electionn@'e (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Couleur pour le statut dcc "attente"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
|
||||
@item col_dcc_connecting
|
||||
Couleur pour le statut dcc "connexion"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@@ -451,6 +462,9 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_private
|
||||
Enregistrer automatiquement les conversations priv@'ees@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_plugin_msg
|
||||
Enregistrer les messages des plugins (scripts)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_path
|
||||
Chemin pour les conversations sauvegard@'ees par WeeChat@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
|
||||
@@ -474,7 +488,7 @@ Message de fin par d@'efaut ('%v' sera remplac@'e par la version de WeeChat dans
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Intervalle entre deux v@'erifications des absences (en minutes, 0 = ne jemais v@'erifier)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 0@*
|
||||
@item irc_lag_check
|
||||
Intervalle entre deux mesures de lag (en secondes)@*
|
||||
Type: entier (valeurs: entre 30 et 2147483647), valeur par d@'efaut: 60@*
|
||||
@@ -484,24 +498,30 @@ Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_disconnect
|
||||
D@'econnexion apr@`es un lag important (en minutes, 0 = ne jamais se d@'econnecter)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 5@*
|
||||
@item irc_fifo_pipe
|
||||
Cr@'eer un tube FIFO pour le contr@^ole @`a distance@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_auto_accept_files
|
||||
Accepte automatiquement les fichiers dcc entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Accepte automatiquement les demandes de discussion dcc (@`a utiliser avec pr@'ecaution !)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_timeout
|
||||
D@'elai d'attente pour les requ@^etes dcc (en secondes)@*
|
||||
Type: entier (valeurs: entre 1 et 2147483647), valeur par d@'efaut: 300@*
|
||||
@item dcc_blocksize
|
||||
Taille de bloc pour les paquets dcc en octets (d@'efaut: 1024)@*
|
||||
Type: entier (valeurs: entre 1024 et 102400), valeur par d@'efaut: 1024@*
|
||||
Taille de bloc pour les paquets dcc en octets (d@'efaut: 65536)@*
|
||||
Type: entier (valeurs: entre 1024 et 102400), valeur par d@'efaut: 65536@*
|
||||
@item dcc_download_path
|
||||
Chemin pour @'ecrire les fichiers re@,{c}us par dcc (par d@'efaut: r@'epertoire de l'utilisateur)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_upload_path
|
||||
Chemin pour lire les fichiers lorsqu'ils sont envoy@'es par dcc (quand aucun chemin n'est sp@'ecifi@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_convert_spaces
|
||||
Convertir les espaces en underscores lors d'envoi de fichiers@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item dcc_auto_rename
|
||||
Renommer les fichiers re@,{c}us s'ils existent d@'ej@`a (ajoute '.1', '.2', ...)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -568,6 +588,7 @@ Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_autorejoin
|
||||
Rejoindre automatiquement les canaux quand mis dehors@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
|
||||
@end table
|
||||
|
||||
Les couleurs pour l'interface Curses sont :@*
|
||||
@@ -641,11 +662,11 @@ Rappeler les derni@`eres commandes/messages@*
|
||||
@item PageUp / PageDown
|
||||
Afficher l'historique du tampon@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Aller au tampon pr@'ec@'edent@*
|
||||
@item F5 / F6
|
||||
Aller au tampon pr@'ec@'edent / suivant@*
|
||||
@*
|
||||
@item F8
|
||||
Aller @`a la fen@^etre suivante@*
|
||||
@item F7 / F8
|
||||
Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
|
||||
@*
|
||||
@item F10
|
||||
Effacer le dernier message de la barre d'infos@*
|
||||
@@ -654,7 +675,7 @@ Effacer le dernier message de la barre d'infos@*
|
||||
R@'eaffiche toute la fen@^etre@*
|
||||
@*
|
||||
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||
Identique @`a F6 / F7@*
|
||||
Identique @`a F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
|
||||
@@ -676,10 +697,529 @@ Sauter au tampon avec ce num@'ero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
|
||||
@node Commandes WeeChat, Tube FIFO, Raccourcis clavier, Utilisation
|
||||
@section Commandes WeeChat
|
||||
|
||||
NON ECRIT !
|
||||
Commandes internes WeeChat :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item alias [nom_alias [commande [param@`etres]]
|
||||
@*
|
||||
cr@'eer un alias pour une commande@*
|
||||
@*
|
||||
nom_alias: nom de l'alias@*
|
||||
commande: nom de la commande (commande WeeChat ou IRC, sans le premier '/')@*
|
||||
param@`etres: param@`etres pour la commande@*
|
||||
@*
|
||||
@item buffer [action | nombre]
|
||||
@*
|
||||
gestion des buffers@*
|
||||
@*
|
||||
action: action @`a effectuer:@*
|
||||
move: d@'eplacer le tampon dans la liste (peut @^etre relatif, par exemple -1)@*
|
||||
close: fermer le tampon (pour un canal: @'equivalent @`a /part sans message de fin)@*
|
||||
list: liste les tampons ouverts (pas de param@`etre affiche cette liste)@*
|
||||
notify: fixer le niveau de notification (0=jamais, 1=highlight, 2=1+msg, 3=2+join/part)@*
|
||||
nombre: sauter au tampon qui a ce num@'ero@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
affacer la/les fen@^etre(s)@*
|
||||
@*
|
||||
-all: effacer toutes les fen@^etres@*
|
||||
@*
|
||||
@item connect [nom_serveur]
|
||||
@*
|
||||
se connecter @`a un serveur@*
|
||||
@*
|
||||
nom_serveur: nom du serveur pour se connecter@*
|
||||
@*
|
||||
@item disconnect [nom_serveur]
|
||||
@*
|
||||
se d@'econnecter d'un serveur@*
|
||||
@*
|
||||
nom_serveur: nom du serveur pour se d@'econnecter@*
|
||||
@*
|
||||
@item debug dump
|
||||
@*
|
||||
affiche des messages de debuggage@*
|
||||
@*
|
||||
dump: affiche les variables m@'emoire WeeChat dans le fichier log (les m@^emes messages sont affich@'es lorsque WeeChat plante)@*
|
||||
@*
|
||||
@item help [commande]
|
||||
@*
|
||||
afficher l'aide sur les commandes@*
|
||||
@*
|
||||
commande: nom d'une commande WeeChat ou IRC@*
|
||||
@*
|
||||
@item perl [load fichier] | [autoload] | [unload]
|
||||
@*
|
||||
liste/charge/d@'echarge des scripts Perl@*
|
||||
@*
|
||||
fichier: script Perl (fichier) @`a charger@*
|
||||
Sans param@`etre, la commande /perl liste tous les scripts Perl charg@'es.@*
|
||||
@*
|
||||
@item server [nom_serveur] | [nom_serveur nom/IP port [-auto | -noauto] [-pwd mot_de_passe] [-nicks pseudo1 [pseudo2 [pseudo3]]] [-username nom_utilisateur] [-realname nom_r@'eel] [-command commande] [-autojoin canal[,canal]] ] | [del nom_serveur]
|
||||
@*
|
||||
liste, ajoute ou retire des serveurs@*
|
||||
@*
|
||||
nom_serveur: nom du serveur, pour usage interne et affichage@*
|
||||
nom/IP: nom ou adresse IP du serveur@*
|
||||
port: port pour le serveur (nombre entier)@*
|
||||
mot_de_passe: mot de passe pour le serveur@*
|
||||
pseudo1: premier pseudo pour le serveur@*
|
||||
pseudo2: pseudo alternatif pour le serveur@*
|
||||
pseudo3: second pseudo alternatif pour le serveur@*
|
||||
nom_utilisateur: nom d'utilisateur@*
|
||||
nom_r@'eel: nom r@'eel de l'utilisateur@*
|
||||
@*
|
||||
@item save [fichier]
|
||||
@*
|
||||
sauvegarder la configuration sur disque@*
|
||||
@*
|
||||
fichier: fichier pour sauvegarder la configuration@*
|
||||
@*
|
||||
@item set [option[=valeur]]
|
||||
@*
|
||||
modifier des param@`etres de configuration@*
|
||||
@*
|
||||
option: nom d'une option@*
|
||||
valeur: valeur pour l'option@*
|
||||
@*
|
||||
@item unalias nom_alias
|
||||
@*
|
||||
supprimer un alias@*
|
||||
@*
|
||||
nom_alias: nom de l'alias @`a supprimer@*
|
||||
@*
|
||||
@item window [list | splith | splitv | [merge [down | up | left | right | all]]]
|
||||
@*
|
||||
gestion des fen@^etres@*
|
||||
@*
|
||||
list: liste les fen@^etres ouvertes (pas de param@`etre affiche cette liste)@*
|
||||
splith: @'eclate la fen@^etre en deux horizontalement@*
|
||||
splitv: @'eclate la fen@^etre en deux verticalement@*
|
||||
merge: fusionne la fen@^etre avec une autre@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
Commandes IRC :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item admin [cible]
|
||||
@*
|
||||
trouver les informations sur l'administrateur du serveur@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item away [-all] [message]
|
||||
@*
|
||||
basculer le statut absent@*
|
||||
@*
|
||||
-all: basculer le statut absent sur tous les serveurs connect@'es@*
|
||||
message: message pour l'absence (si pas de message donn@'e, le statut d'absence est supprim@'e)@*
|
||||
@*
|
||||
@item ban [canal] [pseudo [pseudo ...]]
|
||||
@*
|
||||
bannit des pseudos ou masques@*
|
||||
@*
|
||||
canal: nom du canal pour le bannissement@*
|
||||
pseudo: pseudo ou masque pour le bannissement@*
|
||||
@*
|
||||
@item ctcp pseudo type
|
||||
@*
|
||||
envoyer un message ctcp@*
|
||||
@*
|
||||
pseudo: utilisateur pour envoyer le ctcp@*
|
||||
type: "action" ou "version"@*
|
||||
@*
|
||||
@item dcc action [pseudo [fichier]]
|
||||
@*
|
||||
d@'emarre le DCC (fichier ou discussion) ou ferme une discussion@*
|
||||
@*
|
||||
action: 'send' (envoi de fichier) ou 'chat' (discussion) ou 'close' (fermeture discussion)@*
|
||||
pseudo: pseudo pour envoyer le fichier ou discuter@*
|
||||
fichier: nom du fichier (sur la machine locale)@*
|
||||
@*
|
||||
@item dehalfop pseudo [pseudo]
|
||||
@*
|
||||
retire le statut de demi-op@'erateur du canal @`a/aux nick(s)@*
|
||||
@*
|
||||
@item deop pseudo [pseudo]
|
||||
@*
|
||||
retire le statut d'op@'erateur du canal @`a/aux nick(s)@*
|
||||
@*
|
||||
@item devoice pseudo [pseudo]
|
||||
@*
|
||||
retire la voix du/des pseudo(s)@*
|
||||
@*
|
||||
@item die
|
||||
@*
|
||||
arr@^eter le serveur@*
|
||||
@*
|
||||
@item halfop pseudo [pseudo]
|
||||
@*
|
||||
donner le statut de demi-op@'erateur @`a un/des utilisateur(s)@*
|
||||
@*
|
||||
@item info [cible]
|
||||
@*
|
||||
voir les informations d@'ecrivant le serveur@*
|
||||
@*
|
||||
cible: nom du serveur@*
|
||||
@*
|
||||
@item invite pseudo canal
|
||||
@*
|
||||
inviter un utilisateur sur un canal@*
|
||||
@*
|
||||
pseudo: utilisateur @`a inviter@*
|
||||
channel: canal pour l'invitation@*
|
||||
@*
|
||||
@item ison pseudo [pseudo ...]
|
||||
@*
|
||||
v@'erifier si un utilisateur est actuellement sur IRC@*
|
||||
@*
|
||||
pseudo: pseudo@*
|
||||
@*
|
||||
@item join canal[,canal] [cl@'e[,cl@'e]]
|
||||
@*
|
||||
joindre un canal@*
|
||||
@*
|
||||
canal: nom du canal @`a rejoindre@*
|
||||
cl@'e: cl@'e pour rejoindre le canal@*
|
||||
@*
|
||||
@item kick [canal] pseudo [commentaire]
|
||||
@*
|
||||
retirer par la force un utilisateur d'un canal@*
|
||||
@*
|
||||
canal: canal o@`u l'utilisateur se trouve@*
|
||||
pseudo: utilisateur @`a @'eliminer@*
|
||||
commentaire: commentaire pour l'@'elimination@*
|
||||
@*
|
||||
@item kickban [canal] pseudo [commentaire]
|
||||
@*
|
||||
retirer par la force un utilisateur d'un canal et le bannir@*
|
||||
@*
|
||||
canal: canal o@`u l'utilisateur se trouve@*
|
||||
pseudo: utilisateur @`a @'eliminer et bannir@*
|
||||
commentaire: commentaire pour l'@'elimination@*
|
||||
@*
|
||||
@item kill pseudo commentaire
|
||||
@*
|
||||
fermer la connexion client-serveur@*
|
||||
@*
|
||||
pseudo: utilisateur@*
|
||||
commentaire: commentaire pour la mort@*
|
||||
@*
|
||||
@item links [[serveur] masque_serveur]
|
||||
@*
|
||||
lister tous les noms de serveurs connus du serveur qui r@'epondent @`a la requ@^ete@*
|
||||
@*
|
||||
serveur: ce serveur doit r@'epondre @`a la requ@^ete@*
|
||||
masque_serveur: liste des serveurs correspondant au masque@*
|
||||
@*
|
||||
@item list [canal[,canall] [serveur]]
|
||||
@*
|
||||
lister les canaux et leur sujet@*
|
||||
@*
|
||||
canal: canal @`a lister@*
|
||||
serveur: nom du serveur@*
|
||||
@*
|
||||
@item lusers [masque [cible]]
|
||||
@*
|
||||
obtenir des statistiques sur la taille du r@'eseau IRC@*
|
||||
@*
|
||||
masque: serveurs qui correspondent au masque seulement@*
|
||||
cible: serveur pour faire suivre la requ@^ete@*
|
||||
@*
|
||||
@item me message
|
||||
@*
|
||||
envoyer une action ctcp au canal courant@*
|
||||
@*
|
||||
message: message @`a envoyer@*
|
||||
@*
|
||||
@item mode @{ canal @{[+|-]|o|p|s|i|t|n|b|v@} [limite] [utilisateur] [masque de banissement] @} | @{ nick @{[+|-]|i|w|s|o@} @}
|
||||
@*
|
||||
changer le mode du canal ou de l'utilisateur@*
|
||||
@*
|
||||
modes de canaux :@*
|
||||
canal: nom du canal @`a modifier@*
|
||||
o: donner/reprendre le statut privil@'egi@'e d'op@'erateur@*
|
||||
p: indicateur de canal priv@'e@*
|
||||
s: indicateur de canal secret@*
|
||||
i: indicateur de canal avec invitation seulement@*
|
||||
t: le titre est modifiable seulement par un op@'erateur du canal@*
|
||||
n: aucun message au canal depuis l'ext@'erieur@*
|
||||
m: canal mod@'er@'e@*
|
||||
l: fixer la limite d'utilisateurs pour le canal@*
|
||||
b: param@'etrer un masque de banissement pour garder des utilisateurs dehors@*
|
||||
v: donner/reprendre la possibilit@'e de parler sur un canal mod@'er@'e@*
|
||||
k: d@'efinir une cl@'e (mot de passe) pour acc@'eder au canal@*
|
||||
modes utilisateur :@*
|
||||
pseudo: utilisateur @`a modifier@*
|
||||
i: marquer un utilisateur comme invisible@*
|
||||
s: marquer un utilisateur pour recevoir les notices du serveur@*
|
||||
w: l'utilisateur re@,{c}oit les wallops@*
|
||||
o: drapeau op@'erateur@*
|
||||
@*
|
||||
@item motd [cible]
|
||||
@*
|
||||
obtenir le message du jour@*
|
||||
@*
|
||||
cible: nom du serveur@*
|
||||
@*
|
||||
@item msg cible[,cible] texte
|
||||
@*
|
||||
envoyer un message @`a un utilisateur ou canal@*
|
||||
@*
|
||||
cible: utilisateur ou canal (peut-@^etre un masque, '*' = canal courant)@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item names [canal[,canal]]
|
||||
@*
|
||||
lister les utilisateurs sur des canaux@*
|
||||
@*
|
||||
canal: nom du canal@*
|
||||
@*
|
||||
@item nick pseudo
|
||||
@*
|
||||
changer le pseudo courant@*
|
||||
@*
|
||||
pseudo: nouveau pseudo pour le serveur IRC courant@*
|
||||
@*
|
||||
@item notice pseudo texte
|
||||
@*
|
||||
envoyer un message notice @`a un utilisateur@*
|
||||
@*
|
||||
pseudo: utilisateur cible pour la notice@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item op pseudo [pseudo]
|
||||
@*
|
||||
donner le statut op@'erateur @`a un/des utilisateur(s)@*
|
||||
@*
|
||||
@item oper utilisateur mot_de_passe
|
||||
@*
|
||||
obtenir le statut d'op@'erateur@*
|
||||
@*
|
||||
utilisateur/mot_de_passe: utilis@'e pour obtenir les privil@`eges sur le serveur IRC courant@*
|
||||
@*
|
||||
@item part [canal[,canall] [message_de_fin]
|
||||
@*
|
||||
quitter un canal@*
|
||||
@*
|
||||
canal: canal @`a quitter@*
|
||||
message_de_fin: message de fin (affich@'e aux autres utilisateurs)@*
|
||||
@*
|
||||
@item ping serveur1 [serveur2]
|
||||
@*
|
||||
pinguer un serveur@*
|
||||
@*
|
||||
serveur1: serveur @`a pinguer@*
|
||||
serveur2: faire suivre le ping @`a ce serveur@*
|
||||
@*
|
||||
@item pong d@'emon [d@'emon2]
|
||||
@*
|
||||
r@'epondre @`a un message ping@*
|
||||
@*
|
||||
d@'emon: d@'emon qui a r@'epondu au message Ping@*
|
||||
d@'emon2: faire suivre le message @`a ce d@'emon@*
|
||||
@*
|
||||
@item query pseudo [texte]
|
||||
@*
|
||||
envoyer un message priv@'e @`a un utilisateur@*
|
||||
@*
|
||||
pseudo: utilisateur pour la conversation priv@'ee@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item quit [message_de_fin]
|
||||
@*
|
||||
fermer toutes les connexions et quitter@*
|
||||
@*
|
||||
message_de_fin: message de fin (affich@'e aux autres utilisateurs)@*
|
||||
@*
|
||||
@item quote donn@'ees
|
||||
@*
|
||||
envoyer des donn@'ees brutes au serveur sans analyse@*
|
||||
@*
|
||||
donn@'ees: donn@'ees brutes @`a envoyer@*
|
||||
@*
|
||||
@item rehash
|
||||
@*
|
||||
demander au serveur de recharger son fichier de configuration@*
|
||||
@*
|
||||
@item restart
|
||||
@*
|
||||
demander au serveur de red@'emarrer@*
|
||||
@*
|
||||
@item service pseudo r@'eserv@'e distribution type r@'eserv@'e info
|
||||
@*
|
||||
enregister un nouveau service@*
|
||||
@*
|
||||
distribution: visibilit@'e du service@*
|
||||
type: r@'eserv@'e pour une utilisation future@*
|
||||
@*
|
||||
@item servlist [masque [type]]
|
||||
@*
|
||||
lister les services actuellement connect@'es au r@'eseau@*
|
||||
@*
|
||||
masque: lister seulement les services qui correspondent @`a ce masque@*
|
||||
type: lister seulement les services de ce type@*
|
||||
@*
|
||||
@item squery service texte
|
||||
@*
|
||||
envoyer un message @`a un service@*
|
||||
@*
|
||||
service: nom du service@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item squit serveur commentaire
|
||||
@*
|
||||
d@'econnecter les liens vers un serveur@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
commentaire: commentaire pour quitter@*
|
||||
@*
|
||||
@item stats [requ@^ete [serveur]]
|
||||
@*
|
||||
demander des statistiques sur le serveur@*
|
||||
@*
|
||||
requ@^ete: c/h/i/k/l/m/o/y/u (voir la RFC1459)@*
|
||||
serveur: nom du serveur@*
|
||||
@*
|
||||
@item summon utilisateur [cible [canal]]
|
||||
@*
|
||||
envoyer aux utilisateurs d'un serveur IRC un message leur demandant de rejoindre IRC@*
|
||||
@*
|
||||
utilisateur: nom d'utilisateur@*
|
||||
cible: nom du serveur@*
|
||||
canal: nom du canal@*
|
||||
@*
|
||||
@item time [cible]
|
||||
@*
|
||||
demander l'heure locale de serveur@*
|
||||
@*
|
||||
cible: demander l'heure de ce serveur@*
|
||||
@*
|
||||
@item topic [canal] [titre]
|
||||
@*
|
||||
recevoir/d@'efinir le titre du canal@*
|
||||
@*
|
||||
canal: nom du canal@*
|
||||
titre: nouveau titre pour le canal (si le titre est "-delete" alors le titre est supprim@'e)@*
|
||||
@*
|
||||
@item trace [cible]
|
||||
@*
|
||||
trouver le chemin jusqu'@`a un serveur sp@'ecifique@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item unban [canal] pseudo [pseudo ...]
|
||||
@*
|
||||
supprime le bannissement sur des pseudos ou masques@*
|
||||
@*
|
||||
canal: nom du canal pour supprimer le bannissement@*
|
||||
pseudo: pseudo ou masque pour supprimer le bannissement@*
|
||||
@*
|
||||
@item userhost pseudo [pseudo ...]
|
||||
@*
|
||||
retourne une liste d'informations sur des utilisateurs@*
|
||||
@*
|
||||
pseudo: pseudo@*
|
||||
@*
|
||||
@item users [cible]
|
||||
@*
|
||||
liste des utilisateurs connect@'es au serveur@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item version [serveur | pseudo]
|
||||
@*
|
||||
retourne la version de l'utilisateur ou du serveur (courant ou sp@'ecifi@'e)@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
pseudo: utilisateur@*
|
||||
@*
|
||||
@item voice pseudo [pseudo]
|
||||
@*
|
||||
donne la voix @`a/aux utilisateur(s)@*
|
||||
@*
|
||||
@item wallops texte
|
||||
@*
|
||||
envoyer un message @`a tous les utilisateurs connect@'es qui ont activ@'e le mode utilisateur 'w' pour eux-m@^emes@*
|
||||
@*
|
||||
texte @`a envoyer@*
|
||||
@*
|
||||
@item who [masque ["o"]]
|
||||
@*
|
||||
g@'en@`ere une requ@^ete qui retourne une liste d'information@*
|
||||
@*
|
||||
masque: information qui correspond @`a ce masque uniquement@*
|
||||
o: seul les op@'erateurs sont retourn@'es correspondant au masque fourni@*
|
||||
@*
|
||||
@item whois [serveur] pseudo[,pseudo]
|
||||
@*
|
||||
demande les informations sur le(s) utilisateur(s)@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
pseudo: utilisateur (peut @^etre un masque)@*
|
||||
@*
|
||||
@item whowas pseudo [,pseudo [,pseudo ...]] [nombre [cible]]
|
||||
@*
|
||||
demander de l'information sur un nick qui n'existe plus@*
|
||||
@*
|
||||
pseudo: pseudo @`a chercher@*
|
||||
nombre: nombre de r@'eponses @`a retourner (recherche compl@`ete si nombre n@'egatif)@*
|
||||
cible: la r@'eponse doit correspondre @`a ce masque@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
@node Tube FIFO, , Commandes WeeChat, Utilisation
|
||||
@section Tube FIFO
|
||||
|
||||
Vous pouvez contr@^oler WeeChat @`a distance, en envoyant des commandes ou du
|
||||
texte dans un tube FIFO (l'option "irc_fifo_pipe" doit @^etre activ@'ee, elle
|
||||
est d@'esactiv@'ee par d@'efaut).@*
|
||||
Le tube FIFO est dans le r@'epertoire ~/.weechat/ et s'appelle "weechat_fifo_xxxxx"
|
||||
(o@`u xxxxx est l'ID du processus (PID) du WeeChat qui tourne).@*
|
||||
Donc si plusieurs WeeChat tournent, vous avez plusieurs tubes FIFO, un pour
|
||||
chaque session.@*
|
||||
@*
|
||||
La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO est la suivante :@*
|
||||
@command{serveur,canal *texte ou commande ici}@*
|
||||
o@`u le serveur et le canal sont facultatifs, mais si le canal est l@`a, le
|
||||
serveur doit l'@^etre aussi.@*
|
||||
@*
|
||||
Quelques exemples :
|
||||
@table @asis
|
||||
@item @bullet{} changement du pseudo sur freenode en "pseudo|absent":
|
||||
@command{echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} affichage de texte sur le canal #weechat :
|
||||
@command{echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} affichage de texte sur le canal courant (le tampon affich@'e par WeeChat):
|
||||
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Attention :} ceci est dangereux et vous ne devriez pas le faire sauf si vous savez ce que vous faites !
|
||||
@item @bullet{} envoyer deux commandes pour décharger/recharger les scripts Perl (vous devez les séparer par \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
Vous pouvez @'ecrire un script qui envoie les commandes @`a tous les WeeChat qui
|
||||
tournent en m@^eme temps, par exemple :@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
Si le script s'appelle "auto_weechat_command", vous pouvez le lancer ainsi :@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *bonjour"}
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
@@ -896,12 +1436,6 @@ WeeChat est d@'evelopp@'e par :@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
+51
-13
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.0 - 12 de Fevereiro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.1 - 20 de Mar@,{c}o de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -206,6 +206,7 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
|
||||
* Invocar o WeeChat::
|
||||
* Recursos de teclado::
|
||||
* Comandos do WeeChat::
|
||||
* FIFO pipe::
|
||||
@end menu
|
||||
|
||||
@node Invocar o WeeChat, Recursos de teclado, Utilizacao, Utilizacao
|
||||
@@ -274,11 +275,11 @@ Repetir os ultimos comandos/mensagens@*
|
||||
@item PageUp / PageDown
|
||||
Navegar no hist@'orico da janela@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Ir para a janela anterior/seguinte@*
|
||||
@item F5 / F6
|
||||
Comute ao amortecedor anterior / seguinte@*
|
||||
@*
|
||||
@item F8
|
||||
Comute @`a janela seguinte@*
|
||||
@item F7 / F8
|
||||
Comute ao janela anterior / seguinte@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@@ -287,7 +288,7 @@ Apagar a @'ultima mensagem da barra do info@*
|
||||
Redesenhe a janela inteira@*
|
||||
@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F6 / F7@*
|
||||
Identico a F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@@ -309,11 +310,54 @@ Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
|
||||
@node Comandos do WeeChat, FIFO pipe, Recursos de teclado, Utilizacao
|
||||
@section Comandos do WeeChat
|
||||
|
||||
N@~AO ESCRITO !
|
||||
|
||||
@node FIFO pipe, , Comandos do WeeChat, Utilizacao
|
||||
@section FIFO pipe
|
||||
|
||||
You can remote control WeeChat, by sending commands or text to a FIFO pipe
|
||||
(you have to enable option "irc_fifo_pipe", it is disabled by default).@*
|
||||
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx"
|
||||
(where xxxxx is the process ID (PID) of running WeeChat).@*
|
||||
So if many WeeChat are running, you have many FIFO pipe, one for each session.@*
|
||||
@*
|
||||
The syntax for the FIFO pipe commands/text is:@*
|
||||
@command{server,channel *text or command here}@*
|
||||
where server and channel are optional, but if channel is here, server should be too.@*
|
||||
@*
|
||||
Some examples:
|
||||
@table @asis
|
||||
@item @bullet{} change your nick on freenode to "mynick|out":
|
||||
@*
|
||||
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on #weechat channel:
|
||||
@*
|
||||
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
|
||||
@*
|
||||
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
|
||||
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
You can write a script to send command to all running WeeChat at same time, for example:@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
If the script is called "auto_weechat_command", you can run it with:@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *hello"}
|
||||
|
||||
|
||||
@c ******************************* Extencoes *********************************
|
||||
|
||||
@@ -524,12 +568,6 @@ O WeeChat @'e desenvolvido por :@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
Binary file not shown.
+12
-5
@@ -1,12 +1,12 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc.h
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/irc/irc.h
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/plugins.c
|
||||
@@ -15,16 +15,23 @@
|
||||
./src/gui/curses/gui-display.c
|
||||
./src/gui/gtk/gui-display.c
|
||||
./src/gui/gtk/gui-input.c
|
||||
./src/gui/gui.h
|
||||
./src/gui/gui-common.c
|
||||
./src/gui/gui.h
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.c
|
||||
./src/common/command.h
|
||||
./src/common/completion.c
|
||||
./src/common/completion.h
|
||||
./src/common/fifo.c
|
||||
./src/common/fifo.h
|
||||
./src/common/history.c
|
||||
./src/common/history.h
|
||||
./src/common/hotlist.c
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/weechat.c
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.c
|
||||
./src/common/weeconfig.h
|
||||
./src/common/weelist.c
|
||||
./src/common/weelist.h
|
||||
|
||||
+1199
-940
File diff suppressed because it is too large
Load Diff
@@ -34,4 +34,6 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
hotlist.c \
|
||||
hotlist.h \
|
||||
log.c \
|
||||
log.h
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h
|
||||
|
||||
+168
-111
@@ -47,10 +47,10 @@ t_weechat_command weechat_commands[] =
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action | number]"),
|
||||
N_("action: action to do:\n"
|
||||
" move move buffer in the list (may be relative, for example -1)\n"
|
||||
" close close buffer (for channel: same as /part without part message)\n"
|
||||
" list list opened buffers (no parameter implies this list)\n"
|
||||
" notify set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
|
||||
" move: move buffer in the list (may be relative, for example -1)\n"
|
||||
" close: close buffer (for channel: same as /part without part message)\n"
|
||||
" list: list opened buffers (no parameter implies this list)\n"
|
||||
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
|
||||
"number: jump to buffer by number"),
|
||||
0, MAX_ARGS, weechat_cmd_buffer, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
@@ -58,13 +58,17 @@ t_weechat_command weechat_commands[] =
|
||||
N_("-all: clear all windows"),
|
||||
0, 1, weechat_cmd_clear, NULL },
|
||||
{ "connect", N_("connect to a server"),
|
||||
N_("servername"),
|
||||
N_("[servername]"),
|
||||
N_("servername: server name to connect"),
|
||||
1, 1, weechat_cmd_connect, NULL },
|
||||
0, 1, weechat_cmd_connect, NULL },
|
||||
{ "disconnect", N_("disconnect from a server"),
|
||||
N_("servername"),
|
||||
N_("[servername]"),
|
||||
N_("servername: server name to disconnect"),
|
||||
1, 1, weechat_cmd_disconnect, NULL },
|
||||
0, 1, weechat_cmd_disconnect, NULL },
|
||||
{ "debug", N_("print debug messages"),
|
||||
N_("dump"),
|
||||
N_("dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)"),
|
||||
1, 1, weechat_cmd_debug, NULL },
|
||||
{ "help", N_("display help about commands"),
|
||||
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
|
||||
0, 1, weechat_cmd_help, NULL },
|
||||
@@ -101,10 +105,10 @@ t_weechat_command weechat_commands[] =
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
|
||||
N_(
|
||||
" list list opened windows (no parameter implies this list)\n"
|
||||
"splith split current window horizontally\n"
|
||||
"splitv split current window vertically\n"
|
||||
" merge merge window with another"),
|
||||
"list: list opened windows (no parameter implies this list)\n"
|
||||
"splith: split current window horizontally\n"
|
||||
"splitv: split current window vertically\n"
|
||||
"merge: merge window with another"),
|
||||
0, 2, weechat_cmd_window, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
@@ -506,8 +510,8 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s %s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, PACKAGE_NAME, command + 1);
|
||||
_("%s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, command + 1);
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
@@ -576,7 +580,7 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s IRC command \"%s\" failed\n"),
|
||||
_("%s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, command + 1);
|
||||
}
|
||||
}
|
||||
@@ -645,12 +649,13 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
*/
|
||||
|
||||
void
|
||||
user_command (t_irc_server *server, char *command)
|
||||
user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
|
||||
if ((command[0] == '/') && (command[1] != '/'))
|
||||
{
|
||||
/* WeeChat internal command (or IRC command) */
|
||||
@@ -658,38 +663,45 @@ user_command (t_irc_server *server, char *command)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!buffer)
|
||||
buffer = gui_current_window->buffer;
|
||||
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
|
||||
|
||||
if (server && (!BUFFER_IS_SERVER(buffer)))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
command);
|
||||
if (CHANNEL(buffer)->dcc_chat)
|
||||
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
|
||||
"%s\r\n", command);
|
||||
else
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(buffer)->name, command);
|
||||
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
|
||||
ptr_nick = nick_search (CHANNEL(buffer), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window->buffer)->buffer, ptr_nick,
|
||||
irc_display_nick (CHANNEL(buffer)->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_color (CHANNEL(buffer)->buffer,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
@@ -704,8 +716,8 @@ user_command (t_irc_server *server, char *command)
|
||||
else
|
||||
{
|
||||
irc_display_prefix ((server) ? server->buffer : NULL, PREFIX_ERROR);
|
||||
gui_printf ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
gui_printf_nolog ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -767,12 +779,11 @@ weechat_cmd_alias (char *arguments)
|
||||
/* List all aliases */
|
||||
if (weechat_alias)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("List of aliases:\n"));
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, " %s => %s\n",
|
||||
ptr_alias->alias_name,
|
||||
ptr_alias->alias_command + 1);
|
||||
@@ -833,6 +844,7 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
long number;
|
||||
char *error;
|
||||
|
||||
@@ -840,12 +852,11 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
/* list opened buffers */
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Opened buffers:\n"));
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf (NULL, "%d", ptr_buffer->number);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
|
||||
@@ -922,10 +933,23 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
|
||||
{
|
||||
if (SERVER(gui_current_window->buffer)->is_connected)
|
||||
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
|
||||
else
|
||||
{
|
||||
ptr_channel = channel_search (SERVER(gui_current_window->buffer),
|
||||
CHANNEL(gui_current_window->buffer)->name);
|
||||
if (ptr_channel)
|
||||
channel_free (SERVER(gui_current_window->buffer),
|
||||
ptr_channel);
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
}
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "notify") == 0)
|
||||
{
|
||||
@@ -934,7 +958,7 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
if (argc < 2)
|
||||
{
|
||||
/* display notify level for all buffers */
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Notify levels: "));
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
@@ -1018,7 +1042,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
if (strcasecmp (argv[0], "-all") == 0)
|
||||
gui_buffer_clear_all ();
|
||||
else
|
||||
{
|
||||
@@ -1043,10 +1067,11 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
if (argc == 1)
|
||||
ptr_server = server_search (argv[0]);
|
||||
else
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
|
||||
ptr_server = server_search (argv[0]);
|
||||
if (ptr_server)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
@@ -1054,7 +1079,15 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s already connected to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (ptr_server->child_pid > 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s currently connecting to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (!ptr_server->buffer)
|
||||
@@ -1066,20 +1099,49 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
{
|
||||
ptr_server->reconnect_start = 0;
|
||||
ptr_server->reconnect_join = (ptr_server->channels) ? 1 : 0;
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s server \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_debug: print debug messages
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_debug (int argc, char **argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "debug");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcasecmp (argv[0], "dump") == 0)
|
||||
{
|
||||
wee_dump (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "perl");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_disconnect: disconnect from a server
|
||||
*/
|
||||
@@ -1089,18 +1151,20 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
if (argc == 1)
|
||||
ptr_server = server_search (argv[0]);
|
||||
else
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
|
||||
ptr_server = server_search (argv[0]);
|
||||
if (ptr_server)
|
||||
{
|
||||
if ((!ptr_server->is_connected) && (ptr_server->reconnect_start == 0))
|
||||
if ((!ptr_server->is_connected) && (ptr_server->child_pid == 0)
|
||||
&& (ptr_server->reconnect_start == 0))
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s not connected to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (ptr_server->reconnect_start > 0)
|
||||
@@ -1115,9 +1179,7 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s server \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1134,29 +1196,27 @@ weechat_cmd_help (int argc, char **argv)
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL,
|
||||
_("> List of %s internal commands:\n"),
|
||||
PACKAGE_NAME);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("%s internal commands:\n"), PACKAGE_NAME);
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, " - %s\n",
|
||||
_(weechat_commands[i].command_description));
|
||||
}
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> List of IRC commands:\n"));
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("IRC commands:\n"));
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, " - %s\n",
|
||||
_(irc_commands[i].command_description));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 1)
|
||||
{
|
||||
@@ -1164,20 +1224,23 @@ weechat_cmd_help (int argc, char **argv)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> Help on %s internal command \""), PACKAGE_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[w]");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, "\":\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("Syntax: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, " %s\n",
|
||||
(weechat_commands[i].arguments) ?
|
||||
_(weechat_commands[i].arguments) : "");
|
||||
if (weechat_commands[i].arguments_description)
|
||||
gui_printf (NULL, "%s\n",
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
gui_printf (NULL, " %s\n",
|
||||
_(weechat_commands[i].arguments));
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (weechat_commands[i].command_description &&
|
||||
weechat_commands[i].command_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
return 0;
|
||||
}
|
||||
@@ -1187,20 +1250,23 @@ weechat_cmd_help (int argc, char **argv)
|
||||
if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
|
||||
&& (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> Help on IRC command \""));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[i]");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, "\":\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("Syntax: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, "%s\n",
|
||||
(irc_commands[i].arguments) ?
|
||||
_(irc_commands[i].arguments) : "");
|
||||
if (irc_commands[i].arguments_description)
|
||||
gui_printf (NULL, "%s\n",
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
gui_printf (NULL, " %s\n",
|
||||
_(irc_commands[i].arguments));
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (irc_commands[i].command_description &&
|
||||
irc_commands[i].command_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
return 0;
|
||||
}
|
||||
@@ -1231,7 +1297,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Perl scripts */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Registered Perl scripts:\n"));
|
||||
if (perl_scripts)
|
||||
{
|
||||
@@ -1253,7 +1319,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* list Perl message handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Perl message handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
@@ -1275,7 +1341,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* list Perl command handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Perl command handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
@@ -1298,9 +1364,9 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (strcmp (argv[0], "autoload") == 0)
|
||||
if (strcasecmp (argv[0], "autoload") == 0)
|
||||
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
|
||||
if (strcmp (argv[0], "unload") == 0)
|
||||
if (strcasecmp (argv[0], "unload") == 0)
|
||||
{
|
||||
/* unload all Perl scripts */
|
||||
plugin_unload (PLUGIN_TYPE_PERL, NULL);
|
||||
@@ -1309,7 +1375,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (strcmp (argv[0], "load") == 0)
|
||||
if (strcasecmp (argv[0], "load") == 0)
|
||||
{
|
||||
/* load Perl script */
|
||||
if (strstr(argv[1], DIR_SEPARATOR))
|
||||
@@ -1631,8 +1697,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
if (new_server->autoconnect)
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);
|
||||
if (server_connect (new_server))
|
||||
irc_login (new_server);
|
||||
server_connect (new_server);
|
||||
}
|
||||
|
||||
server_destroy (&server);
|
||||
@@ -1649,7 +1714,6 @@ weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *val
|
||||
{
|
||||
char *color_name, *pos_nickserv, *pos_pwd, *value2;
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, " %s%s%s",
|
||||
(prefix) ? prefix : "",
|
||||
(prefix) ? "." : "",
|
||||
@@ -1774,8 +1838,7 @@ weechat_cmd_set (char *arguments)
|
||||
switch (config_set_server_value (ptr_server, pos + 1, value))
|
||||
{
|
||||
case 0:
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
config_sections[CONFIG_SECTION_SERVER].section_name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
|
||||
@@ -1827,8 +1890,7 @@ weechat_cmd_set (char *arguments)
|
||||
if (config_option_set_value (ptr_option, value) == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s", config_get_section (ptr_option));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
@@ -1867,8 +1929,7 @@ weechat_cmd_set (char *arguments)
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s",
|
||||
config_sections[i].section_name);
|
||||
@@ -1896,8 +1957,7 @@ weechat_cmd_set (char *arguments)
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
config_sections[CONFIG_SECTION_SERVER].section_name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
|
||||
@@ -1919,7 +1979,6 @@ weechat_cmd_set (char *arguments)
|
||||
}
|
||||
if (number_found == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
if (option)
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"),
|
||||
option);
|
||||
@@ -1928,8 +1987,7 @@ weechat_cmd_set (char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", number_found);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
|
||||
if (option)
|
||||
gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
|
||||
option);
|
||||
@@ -1983,13 +2041,12 @@ weechat_cmd_window (int argc, char **argv)
|
||||
{
|
||||
/* list opened windows */
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Opened windows:\n"));
|
||||
|
||||
i = 1;
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf (NULL, "%d", i);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] (");
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
@@ -60,11 +61,12 @@ extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_debug (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_perl (int, char **);
|
||||
|
||||
+41
-13
@@ -145,17 +145,34 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "connect") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
if ((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "disconnect") == 0))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "debug") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
"dump");
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
@@ -199,11 +216,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s =",
|
||||
weechat_options[i][j].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
weechat_options[i][j].option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +227,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s =",
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -334,6 +349,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
@@ -540,8 +558,18 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel
|
||||
&& (((t_irc_channel *)channel)->type == CHAT_PRIVATE))
|
||||
/* nick completion with nothing as base word is disabled,
|
||||
in order to prevent completion when pasting messages with [tab] inside */
|
||||
if ((completion->context == COMPLETION_NICK)
|
||||
&& ((!completion->base_word) || (!completion->base_word[0])))
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel &&
|
||||
(((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
&& (completion->context == COMPLETION_NICK))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* fifo.c: FIFO pipe for WeeChat remote control */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "fifo.h"
|
||||
#include "command.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
int weechat_fifo = -1;
|
||||
char *weechat_fifo_filename = NULL;
|
||||
char *weechat_fifo_unterminated = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* fifo_create: create FIFO pipe for remote control
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_create ()
|
||||
{
|
||||
int filename_length;
|
||||
|
||||
if (cfg_irc_fifo_pipe)
|
||||
{
|
||||
/* build FIFO filename: "~/.weechat/weechat_fifo_" + process PID */
|
||||
if (!weechat_fifo_filename)
|
||||
{
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
weechat_fifo_filename = (char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (weechat_fifo_filename, filename_length, "%s/weechat_fifo_%d",
|
||||
weechat_home, (int) getpid());
|
||||
}
|
||||
|
||||
/* create FIFO pipe, writable for user only */
|
||||
if ((weechat_fifo = mkfifo (weechat_fifo_filename, 0600)) != 0)
|
||||
{
|
||||
weechat_fifo = -1;
|
||||
gui_printf (NULL,
|
||||
_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* open FIFO pipe in read-only (for WeeChat), non nlobking mode */
|
||||
if ((weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is open\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_exec: execute a command/text received by FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_exec (char *text)
|
||||
{
|
||||
char *pos_msg, *pos;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = NULL;
|
||||
ptr_server = NULL;
|
||||
ptr_channel = NULL;
|
||||
ptr_buffer = NULL;
|
||||
|
||||
/* look for server/channel at beginning of text */
|
||||
/* text may be: "server,channel *text" or "server *text" or "*text" */
|
||||
if (text[0] == '*')
|
||||
{
|
||||
pos_msg = text + 1;
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid buffer for displaying text via FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_msg = strstr (text, " *");
|
||||
if (!pos_msg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
pos_msg[0] = '\0';
|
||||
pos = pos_msg - 1;
|
||||
pos_msg += 2;
|
||||
while ((pos >= text) && (pos[0] == ' '))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos--;
|
||||
}
|
||||
|
||||
if (text[0])
|
||||
{
|
||||
pos = strchr (text, ',');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_server = server_search (text);
|
||||
if (!ptr_server || !ptr_server->buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s server \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, text);
|
||||
return;
|
||||
}
|
||||
if (ptr_server)
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
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"),
|
||||
WEECHAT_WARNING, pos + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
else
|
||||
ptr_buffer = ptr_server->buffer;
|
||||
}
|
||||
|
||||
user_command (ptr_server, ptr_buffer, pos_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_read: read data in FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_read ()
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
int num_read;
|
||||
|
||||
num_read = read (weechat_fifo, buffer, sizeof (buffer) - 2);
|
||||
if (num_read > 0)
|
||||
{
|
||||
buffer[num_read] = '\0';
|
||||
|
||||
buf2 = NULL;
|
||||
ptr_buf = buffer;
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
buf2 = (char *) malloc (strlen (weechat_fifo_unterminated) +
|
||||
strlen (buffer) + 1);
|
||||
if (buf2)
|
||||
{
|
||||
strcpy (buf2, weechat_fifo_unterminated);
|
||||
strcat (buf2, buffer);
|
||||
}
|
||||
ptr_buf = buf2;
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
while (ptr_buf && ptr_buf[0])
|
||||
{
|
||||
next_ptr_buf = NULL;
|
||||
pos = strstr (ptr_buf, "\r\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strstr (ptr_buf, "\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_fifo_unterminated = strdup (ptr_buf);
|
||||
ptr_buf = NULL;
|
||||
next_ptr_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_buf)
|
||||
fifo_exec (ptr_buf);
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_read < 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
fifo_remove ();
|
||||
}
|
||||
else
|
||||
{
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_remove: remove FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_remove ()
|
||||
{
|
||||
if (weechat_fifo != -1)
|
||||
{
|
||||
/* close FIFO pipe */
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = -1;
|
||||
}
|
||||
|
||||
/* remove FIFO from disk */
|
||||
if (weechat_fifo_filename)
|
||||
unlink (weechat_fifo_filename);
|
||||
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
if (weechat_fifo_filename)
|
||||
{
|
||||
free (weechat_fifo_filename);
|
||||
weechat_fifo_filename = NULL;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is closed\n"));
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_FIFO_H
|
||||
#define __WEECHAT_FIFO_H 1
|
||||
|
||||
extern int weechat_fifo;
|
||||
|
||||
extern void fifo_create ();
|
||||
extern void fifo_read ();
|
||||
extern void fifo_remove ();
|
||||
|
||||
#endif /* fifo.h */
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -71,6 +72,28 @@ log_write (t_gui_buffer *buffer, char *message)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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");
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_start: starts a log
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
#define __WEECHAT_LOG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
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 *);
|
||||
|
||||
|
||||
+267
-81
@@ -8,11 +8,9 @@
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By: FlashCode <flashcode@flashtux.org> ###
|
||||
* ### Bounga <bounga@altern.org> ###
|
||||
* ### Xahlexx <xahlexx@weeland.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
@@ -49,99 +47,32 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
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 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@@ -173,6 +104,77 @@ wee_log_printf (char *message, ...)
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
#endif /* HAVE_ICONV */
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
*/
|
||||
@@ -246,6 +248,59 @@ void wee_display_config_options ()
|
||||
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_commands: display WeeChat and/or IRC commands
|
||||
*/
|
||||
|
||||
void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (weechat_cmd)
|
||||
{
|
||||
printf (_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
printf ("* %s", weechat_commands[i].command_name);
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(weechat_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
|
||||
if (irc_cmd)
|
||||
{
|
||||
printf (_("IRC commands:\n"));
|
||||
printf ("\n");
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args ||
|
||||
irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
printf ("* %s", irc_commands[i].command_name);
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(irc_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
@@ -273,6 +328,12 @@ wee_parse_args (int argc, char *argv[])
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
@@ -285,6 +346,12 @@ wee_parse_args (int argc, char *argv[])
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
@@ -527,6 +594,7 @@ wee_gui_shutdown ()
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
fifo_remove ();
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
@@ -537,6 +605,122 @@ wee_shutdown (int return_code)
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_dump writes dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_dump (int crash)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* prevent reentrance */
|
||||
if (sigsegv)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
wee_log_printf ("very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
if (crash)
|
||||
{
|
||||
wee_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
wee_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
wee_log_printf ("****** and explain when this crash happened ******\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf ("****** WeeChat dump request ******\n");
|
||||
}
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
server_print_log (ptr_server);
|
||||
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
channel_print_log (ptr_channel);
|
||||
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
nick_print_log (ptr_nick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("[windows/buffers]\n");
|
||||
wee_log_printf (" => windows:\n");
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_window);
|
||||
}
|
||||
wee_log_printf (" => buffers:\n");
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_buffer);
|
||||
}
|
||||
wee_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_window_print_log (ptr_window);
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigsegv ()
|
||||
{
|
||||
wee_dump (1);
|
||||
wee_gui_shutdown ();
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat has crashed (SIGSEGV received)\n");
|
||||
fprintf (stderr, "*** Full crash dump was saved to ~/.weechat/weechat.log file\n");
|
||||
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* main: WeeChat startup
|
||||
*/
|
||||
@@ -553,6 +737,7 @@ main (int argc, char *argv[])
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
@@ -580,6 +765,7 @@ main (int argc, char *argv[])
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
|
||||
+10
-7
@@ -47,8 +47,8 @@
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||
#define WEECHAT_ERROR _("WeeChat Error:")
|
||||
#define WEECHAT_WARNING _("WeeChat Warning:")
|
||||
|
||||
/* log file */
|
||||
|
||||
@@ -81,10 +81,12 @@
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -c, --config config file help (list of options)\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n\n"
|
||||
" -c, --config display config file options\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
@@ -102,9 +104,10 @@ extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
+52
-7
@@ -38,6 +38,7 @@
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -204,6 +205,8 @@ int cfg_col_input_nick;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
int cfg_col_nick_chanowner;
|
||||
int cfg_col_nick_chanadmin;
|
||||
int cfg_col_nick_op;
|
||||
int cfg_col_nick_halfop;
|
||||
int cfg_col_nick_voice;
|
||||
@@ -297,7 +300,7 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"default", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
{ "col_status_more", N_("color for \"-MORE-\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_status_more, NULL, &config_change_color },
|
||||
@@ -347,6 +350,14 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for away nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_nick_away, NULL, &config_change_color },
|
||||
{ "col_nick_chanowner", N_("color for chan owner symbol"),
|
||||
N_("color for chan owner symbol (specific to unrealircd)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_nick_chanowner, NULL, &config_change_color },
|
||||
{ "col_nick_chanadmin", N_("color for chan admin symbol"),
|
||||
N_("color for chan admin symbol (specific to unrealircd)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_nick_chanadmin, NULL, &config_change_color },
|
||||
{ "col_nick_op", N_("color for operator symbol"),
|
||||
N_("color for operator symbol"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -384,7 +395,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_dcc_waiting", N_("color for \"waiting\" dcc status"),
|
||||
N_("color for \"waiting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
"lightcyan", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
{ "col_dcc_connecting", N_("color for \"connecting\" dcc status"),
|
||||
N_("color for \"connecting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -432,6 +443,7 @@ t_config_option weechat_options_history[] =
|
||||
int cfg_log_auto_server;
|
||||
int cfg_log_auto_channel;
|
||||
int cfg_log_auto_private;
|
||||
int cfg_log_plugin_msg;
|
||||
char *cfg_log_path;
|
||||
char *cfg_log_timestamp;
|
||||
int cfg_log_hide_nickserv_pwd;
|
||||
@@ -449,6 +461,10 @@ t_config_option weechat_options_log[] =
|
||||
N_("automatically log private chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
{ "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 },
|
||||
{ "log_path", N_("path for log files"),
|
||||
N_("path for WeeChat log files"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -474,6 +490,7 @@ 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;
|
||||
|
||||
t_config_option weechat_options_irc[] =
|
||||
{ { "irc_display_away", N_("display message to all channels when away"),
|
||||
@@ -494,7 +511,7 @@ t_config_option weechat_options_irc[] =
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
|
||||
{ "irc_away_check", N_("interval between two checks for away"),
|
||||
N_("interval between two checks for away (in minutes, 0 = never check)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 0,
|
||||
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)"),
|
||||
@@ -508,6 +525,10 @@ t_config_option weechat_options_irc[] =
|
||||
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 },
|
||||
{ "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, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -519,6 +540,7 @@ int cfg_dcc_timeout;
|
||||
int cfg_dcc_blocksize;
|
||||
char *cfg_dcc_download_path;
|
||||
char *cfg_dcc_upload_path;
|
||||
int cfg_dcc_convert_spaces;
|
||||
int cfg_dcc_auto_rename;
|
||||
int cfg_dcc_auto_resume;
|
||||
|
||||
@@ -529,15 +551,15 @@ t_config_option weechat_options_dcc[] =
|
||||
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_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
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 },
|
||||
{ "dcc_blocksize", N_("block size for dcc packets"),
|
||||
N_("block size for dcc packets in bytes (default: 1024)"),
|
||||
OPTION_TYPE_INT, 1024, 102400, 1024,
|
||||
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 },
|
||||
{ "dcc_download_path", N_("path for incoming files with dcc"),
|
||||
N_("path for writing incoming files with dcc (default: user home)"),
|
||||
@@ -547,6 +569,10 @@ t_config_option weechat_options_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 },
|
||||
{ "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 },
|
||||
{ "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,
|
||||
@@ -603,7 +629,7 @@ t_config_option weechat_options_server[] =
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &(cfg_server.autoreconnect), NULL, NULL },
|
||||
{ "server_autoreconnect_delay", N_("delay before trying again to reconnect"),
|
||||
N_("delay (in deconds) before trying again to reconnect to server"),
|
||||
N_("delay (in seconds) before trying again to reconnect to server"),
|
||||
OPTION_TYPE_INT, 0, 65535, 30,
|
||||
NULL, NULL, &(cfg_server.autoreconnect_delay), NULL, NULL },
|
||||
{ "server_address", N_("server address or hostname"),
|
||||
@@ -779,6 +805,25 @@ config_change_away_check ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_fifo_pipe: called when FIFO pipe is changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_fifo_pipe ()
|
||||
{
|
||||
if (cfg_irc_fifo_pipe)
|
||||
{
|
||||
if (weechat_fifo == -1)
|
||||
fifo_create ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weechat_fifo != -1)
|
||||
fifo_remove ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_set_value: set new value for an option
|
||||
* return: 0 if success
|
||||
|
||||
@@ -127,6 +127,8 @@ extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_chanowner;
|
||||
extern int cfg_col_nick_chanadmin;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
@@ -148,6 +150,7 @@ extern int cfg_history_max_commands;
|
||||
extern int cfg_log_auto_server;
|
||||
extern int cfg_log_auto_channel;
|
||||
extern int cfg_log_auto_private;
|
||||
extern int cfg_log_plugin_msg;
|
||||
extern char *cfg_log_path;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
@@ -160,6 +163,7 @@ 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 int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
@@ -167,6 +171,7 @@ extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_convert_spaces;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
extern int cfg_dcc_auto_resume;
|
||||
|
||||
@@ -185,6 +190,7 @@ extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern void config_change_fifo_pipe ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
|
||||
+485
-319
File diff suppressed because it is too large
Load Diff
+70
-33
@@ -38,6 +38,7 @@
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
#define KEY_ESCAPE 27
|
||||
@@ -52,8 +53,9 @@ gui_read_keyb ()
|
||||
int key, i;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
char new_char[3], *decoded_string;
|
||||
t_dcc *dcc_selected;
|
||||
t_irc_dcc *dcc_selected;
|
||||
|
||||
key = getch ();
|
||||
if (key != ERR)
|
||||
@@ -69,19 +71,22 @@ gui_read_keyb ()
|
||||
case KEY_F(2):
|
||||
case KEY_F(3):
|
||||
case KEY_F(4):
|
||||
case KEY_F(5):
|
||||
case KEY_F(9):
|
||||
case KEY_F(11):
|
||||
case KEY_F(12):
|
||||
break;
|
||||
/* previous buffer in window */
|
||||
case KEY_F(6):
|
||||
case KEY_F(5):
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
/* next buffer in window */
|
||||
case KEY_F(7):
|
||||
case KEY_F(6):
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
/* previous window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_previous_window (gui_current_window);
|
||||
break;
|
||||
/* next window */
|
||||
case KEY_F(8):
|
||||
gui_switch_to_next_window (gui_current_window);
|
||||
@@ -98,14 +103,14 @@ gui_read_keyb ()
|
||||
if (dcc_list)
|
||||
{
|
||||
if (gui_current_window->dcc_selected
|
||||
&& ((t_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
|
||||
&& ((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
|
||||
{
|
||||
if (gui_current_window->dcc_selected ==
|
||||
gui_current_window->dcc_first)
|
||||
gui_current_window->dcc_first =
|
||||
((t_dcc *)(gui_current_window->dcc_first))->prev_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_first))->prev_dcc;
|
||||
gui_current_window->dcc_selected =
|
||||
((t_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
|
||||
gui_draw_buffer_chat (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
@@ -144,7 +149,7 @@ gui_read_keyb ()
|
||||
if (dcc_list)
|
||||
{
|
||||
if (!gui_current_window->dcc_selected
|
||||
|| ((t_dcc *)(gui_current_window->dcc_selected))->next_dcc)
|
||||
|| ((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc)
|
||||
{
|
||||
if (gui_current_window->dcc_last_displayed
|
||||
&& (gui_current_window->dcc_selected ==
|
||||
@@ -152,14 +157,14 @@ gui_read_keyb ()
|
||||
{
|
||||
if (gui_current_window->dcc_first)
|
||||
gui_current_window->dcc_first =
|
||||
((t_dcc *)(gui_current_window->dcc_first))->next_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_first))->next_dcc;
|
||||
else
|
||||
gui_current_window->dcc_first =
|
||||
dcc_list->next_dcc;
|
||||
}
|
||||
if (gui_current_window->dcc_selected)
|
||||
gui_current_window->dcc_selected =
|
||||
((t_dcc *)(gui_current_window->dcc_selected))->next_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc;
|
||||
else
|
||||
gui_current_window->dcc_selected =
|
||||
dcc_list->next_dcc;
|
||||
@@ -544,6 +549,7 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
{
|
||||
@@ -558,16 +564,15 @@ gui_read_keyb ()
|
||||
if (gui_current_window->buffer->dcc)
|
||||
{
|
||||
dcc_selected = (gui_current_window->dcc_selected) ?
|
||||
(t_dcc *) gui_current_window->dcc_selected : dcc_list;
|
||||
(t_irc_dcc *) gui_current_window->dcc_selected : dcc_list;
|
||||
switch (key)
|
||||
{
|
||||
/* accept DCC */
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (dcc_selected
|
||||
&& (((dcc_selected->type == DCC_CHAT_RECV)
|
||||
|| (dcc_selected->type == DCC_FILE_RECV))
|
||||
&& (dcc_selected->status == DCC_WAITING)))
|
||||
&& (DCC_IS_RECV(dcc_selected->status))
|
||||
&& (dcc_selected->status == DCC_WAITING))
|
||||
{
|
||||
dcc_accept (dcc_selected);
|
||||
}
|
||||
@@ -576,29 +581,41 @@ gui_read_keyb ()
|
||||
case 'c':
|
||||
case 'C':
|
||||
if (dcc_selected
|
||||
&& ((dcc_selected->status == DCC_WAITING)
|
||||
|| (dcc_selected->status == DCC_CONNECTING)
|
||||
|| (dcc_selected->status == DCC_ACTIVE)))
|
||||
&& (!DCC_ENDED(dcc_selected->status)))
|
||||
{
|
||||
dcc_close (dcc_selected, DCC_ABORTED);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
break;
|
||||
/* purge old DCC */
|
||||
case 'p':
|
||||
case 'P':
|
||||
gui_current_window->dcc_selected = NULL;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (DCC_ENDED(ptr_dcc->status))
|
||||
dcc_free (ptr_dcc);
|
||||
}
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* close DCC window */
|
||||
case 'q':
|
||||
case 'Q':
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
if (buffer_before_dcc)
|
||||
{
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
gui_switch_to_buffer (gui_current_window,
|
||||
buffer_before_dcc);
|
||||
}
|
||||
else
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* remove from DCC list */
|
||||
case 'r':
|
||||
case 'R':
|
||||
if (dcc_selected
|
||||
&& (((dcc_selected->type == DCC_CHAT_RECV)
|
||||
|| (dcc_selected->type == DCC_FILE_RECV))
|
||||
&& ((dcc_selected->status == DCC_DONE)
|
||||
|| (dcc_selected->status == DCC_FAILED)
|
||||
|| (dcc_selected->status == DCC_ABORTED))))
|
||||
&& (DCC_ENDED(dcc_selected->status)))
|
||||
{
|
||||
if (dcc_selected->next_dcc)
|
||||
gui_current_window->dcc_selected = dcc_selected->next_dcc;
|
||||
@@ -703,10 +720,15 @@ gui_main_loop ()
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO (&read_fd);
|
||||
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
if (weechat_fifo != -1)
|
||||
FD_SET (weechat_fifo, &read_fd);
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 10000;
|
||||
FD_ZERO (&read_fd);
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
@@ -745,23 +767,38 @@ gui_main_loop ()
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_server->sock4 >= 0)
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
FD_SET (ptr_server->child_read, &read_fd);
|
||||
else
|
||||
{
|
||||
if (ptr_server->sock >= 0)
|
||||
FD_SET (ptr_server->sock, &read_fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout))
|
||||
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
||||
{
|
||||
gui_read_keyb ();
|
||||
}
|
||||
else
|
||||
if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd)))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
fifo_read ();
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
{
|
||||
if ((ptr_server->sock4 >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock4, &read_fd)))
|
||||
if (FD_ISSET (ptr_server->child_read, &read_fd))
|
||||
server_child_read (ptr_server);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ptr_server->sock >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock, &read_fd)))
|
||||
server_recv (ptr_server);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,6 +337,9 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
if (window->buffer && (window->buffer->num_displayed > 0))
|
||||
window->buffer->num_displayed--;
|
||||
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
@@ -455,6 +458,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
ptr_win->buffer = NULL;
|
||||
}
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
@@ -475,6 +484,7 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->log_write = 1;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
@@ -807,3 +817,115 @@ gui_move_buffer_to_number (t_gui_window *window, int number)
|
||||
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_print_log: print window infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_print_log (t_gui_window *window)
|
||||
{
|
||||
wee_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
wee_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
wee_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
wee_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
wee_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
wee_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
wee_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
wee_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
wee_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
wee_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
wee_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
wee_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
wee_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
wee_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
wee_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
wee_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
wee_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
wee_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
wee_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
wee_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
wee_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
wee_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
wee_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
wee_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
wee_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
wee_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
wee_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
wee_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
wee_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
wee_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
wee_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
wee_log_printf (" sub_lines . . . . . : %d\n", window->sub_lines);
|
||||
wee_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
wee_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_print_log: print buffer infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
int num;
|
||||
char buf[4096];
|
||||
|
||||
wee_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
wee_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
wee_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
wee_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
wee_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
wee_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
wee_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
wee_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
wee_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
wee_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
wee_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
wee_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
wee_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
wee_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
wee_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
wee_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
wee_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" => last 100 lines:\n");
|
||||
|
||||
num = 0;
|
||||
ptr_line = buffer->last_line;
|
||||
while (ptr_line && (num < 100))
|
||||
{
|
||||
num++;
|
||||
ptr_line = ptr_line->prev_line;
|
||||
}
|
||||
if (!ptr_line)
|
||||
ptr_line = buffer->lines;
|
||||
else
|
||||
ptr_line = ptr_line->next_line;
|
||||
|
||||
while (ptr_line)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
for (ptr_message = ptr_line->messages; ptr_message;
|
||||
ptr_message = ptr_message->next_message)
|
||||
{
|
||||
if (strlen (buf) + strlen (ptr_message->message) + 1 >= sizeof (buf))
|
||||
break;
|
||||
strcat (buf, ptr_message->message);
|
||||
}
|
||||
num--;
|
||||
wee_log_printf (" line N-%05d: %s\n", num, buf);
|
||||
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-23
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 47
|
||||
#define NUM_COLORS 49
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -51,22 +51,24 @@
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_OP 25
|
||||
#define COLOR_WIN_NICK_HALFOP 26
|
||||
#define COLOR_WIN_NICK_VOICE 27
|
||||
#define COLOR_WIN_NICK_SEP 28
|
||||
#define COLOR_WIN_NICK_SELF 29
|
||||
#define COLOR_WIN_NICK_PRIVATE 30
|
||||
#define COLOR_WIN_NICK_FIRST 31
|
||||
#define COLOR_WIN_NICK_LAST 40
|
||||
#define COLOR_WIN_NICK_CHANOWNER 25
|
||||
#define COLOR_WIN_NICK_CHANADMIN 26
|
||||
#define COLOR_WIN_NICK_OP 27
|
||||
#define COLOR_WIN_NICK_HALFOP 28
|
||||
#define COLOR_WIN_NICK_VOICE 29
|
||||
#define COLOR_WIN_NICK_SEP 30
|
||||
#define COLOR_WIN_NICK_SELF 31
|
||||
#define COLOR_WIN_NICK_PRIVATE 32
|
||||
#define COLOR_WIN_NICK_FIRST 33
|
||||
#define COLOR_WIN_NICK_LAST 42
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 41
|
||||
#define COLOR_DCC_WAITING 42
|
||||
#define COLOR_DCC_CONNECTING 43
|
||||
#define COLOR_DCC_ACTIVE 44
|
||||
#define COLOR_DCC_DONE 45
|
||||
#define COLOR_DCC_FAILED 46
|
||||
#define COLOR_DCC_ABORTED 47
|
||||
#define COLOR_DCC_SELECTED 43
|
||||
#define COLOR_DCC_WAITING 44
|
||||
#define COLOR_DCC_CONNECTING 45
|
||||
#define COLOR_DCC_ACTIVE 46
|
||||
#define COLOR_DCC_DONE 47
|
||||
#define COLOR_DCC_FAILED 48
|
||||
#define COLOR_DCC_ABORTED 49
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
@@ -76,16 +78,24 @@
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_NICK 2
|
||||
#define MSG_TYPE_INFO 4
|
||||
#define MSG_TYPE_MSG 8
|
||||
#define MSG_TYPE_HIGHLIGHT 16
|
||||
#define MSG_TYPE_PREFIX 2
|
||||
#define MSG_TYPE_NICK 4
|
||||
#define MSG_TYPE_INFO 8
|
||||
#define MSG_TYPE_MSG 16
|
||||
#define MSG_TYPE_HIGHLIGHT 32
|
||||
#define MSG_TYPE_NOLOG 64
|
||||
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, color, 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_color_type(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -104,6 +114,7 @@ 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 */
|
||||
@@ -266,6 +277,8 @@ extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, int);
|
||||
extern void gui_window_print_log (t_gui_window *);
|
||||
extern void gui_buffer_print_log (t_gui_buffer *);
|
||||
|
||||
/* GUI dependant functions */
|
||||
|
||||
@@ -286,6 +299,7 @@ extern t_gui_buffer *gui_get_dcc_buffer ();
|
||||
extern void gui_switch_to_dcc_buffer ();
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
@@ -304,7 +318,7 @@ extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
@@ -53,12 +54,14 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
|
||||
/* initialize new channel */
|
||||
new_channel->type = channel_type;
|
||||
new_channel->dcc_chat = NULL;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks_count = 0;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
@@ -101,6 +104,14 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
|
||||
if (channel->next_channel)
|
||||
(channel->next_channel)->prev_channel = channel->prev_channel;
|
||||
|
||||
/* close DCC CHAT */
|
||||
if ((t_irc_dcc *)(channel->dcc_chat) &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
|
||||
{
|
||||
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (channel->name)
|
||||
free (channel->name);
|
||||
@@ -204,3 +215,71 @@ channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_create_dcc: create DCC CHAT channel
|
||||
*/
|
||||
|
||||
int
|
||||
channel_create_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
|
||||
ptr_dcc->nick, 0);
|
||||
if (!ptr_channel)
|
||||
return 0;
|
||||
|
||||
if (ptr_channel->dcc_chat &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
|
||||
return 0;
|
||||
|
||||
ptr_channel->dcc_chat = ptr_dcc;
|
||||
ptr_dcc->channel = ptr_channel;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_dcc: remove a DCC CHAT
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = ptr_dcc->server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if ((t_irc_dcc *)(ptr_channel->dcc_chat) == ptr_dcc)
|
||||
{
|
||||
ptr_channel->dcc_chat = NULL;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_print_log: print channel infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
channel_print_log (t_irc_channel *channel)
|
||||
{
|
||||
wee_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
wee_log_printf (" type . . . . : %d\n", channel->type);
|
||||
wee_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
wee_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
wee_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
wee_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
wee_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
wee_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
wee_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
wee_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
wee_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
wee_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
wee_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
}
|
||||
|
||||
+38
-14
@@ -40,16 +40,23 @@ t_irc_command irc_commands[] =
|
||||
N_("-all: toggle away status on all connected servers\n"
|
||||
"message: message for away (if no message is given, away status is removed)"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
|
||||
{ "ban", N_("bans nicks or hosts"),
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_("channel: channel for ban\nnickname: user or host to ban"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a ctcp message"),
|
||||
N_("nickname type"),
|
||||
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "dcc", N_("starts DCC (file or chat)"),
|
||||
N_("action nickname [file]"),
|
||||
N_("action: 'send' (file) or 'chat'\n"
|
||||
{ "dcc", N_("starts DCC (file or chat) or close chat"),
|
||||
N_("action [nickname [file]]"),
|
||||
N_("action: 'send' (file) or 'chat' or 'close' (chat)\n"
|
||||
"nickname: nickname to send file or chat\n"
|
||||
"file: filename (on local host)"),
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
@@ -60,6 +67,9 @@ t_irc_command irc_commands[] =
|
||||
"", "",
|
||||
0, 0, 1, NULL, irc_cmd_send_die, NULL },
|
||||
{ "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "halfop", N_("gives half channel operator status to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
|
||||
{ "info", N_("get information describing the server"),
|
||||
N_("[target]"),
|
||||
N_("target: server name"),
|
||||
@@ -67,7 +77,7 @@ t_irc_command irc_commands[] =
|
||||
{ "invite", N_("invite a nick on a channel"),
|
||||
N_("nickname channel"),
|
||||
N_("nickname: nick to invite\nchannel: channel to invite"),
|
||||
2, 2, 1, NULL, irc_cmd_send_invite, NULL },
|
||||
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
|
||||
{ "ison", N_("check if a nickname is currently on IRC"),
|
||||
N_("nickname [nickname ...]"),
|
||||
N_("nickname: nickname"),
|
||||
@@ -80,20 +90,24 @@ t_irc_command irc_commands[] =
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
|
||||
{ "kickban", N_("kicks and bans a nick from a channel"),
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\nnickname: nickname to kick and ban\ncomment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
|
||||
{ "kill", N_("close client-server connection"),
|
||||
N_("nickname comment"),
|
||||
N_("nickname: nickname\ncomment: comment for kill"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL },
|
||||
{ "links", N_("list all servernames which are known by the server answering the query"),
|
||||
N_("[[remove_server] server_mask]"),
|
||||
N_("remote_server: this server should answer the query\n"
|
||||
N_("[[server] server_mask]"),
|
||||
N_("server: this server should answer the query\n"
|
||||
"server_mask: list of servers must match this mask"),
|
||||
0, 2, 1, NULL, irc_cmd_send_links, NULL },
|
||||
{ "list", N_("list channels and their topic"),
|
||||
N_("[channel[,channel] [server]]"),
|
||||
N_("channel: channel to list\nserver: server name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL },
|
||||
{ "lusers", N_("get statistics about ths size of the IRC network"),
|
||||
{ "lusers", N_("get statistics about the size of the IRC network"),
|
||||
N_("[mask [target]]"),
|
||||
N_("mask: servers matching the mask only\n"
|
||||
"target: server for forwarding request"),
|
||||
@@ -104,7 +118,7 @@ t_irc_command irc_commands[] =
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
{ "mode", N_("change channel or user mode"),
|
||||
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
|
||||
"{ nickname {[+|-]|i|w|s|o}"),
|
||||
"{ nickname {[+|-]|i|w|s|o} }"),
|
||||
N_("channel modes:\n"
|
||||
" channel: channel name to modify\n"
|
||||
" o: give/take channel operator privileges\n"
|
||||
@@ -123,7 +137,7 @@ t_irc_command irc_commands[] =
|
||||
" i: mark a user as invisible\n"
|
||||
" s: mark a user for receive server notices\n"
|
||||
" w: user receives wallops\n"
|
||||
" o: operator flag\n"),
|
||||
" o: operator flag"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
|
||||
{ "motd", N_("get the \"Message Of The Day\""),
|
||||
N_("[target]"),
|
||||
@@ -170,7 +184,7 @@ t_irc_command irc_commands[] =
|
||||
N_("nickname: nickname for private conversation"
|
||||
"\ntext: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
|
||||
{ "quit", N_("close all connections & quit " PACKAGE_NAME),
|
||||
{ "quit", N_("close all connections & quit"),
|
||||
N_("[quit_message]"),
|
||||
N_("quit_message: quit message (displayed to other users)"),
|
||||
0, MAX_ARGS, 0, NULL, irc_cmd_send_quit, irc_cmd_recv_quit },
|
||||
@@ -197,7 +211,7 @@ t_irc_command irc_commands[] =
|
||||
N_("service text"), N_("service: name of service\ntext: text to send"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
|
||||
{ "squit", N_("disconnect server links"),
|
||||
N_("server commnent"), N_("server: server name\ncomment: comment for quit"),
|
||||
N_("server comment"), N_("server: server name\ncomment: comment for quit"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
|
||||
{ "stats", N_("query statistics about server"),
|
||||
N_("[query [server]]"),
|
||||
@@ -218,6 +232,10 @@ t_irc_command irc_commands[] =
|
||||
{ "trace", N_("find the route to specific server"),
|
||||
N_("[target]"), N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_trace, NULL },
|
||||
{ "unban", N_("unbans nicks or hosts"),
|
||||
N_("[channel] nickname [nickname ...]"),
|
||||
N_("channel: channel for unban\nnickname: user or host to unban"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
|
||||
{ "userhost", N_("return a list of information about nicknames"),
|
||||
N_("nickname [nickname ...]"), N_("nickname: nickname"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_userhost, NULL },
|
||||
@@ -236,7 +254,7 @@ t_irc_command irc_commands[] =
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
|
||||
{ "who", N_("generate a query which returns a list of information"),
|
||||
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
|
||||
"o: only operators are returned according to the mask supplied\n"),
|
||||
"o: only operators are returned according to the mask supplied"),
|
||||
0, 2, 1, NULL, irc_cmd_send_who, NULL },
|
||||
{ "whois", N_("query information about user(s)"),
|
||||
N_("[server] nickname[,nickname]"), N_("server: server name\n"
|
||||
@@ -311,6 +329,8 @@ t_irc_command irc_commands[] =
|
||||
{ "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 },
|
||||
@@ -337,6 +357,8 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "409", N_("no origin"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "410", N_("no services"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "411", N_("no recipient"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "412", N_("no text to send"),
|
||||
@@ -355,12 +377,14 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "431", N_("no nickname given"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "432", N_("erroneus nickname"),
|
||||
{ "432", N_("erroneous nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "433", N_("nickname already in use"),
|
||||
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_433 },
|
||||
{ "436", N_("nickname collision"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "438", N_("not authorized to change nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_438 },
|
||||
{ "441", N_("user not in channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "442", N_("not on channel"),
|
||||
|
||||
+781
-152
File diff suppressed because it is too large
Load Diff
+36
-39
@@ -43,11 +43,18 @@
|
||||
void
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = MSG_TYPE_INFO | MSG_TYPE_PREFIX;
|
||||
|
||||
if (!cfg_log_plugin_msg && (prefix == PREFIX_PLUGIN))
|
||||
type |= MSG_TYPE_NOLOG;
|
||||
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c ", 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]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
@@ -63,41 +70,43 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (buffer,
|
||||
if (nick->is_chanowner)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "~");
|
||||
else if (nick->is_chanadmin)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "&");
|
||||
else if (nick->is_op)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else if (nick->is_halfop)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else if (nick->has_voice)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (buffer,
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
@@ -106,7 +115,7 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -141,7 +150,7 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
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, " [");
|
||||
@@ -149,58 +158,46 @@ irc_display_server (t_irc_server *server)
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
|
||||
+37
-4
@@ -64,8 +64,10 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||
score1 = - ( (nick1->is_chanowner * 32) + (nick1->is_chanadmin * 16) +
|
||||
(nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2) );
|
||||
score2 = - ( (nick2->is_chanowner * 32) + (nick2->is_chanadmin * 16) +
|
||||
(nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2) );
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
@@ -149,7 +151,8 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
|
||||
|
||||
t_irc_nick *
|
||||
nick_new (t_irc_channel *channel, char *nick_name,
|
||||
int is_op, int is_halfop, int has_voice)
|
||||
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
|
||||
int has_voice)
|
||||
{
|
||||
t_irc_nick *new_nick;
|
||||
|
||||
@@ -157,6 +160,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
if ((new_nick = nick_search (channel, nick_name)))
|
||||
{
|
||||
/* update nick */
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
@@ -173,6 +178,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
@@ -184,6 +191,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
channel->nicks_count++;
|
||||
|
||||
/* all is ok, return address of new nick */
|
||||
return new_nick;
|
||||
}
|
||||
@@ -256,6 +265,8 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
|
||||
if (nick->next_nick)
|
||||
(nick->next_nick)->prev_nick = nick->prev_nick;
|
||||
|
||||
channel->nicks_count--;
|
||||
|
||||
/* free data */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
@@ -273,6 +284,9 @@ nick_free_all (t_irc_channel *channel)
|
||||
/* remove all nicks for the channel */
|
||||
while (channel->nicks)
|
||||
nick_free (channel, channel->nicks);
|
||||
|
||||
/* sould be zero, but prevent any bug :D */
|
||||
channel->nicks_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -312,7 +326,7 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
(*total)++;
|
||||
if (ptr_nick->is_op)
|
||||
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
|
||||
(*count_op)++;
|
||||
else
|
||||
{
|
||||
@@ -362,3 +376,22 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_print_log: print nick infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
wee_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
wee_log_printf (" is_chanowner . : %d\n", nick->is_chanowner);
|
||||
wee_log_printf (" is_chanadmin . : %d\n", nick->is_chanadmin);
|
||||
wee_log_printf (" is_op. . . . . : %d\n", nick->is_op);
|
||||
wee_log_printf (" is_halfop. . . : %d\n", nick->is_halfop);
|
||||
wee_log_printf (" has_voice. . . : %d\n", nick->has_voice);
|
||||
wee_log_printf (" is_away. . . . : %d\n", nick->is_away);
|
||||
wee_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
wee_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
wee_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
}
|
||||
|
||||
+531
-118
File diff suppressed because it is too large
Load Diff
+446
-96
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
@@ -187,6 +187,84 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_ban: bans nicks or hosts
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_ban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos, *pos2;
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
pos_channel = NULL;
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = ' ';
|
||||
pos = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
pos = arguments;
|
||||
|
||||
/* channel not given, use default buffer */
|
||||
if (!pos_channel)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
/* loop on users */
|
||||
while (pos && pos[0])
|
||||
{
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
}
|
||||
server_sendf (server, "MODE %s +b %s\r\n", pos_channel, pos);
|
||||
pos = pos2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "MODE %s +b\r\n", CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_ctcp: send a ctcp message
|
||||
*/
|
||||
@@ -246,21 +324,106 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dcc: starts DCC (file or chat)
|
||||
* irc_cmd_send_dcc: start DCC (file or chat)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
char *pos_nick, *pos_file;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
/* DCC SEND file */
|
||||
if (strncasecmp (arguments, "send", 4) == 0)
|
||||
{
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
return -1;
|
||||
}
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
|
||||
pos_file = strchr (pos_nick, ' ');
|
||||
if (!pos_file)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
return -1;
|
||||
}
|
||||
pos_file[0] = '\0';
|
||||
pos_file++;
|
||||
while (pos_file[0] == ' ')
|
||||
pos_file++;
|
||||
|
||||
dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file);
|
||||
}
|
||||
else if (strncasecmp (arguments, "chat", 4) == 0)
|
||||
{
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc chat");
|
||||
return -1;
|
||||
}
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
|
||||
dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL);
|
||||
}
|
||||
else if (strcasecmp (arguments, "close") == 0)
|
||||
{
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer) &&
|
||||
CHANNEL(gui_current_window->buffer)->dcc_chat)
|
||||
{
|
||||
dcc_close ((t_irc_dcc *)(CHANNEL(gui_current_window->buffer)->dcc_chat),
|
||||
DCC_ABORTED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("This command is not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dehalfop: remove half operator privileges from nickname(s)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dehalfop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -h %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "dehalfop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -283,9 +446,9 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -309,9 +472,9 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -331,6 +494,33 @@ irc_cmd_send_die (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_halfop: give half operator privileges to nickname(s)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_halfop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +h %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "halfop");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_info: get information describing the server
|
||||
*/
|
||||
@@ -350,9 +540,23 @@ irc_cmd_send_info (t_irc_server *server, char *arguments)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_invite (t_irc_server *server, char *arguments)
|
||||
irc_cmd_send_invite (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
server_sendf (server, "INVITE %s\r\n", arguments);
|
||||
if (argc == 2)
|
||||
server_sendf (server, "INVITE %s %s\r\n", argv[0], argv[1]);
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "invite");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "INVITE %s %s\r\n",
|
||||
argv[0], CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -385,37 +589,111 @@ irc_cmd_send_join (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *args, *pos;
|
||||
char *pos_channel, *pos_nick, *pos_comment;
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
server_sendf (server, "KICK %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
{
|
||||
args = strdup (arguments);
|
||||
pos = strchr (args, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
if (pos)
|
||||
server_sendf (server,
|
||||
"KICK %s %s :%s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name, args, pos + 1);
|
||||
else
|
||||
server_sendf (server,
|
||||
"KICK %s %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name, args);
|
||||
free (args);
|
||||
}
|
||||
else
|
||||
pos_channel = arguments;
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
}
|
||||
pos_nick[0] = '\0';
|
||||
pos_nick++;
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_nick = arguments;
|
||||
}
|
||||
|
||||
pos_comment = strchr (pos_nick, ' ');
|
||||
if (pos_comment)
|
||||
{
|
||||
pos_comment[0] = '\0';
|
||||
pos_comment++;
|
||||
while (pos_comment[0] == ' ')
|
||||
pos_comment++;
|
||||
}
|
||||
|
||||
if (pos_comment)
|
||||
server_sendf (server, "KICK %s %s :%s\r\n", pos_channel, pos_nick, pos_comment);
|
||||
else
|
||||
server_sendf (server, "KICK %s %s\r\n", pos_channel, pos_nick);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_kickban: forcibly remove a user from a channel and ban it
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_kickban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_nick, *pos_comment;
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
return -1;
|
||||
}
|
||||
pos_nick[0] = '\0';
|
||||
pos_nick++;
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_nick = arguments;
|
||||
}
|
||||
|
||||
pos_comment = strchr (pos_nick, ' ');
|
||||
if (pos_comment)
|
||||
{
|
||||
pos_comment[0] = '\0';
|
||||
pos_comment++;
|
||||
while (pos_comment[0] == ' ')
|
||||
pos_comment++;
|
||||
}
|
||||
|
||||
server_sendf (server, "MODE %s +b %s\r\n", pos_channel, pos_nick);
|
||||
if (pos_comment)
|
||||
server_sendf (server, "KICK %s %s :%s\r\n", pos_channel, pos_nick, pos_comment);
|
||||
else
|
||||
server_sendf (server, "KICK %s %s\r\n", pos_channel, pos_nick);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -520,9 +798,9 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
return -1;
|
||||
}
|
||||
irc_send_me (server, CHANNEL(gui_current_window->buffer), arguments);
|
||||
@@ -587,9 +865,9 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
return -1;
|
||||
}
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
@@ -598,16 +876,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
}
|
||||
@@ -623,16 +901,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
}
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -659,13 +937,13 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_color (server->buffer,
|
||||
@@ -682,26 +960,25 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -713,9 +990,9 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -735,9 +1012,9 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -787,9 +1064,9 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -814,9 +1091,9 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -862,9 +1139,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
@@ -876,9 +1153,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
@@ -960,10 +1237,9 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
@@ -984,17 +1260,17 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -1209,9 +1485,9 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
@@ -1243,6 +1519,80 @@ irc_cmd_send_trace (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_unban: unbans nicks or hosts
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_unban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos, *pos2;
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
pos_channel = NULL;
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = ' ';
|
||||
pos = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
pos = arguments;
|
||||
|
||||
/* channel not given, use default buffer */
|
||||
if (!pos_channel)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
/* loop on users */
|
||||
while (pos && pos[0])
|
||||
{
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
}
|
||||
server_sendf (server, "MODE %s -b %s\r\n", pos_channel, pos);
|
||||
pos = pos2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_userhost: return a list of information about nicknames
|
||||
*/
|
||||
@@ -1315,9 +1665,9 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+334
-148
@@ -27,12 +27,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
@@ -57,6 +59,7 @@ int check_away = 0;
|
||||
void
|
||||
server_init (t_irc_server *server)
|
||||
{
|
||||
/* user choices */
|
||||
server->name = NULL;
|
||||
server->autoconnect = 0;
|
||||
server->autoreconnect = 1;
|
||||
@@ -73,14 +76,18 @@ server_init (t_irc_server *server)
|
||||
server->command = NULL;
|
||||
server->command_delay = 1;
|
||||
server->autojoin = NULL;
|
||||
server->autorejoin = 0;
|
||||
|
||||
/* internal vars */
|
||||
server->child_pid = 0;
|
||||
server->child_read = -1;
|
||||
server->child_write = -1;
|
||||
server->sock = -1;
|
||||
server->is_connected = 0;
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->is_connected = 0;
|
||||
server->reconnect_start = 0;
|
||||
server->reconnect_join = 0;
|
||||
server->sock4 = -1;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
@@ -264,6 +271,10 @@ server_free (t_irc_server *server)
|
||||
{
|
||||
t_irc_server *new_irc_servers;
|
||||
|
||||
/* close any opened channel/private */
|
||||
while (server->channels)
|
||||
channel_free (server, server->channels);
|
||||
|
||||
/* remove server from queue */
|
||||
if (last_irc_server == server)
|
||||
last_irc_server = server->prev_server;
|
||||
@@ -357,12 +368,12 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
*/
|
||||
|
||||
int
|
||||
server_send (t_irc_server * server, char *buffer, int size_buf)
|
||||
server_send (t_irc_server *server, char *buffer, int size_buf)
|
||||
{
|
||||
if (!server)
|
||||
return -1;
|
||||
|
||||
return send (server->sock4, buffer, size_buf, 0);
|
||||
return send (server->sock, buffer, size_buf, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -370,23 +381,23 @@ server_send (t_irc_server * server, char *buffer, int size_buf)
|
||||
*/
|
||||
|
||||
void
|
||||
server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
static char buffer[4096];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
|
||||
va_start (args, fmt);
|
||||
size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
|
||||
return;
|
||||
|
||||
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
@@ -491,11 +502,11 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (buffer, '\0');
|
||||
if (pos)
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (server->unterminated_message) +
|
||||
strlen (buffer) + 1);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
@@ -505,13 +516,21 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcpy (server->unterminated_message, buffer);
|
||||
return;
|
||||
strcat (server->unterminated_message, buffer);
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,8 +546,7 @@ server_msgq_flush ()
|
||||
t_irc_message *next;
|
||||
char *entire_line, *ptr_data, *pos, *pos2;
|
||||
char *host, *command, *args;
|
||||
|
||||
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
|
||||
|
||||
while (recv_msgq)
|
||||
{
|
||||
if (recv_msgq->data)
|
||||
@@ -555,9 +573,9 @@ server_msgq_flush ()
|
||||
|
||||
if (ptr_data[0] == ':')
|
||||
{
|
||||
pos = strchr(ptr_data, ' ');
|
||||
pos = strchr (ptr_data, ' ');
|
||||
pos[0] = '\0';
|
||||
host = ptr_data+1;
|
||||
host = ptr_data + 1;
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
@@ -567,15 +585,15 @@ server_msgq_flush ()
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr(pos, ' ');
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2 != NULL)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
command = strdup(pos);
|
||||
command = strdup (pos);
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
args = (pos2[0] == ':') ? pos2+1 : pos2;
|
||||
args = (pos2[0] == ':') ? pos2 + 1 : pos2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +614,7 @@ server_msgq_flush ()
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_ERROR, command, args);
|
||||
WEECHAT_WARNING, command, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -626,7 +644,7 @@ server_recv (t_irc_server *server)
|
||||
static char buffer[4096 + 2];
|
||||
int num_read;
|
||||
|
||||
num_read = recv (server->sock4, buffer, sizeof (buffer) - 2, 0);
|
||||
num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0);
|
||||
if (num_read > 0)
|
||||
{
|
||||
buffer[num_read] = '\0';
|
||||
@@ -643,6 +661,174 @@ server_recv (t_irc_server *server)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_kill_child: kill child process and close pipe
|
||||
*/
|
||||
|
||||
void
|
||||
server_kill_child (t_irc_server *server)
|
||||
{
|
||||
/* kill process */
|
||||
if (server->child_pid > 0)
|
||||
{
|
||||
kill (server->child_pid, SIGKILL);
|
||||
waitpid (server->child_pid, NULL, 0);
|
||||
server->child_pid = 0;
|
||||
}
|
||||
|
||||
/* close pipe used with child */
|
||||
if (server->child_read != -1)
|
||||
{
|
||||
close (server->child_read);
|
||||
server->child_read = -1;
|
||||
}
|
||||
if (server->child_write != -1)
|
||||
{
|
||||
close (server->child_write);
|
||||
server->child_write = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_close_connection: close server connection (kill child, close socket/pipes)
|
||||
*/
|
||||
|
||||
void
|
||||
server_close_connection (t_irc_server *server)
|
||||
{
|
||||
server_kill_child (server);
|
||||
|
||||
/* close network socket */
|
||||
if (server->sock != -1)
|
||||
{
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
}
|
||||
|
||||
/* free any pending message */
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
}
|
||||
|
||||
/* server is now disconnected */
|
||||
server->is_connected = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_reconnect_schedule: schedule reconnect for a server
|
||||
*/
|
||||
|
||||
void
|
||||
server_reconnect_schedule (t_irc_server *server)
|
||||
{
|
||||
if (server->autoreconnect)
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_child_read: read connection progress from child process
|
||||
*/
|
||||
|
||||
void
|
||||
server_child_read (t_irc_server *server)
|
||||
{
|
||||
char buffer[1];
|
||||
int num_read;
|
||||
|
||||
num_read = read (server->child_read, buffer, sizeof (buffer));
|
||||
if (num_read != -1)
|
||||
{
|
||||
switch (buffer[0])
|
||||
{
|
||||
/* connection OK */
|
||||
case '0':
|
||||
server_kill_child (server);
|
||||
irc_login (server);
|
||||
break;
|
||||
/* adress not found */
|
||||
case '1':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
/* IP address not found */
|
||||
case '2':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
/* connection refused */
|
||||
case '3':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s connection refused\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_child: child process trying to connect to server
|
||||
*/
|
||||
|
||||
int
|
||||
server_child (t_irc_server *server)
|
||||
{
|
||||
struct hostent *ip4_hostent;
|
||||
struct sockaddr_in addr;
|
||||
char *ip_address;
|
||||
int error;
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
write (server->child_write, "1", 1);
|
||||
return 0;
|
||||
}
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
memcpy (&addr.sin_addr, ip4_hostent->h_addr, ip4_hostent->h_length);
|
||||
addr.sin_port = htons (server->port);
|
||||
addr.sin_family = AF_INET;
|
||||
|
||||
/* find IP address */
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
write (server->child_write, "2", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connect to server */
|
||||
error = connect (server->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
write (server->child_write, "3", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connection OK */
|
||||
write (server->child_write, "0", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_connect: connect to an IRC server
|
||||
*/
|
||||
@@ -650,12 +836,8 @@ server_recv (t_irc_server *server)
|
||||
int
|
||||
server_connect (t_irc_server *server)
|
||||
{
|
||||
int set;
|
||||
struct hostent *ip4_hostent;
|
||||
struct sockaddr_in addr;
|
||||
char *ip_address;
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
int child_pipe[2], set;
|
||||
pid_t pid;
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
@@ -663,100 +845,70 @@ server_connect (t_irc_server *server)
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
server->is_connected = 0;
|
||||
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
|
||||
/* close any opened connection and kill child process if running */
|
||||
server_close_connection (server);
|
||||
|
||||
/* create pipe for child process */
|
||||
if (pipe (child_pipe) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
return 0;
|
||||
}
|
||||
server->server_read = server_pipe[0];
|
||||
server->server_write = server_pipe[1];
|
||||
|
||||
server->child_read = child_pipe[0];
|
||||
server->child_write = child_pipe[1];
|
||||
|
||||
/* create socket and set options */
|
||||
server->sock4 = socket (AF_INET, SOCK_STREAM, 0);
|
||||
server->sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (server->sock == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create socket\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set SO_REUSEADDR option for socket */
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
|
||||
/* set SO_KEEPALIVE option for socket */
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
|
||||
switch (pid = fork ())
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
}
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
memcpy (&addr.sin_addr, ip4_hostent->h_addr, ip4_hostent->h_length);
|
||||
addr.sin_port = htons (server->port);
|
||||
addr.sin_family = AF_INET;
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s can't bind to hostname\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
}*/
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
/* fork failed */
|
||||
case -1:
|
||||
server_close_connection (server);
|
||||
return 0;
|
||||
/* child process */
|
||||
case 0:
|
||||
setuid (getuid ());
|
||||
server_child (server);
|
||||
_exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* parent process go on here */
|
||||
server->child_pid = pid;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -773,17 +925,9 @@ server_reconnect (t_irc_server *server)
|
||||
server->reconnect_start = 0;
|
||||
|
||||
if (server_connect (server))
|
||||
{
|
||||
server->reconnect_join = 1;
|
||||
irc_login (server);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
server_reconnect_schedule (server);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -802,8 +946,8 @@ server_auto_connect (int command_line)
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
server_connect (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -829,24 +973,14 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
}
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
if (server->server_read >= 0)
|
||||
close (server->server_read);
|
||||
server->server_read = -1;
|
||||
server_close_connection (server);
|
||||
|
||||
if (server->server_write >= 0)
|
||||
close (server->server_write);
|
||||
server->server_write = -1;
|
||||
if (server->buffer)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
|
||||
if (server->sock4 >= 0)
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
|
||||
server->is_connected = 0;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
@@ -855,12 +989,7 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
|
||||
if ((reconnect) && (server->autoreconnect))
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
server_reconnect_schedule (server);
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
|
||||
@@ -947,10 +1076,13 @@ server_remove_away ()
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -967,10 +1099,13 @@ server_check_away ()
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -986,7 +1121,58 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
if (server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_print_log: print server infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
server_print_log (t_irc_server *server)
|
||||
{
|
||||
wee_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
wee_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
wee_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
wee_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
wee_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
wee_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
wee_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
wee_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ? "(hidden)" : server->password);
|
||||
wee_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
wee_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
wee_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
wee_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
wee_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
wee_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ? "(hidden)" : server->command);
|
||||
wee_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
wee_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
wee_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
wee_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
wee_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
wee_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
wee_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
wee_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
wee_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
wee_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
wee_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
wee_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
wee_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
wee_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
wee_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
wee_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec, server->lag_check_time.tv_usec);
|
||||
wee_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
wee_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
wee_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
wee_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
wee_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
}
|
||||
|
||||
+52
-17
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
@@ -70,6 +71,14 @@
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -77,6 +86,8 @@ typedef struct t_irc_nick t_irc_nick;
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int is_chanowner; /* chan owner? (specific to unrealircd) */
|
||||
int is_chanadmin; /* chan admin? (specific to unrealircd) */
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
@@ -97,11 +108,13 @@ typedef struct t_irc_channel t_irc_channel;
|
||||
struct t_irc_channel
|
||||
{
|
||||
int type; /* channel type */
|
||||
void *dcc_chat; /* DCC CHAT pointer (NULL if not DCC) */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int nicks_count; /* # nicks on channel (0 if dcc/pv) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
@@ -136,14 +149,15 @@ struct t_irc_server
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
int child_read; /* to read into child pipe */
|
||||
int child_write; /* to write into child pipe */
|
||||
int sock; /* socket for server */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int sock4; /* socket for server */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
@@ -189,32 +203,36 @@ struct t_irc_message
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_dcc t_dcc;
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
struct t_dcc
|
||||
struct t_irc_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
t_irc_channel *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 */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int sock; /* socket for connection */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
int file; /* local file (for reading or writing) */
|
||||
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 */
|
||||
t_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
unsigned long ack; /* number of bytes received OK */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern int check_away;
|
||||
extern t_dcc *dcc_list;
|
||||
extern t_irc_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
@@ -232,6 +250,7 @@ extern t_irc_server *server_new (char *, int, int, int, int, char *, int, char *
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
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);
|
||||
@@ -243,6 +262,7 @@ extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
extern void server_print_log (t_irc_server *);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -254,10 +274,13 @@ extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int);
|
||||
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 *);
|
||||
extern void nick_free (t_irc_channel *, t_irc_nick *);
|
||||
@@ -266,15 +289,18 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
extern void nick_print_log (t_irc_nick *);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
extern void dcc_free (t_dcc *);
|
||||
extern void dcc_close (t_dcc *, int);
|
||||
extern void dcc_accept (t_dcc *);
|
||||
extern t_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, char *,
|
||||
unsigned int);
|
||||
extern void dcc_redraw (int);
|
||||
extern void dcc_free (t_irc_dcc *);
|
||||
extern void dcc_close (t_irc_dcc *, int);
|
||||
extern void dcc_accept (t_irc_dcc *);
|
||||
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
|
||||
char *, char *, unsigned long);
|
||||
extern void dcc_send_request (t_irc_server *, int, char *, char *);
|
||||
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
|
||||
@@ -293,16 +319,20 @@ extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dehalfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_halfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_info (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ison (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_join (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kickban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_links (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_list (t_irc_server *, char *);
|
||||
@@ -335,6 +365,7 @@ extern int irc_cmd_send_summon (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_time (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_trace (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_unban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_userhost (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_users (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_version (t_irc_server *, char *);
|
||||
@@ -345,6 +376,7 @@ 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_mode (t_irc_server *, char *, char *);
|
||||
@@ -387,6 +419,9 @@ 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 *);
|
||||
|
||||
#endif /* irc.h */
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#undef _
|
||||
#include "../../common/weechat.h"
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
@@ -450,13 +451,13 @@ wee_perl_init ()
|
||||
" my $content = wee_perl_load_file ($filename);"
|
||||
" if ($content eq \"__WEECHAT_ERROR__\")"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " Perl script '$filename' not found.\\n\";"
|
||||
" IRC::print \"WeeChat Error: Perl script '$filename' not found.\\n\";"
|
||||
" return 1;"
|
||||
" }"
|
||||
" eval $content;"
|
||||
" if ($@)"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"WeeChat error: unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"$@\\n\";"
|
||||
" return 2;"
|
||||
" }"
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.1.0
|
||||
%define version 0.1.1
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Mar 20 2005 FlashCode <flashcode@flashtux.org> 0.1.1-1
|
||||
- Released version 0.1.1
|
||||
* Sat Feb 12 2005 FlashCode <flashcode@flashtux.org> 0.1.0-1
|
||||
- Released version 0.1.0
|
||||
* Sat Jan 01 2005 FlashCode <flashcode@flashtux.org> 0.0.9-1
|
||||
|
||||
+22
-1
@@ -1,9 +1,30 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-02-12
|
||||
ChangeLog - 2005-03-20
|
||||
|
||||
|
||||
Version 0.1.1 (2005-03-20):
|
||||
* added nicks count for channel buffers
|
||||
* added FIFO pipe for remote control
|
||||
* added crash dump when WeeChat receives SIGSEGV (Segmentation fault)
|
||||
* added new display engine: doesn't cut words at end of lines
|
||||
* added DCC send and DCC chat
|
||||
* added /halfop & /dehalfop commands, fixed halfop display bug in nicklist
|
||||
* added /ban, /unban and /kickban commands
|
||||
* added spanish translation
|
||||
* added --irc-commands and --weechat-commands command line options
|
||||
* connection to IRC server is now made by child process (non blocking)
|
||||
* added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
|
||||
* new key for window switch (now: F5/F6=switch buffer, F7/F8=switch window)
|
||||
* on server buffer, only server messages are logged
|
||||
* improved /help command output
|
||||
* plugins messages are logged with new config option (log_plugin_msg)
|
||||
* fixed /kick command
|
||||
* fixed /invite command (and now invite requests are displayed)
|
||||
* fixed /buffer close command (now ok when disconnected from server)
|
||||
* fixed display bugs when many windows are opened
|
||||
|
||||
Version 0.1.0 (2005-02-12):
|
||||
* improved /window command: now split and merge are ok
|
||||
* away nicks are now displayed with another color (new option: "irc_away_check")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2005-03-20
|
||||
|
||||
WeeChat 0.1.1 released.
|
||||
|
||||
* FlashCode, 2005-02-12
|
||||
|
||||
WeeChat 0.1.0 released.
|
||||
|
||||
+5
-4
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-02-12
|
||||
TODO - 2005-03-20
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -16,10 +16,11 @@ v0.1.1:
|
||||
* General:
|
||||
+ Windows version
|
||||
+ Solaris version
|
||||
- *BSD version
|
||||
+ *BSD version
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
# "/dcc send" command
|
||||
# "/dcc chat" command (and incoming DCC chats)
|
||||
- customizable CTCP version reply
|
||||
|
||||
* Interface:
|
||||
@@ -27,7 +28,7 @@ v0.1.1:
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
|
||||
* TCP/IP communication:
|
||||
- connect to server with child process (background)
|
||||
# connect to server with child process (background)
|
||||
|
||||
|
||||
Future versions:
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.1.0, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.1.1, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.0])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.1.1])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -30,7 +30,7 @@ AC_PROG_MAKE_SET
|
||||
AC_PROG_RANLIB
|
||||
|
||||
# Gettext
|
||||
ALL_LINGUAS="fr"
|
||||
ALL_LINGUAS="fr es"
|
||||
AM_GNU_GETTEXT
|
||||
|
||||
# Checks for libraries.
|
||||
@@ -45,8 +45,6 @@ AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
weechat (0.1.1-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.1, see ChangeLog for detail.
|
||||
|
||||
-- Sebastien Helleu <flashcode@flashtux.org> Sat, 20 Mar 2005 08:00:00 +0200
|
||||
|
||||
weechat (0.1.0-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.1.0, see ChangeLog for detail.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 12 Jan 2005 12:00:00 +0200.
|
||||
Sat, 20 Mar 2005 08:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2003 FlashCode <flashcode@flashtux.org>
|
||||
# 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
|
||||
@@ -15,15 +15,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi
|
||||
all: weechat_doc_fr.texi weechat_doc_en.texi weechat_doc_pt.texi weechat_doc_es.texi
|
||||
export LANG=fr_FR && makeinfo --html --no-split --number-sections weechat_doc_fr.texi
|
||||
export LANG=fr_FR && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_fr.texi >weechat_doc_fr.txt
|
||||
export LANG=en_EN && makeinfo --html --no-split --number-sections weechat_doc_en.texi
|
||||
export LANG=en_EN && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_en.texi >weechat_doc_en.txt
|
||||
export LANG=es_ES && makeinfo --html --no-split --number-sections weechat_doc_es.texi
|
||||
export LANG=es_ES && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_es.texi >weechat_doc_es.txt
|
||||
export LANG=pt_PT && makeinfo --html --no-split --number-sections weechat_doc_pt.texi
|
||||
export LANG=pt_PT && makeinfo --no-headers --no-warn --no-split --number-sections weechat_doc_pt.texi >weechat_doc_pt.txt
|
||||
export LANG=fr_FR && texi2pdf weechat_doc_fr.texi
|
||||
export LANG=en_EN && texi2pdf weechat_doc_en.texi
|
||||
export LANG=es_ES && texi2pdf weechat_doc_es.texi
|
||||
export LANG=pt_PT && texi2pdf weechat_doc_pt.texi
|
||||
|
||||
clean:
|
||||
|
||||
+552
-22
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.0 - February, 12 2005
|
||||
@subtitle Documentation for WeeChat v0.1.1 - March, 20 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
This manual documents WeeChat IRC client, it is part of WeeChat.@*
|
||||
@*
|
||||
Latest version of this document can be found on this page:@*
|
||||
@uref{http://weechat.flashtux.org/doc.php?lang=en}@*
|
||||
@uref{http://weechat.flashtux.org/doc.php}@*
|
||||
@*
|
||||
Copyright @copyright{} 2005 FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>@*
|
||||
@@ -209,6 +209,7 @@ Then follow instructions for source package - @xref{Source package}.
|
||||
* Config file::
|
||||
* Key bindings::
|
||||
* WeeChat commands::
|
||||
* FIFO pipe::
|
||||
@end menu
|
||||
|
||||
@node Run WeeChat, Config file, Usage, Usage
|
||||
@@ -244,9 +245,10 @@ set parameters with @kbd{/set} command in WeeChat - @xref{WeeChat commands}.
|
||||
@node Config file, Key bindings, Run WeeChat, Usage
|
||||
@section Config file
|
||||
|
||||
Here is a list of all options for config file:@*
|
||||
List of options for config file:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item look_set_title
|
||||
Set title for window (terminal for Curses GUI) with name & version@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -261,10 +263,13 @@ WeeChat slogan (if empty, slogan is not used)@*
|
||||
Type: string (any string), default value: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
Type: string (any string), default value: 'UTF-8'@*
|
||||
@item look_charset_encode
|
||||
Charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item look_charset_internal
|
||||
Internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)@*
|
||||
Type: string (any string), default value: 'ISO-8859-1'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -394,6 +399,12 @@ Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_nick_away
|
||||
Color for away nicknames@*
|
||||
Type: color (Curses or Gtk color), default value: 'cyan'@*
|
||||
@item col_nick_chanowner
|
||||
Color for chan owner symbol (specific to unrealircd)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_nick_chanadmin
|
||||
Color for chan admin symbol (specific to unrealircd)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@item col_nick_op
|
||||
Color for operator symbol@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightgreen'@*
|
||||
@@ -420,7 +431,7 @@ Color for selected DCC (chat window)@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Color for "waiting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'white'@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
|
||||
@item col_dcc_connecting
|
||||
Color for "connecting" dcc status@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@@ -451,6 +462,9 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_auto_private
|
||||
Automatically log private chats@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_plugin_msg
|
||||
Log messages from plugins (scripts)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item log_path
|
||||
Path for WeeChat log files@*
|
||||
Type: string (any string), default value: '~/.weechat/logs/'@*
|
||||
@@ -474,7 +488,7 @@ Default quit message ('%v' will be replaced by WeeChat version in string)@*
|
||||
Type: string (any string), default value: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Interval between two checks for away (in minutes, 0 = never check)@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 1@*
|
||||
Type: integer (values: between 0 and 2147483647), default value: 0@*
|
||||
@item irc_lag_check
|
||||
Interval between two checks for lag (in seconds)@*
|
||||
Type: integer (values: between 30 and 2147483647), default value: 60@*
|
||||
@@ -489,19 +503,22 @@ Automatically accept incoming dcc files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Automatically accept dcc chats (use carefully!)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item dcc_timeout
|
||||
Timeout for dcc request (in seconds)@*
|
||||
Type: integer (values: between 1 and 2147483647), default value: 300@*
|
||||
@item dcc_blocksize
|
||||
Block size for dcc packets in bytes (default: 1024)@*
|
||||
Type: integer (values: between 1024 and 102400), default value: 1024@*
|
||||
Block size for dcc packets in bytes (default: 65536)@*
|
||||
Type: integer (values: between 1024 and 102400), default value: 65536@*
|
||||
@item dcc_download_path
|
||||
Path for writing incoming files with dcc (default: user home)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_upload_path
|
||||
Path for reading files when sending thru dcc (when no path is specified)@*
|
||||
Type: string (any string), default value: '~'@*
|
||||
@item dcc_convert_spaces
|
||||
Convert spaces to underscores when sending files@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item dcc_auto_rename
|
||||
Rename incoming files if already exists (add '.1', '.2', ...)@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@@ -530,7 +547,7 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
Automatically reconnect to server when disconnected@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_autoreconnect_delay
|
||||
Delay (in deconds) before trying again to reconnect to server@*
|
||||
Delay (in seconds) before trying again to reconnect to server@*
|
||||
Type: integer (values: between 0 and 65535), default value: 30@*
|
||||
@item server_address
|
||||
IP address or hostname of IRC server@*
|
||||
@@ -568,6 +585,7 @@ Type: string (any string), default value: ''@*
|
||||
@item server_autorejoin
|
||||
Automatically rejoin channels when kicked@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@@ -641,11 +659,11 @@ Call again last commands/messages@*
|
||||
@item PageUp / PageDown
|
||||
Show buffer history@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
@item F5 / F6
|
||||
Switch to previous / next buffer@*
|
||||
@*
|
||||
@item F8
|
||||
Switch to next window@*
|
||||
@item F7 / F8
|
||||
Switch to previous / next window@*
|
||||
@*
|
||||
@item F10
|
||||
Remove last infobar message@*
|
||||
@@ -654,7 +672,7 @@ Remove last infobar message@*
|
||||
Redraw whole window@*
|
||||
@*
|
||||
@item Alt + left arrow / Alt + right arrow
|
||||
Same as F6 / F7@*
|
||||
Same as F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Switch to next buffer with activity (with priority: highlight, message, other)@*
|
||||
@@ -676,10 +694,528 @@ Switch to buffer by number@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node WeeChat commands, , Key bindings, Usage
|
||||
@node WeeChat commands, FIFO pipe, Key bindings, Usage
|
||||
@section WeeChat commands
|
||||
|
||||
NOT WRITTEN!
|
||||
WeeChat internal commands:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item alias [alias_name [command [arguments]]
|
||||
@*
|
||||
create an alias for a command@*
|
||||
@*
|
||||
alias_name: name of alias@*
|
||||
command: command name (WeeChat or IRC command, without first '/')@*
|
||||
arguments: arguments for command@*
|
||||
@*
|
||||
@item buffer [action | number]
|
||||
@*
|
||||
manage buffers@*
|
||||
@*
|
||||
action: action to do:@*
|
||||
move: move buffer in the list (may be relative, for example -1)@*
|
||||
close: close buffer (for channel: same as /part without part message)@*
|
||||
list: list opened buffers (no parameter implies this list)@*
|
||||
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
@*
|
||||
-all: clear all windows@*
|
||||
@*
|
||||
@item connect [servername]
|
||||
@*
|
||||
connect to a server@*
|
||||
@*
|
||||
servername: server name to connect@*
|
||||
@*
|
||||
@item disconnect [servername]
|
||||
@*
|
||||
disconnect from a server@*
|
||||
@*
|
||||
servername: server name to disconnect@*
|
||||
@*
|
||||
@item debug dump
|
||||
@*
|
||||
print debug messages@*
|
||||
@*
|
||||
dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)@*
|
||||
@*
|
||||
@item help [command]
|
||||
@*
|
||||
display help about commands@*
|
||||
@*
|
||||
command: name of a WeeChat or IRC command@*
|
||||
@*
|
||||
@item perl [load filename] | [autoload] | [unload]
|
||||
@*
|
||||
list/load/unload Perl scripts@*
|
||||
@*
|
||||
filename: Perl script (file) to load@*
|
||||
Without argument, /perl command lists all loaded Perl scripts.@*
|
||||
@*
|
||||
@item server [servername] | [servername hostname port [-auto | -noauto] [-pwd password] [-nicks nick1 [nick2 [nick3]]] [-username username] [-realname realname] [-command command] [-autojoin channel[,channel]] ] | [del servername]
|
||||
@*
|
||||
list, add or remove servers@*
|
||||
@*
|
||||
servername: server name, for internal & display use@*
|
||||
hostname: name or IP address of server@*
|
||||
port: port for server (integer)@*
|
||||
password: password for server@*
|
||||
nick1: first nick for server@*
|
||||
nick2: alternate nick for server@*
|
||||
nick3: second alternate nick for server@*
|
||||
username: user name@*
|
||||
realname: real name of user@*
|
||||
@*
|
||||
@item save [file]
|
||||
@*
|
||||
save config to disk@*
|
||||
@*
|
||||
file: filename for writing config@*
|
||||
@*
|
||||
@item set [option[=value]]
|
||||
@*
|
||||
set config parameters@*
|
||||
@*
|
||||
option: name of an option@*
|
||||
value: value for option@*
|
||||
@*
|
||||
@item unalias alias_name
|
||||
@*
|
||||
remove an alias@*
|
||||
@*
|
||||
alias_name: name of alias to remove@*
|
||||
@*
|
||||
@item window [list | splith | splitv | [merge [down | up | left | right | all]]]
|
||||
@*
|
||||
manage windows@*
|
||||
@*
|
||||
list: list opened windows (no parameter implies this list)@*
|
||||
splith: split current window horizontally@*
|
||||
splitv: split current window vertically@*
|
||||
merge: merge window with another@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
IRC commands:@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item admin [target]
|
||||
@*
|
||||
find information about the administrator of the server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item away [-all] [message]
|
||||
@*
|
||||
toggle away status@*
|
||||
@*
|
||||
-all: toggle away status on all connected servers@*
|
||||
message: message for away (if no message is given, away status is removed)@*
|
||||
@*
|
||||
@item ban [channel] [nickname [nickname ...]]
|
||||
@*
|
||||
bans nicks or hosts@*
|
||||
@*
|
||||
channel: channel for ban@*
|
||||
nickname: user or host to ban@*
|
||||
@*
|
||||
@item ctcp nickname type
|
||||
@*
|
||||
send a ctcp message@*
|
||||
@*
|
||||
nickname: user to send ctcp to@*
|
||||
type: "action" or "version"@*
|
||||
@*
|
||||
@item dcc action [nickname [file]]
|
||||
@*
|
||||
starts DCC (file or chat) or close chat@*
|
||||
@*
|
||||
action: 'send' (file) or 'chat' or 'close' (chat)@*
|
||||
nickname: nickname to send file or chat@*
|
||||
file: filename (on local host)@*
|
||||
@*
|
||||
@item dehalfop nickname [nickname]
|
||||
@*
|
||||
removes half channel operator status from nickname(s)@*
|
||||
@*
|
||||
@item deop nickname [nickname]
|
||||
@*
|
||||
removes channel operator status from nickname(s)@*
|
||||
@*
|
||||
@item devoice nickname [nickname]
|
||||
@*
|
||||
removes voice from nickname(s)@*
|
||||
@*
|
||||
@item die
|
||||
@*
|
||||
shutdown the server@*
|
||||
@*
|
||||
@item halfop nickname [nickname]
|
||||
@*
|
||||
gives half channel operator status to nickname(s)@*
|
||||
@*
|
||||
@item info [target]
|
||||
@*
|
||||
get information describing the server@*
|
||||
@*
|
||||
target: server name@*
|
||||
@*
|
||||
@item invite nickname channel
|
||||
@*
|
||||
invite a nick on a channel@*
|
||||
@*
|
||||
nickname: nick to invite@*
|
||||
channel: channel to invite@*
|
||||
@*
|
||||
@item ison nickname [nickname ...]
|
||||
@*
|
||||
check if a nickname is currently on IRC@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item join channel[,channel] [key[,key]]
|
||||
@*
|
||||
join a channel@*
|
||||
@*
|
||||
channel: channel name to join@*
|
||||
key: key to join the channel@*
|
||||
@*
|
||||
@item kick [channel] nickname [comment]
|
||||
@*
|
||||
forcibly remove a user from a channel@*
|
||||
@*
|
||||
channel: channel where user is@*
|
||||
nickname: nickname to kick@*
|
||||
comment: comment for kick@*
|
||||
@*
|
||||
@item kickban [channel] nickname [comment]
|
||||
@*
|
||||
kicks and bans a nick from a channel@*
|
||||
@*
|
||||
channel: channel where user is@*
|
||||
nickname: nickname to kick and ban@*
|
||||
comment: comment for kick@*
|
||||
@*
|
||||
@item kill nickname comment
|
||||
@*
|
||||
close client-server connection@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
comment: comment for kill@*
|
||||
@*
|
||||
@item links [[server] server_mask]
|
||||
@*
|
||||
list all servernames which are known by the server answering the query@*
|
||||
@*
|
||||
server: this server should answer the query@*
|
||||
server_mask: list of servers must match this mask@*
|
||||
@*
|
||||
@item list [channel[,channel] [server]]
|
||||
@*
|
||||
list channels and their topic@*
|
||||
@*
|
||||
channel: channel to list@*
|
||||
server: server name@*
|
||||
@*
|
||||
@item lusers [mask [target]]
|
||||
@*
|
||||
get statistics about the size of the IRC network@*
|
||||
@*
|
||||
mask: servers matching the mask only@*
|
||||
target: server for forwarding request@*
|
||||
@*
|
||||
@item me message
|
||||
@*
|
||||
send a ctcp action to the current channel@*
|
||||
@*
|
||||
message: message to send@*
|
||||
@*
|
||||
@item mode @{ channel @{[+|-]|o|p|s|i|t|n|b|v@} [limit] [user] [ban mask] @} | @{ nickname @{[+|-]|i|w|s|o@} @}
|
||||
@*
|
||||
change channel or user mode@*
|
||||
@*
|
||||
channel modes:@*
|
||||
channel: channel name to modify@*
|
||||
o: give/take channel operator privileges@*
|
||||
p: private channel flag@*
|
||||
s: secret channel flag@*
|
||||
i: invite-only channel flag@*
|
||||
t: topic settable by channel operator only flag@*
|
||||
n: no messages to channel from clients on the outside@*
|
||||
m: moderated channel@*
|
||||
l: set the user limit to channel@*
|
||||
b: set a ban mask to keep users out@*
|
||||
v: give/take the ability to speak on a moderated channel@*
|
||||
k: set a channel key (password)@*
|
||||
user modes:@*
|
||||
nickname: nickname to modify@*
|
||||
i: mark a user as invisible@*
|
||||
s: mark a user for receive server notices@*
|
||||
w: user receives wallops@*
|
||||
o: operator flag@*
|
||||
@*
|
||||
@item motd [target]
|
||||
@*
|
||||
get the "Message Of The Day"@*
|
||||
@*
|
||||
target: server name@*
|
||||
@*
|
||||
@item msg receiver[,receiver] text
|
||||
@*
|
||||
send message to a nick or channel@*
|
||||
@*
|
||||
receiver: nick or channel (may be mask, '*' = current channel)@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item names [channel[,channel]]
|
||||
@*
|
||||
list nicknames on channels@*
|
||||
@*
|
||||
channel: channel name@*
|
||||
@*
|
||||
@item nick nickname
|
||||
@*
|
||||
change current nickname@*
|
||||
@*
|
||||
nickname: new nickname for current IRC server@*
|
||||
@*
|
||||
@item notice nickname text
|
||||
@*
|
||||
send notice message to user@*
|
||||
@*
|
||||
nickname: user to send notice to@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item op nickname [nickname]
|
||||
@*
|
||||
gives channel operator status to nickname(s)@*
|
||||
@*
|
||||
@item oper user password
|
||||
@*
|
||||
get operator privileges@*
|
||||
@*
|
||||
user/password: used to get privileges on current IRC server@*
|
||||
@*
|
||||
@item part [channel[,channel]] [part_message]
|
||||
@*
|
||||
leave a channel@*
|
||||
@*
|
||||
channel: channel name to leave@*
|
||||
part_message: part message (displayed to other users)@*
|
||||
@*
|
||||
@item ping server1 [server2]
|
||||
@*
|
||||
ping server@*
|
||||
@*
|
||||
server1: server to ping@*
|
||||
server2: forward ping to this server@*
|
||||
@*
|
||||
@item pong daemon [daemon2]
|
||||
@*
|
||||
answer to a ping message@*
|
||||
@*
|
||||
daemon: daemon who has responded to Ping message@*
|
||||
daemon2: forward message to this daemon@*
|
||||
@*
|
||||
@item query nickname [text]
|
||||
@*
|
||||
send a private message to a nick@*
|
||||
@*
|
||||
nickname: nickname for private conversation@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item quit [quit_message]
|
||||
@*
|
||||
close all connections & quit@*
|
||||
@*
|
||||
quit_message: quit message (displayed to other users)@*
|
||||
@*
|
||||
@item quote data
|
||||
@*
|
||||
send raw data to server without parsing@*
|
||||
@*
|
||||
data: raw data to send@*
|
||||
@*
|
||||
@item rehash
|
||||
@*
|
||||
tell the server to reload its config file@*
|
||||
@*
|
||||
@item restart
|
||||
@*
|
||||
tell the server to restart itself@*
|
||||
@*
|
||||
@item service nickname reserved distribution type reserved info
|
||||
@*
|
||||
register a new service@*
|
||||
@*
|
||||
distribution: visibility of service@*
|
||||
type: reserved for future usage@*
|
||||
@*
|
||||
@item servlist [mask [type]]
|
||||
@*
|
||||
list services currently connected to the network@*
|
||||
@*
|
||||
mask: list only services matching this mask@*
|
||||
type: list only services of this type@*
|
||||
@*
|
||||
@item squery service text
|
||||
@*
|
||||
deliver a message to a service@*
|
||||
@*
|
||||
service: name of service@*
|
||||
text: text to send@*
|
||||
@*
|
||||
@item squit server comment
|
||||
@*
|
||||
disconnect server links@*
|
||||
@*
|
||||
server: server name@*
|
||||
comment: comment for quit@*
|
||||
@*
|
||||
@item stats [query [server]]
|
||||
@*
|
||||
query statistics about server@*
|
||||
@*
|
||||
query: c/h/i/k/l/m/o/y/u (see RFC1459)@*
|
||||
server: server name@*
|
||||
@*
|
||||
@item summon user [target [channel]]
|
||||
@*
|
||||
give users who are on a host running an IRC server a message asking them to please join IRC@*
|
||||
@*
|
||||
user: username@*
|
||||
target: server name@*
|
||||
channel: channel name@*
|
||||
@*
|
||||
@item time [target]
|
||||
@*
|
||||
query local time from server@*
|
||||
@*
|
||||
target: query time from specified server@*
|
||||
@*
|
||||
@item topic [channel] [topic]
|
||||
@*
|
||||
get/set channel topic@*
|
||||
@*
|
||||
channel: channel name@*
|
||||
topic: new topic for channel (if topic is "-delete" then topic is deleted)@*
|
||||
@*
|
||||
@item trace [target]
|
||||
@*
|
||||
find the route to specific server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item unban [channel] nickname [nickname ...]
|
||||
@*
|
||||
unbans nicks or hosts@*
|
||||
@*
|
||||
channel: channel for unban@*
|
||||
nickname: user or host to unban@*
|
||||
@*
|
||||
@item userhost nickname [nickname ...]
|
||||
@*
|
||||
return a list of information about nicknames@*
|
||||
@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item users [target]
|
||||
@*
|
||||
list of users logged into the server@*
|
||||
@*
|
||||
target: server@*
|
||||
@*
|
||||
@item version [server | nickname]
|
||||
@*
|
||||
gives the version info of nick or server (current or specified)@*
|
||||
@*
|
||||
server: server name@*
|
||||
nickname: nickname@*
|
||||
@*
|
||||
@item voice nickname [nickname]
|
||||
@*
|
||||
gives voice to nickname(s)@*
|
||||
@*
|
||||
@item wallops text
|
||||
@*
|
||||
send a message to all currently connected users who have set the 'w' user mode for themselves@*
|
||||
@*
|
||||
text to send@*
|
||||
@*
|
||||
@item who [mask ["o"]]
|
||||
@*
|
||||
generate a query which returns a list of information@*
|
||||
@*
|
||||
mask: only information which match this mask@*
|
||||
o: only operators are returned according to the mask supplied@*
|
||||
@*
|
||||
@item whois [server] nickname[,nickname]
|
||||
@*
|
||||
query information about user(s)@*
|
||||
@*
|
||||
server: server name@*
|
||||
nickname: nickname (may be a mask)@*
|
||||
@*
|
||||
@item whowas nickname [,nickname [,nickname ...]] [count [target]]
|
||||
@*
|
||||
ask for information about a nickname which no longer exists@*
|
||||
@*
|
||||
nickname: nickname to search@*
|
||||
count: number of replies to return (full search if negative number)@*
|
||||
target: reply should match this mask@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
@node FIFO pipe, , WeeChat commands, Usage
|
||||
@section FIFO pipe
|
||||
|
||||
You can remote control WeeChat, by sending commands or text to a FIFO pipe
|
||||
(you have to enable option "irc_fifo_pipe", it is disabled by default).@*
|
||||
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx"
|
||||
(where xxxxx is the process ID (PID) of running WeeChat).@*
|
||||
So if many WeeChat are running, you have many FIFO pipe, one for each session.@*
|
||||
@*
|
||||
The syntax for the FIFO pipe commands/text is:@*
|
||||
@command{server,channel *text or command here}@*
|
||||
where server and channel are optional, but if channel is here, server should be too.@*
|
||||
@*
|
||||
Some examples:
|
||||
@table @asis
|
||||
@item @bullet{} change your nick on freenode to "mynick|out":
|
||||
@*
|
||||
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on #weechat channel:
|
||||
@*
|
||||
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
|
||||
@*
|
||||
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
|
||||
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
You can write a script to send command to all running WeeChat at same time, for example:@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
If the script is called "auto_weechat_command", you can run it with:@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *hello"}
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
@@ -896,12 +1432,6 @@ WeeChat is developed by:@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+554
-20
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.0 - 12 F@'evrier 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.1 - 20 Mars 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -209,6 +209,7 @@ Suivez alors les instructions du paquet sources - @xref{Paquet source}.
|
||||
* Fichier de configuration::
|
||||
* Raccourcis clavier::
|
||||
* Commandes WeeChat::
|
||||
* Tube FIFO::
|
||||
@end menu
|
||||
|
||||
@node Lancer WeeChat, Fichier de configuration, Utilisation, Utilisation
|
||||
@@ -247,6 +248,7 @@ vous pouvez modifier les param@`etres dans WeeChat avec la commande @kbd{/set} -
|
||||
Liste des options du fichier de configuration :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item look_set_title
|
||||
D@'efinit le titre de la fen@^etre (terminal pour l'interface Curses) avec le nom et la version@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -261,10 +263,13 @@ Slogan WeeChat (si vide, le slogan ne sera pas utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'the geekest IRC client!'@*
|
||||
@item look_charset_decode
|
||||
Jeu de caract@`eres pour d@'ecoder les messages du serveur, exemples: UTF-8, ISO-8859-1 (si non renseign@'e, les messages ne sont pas convertis)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'UTF-8'@*
|
||||
@item look_charset_encode
|
||||
Jeu de caract@`eres pour encoder les messages envoy@'es au serveur, exemples: UFT-8, ISO-8859-1 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item look_charset_internal
|
||||
Jeu de caract@`eres interne @`a WeeChat, devrait @^etre ISO-xxxx m@^eme si la locale est UTF-8 (si non renseign@'e, le jeu de caract@`eres local est utilis@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'ISO-8859-1'@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -394,6 +399,12 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_nick_away
|
||||
Couleur pour les pseudos absents@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
|
||||
@item col_nick_chanowner
|
||||
Couleur pour le symbole du propri@'etaire du canal (sp@'ecifique @`a unrealircd)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_nick_chanadmin
|
||||
Couleur pour le symbole administrateur du canal (sp@'ecifique @`a unrealircd)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@item col_nick_op
|
||||
Couleur pour le symbole op@'erateur@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightgreen'@*
|
||||
@@ -420,7 +431,7 @@ Couleur pour le DCC s@'electionn@'e (fen@^etre de discussion)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
@item col_dcc_waiting
|
||||
Couleur pour le statut dcc "attente"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
|
||||
@item col_dcc_connecting
|
||||
Couleur pour le statut dcc "connexion"@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@@ -451,6 +462,9 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_auto_private
|
||||
Enregistrer automatiquement les conversations priv@'ees@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_plugin_msg
|
||||
Enregistrer les messages des plugins (scripts)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item log_path
|
||||
Chemin pour les conversations sauvegard@'ees par WeeChat@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~/.weechat/logs/'@*
|
||||
@@ -474,7 +488,7 @@ Message de fin par d@'efaut ('%v' sera remplac@'e par la version de WeeChat dans
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: 'WeeChat %v'@*
|
||||
@item irc_away_check
|
||||
Intervalle entre deux v@'erifications des absences (en minutes, 0 = ne jemais v@'erifier)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 0@*
|
||||
@item irc_lag_check
|
||||
Intervalle entre deux mesures de lag (en secondes)@*
|
||||
Type: entier (valeurs: entre 30 et 2147483647), valeur par d@'efaut: 60@*
|
||||
@@ -484,24 +498,30 @@ Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 1@*
|
||||
@item irc_lag_disconnect
|
||||
D@'econnexion apr@`es un lag important (en minutes, 0 = ne jamais se d@'econnecter)@*
|
||||
Type: entier (valeurs: entre 0 et 2147483647), valeur par d@'efaut: 5@*
|
||||
@item irc_fifo_pipe
|
||||
Cr@'eer un tube FIFO pour le contr@^ole @`a distance@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_auto_accept_files
|
||||
Accepte automatiquement les fichiers dcc entrants@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_auto_accept_chats
|
||||
Accepte automatiquement les demandes de discussion dcc (@`a utiliser avec pr@'ecaution !)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item dcc_timeout
|
||||
D@'elai d'attente pour les requ@^etes dcc (en secondes)@*
|
||||
Type: entier (valeurs: entre 1 et 2147483647), valeur par d@'efaut: 300@*
|
||||
@item dcc_blocksize
|
||||
Taille de bloc pour les paquets dcc en octets (d@'efaut: 1024)@*
|
||||
Type: entier (valeurs: entre 1024 et 102400), valeur par d@'efaut: 1024@*
|
||||
Taille de bloc pour les paquets dcc en octets (d@'efaut: 65536)@*
|
||||
Type: entier (valeurs: entre 1024 et 102400), valeur par d@'efaut: 65536@*
|
||||
@item dcc_download_path
|
||||
Chemin pour @'ecrire les fichiers re@,{c}us par dcc (par d@'efaut: r@'epertoire de l'utilisateur)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_upload_path
|
||||
Chemin pour lire les fichiers lorsqu'ils sont envoy@'es par dcc (quand aucun chemin n'est sp@'ecifi@'e)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '~'@*
|
||||
@item dcc_convert_spaces
|
||||
Convertir les espaces en underscores lors d'envoi de fichiers@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item dcc_auto_rename
|
||||
Renommer les fichiers re@,{c}us s'ils existent d@'ej@`a (ajoute '.1', '.2', ...)@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@@ -568,6 +588,7 @@ Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_autorejoin
|
||||
Rejoindre automatiquement les canaux quand mis dehors@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
|
||||
@end table
|
||||
|
||||
Les couleurs pour l'interface Curses sont :@*
|
||||
@@ -641,11 +662,11 @@ Rappeler les derni@`eres commandes/messages@*
|
||||
@item PageUp / PageDown
|
||||
Afficher l'historique du tampon@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Aller au tampon pr@'ec@'edent@*
|
||||
@item F5 / F6
|
||||
Aller au tampon pr@'ec@'edent / suivant@*
|
||||
@*
|
||||
@item F8
|
||||
Aller @`a la fen@^etre suivante@*
|
||||
@item F7 / F8
|
||||
Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
|
||||
@*
|
||||
@item F10
|
||||
Effacer le dernier message de la barre d'infos@*
|
||||
@@ -654,7 +675,7 @@ Effacer le dernier message de la barre d'infos@*
|
||||
R@'eaffiche toute la fen@^etre@*
|
||||
@*
|
||||
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||
Identique @`a F6 / F7@*
|
||||
Identique @`a F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
|
||||
@@ -676,10 +697,529 @@ Sauter au tampon avec ce num@'ero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Commandes WeeChat, , Raccourcis clavier, Utilisation
|
||||
@node Commandes WeeChat, Tube FIFO, Raccourcis clavier, Utilisation
|
||||
@section Commandes WeeChat
|
||||
|
||||
NON ECRIT !
|
||||
Commandes internes WeeChat :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item alias [nom_alias [commande [param@`etres]]
|
||||
@*
|
||||
cr@'eer un alias pour une commande@*
|
||||
@*
|
||||
nom_alias: nom de l'alias@*
|
||||
commande: nom de la commande (commande WeeChat ou IRC, sans le premier '/')@*
|
||||
param@`etres: param@`etres pour la commande@*
|
||||
@*
|
||||
@item buffer [action | nombre]
|
||||
@*
|
||||
gestion des buffers@*
|
||||
@*
|
||||
action: action @`a effectuer:@*
|
||||
move: d@'eplacer le tampon dans la liste (peut @^etre relatif, par exemple -1)@*
|
||||
close: fermer le tampon (pour un canal: @'equivalent @`a /part sans message de fin)@*
|
||||
list: liste les tampons ouverts (pas de param@`etre affiche cette liste)@*
|
||||
notify: fixer le niveau de notification (0=jamais, 1=highlight, 2=1+msg, 3=2+join/part)@*
|
||||
nombre: sauter au tampon qui a ce num@'ero@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
affacer la/les fen@^etre(s)@*
|
||||
@*
|
||||
-all: effacer toutes les fen@^etres@*
|
||||
@*
|
||||
@item connect [nom_serveur]
|
||||
@*
|
||||
se connecter @`a un serveur@*
|
||||
@*
|
||||
nom_serveur: nom du serveur pour se connecter@*
|
||||
@*
|
||||
@item disconnect [nom_serveur]
|
||||
@*
|
||||
se d@'econnecter d'un serveur@*
|
||||
@*
|
||||
nom_serveur: nom du serveur pour se d@'econnecter@*
|
||||
@*
|
||||
@item debug dump
|
||||
@*
|
||||
affiche des messages de debuggage@*
|
||||
@*
|
||||
dump: affiche les variables m@'emoire WeeChat dans le fichier log (les m@^emes messages sont affich@'es lorsque WeeChat plante)@*
|
||||
@*
|
||||
@item help [commande]
|
||||
@*
|
||||
afficher l'aide sur les commandes@*
|
||||
@*
|
||||
commande: nom d'une commande WeeChat ou IRC@*
|
||||
@*
|
||||
@item perl [load fichier] | [autoload] | [unload]
|
||||
@*
|
||||
liste/charge/d@'echarge des scripts Perl@*
|
||||
@*
|
||||
fichier: script Perl (fichier) @`a charger@*
|
||||
Sans param@`etre, la commande /perl liste tous les scripts Perl charg@'es.@*
|
||||
@*
|
||||
@item server [nom_serveur] | [nom_serveur nom/IP port [-auto | -noauto] [-pwd mot_de_passe] [-nicks pseudo1 [pseudo2 [pseudo3]]] [-username nom_utilisateur] [-realname nom_r@'eel] [-command commande] [-autojoin canal[,canal]] ] | [del nom_serveur]
|
||||
@*
|
||||
liste, ajoute ou retire des serveurs@*
|
||||
@*
|
||||
nom_serveur: nom du serveur, pour usage interne et affichage@*
|
||||
nom/IP: nom ou adresse IP du serveur@*
|
||||
port: port pour le serveur (nombre entier)@*
|
||||
mot_de_passe: mot de passe pour le serveur@*
|
||||
pseudo1: premier pseudo pour le serveur@*
|
||||
pseudo2: pseudo alternatif pour le serveur@*
|
||||
pseudo3: second pseudo alternatif pour le serveur@*
|
||||
nom_utilisateur: nom d'utilisateur@*
|
||||
nom_r@'eel: nom r@'eel de l'utilisateur@*
|
||||
@*
|
||||
@item save [fichier]
|
||||
@*
|
||||
sauvegarder la configuration sur disque@*
|
||||
@*
|
||||
fichier: fichier pour sauvegarder la configuration@*
|
||||
@*
|
||||
@item set [option[=valeur]]
|
||||
@*
|
||||
modifier des param@`etres de configuration@*
|
||||
@*
|
||||
option: nom d'une option@*
|
||||
valeur: valeur pour l'option@*
|
||||
@*
|
||||
@item unalias nom_alias
|
||||
@*
|
||||
supprimer un alias@*
|
||||
@*
|
||||
nom_alias: nom de l'alias @`a supprimer@*
|
||||
@*
|
||||
@item window [list | splith | splitv | [merge [down | up | left | right | all]]]
|
||||
@*
|
||||
gestion des fen@^etres@*
|
||||
@*
|
||||
list: liste les fen@^etres ouvertes (pas de param@`etre affiche cette liste)@*
|
||||
splith: @'eclate la fen@^etre en deux horizontalement@*
|
||||
splitv: @'eclate la fen@^etre en deux verticalement@*
|
||||
merge: fusionne la fen@^etre avec une autre@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
Commandes IRC :@*
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item admin [cible]
|
||||
@*
|
||||
trouver les informations sur l'administrateur du serveur@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item away [-all] [message]
|
||||
@*
|
||||
basculer le statut absent@*
|
||||
@*
|
||||
-all: basculer le statut absent sur tous les serveurs connect@'es@*
|
||||
message: message pour l'absence (si pas de message donn@'e, le statut d'absence est supprim@'e)@*
|
||||
@*
|
||||
@item ban [canal] [pseudo [pseudo ...]]
|
||||
@*
|
||||
bannit des pseudos ou masques@*
|
||||
@*
|
||||
canal: nom du canal pour le bannissement@*
|
||||
pseudo: pseudo ou masque pour le bannissement@*
|
||||
@*
|
||||
@item ctcp pseudo type
|
||||
@*
|
||||
envoyer un message ctcp@*
|
||||
@*
|
||||
pseudo: utilisateur pour envoyer le ctcp@*
|
||||
type: "action" ou "version"@*
|
||||
@*
|
||||
@item dcc action [pseudo [fichier]]
|
||||
@*
|
||||
d@'emarre le DCC (fichier ou discussion) ou ferme une discussion@*
|
||||
@*
|
||||
action: 'send' (envoi de fichier) ou 'chat' (discussion) ou 'close' (fermeture discussion)@*
|
||||
pseudo: pseudo pour envoyer le fichier ou discuter@*
|
||||
fichier: nom du fichier (sur la machine locale)@*
|
||||
@*
|
||||
@item dehalfop pseudo [pseudo]
|
||||
@*
|
||||
retire le statut de demi-op@'erateur du canal @`a/aux nick(s)@*
|
||||
@*
|
||||
@item deop pseudo [pseudo]
|
||||
@*
|
||||
retire le statut d'op@'erateur du canal @`a/aux nick(s)@*
|
||||
@*
|
||||
@item devoice pseudo [pseudo]
|
||||
@*
|
||||
retire la voix du/des pseudo(s)@*
|
||||
@*
|
||||
@item die
|
||||
@*
|
||||
arr@^eter le serveur@*
|
||||
@*
|
||||
@item halfop pseudo [pseudo]
|
||||
@*
|
||||
donner le statut de demi-op@'erateur @`a un/des utilisateur(s)@*
|
||||
@*
|
||||
@item info [cible]
|
||||
@*
|
||||
voir les informations d@'ecrivant le serveur@*
|
||||
@*
|
||||
cible: nom du serveur@*
|
||||
@*
|
||||
@item invite pseudo canal
|
||||
@*
|
||||
inviter un utilisateur sur un canal@*
|
||||
@*
|
||||
pseudo: utilisateur @`a inviter@*
|
||||
channel: canal pour l'invitation@*
|
||||
@*
|
||||
@item ison pseudo [pseudo ...]
|
||||
@*
|
||||
v@'erifier si un utilisateur est actuellement sur IRC@*
|
||||
@*
|
||||
pseudo: pseudo@*
|
||||
@*
|
||||
@item join canal[,canal] [cl@'e[,cl@'e]]
|
||||
@*
|
||||
joindre un canal@*
|
||||
@*
|
||||
canal: nom du canal @`a rejoindre@*
|
||||
cl@'e: cl@'e pour rejoindre le canal@*
|
||||
@*
|
||||
@item kick [canal] pseudo [commentaire]
|
||||
@*
|
||||
retirer par la force un utilisateur d'un canal@*
|
||||
@*
|
||||
canal: canal o@`u l'utilisateur se trouve@*
|
||||
pseudo: utilisateur @`a @'eliminer@*
|
||||
commentaire: commentaire pour l'@'elimination@*
|
||||
@*
|
||||
@item kickban [canal] pseudo [commentaire]
|
||||
@*
|
||||
retirer par la force un utilisateur d'un canal et le bannir@*
|
||||
@*
|
||||
canal: canal o@`u l'utilisateur se trouve@*
|
||||
pseudo: utilisateur @`a @'eliminer et bannir@*
|
||||
commentaire: commentaire pour l'@'elimination@*
|
||||
@*
|
||||
@item kill pseudo commentaire
|
||||
@*
|
||||
fermer la connexion client-serveur@*
|
||||
@*
|
||||
pseudo: utilisateur@*
|
||||
commentaire: commentaire pour la mort@*
|
||||
@*
|
||||
@item links [[serveur] masque_serveur]
|
||||
@*
|
||||
lister tous les noms de serveurs connus du serveur qui r@'epondent @`a la requ@^ete@*
|
||||
@*
|
||||
serveur: ce serveur doit r@'epondre @`a la requ@^ete@*
|
||||
masque_serveur: liste des serveurs correspondant au masque@*
|
||||
@*
|
||||
@item list [canal[,canall] [serveur]]
|
||||
@*
|
||||
lister les canaux et leur sujet@*
|
||||
@*
|
||||
canal: canal @`a lister@*
|
||||
serveur: nom du serveur@*
|
||||
@*
|
||||
@item lusers [masque [cible]]
|
||||
@*
|
||||
obtenir des statistiques sur la taille du r@'eseau IRC@*
|
||||
@*
|
||||
masque: serveurs qui correspondent au masque seulement@*
|
||||
cible: serveur pour faire suivre la requ@^ete@*
|
||||
@*
|
||||
@item me message
|
||||
@*
|
||||
envoyer une action ctcp au canal courant@*
|
||||
@*
|
||||
message: message @`a envoyer@*
|
||||
@*
|
||||
@item mode @{ canal @{[+|-]|o|p|s|i|t|n|b|v@} [limite] [utilisateur] [masque de banissement] @} | @{ nick @{[+|-]|i|w|s|o@} @}
|
||||
@*
|
||||
changer le mode du canal ou de l'utilisateur@*
|
||||
@*
|
||||
modes de canaux :@*
|
||||
canal: nom du canal @`a modifier@*
|
||||
o: donner/reprendre le statut privil@'egi@'e d'op@'erateur@*
|
||||
p: indicateur de canal priv@'e@*
|
||||
s: indicateur de canal secret@*
|
||||
i: indicateur de canal avec invitation seulement@*
|
||||
t: le titre est modifiable seulement par un op@'erateur du canal@*
|
||||
n: aucun message au canal depuis l'ext@'erieur@*
|
||||
m: canal mod@'er@'e@*
|
||||
l: fixer la limite d'utilisateurs pour le canal@*
|
||||
b: param@'etrer un masque de banissement pour garder des utilisateurs dehors@*
|
||||
v: donner/reprendre la possibilit@'e de parler sur un canal mod@'er@'e@*
|
||||
k: d@'efinir une cl@'e (mot de passe) pour acc@'eder au canal@*
|
||||
modes utilisateur :@*
|
||||
pseudo: utilisateur @`a modifier@*
|
||||
i: marquer un utilisateur comme invisible@*
|
||||
s: marquer un utilisateur pour recevoir les notices du serveur@*
|
||||
w: l'utilisateur re@,{c}oit les wallops@*
|
||||
o: drapeau op@'erateur@*
|
||||
@*
|
||||
@item motd [cible]
|
||||
@*
|
||||
obtenir le message du jour@*
|
||||
@*
|
||||
cible: nom du serveur@*
|
||||
@*
|
||||
@item msg cible[,cible] texte
|
||||
@*
|
||||
envoyer un message @`a un utilisateur ou canal@*
|
||||
@*
|
||||
cible: utilisateur ou canal (peut-@^etre un masque, '*' = canal courant)@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item names [canal[,canal]]
|
||||
@*
|
||||
lister les utilisateurs sur des canaux@*
|
||||
@*
|
||||
canal: nom du canal@*
|
||||
@*
|
||||
@item nick pseudo
|
||||
@*
|
||||
changer le pseudo courant@*
|
||||
@*
|
||||
pseudo: nouveau pseudo pour le serveur IRC courant@*
|
||||
@*
|
||||
@item notice pseudo texte
|
||||
@*
|
||||
envoyer un message notice @`a un utilisateur@*
|
||||
@*
|
||||
pseudo: utilisateur cible pour la notice@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item op pseudo [pseudo]
|
||||
@*
|
||||
donner le statut op@'erateur @`a un/des utilisateur(s)@*
|
||||
@*
|
||||
@item oper utilisateur mot_de_passe
|
||||
@*
|
||||
obtenir le statut d'op@'erateur@*
|
||||
@*
|
||||
utilisateur/mot_de_passe: utilis@'e pour obtenir les privil@`eges sur le serveur IRC courant@*
|
||||
@*
|
||||
@item part [canal[,canall] [message_de_fin]
|
||||
@*
|
||||
quitter un canal@*
|
||||
@*
|
||||
canal: canal @`a quitter@*
|
||||
message_de_fin: message de fin (affich@'e aux autres utilisateurs)@*
|
||||
@*
|
||||
@item ping serveur1 [serveur2]
|
||||
@*
|
||||
pinguer un serveur@*
|
||||
@*
|
||||
serveur1: serveur @`a pinguer@*
|
||||
serveur2: faire suivre le ping @`a ce serveur@*
|
||||
@*
|
||||
@item pong d@'emon [d@'emon2]
|
||||
@*
|
||||
r@'epondre @`a un message ping@*
|
||||
@*
|
||||
d@'emon: d@'emon qui a r@'epondu au message Ping@*
|
||||
d@'emon2: faire suivre le message @`a ce d@'emon@*
|
||||
@*
|
||||
@item query pseudo [texte]
|
||||
@*
|
||||
envoyer un message priv@'e @`a un utilisateur@*
|
||||
@*
|
||||
pseudo: utilisateur pour la conversation priv@'ee@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item quit [message_de_fin]
|
||||
@*
|
||||
fermer toutes les connexions et quitter@*
|
||||
@*
|
||||
message_de_fin: message de fin (affich@'e aux autres utilisateurs)@*
|
||||
@*
|
||||
@item quote donn@'ees
|
||||
@*
|
||||
envoyer des donn@'ees brutes au serveur sans analyse@*
|
||||
@*
|
||||
donn@'ees: donn@'ees brutes @`a envoyer@*
|
||||
@*
|
||||
@item rehash
|
||||
@*
|
||||
demander au serveur de recharger son fichier de configuration@*
|
||||
@*
|
||||
@item restart
|
||||
@*
|
||||
demander au serveur de red@'emarrer@*
|
||||
@*
|
||||
@item service pseudo r@'eserv@'e distribution type r@'eserv@'e info
|
||||
@*
|
||||
enregister un nouveau service@*
|
||||
@*
|
||||
distribution: visibilit@'e du service@*
|
||||
type: r@'eserv@'e pour une utilisation future@*
|
||||
@*
|
||||
@item servlist [masque [type]]
|
||||
@*
|
||||
lister les services actuellement connect@'es au r@'eseau@*
|
||||
@*
|
||||
masque: lister seulement les services qui correspondent @`a ce masque@*
|
||||
type: lister seulement les services de ce type@*
|
||||
@*
|
||||
@item squery service texte
|
||||
@*
|
||||
envoyer un message @`a un service@*
|
||||
@*
|
||||
service: nom du service@*
|
||||
texte: texte @`a envoyer@*
|
||||
@*
|
||||
@item squit serveur commentaire
|
||||
@*
|
||||
d@'econnecter les liens vers un serveur@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
commentaire: commentaire pour quitter@*
|
||||
@*
|
||||
@item stats [requ@^ete [serveur]]
|
||||
@*
|
||||
demander des statistiques sur le serveur@*
|
||||
@*
|
||||
requ@^ete: c/h/i/k/l/m/o/y/u (voir la RFC1459)@*
|
||||
serveur: nom du serveur@*
|
||||
@*
|
||||
@item summon utilisateur [cible [canal]]
|
||||
@*
|
||||
envoyer aux utilisateurs d'un serveur IRC un message leur demandant de rejoindre IRC@*
|
||||
@*
|
||||
utilisateur: nom d'utilisateur@*
|
||||
cible: nom du serveur@*
|
||||
canal: nom du canal@*
|
||||
@*
|
||||
@item time [cible]
|
||||
@*
|
||||
demander l'heure locale de serveur@*
|
||||
@*
|
||||
cible: demander l'heure de ce serveur@*
|
||||
@*
|
||||
@item topic [canal] [titre]
|
||||
@*
|
||||
recevoir/d@'efinir le titre du canal@*
|
||||
@*
|
||||
canal: nom du canal@*
|
||||
titre: nouveau titre pour le canal (si le titre est "-delete" alors le titre est supprim@'e)@*
|
||||
@*
|
||||
@item trace [cible]
|
||||
@*
|
||||
trouver le chemin jusqu'@`a un serveur sp@'ecifique@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item unban [canal] pseudo [pseudo ...]
|
||||
@*
|
||||
supprime le bannissement sur des pseudos ou masques@*
|
||||
@*
|
||||
canal: nom du canal pour supprimer le bannissement@*
|
||||
pseudo: pseudo ou masque pour supprimer le bannissement@*
|
||||
@*
|
||||
@item userhost pseudo [pseudo ...]
|
||||
@*
|
||||
retourne une liste d'informations sur des utilisateurs@*
|
||||
@*
|
||||
pseudo: pseudo@*
|
||||
@*
|
||||
@item users [cible]
|
||||
@*
|
||||
liste des utilisateurs connect@'es au serveur@*
|
||||
@*
|
||||
cible: serveur@*
|
||||
@*
|
||||
@item version [serveur | pseudo]
|
||||
@*
|
||||
retourne la version de l'utilisateur ou du serveur (courant ou sp@'ecifi@'e)@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
pseudo: utilisateur@*
|
||||
@*
|
||||
@item voice pseudo [pseudo]
|
||||
@*
|
||||
donne la voix @`a/aux utilisateur(s)@*
|
||||
@*
|
||||
@item wallops texte
|
||||
@*
|
||||
envoyer un message @`a tous les utilisateurs connect@'es qui ont activ@'e le mode utilisateur 'w' pour eux-m@^emes@*
|
||||
@*
|
||||
texte @`a envoyer@*
|
||||
@*
|
||||
@item who [masque ["o"]]
|
||||
@*
|
||||
g@'en@`ere une requ@^ete qui retourne une liste d'information@*
|
||||
@*
|
||||
masque: information qui correspond @`a ce masque uniquement@*
|
||||
o: seul les op@'erateurs sont retourn@'es correspondant au masque fourni@*
|
||||
@*
|
||||
@item whois [serveur] pseudo[,pseudo]
|
||||
@*
|
||||
demande les informations sur le(s) utilisateur(s)@*
|
||||
@*
|
||||
serveur: nom du serveur@*
|
||||
pseudo: utilisateur (peut @^etre un masque)@*
|
||||
@*
|
||||
@item whowas pseudo [,pseudo [,pseudo ...]] [nombre [cible]]
|
||||
@*
|
||||
demander de l'information sur un nick qui n'existe plus@*
|
||||
@*
|
||||
pseudo: pseudo @`a chercher@*
|
||||
nombre: nombre de r@'eponses @`a retourner (recherche compl@`ete si nombre n@'egatif)@*
|
||||
cible: la r@'eponse doit correspondre @`a ce masque@*
|
||||
@*
|
||||
|
||||
@end table
|
||||
|
||||
@node Tube FIFO, , Commandes WeeChat, Utilisation
|
||||
@section Tube FIFO
|
||||
|
||||
Vous pouvez contr@^oler WeeChat @`a distance, en envoyant des commandes ou du
|
||||
texte dans un tube FIFO (l'option "irc_fifo_pipe" doit @^etre activ@'ee, elle
|
||||
est d@'esactiv@'ee par d@'efaut).@*
|
||||
Le tube FIFO est dans le r@'epertoire ~/.weechat/ et s'appelle "weechat_fifo_xxxxx"
|
||||
(o@`u xxxxx est l'ID du processus (PID) du WeeChat qui tourne).@*
|
||||
Donc si plusieurs WeeChat tournent, vous avez plusieurs tubes FIFO, un pour
|
||||
chaque session.@*
|
||||
@*
|
||||
La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO est la suivante :@*
|
||||
@command{serveur,canal *texte ou commande ici}@*
|
||||
o@`u le serveur et le canal sont facultatifs, mais si le canal est l@`a, le
|
||||
serveur doit l'@^etre aussi.@*
|
||||
@*
|
||||
Quelques exemples :
|
||||
@table @asis
|
||||
@item @bullet{} changement du pseudo sur freenode en "pseudo|absent":
|
||||
@command{echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} affichage de texte sur le canal #weechat :
|
||||
@command{echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} affichage de texte sur le canal courant (le tampon affich@'e par WeeChat):
|
||||
@command{echo "*bonjour !" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Attention :} ceci est dangereux et vous ne devriez pas le faire sauf si vous savez ce que vous faites !
|
||||
@item @bullet{} envoyer deux commandes pour décharger/recharger les scripts Perl (vous devez les séparer par \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
Vous pouvez @'ecrire un script qui envoie les commandes @`a tous les WeeChat qui
|
||||
tournent en m@^eme temps, par exemple :@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
Si le script s'appelle "auto_weechat_command", vous pouvez le lancer ainsi :@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *bonjour"}
|
||||
|
||||
|
||||
@c ******************************* Extensions *********************************
|
||||
@@ -896,12 +1436,6 @@ WeeChat est d@'evelopp@'e par :@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.0 - 12 de Fevereiro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.1 - 20 de Mar@,{c}o de 2005
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -206,6 +206,7 @@ Segue agora as instru@,{c}@~oes para compilar o c@'odigo fonte - @xref{Codigo Fo
|
||||
* Invocar o WeeChat::
|
||||
* Recursos de teclado::
|
||||
* Comandos do WeeChat::
|
||||
* FIFO pipe::
|
||||
@end menu
|
||||
|
||||
@node Invocar o WeeChat, Recursos de teclado, Utilizacao, Utilizacao
|
||||
@@ -274,11 +275,11 @@ Repetir os ultimos comandos/mensagens@*
|
||||
@item PageUp / PageDown
|
||||
Navegar no hist@'orico da janela@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Ir para a janela anterior/seguinte@*
|
||||
@item F5 / F6
|
||||
Comute ao amortecedor anterior / seguinte@*
|
||||
@*
|
||||
@item F8
|
||||
Comute @`a janela seguinte@*
|
||||
@item F7 / F8
|
||||
Comute ao janela anterior / seguinte@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@@ -287,7 +288,7 @@ Apagar a @'ultima mensagem da barra do info@*
|
||||
Redesenhe a janela inteira@*
|
||||
@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F6 / F7@*
|
||||
Identico a F5 / F6@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@@ -309,11 +310,54 @@ Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@end table
|
||||
|
||||
@node Comandos do WeeChat, , Recursos de teclado, Utilizacao
|
||||
@node Comandos do WeeChat, FIFO pipe, Recursos de teclado, Utilizacao
|
||||
@section Comandos do WeeChat
|
||||
|
||||
N@~AO ESCRITO !
|
||||
|
||||
@node FIFO pipe, , Comandos do WeeChat, Utilizacao
|
||||
@section FIFO pipe
|
||||
|
||||
You can remote control WeeChat, by sending commands or text to a FIFO pipe
|
||||
(you have to enable option "irc_fifo_pipe", it is disabled by default).@*
|
||||
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx"
|
||||
(where xxxxx is the process ID (PID) of running WeeChat).@*
|
||||
So if many WeeChat are running, you have many FIFO pipe, one for each session.@*
|
||||
@*
|
||||
The syntax for the FIFO pipe commands/text is:@*
|
||||
@command{server,channel *text or command here}@*
|
||||
where server and channel are optional, but if channel is here, server should be too.@*
|
||||
@*
|
||||
Some examples:
|
||||
@table @asis
|
||||
@item @bullet{} change your nick on freenode to "mynick|out":
|
||||
@*
|
||||
@command{echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on #weechat channel:
|
||||
@*
|
||||
@command{echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345}
|
||||
@item @bullet{} display text on current channel (buffer displayed by WeeChat):
|
||||
@*
|
||||
@command{echo "*hello!" >~/.weechat/weechat_fifo_12345}@*
|
||||
@*
|
||||
@b{Warning:} this is dangerous and you should not do that except if you know what you do!
|
||||
@item @bullet{} send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
|
||||
@command{echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345}
|
||||
@end table
|
||||
@*
|
||||
You can write a script to send command to all running WeeChat at same time, for example:@*
|
||||
@verbatim
|
||||
#!/bin/sh
|
||||
if [ $# -eq 1 ]; then
|
||||
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
|
||||
echo -e "$1" >$fifo
|
||||
done
|
||||
fi
|
||||
@end verbatim
|
||||
@*
|
||||
If the script is called "auto_weechat_command", you can run it with:@*
|
||||
@command{./auto_weechat_command "freenode,#weechat *hello"}
|
||||
|
||||
|
||||
@c ******************************* Extencoes *********************************
|
||||
|
||||
@@ -524,12 +568,6 @@ O WeeChat @'e desenvolvido por :@*
|
||||
@item
|
||||
FlashCode
|
||||
<@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
@item
|
||||
Bounga
|
||||
<@email{bounga@@altern.org, bounga AT altern.org}>
|
||||
@item
|
||||
Xahlexx
|
||||
<@email{xahlexx@@tuxfamily.org, xahlexx AT tuxfamily.org}>
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
Binary file not shown.
+12
-5
@@ -1,12 +1,12 @@
|
||||
./src/irc/irc-nick.c
|
||||
./src/irc/irc-server.c
|
||||
./src/irc/irc-channel.c
|
||||
./src/irc/irc.h
|
||||
./src/irc/irc-commands.c
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/irc/irc.h
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/plugins.c
|
||||
@@ -15,16 +15,23 @@
|
||||
./src/gui/curses/gui-display.c
|
||||
./src/gui/gtk/gui-display.c
|
||||
./src/gui/gtk/gui-input.c
|
||||
./src/gui/gui.h
|
||||
./src/gui/gui-common.c
|
||||
./src/gui/gui.h
|
||||
./src/common/command.c
|
||||
./src/common/completion.c
|
||||
./src/common/history.c
|
||||
./src/common/weechat.c
|
||||
./src/common/command.h
|
||||
./src/common/completion.c
|
||||
./src/common/completion.h
|
||||
./src/common/fifo.c
|
||||
./src/common/fifo.h
|
||||
./src/common/history.c
|
||||
./src/common/history.h
|
||||
./src/common/hotlist.c
|
||||
./src/common/hotlist.h
|
||||
./src/common/log.c
|
||||
./src/common/log.h
|
||||
./src/common/weechat.c
|
||||
./src/common/weechat.h
|
||||
./src/common/weeconfig.c
|
||||
./src/common/weeconfig.h
|
||||
./src/common/weelist.c
|
||||
./src/common/weelist.h
|
||||
|
||||
+3710
File diff suppressed because it is too large
Load Diff
+1227
-946
File diff suppressed because it is too large
Load Diff
+1199
-940
File diff suppressed because it is too large
Load Diff
@@ -34,4 +34,6 @@ lib_weechat_main_a_SOURCES = weechat.c \
|
||||
hotlist.c \
|
||||
hotlist.h \
|
||||
log.c \
|
||||
log.h
|
||||
log.h \
|
||||
fifo.c \
|
||||
fifo.h
|
||||
|
||||
+168
-111
@@ -47,10 +47,10 @@ t_weechat_command weechat_commands[] =
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action | number]"),
|
||||
N_("action: action to do:\n"
|
||||
" move move buffer in the list (may be relative, for example -1)\n"
|
||||
" close close buffer (for channel: same as /part without part message)\n"
|
||||
" list list opened buffers (no parameter implies this list)\n"
|
||||
" notify set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
|
||||
" move: move buffer in the list (may be relative, for example -1)\n"
|
||||
" close: close buffer (for channel: same as /part without part message)\n"
|
||||
" list: list opened buffers (no parameter implies this list)\n"
|
||||
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
|
||||
"number: jump to buffer by number"),
|
||||
0, MAX_ARGS, weechat_cmd_buffer, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
@@ -58,13 +58,17 @@ t_weechat_command weechat_commands[] =
|
||||
N_("-all: clear all windows"),
|
||||
0, 1, weechat_cmd_clear, NULL },
|
||||
{ "connect", N_("connect to a server"),
|
||||
N_("servername"),
|
||||
N_("[servername]"),
|
||||
N_("servername: server name to connect"),
|
||||
1, 1, weechat_cmd_connect, NULL },
|
||||
0, 1, weechat_cmd_connect, NULL },
|
||||
{ "disconnect", N_("disconnect from a server"),
|
||||
N_("servername"),
|
||||
N_("[servername]"),
|
||||
N_("servername: server name to disconnect"),
|
||||
1, 1, weechat_cmd_disconnect, NULL },
|
||||
0, 1, weechat_cmd_disconnect, NULL },
|
||||
{ "debug", N_("print debug messages"),
|
||||
N_("dump"),
|
||||
N_("dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)"),
|
||||
1, 1, weechat_cmd_debug, NULL },
|
||||
{ "help", N_("display help about commands"),
|
||||
N_("[command]"), N_("command: name of a WeeChat or IRC command"),
|
||||
0, 1, weechat_cmd_help, NULL },
|
||||
@@ -101,10 +105,10 @@ t_weechat_command weechat_commands[] =
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[list | splith | splitv | [merge [down | up | left | right | all]]]"),
|
||||
N_(
|
||||
" list list opened windows (no parameter implies this list)\n"
|
||||
"splith split current window horizontally\n"
|
||||
"splitv split current window vertically\n"
|
||||
" merge merge window with another"),
|
||||
"list: list opened windows (no parameter implies this list)\n"
|
||||
"splith: split current window horizontally\n"
|
||||
"splitv: split current window vertically\n"
|
||||
"merge: merge window with another"),
|
||||
0, 2, weechat_cmd_window, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
@@ -506,8 +510,8 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s %s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, PACKAGE_NAME, command + 1);
|
||||
_("%s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, command + 1);
|
||||
}
|
||||
}
|
||||
if (argv)
|
||||
@@ -576,7 +580,7 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s IRC command \"%s\" failed\n"),
|
||||
_("%s command \"%s\" failed\n"),
|
||||
WEECHAT_ERROR, command + 1);
|
||||
}
|
||||
}
|
||||
@@ -645,12 +649,13 @@ exec_weechat_command (t_irc_server *server, char *string)
|
||||
*/
|
||||
|
||||
void
|
||||
user_command (t_irc_server *server, char *command)
|
||||
user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
|
||||
{
|
||||
t_irc_nick *ptr_nick;
|
||||
|
||||
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
|
||||
return;
|
||||
|
||||
if ((command[0] == '/') && (command[1] != '/'))
|
||||
{
|
||||
/* WeeChat internal command (or IRC command) */
|
||||
@@ -658,38 +663,45 @@ user_command (t_irc_server *server, char *command)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!buffer)
|
||||
buffer = gui_current_window->buffer;
|
||||
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
|
||||
|
||||
if (server && (!BUFFER_IS_SERVER(buffer)))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
command);
|
||||
if (CHANNEL(buffer)->dcc_chat)
|
||||
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
|
||||
"%s\r\n", command);
|
||||
else
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(buffer)->name, command);
|
||||
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_type_color (CHANNEL(buffer)->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
|
||||
ptr_nick = nick_search (CHANNEL(buffer), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window->buffer)->buffer, ptr_nick,
|
||||
irc_display_nick (CHANNEL(buffer)->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
gui_printf_color (CHANNEL(buffer)->buffer,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
@@ -704,8 +716,8 @@ user_command (t_irc_server *server, char *command)
|
||||
else
|
||||
{
|
||||
irc_display_prefix ((server) ? server->buffer : NULL, PREFIX_ERROR);
|
||||
gui_printf ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
gui_printf_nolog ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -767,12 +779,11 @@ weechat_cmd_alias (char *arguments)
|
||||
/* List all aliases */
|
||||
if (weechat_alias)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("List of aliases:\n"));
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, " %s => %s\n",
|
||||
ptr_alias->alias_name,
|
||||
ptr_alias->alias_command + 1);
|
||||
@@ -833,6 +844,7 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
long number;
|
||||
char *error;
|
||||
|
||||
@@ -840,12 +852,11 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
/* list opened buffers */
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Opened buffers:\n"));
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf (NULL, "%d", ptr_buffer->number);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
|
||||
@@ -922,10 +933,23 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
if (SERVER(gui_current_window->buffer))
|
||||
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
|
||||
{
|
||||
if (SERVER(gui_current_window->buffer)->is_connected)
|
||||
irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL);
|
||||
else
|
||||
{
|
||||
ptr_channel = channel_search (SERVER(gui_current_window->buffer),
|
||||
CHANNEL(gui_current_window->buffer)->name);
|
||||
if (ptr_channel)
|
||||
channel_free (SERVER(gui_current_window->buffer),
|
||||
ptr_channel);
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
}
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "notify") == 0)
|
||||
{
|
||||
@@ -934,7 +958,7 @@ weechat_cmd_buffer (int argc, char **argv)
|
||||
if (argc < 2)
|
||||
{
|
||||
/* display notify level for all buffers */
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Notify levels: "));
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
@@ -1018,7 +1042,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
if (strcasecmp (argv[0], "-all") == 0)
|
||||
gui_buffer_clear_all ();
|
||||
else
|
||||
{
|
||||
@@ -1043,10 +1067,11 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
if (argc == 1)
|
||||
ptr_server = server_search (argv[0]);
|
||||
else
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
|
||||
ptr_server = server_search (argv[0]);
|
||||
if (ptr_server)
|
||||
{
|
||||
if (ptr_server->is_connected)
|
||||
@@ -1054,7 +1079,15 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s already connected to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (ptr_server->child_pid > 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s currently connecting to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (!ptr_server->buffer)
|
||||
@@ -1066,20 +1099,49 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
{
|
||||
ptr_server->reconnect_start = 0;
|
||||
ptr_server->reconnect_join = (ptr_server->channels) ? 1 : 0;
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s server \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_debug: print debug messages
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_debug (int argc, char **argv)
|
||||
{
|
||||
if (argc != 1)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "debug");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcasecmp (argv[0], "dump") == 0)
|
||||
{
|
||||
wee_dump (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "perl");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_disconnect: disconnect from a server
|
||||
*/
|
||||
@@ -1089,18 +1151,20 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) argc;
|
||||
if (argc == 1)
|
||||
ptr_server = server_search (argv[0]);
|
||||
else
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
|
||||
ptr_server = server_search (argv[0]);
|
||||
if (ptr_server)
|
||||
{
|
||||
if ((!ptr_server->is_connected) && (ptr_server->reconnect_start == 0))
|
||||
if ((!ptr_server->is_connected) && (ptr_server->child_pid == 0)
|
||||
&& (ptr_server->reconnect_start == 0))
|
||||
{
|
||||
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
|
||||
gui_printf (ptr_server->buffer,
|
||||
_("%s not connected to server \"%s\"!\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
WEECHAT_ERROR, ptr_server->name);
|
||||
return -1;
|
||||
}
|
||||
if (ptr_server->reconnect_start > 0)
|
||||
@@ -1115,9 +1179,7 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL,
|
||||
_("%s server \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
gui_printf (NULL, _("%s server not found\n"), WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1134,29 +1196,27 @@ weechat_cmd_help (int argc, char **argv)
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL,
|
||||
_("> List of %s internal commands:\n"),
|
||||
PACKAGE_NAME);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("%s internal commands:\n"), PACKAGE_NAME);
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, " - %s\n",
|
||||
_(weechat_commands[i].command_description));
|
||||
}
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> List of IRC commands:\n"));
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("IRC commands:\n"));
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, " - %s\n",
|
||||
_(irc_commands[i].command_description));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 1)
|
||||
{
|
||||
@@ -1164,20 +1224,23 @@ weechat_cmd_help (int argc, char **argv)
|
||||
{
|
||||
if (strcasecmp (weechat_commands[i].command_name, argv[0]) == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> Help on %s internal command \""), PACKAGE_NAME);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[w]");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, "\":\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("Syntax: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
|
||||
weechat_commands[i].command_name);
|
||||
gui_printf (NULL, " %s\n",
|
||||
(weechat_commands[i].arguments) ?
|
||||
_(weechat_commands[i].arguments) : "");
|
||||
if (weechat_commands[i].arguments_description)
|
||||
gui_printf (NULL, "%s\n",
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
gui_printf (NULL, " %s\n",
|
||||
_(weechat_commands[i].arguments));
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (weechat_commands[i].command_description &&
|
||||
weechat_commands[i].command_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
return 0;
|
||||
}
|
||||
@@ -1187,20 +1250,23 @@ weechat_cmd_help (int argc, char **argv)
|
||||
if ((strcasecmp (irc_commands[i].command_name, argv[0]) == 0)
|
||||
&& (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg))
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("> Help on IRC command \""));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, "[i]");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, "\":\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, _("Syntax: "));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "/%s",
|
||||
irc_commands[i].command_name);
|
||||
gui_printf (NULL, "%s\n",
|
||||
(irc_commands[i].arguments) ?
|
||||
_(irc_commands[i].arguments) : "");
|
||||
if (irc_commands[i].arguments_description)
|
||||
gui_printf (NULL, "%s\n",
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
gui_printf (NULL, " %s\n",
|
||||
_(irc_commands[i].arguments));
|
||||
else
|
||||
gui_printf (NULL, "\n");
|
||||
if (irc_commands[i].command_description &&
|
||||
irc_commands[i].command_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
gui_printf (NULL, "\n%s\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
return 0;
|
||||
}
|
||||
@@ -1231,7 +1297,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
/* list registered Perl scripts */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Registered Perl scripts:\n"));
|
||||
if (perl_scripts)
|
||||
{
|
||||
@@ -1253,7 +1319,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* list Perl message handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Perl message handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
|
||||
@@ -1275,7 +1341,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* list Perl command handlers */
|
||||
irc_display_prefix (NULL, PREFIX_PLUGIN);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Perl command handlers:\n"));
|
||||
handler_found = 0;
|
||||
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
|
||||
@@ -1298,9 +1364,9 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (strcmp (argv[0], "autoload") == 0)
|
||||
if (strcasecmp (argv[0], "autoload") == 0)
|
||||
plugin_auto_load (PLUGIN_TYPE_PERL, "perl/autoload");
|
||||
if (strcmp (argv[0], "unload") == 0)
|
||||
if (strcasecmp (argv[0], "unload") == 0)
|
||||
{
|
||||
/* unload all Perl scripts */
|
||||
plugin_unload (PLUGIN_TYPE_PERL, NULL);
|
||||
@@ -1309,7 +1375,7 @@ weechat_cmd_perl (int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (strcmp (argv[0], "load") == 0)
|
||||
if (strcasecmp (argv[0], "load") == 0)
|
||||
{
|
||||
/* load Perl script */
|
||||
if (strstr(argv[1], DIR_SEPARATOR))
|
||||
@@ -1631,8 +1697,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
if (new_server->autoconnect)
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);
|
||||
if (server_connect (new_server))
|
||||
irc_login (new_server);
|
||||
server_connect (new_server);
|
||||
}
|
||||
|
||||
server_destroy (&server);
|
||||
@@ -1649,7 +1714,6 @@ weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *val
|
||||
{
|
||||
char *color_name, *pos_nickserv, *pos_pwd, *value2;
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, " %s%s%s",
|
||||
(prefix) ? prefix : "",
|
||||
(prefix) ? "." : "",
|
||||
@@ -1774,8 +1838,7 @@ weechat_cmd_set (char *arguments)
|
||||
switch (config_set_server_value (ptr_server, pos + 1, value))
|
||||
{
|
||||
case 0:
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
config_sections[CONFIG_SECTION_SERVER].section_name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
|
||||
@@ -1827,8 +1890,7 @@ weechat_cmd_set (char *arguments)
|
||||
if (config_option_set_value (ptr_option, value) == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s", config_get_section (ptr_option));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
@@ -1867,8 +1929,7 @@ weechat_cmd_set (char *arguments)
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
|
||||
"%s",
|
||||
config_sections[i].section_name);
|
||||
@@ -1896,8 +1957,7 @@ weechat_cmd_set (char *arguments)
|
||||
{
|
||||
if (!section_displayed)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
|
||||
config_sections[CONFIG_SECTION_SERVER].section_name);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
|
||||
@@ -1919,7 +1979,6 @@ weechat_cmd_set (char *arguments)
|
||||
}
|
||||
if (number_found == 0)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
if (option)
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"),
|
||||
option);
|
||||
@@ -1928,8 +1987,7 @@ weechat_cmd_set (char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", number_found);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
|
||||
if (option)
|
||||
gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
|
||||
option);
|
||||
@@ -1983,13 +2041,12 @@ weechat_cmd_window (int argc, char **argv)
|
||||
{
|
||||
/* list opened windows */
|
||||
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf (NULL, "\n");
|
||||
gui_printf (NULL, _("Opened windows:\n"));
|
||||
|
||||
i = 1;
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf (NULL, "%d", i);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] (");
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "weelist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
#define MAX_ARGS 8192
|
||||
|
||||
@@ -60,11 +61,12 @@ extern void command_index_free ();
|
||||
extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_debug (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_perl (int, char **);
|
||||
|
||||
@@ -145,17 +145,34 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"-all");
|
||||
return;
|
||||
}
|
||||
if (((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "connect") == 0))
|
||||
&& (completion->base_command_arg == 1))
|
||||
if ((strcasecmp (completion->base_command, "connect") == 0)
|
||||
|| (strcasecmp (completion->base_command, "disconnect") == 0))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "debug") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
ptr_server->name);
|
||||
}
|
||||
"dump");
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((strcasecmp (completion->base_command, "help") == 0)
|
||||
@@ -199,11 +216,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
for (j = 0; weechat_options[i][j].option_name; j++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s =",
|
||||
weechat_options[i][j].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
option_name);
|
||||
weechat_options[i][j].option_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +227,7 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
{
|
||||
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
|
||||
{
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s =",
|
||||
snprintf (option_name, sizeof (option_name), "%s.%s",
|
||||
ptr_server->name,
|
||||
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
|
||||
weelist_add (&completion->completion_list,
|
||||
@@ -334,6 +349,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"send");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"close");
|
||||
return;
|
||||
}
|
||||
if (strcasecmp (completion->base_command, "invite") == 0)
|
||||
@@ -540,8 +558,18 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel
|
||||
&& (((t_irc_channel *)channel)->type == CHAT_PRIVATE))
|
||||
/* nick completion with nothing as base word is disabled,
|
||||
in order to prevent completion when pasting messages with [tab] inside */
|
||||
if ((completion->context == COMPLETION_NICK)
|
||||
&& ((!completion->base_word) || (!completion->base_word[0])))
|
||||
{
|
||||
completion->context = COMPLETION_NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!completion->completion_list && channel &&
|
||||
(((t_irc_channel *)channel)->type == CHAT_PRIVATE)
|
||||
&& (completion->context == COMPLETION_NICK))
|
||||
{
|
||||
/* nick completion in private (only other nick and self) */
|
||||
completion->context = COMPLETION_NICK;
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* fifo.c: FIFO pipe for WeeChat remote control */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "fifo.h"
|
||||
#include "command.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
int weechat_fifo = -1;
|
||||
char *weechat_fifo_filename = NULL;
|
||||
char *weechat_fifo_unterminated = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* fifo_create: create FIFO pipe for remote control
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_create ()
|
||||
{
|
||||
int filename_length;
|
||||
|
||||
if (cfg_irc_fifo_pipe)
|
||||
{
|
||||
/* build FIFO filename: "~/.weechat/weechat_fifo_" + process PID */
|
||||
if (!weechat_fifo_filename)
|
||||
{
|
||||
filename_length = strlen (weechat_home) + 64;
|
||||
weechat_fifo_filename = (char *) malloc (filename_length * sizeof (char));
|
||||
snprintf (weechat_fifo_filename, filename_length, "%s/weechat_fifo_%d",
|
||||
weechat_home, (int) getpid());
|
||||
}
|
||||
|
||||
/* create FIFO pipe, writable for user only */
|
||||
if ((weechat_fifo = mkfifo (weechat_fifo_filename, 0600)) != 0)
|
||||
{
|
||||
weechat_fifo = -1;
|
||||
gui_printf (NULL,
|
||||
_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to create FIFO pipe for remote control (%s)\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* open FIFO pipe in read-only (for WeeChat), non nlobking mode */
|
||||
if ((weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
wee_log_printf (_("%s unable to open FIFO pipe (%s) for reading\n"),
|
||||
WEECHAT_ERROR, weechat_fifo_filename);
|
||||
return;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is open\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_exec: execute a command/text received by FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_exec (char *text)
|
||||
{
|
||||
char *pos_msg, *pos;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = NULL;
|
||||
ptr_server = NULL;
|
||||
ptr_channel = NULL;
|
||||
ptr_buffer = NULL;
|
||||
|
||||
/* look for server/channel at beginning of text */
|
||||
/* text may be: "server,channel *text" or "server *text" or "*text" */
|
||||
if (text[0] == '*')
|
||||
{
|
||||
pos_msg = text + 1;
|
||||
ptr_server = SERVER(gui_current_window->buffer);
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid buffer for displaying text via FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_msg = strstr (text, " *");
|
||||
if (!pos_msg)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
pos_msg[0] = '\0';
|
||||
pos = pos_msg - 1;
|
||||
pos_msg += 2;
|
||||
while ((pos >= text) && (pos[0] == ' '))
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos--;
|
||||
}
|
||||
|
||||
if (text[0])
|
||||
{
|
||||
pos = strchr (text, ',');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
ptr_server = server_search (text);
|
||||
if (!ptr_server || !ptr_server->buffer)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s server \"%s\" not found (FIFO pipe data)\n"),
|
||||
WEECHAT_WARNING, text);
|
||||
return;
|
||||
}
|
||||
if (ptr_server)
|
||||
{
|
||||
if (pos)
|
||||
{
|
||||
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"),
|
||||
WEECHAT_WARNING, pos + 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ptr_server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_ERROR);
|
||||
gui_printf (NULL, _("%s invalid text received on FIFO pipe\n"),
|
||||
WEECHAT_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
if (ptr_channel)
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
else
|
||||
ptr_buffer = ptr_server->buffer;
|
||||
}
|
||||
|
||||
user_command (ptr_server, ptr_buffer, pos_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_read: read data in FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_read ()
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
int num_read;
|
||||
|
||||
num_read = read (weechat_fifo, buffer, sizeof (buffer) - 2);
|
||||
if (num_read > 0)
|
||||
{
|
||||
buffer[num_read] = '\0';
|
||||
|
||||
buf2 = NULL;
|
||||
ptr_buf = buffer;
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
buf2 = (char *) malloc (strlen (weechat_fifo_unterminated) +
|
||||
strlen (buffer) + 1);
|
||||
if (buf2)
|
||||
{
|
||||
strcpy (buf2, weechat_fifo_unterminated);
|
||||
strcat (buf2, buffer);
|
||||
}
|
||||
ptr_buf = buf2;
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
while (ptr_buf && ptr_buf[0])
|
||||
{
|
||||
next_ptr_buf = NULL;
|
||||
pos = strstr (ptr_buf, "\r\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strstr (ptr_buf, "\n");
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
next_ptr_buf = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_fifo_unterminated = strdup (ptr_buf);
|
||||
ptr_buf = NULL;
|
||||
next_ptr_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_buf)
|
||||
fifo_exec (ptr_buf);
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_read < 0)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
wee_log_printf (_("%s error reading FIFO pipe, closing it\n"),
|
||||
WEECHAT_ERROR);
|
||||
fifo_remove ();
|
||||
}
|
||||
else
|
||||
{
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = open (weechat_fifo_filename, O_RDONLY | O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* fifo_remove: remove FIFO pipe
|
||||
*/
|
||||
|
||||
void
|
||||
fifo_remove ()
|
||||
{
|
||||
if (weechat_fifo != -1)
|
||||
{
|
||||
/* close FIFO pipe */
|
||||
close (weechat_fifo);
|
||||
weechat_fifo = -1;
|
||||
}
|
||||
|
||||
/* remove FIFO from disk */
|
||||
if (weechat_fifo_filename)
|
||||
unlink (weechat_fifo_filename);
|
||||
|
||||
if (weechat_fifo_unterminated)
|
||||
{
|
||||
free (weechat_fifo_unterminated);
|
||||
weechat_fifo_unterminated = NULL;
|
||||
}
|
||||
|
||||
if (weechat_fifo_filename)
|
||||
{
|
||||
free (weechat_fifo_filename);
|
||||
weechat_fifo_filename = NULL;
|
||||
}
|
||||
|
||||
wee_log_printf (_("FIFO pipe is closed\n"));
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_FIFO_H
|
||||
#define __WEECHAT_FIFO_H 1
|
||||
|
||||
extern int weechat_fifo;
|
||||
|
||||
extern void fifo_create ();
|
||||
extern void fifo_read ();
|
||||
extern void fifo_remove ();
|
||||
|
||||
#endif /* fifo.h */
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "weechat.h"
|
||||
#include "log.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -71,6 +72,28 @@ log_write (t_gui_buffer *buffer, char *message)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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");
|
||||
fflush (buffer->log_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* log_start: starts a log
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
#define __WEECHAT_LOG_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
extern void log_write_date (t_gui_buffer *);
|
||||
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 *);
|
||||
|
||||
|
||||
+267
-81
@@ -8,11 +8,9 @@
|
||||
* ### WeeChat - Wee Enhanced Environment for Chat ###
|
||||
* ### Fast & light environment for Chat ###
|
||||
* ### ###
|
||||
* ### By: FlashCode <flashcode@flashtux.org> ###
|
||||
* ### Bounga <bounga@altern.org> ###
|
||||
* ### Xahlexx <xahlexx@weeland.org> ###
|
||||
* ### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### By FlashCode <flashcode@flashtux.org> ###
|
||||
### ###
|
||||
* ### http://weechat.flashtux.org ###
|
||||
* ### ###
|
||||
* ############################################################################
|
||||
*
|
||||
@@ -49,99 +47,32 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home = NULL; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file = NULL; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
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 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@@ -173,6 +104,77 @@ wee_log_printf (char *message, ...)
|
||||
fflush (weechat_log_file);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
#else
|
||||
/* make gcc happy */
|
||||
(void) from_code;
|
||||
(void) to_code;
|
||||
outbuf = strdup (string);
|
||||
#endif /* HAVE_ICONV */
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_timeval_diff: calculates difference between two times (return in milliseconds)
|
||||
*/
|
||||
|
||||
long get_timeval_diff(struct timeval *tv1, struct timeval *tv2)
|
||||
{
|
||||
long diff_sec, diff_usec;
|
||||
|
||||
diff_sec = tv2->tv_sec - tv1->tv_sec;
|
||||
diff_usec = tv2->tv_usec - tv1->tv_usec;
|
||||
|
||||
if (diff_usec < 0)
|
||||
{
|
||||
diff_usec += 1000000;
|
||||
diff_sec--;
|
||||
}
|
||||
return ((diff_usec / 1000) + (diff_sec * 1000));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_config_options: display config options
|
||||
*/
|
||||
@@ -246,6 +248,59 @@ void wee_display_config_options ()
|
||||
printf (_("where 'j' is alias name, and 'join' associated command.\n\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_display_commands: display WeeChat and/or IRC commands
|
||||
*/
|
||||
|
||||
void wee_display_commands (int weechat_cmd, int irc_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (weechat_cmd)
|
||||
{
|
||||
printf (_("%s internal commands:\n"), PACKAGE_NAME);
|
||||
printf ("\n");
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
printf ("* %s", weechat_commands[i].command_name);
|
||||
if (weechat_commands[i].arguments &&
|
||||
weechat_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(weechat_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(weechat_commands[i].command_description));
|
||||
if (weechat_commands[i].arguments_description &&
|
||||
weechat_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(weechat_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
|
||||
if (irc_cmd)
|
||||
{
|
||||
printf (_("IRC commands:\n"));
|
||||
printf ("\n");
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if (irc_commands[i].cmd_function_args ||
|
||||
irc_commands[i].cmd_function_1arg)
|
||||
{
|
||||
printf ("* %s", irc_commands[i].command_name);
|
||||
if (irc_commands[i].arguments &&
|
||||
irc_commands[i].arguments[0])
|
||||
printf (" %s\n\n", _(irc_commands[i].arguments));
|
||||
else
|
||||
printf ("\n\n");
|
||||
printf ("%s\n\n", _(irc_commands[i].command_description));
|
||||
if (irc_commands[i].arguments_description &&
|
||||
irc_commands[i].arguments_description[0])
|
||||
printf ("%s\n\n",
|
||||
_(irc_commands[i].arguments_description));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_parse_args: parse command line args
|
||||
*/
|
||||
@@ -273,6 +328,12 @@ wee_parse_args (int argc, char *argv[])
|
||||
printf ("%s", WEE_USAGE2);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-i") == 0)
|
||||
|| (strcmp (argv[i], "--irc-commands") == 0))
|
||||
{
|
||||
wee_display_commands (0, 1);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strcmp (argv[i], "-l") == 0)
|
||||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
@@ -285,6 +346,12 @@ wee_parse_args (int argc, char *argv[])
|
||||
printf (PACKAGE_VERSION "\n");
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
if ((strcmp (argv[i], "-w") == 0)
|
||||
|| (strcmp (argv[i], "--weechat-commands") == 0))
|
||||
{
|
||||
wee_display_commands (1, 0);
|
||||
wee_shutdown (EXIT_SUCCESS);
|
||||
}
|
||||
else if ((strncasecmp (argv[i], "irc://", 6) == 0))
|
||||
{
|
||||
if (server_init_with_url (argv[i], &server_tmp) < 0)
|
||||
@@ -527,6 +594,7 @@ wee_gui_shutdown ()
|
||||
void
|
||||
wee_shutdown (int return_code)
|
||||
{
|
||||
fifo_remove ();
|
||||
if (weechat_home)
|
||||
free (weechat_home);
|
||||
if (weechat_log_file)
|
||||
@@ -537,6 +605,122 @@ wee_shutdown (int return_code)
|
||||
exit (return_code);
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_dump writes dump to WeeChat log file
|
||||
*/
|
||||
|
||||
void
|
||||
wee_dump (int crash)
|
||||
{
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* prevent reentrance */
|
||||
if (sigsegv)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
if (crash)
|
||||
{
|
||||
sigsegv = 1;
|
||||
wee_log_printf ("very bad, WeeChat is crashing (SIGSEGV received)...\n");
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
if (crash)
|
||||
{
|
||||
wee_log_printf ("****** WeeChat CRASH DUMP ******\n");
|
||||
wee_log_printf ("****** Please send this file to WeeChat developers ******\n");
|
||||
wee_log_printf ("****** and explain when this crash happened ******\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf ("****** WeeChat dump request ******\n");
|
||||
}
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
server_print_log (ptr_server);
|
||||
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
channel_print_log (ptr_channel);
|
||||
|
||||
for (ptr_nick = ptr_channel->nicks; ptr_nick;
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
nick_print_log (ptr_nick);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("[windows/buffers]\n");
|
||||
wee_log_printf (" => windows:\n");
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_window);
|
||||
}
|
||||
wee_log_printf (" => buffers:\n");
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf (" 0x%X\n", ptr_buffer);
|
||||
}
|
||||
wee_log_printf (" => current window = 0x%X\n", gui_current_window);
|
||||
|
||||
for (ptr_window = gui_windows; ptr_window; ptr_window = ptr_window->next_window)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_window_print_log (ptr_window);
|
||||
}
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
wee_log_printf ("\n");
|
||||
gui_buffer_print_log (ptr_buffer);
|
||||
}
|
||||
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf ("****** End of dump ******\n");
|
||||
wee_log_printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigint: SIGINT handler, do nothing (just ignore this signal)
|
||||
* Prevents user for exiting with Ctrl-C
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigint ()
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit
|
||||
*/
|
||||
|
||||
void
|
||||
my_sigsegv ()
|
||||
{
|
||||
wee_dump (1);
|
||||
wee_gui_shutdown ();
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "*** Very bad! WeeChat has crashed (SIGSEGV received)\n");
|
||||
fprintf (stderr, "*** Full crash dump was saved to ~/.weechat/weechat.log file\n");
|
||||
fprintf (stderr, "*** Please send this file to WeeChat developers.\n");
|
||||
fprintf (stderr, "*** (be careful, private info may be in this file since\n");
|
||||
fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
|
||||
wee_shutdown (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* main: WeeChat startup
|
||||
*/
|
||||
@@ -553,6 +737,7 @@ main (int argc, char *argv[])
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
wee_parse_args (argc, argv); /* parse command line args */
|
||||
@@ -580,6 +765,7 @@ main (int argc, char *argv[])
|
||||
weechat_welcome_message (); /* display WeeChat welcome message */
|
||||
/* auto-connect to servers */
|
||||
server_auto_connect (server_cmd_line);
|
||||
fifo_create (); /* create FIFO pipe for remote control */
|
||||
|
||||
gui_main_loop (); /* WeeChat main loop */
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
#define WEECHAT_COPYRIGHT_DATE "(c) 2003-2005"
|
||||
#define WEECHAT_WEBSITE "http://weechat.flashtux.org"
|
||||
|
||||
#define WEECHAT_ERROR _(PACKAGE_NAME " Error:")
|
||||
#define WEECHAT_WARNING _(PACKAGE_NAME " Warning:")
|
||||
#define WEECHAT_ERROR _("WeeChat Error:")
|
||||
#define WEECHAT_WARNING _("WeeChat Warning:")
|
||||
|
||||
/* log file */
|
||||
|
||||
@@ -81,10 +81,12 @@
|
||||
" or: %s [irc://[nickname[:password]@]irc.example.org[:port][/channel] ...]\n\n"
|
||||
|
||||
#define WEE_USAGE2 \
|
||||
" -c, --config config file help (list of options)\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n\n"
|
||||
" -c, --config display config file options\n" \
|
||||
" -h, --help this help screen\n" \
|
||||
" -i, --irc-commands display IRC commands\n" \
|
||||
" -l, --license display WeeChat license\n" \
|
||||
" -v, --version display WeeChat version\n" \
|
||||
" -w, --weechat-commands display WeeChat commands\n\n"
|
||||
|
||||
/* directory separator, depending on OS */
|
||||
|
||||
@@ -102,9 +104,10 @@ extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown (int);
|
||||
|
||||
#endif /* weechat.h */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
#include "command.h"
|
||||
#include "fifo.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
@@ -204,6 +205,8 @@ int cfg_col_input_nick;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
int cfg_col_nick_chanowner;
|
||||
int cfg_col_nick_chanadmin;
|
||||
int cfg_col_nick_op;
|
||||
int cfg_col_nick_halfop;
|
||||
int cfg_col_nick_voice;
|
||||
@@ -297,7 +300,7 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"default", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
{ "col_status_more", N_("color for \"-MORE-\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_status_more, NULL, &config_change_color },
|
||||
@@ -347,6 +350,14 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for away nicknames"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"cyan", NULL, &cfg_col_nick_away, NULL, &config_change_color },
|
||||
{ "col_nick_chanowner", N_("color for chan owner symbol"),
|
||||
N_("color for chan owner symbol (specific to unrealircd)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_nick_chanowner, NULL, &config_change_color },
|
||||
{ "col_nick_chanadmin", N_("color for chan admin symbol"),
|
||||
N_("color for chan admin symbol (specific to unrealircd)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_nick_chanadmin, NULL, &config_change_color },
|
||||
{ "col_nick_op", N_("color for operator symbol"),
|
||||
N_("color for operator symbol"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -384,7 +395,7 @@ t_config_option weechat_options_colors[] =
|
||||
{ "col_dcc_waiting", N_("color for \"waiting\" dcc status"),
|
||||
N_("color for \"waiting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
"lightcyan", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
{ "col_dcc_connecting", N_("color for \"connecting\" dcc status"),
|
||||
N_("color for \"connecting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -432,6 +443,7 @@ t_config_option weechat_options_history[] =
|
||||
int cfg_log_auto_server;
|
||||
int cfg_log_auto_channel;
|
||||
int cfg_log_auto_private;
|
||||
int cfg_log_plugin_msg;
|
||||
char *cfg_log_path;
|
||||
char *cfg_log_timestamp;
|
||||
int cfg_log_hide_nickserv_pwd;
|
||||
@@ -449,6 +461,10 @@ t_config_option weechat_options_log[] =
|
||||
N_("automatically log private chats"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_log_auto_private, NULL, NULL },
|
||||
{ "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 },
|
||||
{ "log_path", N_("path for log files"),
|
||||
N_("path for WeeChat log files"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -474,6 +490,7 @@ 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;
|
||||
|
||||
t_config_option weechat_options_irc[] =
|
||||
{ { "irc_display_away", N_("display message to all channels when away"),
|
||||
@@ -494,7 +511,7 @@ t_config_option weechat_options_irc[] =
|
||||
"WeeChat %v", NULL, NULL, &cfg_irc_default_msg_quit, config_change_noop },
|
||||
{ "irc_away_check", N_("interval between two checks for away"),
|
||||
N_("interval between two checks for away (in minutes, 0 = never check)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 1,
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 0,
|
||||
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)"),
|
||||
@@ -508,6 +525,10 @@ t_config_option weechat_options_irc[] =
|
||||
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 },
|
||||
{ "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, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -519,6 +540,7 @@ int cfg_dcc_timeout;
|
||||
int cfg_dcc_blocksize;
|
||||
char *cfg_dcc_download_path;
|
||||
char *cfg_dcc_upload_path;
|
||||
int cfg_dcc_convert_spaces;
|
||||
int cfg_dcc_auto_rename;
|
||||
int cfg_dcc_auto_resume;
|
||||
|
||||
@@ -529,15 +551,15 @@ t_config_option weechat_options_dcc[] =
|
||||
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_TRUE,
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
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 },
|
||||
{ "dcc_blocksize", N_("block size for dcc packets"),
|
||||
N_("block size for dcc packets in bytes (default: 1024)"),
|
||||
OPTION_TYPE_INT, 1024, 102400, 1024,
|
||||
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 },
|
||||
{ "dcc_download_path", N_("path for incoming files with dcc"),
|
||||
N_("path for writing incoming files with dcc (default: user home)"),
|
||||
@@ -547,6 +569,10 @@ t_config_option weechat_options_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 },
|
||||
{ "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 },
|
||||
{ "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,
|
||||
@@ -603,7 +629,7 @@ t_config_option weechat_options_server[] =
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &(cfg_server.autoreconnect), NULL, NULL },
|
||||
{ "server_autoreconnect_delay", N_("delay before trying again to reconnect"),
|
||||
N_("delay (in deconds) before trying again to reconnect to server"),
|
||||
N_("delay (in seconds) before trying again to reconnect to server"),
|
||||
OPTION_TYPE_INT, 0, 65535, 30,
|
||||
NULL, NULL, &(cfg_server.autoreconnect_delay), NULL, NULL },
|
||||
{ "server_address", N_("server address or hostname"),
|
||||
@@ -779,6 +805,25 @@ config_change_away_check ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_fifo_pipe: called when FIFO pipe is changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_fifo_pipe ()
|
||||
{
|
||||
if (cfg_irc_fifo_pipe)
|
||||
{
|
||||
if (weechat_fifo == -1)
|
||||
fifo_create ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (weechat_fifo != -1)
|
||||
fifo_remove ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_set_value: set new value for an option
|
||||
* return: 0 if success
|
||||
|
||||
@@ -127,6 +127,8 @@ extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
extern int cfg_col_nick_chanowner;
|
||||
extern int cfg_col_nick_chanadmin;
|
||||
extern int cfg_col_nick_op;
|
||||
extern int cfg_col_nick_halfop;
|
||||
extern int cfg_col_nick_voice;
|
||||
@@ -148,6 +150,7 @@ extern int cfg_history_max_commands;
|
||||
extern int cfg_log_auto_server;
|
||||
extern int cfg_log_auto_channel;
|
||||
extern int cfg_log_auto_private;
|
||||
extern int cfg_log_plugin_msg;
|
||||
extern char *cfg_log_path;
|
||||
extern char *cfg_log_timestamp;
|
||||
extern int cfg_log_hide_nickserv_pwd;
|
||||
@@ -160,6 +163,7 @@ 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 int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
@@ -167,6 +171,7 @@ extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_convert_spaces;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
extern int cfg_dcc_auto_resume;
|
||||
|
||||
@@ -185,6 +190,7 @@ extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern void config_change_away_check ();
|
||||
extern void config_change_fifo_pipe ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern int config_set_value (char *, char *);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../common/fifo.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
#define KEY_ESCAPE 27
|
||||
@@ -52,8 +53,9 @@ gui_read_keyb ()
|
||||
int key, i;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_dcc *ptr_dcc;
|
||||
char new_char[3], *decoded_string;
|
||||
t_dcc *dcc_selected;
|
||||
t_irc_dcc *dcc_selected;
|
||||
|
||||
key = getch ();
|
||||
if (key != ERR)
|
||||
@@ -69,19 +71,22 @@ gui_read_keyb ()
|
||||
case KEY_F(2):
|
||||
case KEY_F(3):
|
||||
case KEY_F(4):
|
||||
case KEY_F(5):
|
||||
case KEY_F(9):
|
||||
case KEY_F(11):
|
||||
case KEY_F(12):
|
||||
break;
|
||||
/* previous buffer in window */
|
||||
case KEY_F(6):
|
||||
case KEY_F(5):
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
/* next buffer in window */
|
||||
case KEY_F(7):
|
||||
case KEY_F(6):
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
/* previous window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_previous_window (gui_current_window);
|
||||
break;
|
||||
/* next window */
|
||||
case KEY_F(8):
|
||||
gui_switch_to_next_window (gui_current_window);
|
||||
@@ -98,14 +103,14 @@ gui_read_keyb ()
|
||||
if (dcc_list)
|
||||
{
|
||||
if (gui_current_window->dcc_selected
|
||||
&& ((t_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
|
||||
&& ((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc)
|
||||
{
|
||||
if (gui_current_window->dcc_selected ==
|
||||
gui_current_window->dcc_first)
|
||||
gui_current_window->dcc_first =
|
||||
((t_dcc *)(gui_current_window->dcc_first))->prev_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_first))->prev_dcc;
|
||||
gui_current_window->dcc_selected =
|
||||
((t_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_selected))->prev_dcc;
|
||||
gui_draw_buffer_chat (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
}
|
||||
@@ -144,7 +149,7 @@ gui_read_keyb ()
|
||||
if (dcc_list)
|
||||
{
|
||||
if (!gui_current_window->dcc_selected
|
||||
|| ((t_dcc *)(gui_current_window->dcc_selected))->next_dcc)
|
||||
|| ((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc)
|
||||
{
|
||||
if (gui_current_window->dcc_last_displayed
|
||||
&& (gui_current_window->dcc_selected ==
|
||||
@@ -152,14 +157,14 @@ gui_read_keyb ()
|
||||
{
|
||||
if (gui_current_window->dcc_first)
|
||||
gui_current_window->dcc_first =
|
||||
((t_dcc *)(gui_current_window->dcc_first))->next_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_first))->next_dcc;
|
||||
else
|
||||
gui_current_window->dcc_first =
|
||||
dcc_list->next_dcc;
|
||||
}
|
||||
if (gui_current_window->dcc_selected)
|
||||
gui_current_window->dcc_selected =
|
||||
((t_dcc *)(gui_current_window->dcc_selected))->next_dcc;
|
||||
((t_irc_dcc *)(gui_current_window->dcc_selected))->next_dcc;
|
||||
else
|
||||
gui_current_window->dcc_selected =
|
||||
dcc_list->next_dcc;
|
||||
@@ -544,6 +549,7 @@ gui_read_keyb ()
|
||||
gui_current_window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer,
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
{
|
||||
@@ -558,16 +564,15 @@ gui_read_keyb ()
|
||||
if (gui_current_window->buffer->dcc)
|
||||
{
|
||||
dcc_selected = (gui_current_window->dcc_selected) ?
|
||||
(t_dcc *) gui_current_window->dcc_selected : dcc_list;
|
||||
(t_irc_dcc *) gui_current_window->dcc_selected : dcc_list;
|
||||
switch (key)
|
||||
{
|
||||
/* accept DCC */
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (dcc_selected
|
||||
&& (((dcc_selected->type == DCC_CHAT_RECV)
|
||||
|| (dcc_selected->type == DCC_FILE_RECV))
|
||||
&& (dcc_selected->status == DCC_WAITING)))
|
||||
&& (DCC_IS_RECV(dcc_selected->status))
|
||||
&& (dcc_selected->status == DCC_WAITING))
|
||||
{
|
||||
dcc_accept (dcc_selected);
|
||||
}
|
||||
@@ -576,29 +581,41 @@ gui_read_keyb ()
|
||||
case 'c':
|
||||
case 'C':
|
||||
if (dcc_selected
|
||||
&& ((dcc_selected->status == DCC_WAITING)
|
||||
|| (dcc_selected->status == DCC_CONNECTING)
|
||||
|| (dcc_selected->status == DCC_ACTIVE)))
|
||||
&& (!DCC_ENDED(dcc_selected->status)))
|
||||
{
|
||||
dcc_close (dcc_selected, DCC_ABORTED);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
break;
|
||||
/* purge old DCC */
|
||||
case 'p':
|
||||
case 'P':
|
||||
gui_current_window->dcc_selected = NULL;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (DCC_ENDED(ptr_dcc->status))
|
||||
dcc_free (ptr_dcc);
|
||||
}
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* close DCC window */
|
||||
case 'q':
|
||||
case 'Q':
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
if (buffer_before_dcc)
|
||||
{
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
gui_switch_to_buffer (gui_current_window,
|
||||
buffer_before_dcc);
|
||||
}
|
||||
else
|
||||
gui_buffer_free (gui_current_window->buffer, 1);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* remove from DCC list */
|
||||
case 'r':
|
||||
case 'R':
|
||||
if (dcc_selected
|
||||
&& (((dcc_selected->type == DCC_CHAT_RECV)
|
||||
|| (dcc_selected->type == DCC_FILE_RECV))
|
||||
&& ((dcc_selected->status == DCC_DONE)
|
||||
|| (dcc_selected->status == DCC_FAILED)
|
||||
|| (dcc_selected->status == DCC_ABORTED))))
|
||||
&& (DCC_ENDED(dcc_selected->status)))
|
||||
{
|
||||
if (dcc_selected->next_dcc)
|
||||
gui_current_window->dcc_selected = dcc_selected->next_dcc;
|
||||
@@ -703,10 +720,15 @@ gui_main_loop ()
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO (&read_fd);
|
||||
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
if (weechat_fifo != -1)
|
||||
FD_SET (weechat_fifo, &read_fd);
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 10000;
|
||||
FD_ZERO (&read_fd);
|
||||
FD_SET (STDIN_FILENO, &read_fd);
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
@@ -745,23 +767,38 @@ gui_main_loop ()
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr_server->sock4 >= 0)
|
||||
FD_SET (ptr_server->sock4, &read_fd);
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
FD_SET (ptr_server->child_read, &read_fd);
|
||||
else
|
||||
{
|
||||
if (ptr_server->sock >= 0)
|
||||
FD_SET (ptr_server->sock, &read_fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout))
|
||||
|
||||
if (select (FD_SETSIZE, &read_fd, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
if (FD_ISSET (STDIN_FILENO, &read_fd))
|
||||
{
|
||||
gui_read_keyb ();
|
||||
}
|
||||
else
|
||||
if ((weechat_fifo != -1) && (FD_ISSET (weechat_fifo, &read_fd)))
|
||||
{
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
fifo_read ();
|
||||
}
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
|
||||
{
|
||||
if ((ptr_server->sock4 >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock4, &read_fd)))
|
||||
if (FD_ISSET (ptr_server->child_read, &read_fd))
|
||||
server_child_read (ptr_server);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ptr_server->sock >= 0) &&
|
||||
(FD_ISSET (ptr_server->sock, &read_fd)))
|
||||
server_recv (ptr_server);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,6 +337,9 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
{
|
||||
if (window->buffer && (window->buffer->num_displayed > 0))
|
||||
window->buffer->num_displayed--;
|
||||
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
@@ -455,6 +458,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
ptr_win->buffer = NULL;
|
||||
}
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
@@ -475,6 +484,7 @@ gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->log_write = 1;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
@@ -807,3 +817,115 @@ gui_move_buffer_to_number (t_gui_window *window, int number)
|
||||
|
||||
gui_redraw_buffer (window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_print_log: print window infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_print_log (t_gui_window *window)
|
||||
{
|
||||
wee_log_printf ("[window (addr:0x%X)]\n", window);
|
||||
wee_log_printf (" win_x . . . . . . . : %d\n", window->win_x);
|
||||
wee_log_printf (" win_y . . . . . . . : %d\n", window->win_y);
|
||||
wee_log_printf (" win_width . . . . . : %d\n", window->win_width);
|
||||
wee_log_printf (" win_height. . . . . : %d\n", window->win_height);
|
||||
wee_log_printf (" win_chat_x. . . . . : %d\n", window->win_chat_x);
|
||||
wee_log_printf (" win_chat_y. . . . . : %d\n", window->win_chat_y);
|
||||
wee_log_printf (" win_chat_width. . . : %d\n", window->win_chat_width);
|
||||
wee_log_printf (" win_chat_height . . : %d\n", window->win_chat_height);
|
||||
wee_log_printf (" win_chat_cursor_x . : %d\n", window->win_chat_cursor_x);
|
||||
wee_log_printf (" win_chat_cursor_y . : %d\n", window->win_chat_cursor_y);
|
||||
wee_log_printf (" win_nick_x. . . . . : %d\n", window->win_nick_x);
|
||||
wee_log_printf (" win_nick_y. . . . . : %d\n", window->win_nick_y);
|
||||
wee_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
|
||||
wee_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
|
||||
wee_log_printf (" win_title . . . . . : 0x%X\n", window->win_title);
|
||||
wee_log_printf (" win_chat. . . . . . : 0x%X\n", window->win_chat);
|
||||
wee_log_printf (" win_nick. . . . . . : 0x%X\n", window->win_nick);
|
||||
wee_log_printf (" win_status. . . . . : 0x%X\n", window->win_status);
|
||||
wee_log_printf (" win_infobar . . . . : 0x%X\n", window->win_infobar);
|
||||
wee_log_printf (" win_input . . . . . : 0x%X\n", window->win_input);
|
||||
wee_log_printf (" win_separator . . . : 0x%X\n", window->win_separator);
|
||||
wee_log_printf (" textview_chat . . . : 0x%X\n", window->textview_chat);
|
||||
wee_log_printf (" textbuffer_chat . . : 0x%X\n", window->textbuffer_chat);
|
||||
wee_log_printf (" texttag_chat. . . . : 0x%X\n", window->texttag_chat);
|
||||
wee_log_printf (" textview_nicklist . : 0x%X\n", window->textview_nicklist);
|
||||
wee_log_printf (" textbuffer_nicklist : 0x%X\n", window->textbuffer_nicklist);
|
||||
wee_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
|
||||
wee_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
|
||||
wee_log_printf (" dcc_last_displayed. : 0x%X\n", window->dcc_last_displayed);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", window->buffer);
|
||||
wee_log_printf (" first_line_displayed: %d\n", window->first_line_displayed);
|
||||
wee_log_printf (" sub_lines . . . . . : %d\n", window->sub_lines);
|
||||
wee_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
|
||||
wee_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_print_log: print buffer infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_print_log (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
int num;
|
||||
char buf[4096];
|
||||
|
||||
wee_log_printf ("[buffer (addr:0x%X)]\n", buffer);
|
||||
wee_log_printf (" num_displayed. . . . : %d\n", buffer->num_displayed);
|
||||
wee_log_printf (" number . . . . . . . : %d\n", buffer->number);
|
||||
wee_log_printf (" server . . . . . . . : 0x%X\n", buffer->server);
|
||||
wee_log_printf (" channel. . . . . . . : 0x%X\n", buffer->channel);
|
||||
wee_log_printf (" dcc. . . . . . . . . : %d\n", buffer->dcc);
|
||||
wee_log_printf (" lines. . . . . . . . : 0x%X\n", buffer->lines);
|
||||
wee_log_printf (" last_line. . . . . . : 0x%X\n", buffer->last_line);
|
||||
wee_log_printf (" num_lines. . . . . . : %d\n", buffer->num_lines);
|
||||
wee_log_printf (" line_complete. . . . : %d\n", buffer->line_complete);
|
||||
wee_log_printf (" notify_level . . . . : %d\n", buffer->notify_level);
|
||||
wee_log_printf (" log_filename . . . . : '%s'\n", buffer->log_filename);
|
||||
wee_log_printf (" log_file . . . . . . : 0x%X\n", buffer->log_file);
|
||||
wee_log_printf (" input_buffer . . . . : '%s'\n", buffer->input_buffer);
|
||||
wee_log_printf (" input_buffer_alloc . : %d\n", buffer->input_buffer_alloc);
|
||||
wee_log_printf (" input_buffer_size. . : %d\n", buffer->input_buffer_size);
|
||||
wee_log_printf (" input_buffer_pos . . : %d\n", buffer->input_buffer_pos);
|
||||
wee_log_printf (" input_buffer_1st_disp: %d\n", buffer->input_buffer_1st_display);
|
||||
wee_log_printf (" history. . . . . . . : 0x%X\n", buffer->history);
|
||||
wee_log_printf (" last_history . . . . : 0x%X\n", buffer->last_history);
|
||||
wee_log_printf (" ptr_history. . . . . : 0x%X\n", buffer->ptr_history);
|
||||
wee_log_printf (" prev_buffer. . . . . : 0x%X\n", buffer->prev_buffer);
|
||||
wee_log_printf (" next_buffer. . . . . : 0x%X\n", buffer->next_buffer);
|
||||
wee_log_printf ("\n");
|
||||
wee_log_printf (" => last 100 lines:\n");
|
||||
|
||||
num = 0;
|
||||
ptr_line = buffer->last_line;
|
||||
while (ptr_line && (num < 100))
|
||||
{
|
||||
num++;
|
||||
ptr_line = ptr_line->prev_line;
|
||||
}
|
||||
if (!ptr_line)
|
||||
ptr_line = buffer->lines;
|
||||
else
|
||||
ptr_line = ptr_line->next_line;
|
||||
|
||||
while (ptr_line)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
for (ptr_message = ptr_line->messages; ptr_message;
|
||||
ptr_message = ptr_message->next_message)
|
||||
{
|
||||
if (strlen (buf) + strlen (ptr_message->message) + 1 >= sizeof (buf))
|
||||
break;
|
||||
strcat (buf, ptr_message->message);
|
||||
}
|
||||
num--;
|
||||
wee_log_printf (" line N-%05d: %s\n", num, buf);
|
||||
|
||||
ptr_line = ptr_line->next_line;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-23
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 47
|
||||
#define NUM_COLORS 49
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -51,22 +51,24 @@
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_AWAY 24
|
||||
#define COLOR_WIN_NICK_OP 25
|
||||
#define COLOR_WIN_NICK_HALFOP 26
|
||||
#define COLOR_WIN_NICK_VOICE 27
|
||||
#define COLOR_WIN_NICK_SEP 28
|
||||
#define COLOR_WIN_NICK_SELF 29
|
||||
#define COLOR_WIN_NICK_PRIVATE 30
|
||||
#define COLOR_WIN_NICK_FIRST 31
|
||||
#define COLOR_WIN_NICK_LAST 40
|
||||
#define COLOR_WIN_NICK_CHANOWNER 25
|
||||
#define COLOR_WIN_NICK_CHANADMIN 26
|
||||
#define COLOR_WIN_NICK_OP 27
|
||||
#define COLOR_WIN_NICK_HALFOP 28
|
||||
#define COLOR_WIN_NICK_VOICE 29
|
||||
#define COLOR_WIN_NICK_SEP 30
|
||||
#define COLOR_WIN_NICK_SELF 31
|
||||
#define COLOR_WIN_NICK_PRIVATE 32
|
||||
#define COLOR_WIN_NICK_FIRST 33
|
||||
#define COLOR_WIN_NICK_LAST 42
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_SELECTED 41
|
||||
#define COLOR_DCC_WAITING 42
|
||||
#define COLOR_DCC_CONNECTING 43
|
||||
#define COLOR_DCC_ACTIVE 44
|
||||
#define COLOR_DCC_DONE 45
|
||||
#define COLOR_DCC_FAILED 46
|
||||
#define COLOR_DCC_ABORTED 47
|
||||
#define COLOR_DCC_SELECTED 43
|
||||
#define COLOR_DCC_WAITING 44
|
||||
#define COLOR_DCC_CONNECTING 45
|
||||
#define COLOR_DCC_ACTIVE 46
|
||||
#define COLOR_DCC_DONE 47
|
||||
#define COLOR_DCC_FAILED 48
|
||||
#define COLOR_DCC_ABORTED 49
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
@@ -76,16 +78,24 @@
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_NICK 2
|
||||
#define MSG_TYPE_INFO 4
|
||||
#define MSG_TYPE_MSG 8
|
||||
#define MSG_TYPE_HIGHLIGHT 16
|
||||
#define MSG_TYPE_PREFIX 2
|
||||
#define MSG_TYPE_NICK 4
|
||||
#define MSG_TYPE_INFO 8
|
||||
#define MSG_TYPE_MSG 16
|
||||
#define MSG_TYPE_HIGHLIGHT 32
|
||||
#define MSG_TYPE_NOLOG 64
|
||||
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, color, 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_color_type(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
#define gui_printf_nolog(buffer, fmt, argz...) \
|
||||
gui_printf_type_color(buffer, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -104,6 +114,7 @@ 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 */
|
||||
@@ -266,6 +277,8 @@ extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
extern void gui_move_buffer_to_number (t_gui_window *, int);
|
||||
extern void gui_window_print_log (t_gui_window *);
|
||||
extern void gui_buffer_print_log (t_gui_buffer *);
|
||||
|
||||
/* GUI dependant functions */
|
||||
|
||||
@@ -286,6 +299,7 @@ extern t_gui_buffer *gui_get_dcc_buffer ();
|
||||
extern void gui_switch_to_dcc_buffer ();
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
@@ -304,7 +318,7 @@ extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_printf_type_color (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
@@ -53,12 +54,14 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
|
||||
/* initialize new channel */
|
||||
new_channel->type = channel_type;
|
||||
new_channel->dcc_chat = NULL;
|
||||
new_channel->name = strdup (channel_name);
|
||||
new_channel->topic = NULL;
|
||||
memset (new_channel->modes, ' ', sizeof (new_channel->modes));
|
||||
new_channel->modes[sizeof (new_channel->modes) - 1] = '\0';
|
||||
new_channel->limit = 0;
|
||||
new_channel->key = NULL;
|
||||
new_channel->nicks_count = 0;
|
||||
new_channel->checking_away = 0;
|
||||
new_channel->nicks = NULL;
|
||||
new_channel->last_nick = NULL;
|
||||
@@ -101,6 +104,14 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
|
||||
if (channel->next_channel)
|
||||
(channel->next_channel)->prev_channel = channel->prev_channel;
|
||||
|
||||
/* close DCC CHAT */
|
||||
if ((t_irc_dcc *)(channel->dcc_chat) &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
|
||||
{
|
||||
dcc_close ((t_irc_dcc *)(channel->dcc_chat), DCC_ABORTED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
|
||||
/* free data */
|
||||
if (channel->name)
|
||||
free (channel->name);
|
||||
@@ -204,3 +215,71 @@ channel_set_away (t_irc_channel *channel, char *nick, int is_away)
|
||||
nick_set_away (channel, ptr_nick, is_away);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_create_dcc: create DCC CHAT channel
|
||||
*/
|
||||
|
||||
int
|
||||
channel_create_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
ptr_channel = channel_search (ptr_dcc->server, ptr_dcc->nick);
|
||||
if (!ptr_channel)
|
||||
ptr_channel = channel_new (ptr_dcc->server, CHAT_PRIVATE,
|
||||
ptr_dcc->nick, 0);
|
||||
if (!ptr_channel)
|
||||
return 0;
|
||||
|
||||
if (ptr_channel->dcc_chat &&
|
||||
(!DCC_ENDED(((t_irc_dcc *)(ptr_channel->dcc_chat))->status)))
|
||||
return 0;
|
||||
|
||||
ptr_channel->dcc_chat = ptr_dcc;
|
||||
ptr_dcc->channel = ptr_channel;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_dcc: remove a DCC CHAT
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_dcc (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = ptr_dcc->server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if ((t_irc_dcc *)(ptr_channel->dcc_chat) == ptr_dcc)
|
||||
{
|
||||
ptr_channel->dcc_chat = NULL;
|
||||
gui_redraw_buffer (ptr_channel->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_print_log: print channel infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
channel_print_log (t_irc_channel *channel)
|
||||
{
|
||||
wee_log_printf ("=> channel %s (addr:0x%X)]\n", channel->name, channel);
|
||||
wee_log_printf (" type . . . . : %d\n", channel->type);
|
||||
wee_log_printf (" dcc_chat . . : 0x%X\n", channel->dcc_chat);
|
||||
wee_log_printf (" topic. . . . : '%s'\n", channel->topic);
|
||||
wee_log_printf (" modes. . . . : '%s'\n", channel->modes);
|
||||
wee_log_printf (" limit. . . . : %d\n", channel->limit);
|
||||
wee_log_printf (" key. . . . . : '%s'\n", channel->key);
|
||||
wee_log_printf (" checking_away: %d\n", channel->checking_away);
|
||||
wee_log_printf (" nicks. . . . : 0x%X\n", channel->nicks);
|
||||
wee_log_printf (" last_nick. . : 0x%X\n", channel->last_nick);
|
||||
wee_log_printf (" buffer . . . : 0x%X\n", channel->buffer);
|
||||
wee_log_printf (" prev_channel : 0x%X\n", channel->prev_channel);
|
||||
wee_log_printf (" next_channel : 0x%X\n", channel->next_channel);
|
||||
}
|
||||
|
||||
@@ -40,16 +40,23 @@ t_irc_command irc_commands[] =
|
||||
N_("-all: toggle away status on all connected servers\n"
|
||||
"message: message for away (if no message is given, away status is removed)"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_away, NULL },
|
||||
{ "ban", N_("bans nicks or hosts"),
|
||||
N_("[channel] [nickname [nickname ...]]"),
|
||||
N_("channel: channel for ban\nnickname: user or host to ban"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_ban, NULL },
|
||||
{ "ctcp", N_("send a ctcp message"),
|
||||
N_("nickname type"),
|
||||
N_("nickname: user to send ctcp to\ntype: \"action\" or \"version\""),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_ctcp, NULL },
|
||||
{ "dcc", N_("starts DCC (file or chat)"),
|
||||
N_("action nickname [file]"),
|
||||
N_("action: 'send' (file) or 'chat'\n"
|
||||
{ "dcc", N_("starts DCC (file or chat) or close chat"),
|
||||
N_("action [nickname [file]]"),
|
||||
N_("action: 'send' (file) or 'chat' or 'close' (chat)\n"
|
||||
"nickname: nickname to send file or chat\n"
|
||||
"file: filename (on local host)"),
|
||||
2, 3, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_dcc, NULL },
|
||||
{ "dehalfop", N_("removes half channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_dehalfop, NULL, NULL },
|
||||
{ "deop", N_("removes channel operator status from nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_deop, NULL, NULL },
|
||||
@@ -60,6 +67,9 @@ t_irc_command irc_commands[] =
|
||||
"", "",
|
||||
0, 0, 1, NULL, irc_cmd_send_die, NULL },
|
||||
{ "error", N_("error received from IRC server"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "halfop", N_("gives half channel operator status to nickname(s)"),
|
||||
N_("nickname [nickname]"), "",
|
||||
1, MAX_ARGS, 1, irc_cmd_send_halfop, NULL, NULL },
|
||||
{ "info", N_("get information describing the server"),
|
||||
N_("[target]"),
|
||||
N_("target: server name"),
|
||||
@@ -67,7 +77,7 @@ t_irc_command irc_commands[] =
|
||||
{ "invite", N_("invite a nick on a channel"),
|
||||
N_("nickname channel"),
|
||||
N_("nickname: nick to invite\nchannel: channel to invite"),
|
||||
2, 2, 1, NULL, irc_cmd_send_invite, NULL },
|
||||
1, 2, 1, irc_cmd_send_invite, NULL, irc_cmd_recv_invite },
|
||||
{ "ison", N_("check if a nickname is currently on IRC"),
|
||||
N_("nickname [nickname ...]"),
|
||||
N_("nickname: nickname"),
|
||||
@@ -80,20 +90,24 @@ t_irc_command irc_commands[] =
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\nnickname: nickname to kick\ncomment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kick, irc_cmd_recv_kick },
|
||||
{ "kickban", N_("kicks and bans a nick from a channel"),
|
||||
N_("[channel] nickname [comment]"),
|
||||
N_("channel: channel where user is\nnickname: nickname to kick and ban\ncomment: comment for kick"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_kickban, NULL },
|
||||
{ "kill", N_("close client-server connection"),
|
||||
N_("nickname comment"),
|
||||
N_("nickname: nickname\ncomment: comment for kill"),
|
||||
2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL },
|
||||
{ "links", N_("list all servernames which are known by the server answering the query"),
|
||||
N_("[[remove_server] server_mask]"),
|
||||
N_("remote_server: this server should answer the query\n"
|
||||
N_("[[server] server_mask]"),
|
||||
N_("server: this server should answer the query\n"
|
||||
"server_mask: list of servers must match this mask"),
|
||||
0, 2, 1, NULL, irc_cmd_send_links, NULL },
|
||||
{ "list", N_("list channels and their topic"),
|
||||
N_("[channel[,channel] [server]]"),
|
||||
N_("channel: channel to list\nserver: server name"),
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_list, NULL },
|
||||
{ "lusers", N_("get statistics about ths size of the IRC network"),
|
||||
{ "lusers", N_("get statistics about the size of the IRC network"),
|
||||
N_("[mask [target]]"),
|
||||
N_("mask: servers matching the mask only\n"
|
||||
"target: server for forwarding request"),
|
||||
@@ -104,7 +118,7 @@ t_irc_command irc_commands[] =
|
||||
0, MAX_ARGS, 1, NULL, irc_cmd_send_me, NULL },
|
||||
{ "mode", N_("change channel or user mode"),
|
||||
N_("{ channel {[+|-]|o|p|s|i|t|n|b|v} [limit] [user] [ban mask] } | "
|
||||
"{ nickname {[+|-]|i|w|s|o}"),
|
||||
"{ nickname {[+|-]|i|w|s|o} }"),
|
||||
N_("channel modes:\n"
|
||||
" channel: channel name to modify\n"
|
||||
" o: give/take channel operator privileges\n"
|
||||
@@ -123,7 +137,7 @@ t_irc_command irc_commands[] =
|
||||
" i: mark a user as invisible\n"
|
||||
" s: mark a user for receive server notices\n"
|
||||
" w: user receives wallops\n"
|
||||
" o: operator flag\n"),
|
||||
" o: operator flag"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
|
||||
{ "motd", N_("get the \"Message Of The Day\""),
|
||||
N_("[target]"),
|
||||
@@ -170,7 +184,7 @@ t_irc_command irc_commands[] =
|
||||
N_("nickname: nickname for private conversation"
|
||||
"\ntext: text to send"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_query, NULL },
|
||||
{ "quit", N_("close all connections & quit " PACKAGE_NAME),
|
||||
{ "quit", N_("close all connections & quit"),
|
||||
N_("[quit_message]"),
|
||||
N_("quit_message: quit message (displayed to other users)"),
|
||||
0, MAX_ARGS, 0, NULL, irc_cmd_send_quit, irc_cmd_recv_quit },
|
||||
@@ -197,7 +211,7 @@ t_irc_command irc_commands[] =
|
||||
N_("service text"), N_("service: name of service\ntext: text to send"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squery, NULL },
|
||||
{ "squit", N_("disconnect server links"),
|
||||
N_("server commnent"), N_("server: server name\ncomment: comment for quit"),
|
||||
N_("server comment"), N_("server: server name\ncomment: comment for quit"),
|
||||
2, 2, 1, NULL, irc_cmd_send_squit, NULL },
|
||||
{ "stats", N_("query statistics about server"),
|
||||
N_("[query [server]]"),
|
||||
@@ -218,6 +232,10 @@ t_irc_command irc_commands[] =
|
||||
{ "trace", N_("find the route to specific server"),
|
||||
N_("[target]"), N_("target: server"),
|
||||
0, 1, 1, NULL, irc_cmd_send_trace, NULL },
|
||||
{ "unban", N_("unbans nicks or hosts"),
|
||||
N_("[channel] nickname [nickname ...]"),
|
||||
N_("channel: channel for unban\nnickname: user or host to unban"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_unban, NULL },
|
||||
{ "userhost", N_("return a list of information about nicknames"),
|
||||
N_("nickname [nickname ...]"), N_("nickname: nickname"),
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_userhost, NULL },
|
||||
@@ -236,7 +254,7 @@ t_irc_command irc_commands[] =
|
||||
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
|
||||
{ "who", N_("generate a query which returns a list of information"),
|
||||
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
|
||||
"o: only operators are returned according to the mask supplied\n"),
|
||||
"o: only operators are returned according to the mask supplied"),
|
||||
0, 2, 1, NULL, irc_cmd_send_who, NULL },
|
||||
{ "whois", N_("query information about user(s)"),
|
||||
N_("[server] nickname[,nickname]"), N_("server: server name\n"
|
||||
@@ -311,6 +329,8 @@ t_irc_command irc_commands[] =
|
||||
{ "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 },
|
||||
@@ -337,6 +357,8 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "409", N_("no origin"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "410", N_("no services"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "411", N_("no recipient"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "412", N_("no text to send"),
|
||||
@@ -355,12 +377,14 @@ t_irc_command irc_commands[] =
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "431", N_("no nickname given"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "432", N_("erroneus nickname"),
|
||||
{ "432", N_("erroneous nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "433", N_("nickname already in use"),
|
||||
"", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_433 },
|
||||
{ "436", N_("nickname collision"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "438", N_("not authorized to change nickname"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_438 },
|
||||
{ "441", N_("user not in channel"),
|
||||
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
|
||||
{ "442", N_("not on channel"),
|
||||
|
||||
+781
-152
File diff suppressed because it is too large
Load Diff
@@ -43,11 +43,18 @@
|
||||
void
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
int type;
|
||||
|
||||
type = MSG_TYPE_INFO | MSG_TYPE_PREFIX;
|
||||
|
||||
if (!cfg_log_plugin_msg && (prefix == PREFIX_PLUGIN))
|
||||
type |= MSG_TYPE_NOLOG;
|
||||
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c ", 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]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
@@ -63,41 +70,43 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (buffer,
|
||||
if (nick->is_chanowner)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "~");
|
||||
else if (nick->is_chanadmin)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "&");
|
||||
else if (nick->is_op)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else if (nick->is_halfop)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else if (nick->has_voice)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (buffer,
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
@@ -106,7 +115,7 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (buffer,
|
||||
gui_printf_type_color (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -141,7 +150,7 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
void
|
||||
irc_display_server (t_irc_server *server)
|
||||
{
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
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, " [");
|
||||
@@ -149,58 +158,46 @@ irc_display_server (t_irc_server *server)
|
||||
(server->is_connected) ?
|
||||
_("connected") : _("not connected"));
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoconnect : %s%s\n",
|
||||
(server->autoconnect) ? _("yes") : _("no"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect . . .: %s\n",
|
||||
(server->autoreconnect) ? _("yes") : _("no"));
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autoreconnect_delay: %d seconds\n",
|
||||
server->autoreconnect_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_address . . . . . .: %s\n",
|
||||
server->address);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_port . . . . . . .: %d\n",
|
||||
server->port);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_password . . . . .: %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_nick1/2/3 . . . . .: %s", server->nick1);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_username . . . . .: %s\n",
|
||||
server->username);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_realname . . . . .: %s\n",
|
||||
server->realname);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command . . . . . .: %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_command_delay . . .: %d seconds\n",
|
||||
server->command_delay);
|
||||
irc_display_prefix (NULL, PREFIX_INFO);
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT,
|
||||
" server_autojoin . . . . .: %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
|
||||
@@ -64,8 +64,10 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
|
||||
{
|
||||
int score1, score2, comp;
|
||||
|
||||
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
|
||||
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
|
||||
score1 = - ( (nick1->is_chanowner * 32) + (nick1->is_chanadmin * 16) +
|
||||
(nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2) );
|
||||
score2 = - ( (nick2->is_chanowner * 32) + (nick2->is_chanadmin * 16) +
|
||||
(nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2) );
|
||||
|
||||
comp = strcasecmp(nick1->nick, nick2->nick);
|
||||
if (comp > 0)
|
||||
@@ -149,7 +151,8 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
|
||||
|
||||
t_irc_nick *
|
||||
nick_new (t_irc_channel *channel, char *nick_name,
|
||||
int is_op, int is_halfop, int has_voice)
|
||||
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
|
||||
int has_voice)
|
||||
{
|
||||
t_irc_nick *new_nick;
|
||||
|
||||
@@ -157,6 +160,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
if ((new_nick = nick_search (channel, nick_name)))
|
||||
{
|
||||
/* update nick */
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
@@ -173,6 +178,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
|
||||
/* initialize new nick */
|
||||
new_nick->nick = strdup (nick_name);
|
||||
new_nick->is_chanowner = is_chanowner;
|
||||
new_nick->is_chanadmin = is_chanadmin;
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
@@ -184,6 +191,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
channel->nicks_count++;
|
||||
|
||||
/* all is ok, return address of new nick */
|
||||
return new_nick;
|
||||
}
|
||||
@@ -256,6 +265,8 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
|
||||
if (nick->next_nick)
|
||||
(nick->next_nick)->prev_nick = nick->prev_nick;
|
||||
|
||||
channel->nicks_count--;
|
||||
|
||||
/* free data */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
@@ -273,6 +284,9 @@ nick_free_all (t_irc_channel *channel)
|
||||
/* remove all nicks for the channel */
|
||||
while (channel->nicks)
|
||||
nick_free (channel, channel->nicks);
|
||||
|
||||
/* sould be zero, but prevent any bug :D */
|
||||
channel->nicks_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -312,7 +326,7 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
|
||||
ptr_nick = ptr_nick->next_nick)
|
||||
{
|
||||
(*total)++;
|
||||
if (ptr_nick->is_op)
|
||||
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
|
||||
(*count_op)++;
|
||||
else
|
||||
{
|
||||
@@ -362,3 +376,22 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
|
||||
gui_draw_buffer_nick (channel->buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nick_print_log: print nick infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
nick_print_log (t_irc_nick *nick)
|
||||
{
|
||||
wee_log_printf ("=> nick %s (addr:0x%X)]\n", nick->nick, nick);
|
||||
wee_log_printf (" is_chanowner . : %d\n", nick->is_chanowner);
|
||||
wee_log_printf (" is_chanadmin . : %d\n", nick->is_chanadmin);
|
||||
wee_log_printf (" is_op. . . . . : %d\n", nick->is_op);
|
||||
wee_log_printf (" is_halfop. . . : %d\n", nick->is_halfop);
|
||||
wee_log_printf (" has_voice. . . : %d\n", nick->has_voice);
|
||||
wee_log_printf (" is_away. . . . : %d\n", nick->is_away);
|
||||
wee_log_printf (" color. . . . . : %d\n", nick->color);
|
||||
wee_log_printf (" prev_nick. . . : 0x%X\n", nick->prev_nick);
|
||||
wee_log_printf (" next_nick. . . : 0x%X\n", nick->next_nick);
|
||||
}
|
||||
|
||||
+531
-118
File diff suppressed because it is too large
Load Diff
+446
-96
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
@@ -187,6 +187,84 @@ irc_cmd_send_away (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_ban: bans nicks or hosts
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_ban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos, *pos2;
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
pos_channel = NULL;
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = ' ';
|
||||
pos = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
pos = arguments;
|
||||
|
||||
/* channel not given, use default buffer */
|
||||
if (!pos_channel)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
/* loop on users */
|
||||
while (pos && pos[0])
|
||||
{
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
}
|
||||
server_sendf (server, "MODE %s +b %s\r\n", pos_channel, pos);
|
||||
pos = pos2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "ban");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "MODE %s +b\r\n", CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_ctcp: send a ctcp message
|
||||
*/
|
||||
@@ -246,21 +324,106 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dcc: starts DCC (file or chat)
|
||||
* irc_cmd_send_dcc: start DCC (file or chat)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dcc (t_irc_server *server, char *arguments)
|
||||
{
|
||||
/* TODO: write this command! */
|
||||
char *pos_nick, *pos_file;
|
||||
|
||||
/* make gcc happy */
|
||||
(void) server;
|
||||
(void) arguments;
|
||||
/* DCC SEND file */
|
||||
if (strncasecmp (arguments, "send", 4) == 0)
|
||||
{
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
return -1;
|
||||
}
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
|
||||
pos_file = strchr (pos_nick, ' ');
|
||||
if (!pos_file)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc send");
|
||||
return -1;
|
||||
}
|
||||
pos_file[0] = '\0';
|
||||
pos_file++;
|
||||
while (pos_file[0] == ' ')
|
||||
pos_file++;
|
||||
|
||||
dcc_send_request (server, DCC_FILE_SEND, pos_nick, pos_file);
|
||||
}
|
||||
else if (strncasecmp (arguments, "chat", 4) == 0)
|
||||
{
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc chat");
|
||||
return -1;
|
||||
}
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
|
||||
dcc_send_request (server, DCC_CHAT_SEND, pos_nick, NULL);
|
||||
}
|
||||
else if (strcasecmp (arguments, "close") == 0)
|
||||
{
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer) &&
|
||||
CHANNEL(gui_current_window->buffer)->dcc_chat)
|
||||
{
|
||||
dcc_close ((t_irc_dcc *)(CHANNEL(gui_current_window->buffer)->dcc_chat),
|
||||
DCC_ABORTED);
|
||||
dcc_redraw (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "dcc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("This command is not developed!\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_dehalfop: remove half operator privileges from nickname(s)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_dehalfop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -h %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "dehalfop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -283,9 +446,9 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -309,9 +472,9 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -331,6 +494,33 @@ irc_cmd_send_die (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_halfop: give half operator privileges to nickname(s)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_halfop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +h %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "halfop");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_info: get information describing the server
|
||||
*/
|
||||
@@ -350,9 +540,23 @@ irc_cmd_send_info (t_irc_server *server, char *arguments)
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_invite (t_irc_server *server, char *arguments)
|
||||
irc_cmd_send_invite (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
server_sendf (server, "INVITE %s\r\n", arguments);
|
||||
if (argc == 2)
|
||||
server_sendf (server, "INVITE %s %s\r\n", argv[0], argv[1]);
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "invite");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "INVITE %s %s\r\n",
|
||||
argv[0], CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -385,37 +589,111 @@ irc_cmd_send_join (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *args, *pos;
|
||||
char *pos_channel, *pos_nick, *pos_comment;
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
server_sendf (server, "KICK %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
{
|
||||
args = strdup (arguments);
|
||||
pos = strchr (args, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
if (pos)
|
||||
server_sendf (server,
|
||||
"KICK %s %s :%s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name, args, pos + 1);
|
||||
else
|
||||
server_sendf (server,
|
||||
"KICK %s %s\r\n",
|
||||
CHANNEL(gui_current_window->buffer)->name, args);
|
||||
free (args);
|
||||
}
|
||||
else
|
||||
pos_channel = arguments;
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
}
|
||||
pos_nick[0] = '\0';
|
||||
pos_nick++;
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_nick = arguments;
|
||||
}
|
||||
|
||||
pos_comment = strchr (pos_nick, ' ');
|
||||
if (pos_comment)
|
||||
{
|
||||
pos_comment[0] = '\0';
|
||||
pos_comment++;
|
||||
while (pos_comment[0] == ' ')
|
||||
pos_comment++;
|
||||
}
|
||||
|
||||
if (pos_comment)
|
||||
server_sendf (server, "KICK %s %s :%s\r\n", pos_channel, pos_nick, pos_comment);
|
||||
else
|
||||
server_sendf (server, "KICK %s %s\r\n", pos_channel, pos_nick);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_kickban: forcibly remove a user from a channel and ban it
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_kickban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos_nick, *pos_comment;
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos_nick = strchr (arguments, ' ');
|
||||
if (!pos_nick)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong arguments for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
return -1;
|
||||
}
|
||||
pos_nick[0] = '\0';
|
||||
pos_nick++;
|
||||
while (pos_nick[0] == ' ')
|
||||
pos_nick++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kickban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_nick = arguments;
|
||||
}
|
||||
|
||||
pos_comment = strchr (pos_nick, ' ');
|
||||
if (pos_comment)
|
||||
{
|
||||
pos_comment[0] = '\0';
|
||||
pos_comment++;
|
||||
while (pos_comment[0] == ' ')
|
||||
pos_comment++;
|
||||
}
|
||||
|
||||
server_sendf (server, "MODE %s +b %s\r\n", pos_channel, pos_nick);
|
||||
if (pos_comment)
|
||||
server_sendf (server, "KICK %s %s :%s\r\n", pos_channel, pos_nick, pos_comment);
|
||||
else
|
||||
server_sendf (server, "KICK %s %s\r\n", pos_channel, pos_nick);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -520,9 +798,9 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
return -1;
|
||||
}
|
||||
irc_send_me (server, CHANNEL(gui_current_window->buffer), arguments);
|
||||
@@ -587,9 +865,9 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
return -1;
|
||||
}
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
@@ -598,16 +876,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
}
|
||||
@@ -623,16 +901,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s nick \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, server->nick, "msg");
|
||||
}
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -659,13 +937,13 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_SERVER);
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_NICK, "%s", arguments);
|
||||
gui_printf_color_type (server->buffer,
|
||||
gui_printf_type_color (server->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "-");
|
||||
gui_printf_color (server->buffer,
|
||||
@@ -682,26 +960,25 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -713,9 +990,9 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -735,9 +1012,9 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -787,9 +1064,9 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "notice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -814,9 +1091,9 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -862,9 +1139,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
@@ -876,9 +1153,9 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
@@ -960,10 +1237,9 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
if (!ptr_channel)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
@@ -984,17 +1260,17 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
gui_printf_type_color (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -1209,9 +1485,9 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
@@ -1243,6 +1519,80 @@ irc_cmd_send_trace (t_irc_server *server, char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_unban: unbans nicks or hosts
|
||||
*/
|
||||
|
||||
int
|
||||
irc_cmd_send_unban (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos_channel, *pos, *pos2;
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
pos_channel = NULL;
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
|
||||
if (string_is_channel (arguments))
|
||||
{
|
||||
pos_channel = arguments;
|
||||
pos++;
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos[0] = ' ';
|
||||
pos = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
pos = arguments;
|
||||
|
||||
/* channel not given, use default buffer */
|
||||
if (!pos_channel)
|
||||
{
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
return -1;
|
||||
}
|
||||
pos_channel = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
/* loop on users */
|
||||
while (pos && pos[0])
|
||||
{
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
}
|
||||
server_sendf (server, "MODE %s -b %s\r\n", pos_channel, pos);
|
||||
pos = pos2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "unban");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_cmd_send_userhost: return a list of information about nicknames
|
||||
*/
|
||||
@@ -1315,9 +1665,9 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
gui_printf_nolog (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+334
-148
@@ -27,12 +27,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
@@ -57,6 +59,7 @@ int check_away = 0;
|
||||
void
|
||||
server_init (t_irc_server *server)
|
||||
{
|
||||
/* user choices */
|
||||
server->name = NULL;
|
||||
server->autoconnect = 0;
|
||||
server->autoreconnect = 1;
|
||||
@@ -73,14 +76,18 @@ server_init (t_irc_server *server)
|
||||
server->command = NULL;
|
||||
server->command_delay = 1;
|
||||
server->autojoin = NULL;
|
||||
server->autorejoin = 0;
|
||||
|
||||
/* internal vars */
|
||||
server->child_pid = 0;
|
||||
server->child_read = -1;
|
||||
server->child_write = -1;
|
||||
server->sock = -1;
|
||||
server->is_connected = 0;
|
||||
server->unterminated_message = NULL;
|
||||
server->nick = NULL;
|
||||
server->is_connected = 0;
|
||||
server->reconnect_start = 0;
|
||||
server->reconnect_join = 0;
|
||||
server->sock4 = -1;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
@@ -264,6 +271,10 @@ server_free (t_irc_server *server)
|
||||
{
|
||||
t_irc_server *new_irc_servers;
|
||||
|
||||
/* close any opened channel/private */
|
||||
while (server->channels)
|
||||
channel_free (server, server->channels);
|
||||
|
||||
/* remove server from queue */
|
||||
if (last_irc_server == server)
|
||||
last_irc_server = server->prev_server;
|
||||
@@ -357,12 +368,12 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
*/
|
||||
|
||||
int
|
||||
server_send (t_irc_server * server, char *buffer, int size_buf)
|
||||
server_send (t_irc_server *server, char *buffer, int size_buf)
|
||||
{
|
||||
if (!server)
|
||||
return -1;
|
||||
|
||||
return send (server->sock4, buffer, size_buf, 0);
|
||||
return send (server->sock, buffer, size_buf, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -370,23 +381,23 @@ server_send (t_irc_server * server, char *buffer, int size_buf)
|
||||
*/
|
||||
|
||||
void
|
||||
server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
static char buffer[4096];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
|
||||
va_start (args, fmt);
|
||||
size_buf = vsnprintf (buffer, sizeof (buffer) - 1, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
if ((size_buf == 0) || (strcmp (buffer, "\r\n") == 0))
|
||||
return;
|
||||
|
||||
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
@@ -491,11 +502,11 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = strchr (buffer, '\0');
|
||||
if (pos)
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
server->unterminated_message =
|
||||
(char *) realloc (server->unterminated_message,
|
||||
strlen (server->unterminated_message) +
|
||||
strlen (buffer) + 1);
|
||||
if (!server->unterminated_message)
|
||||
{
|
||||
@@ -505,13 +516,21 @@ server_msgq_add_buffer (t_irc_server *server, char *buffer)
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
else
|
||||
strcpy (server->unterminated_message, buffer);
|
||||
return;
|
||||
strcat (server->unterminated_message, buffer);
|
||||
}
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,8 +546,7 @@ server_msgq_flush ()
|
||||
t_irc_message *next;
|
||||
char *entire_line, *ptr_data, *pos, *pos2;
|
||||
char *host, *command, *args;
|
||||
|
||||
/* TODO: optimize this function, parse only a few messages (for low CPU time!) */
|
||||
|
||||
while (recv_msgq)
|
||||
{
|
||||
if (recv_msgq->data)
|
||||
@@ -555,9 +573,9 @@ server_msgq_flush ()
|
||||
|
||||
if (ptr_data[0] == ':')
|
||||
{
|
||||
pos = strchr(ptr_data, ' ');
|
||||
pos = strchr (ptr_data, ' ');
|
||||
pos[0] = '\0';
|
||||
host = ptr_data+1;
|
||||
host = ptr_data + 1;
|
||||
pos++;
|
||||
}
|
||||
else
|
||||
@@ -567,15 +585,15 @@ server_msgq_flush ()
|
||||
{
|
||||
while (pos[0] == ' ')
|
||||
pos++;
|
||||
pos2 = strchr(pos, ' ');
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2 != NULL)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
command = strdup(pos);
|
||||
command = strdup (pos);
|
||||
pos2++;
|
||||
while (pos2[0] == ' ')
|
||||
pos2++;
|
||||
args = (pos2[0] == ':') ? pos2+1 : pos2;
|
||||
args = (pos2[0] == ':') ? pos2 + 1 : pos2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +614,7 @@ server_msgq_flush ()
|
||||
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("%s Unknown command: cmd=%s, args=%s\n"),
|
||||
WEECHAT_ERROR, command, args);
|
||||
WEECHAT_WARNING, command, args);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -626,7 +644,7 @@ server_recv (t_irc_server *server)
|
||||
static char buffer[4096 + 2];
|
||||
int num_read;
|
||||
|
||||
num_read = recv (server->sock4, buffer, sizeof (buffer) - 2, 0);
|
||||
num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0);
|
||||
if (num_read > 0)
|
||||
{
|
||||
buffer[num_read] = '\0';
|
||||
@@ -643,6 +661,174 @@ server_recv (t_irc_server *server)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_kill_child: kill child process and close pipe
|
||||
*/
|
||||
|
||||
void
|
||||
server_kill_child (t_irc_server *server)
|
||||
{
|
||||
/* kill process */
|
||||
if (server->child_pid > 0)
|
||||
{
|
||||
kill (server->child_pid, SIGKILL);
|
||||
waitpid (server->child_pid, NULL, 0);
|
||||
server->child_pid = 0;
|
||||
}
|
||||
|
||||
/* close pipe used with child */
|
||||
if (server->child_read != -1)
|
||||
{
|
||||
close (server->child_read);
|
||||
server->child_read = -1;
|
||||
}
|
||||
if (server->child_write != -1)
|
||||
{
|
||||
close (server->child_write);
|
||||
server->child_write = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_close_connection: close server connection (kill child, close socket/pipes)
|
||||
*/
|
||||
|
||||
void
|
||||
server_close_connection (t_irc_server *server)
|
||||
{
|
||||
server_kill_child (server);
|
||||
|
||||
/* close network socket */
|
||||
if (server->sock != -1)
|
||||
{
|
||||
close (server->sock);
|
||||
server->sock = -1;
|
||||
}
|
||||
|
||||
/* free any pending message */
|
||||
if (server->unterminated_message)
|
||||
{
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
}
|
||||
|
||||
/* server is now disconnected */
|
||||
server->is_connected = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_reconnect_schedule: schedule reconnect for a server
|
||||
*/
|
||||
|
||||
void
|
||||
server_reconnect_schedule (t_irc_server *server)
|
||||
{
|
||||
if (server->autoreconnect)
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_child_read: read connection progress from child process
|
||||
*/
|
||||
|
||||
void
|
||||
server_child_read (t_irc_server *server)
|
||||
{
|
||||
char buffer[1];
|
||||
int num_read;
|
||||
|
||||
num_read = read (server->child_read, buffer, sizeof (buffer));
|
||||
if (num_read != -1)
|
||||
{
|
||||
switch (buffer[0])
|
||||
{
|
||||
/* connection OK */
|
||||
case '0':
|
||||
server_kill_child (server);
|
||||
irc_login (server);
|
||||
break;
|
||||
/* adress not found */
|
||||
case '1':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
/* IP address not found */
|
||||
case '2':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
/* connection refused */
|
||||
case '3':
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s connection refused\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
server_reconnect_schedule (server);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_child: child process trying to connect to server
|
||||
*/
|
||||
|
||||
int
|
||||
server_child (t_irc_server *server)
|
||||
{
|
||||
struct hostent *ip4_hostent;
|
||||
struct sockaddr_in addr;
|
||||
char *ip_address;
|
||||
int error;
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
write (server->child_write, "1", 1);
|
||||
return 0;
|
||||
}
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
memcpy (&addr.sin_addr, ip4_hostent->h_addr, ip4_hostent->h_length);
|
||||
addr.sin_port = htons (server->port);
|
||||
addr.sin_family = AF_INET;
|
||||
|
||||
/* find IP address */
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
write (server->child_write, "2", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connect to server */
|
||||
error = connect (server->sock, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
write (server->child_write, "3", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connection OK */
|
||||
write (server->child_write, "0", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_connect: connect to an IRC server
|
||||
*/
|
||||
@@ -650,12 +836,8 @@ server_recv (t_irc_server *server)
|
||||
int
|
||||
server_connect (t_irc_server *server)
|
||||
{
|
||||
int set;
|
||||
struct hostent *ip4_hostent;
|
||||
struct sockaddr_in addr;
|
||||
char *ip_address;
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
int child_pipe[2], set;
|
||||
pid_t pid;
|
||||
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
@@ -663,100 +845,70 @@ server_connect (t_irc_server *server)
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||
server->address, server->port);
|
||||
server->is_connected = 0;
|
||||
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
|
||||
/* close any opened connection and kill child process if running */
|
||||
server_close_connection (server);
|
||||
|
||||
/* create pipe for child process */
|
||||
if (pipe (child_pipe) < 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
return 0;
|
||||
}
|
||||
server->server_read = server_pipe[0];
|
||||
server->server_write = server_pipe[1];
|
||||
|
||||
server->child_read = child_pipe[0];
|
||||
server->child_write = child_pipe[1];
|
||||
|
||||
/* create socket and set options */
|
||||
server->sock4 = socket (AF_INET, SOCK_STREAM, 0);
|
||||
server->sock = socket (AF_INET, SOCK_STREAM, 0);
|
||||
if (server->sock == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create socket\n"), WEECHAT_ERROR);
|
||||
server_close_connection (server);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set SO_REUSEADDR option for socket */
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
|
||||
/* set SO_KEEPALIVE option for socket */
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
if (setsockopt (server->sock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *) &set, sizeof (set)) == -1)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
WEECHAT_WARNING);
|
||||
}
|
||||
|
||||
/* bind to hostname */
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
|
||||
switch (pid = fork ())
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
}
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
memcpy (&addr.sin_addr, ip4_hostent->h_addr, ip4_hostent->h_length);
|
||||
addr.sin_port = htons (server->port);
|
||||
addr.sin_family = AF_INET;
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s can't bind to hostname\n"), WEECHAT_ERROR);
|
||||
return 0;
|
||||
}*/
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
return 0;
|
||||
/* fork failed */
|
||||
case -1:
|
||||
server_close_connection (server);
|
||||
return 0;
|
||||
/* child process */
|
||||
case 0:
|
||||
setuid (getuid ());
|
||||
server_child (server);
|
||||
_exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* parent process go on here */
|
||||
server->child_pid = pid;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -773,17 +925,9 @@ server_reconnect (t_irc_server *server)
|
||||
server->reconnect_start = 0;
|
||||
|
||||
if (server_connect (server))
|
||||
{
|
||||
server->reconnect_join = 1;
|
||||
irc_login (server);
|
||||
}
|
||||
else
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
server_reconnect_schedule (server);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -802,8 +946,8 @@ server_auto_connect (int command_line)
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
server_connect (ptr_server);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -829,24 +973,14 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
}
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
if (server->server_read >= 0)
|
||||
close (server->server_read);
|
||||
server->server_read = -1;
|
||||
server_close_connection (server);
|
||||
|
||||
if (server->server_write >= 0)
|
||||
close (server->server_write);
|
||||
server->server_write = -1;
|
||||
if (server->buffer)
|
||||
{
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
|
||||
if (server->sock4 >= 0)
|
||||
close (server->sock4);
|
||||
server->sock4 = -1;
|
||||
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
server->unterminated_message = NULL;
|
||||
|
||||
server->is_connected = 0;
|
||||
server->is_away = 0;
|
||||
server->away_time = 0;
|
||||
server->lag = 0;
|
||||
@@ -855,12 +989,7 @@ server_disconnect (t_irc_server *server, int reconnect)
|
||||
server->lag_next_check = time (NULL) + cfg_irc_lag_check;
|
||||
|
||||
if ((reconnect) && (server->autoreconnect))
|
||||
{
|
||||
server->reconnect_start = time (NULL);
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
|
||||
PACKAGE_NAME, server->autoreconnect_delay);
|
||||
}
|
||||
server_reconnect_schedule (server);
|
||||
else
|
||||
server->reconnect_start = 0;
|
||||
|
||||
@@ -947,10 +1076,13 @@ server_remove_away ()
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_remove_away (ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -967,10 +1099,13 @@ server_check_away ()
|
||||
|
||||
for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server)
|
||||
{
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
if (ptr_server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_check_away (ptr_server, ptr_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -986,7 +1121,58 @@ server_set_away (t_irc_server *server, char *nick, int is_away)
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
if (server->is_connected)
|
||||
{
|
||||
if (ptr_channel->type == CHAT_CHANNEL)
|
||||
channel_set_away (ptr_channel, nick, is_away);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_print_log: print server infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
void
|
||||
server_print_log (t_irc_server *server)
|
||||
{
|
||||
wee_log_printf ("[server %s (addr:0x%X)]\n", server->name, server);
|
||||
wee_log_printf (" autoconnect . . . . : %d\n", server->autoconnect);
|
||||
wee_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect);
|
||||
wee_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay);
|
||||
wee_log_printf (" command_line. . . . : %d\n", server->command_line);
|
||||
wee_log_printf (" address . . . . . . : '%s'\n", server->address);
|
||||
wee_log_printf (" port. . . . . . . . : %d\n", server->port);
|
||||
wee_log_printf (" password. . . . . . : '%s'\n",
|
||||
(server->password && server->password[0]) ? "(hidden)" : server->password);
|
||||
wee_log_printf (" nick1 . . . . . . . : '%s'\n", server->nick1);
|
||||
wee_log_printf (" nick2 . . . . . . . : '%s'\n", server->nick2);
|
||||
wee_log_printf (" nick3 . . . . . . . : '%s'\n", server->nick3);
|
||||
wee_log_printf (" username. . . . . . : '%s'\n", server->username);
|
||||
wee_log_printf (" realname. . . . . . : '%s'\n", server->realname);
|
||||
wee_log_printf (" command . . . . . . : '%s'\n",
|
||||
(server->command && server->command[0]) ? "(hidden)" : server->command);
|
||||
wee_log_printf (" command_delay . . . : %d\n", server->command_delay);
|
||||
wee_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
wee_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
wee_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
wee_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
wee_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
wee_log_printf (" sock. . . . . . . . : %d\n", server->sock);
|
||||
wee_log_printf (" is_connected. . . . : %d\n", server->is_connected);
|
||||
wee_log_printf (" unterminated_message: '%s'\n", server->unterminated_message);
|
||||
wee_log_printf (" nick. . . . . . . . : '%s'\n", server->nick);
|
||||
wee_log_printf (" reconnect_start . . : %ld\n", server->reconnect_start);
|
||||
wee_log_printf (" reconnect_join. . . : %d\n", server->reconnect_join);
|
||||
wee_log_printf (" is_away . . . . . . : %d\n", server->is_away);
|
||||
wee_log_printf (" away_time . . . . . : %ld\n", server->away_time);
|
||||
wee_log_printf (" lag . . . . . . . . : %d\n", server->lag);
|
||||
wee_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d\n",
|
||||
server->lag_check_time.tv_sec, server->lag_check_time.tv_usec);
|
||||
wee_log_printf (" lag_next_check. . . : %ld\n", server->lag_next_check);
|
||||
wee_log_printf (" buffer. . . . . . . : 0x%X\n", server->buffer);
|
||||
wee_log_printf (" channels. . . . . . : 0x%X\n", server->channels);
|
||||
wee_log_printf (" last_channel. . . . : 0x%X\n", server->last_channel);
|
||||
wee_log_printf (" prev_server . . . . : 0x%X\n", server->prev_server);
|
||||
wee_log_printf (" next_server . . . . : 0x%X\n", server->next_server);
|
||||
}
|
||||
|
||||
+52
-17
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
@@ -70,6 +71,14 @@
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
#define DCC_IS_CHAT(type) ((type == DCC_CHAT_RECV) || (type == DCC_CHAT_SEND))
|
||||
#define DCC_IS_FILE(type) ((type == DCC_FILE_RECV) || (type == DCC_FILE_SEND))
|
||||
#define DCC_IS_RECV(type) ((type == DCC_CHAT_RECV) || (type == DCC_FILE_RECV))
|
||||
#define DCC_IS_SEND(type) ((type == DCC_CHAT_SEND) || (type == DCC_FILE_SEND))
|
||||
|
||||
#define DCC_ENDED(status) ((status == DCC_DONE) || (status == DCC_FAILED) || \
|
||||
(status == DCC_ABORTED))
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -77,6 +86,8 @@ typedef struct t_irc_nick t_irc_nick;
|
||||
struct t_irc_nick
|
||||
{
|
||||
char *nick; /* nickname */
|
||||
int is_chanowner; /* chan owner? (specific to unrealircd) */
|
||||
int is_chanadmin; /* chan admin? (specific to unrealircd) */
|
||||
int is_op; /* operator privileges? */
|
||||
int is_halfop; /* half operaor privileges? */
|
||||
int has_voice; /* nick has voice? */
|
||||
@@ -97,11 +108,13 @@ typedef struct t_irc_channel t_irc_channel;
|
||||
struct t_irc_channel
|
||||
{
|
||||
int type; /* channel type */
|
||||
void *dcc_chat; /* DCC CHAT pointer (NULL if not DCC) */
|
||||
char *name; /* name of channel (exemple: "#abc") */
|
||||
char *topic; /* topic of channel (host for private) */
|
||||
char modes[NUM_CHANNEL_MODES+1];/* channel modes */
|
||||
int limit; /* user limit (0 is limit not set) */
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
int nicks_count; /* # nicks on channel (0 if dcc/pv) */
|
||||
int checking_away; /* = 1 if checking away with WHO cmd */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
@@ -136,14 +149,15 @@ struct t_irc_server
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
|
||||
/* internal vars */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
int child_read; /* to read into child pipe */
|
||||
int child_write; /* to write into child pipe */
|
||||
int sock; /* socket for server */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
char *nick; /* current nickname */
|
||||
int is_connected; /* 1 if WeeChat is connected to server */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
int reconnect_join; /* 1 if channels opened to rejoin */
|
||||
int sock4; /* socket for server */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
time_t away_time; /* time() when user marking as away */
|
||||
int lag; /* lag (in milliseconds) */
|
||||
@@ -189,32 +203,36 @@ struct t_irc_message
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_dcc t_dcc;
|
||||
typedef struct t_irc_dcc t_irc_dcc;
|
||||
|
||||
struct t_dcc
|
||||
struct t_irc_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
t_irc_channel *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 */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int sock; /* socket for connection */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
int file; /* local file (for reading or writing) */
|
||||
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 */
|
||||
t_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
unsigned long ack; /* number of bytes received OK */
|
||||
t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */
|
||||
t_irc_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern int check_away;
|
||||
extern t_dcc *dcc_list;
|
||||
extern t_irc_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
@@ -232,6 +250,7 @@ extern t_irc_server *server_new (char *, int, int, int, int, char *, int, char *
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
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);
|
||||
@@ -243,6 +262,7 @@ extern int server_name_already_exists (char *);
|
||||
extern void server_remove_away ();
|
||||
extern void server_check_away ();
|
||||
extern void server_set_away (t_irc_server *, char *, int);
|
||||
extern void server_print_log (t_irc_server *);
|
||||
|
||||
/* channel functions (irc-channel.c) */
|
||||
|
||||
@@ -254,10 +274,13 @@ extern int string_is_channel (char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
/* nick functions (irc-nick.c) */
|
||||
|
||||
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int);
|
||||
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 *);
|
||||
extern void nick_free (t_irc_channel *, t_irc_nick *);
|
||||
@@ -266,15 +289,18 @@ extern t_irc_nick *nick_search (t_irc_channel *, char *);
|
||||
extern void nick_count (t_irc_channel *, int *, int *, int *, int *, int *);
|
||||
extern int nick_get_max_length (t_irc_channel *);
|
||||
extern void nick_set_away (t_irc_channel *, t_irc_nick *, int);
|
||||
extern void nick_print_log (t_irc_nick *);
|
||||
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
extern void dcc_free (t_dcc *);
|
||||
extern void dcc_close (t_dcc *, int);
|
||||
extern void dcc_accept (t_dcc *);
|
||||
extern t_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, char *,
|
||||
unsigned int);
|
||||
extern void dcc_redraw (int);
|
||||
extern void dcc_free (t_irc_dcc *);
|
||||
extern void dcc_close (t_irc_dcc *, int);
|
||||
extern void dcc_accept (t_irc_dcc *);
|
||||
extern t_irc_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, int,
|
||||
char *, char *, unsigned long);
|
||||
extern void dcc_send_request (t_irc_server *, int, char *, char *);
|
||||
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
|
||||
extern void dcc_handle ();
|
||||
extern void dcc_end ();
|
||||
|
||||
@@ -293,16 +319,20 @@ extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_away (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ctcp (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dcc (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_dehalfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_deop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_devoice (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_die (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_halfop (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_info (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_invite (t_irc_server *, int, char **);
|
||||
extern int irc_cmd_send_ison (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_join (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kick (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kickban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_kill (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_links (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_list (t_irc_server *, char *);
|
||||
@@ -335,6 +365,7 @@ extern int irc_cmd_send_summon (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_time (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_topic (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_trace (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_unban (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_userhost (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_users (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_version (t_irc_server *, char *);
|
||||
@@ -345,6 +376,7 @@ 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_mode (t_irc_server *, char *, char *);
|
||||
@@ -387,6 +419,9 @@ 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 *);
|
||||
|
||||
#endif /* irc.h */
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
#undef _
|
||||
#include "../../common/weechat.h"
|
||||
#include "../plugins.h"
|
||||
#include "wee-perl.h"
|
||||
@@ -450,13 +451,13 @@ wee_perl_init ()
|
||||
" my $content = wee_perl_load_file ($filename);"
|
||||
" if ($content eq \"__WEECHAT_ERROR__\")"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " Perl script '$filename' not found.\\n\";"
|
||||
" IRC::print \"WeeChat Error: Perl script '$filename' not found.\\n\";"
|
||||
" return 1;"
|
||||
" }"
|
||||
" eval $content;"
|
||||
" if ($@)"
|
||||
" {"
|
||||
" IRC::print \"" WEECHAT_ERROR " unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"WeeChat error: unable to load Perl script '$filename':\\n\";"
|
||||
" IRC::print \"$@\\n\";"
|
||||
" return 2;"
|
||||
" }"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.1.0
|
||||
%define version 0.1.1
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Mar 20 2005 FlashCode <flashcode@flashtux.org> 0.1.1-1
|
||||
- Released version 0.1.1
|
||||
* Sat Feb 12 2005 FlashCode <flashcode@flashtux.org> 0.1.0-1
|
||||
- Released version 0.1.0
|
||||
* Sat Jan 01 2005 FlashCode <flashcode@flashtux.org> 0.0.9-1
|
||||
|
||||
Reference in New Issue
Block a user