1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

- added major feature: new color management system (internal to WeeChat), now

colors are displayed by WeeChat (optional by new settings irc_colors_receive
  and irc_colors_send)
- fixed IRC command 367
- added IRC command 382
This commit is contained in:
Sebastien Helleu
2005-11-04 11:53:23 +00:00
parent 5dfab7643d
commit 8a9e8ecc88
56 changed files with 14614 additions and 14596 deletions
+2 -3
View File
@@ -1,13 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2005-09-24
WeeChat known bugs, 2005-11-04
- color display problems when term has white background
- ./configure does not check that Ruby libraries are installed
- ./configure does not check that Gtk 2.0 libraries are installed
- when quitting WeeChat term title is not restored (if look_set_title is ON)
- command name for /server can not contain spaces
- when many WeeChat are launched, log file is not properly written (cleared by
each WeeChat at startup)
- display problems with old Konsole versions (Kde terminal) (???)
- WeeChat may crash if too much nicks in nicklist when position is top or bottom
+6 -2
View File
@@ -1,10 +1,13 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-10-30
ChangeLog - 2005-11-04
Version 0.1.6 (under dev!):
* new color management system, IRC colors are now correctly
displayed and can be removed by new options irc_colors_receive
and irc_colors_send
* added setting for having one server buffer for all servers
(look_one_server_buffer)
* added setting for ignoring some chars when completing nicks
@@ -18,7 +21,8 @@ Version 0.1.6 (under dev!):
library, and perl/python are plugin scripts
* log options (for server/channel/private) can now be set while
WeeChat is running
* added some missing IRC commands, channel modes +e and +f
* added channel modes +e and +f
* added some missing IRC commands, fixed command 367
* added colors for input buffer and current channel of status bar
* added online help for config options (with /set full_option_name)
* enhanced "smart" hotlist, with names (new options:
+9 -1
View File
@@ -1,4 +1,4 @@
.TH WEECHAT 1 "September 2005" "FlashCode"
.TH WEECHAT 1 "November 2005" "FlashCode"
.SH NAME
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
@@ -19,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.SH OPTIONS
.TP
.B \-a, \-\-no\-connect
.br
disable auto-connect to servers at startup
.TP
.B \-c, \-\-config
.br
display config file help (list of options)
@@ -43,6 +47,10 @@ display default keys
.br
display program license
.TP
.B \-p, \-\-no\-plugin
.br
don't load any plugin at startup
.TP
.B \-v, \-\-version
.br
display WeeChat version
+172 -451
View File
@@ -35,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 30 2005
@subtitle Documentation for WeeChat v0.1.6-cvs - November, 4 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -298,9 +298,6 @@ Type: integer (values: between 1 and 10), default value: 10@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@@ -453,7 +450,7 @@ Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Type: color (Curses or Gtk color), default value: 'white'@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@@ -604,6 +601,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Type: string (any string), default value: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@@ -1577,7 +1580,7 @@ them the plugin can't load):@*
@item functions for init and end of plugin:
@itemize @minus
@item weechat_plugin_init: function called when plugin is loaded,
must return PLUGIN_RC_OK (0) if successful, PLUGIN_RC_KO (-1) if error
must return PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error
@item weechat_plugin_end: function called when plugin is unloaded
@end itemize
@end itemize
@@ -1831,15 +1834,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1888,10 +1893,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2217,12 +2224,11 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to use script languages: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Load/unload Perl scripts
Perl scripts are loaded and unloaded with @command{/perl} command.
(type @kbd{/help perl} within WeeChat to get help about command).@*
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
@emph{Examples:}@*
@itemize @bullet
@@ -2232,23 +2238,32 @@ Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection WeeChat / Perl API
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( name, version, shutdown_function, description );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
This is first function to call in Perl script.@*
All Perl scripts for WeeChat should call this function.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: Perl function called when script is
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@@ -2257,13 +2272,20 @@ unloaded (optional parameter, empty string means nothing is called at the end)
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample script!");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( message, [channel, [server]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Print message in a channel.@*
@@ -2278,15 +2300,22 @@ Print message in a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( delay, message );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Print message in infobar.@*
@@ -2301,15 +2330,20 @@ Print message in infobar.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( name, function );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Attach a Perl function to an IRC message.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@@ -2318,14 +2352,14 @@ Function will be called each time IRC message will be received.@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{function}: Perl function called when message is received
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@@ -2337,31 +2371,48 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( name, function );}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
Create new WeeChat command, linked with Perl function.@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
Perl function. Be careful when overriding WeeChat commands, they'll not be
available until your Perl script will be unloaded.
@item @option{function}: Perl function linked with command
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2372,9 +2423,9 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@@ -2383,37 +2434,52 @@ arguments (displayed by /help command)
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2428,15 +2494,22 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@code{weechat.command ("/nick newnick", "", "freenode")}@*
@*
@item
@command{weechat::get_info ( name, [server, [channel] ] );}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Get various info about WeeChat, server or user.@*
@@ -2462,391 +2535,20 @@ Get various info about WeeChat, server or user.@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Load/unload Python scripts
Python scripts are loaded and unloaded with @command{/python} command.
(type @kbd{/help python} within WeeChat to get help about command).@*
@emph{Examples:}@*
@itemize @bullet
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection WeeChat / Python API
@itemize @bullet
@item
@command{weechat.register ( name, version, shutdown_function, description )}@*
@*
This is first function to call in Python script.@*
All Python scripts for WeeChat should call this function.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: Python function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!")}@*
@*
@item
@command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( delay, message )}@*
@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat.add_message_handler ( name, function )}@*
@*
Attach a Python function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{function}: Python function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( name, function )}@*
@*
Create new WeeChat command, linked with Python function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
Python function. Be careful when overriding WeeChat commands, they'll not be
available until your Python script will be unloaded.
@item @option{function}: Python function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@code{weechat.command ("/nick newnick", "", "freenode")}@*
@*
@item
@command{weechat.get_info ( name, [server] )}@*
@*
Get various info about WeeChat, server or user.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Examples:}@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2889,7 +2591,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2902,14 +2605,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2923,14 +2632,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2946,13 +2662,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2969,17 +2690,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
Not developed!
@c **************************** Authors / Support *****************************
+222 -499
View File
@@ -36,7 +36,7 @@
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 30 de octubre de 2005
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 4 de noviembre de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -298,9 +298,6 @@ Typo: entero (valores: entre 1 y 10), valor por defecto: 10@*
@item look_color_actions
Mostrar acciones con colores diferentes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_remove_colors_from_msgs
Quitar colores en los mensajes entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_nicklist
Mostrar ventana de usuarios (para las ventanas de canal)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@@ -453,7 +450,7 @@ Color para el texto de entrada (alias)@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'white'@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'cyan'@*
@item col_input_bg
Color de fondo para la ventana de entrada@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'default'@*
@@ -604,6 +601,12 @@ Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Typo: cadena (cualquier cadena), valor por defecto: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item dcc_auto_accept_files
Aceptar autom@'aticamente los ficheros dcc entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@@ -1834,15 +1837,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1891,10 +1896,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2214,151 +2221,195 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to load scripts: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Cargar/descargar programas Perl
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
Los programas Perl se cargan y descargan con el comando @command{/perl}
(escribiendo @kbd{/help perl} en WeeChat para obtener la ayuda acerca del comando).@*
@emph{Ejemplos:}@*
@emph{Examples:}@*
@itemize @bullet
@item
Cargar un programa Perl: @kbd{/perl load /tmp/ejemplo.pl}@*
@item Descargar todos los programas Perl: @kbd{/perl unload}@*
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
@item
Listar los programas Perl cargados: @kbd{/perl}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection Interfaz WeeChat / Perl
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( nombre, versi@'on, funci@'on_final, descripci@'on );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
Es la primera funci@'on a la que llamar en el programa Perl.@*
Todos los programas en Perl para WeeChat deben llamar esta funci@'on.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre @'unico para identificar el programa (cada programa debe
tener un nombre distinto)
@item @option{versi@'on}: versi@'on del programa
@item @option{funci@'on_final}: funci@'on Perl llamada cuando el programa finaliza
(par@'ametro facultativo, una cadena llena significa que no hay ninguna funci@'on que llamar)
@item @option{descripci@'on}: descripci@'on breve del programa
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( mensaje, [canal, [servidor]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Escribe un mensaje en un canal.@*
Print message in a channel.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{mensaje}: mensaje a escribir
@item @option{canal}: nombre del canal
@item @option{servidor}: (opcional) nombre interno del servidor
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplos:}@*
@emph{Perl examples:}@*
@*
@code{weechat::print ("mensaje");}@*
@code{weechat::print ("mensaje", "#weechat");}@*
@code{weechat::print ("mensaje", "#weechat", "freenode");}@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( retraso, mensaje );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Escribir un mensaje en la barra de informaciones.@*
Print message in infobar.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{plazo}: periodo en segundo durante el cual se mostrar@'a el mensaje
(si es 0, el mensaje no se borrar@'a).
@item @option{message}: mensaje que se escribir@'a en la barra de informaciones.
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::print_infobar (5, "mensaje");}@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( nombre, funci@'on );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Adjunta una funci@'on Perl a un mensaje IRC.@*
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre del mensaje IRC que producir@'a la llamada a la funci@'on.@*
Para saber qu@'e tipo de mensajes IRC existen puede leer las
RFC 1459 y/o 2812:@*
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{funci@'on}: funci@'on en Perl llamada cuando se reciba el mensaje.
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", mi_funcion);}@*
@code{sub mi_funcion}@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $mensaje) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($mascara, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masc=$mascara, canal=$canal, msj=$mensaje\n");}@*
@code{@ @ @ @ weechat::print ("server=$_[0]\n");}@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( nombre, funci@'on );}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Perl.@*
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre del nuevo comando@*
Puede ser un comando que ya existe, y en este caso el nuevo comando sustituir@'a
el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
al antiguo comando si el script Perl est@'a cargado.
@item @option{funcion}: funci@'on Perl assiciada al comando.
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2369,48 +2420,63 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("comando", mi_comando);}@*
@code{sub mi_comando}@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Servidor: $_[0], Par@'ametros: $_[1]\n");}@*
@code{@ @ @ @ weechat::print("Server: $_[0], arguments: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2425,384 +2491,13 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@item
@command{weechat::get_info ( nombre, [servidor, [canal] ] );}@*
@*
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
@itemize @minus
@item @option{version}: obtener la versi@'on de WeeChat
@item @option{nick}: obtener el seud@'onimo
@item @option{channel}: obtener el nombre del canal
@item @option{server}: obtener el nombre del servidor
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nombre interno del servidor
@item @option{canal}: nombre del canal
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Ejemplos:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Cargar/descargar programas Python
Los programas Python se cargan y descargan con el comando @command{/python}
(escribiendo @kbd{/help python} en WeeChat para obtener la ayuda acerca del comando).@*
@emph{Ejemplos:}@*
@itemize @bullet
@item
Cargar un programa Python: @kbd{/python load /tmp/ejemplo.py}@*
@item Descargar todos los programas Python: @kbd{/python unload}@*
@item
Listar los programas Python cargados: @kbd{/python}@*
@end itemize
@subsubsection Interfaz WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nombre, versi@'on, funci@'on_final, descripci@'on )}@*
@*
Es la primera funci@'on a la que llamar en el programa Python.@*
Todos los programas en Python para WeeChat deben llamar esta funci@'on.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre @'unico para identificar el programa (cada programa debe
tener un nombre distinto)
@item @option{versi@'on}: versi@'on del programa
@item @option{funci@'on_final}: funci@'on Python llamada cuando el programa finaliza
(par@'ametro facultativo, una cadena llena significa que no hay ninguna funci@'on que llamar)
@item @option{descripci@'on}: descripci@'on breve del programa
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...")}@*
@*
@item
@command{weechat.prnt ( mensaje, [canal, [servidor]] )}@*
@*
Escribe un mensaje en un canal.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{mensaje}: mensaje a escribir
@item @option{canal}: nombre del canal
@item @option{servidor}: (opcional) nombre interno del servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplos:}@*
@*
@code{weechat.prnt ("mensaje")}@*
@code{weechat.prnt ("mensaje", "#weechat")}@*
@code{weechat.prnt ("mensaje", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( retraso, mensaje )}@*
@*
Escribir un mensaje en la barra de informaciones.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{retraso}: periodo en segundo durante el cual se mostrar@'a el mensaje
(si es 0, el mensaje no se borrar@'a).
@item @option{mensaje}: mensaje que se escribir@'a en la barra de informaciones.
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.print_infobar (5, "mensaje")}@*
@*
@item
@command{weechat.add_message_handler ( nombre, funci@'on )}@*
@*
Adjunta una funci@'on Python a un mensaje IRC.@*
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre del mensaje IRC que producir@'a la llamada a la funci@'on.@*
Para saber qu@'e tipo de mensajes IRC existen puede leer las
RFC 1459 y/o 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{funci@'on}: funci@'on en Python llamada cuando se reciba el mensaje.
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.add_message_handler ("privmsg", mi_funcion)}@*
@code{def mi_funcion(servidor, args):}@*
@code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*
@code{@ @ @ @ null, canal, mensaje = string.split(args, ":", 2)}@*
@code{@ @ @ @ mascara, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("masc="+mascara+", canal="+canal+", msj="+mensaje)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( nombre, funci@'on )}@*
@*
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Python.@*
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre del nuevo comando@*
Puede ser un comando que ya existe, y en este caso el nuevo comando sustituir@'a
el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
al antiguo comando si el script Python est@'a cargado.
@item @option{funcion}: funci@'on Python assiciada al comando.
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.add_command_handler ("comando", mi_comando)}@*
@code{def mi_comando(servidor, args):}@*
@code{@ @ @ @ weechat.prnt("Servidor:"+servidor+" Par@'ametros:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@@ -2810,38 +2505,47 @@ Execute a command or send a message to a channel.@*
@*
@item
@command{weechat.get_info ( nombre, [servidor] )}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
Get various info about WeeChat, server or user.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: obtener la versi@'on de WeeChat
@item @option{nick}: obtener el seud@'onimo
@item @option{channel}: obtener el nombre del canal
@item @option{server}: obtener el nombre del servidor
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nombre interno del servidor
@item @option{server}: internal name of server
@item @option{channel}: channel name
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Ejemplos:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2884,7 +2588,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2897,14 +2602,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2918,14 +2629,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2941,13 +2659,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2964,17 +2687,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
@exclamdown{}No desarrollado!
@c **************************** Autores / Soporte *****************************
+182 -472
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.6-cvs - 30 octobre 2005
@subtitle Documentation pour WeeChat v0.1.6-cvs - 4 novembre 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -299,9 +299,6 @@ Type: entier (valeurs: entre 1 et 10), valeur par d@'efaut: 10@*
@item look_color_actions
Afficher les actions avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_remove_colors_from_msgs
Supprimer les couleurs dans les messages entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist
Afficher la fen@^etre des utilisateurs (pour les fen@^etres de canaux)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@@ -454,7 +451,7 @@ Couleur pour le texte saisi (pseudo)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_input_delimiters
Couleur pour le texte saisi (d@'elimiteurs)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_input_bg
Couleur de fond pour la fen@^etre de saisie@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@@ -605,6 +602,12 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item irc_highlight
Liste des mots pour la notification (s@'epar@'es par des virgules, le comparaison ne tient pas compte de la casse, les mots peuvent commencer ou se terminer par "*" pour une comparaison partielle)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item irc_colors_receive
Garder les couleurs dans les messages re@,{c}us@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item irc_colors_send
Autorise l'utilisateur @`a envoyer des couleurs avec des codes sp@'eciaux (%B=gras, %Cxx,yy=couleur, %U=soulign@'e, %R=invers@'e)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_accept_files
Accepte automatiquement les fichiers dcc entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@@ -1850,15 +1853,16 @@ void *handler_pointer)}@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
des valeurs suivantes (pr@'efix@'ee par ``weechat::'' pour Perl ou
``weechat.'' pour Python) :@*
@itemize @minus
@item @option{PLUGIN_RC_KO ou -1}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK ou 0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT ou 1}: le message ne sera pas transmis
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: le message ne sera pas transmis
@`a WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS ou 2}: le message ne sera pas transmis
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: le message ne sera pas transmis
@`a d'autres extensions
@item @option{PLUGIN_RC_OK_IGNORE_ALL ou 3}: le message ne sera transmis ni @`a
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: le message ne sera transmis ni @`a
WeeChat ni @`a d'autres extensions
@end itemize
@*
@@ -1911,10 +1915,11 @@ fichier: %s", (arguments) ? arguments : "aucun");}@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit
renvoyer une des valeurs suivantes :@*
renvoyer une des valeurs suivantes (pr@'efix@'ee par ``weechat::''
pour Perl ou ``weechat.'' pour Python) :@*
@itemize @minus
@item @option{PLUGIN_RC_KO ou -1}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK ou 0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@end itemize
@*
@@ -2249,37 +2254,47 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Trois extensions sont fournies en standard avec WeeChat pour utiliser
des langages de script: Perl, Python et Ruby.
@subsection Scripts Perl
@subsection Charger/d@'echarger des scripts
@subsubsection Charger/d@'echarger des scripts Perl
Les scripts Perl sont charg@'es et d@'echarg@'es avec la commande @command{/perl}
(tapez @kbd{/help perl} dans WeeChat pour obtenir de l'aide sur la commande).@*
Les scripts sont charg@'es et d@'echarg@'es avec les commandes
@command{/perl}, @command{/python} et @command{/ruby}.
(tapez @kbd{/help} dans WeeChat pour obtenir de l'aide sur les
commandes).@*
@emph{Exemples :}@*
@itemize @bullet
@item
Charger un script Perl : @kbd{/perl load /tmp/essai.pl}@*
@item D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
@item
D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
@item
Lister les scripts Perl charg@'es : @kbd{/perl}@*
@item
Charger un script Python : @kbd{/python load /tmp/essai.py}@*
@item
D@'echarger tous les scripts Python : @kbd{/python unload}@*
@item
Lister les scripts Python charg@'es : @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Perl
@subsection Interface WeeChat / Scripts
@itemize @bullet
@item
@command{weechat::register ( nom, version, fonction_de_fin, description );}@*
Perl: @command{weechat::register ( nom, version, fonction_de_fin,
description );}@*
Python: @command{weechat.register ( nom, version, fonction_de_fin,
description )}@*
@*
C'est la premi@`ere fonction @`a appeler dans le script Perl.@*
Tout script Perl pour WeeChat doit appeler cette fonction.@*
C'est la premi@`ere fonction @`a appeler dans le script.@*
Tout script pour WeeChat doit appeler cette fonction.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom unique pour identifier le script (chaque script doit
avoir un nom diff@'erent)
@item @option{version}: version du script
@item @option{fonction_de_fin}: fonction Perl appel@'ee quand le script est
@item @option{fonction_de_fin}: fonction appel@'ee quand le script est
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
de fonction @`a appeler)
@item @option{description}: description br@`eve du script.
@@ -2289,13 +2304,18 @@ de fonction @`a appeler)
@*
1 si le script a @'et@'e enregistr@'e, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::register ("essai", "1.0", "fin_essai", "Script d'essai !");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")}@*
@*
@item
@command{weechat::print ( message, [canal, [serveur]] );}@*
Perl: @command{weechat::print ( message, [canal, [serveur]] );}@*
Python: @command{weechat.prnt ( message, [canal, [serveur]] )}@*
@*
Affiche un message dans un canal.@*
@@ -2310,15 +2330,22 @@ Affiche un message dans un canal.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( d@'elai, message );}@*
Perl: @command{weechat::print_infobar ( d@'elai, message );}@*
Python: @command{weechat.print_infobar ( d@'elai, message )}@*
@*
Affiche un message dans la barre d'infos.@*
@@ -2333,16 +2360,22 @@ Affiche un message dans la barre d'infos.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( nom, fonction );}@*
Perl: @command{weechat::add_message_handler ( nom, fonction );}@*
Python: @command{weechat.add_message_handler ( nom, fonction )}@*
@*
Attache une fonction Perl @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
Attache une fonction @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera
re@,{c}u.@*
@emph{Param@`etres :}
@itemize @minus
@@ -2351,14 +2384,14 @@ Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
RFC 1459 et/ou 2812 :@*
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fonction}: fonction Perl appel@'ee lorsque le message est re@,{c}u
@item @option{fonction}: fonction appel@'ee lorsque le message est re@,{c}u
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Perl a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
1 si la fonction a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::add_message_handler ("privmsg", ma_fonction);}@*
@code{sub ma_fonction}@*
@@ -2367,391 +2400,10 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ ($null, $canal, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@ @ @ @ return weechat::PLUGIN_RC_OK;}@*
@code{@} }@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{1}: le message ne sera pas transmis @`a WeeChat
@item @option{2}: le message ne sera pas transmis @`a d'autres extensions
@item @option{3}: le message ne sera transmis ni @`a WeeChat ni @`a
d'autres extensions
@end itemize
@*
@item
@command{weechat::add_command_handler ( nom, fonction, [description,
arguments, arguments_description] );}@*
@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Perl.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de la nouvelle commande@*
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
la fonction Perl. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
ne seront plus accessibles tant que le script Perl sera charg@'e.
@item @option{fonction}: fonction Perl associ@'ee @`a la commande
@item @option{description}: description de la commande (affich@'ee par
/help commande)
@item @option{arguments}: br@`eve description des param@`etres de la
commande (affich@'ee par /help commande)
@item @option{arguments_description}: longue description des
param@`etres de la commande (affich@'ee par /help commande)
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Perl a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::add_command_handler ("commande", ma_commande);}@*
@code{sub ma_commande}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Serveur: $_[0], param@`etres: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit renvoyer une
des valeurs suivantes :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@end itemize
@*
@item
@command{weechat::remove_handler ( nom, fonction );}@*
@*
Supprime un gestionnaire de message ou de commande.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC ou de la commande
@item @option{fonction}: fonction Perl associ@'ee
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::remove_handler ("commande", ma_commande);}@*
@*
@item
@command{weechat::command ( commande, [canal, [serveur]] );}@*
@*
Ex@'ecute une commande ou envoie un message @'a un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a envoyer au canal)
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat::command ("bonjour tout le monde !");}@*
@code{weechat::command ("/kick toto merci de quitter ce canal", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@item
@command{weechat::get_info ( nom, [serveur, [canal] ] );}@*
@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou l'utilisateur.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'info @`a obtenir :
@itemize @minus
@item @option{version}: obtenir la version de WeeChat
@item @option{nick}: obtenir le pseudo
@item @option{channel}: obtenir le nom du canal
@item @option{server}: obtenir le nom du serveur
@item @option{away}: obtenir le drapeau ``away''
@item @option{weechat_dir}: obtenir le r@'epertoire maison de WeeChat
@item @option{weechat_libdir}: obtenir le r@'epertoire ``lib''
syst@`eme de WeeChat
@item @option{weechat_sharedir}: obtenir le r@'epertoire ``share''
syst@`eme de partage WeeChat
@end itemize
@item @option{serveur}: nom interne du serveur
@item @option{canal}: nom du canal
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
L'information demand@'e, blanc si une erreur s'est produite ou que
l'information n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Obtenir la liste des DCC.@*
Le tableau renvoy@'e contient les champs suivants :
@itemize @minus
@item server: le serveur IRC
@item channel: le canal IRC
@item type: le type de DCC :
@itemize @minus
@item 0: discussion (re@,cue)
@item 1: discussion (envoy@'ee)
@item 2: fichier en r@'eception
@item 3: fichier en @'emission
@end itemize
@item status: statut du DCC :
@itemize @minus
@item 0: en attente
@item 1: en cours de connexion
@item 2: actif
@item 3: termin@'e
@item 4: @'echou@'e
@item 5: interrompu par l'utilisateur
@end itemize
@item start_time: la date et heure de cr@'eation du DCC
@item start_transfer: la date et heure de d@'emarrage du transfert
@item addr: adresse de l'utilisateur distant
@item port: port utilis@'e pour le DCC
@item nick: pseudo de l'utilisateur distant
@item filename: nom de fichier
@item local_filename: nom de fichier local
@item size: taille du fichier
@item pos: position actuelle dans le fichier
@item start_resume: position de d@'emarrage apr@`es une interruption
@item bytes_per_sec: nombre d'octets transmis par seconde depuis le d@'ebut
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La liste des DCC, 0 si une erreur s'est produite.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Obtenir la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, valeur );}@*
@*
Modifier une otion de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin, "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Renvoie la valeur d'une option de l'extension.@*
L'option est lue depuis le fichier ~/.weechat/plugins.rc et est
sous cette forme :@*
@code{extension.script.option=valeur}@*
NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemple :}@*
@*
@code{$value = weechat::get_plugin_config ("ma_variable");}@*
@*
@item
@command{weechat::set_plugin_config ( option, valeur );}@*
@*
Modifie la valeur d'une option de l'extension.@*
L'option est @'ecrite dans le fichier ~/.weechat/plugins.rc et est
sous cette forme :@*
@code{extension.script.option=valeur}@*
NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::set_plugin_config ("ma_variable", "valeur");}@*
@*
@end itemize
@subsection Scripts Python
@subsubsection Charger/d@'echarger des scripts Python
Les scripts Python sont charg@'es et d@'echarg@'es avec la commande @command{/python}
(tapez @kbd{/help python} dans WeeChat pour obtenir de l'aide sur la commande).@*
@emph{Exemples :}@*
@itemize @bullet
@item
Charger un script Python : @kbd{/python load /tmp/essai.py}@*
@item D@'echarger tous les scripts Python : @kbd{/python unload}@*
@item
Lister les scripts Python charg@'es : @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nom, version, fonction_de_fin, description )}@*
@*
C'est la premi@`ere fonction @`a appeler dans le script Python.@*
Tout script Python pour WeeChat doit appeler cette fonction.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom unique pour identifier le script (chaque script doit
avoir un nom diff@'erent)
@item @option{version}: version du script
@item @option{fonction_de_fin}: fonction Python appel@'ee quand le script est
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
de fonction @`a appeler)
@item @option{description}: description br@`eve du script.
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si le script a @'et@'e enregistr@'e, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")}@*
@*
@item
@command{weechat.prnt ( message, [canal, [serveur]] )}@*
@*
Affiche un message dans un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{message}: message @`a afficher
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( d@'elai, message )}@*
@*
Affiche un message dans la barre d'infos.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{d@'elai}: d@'elai (en secondes) pendant lequel le message est affich@'e
(si 0, le message ne sera pas effac@'e).
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat.add_message_handler ( nom, fonction )}@*
@*
Attache une fonction Python @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC pour lequel la fonction est appel@'ee@*
Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
RFC 1459 et/ou 2812 :@*
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fonction}: fonction Python appel@'ee lorsque le message est re@,{c}u
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Python a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Python :}@*
@*
@code{weechat.add_message_handler ("privmsg", ma_fonction)}@*
@code{def ma_fonction(serveur, args):}@*
@@ -2759,35 +2411,43 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ null, canal, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ masque, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("masque="+masque+", canal="+canal+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@code{@ @ @ @ return weechat.PLUGIN_RC_OK}@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
des valeurs suivantes (pr@'efix@'ee par ``weechat::'' pour Perl ou
``weechat.'' pour Python) :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{1}: le message ne sera pas transmis @`a WeeChat
@item @option{2}: le message ne sera pas transmis @`a d'autres extensions
@item @option{3}: le message ne sera transmis ni @`a WeeChat ni @`a
d'autres extensions
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: le message ne sera pas
transmis @`a WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: le message ne sera pas
transmis @`a d'autres extensions
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: le message ne sera transmis ni
@`a WeeChat ni @`a d'autres extensions
@end itemize
@*
@item
@command{weechat.add_command_handler ( nom, fonction )}@*
Perl: @command{weechat::add_command_handler ( nom, fonction,
[description, arguments, arguments_description] );}@*
Python: @command{weechat.add_command_handler ( nom, fonction,
[description, arguments, arguments_description] )}@*
@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Python.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande
par @kbd{/nom}.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de la nouvelle commande@*
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
la fonction Python. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
ne seront plus accessibles tant que le script Python sera charg@'e.
@item @option{fonction}: fonction Python associ@'ee @`a la commande
Il peut s'agir d'une commande existante, auquel cas celle-ci est
@'ecras@'ee par la fonction du script. Soyez prudent en @'ecrasant les
commandes WeeChat, car elles ne seront plus accessibles tant que le
script sera charg@'e.
@item @option{fonction}: fonction associ@'ee @`a la commande
@item @option{description}: description de la commande (affich@'ee par
/help commande)
@item @option{arguments}: br@`eve description des param@`etres de la
@@ -2798,53 +2458,70 @@ param@`etres de la commande (affich@'ee par /help commande)
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Python a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
1 si la fonction a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::add_command_handler ("commande", ma_commande);}@*
@code{sub ma_commande}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Serveur: $_[0], param@`etres: $_[1]\n");}@*
@code{@ @ @ @ return weechat::PLUGIN_RC_OK;}@*
@code{@} }@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.add_command_handler ("commande", ma_commande)}@*
@code{def ma_commande(serveur, args):}@*
@code{@ @ @ @ weechat.prnt("serveur:"+serveur+" param@`etres:"+args)}@*
@code{@ @ @ @ return 0}@*
@code{@ @ @ @ return weechat.PLUGIN_RC_OK}@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit renvoyer une
des valeurs suivantes :@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit
renvoyer une des valeurs suivantes (pr@'efix@'ee par ``weechat::''
pour Perl ou ``weechat.'' pour Python) :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@end itemize
@*
@item
@command{weechat.remove_handler ( nom, fonction );}@*
Perl: @command{weechat::remove_handler ( nom, fonction );}@*
Python: @command{weechat.remove_handler ( nom, fonction )}@*
@*
Supprime un gestionnaire de message ou de commande.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC ou de la commande
@item @option{fonction}: fonction Python associ@'ee
@item @option{fonction}: fonction associ@'ee
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat.remove_handler ("commande", ma_commande);}@*
@code{weechat::remove_handler ("commande", ma_commande);}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.remove_handler ("commande", ma_commande)}@*
@*
@item
@command{weechat.command ( commande, [canal, [serveur]] )}@*
Perl: @command{weechat::command ( commande, [canal, [serveur]] );}@*
Python: @command{weechat.command ( commande, [canal, [serveur]] )}@*
@*
Ex@'ecute une commande ou envoie un message @'a un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a envoyer au canal)
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a
envoyer au canal)
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@@ -2853,7 +2530,13 @@ Ex@'ecute une commande ou envoie un message @'a un canal.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat::command ("bonjour tout le monde !");}@*
@code{weechat::command ("/kick toto merci de quitter ce canal", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.command ("bonjour tout le monde !")}@*
@code{weechat.command ("/kick toto merci de quitter ce canal", "#weechat")}@*
@@ -2861,9 +2544,11 @@ Ex@'ecute une commande ou envoie un message @'a un canal.@*
@*
@item
@command{weechat.get_info ( nom, [serveur] )}@*
Perl: @command{weechat::get_info ( nom, [serveur, [canal] ] );}@*
Python: @command{weechat.get_info ( nom, [serveur, [canal] ] )}@*
@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou l'utilisateur.@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou
l'utilisateur.@*
@emph{Param@`etres :}
@itemize @minus
@@ -2881,6 +2566,7 @@ syst@`eme de WeeChat
syst@`eme de partage WeeChat
@end itemize
@item @option{serveur}: nom interne du serveur
@item @option{canal}: nom du canal
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@@ -2888,14 +2574,20 @@ syst@`eme de partage WeeChat
L'information demand@'e, blanc si une erreur s'est produite ou que
l'information n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{$version = weechat.get_info ("version")}@*
@code{$nick = weechat.get_info ("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( )}@*
@*
Obtenir la liste des DCC.@*
@@ -2938,13 +2630,14 @@ La liste des DCC, 0 si une erreur s'est produite.@*
@*
@item
@command{weechat.get_config ( nom );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Obtenir la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'option
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@@ -2952,20 +2645,26 @@ Obtenir la valeur d'une option de configuration WeeChat.@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( nom, valeur );}@*
Perl: @command{weechat::set_config ( option, valeur );}@*
Python: @command{weechat.set_config ( option, valeur )}@*
@*
Modifier une otion de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'option
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@@ -2973,14 +2672,20 @@ Modifier une otion de configuration WeeChat.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin, "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin, "#weechat");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin, "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Renvoie la valeur d'une option de l'extension.@*
L'option est lue depuis le fichier ~/.weechat/plugins.rc et est
@@ -2998,13 +2703,18 @@ NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{$value = weechat.get_plugin_config ("ma_variable");}@*
@code{$value = weechat::get_plugin_config ("ma_variable");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{$value = weechat.get_plugin_config ("ma_variable")}@*
@*
@item
@command{weechat.set_plugin_config ( option, valeur );}@*
Perl: @command{weechat::set_plugin_config ( option, valeur );}@*
Python: @command{weechat.set_plugin_config ( option, valeur )}@*
@*
Modifie la valeur d'une option de l'extension.@*
L'option est @'ecrite dans le fichier ~/.weechat/plugins.rc et est
@@ -3022,17 +2732,17 @@ NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat.set_plugin_config ("ma_variable", "valeur");}@*
@code{weechat::set_plugin_config ("ma_variable", "valeur");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.set_plugin_config ("ma_variable", "valeur")}@*
@*
@end itemize
@subsection Scripts Ruby
Non d@'evelopp@'e !
@c **************************** Auteurs / Support *****************************
+220 -487
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 30 de outubro de 2005
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 4 de novembro de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -296,9 +296,6 @@ Type: integer (values: between 1 and 10), default value: 10@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@@ -451,7 +448,7 @@ Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Type: color (Curses or Gtk color), default value: 'white'@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@@ -602,6 +599,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Type: string (any string), default value: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@@ -1829,15 +1832,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1886,10 +1891,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2209,204 +2216,74 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to load scripts: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Carregar/Descarregar Scripts Perl
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
Os Scripts Perl s@~ao carregados e descarregados com o comando @command{/perl}.
(escreve @kbd{/help perl} dentro do WeeChat para obteres ajuda acerca do comando).@*
@emph{Exemplos:}@*
@emph{Examples:}@*
@itemize @bullet
@item
Carregar um Script Perl: @kbd{/perl load /tmp/sample.pl}@*
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
@item
Descarregar todos os Scripts Perl: @kbd{/perl unload}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
Listar todos os Scripts Perl: @kbd{/perl}@*
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Perl
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Perl.@*
Todos os Scripts Perl para o Weechat devem invocar esta fun@,{c}@~ao.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome @'unico que indentifique o script (cada Script Perl deve ter um @'unico nome)
@item @option{vers@~ao}: vers@~ao do script
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Perl invocada quando o script é descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample script!");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( mensagem, [canal, [servidor]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{mensagem}: mensagem a mostrar
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplos:}@*
@*
@code{weechat::print ("mensagem");}@*
@code{weechat::print ("mensagem", "#weechat");}@*
@code{weechat::print ("mensagem", "#weechat", "freenode");}@*
@*
@item
@command{weechat::print_infobar ( atrasa, mensagem );}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::print_infobar (5, "mensagem");}@*
@*
@item
@command{weechat::add_message_handler ( nome, fun@,{c}@~ao );}@*
@*
Anexa uma fun@,{c}@~ao Perl a uma mensagem de IRC.@*
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome da mensagem IRC@*
Para conheceres uma lista de mensagens de IRC, por favor lê o RFC 1459 e/ou o 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl invocada quando a mensagem é recebida
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( nome, fun@,{c}@~ao );}@*
@*
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Perl.@*
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome do novo comando@*
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Perl. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Perl.
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl ligada ao comando
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Argumentos: ".@@_[0]);}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@@ -2415,315 +2292,119 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::get_info ( nome, [servidor, [canal] ] );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome do info a recuperar:
@itemize @minus
@item @option{version}: comece a vers@~ao de WeeChat
@item @option{nick}: comece o nickname
@item @option{channel}: comece o nome da canal
@item @option{server}: comece o nome do servidor
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nome interno da servidor
@item @option{canal}: nome da canal
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Exemplos:}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl example:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Carregar/Descarregar Scripts Python
Os Scripts Python s@~ao carregados e descarregados com o comando @command{/python}.
(escreve @kbd{/help python} dentro do WeeChat para obteres ajuda acerca do comando).@*
@emph{Exemplos:}@*
@itemize @bullet
@item
Carregar um Script Python: @kbd{/python load /tmp/sample.py}@*
@item
Descarregar todos os Scripts Python: @kbd{/python unload}@*
@item
Listar todos os Scripts Python: @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
@*
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Python.@*
Todos os Scripts Python para o Weechat devem invocar esta fun@,{c}@~ao.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome @'unico que indentifique o script (cada Script Python deve ter um @'unico nome)
@item @option{vers@~ao}: vers@~ao do script
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Python invocada quando o script é descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!")}@*
@*
@item
@command{weechat.prnt ( mensagem, [canal, [servidor]] )}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{mensagem}: mensagem a mostrar
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplos:}@*
@*
@code{weechat.prnt ("mensagem")}@*
@code{weechat.prnt ("mensagem", "#weechat")}@*
@code{weechat.prnt ("mensagem", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( atrasa, mensagem )}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat.print_infobar (5, "mensagem")}@*
@*
@item
@command{weechat.add_message_handler ( nome, fun@,{c}@~ao )}@*
@*
Anexa uma fun@,{c}@~ao Python a uma mensagem de IRC.@*
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome da mensagem IRC@*
Para conheceres uma lista de mensagens de IRC, por favor lê o RFC 1459 e/ou o 2812:@*
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python invocada quando a mensagem é recebida
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print ("server=$_[0]\n");}@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", chan="+channel+", msg="+message)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( nome, fun@,{c}@~ao )}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Python.@*
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome do novo comando@*
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Python. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Python.
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python ligada ao comando
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2734,45 +2415,63 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Server: $_[0], arguments: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("Servidor:"+server+" Argumentos:"+args)}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2787,7 +2486,13 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@@ -2795,38 +2500,47 @@ Execute a command or send a message to a channel.@*
@*
@item
@command{weechat.get_info ( nome, [servidor] )}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
Get various info about WeeChat, server or user.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome do info a recuperar:
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: comece a vers@~ao de WeeChat
@item @option{nick}: comece o nickname
@item @option{channel}: comece o nome da canal
@item @option{server}: comece o nome do servidor
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nome interno da servidor
@item @option{server}: internal name of server
@item @option{channel}: channel name
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Exemplos:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2869,7 +2583,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2882,14 +2597,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2903,14 +2624,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2926,13 +2654,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2949,17 +2682,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
N@~AO DESENVOLVIDO!
@c **************************** Autores/Suporte *****************************
+945 -787
View File
File diff suppressed because it is too large Load Diff
+935 -789
View File
File diff suppressed because it is too large Load Diff
+969 -808
View File
File diff suppressed because it is too large Load Diff
+796 -764
View File
File diff suppressed because it is too large Load Diff
+223 -147
View File
@@ -303,7 +303,7 @@ alias_new (char *alias_name, char *alias_command)
if (!weelist_search (index_commands, alias_command))
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s target command \"%s\" does not exist!\n"),
gui_printf (NULL, _("%s target command \"/%s\" does not exist!\n"),
WEECHAT_ERROR, alias_command);
return NULL;
}
@@ -689,7 +689,7 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
{
t_irc_nick *ptr_nick;
int plugin_args_length;
char *plugin_args;
char *command_with_colors, *command_with_colors2, *plugin_args;
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
return;
@@ -709,28 +709,37 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
if (server && (!BUFFER_IS_SERVER(buffer)))
{
command_with_colors = (cfg_irc_colors_send) ?
(char *)gui_color_encode ((unsigned char *)command) : NULL;
if (CHANNEL(buffer)->dcc_chat)
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
"%s\r\n", command);
"%s\r\n",
(command_with_colors) ? command_with_colors : command);
else
server_sendf (server, "PRIVMSG %s :%s\r\n",
CHANNEL(buffer)->name, command);
CHANNEL(buffer)->name,
(command_with_colors) ?
command_with_colors : command);
command_with_colors2 = (command_with_colors) ?
(char *)gui_color_decode ((unsigned char *)command_with_colors, 1) : NULL;
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
{
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", command);
gui_printf_type (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (CHANNEL(buffer)->buffer,
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(command_with_colors2) ?
command_with_colors2 : command);
}
else
{
@@ -739,8 +748,10 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
{
irc_display_nick (CHANNEL(buffer)->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color (CHANNEL(buffer)->buffer,
COLOR_WIN_CHAT, "%s\n", command);
gui_printf (CHANNEL(buffer)->buffer,
"%s\n",
(command_with_colors2) ?
command_with_colors2 : command);
}
else
{
@@ -751,6 +762,11 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
}
}
if (command_with_colors)
free (command_with_colors);
if (command_with_colors2)
free (command_with_colors2);
/* sending a copy of the message as PRIVMSG to plugins because irc server doesn't */
plugin_args_length = strlen ("localhost PRIVMSG :") +
strlen (CHANNEL(buffer)->name) + strlen(command) + 16;
@@ -810,6 +826,13 @@ weechat_cmd_alias (char *arguments)
WEECHAT_ERROR, "alias");
return -1;
}
if (arguments[0] == '/')
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s alias can not start with \"/\"\n"),
WEECHAT_ERROR, "alias");
return -1;
}
if (!alias_new (arguments, pos))
return -1;
if (weelist_add (&index_commands, &last_index_command, arguments))
@@ -845,8 +868,10 @@ weechat_cmd_alias (char *arguments)
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
gui_printf (NULL, " %s => %s\n",
gui_printf (NULL, " %s %s=>%s %s\n",
ptr_alias->alias_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_alias->alias_command + 1);
}
}
@@ -867,38 +892,32 @@ void
weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
{
if (buffer->dcc)
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n");
gui_printf (NULL, "%sDCC\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
else if (BUFFER_IS_SERVER (buffer))
{
gui_printf (NULL, _("Server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s\n", SERVER(buffer)->name);
}
gui_printf (NULL, _("%sServer: %s%s\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name);
else if (BUFFER_IS_CHANNEL (buffer))
{
gui_printf (NULL, _("Channel: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", CHANNEL(buffer)->name);
gui_printf (NULL, _(" (server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", SERVER(buffer)->name);
gui_printf (NULL, ")\n");
}
gui_printf (NULL, _("%sChannel: %s%s %s(server: %s%s%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
CHANNEL(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT));
else if (BUFFER_IS_PRIVATE (buffer))
{
gui_printf (NULL, _("Private with: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK,
"%s", CHANNEL(buffer)->name);
gui_printf (NULL, _(" (server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", SERVER(buffer)->name);
gui_printf (NULL, ")\n");
}
gui_printf (NULL, _("%sPrivate with: %s%s %s(server: %s%s%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
CHANNEL(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name);
else
{
gui_printf (NULL, _("not connected"));
gui_printf (NULL, "\n");
}
gui_printf (NULL, _("not connected\n"));
}
/*
@@ -924,10 +943,11 @@ weechat_cmd_buffer (int argc, char **argv)
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", ptr_buffer->number);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
gui_printf (NULL, "%s[%s%d%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_buffer->number,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_buffer_display_info (ptr_buffer);
}
}
@@ -1314,9 +1334,10 @@ weechat_cmd_help (int argc, char **argv)
gui_printf (NULL, _("%s internal commands:\n"), PACKAGE_NAME);
for (i = 0; weechat_commands[i].command_name; i++)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
weechat_commands[i].command_name);
gui_printf (NULL, " - %s\n",
gui_printf (NULL, " %s%s %s- %s\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
weechat_commands[i].command_name,
GUI_COLOR(COLOR_WIN_CHAT),
_(weechat_commands[i].command_description));
}
gui_printf (NULL, "\n");
@@ -1325,9 +1346,10 @@ weechat_cmd_help (int argc, char **argv)
{
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
irc_commands[i].command_name);
gui_printf (NULL, " - %s\n",
gui_printf (NULL, " %s%s %s- %s\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
irc_commands[i].command_name,
GUI_COLOR(COLOR_WIN_CHAT),
_(irc_commands[i].command_description));
}
}
@@ -1342,11 +1364,13 @@ weechat_cmd_help (int argc, char **argv)
{
if (ptr_handler->type == HANDLER_COMMAND)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
ptr_handler->command);
gui_printf (NULL, " %s%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_handler->command);
if (ptr_handler->description
&& ptr_handler->description[0])
gui_printf (NULL, " - %s",
gui_printf (NULL, " %s- %s",
GUI_COLOR(COLOR_WIN_CHAT),
ptr_handler->description);
gui_printf (NULL, "\n");
}
@@ -1361,11 +1385,13 @@ weechat_cmd_help (int argc, char **argv)
{
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, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
weechat_commands[i].command_name);
if (weechat_commands[i].arguments &&
weechat_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_(weechat_commands[i].arguments));
else
gui_printf (NULL, "\n");
@@ -1387,11 +1413,13 @@ weechat_cmd_help (int argc, char **argv)
{
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, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
irc_commands[i].command_name);
if (irc_commands[i].arguments &&
irc_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_(irc_commands[i].arguments));
else
gui_printf (NULL, "\n");
@@ -1418,11 +1446,13 @@ weechat_cmd_help (int argc, char **argv)
{
gui_printf (NULL, "\n");
gui_printf (NULL, "[p]");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
ptr_handler->command);
gui_printf (NULL, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_handler->command);
if (ptr_handler->arguments &&
ptr_handler->arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
ptr_handler->arguments);
else
gui_printf (NULL, "\n");
@@ -1456,17 +1486,27 @@ void
weechat_cmd_ignore_display (char *text, t_irc_ignore *ptr_ignore)
{
if (text)
gui_printf (NULL, "%s ", text);
gui_printf (NULL, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT),
text);
gui_printf (NULL, _("on"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", ptr_ignore->server_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "/");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->channel_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
gui_printf (NULL, _(" ignoring "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->type);
gui_printf (NULL, _(" from "));
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s\n", ptr_ignore->mask);
gui_printf (NULL, "%s%s %s%s%s/%s%s%s:%s%s%s%s%s%s%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_("on"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->server_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->channel_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
_(" ignoring "),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->type,
GUI_COLOR(COLOR_WIN_CHAT),
_(" from "),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_ignore->mask);
}
/*
@@ -1493,9 +1533,11 @@ weechat_cmd_ignore (int argc, char **argv)
ptr_ignore = ptr_ignore->next_ignore)
{
i++;
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", i);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
gui_printf (NULL, "%s[%s%d%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
i,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_ignore_display (NULL, ptr_ignore);
}
}
@@ -1547,13 +1589,15 @@ weechat_cmd_key_display (t_gui_key *key, int new_key)
expanded_name = gui_key_get_expanded_name (key->key);
if (new_key)
{
gui_printf (NULL, _("New key binding:\n"));
gui_printf (NULL, " %s", (expanded_name) ? expanded_name : key->key);
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("New key binding: %s"),
(expanded_name) ? expanded_name : key->key);
}
else
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " => ");
gui_printf (NULL, "%s\n",
gui_printf (NULL, "%s => %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
(key->function) ?
gui_key_function_search_by_ptr (key->function) : key->command);
if (expanded_name)
@@ -1592,7 +1636,10 @@ weechat_cmd_key (char *arguments)
while (arguments[0] == ' ')
arguments++;
if (gui_key_unbind (arguments))
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Key \"%s\" unbinded\n"), arguments);
}
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
@@ -1624,6 +1671,7 @@ weechat_cmd_key (char *arguments)
{
gui_key_free_all ();
gui_key_init ();
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Default key bindings restored\n"));
}
else
@@ -1692,8 +1740,10 @@ weechat_cmd_plugin (int argc, char **argv)
{
/* plugin info */
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
gui_printf (NULL, " %s v%s - %s (%s)\n",
gui_printf (NULL, " %s%s%s v%s - %s (%s)\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_plugin->name,
GUI_COLOR(COLOR_WIN_CHAT),
ptr_plugin->version,
ptr_plugin->description,
ptr_plugin->filename);
@@ -1904,13 +1954,14 @@ weechat_cmd_server (int argc, char **argv)
}
}
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
" %s ", server_found->name);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("has been deleted\n"));
server_free (server_found);
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Server %s%s%s has been deleted\n"),
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
server_found->name,
GUI_COLOR(COLOR_WIN_CHAT));
gui_redraw_buffer (gui_current_window->buffer);
return 0;
@@ -2051,10 +2102,10 @@ weechat_cmd_server (int argc, char **argv)
if (new_server)
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
" %s ", server.name);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("created\n"));
gui_printf (NULL, _("Server %s%s%s created\n"),
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
server.name,
GUI_COLOR(COLOR_WIN_CHAT));
}
else
{
@@ -2086,11 +2137,11 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
{
char *color_name, *pos_nickserv, *pos_pwd, *value2;
gui_printf (NULL, " %s%s%s",
gui_printf (NULL, " %s%s%s%s = ",
(prefix) ? prefix : "",
(prefix) ? "." : "",
option->option_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " = ");
option->option_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
@@ -2101,21 +2152,25 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", (*((int *)value)) ? "ON" : "OFF");
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
(*((int *)value)) ? "ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%d\n", *((int *)value));
gui_printf (NULL, "%s%d\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
*((int *)value));
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", option->array_values[*((int *)value)]);
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
option->array_values[*((int *)value)]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", (color_name) ? color_name : _("(unknown)"));
color_name = gui_get_color_name (*((int *)value));
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
if (*((char **)value))
@@ -2138,9 +2193,12 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
pos_pwd[0] = '*';
pos_pwd++;
}
gui_printf (NULL, _("(password hidden) "));
gui_printf (NULL, _("%s(password hidden) "),
GUI_COLOR(COLOR_WIN_CHAT));
}
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s", value2);
gui_printf (NULL, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
value2);
free (value2);
}
gui_printf (NULL, "\n");
@@ -2210,12 +2268,14 @@ weechat_cmd_set (char *arguments)
switch (config_set_server_value (ptr_server, pos + 1, value))
{
case 0:
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",
ptr_server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s %s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[CONFIG_SECTION_SERVER].section_name,
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
ptr_server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
if (strcmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, pos + 1) == 0)
@@ -2262,10 +2322,12 @@ weechat_cmd_set (char *arguments)
if (config_option_set_value (ptr_option, value) == 0)
{
(void) (ptr_option->handler_change());
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");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_get_section (ptr_option),
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_set_display_option (ptr_option, NULL, NULL);
}
else
@@ -2304,11 +2366,12 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s",
config_sections[i].section_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[i].section_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
section_displayed = 1;
}
weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);
@@ -2334,12 +2397,14 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
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",
ptr_server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s %s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[CONFIG_SECTION_SERVER].section_name,
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
ptr_server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
section_displayed = 1;
}
ptr_option_value = config_get_server_option_ptr (ptr_server,
@@ -2369,7 +2434,9 @@ weechat_cmd_set (char *arguments)
if ((number_found == 1) && (last_section >= 0) && (last_option >= 0))
{
gui_printf (NULL, "\n");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, _("Detail:\n"));
gui_printf (NULL, _("%sDetail:\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
gui_printf (NULL, GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
switch (weechat_options[last_section][last_option].option_type)
{
case OPTION_TYPE_BOOLEAN:
@@ -2419,7 +2486,11 @@ weechat_cmd_set (char *arguments)
}
else
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
gui_printf (NULL, "\n");
gui_printf (NULL, "%s%d %s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
number_found,
GUI_COLOR(COLOR_WIN_CHAT));
if (option)
gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
option);
@@ -2506,7 +2577,10 @@ weechat_cmd_unignore (int argc, char **argv)
if (ret)
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", ret);
gui_printf (NULL, "%s%d%s ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ret,
GUI_COLOR(COLOR_WIN_CHAT));
if (ret > 1)
gui_printf (NULL, _("ignore were removed.\n"));
else
@@ -2545,17 +2619,19 @@ weechat_cmd_window (int argc, char **argv)
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", i);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] (");
gui_printf (NULL, "%d", ptr_win->win_x);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
gui_printf (NULL, "%d", ptr_win->win_y);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ";");
gui_printf (NULL, "%d", ptr_win->win_width);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "x");
gui_printf (NULL, "%d", ptr_win->win_height);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ") ");
gui_printf (NULL, "%s[%s%d%s] (%s%d:%d%s;%s%dx%d%s) ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
i,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_win->win_x,
ptr_win->win_y,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_win->win_width,
ptr_win->win_height,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_buffer_display_info (ptr_win->buffer);
+1 -1
View File
@@ -425,7 +425,7 @@ completion_build_list (t_completion *completion, void *channel)
weelist_add (&completion->completion_list,
&completion->last_completion,
(option_value) ?
gui_get_color_by_value (*((int *)(option_value))) :
gui_get_color_name (*((int *)(option_value))) :
option->default_string);
break;
case OPTION_TYPE_STRING:
-22
View File
@@ -72,28 +72,6 @@ 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
*/
+38 -19
View File
@@ -169,6 +169,7 @@ void
wee_log_printf (char *message, ...)
{
static char buffer[4096];
char *ptr_buffer;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
@@ -180,6 +181,17 @@ wee_log_printf (char *message, ...)
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
/* keep only valid chars */
ptr_buffer = buffer;
while (ptr_buffer[0])
{
if ((ptr_buffer[0] != '\n')
&& (ptr_buffer[0] != '\r')
&& ((unsigned char)(ptr_buffer[0]) < 32))
ptr_buffer[0] = '.';
ptr_buffer++;
}
seconds = time (NULL);
date_tmp = localtime (&seconds);
if (date_tmp)
@@ -667,35 +679,42 @@ weechat_welcome_message ()
{
if (cfg_look_startup_logo)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
" ___ __ ______________ _____ \n"
" __ | / /___________ ____/__ /_______ __ /_\n"
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
gui_printf (NULL,
"%s ___ __ ______________ _____ \n"
"%s __ | / /___________ ____/__ /_______ __ /_\n"
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK));
}
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
{
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
(cfg_look_startup_logo) ? " " : "");
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
gui_printf_color (NULL, COLOR_WIN_CHAT,
", %s\n", cfg_look_weechat_slogan);
gui_printf (NULL, _("%sWelcome to %s%s%s, %s\n"),
(cfg_look_startup_logo) ? " " : "",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
PACKAGE_NAME,
GUI_NO_COLOR,
cfg_look_weechat_slogan);
}
if (cfg_look_startup_version)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
"%s" PACKAGE_STRING,
(cfg_look_startup_logo) ? " " : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
", %s %s %s\n",
_("compiled on"), __DATE__, __TIME__);
gui_printf (NULL, "%s%s%s%s, %s %s %s\n",
(cfg_look_startup_logo) ? " " : "",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
PACKAGE_STRING,
GUI_NO_COLOR,
_("compiled on"), __DATE__, __TIME__);
}
if (cfg_look_startup_logo ||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
cfg_look_startup_version)
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
gui_printf (NULL,
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK));
wee_log_printf ("%s (%s %s %s)\n",
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
+14 -8
View File
@@ -77,7 +77,6 @@ char *cfg_look_buffer_timestamp;
int cfg_look_color_nicks;
int cfg_look_color_nicks_number;
int cfg_look_color_actions;
int cfg_look_remove_colors_from_msgs;
int cfg_look_nicklist;
int cfg_look_nicklist_position;
char *cfg_look_nicklist_position_values[] =
@@ -154,10 +153,6 @@ t_config_option weechat_options_look[] =
N_("display actions with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop },
{ "look_remove_colors_from_msgs", N_("remove colors from incoming messages"),
N_("remove colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop },
{ "look_nicklist", N_("display nicklist window"),
N_("display nicklist window (for channel windows)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
@@ -435,7 +430,7 @@ t_config_option weechat_options_colors[] =
{ "col_input_delimiters", N_("color for input text (delimiters)"),
N_("color for input text (delimiters)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_input_delimiters, NULL, &config_change_color },
"cyan", NULL, &cfg_col_input_delimiters, NULL, &config_change_color },
{ "col_input_bg", N_("background for input window"),
N_("background for input window"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -637,6 +632,8 @@ int cfg_irc_lag_min_show;
int cfg_irc_lag_disconnect;
int cfg_irc_fifo_pipe;
char *cfg_irc_highlight;
int cfg_irc_colors_receive;
int cfg_irc_colors_send;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message to all channels when away"),
@@ -684,6 +681,15 @@ t_config_option weechat_options_irc[] =
"words may begin or end with \"*\" for partial match)"),
OPTION_TYPE_STRING, 0, 0, 0,
"", NULL, NULL, &cfg_irc_highlight, &config_change_noop },
{ "irc_colors_receive", N_("keep colors from incoming messages"),
N_("keep colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_receive, NULL, config_change_noop },
{ "irc_colors_send", N_("allow user to send colors"),
N_("allow user to send colors with special codes (%B=bold, %Cxx,yy=color, "
"%U=underline, %R=reverse)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -1043,7 +1049,7 @@ config_change_color ()
{
t_gui_window *ptr_win;
gui_init_colors ();
gui_rebuild_weechat_colors ();
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
gui_redraw_buffer (ptr_win->buffer);
}
@@ -2072,7 +2078,7 @@ config_write (char *config_name)
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
gui_get_color_by_value (*weechat_options[i][j].ptr_int) :
gui_get_color_name (*weechat_options[i][j].ptr_int) :
weechat_options[i][j].default_string);
break;
case OPTION_TYPE_STRING:
+2 -1
View File
@@ -92,7 +92,6 @@ extern char *cfg_look_buffer_timestamp;
extern int cfg_look_color_nicks;
extern int cfg_look_color_nicks_number;
extern int cfg_look_color_actions;
extern int cfg_look_remove_colors_from_msgs;
extern int cfg_look_nicklist;
extern int cfg_look_nicklist_position;
extern int cfg_look_nicklist_min_size;
@@ -189,6 +188,8 @@ extern int cfg_irc_lag_min_show;
extern int cfg_irc_lag_disconnect;
extern int cfg_irc_fifo_pipe;
extern char *cfg_irc_highlight;
extern int cfg_irc_colors_receive;
extern int cfg_irc_colors_send;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;
+1160 -882
View File
File diff suppressed because it is too large Load Diff
+340 -107
View File
@@ -31,6 +31,7 @@
#include <string.h>
#include <signal.h>
#include <time.h>
#include <ctype.h>
#include "../common/weechat.h"
#include "gui.h"
@@ -302,19 +303,12 @@ gui_buffer_clear (t_gui_buffer *buffer)
{
t_gui_window *ptr_win;
t_gui_line *ptr_line;
t_gui_message *ptr_message;
while (buffer->lines)
{
ptr_line = buffer->lines->next_line;
while (buffer->lines->messages)
{
ptr_message = buffer->lines->messages->next_message;
if (buffer->lines->messages->message)
free (buffer->lines->messages->message);
free (buffer->lines->messages);
buffer->lines->messages = ptr_message;
}
if (buffer->lines->data)
free (buffer->lines->data);
free (buffer->lines);
buffer->lines = ptr_line;
}
@@ -351,47 +345,6 @@ gui_buffer_clear_all ()
gui_buffer_clear (ptr_buffer);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos, *buf2;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
buf2 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buffer);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buf2);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("Not enough memory for infobar message\n"));
free (buf2);
}
/*
* gui_window_free: delete a window
*/
@@ -415,25 +368,6 @@ gui_window_free (t_gui_window *window)
free (window);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
}
}
/*
* gui_line_free: delete a line from a buffer
*/
@@ -442,8 +376,7 @@ void
gui_line_free (t_gui_line *line)
{
t_gui_window *ptr_win;
t_gui_message *ptr_message;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->start_line == line)
@@ -452,14 +385,8 @@ gui_line_free (t_gui_line *line)
ptr_win->start_line_pos = 0;
}
}
while (line->messages)
{
ptr_message = line->messages->next_message;
if (line->messages->message)
free (line->messages->message);
free (line->messages);
line->messages = ptr_message;
}
if (line->data)
free (line->data);
free (line);
}
@@ -566,8 +493,7 @@ gui_new_line (t_gui_buffer *buffer)
new_line->log_write = 1;
new_line->line_with_message = 0;
new_line->line_with_highlight = 0;
new_line->messages = NULL;
new_line->last_message = NULL;
new_line->data = NULL;
if (!buffer->lines)
buffer->lines = new_line;
else
@@ -602,30 +528,345 @@ gui_new_line (t_gui_buffer *buffer)
}
/*
* gui_new_message: create a new message for last line of a buffer
* gui_word_strlen: returns length of a word
* special chars like color, bold, .. are ignored
*/
t_gui_message *
gui_new_message (t_gui_buffer *buffer)
int
gui_word_strlen (t_gui_window *window, char *string)
{
t_gui_message *new_message;
int length;
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
length = 0;
while (string && string[0])
{
if (!buffer->last_line->messages)
buffer->last_line->messages = new_message;
else
buffer->last_line->last_message->next_message = new_message;
new_message->prev_message = buffer->last_line->last_message;
new_message->next_message = NULL;
buffer->last_line->last_message = new_message;
string = gui_word_get_next_char (window, (unsigned char *)string, 0);
if (string)
length++;
}
return length;
}
/*
* gui_word_real_pos: get real position in string (ignoring color/bold/.. chars)
*/
int
gui_word_real_pos (t_gui_window *window, char *string, int pos)
{
char *saved_pos;
int real_pos;
if (pos <= 0)
return 0;
real_pos = 0;
while (string && string[0] && (pos > 0))
{
saved_pos = string;
string = gui_word_get_next_char (window, (unsigned char *)string, 0);
pos--;
if (string)
real_pos += (string - saved_pos);
}
return real_pos;
}
/*
* gui_add_to_line: add a message to last line of buffer
*/
void
gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
{
char *pos;
int length;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (buffer->line_complete)
{
buffer->line_complete = 0;
if (!gui_new_line (buffer))
return;
}
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
buffer->line_complete = 1;
}
if (buffer->last_line->data)
{
buffer->last_line->data = (char *) realloc (buffer->last_line->data,
strlen (buffer->last_line->data) +
strlen (message) + 1);
strcat (buffer->last_line->data, message);
}
else
buffer->last_line->data = strdup (message);
length = gui_word_strlen (NULL, message);
buffer->last_line->length += length;
if (type & MSG_TYPE_MSG)
buffer->last_line->line_with_message = 1;
if (type & MSG_TYPE_HIGHLIGHT)
buffer->last_line->line_with_highlight = 1;
if ((type & MSG_TYPE_TIME) || (type & MSG_TYPE_NICK) || (type & MSG_TYPE_PREFIX))
buffer->last_line->length_align += length;
if (type & MSG_TYPE_NOLOG)
buffer->last_line->log_write = 0;
if (pos)
{
wee_log_printf (_("Not enough memory for new message\n"));
return NULL;
pos[0] = '\n';
if (buffer->num_displayed > 0)
gui_draw_buffer_chat (buffer, 0);
if (gui_add_hotlist && (buffer->num_displayed == 0))
{
if (3 - buffer->last_line->line_with_message -
buffer->last_line->line_with_highlight <=
buffer->notify_level)
{
if (buffer->last_line->line_with_highlight)
hotlist_add (HOTLIST_HIGHLIGHT, buffer);
else if (BUFFER_IS_PRIVATE(buffer) && (buffer->last_line->line_with_message))
hotlist_add (HOTLIST_PRIVATE, buffer);
else if (buffer->last_line->line_with_message)
hotlist_add (HOTLIST_MSG, buffer);
else
hotlist_add (HOTLIST_LOW, buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
}
if (buffer->line_complete && buffer->log_file && buffer->last_line->log_write)
{
log_write (buffer, buffer->last_line->data);
log_write (buffer, "\n");
}
}
/*
* gui_printf_internal: display a message in a buffer
* This function should NEVER be called directly.
* You should use macros defined in gui.h
*/
void
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *message, ...)
{
static char buf[8192];
char text_time[1024];
char text_time_char[2];
time_t time_seconds;
struct tm *local_time;
int time_first_digit, time_last_digit;
char *pos, *buf2;
int i;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
if (gui_init_ok)
{
if (buffer == NULL)
{
type |= MSG_TYPE_NOLOG;
if (SERVER(gui_current_window->buffer))
buffer = SERVER(gui_current_window->buffer)->buffer;
else
buffer = gui_current_window->buffer;
if (!buffer || buffer->dcc)
buffer = gui_buffers;
}
if (buffer == NULL)
{
wee_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
"please send to developers - thanks\n");
return;
}
if (buffer->dcc)
buffer = gui_buffers;
if (buffer->dcc)
return;
}
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
if (!buf[0])
return;
if (!local_utf8 || !utf8_is_valid (buf))
buf2 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buf);
else
buf2 = strdup (buf);
if (gui_init_ok)
{
seconds = time (NULL);
date_tmp = localtime (&seconds);
pos = buf2 - 1;
while (pos)
{
if (display_time
&& cfg_look_buffer_timestamp && cfg_look_buffer_timestamp[0]
&& ((!buffer->last_line) || (buffer->line_complete)))
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
time_first_digit = -1;
time_last_digit = -1;
i = 0;
while (text_time[i])
{
if (isdigit (text_time[i]))
{
if (time_first_digit == -1)
time_first_digit = i;
time_last_digit = i;
}
i++;
}
text_time_char[1] = '\0';
i = 0;
while (text_time[i])
{
text_time_char[0] = text_time[i];
if (time_first_digit < 0)
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if ((i < time_first_digit) || (i > time_last_digit))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if (isdigit (text_time[i]))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
}
}
i++;
}
gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
gui_add_to_line (buffer, MSG_TYPE_TIME, " ");
}
gui_add_to_line (buffer, type, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
}
else
printf ("%s", buf2);
free (buf2);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos, *buf2, *buf3;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
buf2 = (char *)gui_color_decode ((unsigned char *)buffer, 0);
if (buf2)
{
if (!local_utf8 || !utf8_is_valid (buf2))
buf3 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buf2);
else
buf3 = strdup (buf2);
}
else
buf3 = NULL;
if (buf3)
{
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buf3);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("Not enough memory for infobar message\n"));
}
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
}
return new_message;
}
/*
@@ -1219,9 +1460,7 @@ 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);
@@ -1266,16 +1505,10 @@ gui_buffer_print_log (t_gui_buffer *buffer)
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);
wee_log_printf (" line N-%05d: %s\n",
num,
(ptr_line->data) ? ptr_line->data : "(empty)");
ptr_line = ptr_line->next_line;
}
+147 -94
View File
@@ -26,57 +26,114 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 57
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
#define COLOR_WIN_CHAT_TIME_SEP 4
#define COLOR_WIN_CHAT_PREFIX1 5
#define COLOR_WIN_CHAT_PREFIX2 6
#define COLOR_WIN_CHAT_SERVER 7
#define COLOR_WIN_CHAT_JOIN 8
#define COLOR_WIN_CHAT_PART 9
#define COLOR_WIN_CHAT_NICK 10
#define COLOR_WIN_CHAT_HOST 11
#define COLOR_WIN_CHAT_CHANNEL 12
#define COLOR_WIN_CHAT_DARK 13
#define COLOR_WIN_CHAT_HIGHLIGHT 14
#define COLOR_WIN_STATUS 15
#define COLOR_WIN_STATUS_DELIMITERS 16
#define COLOR_WIN_STATUS_CHANNEL 17
#define COLOR_WIN_STATUS_DATA_MSG 18
#define COLOR_WIN_STATUS_DATA_PRIVATE 19
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 20
#define COLOR_WIN_STATUS_DATA_OTHER 21
#define COLOR_WIN_STATUS_MORE 22
#define COLOR_WIN_INFOBAR 23
#define COLOR_WIN_INFOBAR_DELIMITERS 24
#define COLOR_WIN_INFOBAR_HIGHLIGHT 25
#define COLOR_WIN_INPUT 26
#define COLOR_WIN_INPUT_CHANNEL 27
#define COLOR_WIN_INPUT_NICK 28
#define COLOR_WIN_INPUT_DELIMITERS 29
#define COLOR_WIN_NICK 30
#define COLOR_WIN_NICK_AWAY 31
#define COLOR_WIN_NICK_CHANOWNER 32
#define COLOR_WIN_NICK_CHANADMIN 33
#define COLOR_WIN_NICK_OP 34
#define COLOR_WIN_NICK_HALFOP 35
#define COLOR_WIN_NICK_VOICE 36
#define COLOR_WIN_NICK_MORE 37
#define COLOR_WIN_NICK_SEP 38
#define COLOR_WIN_NICK_SELF 39
#define COLOR_WIN_NICK_PRIVATE 40
#define COLOR_WIN_NICK_FIRST 41
#define COLOR_WIN_NICK_LAST 50
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define COLOR_DCC_SELECTED 51
#define COLOR_DCC_WAITING 52
#define COLOR_DCC_CONNECTING 53
#define COLOR_DCC_ACTIVE 54
#define COLOR_DCC_DONE 55
#define COLOR_DCC_FAILED 56
#define COLOR_DCC_ABORTED 57
/* shift ncurses colors for compatibility with colors
in IRC messages (same as other IRC clients) */
#define WEECHAT_COLOR_BLACK COLOR_BLACK
#define WEECHAT_COLOR_RED COLOR_BLUE
#define WEECHAT_COLOR_GREEN COLOR_GREEN
#define WEECHAT_COLOR_YELLOW COLOR_CYAN
#define WEECHAT_COLOR_BLUE COLOR_RED
#define WEECHAT_COLOR_MAGENTA COLOR_MAGENTA
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
#define WEECHAT_COLOR_WHITE COLOR_WHITE
#define COLOR_WIN_NICK_NUMBER 10
typedef enum t_weechat_color t_weechat_color;
enum t_weechat_color
{
COLOR_WIN_TITLE = 0,
COLOR_WIN_CHAT,
COLOR_WIN_CHAT_TIME,
COLOR_WIN_CHAT_TIME_SEP,
COLOR_WIN_CHAT_PREFIX1,
COLOR_WIN_CHAT_PREFIX2,
COLOR_WIN_CHAT_SERVER,
COLOR_WIN_CHAT_JOIN,
COLOR_WIN_CHAT_PART,
COLOR_WIN_CHAT_NICK,
COLOR_WIN_CHAT_HOST,
COLOR_WIN_CHAT_CHANNEL,
COLOR_WIN_CHAT_DARK,
COLOR_WIN_CHAT_HIGHLIGHT,
COLOR_WIN_STATUS,
COLOR_WIN_STATUS_DELIMITERS,
COLOR_WIN_STATUS_CHANNEL,
COLOR_WIN_STATUS_DATA_MSG,
COLOR_WIN_STATUS_DATA_PRIVATE,
COLOR_WIN_STATUS_DATA_HIGHLIGHT,
COLOR_WIN_STATUS_DATA_OTHER,
COLOR_WIN_STATUS_MORE,
COLOR_WIN_INFOBAR,
COLOR_WIN_INFOBAR_DELIMITERS,
COLOR_WIN_INFOBAR_HIGHLIGHT,
COLOR_WIN_INPUT,
COLOR_WIN_INPUT_CHANNEL,
COLOR_WIN_INPUT_NICK,
COLOR_WIN_INPUT_DELIMITERS,
COLOR_WIN_NICK,
COLOR_WIN_NICK_AWAY,
COLOR_WIN_NICK_CHANOWNER,
COLOR_WIN_NICK_CHANADMIN,
COLOR_WIN_NICK_OP,
COLOR_WIN_NICK_HALFOP,
COLOR_WIN_NICK_VOICE,
COLOR_WIN_NICK_MORE,
COLOR_WIN_NICK_SEP,
COLOR_WIN_NICK_SELF,
COLOR_WIN_NICK_PRIVATE,
COLOR_WIN_NICK_1,
COLOR_WIN_NICK_2,
COLOR_WIN_NICK_3,
COLOR_WIN_NICK_4,
COLOR_WIN_NICK_5,
COLOR_WIN_NICK_6,
COLOR_WIN_NICK_7,
COLOR_WIN_NICK_8,
COLOR_WIN_NICK_9,
COLOR_WIN_NICK_10,
COLOR_DCC_SELECTED,
COLOR_DCC_WAITING,
COLOR_DCC_CONNECTING,
COLOR_DCC_ACTIVE,
COLOR_DCC_DONE,
COLOR_DCC_FAILED,
COLOR_DCC_ABORTED,
NUM_COLORS
};
/* attributes in IRC messages for color & style (bold, ..) */
#define GUI_ATTR_BOLD_CHAR '\x02'
#define GUI_ATTR_BOLD_STR "\x02"
#define GUI_ATTR_COLOR_CHAR '\x03'
#define GUI_ATTR_COLOR_STR "\x03"
#define GUI_ATTR_RESET_CHAR '\x0F'
#define GUI_ATTR_RESET_STR "\x0F"
#define GUI_ATTR_FIXED_CHAR '\x11'
#define GUI_ATTR_FIXED_STR "\x11"
#define GUI_ATTR_REVERSE_CHAR '\x12'
#define GUI_ATTR_REVERSE_STR "\x12"
#define GUI_ATTR_REVERSE2_CHAR '\x16'
#define GUI_ATTR_REVERSE2_STR "\x16"
#define GUI_ATTR_ITALIC_CHAR '\x1D'
#define GUI_ATTR_ITALIC_STR "\x1D"
#define GUI_ATTR_UNDERLINE_CHAR '\x1F'
#define GUI_ATTR_UNDERLINE_STR "\x1F"
/* WeeChat internal attributes (should never be in IRC messages) */
#define GUI_ATTR_WEECHAT_COLOR_CHAR '\x19'
#define GUI_ATTR_WEECHAT_COLOR_STR "\x19"
#define GUI_ATTR_WEECHAT_SET_CHAR '\x1A'
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
@@ -85,6 +142,8 @@
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
#define BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
#define MSG_TYPE_TIME 1
#define MSG_TYPE_PREFIX 2
#define MSG_TYPE_NICK 4
@@ -94,22 +153,16 @@
#define MSG_TYPE_NOLOG 64
#define gui_printf(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, -1, fmt, ##argz)
#define gui_printf_color(buffer, color, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, color, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
gui_printf_internal(buffer, 1, type, -1, fmt, ##argz)
#define gui_printf_type_color(buffer, type, color, fmt, argz...) \
gui_printf_internal(buffer, 1, type, color, fmt, ##argz)
gui_printf_internal(buffer, 1, type, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, -1, fmt, ##argz)
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, fmt, ##argz)
#define NOTIFY_LEVEL_MIN 0
#define NOTIFY_LEVEL_MAX 3
@@ -118,38 +171,14 @@
#define KEY_SHOW_MODE_DISPLAY 1
#define KEY_SHOW_MODE_BIND 2
typedef struct t_gui_message t_gui_message;
struct t_gui_message
{
int type; /* type of message (time, nick, other) */
int color; /* color of message */
char *message; /* message content */
t_gui_message *prev_message; /* link to previous message for line */
t_gui_message *next_message; /* link to next message for line */
};
typedef struct t_gui_line t_gui_line;
struct t_gui_line
{
int length; /* length of the line (in char) */
int length_align; /* alignment length (time or time/nick) */
int log_write; /* = 1 if line will be written to log */
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
t_gui_message *messages; /* messages for the line */
t_gui_message *last_message; /* last message of the line */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};
typedef struct t_gui_color t_gui_color;
struct t_gui_color
{
char *name;
int color;
int foreground; /* foreground color */
int background; /* background color */
int attributes; /* attributes (bold, ..) */
char *string; /* WeeChat color: "\x19??", ?? is #color*/
};
typedef struct t_gui_infobar t_gui_infobar;
@@ -164,6 +193,20 @@ struct t_gui_infobar
t_gui_infobar *next_infobar; /* next message for infobar */
};
typedef struct t_gui_line t_gui_line;
struct t_gui_line
{
int length; /* length of the line (in char) */
int length_align; /* alignment length (time or time/nick) */
int log_write; /* = 1 if line will be written to log */
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
char *data; /* line content */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};
typedef struct t_gui_buffer t_gui_buffer;
struct t_gui_buffer
@@ -260,6 +303,11 @@ struct t_gui_window
/* windows for Qt GUI */
/* TODO: declare Qt window */
int current_style_fg;; /* current color used for foreground */
int current_style_bg;; /* current color used for background */
int current_style_attr; /* current attributes (bold, ..) */
int current_color_attr; /* attr sum of last color(s) displayed */
/* DCC */
void *dcc_first; /* first dcc displayed */
void *dcc_selected; /* selected dcc */
@@ -316,6 +364,8 @@ extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
extern t_gui_color *gui_color[NUM_COLORS];
/* GUI independent functions: windows & buffers */
extern t_gui_window *gui_window_new (int, int, int, int);
@@ -327,7 +377,9 @@ extern void gui_window_free (t_gui_window *);
extern void gui_infobar_remove ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_new_line (t_gui_buffer *);
extern t_gui_message *gui_new_message (t_gui_buffer *);
extern int gui_word_strlen (t_gui_window *, char *);
extern int gui_word_real_pos (t_gui_window *, char *, int);
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
extern void gui_exec_action_dcc (t_gui_window *, char *);
extern int gui_insert_string_input (t_gui_window *, char *, int);
@@ -403,11 +455,13 @@ extern void gui_key_free_all ();
/* GUI dependant functions: display */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern char *gui_get_color_name (int);
extern unsigned char *gui_color_decode (unsigned char *, int);
extern unsigned char *gui_color_encode (unsigned char *);
extern int gui_buffer_has_nicklist (t_gui_buffer *);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_buffer_title (t_gui_buffer *, int);
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, int);
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
extern void gui_draw_buffer_status (t_gui_buffer *, int);
@@ -434,11 +488,10 @@ extern void gui_window_merge_auto (t_gui_window *);
extern void gui_window_merge_all (t_gui_window *);
extern void gui_refresh_screen ();
extern void gui_pre_init (int *, char **[]);
extern void gui_init_colors ();
extern void gui_rebuild_weechat_colors ();
extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_end ();
extern void gui_printf_internal (t_gui_buffer *, int, int, int, char *, ...);
extern void gui_input_default_key_bindings ();
extern void gui_main_loop ();
+1
View File
@@ -384,6 +384,7 @@ t_irc_command irc_commands[] =
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "381", N_("you are now an IRC operator"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "382", N_("rehashing"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "401", N_("no such nick/channel"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
+125 -105
View File
@@ -364,30 +364,26 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
{
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer,
_("DCC: file %s%s%s"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT));
if (ptr_dcc->local_filename)
{
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
gui_printf (ptr_dcc->server->buffer, ")");
}
gui_printf (ptr_dcc->server->buffer,
_(" (local filename: %s%s%s)"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->local_filename,
GUI_COLOR(COLOR_WIN_CHAT));
if (ptr_dcc->type == DCC_FILE_SEND)
gui_printf (ptr_dcc->server->buffer, _(" sent to "));
else
gui_printf (ptr_dcc->server->buffer, _(" received from "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_NICK,
"%s",
ptr_dcc->nick);
gui_printf (ptr_dcc->server->buffer,
(status == DCC_DONE) ? _(": ok!\n") : _(": FAILED\n"));
gui_printf (ptr_dcc->server->buffer, "%s%s%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(status == DCC_DONE) ? _("OK") : _("FAILED"));
}
}
if (status == DCC_ABORTED)
@@ -399,15 +395,17 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
else
ptr_buffer = ptr_dcc->server->buffer;
irc_display_prefix (ptr_dcc->server, ptr_buffer, PREFIX_INFO);
gui_printf (ptr_buffer, _("DCC chat closed with "));
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_NICK,
"%s", ptr_dcc->nick);
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, ")\n");
gui_printf (ptr_buffer,
_("DCC chat closed with %s%s %s(%s%d.%d.%d.%d%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_dcc->addr >> 24,
(ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff,
ptr_dcc->addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
}
@@ -467,16 +465,17 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
irc_display_prefix (ptr_dcc->server, ptr_dcc->channel->buffer,
PREFIX_INFO);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
_("Connected to "));
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", ptr_dcc->nick);
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, ") ");
gui_printf (ptr_dcc->channel->buffer, _("via DCC chat\n"));
_("Connected to %s%s %s(%s%d.%d.%d.%d%s)%s via DCC chat\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_dcc->addr >> 24,
(ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff,
ptr_dcc->addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT));
}
/*
@@ -565,12 +564,11 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port,
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _("resumed at position %u\n"),
gui_printf (ptr_dcc->server->buffer,
_("DCC: file %s%s%s resumed at position %u\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT),
ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
@@ -669,51 +667,70 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
if (type == DCC_FILE_RECV)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Incoming DCC file from "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf (server->buffer, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
gui_printf (server->buffer, ", ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
gui_printf (server->buffer,
_("Incoming DCC file from %s%s%s (%s%d.%d.%d.%d%s)%s: %s%s%s, %s%lu%s bytes\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
addr >> 24,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
size,
GUI_COLOR(COLOR_WIN_CHAT));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_FILE_SEND)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC file to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf (server->buffer, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
gui_printf (server->buffer, _(" (local filename: "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", local_filename);
gui_printf (server->buffer, "), ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
gui_printf (server->buffer,
_("Sending DCC file to %s%s%s: %s%s%s "
"(local filename: %s%s%s), %s%lu%s bytes\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
local_filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
size,
GUI_COLOR(COLOR_WIN_CHAT));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_RECV)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Incoming DCC chat request from "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")\n");
gui_printf (server->buffer,
_("Incoming DCC chat request from %s%s%s "
"(%s%d.%d.%d.%d%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
addr >> 24,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_SEND)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC chat request to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s\n", nick);
gui_printf (server->buffer,
_("Sending DCC chat request to %s%s\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick);
dcc_redraw (HOTLIST_MSG);
}
@@ -728,18 +745,15 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
{
irc_display_prefix (new_dcc->server, new_dcc->server->buffer,
PREFIX_INFO);
gui_printf (new_dcc->server->buffer, _("DCC: file "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->filename);
gui_printf (new_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->local_filename);
gui_printf (new_dcc->server->buffer, ") ");
gui_printf (new_dcc->server->buffer, _("will be resumed at position %u\n"),
gui_printf (new_dcc->server->buffer,
_("DCC: file %s%s%s (local filename: %s%s%s) "
"will be resumed at position %u\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
new_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
new_dcc->local_filename,
GUI_COLOR(COLOR_WIN_CHAT),
new_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
@@ -1070,6 +1084,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
{
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
char *ptr_buf_color;
int num_read;
num_read = recv (ptr_dcc->sock, buffer, sizeof (buffer) - 2, 0);
@@ -1120,40 +1135,45 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
if (ptr_buf)
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
cfg_irc_colors_receive);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK));
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", ptr_dcc->nick);
gui_printf_type (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
"%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
ptr_dcc->nick);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_dcc->channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
ptr_dcc->nick, ptr_buf);
ptr_dcc->nick,
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
}
else
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", ptr_dcc->nick);
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", ptr_buf);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s%s",
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
ptr_dcc->nick);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s> ", GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
if (ptr_buf_color)
free (ptr_buf_color);
}
ptr_buf = next_ptr_buf;
}
if (buf2)
free (buf2);
free (buf2);
}
else
{
+117 -116
View File
@@ -52,25 +52,34 @@ irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
if (prefix[0] == prefix[2])
{
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
gui_printf_type (buffer, type, "%s%c%s%c%s%c ",
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
prefix[0],
GUI_COLOR(COLOR_WIN_CHAT_PREFIX2),
prefix[1],
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
prefix[2]);
}
else
{
if (strcmp (prefix, PREFIX_JOIN) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_JOIN, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_JOIN), prefix);
else if (strcmp (prefix, PREFIX_PART) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_PART, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_PART), prefix);
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1), prefix);
}
if (server && (server->buffer == buffer) && buffer->all_servers)
{
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_DARK, "[");
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_SERVER, "%s", server->name);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_type (buffer, type, "%s[%s%s%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_SERVER), server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
gui_printf_type (buffer, type, GUI_NO_COLOR);
}
/*
@@ -80,58 +89,51 @@ irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
void
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
int message_type, int display_around, int color_nick, int no_nickmode)
int type, int display_around, int color_nick, int no_nickmode)
{
if (display_around)
gui_printf_type_color (buffer,
message_type, COLOR_WIN_CHAT_DARK,
(nick) ? "<" : ">");
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
(nick) ? "<" : ">");
if (nick && cfg_look_nickmode)
{
if (nick->is_chanowner)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "~");
gui_printf_type (buffer, type, "%s~",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_chanadmin)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "&");
gui_printf_type (buffer, type, "%s&",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_op)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "@");
gui_printf_type (buffer, type, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_halfop)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
gui_printf_type (buffer, type, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
else if (nick->has_voice)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
gui_printf_type (buffer, type, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
else
if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_CHAT, " ");
gui_printf_type (buffer, type, "%s ",
GUI_COLOR(COLOR_WIN_CHAT));
}
if (color_nick < 0)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", (nick) ? nick->nick : nickname);
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
(nick) ? nick->nick : nickname);
else
gui_printf_type_color (buffer,
message_type,
(nick && color_nick) ?
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR((nick && color_nick) ?
((cfg_look_color_nicks) ?
nick->color : COLOR_WIN_CHAT) :
COLOR_WIN_CHAT,
"%s", (nick) ? nick->nick : nickname);
nick->color : COLOR_WIN_CHAT) :
COLOR_WIN_CHAT),
(nick) ? nick->nick : nickname);
if (display_around)
gui_printf_type_color (buffer,
message_type, COLOR_WIN_CHAT_DARK,
(nick) ? "> " : "< ");
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
(nick) ? "> " : "< ");
gui_printf_type (buffer, type, GUI_NO_COLOR);
}
/*
@@ -144,19 +146,27 @@ irc_display_mode (t_irc_server *server, t_gui_buffer *buffer,
char *symbol, char *nick_host, char *message, char *param)
{
irc_display_prefix (server, buffer, PREFIX_INFO);
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
gui_printf (buffer, "%s[%s%s%s/%s%c%s%s] %s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
channel_name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
set_flag,
symbol,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick_host);
if (param)
{
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
}
gui_printf (buffer, " %s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
message,
GUI_COLOR(COLOR_WIN_CHAT_NICK),
param);
else
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
gui_printf (buffer, " %s\n",
GUI_COLOR(COLOR_WIN_CHAT),
message);
}
/*
@@ -167,65 +177,56 @@ void
irc_display_server (t_irc_server *server)
{
gui_printf (NULL, "\n");
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
(server->is_connected) ?
_("connected") : _("not connected"));
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoconnect : %s%s\n",
(server->autoconnect) ? _("yes") : _("no"),
(server->command_line) ?
_(" (temporary server, will not be saved)") : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoreconnect . . .: %s\n",
(server->autoreconnect) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoreconnect_delay: %d seconds\n",
server->autoreconnect_delay);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_address . . . . . .: %s\n",
server->address);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_port . . . . . . .: %d\n",
server->port);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_ipv6 . . . . . . .: %s\n",
(server->ipv6) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_ssl . . . . . . . .: %s\n",
(server->ssl) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_password . . . . .: %s\n",
(server->password && server->password[0]) ?
_("(hidden)") : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_nick1/2/3 . . . . .: %s", server->nick1);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_username . . . . .: %s\n",
server->username);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_realname . . . . .: %s\n",
server->realname);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_command . . . . . .: %s\n",
(server->command && server->command[0]) ?
server->command : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_command_delay . . .: %d seconds\n",
server->command_delay);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autojoin . . . . .: %s\n",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_notify_levels . . .: %s\n",
(server->notify_levels && server->notify_levels[0]) ?
server->notify_levels : "");
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
(server->is_connected) ?
_("connected") : _("not connected"),
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
(server->autoconnect) ? _("yes") : _("no"),
(server->command_line) ?
_(" (temporary server, will not be saved)") : "");
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
(server->autoreconnect) ? _("yes") : _("no"));
gui_printf (NULL, " server_autoreconnect_delay: %d seconds\n",
server->autoreconnect_delay);
gui_printf (NULL, " server_address . . . . . .: %s\n",
server->address);
gui_printf (NULL, " server_port . . . . . . .: %d\n",
server->port);
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
(server->ipv6) ? _("yes") : _("no"));
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
(server->ssl) ? _("yes") : _("no"));
gui_printf (NULL, " server_password . . . . .: %s\n",
(server->password && server->password[0]) ?
_("(hidden)") : "");
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
server->nick1,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
server->nick2,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
server->nick3);
gui_printf (NULL, " server_username . . . . .: %s\n",
server->username);
gui_printf (NULL, " server_realname . . . . .: %s\n",
server->realname);
gui_printf (NULL, " server_command . . . . . .: %s\n",
(server->command && server->command[0]) ?
server->command : "");
gui_printf (NULL, " server_command_delay . . .: %d seconds\n",
server->command_delay);
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
gui_printf (NULL, " server_notify_levels . . .: %s\n",
(server->notify_levels && server->notify_levels[0]) ?
server->notify_levels : "");
}
+1 -1
View File
@@ -49,7 +49,7 @@ nick_find_color (t_irc_nick *nick)
}
color = (color % cfg_look_color_nicks_number);
return COLOR_WIN_NICK_FIRST + color;
return COLOR_WIN_NICK_1 + color;
}
/*
+614 -659
View File
File diff suppressed because it is too large Load Diff
+63 -70
View File
@@ -110,11 +110,11 @@ irc_cmd_send_ame (t_irc_server *server, char *arguments)
ptr_channel->name,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_ACTION_ME);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", ptr_server->nick);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n",
(arguments && arguments[0]) ? arguments : "");
gui_printf (ptr_channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_server->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(arguments && arguments[0]) ? arguments : "");
}
}
}
@@ -157,8 +157,7 @@ irc_cmd_send_amsg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
gui_printf (ptr_channel->buffer, "%s\n", arguments);
}
else
{
@@ -401,20 +400,23 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
}
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type);
gui_printf (server->buffer, "CTCP%s(%s%s%s)%s: %s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
pos_type);
if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args))
{
gettimeofday (&tv, &tz);
server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n",
arguments, tv.tv_sec, tv.tv_usec);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %d %d\n",
tv.tv_sec, tv.tv_usec);
gui_printf (server->buffer, " %s%d %d\n",
GUI_COLOR(COLOR_WIN_CHAT),
tv.tv_sec, tv.tv_usec);
}
else
{
@@ -422,8 +424,9 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
{
server_sendf (server, "PRIVMSG %s :\01%s %s\01\r\n",
arguments, pos_type, pos_args);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %s\n",
pos_args);
gui_printf (server->buffer, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos_args);
}
else
{
@@ -906,11 +909,11 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel, char *arguments)
channel->name,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME);
gui_printf_color (channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", server->nick);
gui_printf_color (channel->buffer,
COLOR_WIN_CHAT, " %s\n",
(arguments && arguments[0]) ? arguments : "");
gui_printf (channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(arguments && arguments[0]) ? arguments : "");
return 0;
}
@@ -1020,9 +1023,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos);
}
else
{
@@ -1045,9 +1046,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos);
}
else
{
@@ -1081,17 +1080,15 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
}
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "-");
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "-");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, " %s\n", msg_pwd_hidden);
gui_printf_type (server->buffer, MSG_TYPE_NICK,
"%s-%s%s%s- ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
COLOR_WIN_CHAT_DARK);
gui_printf (server->buffer, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
msg_pwd_hidden);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
free (msg_pwd_hidden);
return 0;
@@ -1112,19 +1109,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
gui_draw_buffer_title (ptr_channel->buffer, 1);
}
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
}
@@ -1217,11 +1211,13 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
while (pos[0] == ' ')
pos++;
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
gui_printf (server->buffer, "notice%s(%s%s%s)%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
}
else
@@ -1435,19 +1431,16 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
/* display text if given */
if (pos)
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
return 0;
+2 -2
View File
@@ -672,7 +672,7 @@ server_msgq_flush ()
irc_display_prefix (recv_msgq->server,
recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
_("%s Command \"%s\" failed!\n"), WEECHAT_ERROR, command);
break;
case -2:
irc_display_prefix (recv_msgq->server,
@@ -684,7 +684,7 @@ server_msgq_flush ()
irc_display_prefix (recv_msgq->server,
recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
_("%s Unknown command: cmd=%s, host=%s, args=%s\n"),
_("%s Unknown command: cmd=\"%s\", host=\"%s\", args=\"%s\"\n"),
WEECHAT_WARNING, command, host, args);
break;
}
+1 -1
View File
@@ -482,7 +482,7 @@ weechat_plugin_get_config_str_value (t_config_option *option, void *value)
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
color_name = gui_get_color_name (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
+2 -3
View File
@@ -1,13 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
WeeChat known bugs, 2005-09-24
WeeChat known bugs, 2005-11-04
- color display problems when term has white background
- ./configure does not check that Ruby libraries are installed
- ./configure does not check that Gtk 2.0 libraries are installed
- when quitting WeeChat term title is not restored (if look_set_title is ON)
- command name for /server can not contain spaces
- when many WeeChat are launched, log file is not properly written (cleared by
each WeeChat at startup)
- display problems with old Konsole versions (Kde terminal) (???)
- WeeChat may crash if too much nicks in nicklist when position is top or bottom
+6 -2
View File
@@ -1,10 +1,13 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-10-30
ChangeLog - 2005-11-04
Version 0.1.6 (under dev!):
* new color management system, IRC colors are now correctly
displayed and can be removed by new options irc_colors_receive
and irc_colors_send
* added setting for having one server buffer for all servers
(look_one_server_buffer)
* added setting for ignoring some chars when completing nicks
@@ -18,7 +21,8 @@ Version 0.1.6 (under dev!):
library, and perl/python are plugin scripts
* log options (for server/channel/private) can now be set while
WeeChat is running
* added some missing IRC commands, channel modes +e and +f
* added channel modes +e and +f
* added some missing IRC commands, fixed command 367
* added colors for input buffer and current channel of status bar
* added online help for config options (with /set full_option_name)
* enhanced "smart" hotlist, with names (new options:
+9 -1
View File
@@ -1,4 +1,4 @@
.TH WEECHAT 1 "September 2005" "FlashCode"
.TH WEECHAT 1 "November 2005" "FlashCode"
.SH NAME
weechat-curses \- Wee Enhanced Environment for Chat (Curses version)
@@ -19,6 +19,10 @@ It is compliant with RFCs 1459, 2810, 2811, 2812, and 2813.
.SH OPTIONS
.TP
.B \-a, \-\-no\-connect
.br
disable auto-connect to servers at startup
.TP
.B \-c, \-\-config
.br
display config file help (list of options)
@@ -43,6 +47,10 @@ display default keys
.br
display program license
.TP
.B \-p, \-\-no\-plugin
.br
don't load any plugin at startup
.TP
.B \-v, \-\-version
.br
display WeeChat version
+172 -451
View File
@@ -35,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 30 2005
@subtitle Documentation for WeeChat v0.1.6-cvs - November, 4 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -298,9 +298,6 @@ Type: integer (values: between 1 and 10), default value: 10@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@@ -453,7 +450,7 @@ Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Type: color (Curses or Gtk color), default value: 'white'@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@@ -604,6 +601,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Type: string (any string), default value: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@@ -1577,7 +1580,7 @@ them the plugin can't load):@*
@item functions for init and end of plugin:
@itemize @minus
@item weechat_plugin_init: function called when plugin is loaded,
must return PLUGIN_RC_OK (0) if successful, PLUGIN_RC_KO (-1) if error
must return PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error
@item weechat_plugin_end: function called when plugin is unloaded
@end itemize
@end itemize
@@ -1831,15 +1834,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1888,10 +1893,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2217,12 +2224,11 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to use script languages: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Load/unload Perl scripts
Perl scripts are loaded and unloaded with @command{/perl} command.
(type @kbd{/help perl} within WeeChat to get help about command).@*
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
@emph{Examples:}@*
@itemize @bullet
@@ -2232,23 +2238,32 @@ Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection WeeChat / Perl API
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( name, version, shutdown_function, description );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
This is first function to call in Perl script.@*
All Perl scripts for WeeChat should call this function.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: Perl function called when script is
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@@ -2257,13 +2272,20 @@ unloaded (optional parameter, empty string means nothing is called at the end)
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample script!");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( message, [channel, [server]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Print message in a channel.@*
@@ -2278,15 +2300,22 @@ Print message in a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( delay, message );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Print message in infobar.@*
@@ -2301,15 +2330,20 @@ Print message in infobar.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( name, function );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Attach a Perl function to an IRC message.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@@ -2318,14 +2352,14 @@ Function will be called each time IRC message will be received.@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{function}: Perl function called when message is received
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@@ -2337,31 +2371,48 @@ RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( name, function );}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
Create new WeeChat command, linked with Perl function.@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
Perl function. Be careful when overriding WeeChat commands, they'll not be
available until your Perl script will be unloaded.
@item @option{function}: Perl function linked with command
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2372,9 +2423,9 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@@ -2383,37 +2434,52 @@ arguments (displayed by /help command)
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2428,15 +2494,22 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@code{weechat.command ("/nick newnick", "", "freenode")}@*
@*
@item
@command{weechat::get_info ( name, [server, [channel] ] );}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Get various info about WeeChat, server or user.@*
@@ -2462,391 +2535,20 @@ Get various info about WeeChat, server or user.@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Load/unload Python scripts
Python scripts are loaded and unloaded with @command{/python} command.
(type @kbd{/help python} within WeeChat to get help about command).@*
@emph{Examples:}@*
@itemize @bullet
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection WeeChat / Python API
@itemize @bullet
@item
@command{weechat.register ( name, version, shutdown_function, description )}@*
@*
This is first function to call in Python script.@*
All Python scripts for WeeChat should call this function.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: Python function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!")}@*
@*
@item
@command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( delay, message )}@*
@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat.add_message_handler ( name, function )}@*
@*
Attach a Python function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{function}: Python function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( name, function )}@*
@*
Create new WeeChat command, linked with Python function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
Python function. Be careful when overriding WeeChat commands, they'll not be
available until your Python script will be unloaded.
@item @option{function}: Python function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@code{weechat.command ("/nick newnick", "", "freenode")}@*
@*
@item
@command{weechat.get_info ( name, [server] )}@*
@*
Get various info about WeeChat, server or user.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Examples:}@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2889,7 +2591,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2902,14 +2605,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2923,14 +2632,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2946,13 +2662,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2969,17 +2690,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
Not developed!
@c **************************** Authors / Support *****************************
+222 -499
View File
@@ -36,7 +36,7 @@
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 30 de octubre de 2005
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 4 de noviembre de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -298,9 +298,6 @@ Typo: entero (valores: entre 1 y 10), valor por defecto: 10@*
@item look_color_actions
Mostrar acciones con colores diferentes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_remove_colors_from_msgs
Quitar colores en los mensajes entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item look_nicklist
Mostrar ventana de usuarios (para las ventanas de canal)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@@ -453,7 +450,7 @@ Color para el texto de entrada (alias)@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'white'@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'cyan'@*
@item col_input_bg
Color de fondo para la ventana de entrada@*
Typo: color (color Curses @'o Gtk), valor por defecto: 'default'@*
@@ -604,6 +601,12 @@ Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Typo: cadena (cualquier cadena), valor por defecto: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'on'@*
@item dcc_auto_accept_files
Aceptar autom@'aticamente los ficheros dcc entrantes@*
Typo: booleano (valores: 'on' u 'off'), valor por defecto: 'off'@*
@@ -1834,15 +1837,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1891,10 +1896,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2214,151 +2221,195 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to load scripts: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Cargar/descargar programas Perl
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
Los programas Perl se cargan y descargan con el comando @command{/perl}
(escribiendo @kbd{/help perl} en WeeChat para obtener la ayuda acerca del comando).@*
@emph{Ejemplos:}@*
@emph{Examples:}@*
@itemize @bullet
@item
Cargar un programa Perl: @kbd{/perl load /tmp/ejemplo.pl}@*
@item Descargar todos los programas Perl: @kbd{/perl unload}@*
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
@item
Listar los programas Perl cargados: @kbd{/perl}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection Interfaz WeeChat / Perl
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( nombre, versi@'on, funci@'on_final, descripci@'on );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
Es la primera funci@'on a la que llamar en el programa Perl.@*
Todos los programas en Perl para WeeChat deben llamar esta funci@'on.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre @'unico para identificar el programa (cada programa debe
tener un nombre distinto)
@item @option{versi@'on}: versi@'on del programa
@item @option{funci@'on_final}: funci@'on Perl llamada cuando el programa finaliza
(par@'ametro facultativo, una cadena llena significa que no hay ninguna funci@'on que llamar)
@item @option{descripci@'on}: descripci@'on breve del programa
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( mensaje, [canal, [servidor]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Escribe un mensaje en un canal.@*
Print message in a channel.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{mensaje}: mensaje a escribir
@item @option{canal}: nombre del canal
@item @option{servidor}: (opcional) nombre interno del servidor
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplos:}@*
@emph{Perl examples:}@*
@*
@code{weechat::print ("mensaje");}@*
@code{weechat::print ("mensaje", "#weechat");}@*
@code{weechat::print ("mensaje", "#weechat", "freenode");}@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( retraso, mensaje );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Escribir un mensaje en la barra de informaciones.@*
Print message in infobar.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{plazo}: periodo en segundo durante el cual se mostrar@'a el mensaje
(si es 0, el mensaje no se borrar@'a).
@item @option{message}: mensaje que se escribir@'a en la barra de informaciones.
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::print_infobar (5, "mensaje");}@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( nombre, funci@'on );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Adjunta una funci@'on Perl a un mensaje IRC.@*
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre del mensaje IRC que producir@'a la llamada a la funci@'on.@*
Para saber qu@'e tipo de mensajes IRC existen puede leer las
RFC 1459 y/o 2812:@*
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{funci@'on}: funci@'on en Perl llamada cuando se reciba el mensaje.
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", mi_funcion);}@*
@code{sub mi_funcion}@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print ("serveur=$_[0]\n");}@*
@code{@ @ @ @ ($null, $canal, $mensaje) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($mascara, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masc=$mascara, canal=$canal, msj=$mensaje\n");}@*
@code{@ @ @ @ weechat::print ("server=$_[0]\n");}@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( nombre, funci@'on );}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Perl.@*
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre del nuevo comando@*
Puede ser un comando que ya existe, y en este caso el nuevo comando sustituir@'a
el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
al antiguo comando si el script Perl est@'a cargado.
@item @option{funcion}: funci@'on Perl assiciada al comando.
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2369,48 +2420,63 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("comando", mi_comando);}@*
@code{sub mi_comando}@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Servidor: $_[0], Par@'ametros: $_[1]\n");}@*
@code{@ @ @ @ weechat::print("Server: $_[0], arguments: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2425,384 +2491,13 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@item
@command{weechat::get_info ( nombre, [servidor, [canal] ] );}@*
@*
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
@itemize @minus
@item @option{version}: obtener la versi@'on de WeeChat
@item @option{nick}: obtener el seud@'onimo
@item @option{channel}: obtener el nombre del canal
@item @option{server}: obtener el nombre del servidor
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nombre interno del servidor
@item @option{canal}: nombre del canal
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Ejemplos:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Cargar/descargar programas Python
Los programas Python se cargan y descargan con el comando @command{/python}
(escribiendo @kbd{/help python} en WeeChat para obtener la ayuda acerca del comando).@*
@emph{Ejemplos:}@*
@itemize @bullet
@item
Cargar un programa Python: @kbd{/python load /tmp/ejemplo.py}@*
@item Descargar todos los programas Python: @kbd{/python unload}@*
@item
Listar los programas Python cargados: @kbd{/python}@*
@end itemize
@subsubsection Interfaz WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nombre, versi@'on, funci@'on_final, descripci@'on )}@*
@*
Es la primera funci@'on a la que llamar en el programa Python.@*
Todos los programas en Python para WeeChat deben llamar esta funci@'on.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre @'unico para identificar el programa (cada programa debe
tener un nombre distinto)
@item @option{versi@'on}: versi@'on del programa
@item @option{funci@'on_final}: funci@'on Python llamada cuando el programa finaliza
(par@'ametro facultativo, una cadena llena significa que no hay ninguna funci@'on que llamar)
@item @option{descripci@'on}: descripci@'on breve del programa
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.register ("ejemplo", "1.0", "fin_ejemplo", "programa de ejemplo...")}@*
@*
@item
@command{weechat.prnt ( mensaje, [canal, [servidor]] )}@*
@*
Escribe un mensaje en un canal.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{mensaje}: mensaje a escribir
@item @option{canal}: nombre del canal
@item @option{servidor}: (opcional) nombre interno del servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplos:}@*
@*
@code{weechat.prnt ("mensaje")}@*
@code{weechat.prnt ("mensaje", "#weechat")}@*
@code{weechat.prnt ("mensaje", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( retraso, mensaje )}@*
@*
Escribir un mensaje en la barra de informaciones.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{retraso}: periodo en segundo durante el cual se mostrar@'a el mensaje
(si es 0, el mensaje no se borrar@'a).
@item @option{mensaje}: mensaje que se escribir@'a en la barra de informaciones.
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.print_infobar (5, "mensaje")}@*
@*
@item
@command{weechat.add_message_handler ( nombre, funci@'on )}@*
@*
Adjunta una funci@'on Python a un mensaje IRC.@*
Se llamar@'a a la funci@'on cada vez que el mensaje IRC se reciba.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre del mensaje IRC que producir@'a la llamada a la funci@'on.@*
Para saber qu@'e tipo de mensajes IRC existen puede leer las
RFC 1459 y/o 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{funci@'on}: funci@'on en Python llamada cuando se reciba el mensaje.
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.add_message_handler ("privmsg", mi_funcion)}@*
@code{def mi_funcion(servidor, args):}@*
@code{@ @ @ @ weechat.prnt("servidor="+servidor)}@*
@code{@ @ @ @ null, canal, mensaje = string.split(args, ":", 2)}@*
@code{@ @ @ @ mascara, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("masc="+mascara+", canal="+canal+", msj="+mensaje)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( nombre, funci@'on )}@*
@*
A@~nadir un nuevo comando WeeChat, con un enlace a una funci@'on en Python.@*
Se llamar@'a a la funci@'on cuando el usuario lance el comando con @kbd{/nombre}.@*
@emph{Par@'ametros:}
@itemize @minus
@item @option{nombre}: nombre del nuevo comando@*
Puede ser un comando que ya existe, y en este caso el nuevo comando sustituir@'a
el antiguo. Ten cuidado cuando sustituyas a un comando de WeeChat, no podr@'a acceder
al antiguo comando si el script Python est@'a cargado.
@item @option{funcion}: funci@'on Python assiciada al comando.
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
@*
@emph{Ejemplo:}@*
@*
@code{weechat.add_command_handler ("comando", mi_comando)}@*
@code{def mi_comando(servidor, args):}@*
@code{@ @ @ @ weechat.prnt("Servidor:"+servidor+" Par@'ametros:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@@ -2810,38 +2505,47 @@ Execute a command or send a message to a channel.@*
@*
@item
@command{weechat.get_info ( nombre, [servidor] )}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Obtener informaciones distintas sobre WeeChat, el servidor o el usuario.@*
Get various info about WeeChat, server or user.@*
@emph{Par@'ametros:}
@emph{Arguments:}
@itemize @minus
@item @option{nombre}: nombre de la informaci@'on que se quiere obtener:
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: obtener la versi@'on de WeeChat
@item @option{nick}: obtener el seud@'onimo
@item @option{channel}: obtener el nombre del canal
@item @option{server}: obtener el nombre del servidor
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nombre interno del servidor
@item @option{server}: internal name of server
@item @option{channel}: channel name
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Ejemplos:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2884,7 +2588,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2897,14 +2602,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2918,14 +2629,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2941,13 +2659,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2964,17 +2687,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
@exclamdown{}No desarrollado!
@c **************************** Autores / Soporte *****************************
+182 -472
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.6-cvs - 30 octobre 2005
@subtitle Documentation pour WeeChat v0.1.6-cvs - 4 novembre 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -299,9 +299,6 @@ Type: entier (valeurs: entre 1 et 10), valeur par d@'efaut: 10@*
@item look_color_actions
Afficher les actions avec diff@'erentes couleurs@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_remove_colors_from_msgs
Supprimer les couleurs dans les messages entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item look_nicklist
Afficher la fen@^etre des utilisateurs (pour les fen@^etres de canaux)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@@ -454,7 +451,7 @@ Couleur pour le texte saisi (pseudo)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightcyan'@*
@item col_input_delimiters
Couleur pour le texte saisi (d@'elimiteurs)@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'white'@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'cyan'@*
@item col_input_bg
Couleur de fond pour la fen@^etre de saisie@*
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
@@ -605,6 +602,12 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@item irc_highlight
Liste des mots pour la notification (s@'epar@'es par des virgules, le comparaison ne tient pas compte de la casse, les mots peuvent commencer ou se terminer par "*" pour une comparaison partielle)@*
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
@item irc_colors_receive
Garder les couleurs dans les messages re@,{c}us@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item irc_colors_send
Autorise l'utilisateur @`a envoyer des couleurs avec des codes sp@'eciaux (%B=gras, %Cxx,yy=couleur, %U=soulign@'e, %R=invers@'e)@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
@item dcc_auto_accept_files
Accepte automatiquement les fichiers dcc entrants@*
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
@@ -1850,15 +1853,16 @@ void *handler_pointer)}@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
des valeurs suivantes (pr@'efix@'ee par ``weechat::'' pour Perl ou
``weechat.'' pour Python) :@*
@itemize @minus
@item @option{PLUGIN_RC_KO ou -1}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK ou 0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT ou 1}: le message ne sera pas transmis
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: le message ne sera pas transmis
@`a WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS ou 2}: le message ne sera pas transmis
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: le message ne sera pas transmis
@`a d'autres extensions
@item @option{PLUGIN_RC_OK_IGNORE_ALL ou 3}: le message ne sera transmis ni @`a
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: le message ne sera transmis ni @`a
WeeChat ni @`a d'autres extensions
@end itemize
@*
@@ -1911,10 +1915,11 @@ fichier: %s", (arguments) ? arguments : "aucun");}@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit
renvoyer une des valeurs suivantes :@*
renvoyer une des valeurs suivantes (pr@'efix@'ee par ``weechat::''
pour Perl ou ``weechat.'' pour Python) :@*
@itemize @minus
@item @option{PLUGIN_RC_KO ou -1}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK ou 0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@end itemize
@*
@@ -2249,37 +2254,47 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Trois extensions sont fournies en standard avec WeeChat pour utiliser
des langages de script: Perl, Python et Ruby.
@subsection Scripts Perl
@subsection Charger/d@'echarger des scripts
@subsubsection Charger/d@'echarger des scripts Perl
Les scripts Perl sont charg@'es et d@'echarg@'es avec la commande @command{/perl}
(tapez @kbd{/help perl} dans WeeChat pour obtenir de l'aide sur la commande).@*
Les scripts sont charg@'es et d@'echarg@'es avec les commandes
@command{/perl}, @command{/python} et @command{/ruby}.
(tapez @kbd{/help} dans WeeChat pour obtenir de l'aide sur les
commandes).@*
@emph{Exemples :}@*
@itemize @bullet
@item
Charger un script Perl : @kbd{/perl load /tmp/essai.pl}@*
@item D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
@item
D@'echarger tous les scripts Perl : @kbd{/perl unload}@*
@item
Lister les scripts Perl charg@'es : @kbd{/perl}@*
@item
Charger un script Python : @kbd{/python load /tmp/essai.py}@*
@item
D@'echarger tous les scripts Python : @kbd{/python unload}@*
@item
Lister les scripts Python charg@'es : @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Perl
@subsection Interface WeeChat / Scripts
@itemize @bullet
@item
@command{weechat::register ( nom, version, fonction_de_fin, description );}@*
Perl: @command{weechat::register ( nom, version, fonction_de_fin,
description );}@*
Python: @command{weechat.register ( nom, version, fonction_de_fin,
description )}@*
@*
C'est la premi@`ere fonction @`a appeler dans le script Perl.@*
Tout script Perl pour WeeChat doit appeler cette fonction.@*
C'est la premi@`ere fonction @`a appeler dans le script.@*
Tout script pour WeeChat doit appeler cette fonction.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom unique pour identifier le script (chaque script doit
avoir un nom diff@'erent)
@item @option{version}: version du script
@item @option{fonction_de_fin}: fonction Perl appel@'ee quand le script est
@item @option{fonction_de_fin}: fonction appel@'ee quand le script est
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
de fonction @`a appeler)
@item @option{description}: description br@`eve du script.
@@ -2289,13 +2304,18 @@ de fonction @`a appeler)
@*
1 si le script a @'et@'e enregistr@'e, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::register ("essai", "1.0", "fin_essai", "Script d'essai !");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")}@*
@*
@item
@command{weechat::print ( message, [canal, [serveur]] );}@*
Perl: @command{weechat::print ( message, [canal, [serveur]] );}@*
Python: @command{weechat.prnt ( message, [canal, [serveur]] )}@*
@*
Affiche un message dans un canal.@*
@@ -2310,15 +2330,22 @@ Affiche un message dans un canal.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::print_infobar ( d@'elai, message );}@*
Perl: @command{weechat::print_infobar ( d@'elai, message );}@*
Python: @command{weechat.print_infobar ( d@'elai, message )}@*
@*
Affiche un message dans la barre d'infos.@*
@@ -2333,16 +2360,22 @@ Affiche un message dans la barre d'infos.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::add_message_handler ( nom, fonction );}@*
Perl: @command{weechat::add_message_handler ( nom, fonction );}@*
Python: @command{weechat.add_message_handler ( nom, fonction )}@*
@*
Attache une fonction Perl @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
Attache une fonction @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera
re@,{c}u.@*
@emph{Param@`etres :}
@itemize @minus
@@ -2351,14 +2384,14 @@ Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
RFC 1459 et/ou 2812 :@*
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fonction}: fonction Perl appel@'ee lorsque le message est re@,{c}u
@item @option{fonction}: fonction appel@'ee lorsque le message est re@,{c}u
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Perl a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
1 si la fonction a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::add_message_handler ("privmsg", ma_fonction);}@*
@code{sub ma_fonction}@*
@@ -2367,391 +2400,10 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ ($null, $canal, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($masque, $null, $canal) = split " ", $canal;}@*
@code{@ @ @ @ weechat::print ("masque=$masque, canal=$canal, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@ @ @ @ return weechat::PLUGIN_RC_OK;}@*
@code{@} }@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{1}: le message ne sera pas transmis @`a WeeChat
@item @option{2}: le message ne sera pas transmis @`a d'autres extensions
@item @option{3}: le message ne sera transmis ni @`a WeeChat ni @`a
d'autres extensions
@end itemize
@*
@item
@command{weechat::add_command_handler ( nom, fonction, [description,
arguments, arguments_description] );}@*
@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Perl.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de la nouvelle commande@*
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
la fonction Perl. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
ne seront plus accessibles tant que le script Perl sera charg@'e.
@item @option{fonction}: fonction Perl associ@'ee @`a la commande
@item @option{description}: description de la commande (affich@'ee par
/help commande)
@item @option{arguments}: br@`eve description des param@`etres de la
commande (affich@'ee par /help commande)
@item @option{arguments_description}: longue description des
param@`etres de la commande (affich@'ee par /help commande)
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Perl a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::add_command_handler ("commande", ma_commande);}@*
@code{sub ma_commande}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Serveur: $_[0], param@`etres: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit renvoyer une
des valeurs suivantes :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@end itemize
@*
@item
@command{weechat::remove_handler ( nom, fonction );}@*
@*
Supprime un gestionnaire de message ou de commande.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC ou de la commande
@item @option{fonction}: fonction Perl associ@'ee
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::remove_handler ("commande", ma_commande);}@*
@*
@item
@command{weechat::command ( commande, [canal, [serveur]] );}@*
@*
Ex@'ecute une commande ou envoie un message @'a un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a envoyer au canal)
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat::command ("bonjour tout le monde !");}@*
@code{weechat::command ("/kick toto merci de quitter ce canal", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@item
@command{weechat::get_info ( nom, [serveur, [canal] ] );}@*
@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou l'utilisateur.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'info @`a obtenir :
@itemize @minus
@item @option{version}: obtenir la version de WeeChat
@item @option{nick}: obtenir le pseudo
@item @option{channel}: obtenir le nom du canal
@item @option{server}: obtenir le nom du serveur
@item @option{away}: obtenir le drapeau ``away''
@item @option{weechat_dir}: obtenir le r@'epertoire maison de WeeChat
@item @option{weechat_libdir}: obtenir le r@'epertoire ``lib''
syst@`eme de WeeChat
@item @option{weechat_sharedir}: obtenir le r@'epertoire ``share''
syst@`eme de partage WeeChat
@end itemize
@item @option{serveur}: nom interne du serveur
@item @option{canal}: nom du canal
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
L'information demand@'e, blanc si une erreur s'est produite ou que
l'information n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Obtenir la liste des DCC.@*
Le tableau renvoy@'e contient les champs suivants :
@itemize @minus
@item server: le serveur IRC
@item channel: le canal IRC
@item type: le type de DCC :
@itemize @minus
@item 0: discussion (re@,cue)
@item 1: discussion (envoy@'ee)
@item 2: fichier en r@'eception
@item 3: fichier en @'emission
@end itemize
@item status: statut du DCC :
@itemize @minus
@item 0: en attente
@item 1: en cours de connexion
@item 2: actif
@item 3: termin@'e
@item 4: @'echou@'e
@item 5: interrompu par l'utilisateur
@end itemize
@item start_time: la date et heure de cr@'eation du DCC
@item start_transfer: la date et heure de d@'emarrage du transfert
@item addr: adresse de l'utilisateur distant
@item port: port utilis@'e pour le DCC
@item nick: pseudo de l'utilisateur distant
@item filename: nom de fichier
@item local_filename: nom de fichier local
@item size: taille du fichier
@item pos: position actuelle dans le fichier
@item start_resume: position de d@'emarrage apr@`es une interruption
@item bytes_per_sec: nombre d'octets transmis par seconde depuis le d@'ebut
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La liste des DCC, 0 si une erreur s'est produite.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Obtenir la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, valeur );}@*
@*
Modifier une otion de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin, "#weechat");}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
@*
Renvoie la valeur d'une option de l'extension.@*
L'option est lue depuis le fichier ~/.weechat/plugins.rc et est
sous cette forme :@*
@code{extension.script.option=valeur}@*
NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemple :}@*
@*
@code{$value = weechat::get_plugin_config ("ma_variable");}@*
@*
@item
@command{weechat::set_plugin_config ( option, valeur );}@*
@*
Modifie la valeur d'une option de l'extension.@*
L'option est @'ecrite dans le fichier ~/.weechat/plugins.rc et est
sous cette forme :@*
@code{extension.script.option=valeur}@*
NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat::set_plugin_config ("ma_variable", "valeur");}@*
@*
@end itemize
@subsection Scripts Python
@subsubsection Charger/d@'echarger des scripts Python
Les scripts Python sont charg@'es et d@'echarg@'es avec la commande @command{/python}
(tapez @kbd{/help python} dans WeeChat pour obtenir de l'aide sur la commande).@*
@emph{Exemples :}@*
@itemize @bullet
@item
Charger un script Python : @kbd{/python load /tmp/essai.py}@*
@item D@'echarger tous les scripts Python : @kbd{/python unload}@*
@item
Lister les scripts Python charg@'es : @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nom, version, fonction_de_fin, description )}@*
@*
C'est la premi@`ere fonction @`a appeler dans le script Python.@*
Tout script Python pour WeeChat doit appeler cette fonction.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom unique pour identifier le script (chaque script doit
avoir un nom diff@'erent)
@item @option{version}: version du script
@item @option{fonction_de_fin}: fonction Python appel@'ee quand le script est
d@'echarg@'e (param@`etre facultatif, une cha@^ine vide signifiant qu'il n'y a pas
de fonction @`a appeler)
@item @option{description}: description br@`eve du script.
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si le script a @'et@'e enregistr@'e, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")}@*
@*
@item
@command{weechat.prnt ( message, [canal, [serveur]] )}@*
@*
Affiche un message dans un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{message}: message @`a afficher
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( d@'elai, message )}@*
@*
Affiche un message dans la barre d'infos.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{d@'elai}: d@'elai (en secondes) pendant lequel le message est affich@'e
(si 0, le message ne sera pas effac@'e).
@item @option{message}: message @`a afficher
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat.add_message_handler ( nom, fonction )}@*
@*
Attache une fonction Python @`a un message IRC particulier.@*
La fonction sera appel@'ee @`a chaque fois que le message IRC sera re@,{c}u.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC pour lequel la fonction est appel@'ee@*
Pour conna@^itre la liste des messages IRC disponibles, merci de consulter les
RFC 1459 et/ou 2812 :@*
RFC 1459 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fonction}: fonction Python appel@'ee lorsque le message est re@,{c}u
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Python a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Python :}@*
@*
@code{weechat.add_message_handler ("privmsg", ma_fonction)}@*
@code{def ma_fonction(serveur, args):}@*
@@ -2759,35 +2411,43 @@ RFC 2812 : @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@code{@ @ @ @ null, canal, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ masque, null, canal = string.split(string.strip(canal), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("masque="+masque+", canal="+canal+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@code{@ @ @ @ return weechat.PLUGIN_RC_OK}@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque le message est re@,cu doit renvoyer une
des valeurs suivantes :@*
des valeurs suivantes (pr@'efix@'ee par ``weechat::'' pour Perl ou
``weechat.'' pour Python) :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{1}: le message ne sera pas transmis @`a WeeChat
@item @option{2}: le message ne sera pas transmis @`a d'autres extensions
@item @option{3}: le message ne sera transmis ni @`a WeeChat ni @`a
d'autres extensions
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: le message ne sera pas
transmis @`a WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: le message ne sera pas
transmis @`a d'autres extensions
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: le message ne sera transmis ni
@`a WeeChat ni @`a d'autres extensions
@end itemize
@*
@item
@command{weechat.add_command_handler ( nom, fonction )}@*
Perl: @command{weechat::add_command_handler ( nom, fonction,
[description, arguments, arguments_description] );}@*
Python: @command{weechat.add_command_handler ( nom, fonction,
[description, arguments, arguments_description] )}@*
@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction Python.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande par @kbd{/nom}.@*
Cr@'e@'e une nouvelle commande WeeChat, associ@'ee @`a une fonction.@*
La fonction sera appel@'ee lorsque l'utilisateur lancera la commande
par @kbd{/nom}.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de la nouvelle commande@*
Il peut s'agir d'une commande existante, auquel cas celle-ci est @'ecras@'ee par
la fonction Python. Soyez prudent en @'ecrasant les commandes WeeChat, car elles
ne seront plus accessibles tant que le script Python sera charg@'e.
@item @option{fonction}: fonction Python associ@'ee @`a la commande
Il peut s'agir d'une commande existante, auquel cas celle-ci est
@'ecras@'ee par la fonction du script. Soyez prudent en @'ecrasant les
commandes WeeChat, car elles ne seront plus accessibles tant que le
script sera charg@'e.
@item @option{fonction}: fonction associ@'ee @`a la commande
@item @option{description}: description de la commande (affich@'ee par
/help commande)
@item @option{arguments}: br@`eve description des param@`etres de la
@@ -2798,53 +2458,70 @@ param@`etres de la commande (affich@'ee par /help commande)
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si la fonction Python a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
1 si la fonction a @'et@'e attach@'ee, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat::add_command_handler ("commande", ma_commande);}@*
@code{sub ma_commande}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Serveur: $_[0], param@`etres: $_[1]\n");}@*
@code{@ @ @ @ return weechat::PLUGIN_RC_OK;}@*
@code{@} }@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.add_command_handler ("commande", ma_commande)}@*
@code{def ma_commande(serveur, args):}@*
@code{@ @ @ @ weechat.prnt("serveur:"+serveur+" param@`etres:"+args)}@*
@code{@ @ @ @ return 0}@*
@code{@ @ @ @ return weechat.PLUGIN_RC_OK}@*
@*
@emph{Notes :}@*
@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit renvoyer une
des valeurs suivantes :@*
La fonction appel@'ee lorsque la commande est ex@'ecut@'ee doit
renvoyer une des valeurs suivantes (pr@'efix@'ee par ``weechat::''
pour Perl ou ``weechat.'' pour Python) :@*
@itemize @minus
@item @option{-1}: la fonction a @'echou@'e
@item @option{0}: la fonction a r@'eussi
@item @option{PLUGIN_RC_KO}: la fonction a @'echou@'e
@item @option{PLUGIN_RC_OK}: la fonction a r@'eussi
@end itemize
@*
@item
@command{weechat.remove_handler ( nom, fonction );}@*
Perl: @command{weechat::remove_handler ( nom, fonction );}@*
Python: @command{weechat.remove_handler ( nom, fonction )}@*
@*
Supprime un gestionnaire de message ou de commande.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom du message IRC ou de la commande
@item @option{fonction}: fonction Python associ@'ee
@item @option{fonction}: fonction associ@'ee
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat.remove_handler ("commande", ma_commande);}@*
@code{weechat::remove_handler ("commande", ma_commande);}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.remove_handler ("commande", ma_commande)}@*
@*
@item
@command{weechat.command ( commande, [canal, [serveur]] )}@*
Perl: @command{weechat::command ( commande, [canal, [serveur]] );}@*
Python: @command{weechat.command ( commande, [canal, [serveur]] )}@*
@*
Ex@'ecute une commande ou envoie un message @'a un canal.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a envoyer au canal)
@item @option{commande}: commande @'a ex@'ecuter (ou message @'a
envoyer au canal)
@item @option{canal}: nom du canal
@item @option{serveur}: nom interne du serveur
@end itemize
@@ -2853,7 +2530,13 @@ Ex@'ecute une commande ou envoie un message @'a un canal.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat::command ("bonjour tout le monde !");}@*
@code{weechat::command ("/kick toto merci de quitter ce canal", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.command ("bonjour tout le monde !")}@*
@code{weechat.command ("/kick toto merci de quitter ce canal", "#weechat")}@*
@@ -2861,9 +2544,11 @@ Ex@'ecute une commande ou envoie un message @'a un canal.@*
@*
@item
@command{weechat.get_info ( nom, [serveur] )}@*
Perl: @command{weechat::get_info ( nom, [serveur, [canal] ] );}@*
Python: @command{weechat.get_info ( nom, [serveur, [canal] ] )}@*
@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou l'utilisateur.@*
Obtenir des informations vari@'ees sur WeeChat, le serveur ou
l'utilisateur.@*
@emph{Param@`etres :}
@itemize @minus
@@ -2881,6 +2566,7 @@ syst@`eme de WeeChat
syst@`eme de partage WeeChat
@end itemize
@item @option{serveur}: nom interne du serveur
@item @option{canal}: nom du canal
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@@ -2888,14 +2574,20 @@ syst@`eme de partage WeeChat
L'information demand@'e, blanc si une erreur s'est produite ou que
l'information n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{$version = weechat.get_info ("version")}@*
@code{$nick = weechat.get_info ("nick", "freenode")}@*
@*
@item
@command{weechat.get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( )}@*
@*
Obtenir la liste des DCC.@*
@@ -2938,13 +2630,14 @@ La liste des DCC, 0 si une erreur s'est produite.@*
@*
@item
@command{weechat.get_config ( nom );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Obtenir la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'option
@item @option{option}: nom de l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@@ -2952,20 +2645,26 @@ Obtenir la valeur d'une option de configuration WeeChat.@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( nom, valeur );}@*
Perl: @command{weechat::set_config ( option, valeur );}@*
Python: @command{weechat.set_config ( option, valeur )}@*
@*
Modifier une otion de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{nom}: nom de l'option
@item @option{option}: nom de l'option
@item @option{valeur}: la nouvelle valeur pour l'option
@end itemize
@*
@@ -2973,14 +2672,20 @@ Modifier une otion de configuration WeeChat.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemples :}@*
@emph{Exemples en Perl :}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin, "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin, "#weechat");}@*
@*
@emph{Exemples en Python :}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin, "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Renvoie la valeur d'une option de l'extension.@*
L'option est lue depuis le fichier ~/.weechat/plugins.rc et est
@@ -2998,13 +2703,18 @@ NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
La valeur de l'option, blanc si une erreur s'est produite ou que
l'option n'a pas @'et@'e trouv@'ee.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{$value = weechat.get_plugin_config ("ma_variable");}@*
@code{$value = weechat::get_plugin_config ("ma_variable");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{$value = weechat.get_plugin_config ("ma_variable")}@*
@*
@item
@command{weechat.set_plugin_config ( option, valeur );}@*
Perl: @command{weechat::set_plugin_config ( option, valeur );}@*
Python: @command{weechat.set_plugin_config ( option, valeur )}@*
@*
Modifie la valeur d'une option de l'extension.@*
L'option est @'ecrite dans le fichier ~/.weechat/plugins.rc et est
@@ -3022,17 +2732,17 @@ NB: le nom de l'extension et du script sont ajout@'es automatiquement.@*
@*
1 si succ@`es, 0 si une erreur s'est produite.@*
@*
@emph{Exemple :}@*
@emph{Exemple en Perl :}@*
@*
@code{weechat.set_plugin_config ("ma_variable", "valeur");}@*
@code{weechat::set_plugin_config ("ma_variable", "valeur");}@*
@*
@emph{Exemple en Python :}@*
@*
@code{weechat.set_plugin_config ("ma_variable", "valeur")}@*
@*
@end itemize
@subsection Scripts Ruby
Non d@'evelopp@'e !
@c **************************** Auteurs / Support *****************************
+220 -487
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 30 de outubro de 2005
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 4 de novembro de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -296,9 +296,6 @@ Type: integer (values: between 1 and 10), default value: 10@*
@item look_color_actions
Display actions with different colors@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_remove_colors_from_msgs
Remove colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item look_nicklist
Display nicklist window (for channel windows)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@@ -451,7 +448,7 @@ Color for input text (nick name)@*
Type: color (Curses or Gtk color), default value: 'lightcyan'@*
@item col_input_delimiters
Color for input text (delimiters)@*
Type: color (Curses or Gtk color), default value: 'white'@*
Type: color (Curses or Gtk color), default value: 'cyan'@*
@item col_input_bg
Background for input window@*
Type: color (Curses or Gtk color), default value: 'default'@*
@@ -602,6 +599,12 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@item irc_highlight
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@*
Type: string (any string), default value: ''@*
@item irc_colors_receive
Keep colors from incoming messages@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item irc_colors_send
Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)@*
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
@item dcc_auto_accept_files
Automatically accept incoming dcc files@*
Type: boolean (values: 'on' or 'off'), default value: 'off'@*
@@ -1829,15 +1832,17 @@ void *handler_pointer)}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent to
WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent to
other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@@ -1886,10 +1891,12 @@ file: %s", (arguments) ? arguments : "none");}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{PLUGIN_RC_KO or -1}: function failed
@item @option{PLUGIN_RC_OK or 0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@@ -2209,204 +2216,74 @@ void weechat_plugin_end (t_weechat_plugin *plugin)
Three plugins are provided with WeeChat to load scripts: Perl,
Python and Ruby.
@subsection Perl scripts
@subsection Load/unload scripts
@subsubsection Carregar/Descarregar Scripts Perl
Perl scripts are loaded and unloaded with @command{/perl},
@command{/python} and @command{/ruby} commands.
(type @kbd{/help} within WeeChat to get help about commands).@*
Os Scripts Perl s@~ao carregados e descarregados com o comando @command{/perl}.
(escreve @kbd{/help perl} dentro do WeeChat para obteres ajuda acerca do comando).@*
@emph{Exemplos:}@*
@emph{Examples:}@*
@itemize @bullet
@item
Carregar um Script Perl: @kbd{/perl load /tmp/sample.pl}@*
Load a Perl script: @kbd{/perl load /tmp/sample.pl}@*
@item
Descarregar todos os Scripts Perl: @kbd{/perl unload}@*
Unload all Perl scripts: @kbd{/perl unload}@*
@item
Listar todos os Scripts Perl: @kbd{/perl}@*
List all Perl scripts: @kbd{/perl}@*
@item
Load a Python script: @kbd{/python load /tmp/sample.py}@*
@item
Unload all Python scripts: @kbd{/python unload}@*
@item
List all Python scripts: @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Perl
@subsection WeeChat / Scripts API
@itemize @bullet
@item
@command{weechat::register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
Perl: @command{weechat::register ( name, version, shutdown_function,
description );}@*
Python: @command{weechat.register ( name, version, shutdown_function,
description )}@*
@*
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Perl.@*
Todos os Scripts Perl para o Weechat devem invocar esta fun@,{c}@~ao.@*
This is first function to call in script.@*
All scripts for WeeChat should call this function.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome @'unico que indentifique o script (cada Script Perl deve ter um @'unico nome)
@item @option{vers@~ao}: vers@~ao do script
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Perl invocada quando o script é descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
@item @option{name}: unique name to identify script (each script must have
unique name)
@item @option{version}: script's version
@item @option{shutdown_function}: function called when script is
unloaded (optional parameter, empty string means nothing is called at the end)
@item @option{description}: short description of script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample script!");}@*
@code{weechat::register ("sample", "1.0", "sample_end", "Sample
script!");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample
script!")}@*
@*
@item
@command{weechat::print ( mensagem, [canal, [servidor]] );}@*
Perl: @command{weechat::print ( message, [channel, [server]] );}@*
Python: @command{weechat.prnt ( message, [channel, [server]] )}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{mensagem}: mensagem a mostrar
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplos:}@*
@*
@code{weechat::print ("mensagem");}@*
@code{weechat::print ("mensagem", "#weechat");}@*
@code{weechat::print ("mensagem", "#weechat", "freenode");}@*
@*
@item
@command{weechat::print_infobar ( atrasa, mensagem );}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::print_infobar (5, "mensagem");}@*
@*
@item
@command{weechat::add_message_handler ( nome, fun@,{c}@~ao );}@*
@*
Anexa uma fun@,{c}@~ao Perl a uma mensagem de IRC.@*
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome da mensagem IRC@*
Para conheceres uma lista de mensagens de IRC, por favor lê o RFC 1459 e/ou o 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl invocada quando a mensagem é recebida
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",@@_[0],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat::add_command_handler ( nome, fun@,{c}@~ao );}@*
@*
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Perl.@*
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome do novo comando@*
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Perl. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Perl.
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Perl ligada ao comando
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
(displayed by /help command)
@item @option{arguments_description}: long description of command
arguments (displayed by /help command)
@end itemize
@*
@emph{Return value:}@*
@*
1 if Perl function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Argumentos: ".@@_[0]);}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@end itemize
@*
@item
@command{weechat::remove_handler ( name, function );}@*
@*
Remove a message or command handler.@*
Print message in a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Perl function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@item
@command{weechat::command ( command, [channel, [server]] );}@*
@*
Execute a command or send a message to a channel.@*
@emph{Arguments:}
@itemize @minus
@item @option{command}: command to execute (or message to send in a channel)
@item @option{message}: message to display
@item @option{channel}: name of channel
@item @option{server}: internal name of server
@end itemize
@@ -2415,315 +2292,119 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@code{weechat::print ("message");}@*
@code{weechat::print ("message", "#weechat");}@*
@code{weechat::print ("message", "#weechat", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.prnt ("message")}@*
@code{weechat.prnt ("message", "#weechat")}@*
@code{weechat.prnt ("message", "#weechat", "freenode")}@*
@*
@item
@command{weechat::get_info ( nome, [servidor, [canal] ] );}@*
Perl: @command{weechat::print_infobar ( delay, message );}@*
Python: @command{weechat.print_infobar ( delay, message )}@*
@*
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome do info a recuperar:
@itemize @minus
@item @option{version}: comece a vers@~ao de WeeChat
@item @option{nick}: comece o nickname
@item @option{channel}: comece o nome da canal
@item @option{server}: comece o nome do servidor
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nome interno da servidor
@item @option{canal}: nome da canal
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Exemplos:}@*
@*
@code{$version = get_info("version");}@*
@code{$nick = get_info("nick", "freenode");}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
@*
Get DCC list.@*
Returned array has following fields:
@itemize @minus
@item server: IRC server
@item channel: IRC channel
@item type: DCC type:
@itemize @minus
@item 0: chat (received)
@item 1: chat (sent)
@item 2: file (receiving)
@item 3: file (sending)
@end itemize
@item status: DCC status:
@itemize @minus
@item 0: waiting
@item 1: connecting
@item 2: active
@item 3: done
@item 4: failed
@item 5: aborted
@end itemize
@item start_time: date/time of DCC creation
@item start_transfer: date/time of transfer start
@item addr: remote address
@item port: port used for DCC
@item nick: remote nick
@item filename: filename
@item local_filename: local filename
@item size: file size
@item pos: current position in file
@item start_resume: restart position after interruption
@item bytes_per_sec: bytes sent/received per second
@end itemize
@*
@emph{Return value:}@*
@*
DCC list, 0 if error occured.@*
@*
@item
@command{weechat::get_config ( option );}@*
@*
Get WeeChat config option value.@*
Print message in infobar.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@item
@command{weechat::set_config ( option, value );}@*
@*
Get WeeChat config option value.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@item @option{delay}: after this delay (in seconds), message will be erased
(if 0, message will not be erased).
@item @option{message}: message to display
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl example:}@*
@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::print_infobar (5, "message");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.print_infobar (5, "message")}@*
@*
@item
@command{weechat::get_plugin_config ( option );}@*
Perl: @command{weechat::add_message_handler ( name, function );}@*
Python: @command{weechat.add_message_handler ( name, function )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
Attach a script function to an IRC message.@*
Function will be called each time IRC message will be received.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@item
@command{weechat::set_plugin_config ( option, value );}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@code{plugin.script.option=value}@*
Note: plugin and script names are automatically added.@*
@emph{Arguments:}
@itemize @minus
@item @option{option}: name of option
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@end itemize
@subsection Python scripts
@subsubsection Carregar/Descarregar Scripts Python
Os Scripts Python s@~ao carregados e descarregados com o comando @command{/python}.
(escreve @kbd{/help python} dentro do WeeChat para obteres ajuda acerca do comando).@*
@emph{Exemplos:}@*
@itemize @bullet
@item
Carregar um Script Python: @kbd{/python load /tmp/sample.py}@*
@item
Descarregar todos os Scripts Python: @kbd{/python unload}@*
@item
Listar todos os Scripts Python: @kbd{/python}@*
@end itemize
@subsubsection Interface WeeChat / Python
@itemize @bullet
@item
@command{weechat.register ( nome, vers@~ao, fun@,{c}@~ao_de_shutdown, descri@,{c}@~ao );}@*
@*
Esta @'e a primeira fun@,{c}@~ao a invocar num Script Python.@*
Todos os Scripts Python para o Weechat devem invocar esta fun@,{c}@~ao.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome @'unico que indentifique o script (cada Script Python deve ter um @'unico nome)
@item @option{vers@~ao}: vers@~ao do script
@item @option{fun@,{c}@~ao_de_shutdown}: fun@,{c}@~ao Python invocada quando o script é descarregado (par@^ametro opcional, se deixado em branco significa que nada deve ser chamado)
@item @option{descri@,{c}@~ao}: breve descri@,{c}@~ao do script.
@end itemize
@*
@emph{Return value:}@*
@*
1 if script was registered, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat.register ("sample", "1.0", "sample_end", "Sample script!")}@*
@*
@item
@command{weechat.prnt ( mensagem, [canal, [servidor]] )}@*
@*
Imprimne uma mensagem na canal.@*
@emph{Argumentos:}
@itemize @minus
@item @option{mensagem}: mensagem a mostrar
@item @option{canal}: nome da canal
@item @option{servidor}: nome interno da servidor
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplos:}@*
@*
@code{weechat.prnt ("mensagem")}@*
@code{weechat.prnt ("mensagem", "#weechat")}@*
@code{weechat.prnt ("mensagem", "#weechat", "freenode")}@*
@*
@item
@command{weechat.print_infobar ( atrasa, mensagem )}@*
@*
Imprimne uma mensagem na barra do info.@*
@emph{Argumentos:}
@itemize @minus
@item @option{atrasa}: depois que isto atrasa (nos segundos), a mensagem estar@'a apagada
(se 0, mensagem n@~ao forem apagados).
@item @option{mensagem}: mensagem a mostrar
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@*
@code{weechat.print_infobar (5, "mensagem")}@*
@*
@item
@command{weechat.add_message_handler ( nome, fun@,{c}@~ao )}@*
@*
Anexa uma fun@,{c}@~ao Python a uma mensagem de IRC.@*
A fun@,{c}@~ao ser@'a invocada de cada vez que a mensagem IRC for recebida.@*
@emph{Argumentos:}
@itemize @minus
@item @option{nome}: nome da mensagem IRC@*
Para conheceres uma lista de mensagens de IRC, por favor lê o RFC 1459 e/ou o 2812:@*
@item @option{name}: name of IRC message@*
To know list of IRC messages, please refer to RFC 1459 and/or 2812:@*
RFC 1459: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt}@*
RFC 2812: @uref{ftp://ftp.rfc-editor.org/in-notes/rfc2812.txt}
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python invocada quando a mensagem é recebida
@item @option{function}: function called when message is received
@end itemize
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_message_handler ("privmsg", my_function);}@*
@code{sub my_function}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print ("server=$_[0]\n");}@*
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@*
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@*
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_message_handler ("privmsg", my_function)}@*
@code{def my_function(server, args):}@*
@code{@ @ @ @ weechat.prnt("server="+server)}@*
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@*
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", chan="+channel+", msg="+message)}@*
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when message is received has to return one of these values:@*
Function called when message is received has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{1}: message will not be sent to WeeChat
@item @option{2}: message will not be sent to other plugins
@item @option{3}: message will not be sent to WeeChat neither other plugins
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT}: message will not be sent
to WeeChat
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS}: message will not be sent
to other plugins
@item @option{PLUGIN_RC_OK_IGNORE_ALL}: message will not be sent to
WeeChat neither other plugins
@end itemize
@*
@item
@command{weechat.add_command_handler ( nome, fun@,{c}@~ao )}@*
Perl: @command{weechat::add_command_handler ( name, function );}@*
Python: @command{weechat.add_command_handler ( name, function )}@*
@*
Cria um novo comando do Weechat, ligado a uma fun@,{c}@~ao Python.@*
A fun@,{c}@~ao ser@'a chamada quando o utilizador a invocar utilizando @command{/nome}@*
Create new WeeChat command, linked with script function.@*
Function will be called when user will launch command with @kbd{/name}.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome do novo comando@*
Este nome pode pertencer a um comando já existente, o qual ser@'a sobreposto pela fun@,{c}@~ao Python. Tem cuidado quando fizeres isto: os comandos originais não estar@~ao acessiveis antes de teres descarregado o Script Python.
@item @option{fun@,{c}@~ao}: fun@,{c}@~ao Python ligada ao comando
@item @option{name}: name of new command@*
This name may be existing command, so that the command is overrided by
script function. Be careful when overriding WeeChat commands, they'll not be
available until your script will be unloaded.
@item @option{function}: function linked with command
@item @option{description}: command description (displayed by /help
command)
@item @option{arguments}: short description of command arguments
@@ -2734,45 +2415,63 @@ arguments (displayed by /help command)
@*
@emph{Return value:}@*
@*
1 if Python function was attached, 0 if error occured.@*
1 if function was attached, 0 if error occured.@*
@*
@emph{Exemplo:}@*
@emph{Perl example:}@*
@*
@code{weechat::add_command_handler ("command", my_command);}@*
@code{sub my_command}@*
@code{@{ }@*
@code{@ @ @ @ weechat::print("Server: $_[0], arguments: $_[1]\n");}@*
@code{@ @ @ @ return 0;}@*
@code{@} }@*
@*
@emph{Python example:}@*
@*
@code{weechat.add_command_handler ("command", my_command)}@*
@code{def my_command(server, args):}@*
@code{@ @ @ @ weechat.prnt("Servidor:"+server+" Argumentos:"+args)}@*
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@*
@code{@ @ @ @ return 0}@*
@*
@emph{Notes:}@*
@*
Function called when command is executed has to return one of these values:@*
Function called when command is executed has to return one of these
values (prefixed by ``weechat::'' for Perl and ``weechat.'' for
Python):@*
@itemize @minus
@item @option{-1}: function failed
@item @option{0}: function successfully completed
@item @option{PLUGIN_RC_KO}: function failed
@item @option{PLUGIN_RC_OK}: function successfully completed
@end itemize
@*
@item
@command{weechat.remove_handler ( name, function );}@*
Perl: @command{weechat::remove_handler ( name, function );}@*
Python: @command{weechat.remove_handler ( name, function )}@*
@*
Remove a message or command handler.@*
@emph{Arguments:}
@itemize @minus
@item @option{name}: name of IRC message or command handler
@item @option{function}: Python function
@item @option{function}: function
@end itemize
@*
@emph{Return value:}@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.remove_handler ("command", my_command);}@*
@code{weechat::remove_handler ("command", my_command);}@*
@*
@emph{Python example:}@*
@*
@code{weechat.remove_handler ("command", my_command)}@*
@*
@item
@command{weechat.command ( command, [channel, [server]] )}@*
Perl: @command{weechat::command ( command, [channel, [server]] );}@*
Python: @command{weechat.command ( command, [channel, [server]] )}@*
@*
Execute a command or send a message to a channel.@*
@@ -2787,7 +2486,13 @@ Execute a command or send a message to a channel.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat::command ("hello world!");}@*
@code{weechat::command ("/kick toto please leave this chan", "#weechat");}@*
@code{weechat::command ("/nick newnick", "", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.command ("hello world!")}@*
@code{weechat.command ("/kick toto please leave this chan", "#weechat")}@*
@@ -2795,38 +2500,47 @@ Execute a command or send a message to a channel.@*
@*
@item
@command{weechat.get_info ( nome, [servidor] )}@*
Perl: @command{weechat::get_info ( name, [server, [channel] ] );}@*
Python: @command{weechat.get_info ( name, [server, [channel] ] )}@*
@*
Comece o v@'ario info sobre WeeChat, servidor ou usu@'ario.@*
Get various info about WeeChat, server or user.@*
@emph{Argumentos:}
@emph{Arguments:}
@itemize @minus
@item @option{nome}: nome do info a recuperar:
@item @option{name}: name of info to retrieve:
@itemize @minus
@item @option{version}: comece a vers@~ao de WeeChat
@item @option{nick}: comece o nickname
@item @option{channel}: comece o nome da canal
@item @option{server}: comece o nome do servidor
@item @option{version}: get WeeChat version
@item @option{nick}: get nickname
@item @option{channel}: get channel name
@item @option{server}: get server name
@item @option{away}: get ``away'' flag
@item @option{weechat_dir}: get WeeChat home dir
@item @option{weechat_libdir}: get WeeChat system lib dir
@item @option{weechat_sharedir}: get WeeChat system share dir
@end itemize
@item @option{servidor}: nome interno da servidor
@item @option{server}: internal name of server
@item @option{channel}: channel name
@end itemize
@*
@emph{Return value:}@*
@*
Asked info, empty if error occured or info was not found.@*
@*
@emph{Exemplos:}@*
@emph{Perl examples:}@*
@*
@code{$version = weechat::get_info("version");}@*
@code{$nick = weechat::get_info("nick", "freenode");}@*
@*
@emph{Python examples:}@*
@*
@code{$version = weechat.get_info("version")}@*
@code{$nick = weechat.get_info("nick", "freenode")}@*
@*
@item
@command{weechat::get_dcc_info ( );}@*
Perl: @command{weechat::get_dcc_info ( );}@*
Python: @command{weechat.get_dcc_info ( );}@*
@*
Get DCC list.@*
@@ -2869,7 +2583,8 @@ DCC list, 0 if error occured.@*
@*
@item
@command{weechat.get_config ( option );}@*
Perl: @command{weechat::get_config ( option );}@*
Python: @command{weechat.get_config ( option )}@*
@*
Get WeeChat config option value.@*
@@ -2882,14 +2597,20 @@ Get WeeChat config option value.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist");}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin");}@*
@code{$value1 = weechat::get_config ("look_nicklist");}@*
@code{$value2 = weechat::get_config ("freenode.server_autojoin");}@*
@*
@emph{Python examples:}@*
@*
@code{$value1 = weechat.get_config ("look_nicklist")}@*
@code{$value2 = weechat.get_config ("freenode.server_autojoin")}@*
@*
@item
@command{weechat.set_config ( option, value );}@*
Perl: @command{weechat::set_config ( option, value );}@*
Python: @command{weechat.set_config ( option, value )}@*
@*
Get WeeChat config option value.@*
@@ -2903,14 +2624,21 @@ Get WeeChat config option value.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Examples:}@*
@emph{Perl examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off");}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat");}@*
@code{weechat::set_config ("look_nicklist", "off");}@*
@code{weechat::set_config ("freenode.server_autojoin"",
"#weechat");}@*
@*
@emph{Python examples:}@*
@*
@code{weechat.set_config ("look_nicklist", "off")}@*
@code{weechat.set_config ("freenode.server_autojoin"", "#weechat")}@*
@*
@item
@command{weechat.get_plugin_config ( option );}@*
Perl: @command{weechat::get_plugin_config ( option );}@*
Python: @command{weechat.get_plugin_config ( option )}@*
@*
Return value of a plugin option.@*
Option is read from file ~/.weechat/plugins.rc and is like:@*
@@ -2926,13 +2654,18 @@ Note: plugin and script names are automatically added.@*
@*
Value of option, empty if error occured or option was not found.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var");}@*
@code{$value = weechat::get_plugin_config ("my_var");}@*
@*
@emph{Python example:}@*
@*
@code{$value = weechat.get_plugin_config ("my_var")}@*
@*
@item
@command{weechat.set_plugin_config ( option, value );}@*
Perl: @command{weechat::set_plugin_config ( option, value );}@*
Python: @command{weechat.set_plugin_config ( option, value )}@*
@*
Update value of a plugin option.@*
Option is written in file ~/.weechat/plugins.rc and is like:@*
@@ -2949,17 +2682,17 @@ Note: plugin and script names are automatically added.@*
@*
1 if successful, 0 if error occured.@*
@*
@emph{Example:}@*
@emph{Perl example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value");}@*
@code{weechat::set_plugin_config ("my_var", "value");}@*
@*
@emph{Python example:}@*
@*
@code{weechat.set_plugin_config ("my_var", "value")}@*
@*
@end itemize
@subsection Ruby scripts
N@~AO DESENVOLVIDO!
@c **************************** Autores/Suporte *****************************
+945 -787
View File
File diff suppressed because it is too large Load Diff
+935 -789
View File
File diff suppressed because it is too large Load Diff
+969 -808
View File
File diff suppressed because it is too large Load Diff
+796 -764
View File
File diff suppressed because it is too large Load Diff
+223 -147
View File
@@ -303,7 +303,7 @@ alias_new (char *alias_name, char *alias_command)
if (!weelist_search (index_commands, alias_command))
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s target command \"%s\" does not exist!\n"),
gui_printf (NULL, _("%s target command \"/%s\" does not exist!\n"),
WEECHAT_ERROR, alias_command);
return NULL;
}
@@ -689,7 +689,7 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
{
t_irc_nick *ptr_nick;
int plugin_args_length;
char *plugin_args;
char *command_with_colors, *command_with_colors2, *plugin_args;
if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n'))
return;
@@ -709,28 +709,37 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
if (server && (!BUFFER_IS_SERVER(buffer)))
{
command_with_colors = (cfg_irc_colors_send) ?
(char *)gui_color_encode ((unsigned char *)command) : NULL;
if (CHANNEL(buffer)->dcc_chat)
dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat),
"%s\r\n", command);
"%s\r\n",
(command_with_colors) ? command_with_colors : command);
else
server_sendf (server, "PRIVMSG %s :%s\r\n",
CHANNEL(buffer)->name, command);
CHANNEL(buffer)->name,
(command_with_colors) ?
command_with_colors : command);
command_with_colors2 = (command_with_colors) ?
(char *)gui_color_decode ((unsigned char *)command_with_colors, 1) : NULL;
if (CHANNEL(buffer)->type == CHAT_PRIVATE)
{
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (CHANNEL(buffer)->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", command);
gui_printf_type (CHANNEL(buffer)->buffer,
MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (CHANNEL(buffer)->buffer,
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(command_with_colors2) ?
command_with_colors2 : command);
}
else
{
@@ -739,8 +748,10 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
{
irc_display_nick (CHANNEL(buffer)->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color (CHANNEL(buffer)->buffer,
COLOR_WIN_CHAT, "%s\n", command);
gui_printf (CHANNEL(buffer)->buffer,
"%s\n",
(command_with_colors2) ?
command_with_colors2 : command);
}
else
{
@@ -751,6 +762,11 @@ user_command (t_irc_server *server, t_gui_buffer *buffer, char *command)
}
}
if (command_with_colors)
free (command_with_colors);
if (command_with_colors2)
free (command_with_colors2);
/* sending a copy of the message as PRIVMSG to plugins because irc server doesn't */
plugin_args_length = strlen ("localhost PRIVMSG :") +
strlen (CHANNEL(buffer)->name) + strlen(command) + 16;
@@ -810,6 +826,13 @@ weechat_cmd_alias (char *arguments)
WEECHAT_ERROR, "alias");
return -1;
}
if (arguments[0] == '/')
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s alias can not start with \"/\"\n"),
WEECHAT_ERROR, "alias");
return -1;
}
if (!alias_new (arguments, pos))
return -1;
if (weelist_add (&index_commands, &last_index_command, arguments))
@@ -845,8 +868,10 @@ weechat_cmd_alias (char *arguments)
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
gui_printf (NULL, " %s => %s\n",
gui_printf (NULL, " %s %s=>%s %s\n",
ptr_alias->alias_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_alias->alias_command + 1);
}
}
@@ -867,38 +892,32 @@ void
weechat_cmd_buffer_display_info (t_gui_buffer *buffer)
{
if (buffer->dcc)
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "DCC\n");
gui_printf (NULL, "%sDCC\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
else if (BUFFER_IS_SERVER (buffer))
{
gui_printf (NULL, _("Server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s\n", SERVER(buffer)->name);
}
gui_printf (NULL, _("%sServer: %s%s\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name);
else if (BUFFER_IS_CHANNEL (buffer))
{
gui_printf (NULL, _("Channel: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", CHANNEL(buffer)->name);
gui_printf (NULL, _(" (server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", SERVER(buffer)->name);
gui_printf (NULL, ")\n");
}
gui_printf (NULL, _("%sChannel: %s%s %s(server: %s%s%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
CHANNEL(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT));
else if (BUFFER_IS_PRIVATE (buffer))
{
gui_printf (NULL, _("Private with: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK,
"%s", CHANNEL(buffer)->name);
gui_printf (NULL, _(" (server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", SERVER(buffer)->name);
gui_printf (NULL, ")\n");
}
gui_printf (NULL, _("%sPrivate with: %s%s %s(server: %s%s%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
CHANNEL(buffer)->name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
SERVER(buffer)->name);
else
{
gui_printf (NULL, _("not connected"));
gui_printf (NULL, "\n");
}
gui_printf (NULL, _("not connected\n"));
}
/*
@@ -924,10 +943,11 @@ weechat_cmd_buffer (int argc, char **argv)
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", ptr_buffer->number);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
gui_printf (NULL, "%s[%s%d%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_buffer->number,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_buffer_display_info (ptr_buffer);
}
}
@@ -1314,9 +1334,10 @@ weechat_cmd_help (int argc, char **argv)
gui_printf (NULL, _("%s internal commands:\n"), PACKAGE_NAME);
for (i = 0; weechat_commands[i].command_name; i++)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
weechat_commands[i].command_name);
gui_printf (NULL, " - %s\n",
gui_printf (NULL, " %s%s %s- %s\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
weechat_commands[i].command_name,
GUI_COLOR(COLOR_WIN_CHAT),
_(weechat_commands[i].command_description));
}
gui_printf (NULL, "\n");
@@ -1325,9 +1346,10 @@ weechat_cmd_help (int argc, char **argv)
{
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
irc_commands[i].command_name);
gui_printf (NULL, " - %s\n",
gui_printf (NULL, " %s%s %s- %s\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
irc_commands[i].command_name,
GUI_COLOR(COLOR_WIN_CHAT),
_(irc_commands[i].command_description));
}
}
@@ -1342,11 +1364,13 @@ weechat_cmd_help (int argc, char **argv)
{
if (ptr_handler->type == HANDLER_COMMAND)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
ptr_handler->command);
gui_printf (NULL, " %s%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_handler->command);
if (ptr_handler->description
&& ptr_handler->description[0])
gui_printf (NULL, " - %s",
gui_printf (NULL, " %s- %s",
GUI_COLOR(COLOR_WIN_CHAT),
ptr_handler->description);
gui_printf (NULL, "\n");
}
@@ -1361,11 +1385,13 @@ weechat_cmd_help (int argc, char **argv)
{
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, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
weechat_commands[i].command_name);
if (weechat_commands[i].arguments &&
weechat_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_(weechat_commands[i].arguments));
else
gui_printf (NULL, "\n");
@@ -1387,11 +1413,13 @@ weechat_cmd_help (int argc, char **argv)
{
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, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
irc_commands[i].command_name);
if (irc_commands[i].arguments &&
irc_commands[i].arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_(irc_commands[i].arguments));
else
gui_printf (NULL, "\n");
@@ -1418,11 +1446,13 @@ weechat_cmd_help (int argc, char **argv)
{
gui_printf (NULL, "\n");
gui_printf (NULL, "[p]");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " /%s",
ptr_handler->command);
gui_printf (NULL, " %s/%s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_handler->command);
if (ptr_handler->arguments &&
ptr_handler->arguments[0])
gui_printf (NULL, " %s\n",
gui_printf (NULL, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
ptr_handler->arguments);
else
gui_printf (NULL, "\n");
@@ -1456,17 +1486,27 @@ void
weechat_cmd_ignore_display (char *text, t_irc_ignore *ptr_ignore)
{
if (text)
gui_printf (NULL, "%s ", text);
gui_printf (NULL, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT),
text);
gui_printf (NULL, _("on"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s", ptr_ignore->server_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "/");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->channel_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
gui_printf (NULL, _(" ignoring "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", ptr_ignore->type);
gui_printf (NULL, _(" from "));
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s\n", ptr_ignore->mask);
gui_printf (NULL, "%s%s %s%s%s/%s%s%s:%s%s%s%s%s%s%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
_("on"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->server_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->channel_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
_(" ignoring "),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_ignore->type,
GUI_COLOR(COLOR_WIN_CHAT),
_(" from "),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_ignore->mask);
}
/*
@@ -1493,9 +1533,11 @@ weechat_cmd_ignore (int argc, char **argv)
ptr_ignore = ptr_ignore->next_ignore)
{
i++;
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", i);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
gui_printf (NULL, "%s[%s%d%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
i,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_ignore_display (NULL, ptr_ignore);
}
}
@@ -1547,13 +1589,15 @@ weechat_cmd_key_display (t_gui_key *key, int new_key)
expanded_name = gui_key_get_expanded_name (key->key);
if (new_key)
{
gui_printf (NULL, _("New key binding:\n"));
gui_printf (NULL, " %s", (expanded_name) ? expanded_name : key->key);
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("New key binding: %s"),
(expanded_name) ? expanded_name : key->key);
}
else
gui_printf (NULL, " %20s", (expanded_name) ? expanded_name : key->key);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " => ");
gui_printf (NULL, "%s\n",
gui_printf (NULL, "%s => %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
(key->function) ?
gui_key_function_search_by_ptr (key->function) : key->command);
if (expanded_name)
@@ -1592,7 +1636,10 @@ weechat_cmd_key (char *arguments)
while (arguments[0] == ' ')
arguments++;
if (gui_key_unbind (arguments))
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Key \"%s\" unbinded\n"), arguments);
}
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
@@ -1624,6 +1671,7 @@ weechat_cmd_key (char *arguments)
{
gui_key_free_all ();
gui_key_init ();
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Default key bindings restored\n"));
}
else
@@ -1692,8 +1740,10 @@ weechat_cmd_plugin (int argc, char **argv)
{
/* plugin info */
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
gui_printf (NULL, " %s v%s - %s (%s)\n",
gui_printf (NULL, " %s%s%s v%s - %s (%s)\n",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_plugin->name,
GUI_COLOR(COLOR_WIN_CHAT),
ptr_plugin->version,
ptr_plugin->description,
ptr_plugin->filename);
@@ -1904,13 +1954,14 @@ weechat_cmd_server (int argc, char **argv)
}
}
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
" %s ", server_found->name);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("has been deleted\n"));
server_free (server_found);
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf (NULL, _("Server %s%s%s has been deleted\n"),
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
server_found->name,
GUI_COLOR(COLOR_WIN_CHAT));
gui_redraw_buffer (gui_current_window->buffer);
return 0;
@@ -2051,10 +2102,10 @@ weechat_cmd_server (int argc, char **argv)
if (new_server)
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server"));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
" %s ", server.name);
gui_printf_color (NULL, COLOR_WIN_CHAT, _("created\n"));
gui_printf (NULL, _("Server %s%s%s created\n"),
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
server.name,
GUI_COLOR(COLOR_WIN_CHAT));
}
else
{
@@ -2086,11 +2137,11 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
{
char *color_name, *pos_nickserv, *pos_pwd, *value2;
gui_printf (NULL, " %s%s%s",
gui_printf (NULL, " %s%s%s%s = ",
(prefix) ? prefix : "",
(prefix) ? "." : "",
option->option_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " = ");
option->option_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
@@ -2101,21 +2152,25 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", (*((int *)value)) ? "ON" : "OFF");
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
(*((int *)value)) ? "ON" : "OFF");
break;
case OPTION_TYPE_INT:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%d\n", *((int *)value));
gui_printf (NULL, "%s%d\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
*((int *)value));
break;
case OPTION_TYPE_INT_WITH_STRING:
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", option->array_values[*((int *)value)]);
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
option->array_values[*((int *)value)]);
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST,
"%s\n", (color_name) ? color_name : _("(unknown)"));
color_name = gui_get_color_name (*((int *)value));
gui_printf (NULL, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
(color_name) ? color_name : _("(unknown)"));
break;
case OPTION_TYPE_STRING:
if (*((char **)value))
@@ -2138,9 +2193,12 @@ weechat_cmd_set_display_option (t_config_option *option, char *prefix, void *val
pos_pwd[0] = '*';
pos_pwd++;
}
gui_printf (NULL, _("(password hidden) "));
gui_printf (NULL, _("%s(password hidden) "),
GUI_COLOR(COLOR_WIN_CHAT));
}
gui_printf_color (NULL, COLOR_WIN_CHAT_HOST, "%s", value2);
gui_printf (NULL, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HOST),
value2);
free (value2);
}
gui_printf (NULL, "\n");
@@ -2210,12 +2268,14 @@ weechat_cmd_set (char *arguments)
switch (config_set_server_value (ptr_server, pos + 1, value))
{
case 0:
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",
ptr_server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s %s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[CONFIG_SECTION_SERVER].section_name,
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
ptr_server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
if (strcmp (weechat_options[CONFIG_SECTION_SERVER][i].option_name, pos + 1) == 0)
@@ -2262,10 +2322,12 @@ weechat_cmd_set (char *arguments)
if (config_option_set_value (ptr_option, value) == 0)
{
(void) (ptr_option->handler_change());
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");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_get_section (ptr_option),
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_set_display_option (ptr_option, NULL, NULL);
}
else
@@ -2304,11 +2366,12 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s",
config_sections[i].section_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[i].section_name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
section_displayed = 1;
}
weechat_cmd_set_display_option (&weechat_options[i][j], NULL, NULL);
@@ -2334,12 +2397,14 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
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",
ptr_server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf (NULL, "\n");
gui_printf (NULL, "%s[%s%s %s%s%s]\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
config_sections[CONFIG_SECTION_SERVER].section_name,
GUI_COLOR(COLOR_WIN_CHAT_SERVER),
ptr_server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
section_displayed = 1;
}
ptr_option_value = config_get_server_option_ptr (ptr_server,
@@ -2369,7 +2434,9 @@ weechat_cmd_set (char *arguments)
if ((number_found == 1) && (last_section >= 0) && (last_option >= 0))
{
gui_printf (NULL, "\n");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, _("Detail:\n"));
gui_printf (NULL, _("%sDetail:\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
gui_printf (NULL, GUI_COLOR(COLOR_WIN_CHAT_CHANNEL));
switch (weechat_options[last_section][last_option].option_type)
{
case OPTION_TYPE_BOOLEAN:
@@ -2419,7 +2486,11 @@ weechat_cmd_set (char *arguments)
}
else
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
gui_printf (NULL, "\n");
gui_printf (NULL, "%s%d %s",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
number_found,
GUI_COLOR(COLOR_WIN_CHAT));
if (option)
gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
option);
@@ -2506,7 +2577,10 @@ weechat_cmd_unignore (int argc, char **argv)
if (ret)
{
irc_display_prefix (NULL, NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", ret);
gui_printf (NULL, "%s%d%s ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ret,
GUI_COLOR(COLOR_WIN_CHAT));
if (ret > 1)
gui_printf (NULL, _("ignore were removed.\n"));
else
@@ -2545,17 +2619,19 @@ weechat_cmd_window (int argc, char **argv)
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", i);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] (");
gui_printf (NULL, "%d", ptr_win->win_x);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ":");
gui_printf (NULL, "%d", ptr_win->win_y);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ";");
gui_printf (NULL, "%d", ptr_win->win_width);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "x");
gui_printf (NULL, "%d", ptr_win->win_height);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, ") ");
gui_printf (NULL, "%s[%s%d%s] (%s%d:%d%s;%s%dx%d%s) ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
i,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_win->win_x,
ptr_win->win_y,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
ptr_win->win_width,
ptr_win->win_height,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
weechat_cmd_buffer_display_info (ptr_win->buffer);
+1 -1
View File
@@ -425,7 +425,7 @@ completion_build_list (t_completion *completion, void *channel)
weelist_add (&completion->completion_list,
&completion->last_completion,
(option_value) ?
gui_get_color_by_value (*((int *)(option_value))) :
gui_get_color_name (*((int *)(option_value))) :
option->default_string);
break;
case OPTION_TYPE_STRING:
-22
View File
@@ -72,28 +72,6 @@ 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
*/
+38 -19
View File
@@ -169,6 +169,7 @@ void
wee_log_printf (char *message, ...)
{
static char buffer[4096];
char *ptr_buffer;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
@@ -180,6 +181,17 @@ wee_log_printf (char *message, ...)
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
/* keep only valid chars */
ptr_buffer = buffer;
while (ptr_buffer[0])
{
if ((ptr_buffer[0] != '\n')
&& (ptr_buffer[0] != '\r')
&& ((unsigned char)(ptr_buffer[0]) < 32))
ptr_buffer[0] = '.';
ptr_buffer++;
}
seconds = time (NULL);
date_tmp = localtime (&seconds);
if (date_tmp)
@@ -667,35 +679,42 @@ weechat_welcome_message ()
{
if (cfg_look_startup_logo)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
" ___ __ ______________ _____ \n"
" __ | / /___________ ____/__ /_______ __ /_\n"
" __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
" __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
" ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n");
gui_printf (NULL,
"%s ___ __ ______________ _____ \n"
"%s __ | / /___________ ____/__ /_______ __ /_\n"
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ \n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
GUI_COLOR(COLOR_WIN_CHAT_NICK));
}
if (cfg_look_weechat_slogan && cfg_look_weechat_slogan[0])
{
gui_printf_color (NULL, COLOR_WIN_CHAT, _("%sWelcome to "),
(cfg_look_startup_logo) ? " " : "");
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2, PACKAGE_NAME);
gui_printf_color (NULL, COLOR_WIN_CHAT,
", %s\n", cfg_look_weechat_slogan);
gui_printf (NULL, _("%sWelcome to %s%s%s, %s\n"),
(cfg_look_startup_logo) ? " " : "",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
PACKAGE_NAME,
GUI_NO_COLOR,
cfg_look_weechat_slogan);
}
if (cfg_look_startup_version)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX2,
"%s" PACKAGE_STRING,
(cfg_look_startup_logo) ? " " : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
", %s %s %s\n",
_("compiled on"), __DATE__, __TIME__);
gui_printf (NULL, "%s%s%s%s, %s %s %s\n",
(cfg_look_startup_logo) ? " " : "",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
PACKAGE_STRING,
GUI_NO_COLOR,
_("compiled on"), __DATE__, __TIME__);
}
if (cfg_look_startup_logo ||
(cfg_look_weechat_slogan && cfg_look_weechat_slogan[0]) ||
cfg_look_startup_version)
gui_printf_color (NULL, COLOR_WIN_CHAT_PREFIX1,
"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
gui_printf (NULL,
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK));
wee_log_printf ("%s (%s %s %s)\n",
PACKAGE_STRING, _("compiled on"), __DATE__, __TIME__);
+14 -8
View File
@@ -77,7 +77,6 @@ char *cfg_look_buffer_timestamp;
int cfg_look_color_nicks;
int cfg_look_color_nicks_number;
int cfg_look_color_actions;
int cfg_look_remove_colors_from_msgs;
int cfg_look_nicklist;
int cfg_look_nicklist_position;
char *cfg_look_nicklist_position_values[] =
@@ -154,10 +153,6 @@ t_config_option weechat_options_look[] =
N_("display actions with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_actions, NULL, config_change_noop },
{ "look_remove_colors_from_msgs", N_("remove colors from incoming messages"),
N_("remove colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_remove_colors_from_msgs, NULL, config_change_noop },
{ "look_nicklist", N_("display nicklist window"),
N_("display nicklist window (for channel windows)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
@@ -435,7 +430,7 @@ t_config_option weechat_options_colors[] =
{ "col_input_delimiters", N_("color for input text (delimiters)"),
N_("color for input text (delimiters)"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_input_delimiters, NULL, &config_change_color },
"cyan", NULL, &cfg_col_input_delimiters, NULL, &config_change_color },
{ "col_input_bg", N_("background for input window"),
N_("background for input window"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -637,6 +632,8 @@ int cfg_irc_lag_min_show;
int cfg_irc_lag_disconnect;
int cfg_irc_fifo_pipe;
char *cfg_irc_highlight;
int cfg_irc_colors_receive;
int cfg_irc_colors_send;
t_config_option weechat_options_irc[] =
{ { "irc_display_away", N_("display message to all channels when away"),
@@ -684,6 +681,15 @@ t_config_option weechat_options_irc[] =
"words may begin or end with \"*\" for partial match)"),
OPTION_TYPE_STRING, 0, 0, 0,
"", NULL, NULL, &cfg_irc_highlight, &config_change_noop },
{ "irc_colors_receive", N_("keep colors from incoming messages"),
N_("keep colors from incoming messages"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_receive, NULL, config_change_noop },
{ "irc_colors_send", N_("allow user to send colors"),
N_("allow user to send colors with special codes (%B=bold, %Cxx,yy=color, "
"%U=underline, %R=reverse)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
@@ -1043,7 +1049,7 @@ config_change_color ()
{
t_gui_window *ptr_win;
gui_init_colors ();
gui_rebuild_weechat_colors ();
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
gui_redraw_buffer (ptr_win->buffer);
}
@@ -2072,7 +2078,7 @@ config_write (char *config_name)
fprintf (file, "%s=%s\n",
weechat_options[i][j].option_name,
(weechat_options[i][j].ptr_int) ?
gui_get_color_by_value (*weechat_options[i][j].ptr_int) :
gui_get_color_name (*weechat_options[i][j].ptr_int) :
weechat_options[i][j].default_string);
break;
case OPTION_TYPE_STRING:
+2 -1
View File
@@ -92,7 +92,6 @@ extern char *cfg_look_buffer_timestamp;
extern int cfg_look_color_nicks;
extern int cfg_look_color_nicks_number;
extern int cfg_look_color_actions;
extern int cfg_look_remove_colors_from_msgs;
extern int cfg_look_nicklist;
extern int cfg_look_nicklist_position;
extern int cfg_look_nicklist_min_size;
@@ -189,6 +188,8 @@ extern int cfg_irc_lag_min_show;
extern int cfg_irc_lag_disconnect;
extern int cfg_irc_fifo_pipe;
extern char *cfg_irc_highlight;
extern int cfg_irc_colors_receive;
extern int cfg_irc_colors_send;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;
File diff suppressed because it is too large Load Diff
+340 -107
View File
@@ -31,6 +31,7 @@
#include <string.h>
#include <signal.h>
#include <time.h>
#include <ctype.h>
#include "../common/weechat.h"
#include "gui.h"
@@ -302,19 +303,12 @@ gui_buffer_clear (t_gui_buffer *buffer)
{
t_gui_window *ptr_win;
t_gui_line *ptr_line;
t_gui_message *ptr_message;
while (buffer->lines)
{
ptr_line = buffer->lines->next_line;
while (buffer->lines->messages)
{
ptr_message = buffer->lines->messages->next_message;
if (buffer->lines->messages->message)
free (buffer->lines->messages->message);
free (buffer->lines->messages);
buffer->lines->messages = ptr_message;
}
if (buffer->lines->data)
free (buffer->lines->data);
free (buffer->lines);
buffer->lines = ptr_line;
}
@@ -351,47 +345,6 @@ gui_buffer_clear_all ()
gui_buffer_clear (ptr_buffer);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos, *buf2;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
buf2 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buffer);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buf2);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("Not enough memory for infobar message\n"));
free (buf2);
}
/*
* gui_window_free: delete a window
*/
@@ -415,25 +368,6 @@ gui_window_free (t_gui_window *window)
free (window);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
}
}
/*
* gui_line_free: delete a line from a buffer
*/
@@ -442,8 +376,7 @@ void
gui_line_free (t_gui_line *line)
{
t_gui_window *ptr_win;
t_gui_message *ptr_message;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->start_line == line)
@@ -452,14 +385,8 @@ gui_line_free (t_gui_line *line)
ptr_win->start_line_pos = 0;
}
}
while (line->messages)
{
ptr_message = line->messages->next_message;
if (line->messages->message)
free (line->messages->message);
free (line->messages);
line->messages = ptr_message;
}
if (line->data)
free (line->data);
free (line);
}
@@ -566,8 +493,7 @@ gui_new_line (t_gui_buffer *buffer)
new_line->log_write = 1;
new_line->line_with_message = 0;
new_line->line_with_highlight = 0;
new_line->messages = NULL;
new_line->last_message = NULL;
new_line->data = NULL;
if (!buffer->lines)
buffer->lines = new_line;
else
@@ -602,30 +528,345 @@ gui_new_line (t_gui_buffer *buffer)
}
/*
* gui_new_message: create a new message for last line of a buffer
* gui_word_strlen: returns length of a word
* special chars like color, bold, .. are ignored
*/
t_gui_message *
gui_new_message (t_gui_buffer *buffer)
int
gui_word_strlen (t_gui_window *window, char *string)
{
t_gui_message *new_message;
int length;
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
length = 0;
while (string && string[0])
{
if (!buffer->last_line->messages)
buffer->last_line->messages = new_message;
else
buffer->last_line->last_message->next_message = new_message;
new_message->prev_message = buffer->last_line->last_message;
new_message->next_message = NULL;
buffer->last_line->last_message = new_message;
string = gui_word_get_next_char (window, (unsigned char *)string, 0);
if (string)
length++;
}
return length;
}
/*
* gui_word_real_pos: get real position in string (ignoring color/bold/.. chars)
*/
int
gui_word_real_pos (t_gui_window *window, char *string, int pos)
{
char *saved_pos;
int real_pos;
if (pos <= 0)
return 0;
real_pos = 0;
while (string && string[0] && (pos > 0))
{
saved_pos = string;
string = gui_word_get_next_char (window, (unsigned char *)string, 0);
pos--;
if (string)
real_pos += (string - saved_pos);
}
return real_pos;
}
/*
* gui_add_to_line: add a message to last line of buffer
*/
void
gui_add_to_line (t_gui_buffer *buffer, int type, char *message)
{
char *pos;
int length;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (buffer->line_complete)
{
buffer->line_complete = 0;
if (!gui_new_line (buffer))
return;
}
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
buffer->line_complete = 1;
}
if (buffer->last_line->data)
{
buffer->last_line->data = (char *) realloc (buffer->last_line->data,
strlen (buffer->last_line->data) +
strlen (message) + 1);
strcat (buffer->last_line->data, message);
}
else
buffer->last_line->data = strdup (message);
length = gui_word_strlen (NULL, message);
buffer->last_line->length += length;
if (type & MSG_TYPE_MSG)
buffer->last_line->line_with_message = 1;
if (type & MSG_TYPE_HIGHLIGHT)
buffer->last_line->line_with_highlight = 1;
if ((type & MSG_TYPE_TIME) || (type & MSG_TYPE_NICK) || (type & MSG_TYPE_PREFIX))
buffer->last_line->length_align += length;
if (type & MSG_TYPE_NOLOG)
buffer->last_line->log_write = 0;
if (pos)
{
wee_log_printf (_("Not enough memory for new message\n"));
return NULL;
pos[0] = '\n';
if (buffer->num_displayed > 0)
gui_draw_buffer_chat (buffer, 0);
if (gui_add_hotlist && (buffer->num_displayed == 0))
{
if (3 - buffer->last_line->line_with_message -
buffer->last_line->line_with_highlight <=
buffer->notify_level)
{
if (buffer->last_line->line_with_highlight)
hotlist_add (HOTLIST_HIGHLIGHT, buffer);
else if (BUFFER_IS_PRIVATE(buffer) && (buffer->last_line->line_with_message))
hotlist_add (HOTLIST_PRIVATE, buffer);
else if (buffer->last_line->line_with_message)
hotlist_add (HOTLIST_MSG, buffer);
else
hotlist_add (HOTLIST_LOW, buffer);
gui_draw_buffer_status (gui_current_window->buffer, 1);
}
}
}
if (buffer->line_complete && buffer->log_file && buffer->last_line->log_write)
{
log_write (buffer, buffer->last_line->data);
log_write (buffer, "\n");
}
}
/*
* gui_printf_internal: display a message in a buffer
* This function should NEVER be called directly.
* You should use macros defined in gui.h
*/
void
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *message, ...)
{
static char buf[8192];
char text_time[1024];
char text_time_char[2];
time_t time_seconds;
struct tm *local_time;
int time_first_digit, time_last_digit;
char *pos, *buf2;
int i;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
if (gui_init_ok)
{
if (buffer == NULL)
{
type |= MSG_TYPE_NOLOG;
if (SERVER(gui_current_window->buffer))
buffer = SERVER(gui_current_window->buffer)->buffer;
else
buffer = gui_current_window->buffer;
if (!buffer || buffer->dcc)
buffer = gui_buffers;
}
if (buffer == NULL)
{
wee_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, "
"please send to developers - thanks\n");
return;
}
if (buffer->dcc)
buffer = gui_buffers;
if (buffer->dcc)
return;
}
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
if (!buf[0])
return;
if (!local_utf8 || !utf8_is_valid (buf))
buf2 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buf);
else
buf2 = strdup (buf);
if (gui_init_ok)
{
seconds = time (NULL);
date_tmp = localtime (&seconds);
pos = buf2 - 1;
while (pos)
{
if (display_time
&& cfg_look_buffer_timestamp && cfg_look_buffer_timestamp[0]
&& ((!buffer->last_line) || (buffer->line_complete)))
{
time_seconds = time (NULL);
local_time = localtime (&time_seconds);
strftime (text_time, sizeof (text_time), cfg_look_buffer_timestamp, local_time);
time_first_digit = -1;
time_last_digit = -1;
i = 0;
while (text_time[i])
{
if (isdigit (text_time[i]))
{
if (time_first_digit == -1)
time_first_digit = i;
time_last_digit = i;
}
i++;
}
text_time_char[1] = '\0';
i = 0;
while (text_time[i])
{
text_time_char[0] = text_time[i];
if (time_first_digit < 0)
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if ((i < time_first_digit) || (i > time_last_digit))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
if (isdigit (text_time[i]))
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
else
{
gui_add_to_line (buffer, MSG_TYPE_TIME,
GUI_COLOR(COLOR_WIN_CHAT_TIME_SEP));
gui_add_to_line (buffer, MSG_TYPE_TIME, text_time_char);
}
}
}
i++;
}
gui_add_to_line (buffer, MSG_TYPE_TIME, GUI_COLOR(COLOR_WIN_CHAT));
gui_add_to_line (buffer, MSG_TYPE_TIME, " ");
}
gui_add_to_line (buffer, type, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
}
else
printf ("%s", buf2);
free (buf2);
}
/*
* gui_infobar_printf: display message in infobar
*/
void
gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buffer[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
char *pos, *buf2, *buf3;
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
va_end (argptr);
buf2 = (char *)gui_color_decode ((unsigned char *)buffer, 0);
if (buf2)
{
if (!local_utf8 || !utf8_is_valid (buf2))
buf3 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
buf2);
else
buf3 = strdup (buf2);
}
else
buf3 = NULL;
if (buf3)
{
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
ptr_infobar->color = color;
ptr_infobar->text = strdup (buf3);
pos = strchr (ptr_infobar->text, '\n');
if (pos)
pos[0] = '\0';
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
ptr_infobar->next_infobar = gui_infobar;
gui_infobar = ptr_infobar;
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("Not enough memory for infobar message\n"));
}
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
* gui_infobar_remove: remove last displayed message in infobar
*/
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
if (gui_infobar)
{
new_infobar = gui_infobar->next_infobar;
if (gui_infobar->text)
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
}
return new_message;
}
/*
@@ -1219,9 +1460,7 @@ 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);
@@ -1266,16 +1505,10 @@ gui_buffer_print_log (t_gui_buffer *buffer)
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);
wee_log_printf (" line N-%05d: %s\n",
num,
(ptr_line->data) ? ptr_line->data : "(empty)");
ptr_line = ptr_line->next_line;
}
+147 -94
View File
@@ -26,57 +26,114 @@
#define INPUT_BUFFER_BLOCK_SIZE 256
#define NUM_COLORS 57
#define COLOR_WIN_TITLE 1
#define COLOR_WIN_CHAT 2
#define COLOR_WIN_CHAT_TIME 3
#define COLOR_WIN_CHAT_TIME_SEP 4
#define COLOR_WIN_CHAT_PREFIX1 5
#define COLOR_WIN_CHAT_PREFIX2 6
#define COLOR_WIN_CHAT_SERVER 7
#define COLOR_WIN_CHAT_JOIN 8
#define COLOR_WIN_CHAT_PART 9
#define COLOR_WIN_CHAT_NICK 10
#define COLOR_WIN_CHAT_HOST 11
#define COLOR_WIN_CHAT_CHANNEL 12
#define COLOR_WIN_CHAT_DARK 13
#define COLOR_WIN_CHAT_HIGHLIGHT 14
#define COLOR_WIN_STATUS 15
#define COLOR_WIN_STATUS_DELIMITERS 16
#define COLOR_WIN_STATUS_CHANNEL 17
#define COLOR_WIN_STATUS_DATA_MSG 18
#define COLOR_WIN_STATUS_DATA_PRIVATE 19
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 20
#define COLOR_WIN_STATUS_DATA_OTHER 21
#define COLOR_WIN_STATUS_MORE 22
#define COLOR_WIN_INFOBAR 23
#define COLOR_WIN_INFOBAR_DELIMITERS 24
#define COLOR_WIN_INFOBAR_HIGHLIGHT 25
#define COLOR_WIN_INPUT 26
#define COLOR_WIN_INPUT_CHANNEL 27
#define COLOR_WIN_INPUT_NICK 28
#define COLOR_WIN_INPUT_DELIMITERS 29
#define COLOR_WIN_NICK 30
#define COLOR_WIN_NICK_AWAY 31
#define COLOR_WIN_NICK_CHANOWNER 32
#define COLOR_WIN_NICK_CHANADMIN 33
#define COLOR_WIN_NICK_OP 34
#define COLOR_WIN_NICK_HALFOP 35
#define COLOR_WIN_NICK_VOICE 36
#define COLOR_WIN_NICK_MORE 37
#define COLOR_WIN_NICK_SEP 38
#define COLOR_WIN_NICK_SELF 39
#define COLOR_WIN_NICK_PRIVATE 40
#define COLOR_WIN_NICK_FIRST 41
#define COLOR_WIN_NICK_LAST 50
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
#define COLOR_DCC_SELECTED 51
#define COLOR_DCC_WAITING 52
#define COLOR_DCC_CONNECTING 53
#define COLOR_DCC_ACTIVE 54
#define COLOR_DCC_DONE 55
#define COLOR_DCC_FAILED 56
#define COLOR_DCC_ABORTED 57
/* shift ncurses colors for compatibility with colors
in IRC messages (same as other IRC clients) */
#define WEECHAT_COLOR_BLACK COLOR_BLACK
#define WEECHAT_COLOR_RED COLOR_BLUE
#define WEECHAT_COLOR_GREEN COLOR_GREEN
#define WEECHAT_COLOR_YELLOW COLOR_CYAN
#define WEECHAT_COLOR_BLUE COLOR_RED
#define WEECHAT_COLOR_MAGENTA COLOR_MAGENTA
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
#define WEECHAT_COLOR_WHITE COLOR_WHITE
#define COLOR_WIN_NICK_NUMBER 10
typedef enum t_weechat_color t_weechat_color;
enum t_weechat_color
{
COLOR_WIN_TITLE = 0,
COLOR_WIN_CHAT,
COLOR_WIN_CHAT_TIME,
COLOR_WIN_CHAT_TIME_SEP,
COLOR_WIN_CHAT_PREFIX1,
COLOR_WIN_CHAT_PREFIX2,
COLOR_WIN_CHAT_SERVER,
COLOR_WIN_CHAT_JOIN,
COLOR_WIN_CHAT_PART,
COLOR_WIN_CHAT_NICK,
COLOR_WIN_CHAT_HOST,
COLOR_WIN_CHAT_CHANNEL,
COLOR_WIN_CHAT_DARK,
COLOR_WIN_CHAT_HIGHLIGHT,
COLOR_WIN_STATUS,
COLOR_WIN_STATUS_DELIMITERS,
COLOR_WIN_STATUS_CHANNEL,
COLOR_WIN_STATUS_DATA_MSG,
COLOR_WIN_STATUS_DATA_PRIVATE,
COLOR_WIN_STATUS_DATA_HIGHLIGHT,
COLOR_WIN_STATUS_DATA_OTHER,
COLOR_WIN_STATUS_MORE,
COLOR_WIN_INFOBAR,
COLOR_WIN_INFOBAR_DELIMITERS,
COLOR_WIN_INFOBAR_HIGHLIGHT,
COLOR_WIN_INPUT,
COLOR_WIN_INPUT_CHANNEL,
COLOR_WIN_INPUT_NICK,
COLOR_WIN_INPUT_DELIMITERS,
COLOR_WIN_NICK,
COLOR_WIN_NICK_AWAY,
COLOR_WIN_NICK_CHANOWNER,
COLOR_WIN_NICK_CHANADMIN,
COLOR_WIN_NICK_OP,
COLOR_WIN_NICK_HALFOP,
COLOR_WIN_NICK_VOICE,
COLOR_WIN_NICK_MORE,
COLOR_WIN_NICK_SEP,
COLOR_WIN_NICK_SELF,
COLOR_WIN_NICK_PRIVATE,
COLOR_WIN_NICK_1,
COLOR_WIN_NICK_2,
COLOR_WIN_NICK_3,
COLOR_WIN_NICK_4,
COLOR_WIN_NICK_5,
COLOR_WIN_NICK_6,
COLOR_WIN_NICK_7,
COLOR_WIN_NICK_8,
COLOR_WIN_NICK_9,
COLOR_WIN_NICK_10,
COLOR_DCC_SELECTED,
COLOR_DCC_WAITING,
COLOR_DCC_CONNECTING,
COLOR_DCC_ACTIVE,
COLOR_DCC_DONE,
COLOR_DCC_FAILED,
COLOR_DCC_ABORTED,
NUM_COLORS
};
/* attributes in IRC messages for color & style (bold, ..) */
#define GUI_ATTR_BOLD_CHAR '\x02'
#define GUI_ATTR_BOLD_STR "\x02"
#define GUI_ATTR_COLOR_CHAR '\x03'
#define GUI_ATTR_COLOR_STR "\x03"
#define GUI_ATTR_RESET_CHAR '\x0F'
#define GUI_ATTR_RESET_STR "\x0F"
#define GUI_ATTR_FIXED_CHAR '\x11'
#define GUI_ATTR_FIXED_STR "\x11"
#define GUI_ATTR_REVERSE_CHAR '\x12'
#define GUI_ATTR_REVERSE_STR "\x12"
#define GUI_ATTR_REVERSE2_CHAR '\x16'
#define GUI_ATTR_REVERSE2_STR "\x16"
#define GUI_ATTR_ITALIC_CHAR '\x1D'
#define GUI_ATTR_ITALIC_STR "\x1D"
#define GUI_ATTR_UNDERLINE_CHAR '\x1F'
#define GUI_ATTR_UNDERLINE_STR "\x1F"
/* WeeChat internal attributes (should never be in IRC messages) */
#define GUI_ATTR_WEECHAT_COLOR_CHAR '\x19'
#define GUI_ATTR_WEECHAT_COLOR_STR "\x19"
#define GUI_ATTR_WEECHAT_SET_CHAR '\x1A'
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
@@ -85,6 +142,8 @@
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
#define BUFFER_HAS_NICKLIST(buffer) (BUFFER_IS_CHANNEL(buffer))
#define MSG_TYPE_TIME 1
#define MSG_TYPE_PREFIX 2
#define MSG_TYPE_NICK 4
@@ -94,22 +153,16 @@
#define MSG_TYPE_NOLOG 64
#define gui_printf(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, -1, fmt, ##argz)
#define gui_printf_color(buffer, color, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, color, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
gui_printf_internal(buffer, 1, type, -1, fmt, ##argz)
#define gui_printf_type_color(buffer, type, color, fmt, argz...) \
gui_printf_internal(buffer, 1, type, color, fmt, ##argz)
gui_printf_internal(buffer, 1, type, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, -1, fmt, ##argz)
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, fmt, ##argz)
#define NOTIFY_LEVEL_MIN 0
#define NOTIFY_LEVEL_MAX 3
@@ -118,38 +171,14 @@
#define KEY_SHOW_MODE_DISPLAY 1
#define KEY_SHOW_MODE_BIND 2
typedef struct t_gui_message t_gui_message;
struct t_gui_message
{
int type; /* type of message (time, nick, other) */
int color; /* color of message */
char *message; /* message content */
t_gui_message *prev_message; /* link to previous message for line */
t_gui_message *next_message; /* link to next message for line */
};
typedef struct t_gui_line t_gui_line;
struct t_gui_line
{
int length; /* length of the line (in char) */
int length_align; /* alignment length (time or time/nick) */
int log_write; /* = 1 if line will be written to log */
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
t_gui_message *messages; /* messages for the line */
t_gui_message *last_message; /* last message of the line */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};
typedef struct t_gui_color t_gui_color;
struct t_gui_color
{
char *name;
int color;
int foreground; /* foreground color */
int background; /* background color */
int attributes; /* attributes (bold, ..) */
char *string; /* WeeChat color: "\x19??", ?? is #color*/
};
typedef struct t_gui_infobar t_gui_infobar;
@@ -164,6 +193,20 @@ struct t_gui_infobar
t_gui_infobar *next_infobar; /* next message for infobar */
};
typedef struct t_gui_line t_gui_line;
struct t_gui_line
{
int length; /* length of the line (in char) */
int length_align; /* alignment length (time or time/nick) */
int log_write; /* = 1 if line will be written to log */
int line_with_message; /* line contains a message from a user? */
int line_with_highlight; /* line contains highlight */
char *data; /* line content */
t_gui_line *prev_line; /* link to previous line */
t_gui_line *next_line; /* link to next line */
};
typedef struct t_gui_buffer t_gui_buffer;
struct t_gui_buffer
@@ -260,6 +303,11 @@ struct t_gui_window
/* windows for Qt GUI */
/* TODO: declare Qt window */
int current_style_fg;; /* current color used for foreground */
int current_style_bg;; /* current color used for background */
int current_style_attr; /* current attributes (bold, ..) */
int current_color_attr; /* attr sum of last color(s) displayed */
/* DCC */
void *dcc_first; /* first dcc displayed */
void *dcc_selected; /* selected dcc */
@@ -316,6 +364,8 @@ extern int gui_key_grab;
extern int gui_key_grab_count;
extern char *gui_input_clipboard;
extern t_gui_color *gui_color[NUM_COLORS];
/* GUI independent functions: windows & buffers */
extern t_gui_window *gui_window_new (int, int, int, int);
@@ -327,7 +377,9 @@ extern void gui_window_free (t_gui_window *);
extern void gui_infobar_remove ();
extern void gui_buffer_free (t_gui_buffer *, int);
extern t_gui_line *gui_new_line (t_gui_buffer *);
extern t_gui_message *gui_new_message (t_gui_buffer *);
extern int gui_word_strlen (t_gui_window *, char *);
extern int gui_word_real_pos (t_gui_window *, char *, int);
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
extern void gui_exec_action_dcc (t_gui_window *, char *);
extern int gui_insert_string_input (t_gui_window *, char *, int);
@@ -403,11 +455,13 @@ extern void gui_key_free_all ();
/* GUI dependant functions: display */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern char *gui_get_color_name (int);
extern unsigned char *gui_color_decode (unsigned char *, int);
extern unsigned char *gui_color_encode (unsigned char *);
extern int gui_buffer_has_nicklist (t_gui_buffer *);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_buffer_title (t_gui_buffer *, int);
extern char *gui_word_get_next_char (t_gui_window *, unsigned char *, int);
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
extern void gui_draw_buffer_status (t_gui_buffer *, int);
@@ -434,11 +488,10 @@ extern void gui_window_merge_auto (t_gui_window *);
extern void gui_window_merge_all (t_gui_window *);
extern void gui_refresh_screen ();
extern void gui_pre_init (int *, char **[]);
extern void gui_init_colors ();
extern void gui_rebuild_weechat_colors ();
extern void gui_set_window_title ();
extern void gui_init ();
extern void gui_end ();
extern void gui_printf_internal (t_gui_buffer *, int, int, int, char *, ...);
extern void gui_input_default_key_bindings ();
extern void gui_main_loop ();
+1
View File
@@ -384,6 +384,7 @@ t_irc_command irc_commands[] =
{ "375", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "376", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "381", N_("you are now an IRC operator"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "382", N_("rehashing"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "391", N_("server local time"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "401", N_("no such nick/channel"),
"", "", 0, MAX_ARGS, 1, NULL, NULL, irc_cmd_recv_error },
+125 -105
View File
@@ -364,30 +364,26 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
{
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer,
_("DCC: file %s%s%s"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT));
if (ptr_dcc->local_filename)
{
gui_printf (ptr_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
ptr_dcc->local_filename);
gui_printf (ptr_dcc->server->buffer, ")");
}
gui_printf (ptr_dcc->server->buffer,
_(" (local filename: %s%s%s)"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->local_filename,
GUI_COLOR(COLOR_WIN_CHAT));
if (ptr_dcc->type == DCC_FILE_SEND)
gui_printf (ptr_dcc->server->buffer, _(" sent to "));
else
gui_printf (ptr_dcc->server->buffer, _(" received from "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_NICK,
"%s",
ptr_dcc->nick);
gui_printf (ptr_dcc->server->buffer,
(status == DCC_DONE) ? _(": ok!\n") : _(": FAILED\n"));
gui_printf (ptr_dcc->server->buffer, "%s%s%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(status == DCC_DONE) ? _("OK") : _("FAILED"));
}
}
if (status == DCC_ABORTED)
@@ -399,15 +395,17 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
else
ptr_buffer = ptr_dcc->server->buffer;
irc_display_prefix (ptr_dcc->server, ptr_buffer, PREFIX_INFO);
gui_printf (ptr_buffer, _("DCC chat closed with "));
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_NICK,
"%s", ptr_dcc->nick);
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
gui_printf_color (ptr_buffer, COLOR_WIN_CHAT_DARK, ")\n");
gui_printf (ptr_buffer,
_("DCC chat closed with %s%s %s(%s%d.%d.%d.%d%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_dcc->addr >> 24,
(ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff,
ptr_dcc->addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
}
@@ -467,16 +465,17 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
irc_display_prefix (ptr_dcc->server, ptr_dcc->channel->buffer,
PREFIX_INFO);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
_("Connected to "));
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", ptr_dcc->nick);
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
ptr_dcc->addr >> 24, (ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff, ptr_dcc->addr & 0xff);
gui_printf_color (ptr_dcc->channel->buffer, COLOR_WIN_CHAT_DARK, ") ");
gui_printf (ptr_dcc->channel->buffer, _("via DCC chat\n"));
_("Connected to %s%s %s(%s%d.%d.%d.%d%s)%s via DCC chat\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_dcc->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
ptr_dcc->addr >> 24,
(ptr_dcc->addr >> 16) & 0xff,
(ptr_dcc->addr >> 8) & 0xff,
ptr_dcc->addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT));
}
/*
@@ -565,12 +564,11 @@ dcc_accept_resume (t_irc_server *server, char *filename, int port,
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
PREFIX_INFO);
gui_printf (ptr_dcc->server->buffer, _("DCC: file "));
gui_printf_color (ptr_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ",
ptr_dcc->filename);
gui_printf (ptr_dcc->server->buffer, _("resumed at position %u\n"),
gui_printf (ptr_dcc->server->buffer,
_("DCC: file %s%s%s resumed at position %u\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
ptr_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT),
ptr_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
@@ -669,51 +667,70 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
if (type == DCC_FILE_RECV)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Incoming DCC file from "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf (server->buffer, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
gui_printf (server->buffer, ", ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
gui_printf (server->buffer,
_("Incoming DCC file from %s%s%s (%s%d.%d.%d.%d%s)%s: %s%s%s, %s%lu%s bytes\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
addr >> 24,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
size,
GUI_COLOR(COLOR_WIN_CHAT));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_FILE_SEND)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC file to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf (server->buffer, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", filename);
gui_printf (server->buffer, _(" (local filename: "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", local_filename);
gui_printf (server->buffer, "), ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%lu", size);
gui_printf (server->buffer, _(" bytes\n"));
gui_printf (server->buffer,
_("Sending DCC file to %s%s%s: %s%s%s "
"(local filename: %s%s%s), %s%lu%s bytes\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
local_filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
size,
GUI_COLOR(COLOR_WIN_CHAT));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_RECV)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Incoming DCC chat request from "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", nick);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " (");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_HOST,
"%d.%d.%d.%d",
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")\n");
gui_printf (server->buffer,
_("Incoming DCC chat request from %s%s%s "
"(%s%d.%d.%d.%d%s)\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_HOST),
addr >> 24,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
addr & 0xff,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
dcc_redraw (HOTLIST_MSG);
}
if (type == DCC_CHAT_SEND)
{
irc_display_prefix (server, server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("Sending DCC chat request to "));
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s\n", nick);
gui_printf (server->buffer,
_("Sending DCC chat request to %s%s\n"),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick);
dcc_redraw (HOTLIST_MSG);
}
@@ -728,18 +745,15 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
{
irc_display_prefix (new_dcc->server, new_dcc->server->buffer,
PREFIX_INFO);
gui_printf (new_dcc->server->buffer, _("DCC: file "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->filename);
gui_printf (new_dcc->server->buffer, _(" (local filename: "));
gui_printf_color (new_dcc->server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s",
new_dcc->local_filename);
gui_printf (new_dcc->server->buffer, ") ");
gui_printf (new_dcc->server->buffer, _("will be resumed at position %u\n"),
gui_printf (new_dcc->server->buffer,
_("DCC: file %s%s%s (local filename: %s%s%s) "
"will be resumed at position %u\n"),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
new_dcc->filename,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
new_dcc->local_filename,
GUI_COLOR(COLOR_WIN_CHAT),
new_dcc->start_resume);
dcc_redraw (HOTLIST_MSG);
}
@@ -1070,6 +1084,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
{
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
char *ptr_buf_color;
int num_read;
num_read = recv (ptr_dcc->sock, buffer, sizeof (buffer) - 2, 0);
@@ -1120,40 +1135,45 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
if (ptr_buf)
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
cfg_irc_colors_receive);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK));
if (irc_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", ptr_dcc->nick);
gui_printf_type (ptr_dcc->channel->buffer,
MSG_TYPE_NICK | MSG_TYPE_HIGHLIGHT,
"%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
ptr_dcc->nick);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_dcc->channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
ptr_dcc->nick, ptr_buf);
ptr_dcc->nick,
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
}
else
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", ptr_dcc->nick);
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_dcc->channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", ptr_buf);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s%s",
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
ptr_dcc->nick);
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
"%s> ", GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
if (ptr_buf_color)
free (ptr_buf_color);
}
ptr_buf = next_ptr_buf;
}
if (buf2)
free (buf2);
free (buf2);
}
else
{
+117 -116
View File
@@ -52,25 +52,34 @@ irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
if (prefix[0] == prefix[2])
{
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
gui_printf_type (buffer, type, "%s%c%s%c%s%c ",
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
prefix[0],
GUI_COLOR(COLOR_WIN_CHAT_PREFIX2),
prefix[1],
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1),
prefix[2]);
}
else
{
if (strcmp (prefix, PREFIX_JOIN) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_JOIN, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_JOIN), prefix);
else if (strcmp (prefix, PREFIX_PART) == 0)
gui_printf_color (buffer, COLOR_WIN_CHAT_PART, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_PART), prefix);
else
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
gui_printf_type (buffer, type, "%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_PREFIX1), prefix);
}
if (server && (server->buffer == buffer) && buffer->all_servers)
{
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_DARK, "[");
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_SERVER, "%s", server->name);
gui_printf_type_color (buffer, type, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_type (buffer, type, "%s[%s%s%s] ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_SERVER), server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
gui_printf_type (buffer, type, GUI_NO_COLOR);
}
/*
@@ -80,58 +89,51 @@ irc_display_prefix (t_irc_server *server, t_gui_buffer *buffer, char *prefix)
void
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
int message_type, int display_around, int color_nick, int no_nickmode)
int type, int display_around, int color_nick, int no_nickmode)
{
if (display_around)
gui_printf_type_color (buffer,
message_type, COLOR_WIN_CHAT_DARK,
(nick) ? "<" : ">");
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
(nick) ? "<" : ">");
if (nick && cfg_look_nickmode)
{
if (nick->is_chanowner)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "~");
gui_printf_type (buffer, type, "%s~",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_chanadmin)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "&");
gui_printf_type (buffer, type, "%s&",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_op)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_OP, "@");
gui_printf_type (buffer, type, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
else if (nick->is_halfop)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
gui_printf_type (buffer, type, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
else if (nick->has_voice)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
gui_printf_type (buffer, type, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
else
if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_CHAT, " ");
gui_printf_type (buffer, type, "%s ",
GUI_COLOR(COLOR_WIN_CHAT));
}
if (color_nick < 0)
gui_printf_type_color (buffer,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", (nick) ? nick->nick : nickname);
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_HIGHLIGHT),
(nick) ? nick->nick : nickname);
else
gui_printf_type_color (buffer,
message_type,
(nick && color_nick) ?
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR((nick && color_nick) ?
((cfg_look_color_nicks) ?
nick->color : COLOR_WIN_CHAT) :
COLOR_WIN_CHAT,
"%s", (nick) ? nick->nick : nickname);
nick->color : COLOR_WIN_CHAT) :
COLOR_WIN_CHAT),
(nick) ? nick->nick : nickname);
if (display_around)
gui_printf_type_color (buffer,
message_type, COLOR_WIN_CHAT_DARK,
(nick) ? "> " : "< ");
gui_printf_type (buffer, type, "%s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
(nick) ? "> " : "< ");
gui_printf_type (buffer, type, GUI_NO_COLOR);
}
/*
@@ -144,19 +146,27 @@ irc_display_mode (t_irc_server *server, t_gui_buffer *buffer,
char *symbol, char *nick_host, char *message, char *param)
{
irc_display_prefix (server, buffer, PREFIX_INFO);
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
gui_printf (buffer, "%s[%s%s%s/%s%c%s%s] %s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
channel_name,
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
set_flag,
symbol,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
nick_host);
if (param)
{
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
}
gui_printf (buffer, " %s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
message,
GUI_COLOR(COLOR_WIN_CHAT_NICK),
param);
else
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
gui_printf (buffer, " %s\n",
GUI_COLOR(COLOR_WIN_CHAT),
message);
}
/*
@@ -167,65 +177,56 @@ void
irc_display_server (t_irc_server *server)
{
gui_printf (NULL, "\n");
gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
(server->is_connected) ?
_("connected") : _("not connected"));
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoconnect : %s%s\n",
(server->autoconnect) ? _("yes") : _("no"),
(server->command_line) ?
_(" (temporary server, will not be saved)") : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoreconnect . . .: %s\n",
(server->autoreconnect) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autoreconnect_delay: %d seconds\n",
server->autoreconnect_delay);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_address . . . . . .: %s\n",
server->address);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_port . . . . . . .: %d\n",
server->port);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_ipv6 . . . . . . .: %s\n",
(server->ipv6) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_ssl . . . . . . . .: %s\n",
(server->ssl) ? _("yes") : _("no"));
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_password . . . . .: %s\n",
(server->password && server->password[0]) ?
_("(hidden)") : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_nick1/2/3 . . . . .: %s", server->nick1);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_username . . . . .: %s\n",
server->username);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_realname . . . . .: %s\n",
server->realname);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_command . . . . . .: %s\n",
(server->command && server->command[0]) ?
server->command : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_command_delay . . .: %d seconds\n",
server->command_delay);
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_autojoin . . . . .: %s\n",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
gui_printf_color (NULL, COLOR_WIN_CHAT,
" server_notify_levels . . .: %s\n",
(server->notify_levels && server->notify_levels[0]) ?
server->notify_levels : "");
gui_printf (NULL, _("%sServer: %s%s %s[%s%s%s]\n"),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
server->name,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
(server->is_connected) ?
_("connected") : _("not connected"),
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
(server->autoconnect) ? _("yes") : _("no"),
(server->command_line) ?
_(" (temporary server, will not be saved)") : "");
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
(server->autoreconnect) ? _("yes") : _("no"));
gui_printf (NULL, " server_autoreconnect_delay: %d seconds\n",
server->autoreconnect_delay);
gui_printf (NULL, " server_address . . . . . .: %s\n",
server->address);
gui_printf (NULL, " server_port . . . . . . .: %d\n",
server->port);
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
(server->ipv6) ? _("yes") : _("no"));
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
(server->ssl) ? _("yes") : _("no"));
gui_printf (NULL, " server_password . . . . .: %s\n",
(server->password && server->password[0]) ?
_("(hidden)") : "");
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
server->nick1,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
server->nick2,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
server->nick3);
gui_printf (NULL, " server_username . . . . .: %s\n",
server->username);
gui_printf (NULL, " server_realname . . . . .: %s\n",
server->realname);
gui_printf (NULL, " server_command . . . . . .: %s\n",
(server->command && server->command[0]) ?
server->command : "");
gui_printf (NULL, " server_command_delay . . .: %d seconds\n",
server->command_delay);
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
(server->autojoin && server->autojoin[0]) ?
server->autojoin : "");
gui_printf (NULL, " server_notify_levels . . .: %s\n",
(server->notify_levels && server->notify_levels[0]) ?
server->notify_levels : "");
}
+1 -1
View File
@@ -49,7 +49,7 @@ nick_find_color (t_irc_nick *nick)
}
color = (color % cfg_look_color_nicks_number);
return COLOR_WIN_NICK_FIRST + color;
return COLOR_WIN_NICK_1 + color;
}
/*
+614 -659
View File
File diff suppressed because it is too large Load Diff
+63 -70
View File
@@ -110,11 +110,11 @@ irc_cmd_send_ame (t_irc_server *server, char *arguments)
ptr_channel->name,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, ptr_channel->buffer, PREFIX_ACTION_ME);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", ptr_server->nick);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n",
(arguments && arguments[0]) ? arguments : "");
gui_printf (ptr_channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
ptr_server->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(arguments && arguments[0]) ? arguments : "");
}
}
}
@@ -157,8 +157,7 @@ irc_cmd_send_amsg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
gui_printf (ptr_channel->buffer, "%s\n", arguments);
}
else
{
@@ -401,20 +400,23 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
}
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": ");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "%s", pos_type);
gui_printf (server->buffer, "CTCP%s(%s%s%s)%s: %s%s",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
pos_type);
if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args))
{
gettimeofday (&tv, &tz);
server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n",
arguments, tv.tv_sec, tv.tv_usec);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %d %d\n",
tv.tv_sec, tv.tv_usec);
gui_printf (server->buffer, " %s%d %d\n",
GUI_COLOR(COLOR_WIN_CHAT),
tv.tv_sec, tv.tv_usec);
}
else
{
@@ -422,8 +424,9 @@ irc_cmd_send_ctcp (t_irc_server *server, char *arguments)
{
server_sendf (server, "PRIVMSG %s :\01%s %s\01\r\n",
arguments, pos_type, pos_args);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, " %s\n",
pos_args);
gui_printf (server->buffer, " %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos_args);
}
else
{
@@ -906,11 +909,11 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel, char *arguments)
channel->name,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME);
gui_printf_color (channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", server->nick);
gui_printf_color (channel->buffer,
COLOR_WIN_CHAT, " %s\n",
(arguments && arguments[0]) ? arguments : "");
gui_printf (channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT),
(arguments && arguments[0]) ? arguments : "");
return 0;
}
@@ -1020,9 +1023,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos);
}
else
{
@@ -1045,9 +1046,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n", pos);
}
else
{
@@ -1081,17 +1080,15 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
}
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "-");
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_type_color (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "-");
gui_printf_color (server->buffer,
COLOR_WIN_CHAT, " %s\n", msg_pwd_hidden);
gui_printf_type (server->buffer, MSG_TYPE_NICK,
"%s-%s%s%s- ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
COLOR_WIN_CHAT_DARK);
gui_printf (server->buffer, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
msg_pwd_hidden);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
free (msg_pwd_hidden);
return 0;
@@ -1112,19 +1109,16 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
gui_draw_buffer_title (ptr_channel->buffer, 1);
}
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
}
@@ -1217,11 +1211,13 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
while (pos[0] == ' ')
pos++;
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
gui_printf (server->buffer, "notice%s(%s%s%s)%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
}
else
@@ -1435,19 +1431,16 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
/* display text if given */
if (pos)
{
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_type_color (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
"%s<%s%s%s> ",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_NICK_SELF),
server->nick,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
return 0;
+2 -2
View File
@@ -672,7 +672,7 @@ server_msgq_flush ()
irc_display_prefix (recv_msgq->server,
recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
_("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
_("%s Command \"%s\" failed!\n"), WEECHAT_ERROR, command);
break;
case -2:
irc_display_prefix (recv_msgq->server,
@@ -684,7 +684,7 @@ server_msgq_flush ()
irc_display_prefix (recv_msgq->server,
recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
_("%s Unknown command: cmd=%s, host=%s, args=%s\n"),
_("%s Unknown command: cmd=\"%s\", host=\"%s\", args=\"%s\"\n"),
WEECHAT_WARNING, command, host, args);
break;
}
+1 -1
View File
@@ -482,7 +482,7 @@ weechat_plugin_get_config_str_value (t_config_option *option, void *value)
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
color_name = gui_get_color_name (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING: