35 |
|
|
36 |
@title WeeChat - User guide |
@title WeeChat - User guide |
37 |
@subtitle Fast, light and extensible IRC client |
@subtitle Fast, light and extensible IRC client |
38 |
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 25 2005 |
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 28 2005 |
39 |
|
|
40 |
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}> |
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}> |
41 |
|
|
587 |
Create a FIFO pipe for remote control@* |
Create a FIFO pipe for remote control@* |
588 |
Type: boolean (values: 'on' or 'off'), default value: 'off'@* |
Type: boolean (values: 'on' or 'off'), default value: 'off'@* |
589 |
@item irc_highlight |
@item irc_highlight |
590 |
Comma separated list of words to highlight (case insensitive comparison)@* |
Comma separated list of words to highlight (case insensitive comparison, words may begin or end with "*" for partial match)@* |
591 |
Type: string (any string), default value: ''@* |
Type: string (any string), default value: ''@* |
592 |
@item dcc_auto_accept_files |
@item dcc_auto_accept_files |
593 |
Automatically accept incoming dcc files@* |
Automatically accept incoming dcc files@* |
1558 |
@item functions for init and end of plugin: |
@item functions for init and end of plugin: |
1559 |
@itemize @minus |
@itemize @minus |
1560 |
@item weechat_plugin_init: function called when plugin is loaded, |
@item weechat_plugin_init: function called when plugin is loaded, |
1561 |
must return 1 if successful, 0 if error |
must return PLUGIN_RC_OK (0) if successful, PLUGIN_RC_KO (-1) if error |
1562 |
@item weechat_plugin_end: function called when plugin is unloaded, |
@item weechat_plugin_end: function called when plugin is unloaded |
|
must return 1 if successful, 0 if error |
|
1563 |
@end itemize |
@end itemize |
1564 |
@end itemize |
@end itemize |
1565 |
|
|
1575 |
@command{int ascii_strcasecmp (t_weechat_plugin *plugin, |
@command{int ascii_strcasecmp (t_weechat_plugin *plugin, |
1576 |
char *string1, char *string2)}@* |
char *string1, char *string2)}@* |
1577 |
@* |
@* |
1578 |
locale and case independent string comparison.@* |
Locale and case independent string comparison.@* |
1579 |
|
|
1580 |
@emph{Arguments:} |
@emph{Arguments:} |
1581 |
@itemize @minus |
@itemize @minus |
1598 |
@command{int ascii_strncasecmp (t_weechat_plugin *plugin, |
@command{int ascii_strncasecmp (t_weechat_plugin *plugin, |
1599 |
char *string1, char *string2, int max)}@* |
char *string1, char *string2, int max)}@* |
1600 |
@* |
@* |
1601 |
locale and case independent string comparison, for ``max'' chars.@* |
Locale and case independent string comparison, for ``max'' chars.@* |
1602 |
|
|
1603 |
@emph{Arguments:} |
@emph{Arguments:} |
1604 |
@itemize @minus |
@itemize @minus |
1711 |
char *server, char *channel, char *message, ...)}@* |
char *server, char *channel, char *message, ...)}@* |
1712 |
@* |
@* |
1713 |
Display a message on a WeeChat buffer, identified by server and |
Display a message on a WeeChat buffer, identified by server and |
1714 |
channel (both may be NULL).@* |
channel (both may be NULL for current buffer).@* |
1715 |
|
|
1716 |
@emph{Arguments:} |
@emph{Arguments:} |
1717 |
@itemize @minus |
@itemize @minus |
1805 |
void *handler_pointer)}@* |
void *handler_pointer)}@* |
1806 |
@code{@{}@* |
@code{@{}@* |
1807 |
@code{@ @ @ @ plugin->printf (plugin, server, NULL, "KICK received");}@* |
@code{@ @ @ @ plugin->printf (plugin, server, NULL, "KICK received");}@* |
1808 |
|
@code{@ @ @ @ return PLUGIN_RC_OK;}@* |
1809 |
@code{@}}@* |
@code{@}}@* |
1810 |
@code{...}@* |
@code{...}@* |
1811 |
@code{plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);}@* |
@code{plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL);}@* |
1812 |
@* |
@* |
1813 |
|
@emph{Notes:}@* |
1814 |
|
@* |
1815 |
|
Function called when message is received has to return one of these values:@* |
1816 |
|
@itemize @minus |
1817 |
|
@item @option{PLUGIN_RC_KO or -1}: function failed |
1818 |
|
@item @option{PLUGIN_RC_OK or 0}: function successfully completed |
1819 |
|
@item @option{PLUGIN_RC_OK_IGNORE_WEECHAT or 1}: message will not be sent to |
1820 |
|
WeeChat |
1821 |
|
@item @option{PLUGIN_RC_OK_IGNORE_PLUGINS or 2}: message will not be sent to |
1822 |
|
other plugins |
1823 |
|
@item @option{PLUGIN_RC_OK_IGNORE_ALL or 3}: message will not be sent to |
1824 |
|
WeeChat neither other plugins |
1825 |
|
@end itemize |
1826 |
|
@* |
1827 |
|
|
1828 |
@item |
@item |
1829 |
@command{t_plugin_handler *cmd_handler_add (t_weechat_plugin |
@command{t_plugin_handler *cmd_handler_add (t_weechat_plugin |
1837 |
@emph{Arguments:} |
@emph{Arguments:} |
1838 |
@itemize @minus |
@itemize @minus |
1839 |
@item @option{plugin}: pointer to plugin structure |
@item @option{plugin}: pointer to plugin structure |
1840 |
@item @option{commande}: the new command |
@item @option{command}: the new command |
1841 |
@item @option{description}: command description (displayed by /help |
@item @option{description}: command description (displayed by /help |
1842 |
command) |
command) |
1843 |
@item @option{arguments}: short description of command arguments |
@item @option{arguments}: short description of command arguments |
1861 |
@code{@{}@* |
@code{@{}@* |
1862 |
@code{@ @ @ @ plugin->printf (plugin, server, NULL, "test command, |
@code{@ @ @ @ plugin->printf (plugin, server, NULL, "test command, |
1863 |
file: %s", (arguments) ? arguments : "none");}@* |
file: %s", (arguments) ? arguments : "none");}@* |
1864 |
|
@code{@ @ @ @ return PLUGIN_RC_OK;}@* |
1865 |
@code{@}}@* |
@code{@}}@* |
1866 |
@code{...}@* |
@code{...}@* |
1867 |
@code{plugin->cmd_handler_add (plugin, "test", "Test command", |
@code{plugin->cmd_handler_add (plugin, "test", "Test command", |
1868 |
"[file]", "file: a file name", &cmd_test, NULL, NULL);}@* |
"[file]", "file: a file name", &cmd_test, NULL, NULL);}@* |
1869 |
@* |
@* |
1870 |
|
@emph{Notes:}@* |
1871 |
|
@* |
1872 |
|
Function called when command is executed has to return one of these values:@* |
1873 |
|
@itemize @minus |
1874 |
|
@item @option{PLUGIN_RC_KO or -1}: function failed |
1875 |
|
@item @option{PLUGIN_RC_OK or 0}: function successfully completed |
1876 |
|
@end itemize |
1877 |
|
@* |
1878 |
|
|
1879 |
@item |
@item |
1880 |
@command{void handler_remove (t_weechat_plugin *plugin, |
@command{void handler_remove (t_weechat_plugin *plugin, |
2161 |
char plugin_version[] = "0.1"; |
char plugin_version[] = "0.1"; |
2162 |
char plugin_description[] = "Test plugin for WeeChat"; |
char plugin_description[] = "Test plugin for WeeChat"; |
2163 |
|
|
2164 |
/* gestionnaire de commande "/hello" */ |
/* "/hello" command handler */ |
2165 |
|
|
2166 |
int toto_cmd_double (t_weechat_plugin *plugin, char *server, |
int toto_cmd_double (t_weechat_plugin *plugin, char *server, |
2167 |
char *command, char *arguments, |
char *command, char *arguments, |
2172 |
plugin->exec_command (plugin, NULL, NULL, arguments); |
plugin->exec_command (plugin, NULL, NULL, arguments); |
2173 |
plugin->exec_command (plugin, NULL, NULL, arguments); |
plugin->exec_command (plugin, NULL, NULL, arguments); |
2174 |
} |
} |
2175 |
return 1; |
return PLUGIN_RC_OK; |
2176 |
} |
} |
2177 |
|
|
2178 |
int weechat_plugin_init (t_weechat_plugin *plugin) |
int weechat_plugin_init (t_weechat_plugin *plugin) |
2183 |
"msg: message", |
"msg: message", |
2184 |
&toto_cmd_double, |
&toto_cmd_double, |
2185 |
NULL, NULL); |
NULL, NULL); |
2186 |
return 1; |
return PLUGIN_RC_OK; |
2187 |
} |
} |
2188 |
|
|
2189 |
int weechat_plugin_end (t_weechat_plugin *plugin) |
void weechat_plugin_end (t_weechat_plugin *plugin) |
2190 |
{ |
{ |
2191 |
/* on ne fait rien ici */ |
/* nothing done here */ |
|
return 1; |
|
2192 |
} |
} |
2193 |
@end verbatim |
@end verbatim |
2194 |
|
|
2315 |
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@* |
@code{@ @ @ @ ($null, $channel, $message) = split ":",$_[1],3;}@* |
2316 |
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@* |
@code{@ @ @ @ ($hostmask, $null, $channel) = split " ", $channel;}@* |
2317 |
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@* |
@code{@ @ @ @ weechat::print ("host=$hostmask, chan=$channel, msg=$message\n");}@* |
2318 |
|
@code{@ @ @ @ return 0;}@* |
2319 |
@code{@} }@* |
@code{@} }@* |
2320 |
@* |
@* |
2321 |
|
@emph{Notes:}@* |
2322 |
|
@* |
2323 |
|
Function called when message is received has to return one of these values:@* |
2324 |
|
@itemize @minus |
2325 |
|
@item @option{-1}: function failed |
2326 |
|
@item @option{0}: function successfully completed |
2327 |
|
@item @option{1}: message will not be sent to WeeChat |
2328 |
|
@item @option{2}: message will not be sent to other plugins |
2329 |
|
@item @option{3}: message will not be sent to WeeChat neither other plugins |
2330 |
|
@end itemize |
2331 |
|
@* |
2332 |
|
|
2333 |
@item |
@item |
2334 |
@command{weechat::add_command_handler ( name, function );}@* |
@command{weechat::add_command_handler ( name, function );}@* |
2364 |
@code{@ @ @ @ return 0;}@* |
@code{@ @ @ @ return 0;}@* |
2365 |
@code{@} }@* |
@code{@} }@* |
2366 |
@* |
@* |
2367 |
|
@emph{Notes:}@* |
2368 |
|
@* |
2369 |
|
Function called when command is executed has to return one of these values:@* |
2370 |
|
@itemize @minus |
2371 |
|
@item @option{-1}: function failed |
2372 |
|
@item @option{0}: function successfully completed |
2373 |
|
@end itemize |
2374 |
|
@* |
2375 |
|
|
2376 |
@item |
@item |
2377 |
@command{weechat::remove_handler ( name, function );}@* |
@command{weechat::remove_handler ( name, function );}@* |
2696 |
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@* |
@code{@ @ @ @ null, channel, message = string.split(args, ":", 2)}@* |
2697 |
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@* |
@code{@ @ @ @ hostmask, null, channel = string.split(string.strip(channel), " ", 2)}@* |
2698 |
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@* |
@code{@ @ @ @ weechat.prnt("host="+hostmask+", channel="+channel+", message="+message)}@* |
2699 |
|
@code{@ @ @ @ return 0}@* |
2700 |
|
@* |
2701 |
|
@emph{Notes:}@* |
2702 |
|
@* |
2703 |
|
Function called when message is received has to return one of these values:@* |
2704 |
|
@itemize @minus |
2705 |
|
@item @option{-1}: function failed |
2706 |
|
@item @option{0}: function successfully completed |
2707 |
|
@item @option{1}: message will not be sent to WeeChat |
2708 |
|
@item @option{2}: message will not be sent to other plugins |
2709 |
|
@item @option{3}: message will not be sent to WeeChat neither other plugins |
2710 |
|
@end itemize |
2711 |
@* |
@* |
2712 |
|
|
2713 |
@item |
@item |
2740 |
@code{weechat.add_command_handler ("command", my_command)}@* |
@code{weechat.add_command_handler ("command", my_command)}@* |
2741 |
@code{def my_command(server, args):}@* |
@code{def my_command(server, args):}@* |
2742 |
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@* |
@code{@ @ @ @ weechat.prnt("server:"+server+" arguments:"+args)}@* |
2743 |
|
@code{@ @ @ @ return 0}@* |
2744 |
|
@* |
2745 |
|
@emph{Notes:}@* |
2746 |
|
@* |
2747 |
|
Function called when command is executed has to return one of these values:@* |
2748 |
|
@itemize @minus |
2749 |
|
@item @option{-1}: function failed |
2750 |
|
@item @option{0}: function successfully completed |
2751 |
|
@end itemize |
2752 |
@* |
@* |
2753 |
|
|
2754 |
@item |
@item |