1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 05:46:38 +02:00

Many changes in IRC plugin, added IRC specific completions

This commit is contained in:
Sebastien Helleu
2007-12-11 17:34:31 +01:00
parent 43c49926d4
commit 061b0e5c58
27 changed files with 1745 additions and 1484 deletions
+3 -3
View File
@@ -1908,7 +1908,7 @@ command_init ()
" scroll 15 min down: /buffer scroll +15m\n"
" scroll 20 msgs up: /buffer scroll -20\n"
" jump to #weechat: /buffer #weechat"),
"move|close|list|notify|scroll|set|%S|%C %S|%C",
"move|close|list|notify|scroll|set|%b|%c %b|%c",
command_buffer, NULL);
hook_command (NULL, "builtin",
N_("launch WeeChat builtin command (do not look at commands "
@@ -1975,12 +1975,12 @@ command_init ()
"all plugins, then autoload plugins)\n"
" unload: unload one or all plugins\n\n"
"Without argument, /plugin command lists loaded plugins."),
"list|listfull|load|autoload|reload|unload %P",
"list|listfull|load|autoload|reload|unload %p",
command_plugin, NULL);
hook_command (NULL, "quit",
N_("quit WeeChat"),
"", "",
NULL,
"%q",
command_quit, NULL);
hook_command (NULL, "reload",
N_("reload WeeChat and plugins configuration files from "
-5
View File
@@ -74,7 +74,6 @@ struct t_config_option *config_look_prefix_align_max;
struct t_config_option *config_look_prefix_suffix;
struct t_config_option *config_look_nick_completor;
struct t_config_option *config_look_nick_completion_ignore;
struct t_config_option *config_look_nick_completion_smart;
struct t_config_option *config_look_nick_complete_first;
struct t_config_option *config_look_infobar;
struct t_config_option *config_look_infobar_time_format;
@@ -529,10 +528,6 @@ config_weechat_init ()
ptr_section, "look_nick_completion_ignore", "string",
N_("chars ignored for nick completion"),
NULL, 0, 0, "[]-^", NULL);
config_look_nick_completion_smart = config_file_new_option (
ptr_section, "look_nick_completion_smart", "boolean",
N_("smart completion for nicks (completes with last speakers first)"),
NULL, 0, 0, "on", NULL);
config_look_nick_complete_first = config_file_new_option (
ptr_section, "look_nick_complete_first", "boolean",
N_("complete only with first nick found"),
-1
View File
@@ -68,7 +68,6 @@ extern struct t_config_option *config_look_prefix_align_max;
extern struct t_config_option *config_look_prefix_suffix;
extern struct t_config_option *config_look_nick_completor;
extern struct t_config_option *config_look_nick_completion_ignore;
extern struct t_config_option *config_look_nick_completion_smart;
extern struct t_config_option *config_look_nick_complete_first;
extern struct t_config_option *config_look_infobar;
extern struct t_config_option *config_look_infobar_time_format;
+6 -4
View File
@@ -866,10 +866,13 @@ hook_completion (void *plugin, char *completion,
*/
void
hook_completion_exec (void *plugin, char *completion, void *list)
hook_completion_exec (void *plugin, char *completion, void *buffer, void *list)
{
struct t_hook *ptr_hook, *next_hook;
/* make C compiler happy */
(void) plugin;
hook_exec_recursion++;
ptr_hook = weechat_hooks;
@@ -879,13 +882,12 @@ hook_completion_exec (void *plugin, char *completion, void *list)
if ((ptr_hook->type == HOOK_TYPE_COMPLETION)
&& (!ptr_hook->running)
&& (ptr_hook->plugin == plugin)
&& (string_strcasecmp (HOOK_COMPLETION(ptr_hook, completion),
completion) == 0))
{
ptr_hook->running = 1;
(void) (HOOK_COMPLETION(ptr_hook, callback))
(ptr_hook->callback_data, completion, list);
(ptr_hook->callback_data, completion, buffer, list);
if (ptr_hook->type == HOOK_TYPE_COMPLETION)
ptr_hook->running = 0;
}
@@ -895,7 +897,7 @@ hook_completion_exec (void *plugin, char *completion, void *list)
if (hook_exec_recursion > 0)
hook_exec_recursion--;
if (hook_exec_recursion == 0)
hook_remove_deleted ();
}
+2 -2
View File
@@ -123,7 +123,7 @@ struct t_hook_config
/* (NULL = hook for all options) */
};
typedef int (t_hook_callback_completion)(void *, char *, void *);
typedef int (t_hook_callback_completion)(void *, char *, void *, void *);
struct t_hook_completion
{
@@ -161,7 +161,7 @@ extern struct t_hook *hook_config (void *, char *, char *,
extern void hook_config_exec (char *, char *, char *);
extern struct t_hook *hook_completion (void *, char *,
t_hook_callback_completion *, void *);
extern void hook_completion_exec (void *, char *, void *);
extern void hook_completion_exec (void *, char *, void *, void *);
extern void unhook (struct t_hook *);
extern void unhook_all_plugin (void *);
+30 -301
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* completion.c: completes words according to context (cmd/nick) */
/* gui-completion.c: completes words according to context */
#ifdef HAVE_CONFIG_H
@@ -245,43 +245,38 @@ gui_completion_list_add (struct t_gui_completion *completion, char *word,
}
/*
* gui_completion_list_add_channel: add current channel to completion list
* gui_completion_list_add_buffers_names: add buffers names to completion list
*/
void
gui_completion_list_add_channel (struct t_gui_completion *completion)
gui_completion_list_add_buffers_names (struct t_gui_completion *completion)
{
(void) completion;
/*if (completion->channel)
gui_completion_list_add (completion,
((t_irc_channel *)(completion->channel))->name,
0, WEELIST_POS_SORT);*/
struct t_gui_buffer *ptr_buffer;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
gui_completion_list_add (completion, ptr_buffer->name,
0, WEELIST_POS_SORT);
}
}
/*
* gui_completion_list_add_channels: add server channels to completion list
* gui_completion_list_add_buffers_categories: add buffers categories to
* completion list
*/
void
gui_completion_list_add_channels (struct t_gui_completion *completion)
gui_completion_list_add_buffers_categories (struct t_gui_completion *completion)
{
(void) completion;
/*t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
if (completion->server)
struct t_gui_buffer *ptr_buffer;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (ptr_channel = ptr_server->channels;
ptr_channel; ptr_channel = ptr_channel->next_channel)
{
gui_completion_list_add (completion, ptr_channel->name,
0, WEELIST_POS_SORT);
}
}
}*/
gui_completion_list_add (completion, ptr_buffer->category,
0, WEELIST_POS_SORT);
}
}
/*
@@ -399,25 +394,6 @@ gui_completion_list_add_command_hooks (struct t_gui_completion *completion)
}
}
/*
* gui_completion_list_add_irc_cmd_recv: add IRC command (received) to
* completion list
*/
void
gui_completion_list_add_irc_cmd_recv (struct t_gui_completion *completion)
{
(void) completion;
/*int i;
for (i = 0; irc_commands[i].name; i++)
{
if (irc_commands[i].recv_function)
gui_completion_list_add(completion, irc_commands[i].name,
0, WEELIST_POS_SORT);
}*/
}
/*
* gui_completion_list_add_key_cmd: add key commands/functions to completion
* list
@@ -448,161 +424,6 @@ gui_completion_list_add_self_nick (struct t_gui_completion *completion)
0, WEELIST_POS_SORT);
}
/*
* gui_completion_list_add_server_nicks: add server nicks to completion list
*/
void
gui_completion_list_add_server_nicks (struct t_gui_completion *completion)
{
(void) completion;
/*t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
if (completion->server)
{
for (ptr_server = (t_irc_server *)(completion->server); ptr_server;
ptr_server = ptr_server->next_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if ((!completion->channel || (t_irc_channel *)(completion->channel) != ptr_channel)
&& (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
gui_completion_list_add (completion, ptr_nick->nick,
1, WEELIST_POS_SORT);
}
}
}
}
// add current channel nicks at beginning
if (completion->channel && (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_CHANNEL))
{
for (ptr_nick = ((t_irc_channel *)(completion->channel))->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
{
gui_completion_list_add (completion, ptr_nick->nick,
1, WEELIST_POS_BEGINNING);
}
}
// add self nick at the end
if (completion->server)
gui_completion_list_add (completion,
((t_irc_server *)(completion->server))->nick,
1, WEELIST_POS_END);
completion->arg_is_nick = 1;
}*/
}
/*
* gui_completion_list_add_channel_nicks: add channel nicks to completion list
*/
void
gui_completion_list_add_channel_nicks (struct t_gui_completion *completion)
{
(void) completion;
/*t_irc_nick *ptr_nick;
struct t_weelist *ptr_weelist;
if (completion->channel)
{
if (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_CHANNEL)
{
// add channel nicks
for (ptr_nick = ((t_irc_channel *)(completion->channel))->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
{
gui_completion_list_add (completion, ptr_nick->nick,
1, WEELIST_POS_SORT);
}
// add nicks speaking recently on this channel
if (CONFIG_BOOLEAN(config_look_nick_completion_smart))
{
for (ptr_weelist = ((t_irc_channel *)(completion->channel))->nicks_speaking;
ptr_weelist; ptr_weelist = ptr_weelist->next_weelist)
{
if (irc_nick_search ((t_irc_channel *)(completion->channel),
ptr_weelist->data))
gui_completion_list_add (completion, ptr_weelist->data,
1, WEELIST_POS_BEGINNING);
}
}
// add self nick at the end
if (completion->server)
gui_completion_list_add (completion,
((t_irc_server *)(completion->server))->nick,
1, WEELIST_POS_END);
}
if ((((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_PRIVATE)
|| (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_DCC_CHAT))
{
gui_completion_list_add (completion,
((t_irc_channel *)(completion->channel))->name,
1, WEELIST_POS_SORT);
}
completion->arg_is_nick = 1;
}*/
}
/*
* gui_completion_list_add_channel_nicks_hosts: add channel nicks and hosts to completion list
*/
void
gui_completion_list_add_channel_nicks_hosts (struct t_gui_completion *completion)
{
(void) completion;
/*t_irc_nick *ptr_nick;
char *buf;
int length;
if (completion->channel)
{
if (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_CHANNEL)
{
for (ptr_nick = ((t_irc_channel *)(completion->channel))->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
{
gui_completion_list_add (completion, ptr_nick->nick,
1, WEELIST_POS_SORT);
if (ptr_nick->host)
{
length = strlen (ptr_nick->nick) + 1 +
strlen (ptr_nick->host) + 1;
buf = (char *) malloc (length);
if (buf)
{
snprintf (buf, length, "%s!%s",
ptr_nick->nick, ptr_nick->host);
gui_completion_list_add (completion, buf,
1, WEELIST_POS_SORT);
free (buf);
}
}
}
}
if ((((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_PRIVATE)
|| (((t_irc_channel *)(completion->channel))->type == IRC_CHANNEL_TYPE_PRIVATE))
{
gui_completion_list_add (completion,
((t_irc_channel *)(completion->channel))->name,
1, WEELIST_POS_SORT);
}
completion->arg_is_nick = 1;
}*/
}
/*
* gui_completion_list_add_option: add config option to completion list
*/
@@ -643,19 +464,6 @@ gui_completion_list_add_plugin_option (struct t_gui_completion *completion)
}
}
/*
* gui_completion_list_add_part: add part message to completion list
*/
void
gui_completion_list_add_part (struct t_gui_completion *completion)
{
(void) completion;
/*if (config_irc_default_msg_part && config_irc_default_msg_part[0])
gui_completion_list_add (completion, config_irc_default_msg_part,
0, WEELIST_POS_SORT);*/
}
/*
* gui_completion_list_add_plugin: add plugin name to completion list
*/
@@ -680,69 +488,11 @@ gui_completion_list_add_plugin (struct t_gui_completion *completion)
void
gui_completion_list_add_quit (struct t_gui_completion *completion)
{
(void) completion;
/*if (config_irc_default_msg_quit && config_irc_default_msg_quit[0])
gui_completion_list_add (completion, config_irc_default_msg_quit,
0, WEELIST_POS_SORT);*/
}
/*
* gui_completion_list_add_server: add current server to completion list
*/
void
gui_completion_list_add_server (struct t_gui_completion *completion)
{
(void) completion;
/*if (completion->server)
if (CONFIG_STRING(config_look_default_msg_quit)
&& CONFIG_STRING(config_look_default_msg_quit)[0])
gui_completion_list_add (completion,
((t_irc_server *)(completion->server))->name,
0, WEELIST_POS_SORT);*/
}
/*
* gui_completion_list_add_servers: add all servers to completion list
*/
void
gui_completion_list_add_servers (struct t_gui_completion *completion)
{
(void) completion;
/*t_irc_server *ptr_server;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
gui_completion_list_add (completion, ptr_server->name,
CONFIG_STRING(config_look_default_msg_quit),
0, WEELIST_POS_SORT);
}*/
}
/*
* gui_completion_list_add_topic: add topic to completion list
*/
void
gui_completion_list_add_topic (struct t_gui_completion *completion)
{
(void) completion;
/*char *string;
if (completion->server && completion->channel
&& ((t_irc_channel *)(completion->channel))->topic
&& ((t_irc_channel *)(completion->channel))->topic[0])
{
if (config_irc_colors_send)
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
else
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0, 0);
gui_completion_list_add (completion,
(string) ?
string : ((t_irc_channel *)(completion->channel))->topic,
0, WEELIST_POS_SORT);
if (string)
free (string);
}*/
}
/*
@@ -868,6 +618,7 @@ gui_completion_custom (struct t_gui_completion *completion,
{
hook_completion_exec (plugin,
custom_completion,
completion->buffer,
completion->completion_list);
}
@@ -914,11 +665,11 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
break;
case '*': /* repeat last completion (do nothing there) */
break;
case 'c': /* current channel */
gui_completion_list_add_channel (completion);
case 'b': /* buffers names */
gui_completion_list_add_buffers_names (completion);
break;
case 'C': /* all channels */
gui_completion_list_add_channels (completion);
case 'c': /* buffers categories */
gui_completion_list_add_buffers_categories (completion);
break;
case 'f': /* filename */
gui_completion_list_add_filename (completion);
@@ -932,40 +683,18 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
case 'm': /* self nickname */
gui_completion_list_add_self_nick (completion);
break;
case 'M': /* nicks of current server (all open channels) */
gui_completion_list_add_server_nicks (completion);
break;
case 'n': /* channel nicks */
gui_completion_list_add_channel_nicks (completion);
completion->context = GUI_COMPLETION_NICK;
break;
case 'N': /* channel nicks and hosts */
gui_completion_list_add_channel_nicks_hosts (completion);
break;
case 'o': /* config option */
gui_completion_list_add_option (completion);
break;
case 'O': /* plugin option */
gui_completion_list_add_plugin_option (completion);
break;
case 'p': /* part message */
gui_completion_list_add_part (completion);
break;
case 'P': /* plugin name */
case 'p': /* plugin name */
gui_completion_list_add_plugin (completion);
break;
case 'q': /* quit message */
gui_completion_list_add_quit (completion);
break;
case 's': /* current server */
gui_completion_list_add_server (completion);
break;
case 'S': /* all servers */
gui_completion_list_add_servers (completion);
break;
case 't': /* topic */
gui_completion_list_add_topic (completion);
break;
case 'v': /* value of config option */
gui_completion_list_add_option_value (completion);
break;
+7 -4
View File
@@ -34,7 +34,7 @@
#include "gui-window.h"
t_gui_infobar *gui_infobar; /* pointer to infobar content */
struct t_gui_infobar *gui_infobar; /* pointer to infobar content */
/*
@@ -46,14 +46,17 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
{
static char buf[1024];
va_list argptr;
t_gui_infobar *ptr_infobar;
struct t_gui_infobar *ptr_infobar;
char *buf2, *ptr_buf, *pos;
if (!message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
ptr_infobar = (struct t_gui_infobar *)malloc (sizeof (struct t_gui_infobar));
if (ptr_infobar)
{
buf2 = (char *)gui_color_decode ((unsigned char *)buf);
@@ -82,7 +85,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
void
gui_infobar_remove ()
{
t_gui_infobar *new_infobar;
struct t_gui_infobar *new_infobar;
if (gui_infobar)
{
+2 -4
View File
@@ -22,8 +22,6 @@
#include "gui-buffer.h"
typedef struct t_gui_infobar t_gui_infobar;
struct t_gui_infobar
{
int color; /* text color */
@@ -31,12 +29,12 @@ struct t_gui_infobar
int remaining_time; /* delay (sec) before erasing this text */
/* if < 0, text is never erased (except */
/* by user action to erase it) */
t_gui_infobar *next_infobar; /* next message for infobar */
struct t_gui_infobar *next_infobar; /* next message for infobar */
};
/* infobar variables */
extern t_gui_infobar *gui_infobar;
extern struct t_gui_infobar *gui_infobar;
/* infobar functions */
+27 -43
View File
@@ -40,10 +40,6 @@ struct t_weechat_plugin *weechat_alias_plugin = NULL;
struct t_config_file *alias_config_file = NULL;
struct t_alias *alias_list = NULL;
struct t_alias *last_alias = NULL;
struct t_hook *alias_command = NULL;
struct t_hook *unalias_command = NULL;
struct t_hook *config_reload = NULL;
struct t_hook *completion = NULL;
/*
@@ -692,18 +688,19 @@ unalias_command_cb (void *data, void *buffer, int argc, char **argv,
}
/*
* alias_completion_cb: callback for completion
* alias_completion_cb: callback for completion with list of aliases
*/
int
alias_completion_cb (void *data, char *completion, void *list)
alias_completion_cb (void *data, char *completion, void *buffer, void *list)
{
struct t_alias *ptr_alias;
/* make C compiler happy */
(void) data;
(void) completion;
(void) buffer;
for (ptr_alias = alias_list; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
@@ -732,39 +729,30 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
}
alias_config_read ();
alias_command = weechat_hook_command ("alias",
N_("create an alias for a command"),
N_("[alias_name [command [arguments]]]"),
N_("alias_name: name of alias\n"
" command: command name (many "
"commands can be separated by "
"semicolons)\n"
" arguments: arguments for "
"command\n\n"
"Note: in command, special "
"variables $1, $2,..,$9 "
"are replaced by arguments given "
"by user, and $* "
"is replaced by all arguments.\n"
"Variables $nick, $channel and "
"$server are "
"replaced by current nick/channel"
"/server."),
"%- %h",
&alias_command_cb, NULL);
weechat_hook_command ("alias",
N_("create an alias for a command"),
N_("[alias_name [command [arguments]]]"),
N_("alias_name: name of alias\n"
" command: command name (many commands can be "
"separated by semicolons)\n"
" arguments: arguments for command\n\n"
"Note: in command, special variables "
"$1, $2,..,$9 are replaced by arguments given "
"by user, and $* is replaced by all arguments.\n"
"Variables $nick, $channel and $server are "
"replaced by current nick/channel/server."),
"%- %h",
&alias_command_cb, NULL);
unalias_command = weechat_hook_command ("unalias", N_("remove an alias"),
N_("alias_name"),
N_("alias_name: name of alias to "
"remove"),
"%(alias)",
&unalias_command_cb, NULL);
config_reload = weechat_hook_event ("config_reload",
&alias_config_reload_event_cb, NULL);
weechat_hook_command ("unalias", N_("remove an alias"),
N_("alias_name"),
N_("alias_name: name of alias to remove"),
"%(alias)",
&unalias_command_cb, NULL);
completion = weechat_hook_completion ("alias",
&alias_completion_cb, NULL);
weechat_hook_event ("config_reload", &alias_config_reload_event_cb, NULL);
weechat_hook_completion ("alias", &alias_completion_cb, NULL);
return WEECHAT_RC_OK;
}
@@ -777,12 +765,8 @@ int
weechat_plugin_end ()
{
alias_config_write ();
alias_free_all ();
alias_free_all ();
weechat_config_free (alias_config_file);
weechat_unhook (alias_command);
weechat_unhook (unalias_command);
weechat_unhook (config_reload);
weechat_unhook (completion);
return WEECHAT_RC_OK;
}
+6 -4
View File
@@ -15,12 +15,14 @@
#
SET(LIB_PROTOCOL_IRC_SRC irc.c irc.h irc-channel.c irc-channel.h irc-command.c
irc-command.h irc-config.c irc-config.h irc-server.c irc-server.h)
irc-command.h irc-completion.c irc-completion.h irc-config.c irc-config.h
irc-server.c irc-server.h)
#SET(LIB_PROTOCOL_IRC_SRC irc.c irc.h irc-buffer.c irc-buffer.h irc-channel.c
#irc-channel.h irc-command.c irc-command.h irc-color.c irc-color.h irc-config.c
#irc-config.h irc-dcc.c irc-dcc.h irc-display.c irc-input.c irc-log.c irc-mode.c
#irc-nick.c irc-nick.h irc-protocol.c irc-protocol.h irc-server.c irc-server.h)
#irc-channel.h irc-command.c irc-command.h irc-completion.c irc-completion.h
#irc-color.c irc-color.h irc-config.c irc-config.h irc-dcc.c irc-dcc.h
#irc-display.c irc-input.c irc-log.c irc-mode.c irc-nick.c irc-nick.h
#irc-protocol.c irc-protocol.h irc-server.c irc-server.h)
CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
+2
View File
@@ -28,6 +28,8 @@ irc_la_SOURCES = irc.c \
irc-color.h \
irc-command.c \
irc-command.h \
irc-completion.c \
irc-completion.h \
irc-config.c \
irc-config.h \
irc-display.c \
+85 -81
View File
@@ -48,7 +48,7 @@ int
irc_command_admin (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -219,7 +219,8 @@ irc_command_amsg (void *data, void *buffer, int argc, char **argv,
string = (char *)irc_color_decode (
(unsigned char *)argv_eol[1], 1, 0);
weechat_printf (ptr_channel->buffer, "%s%s",
irc_nick_as_prefix (ptr_nick),
irc_nick_as_prefix (ptr_nick,
NULL, NULL),
(string) ? string : argv_eol[1]);
if (string)
free (string);
@@ -378,7 +379,7 @@ int
irc_command_away (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server)
return WEECHAT_RC_ERROR;
@@ -415,7 +416,7 @@ irc_command_ban (void *data, void *buffer, int argc, char **argv,
char *pos_channel;
int pos_args;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -529,7 +530,7 @@ irc_command_connect (void *data, void *buffer, int argc, char **argv,
char *error;
long number;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
/* make C compiler happy */
(void) data;
@@ -677,7 +678,7 @@ irc_command_ctcp (void *data, void *buffer, int argc, char **argv,
char *pos, *irc_cmd;
struct timeval tv;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -766,7 +767,7 @@ irc_command_cycle (void *data, void *buffer, int argc, char **argv,
char **channels;
int i, num_channels;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -865,7 +866,7 @@ int
irc_command_dcc (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -930,7 +931,7 @@ int
irc_command_dehalfop (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -967,7 +968,7 @@ int
irc_command_deop (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1004,7 +1005,7 @@ int
irc_command_devoice (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1041,7 +1042,7 @@ int
irc_command_die (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1133,7 +1134,7 @@ irc_command_disconnect (void *data, void *buffer, int argc, char **argv,
{
int i, disconnect_ok;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
/* make C compiler happy */
(void) data;
@@ -1193,7 +1194,7 @@ int
irc_command_halfop (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1230,7 +1231,7 @@ int
irc_command_info (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1253,7 +1254,7 @@ int
irc_command_invite (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1289,7 +1290,7 @@ int
irc_command_ison (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1328,7 +1329,7 @@ int
irc_command_join (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1356,7 +1357,7 @@ irc_command_kick (void *data, void *buffer, int argc, char **argv,
{
char *pos_channel, *pos_nick, *pos_comment;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1422,7 +1423,7 @@ irc_command_kickban (void *data, void *buffer, int argc, char **argv,
{
char *pos_channel, *pos_nick, *pos_comment;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1488,7 +1489,7 @@ int
irc_command_kill (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1517,7 +1518,7 @@ int
irc_command_links (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1544,7 +1545,7 @@ irc_command_list (void *data, void *buffer, int argc, char **argv,
char buf[512];
int ret;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1602,7 +1603,7 @@ int
irc_command_lusers (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1626,7 +1627,7 @@ int
irc_command_me (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1672,7 +1673,7 @@ int
irc_command_mode (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1698,7 +1699,7 @@ int
irc_command_motd (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1728,7 +1729,7 @@ irc_command_msg (void *data, void *buffer, int argc, char **argv,
struct t_irc_nick *ptr_nick;
char *string;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1897,7 +1898,7 @@ int
irc_command_names (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -1961,7 +1962,7 @@ int
irc_command_nick (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server)
return WEECHAT_RC_ERROR;
@@ -2007,7 +2008,7 @@ irc_command_notice (void *data, void *buffer, int argc, char **argv,
{
char *string;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2047,7 +2048,7 @@ int
irc_command_op (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2084,7 +2085,7 @@ int
irc_command_oper (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2112,7 +2113,7 @@ irc_command_part (void *data, void *buffer, int argc, char **argv,
{
char *channel_name, *pos_args, *ptr_arg, *buf, *version;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2196,7 +2197,7 @@ int
irc_command_ping (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2222,7 +2223,7 @@ int
irc_command_pong (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server)
return WEECHAT_RC_ERROR;
@@ -2250,7 +2251,7 @@ irc_command_query (void *data, void *buffer, int argc, char **argv,
{
char *string;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2312,7 +2313,7 @@ int
irc_command_quote (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server)// || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2371,7 +2372,7 @@ irc_command_reconnect (void *data, void *buffer, int argc, char **argv,
{
int i, nb_reconnect, reconnect_ok, all_servers, no_join;
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
/* make C compiler happy */
(void) data;
@@ -2444,7 +2445,7 @@ int
irc_command_rehash (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2467,7 +2468,7 @@ int
irc_command_restart (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -2976,7 +2977,7 @@ int
irc_command_service (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3002,7 +3003,7 @@ int
irc_command_servlist (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3026,7 +3027,7 @@ int
irc_command_squery (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3057,7 +3058,7 @@ int
irc_command_squit (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3083,7 +3084,7 @@ int
irc_command_stats (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3108,7 +3109,7 @@ int
irc_command_summon (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3134,7 +3135,7 @@ int
irc_command_time (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3160,7 +3161,7 @@ irc_command_topic (void *data, void *buffer, int argc, char **argv,
{
char *channel_name, *new_topic;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3221,7 +3222,7 @@ int
irc_command_trace (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3248,7 +3249,7 @@ irc_command_unban (void *data, void *buffer, int argc, char **argv,
char *pos_channel;
int pos_args;
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3311,7 +3312,7 @@ int
irc_command_userhost (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3337,7 +3338,7 @@ int
irc_command_users (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3361,7 +3362,7 @@ int
irc_command_version (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3393,7 +3394,7 @@ int
irc_command_voice (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER_CHANNEL(buffer);
IRC_GET_SERVER_CHANNEL(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3431,7 +3432,7 @@ int
irc_command_wallops (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3457,7 +3458,7 @@ int
irc_command_who (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3481,7 +3482,7 @@ int
irc_command_whois (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3507,7 +3508,7 @@ int
irc_command_whowas (void *data, void *buffer, int argc, char **argv,
char **argv_eol)
{
IRC_COMMAND_GET_SERVER(buffer);
IRC_GET_SERVER(buffer);
if (!ptr_server || !ptr_server->is_connected)
return WEECHAT_RC_ERROR;
@@ -3563,7 +3564,7 @@ irc_command_init ()
N_("[channel] [nickname [nickname ...]]"),
N_(" channel: channel for ban\n"
"nickname: user or host to ban"),
"%N", &irc_command_ban, NULL);
"%(irc_channel_nicks_hosts)", &irc_command_ban, NULL);
weechat_hook_command ("connect",
N_("connect to server(s)"),
N_("[-all [-nojoin] | servername [servername ...] "
@@ -3579,7 +3580,7 @@ irc_command_init ()
"is 6667)\n"
" ipv6: use IPv6 protocol\n"
" ssl: use SSL protocol"),
"%S|-all|-nojoin|%*", &irc_command_connect, NULL);
"%(irc_servers)|-all|-nojoin|%*", &irc_command_connect, NULL);
weechat_hook_command ("ctcp",
N_("send a CTCP message (Client-To-Client Protocol)"),
N_("receiver type [arguments]"),
@@ -3587,14 +3588,15 @@ irc_command_init ()
" type: CTCP type (examples: \"version\", "
"\"ping\", ..)\n"
"arguments: arguments for CTCP"),
"%c|%n action|ping|version", &irc_command_ctcp, NULL);
"%(irc_channel)|%(irc_channel_nicks) action|ping|version",
&irc_command_ctcp, NULL);
weechat_hook_command ("cycle",
N_("leave and rejoin a channel"),
N_("[channel[,channel]] [part_message]"),
N_(" channel: channel name for cycle\n"
"part_message: part message (displayed to other "
"users)"),
"%p", &irc_command_cycle, NULL);
"%(irc_msg_part)", &irc_command_cycle, NULL);
weechat_hook_command ("dcc",
N_("starts DCC (file or chat) or close chat"),
N_("action [nickname [file]]"),
@@ -3602,7 +3604,8 @@ irc_command_init ()
"(chat)\n"
"nickname: nickname to send file or chat\n"
" file: filename (on local host)"),
"chat|send|close %n %f", &irc_command_dcc, NULL);
"chat|send|close %(irc_channel_nicks) %f",
&irc_command_dcc, NULL);
weechat_hook_command ("dehalfop",
N_("removes half channel operator status from "
"nickname(s)"),
@@ -3630,7 +3633,7 @@ irc_command_init ()
N_("[-all | servername [servername ...]]"),
N_(" -all: disconnect from all servers\n"
"servername: server name to disconnect"),
"%S|-all", &irc_command_disconnect, NULL);
"%(irc_servers)|-all", &irc_command_disconnect, NULL);
weechat_hook_command ("halfop",
N_("gives half channel operator status to "
"nickname(s)"),
@@ -3647,7 +3650,7 @@ irc_command_init ()
N_("nickname channel"),
N_("nickname: nick to invite\n"
" channel: channel to invite"),
"%n %c", &irc_command_invite, NULL);
"%(irc_channel_nicks) %(irc_channel)", &irc_command_invite, NULL);
weechat_hook_command ("ison",
N_("check if a nickname is currently on IRC"),
N_("nickname [nickname ...]"),
@@ -3658,27 +3661,27 @@ irc_command_init ()
N_("channel[,channel] [key[,key]]"),
N_("channel: channel name to join\n"
" key: key to join the channel"),
"%C", &irc_command_join, NULL);
"%(irc_channels)", &irc_command_join, NULL);
weechat_hook_command ("kick",
N_("forcibly remove a user from a channel"),
N_("[channel] nickname [comment]"),
N_(" channel: channel where user is\n"
"nickname: nickname to kick\n"
" comment: comment for kick"),
"%n %-", &irc_command_kick, NULL);
"%(irc_channel_nicks) %-", &irc_command_kick, NULL);
weechat_hook_command ("kickban",
N_("kicks and bans a nick from a channel"),
N_("[channel] nickname [comment]"),
N_(" channel: channel where user is\n"
"nickname: nickname to kick and ban\n"
" comment: comment for kick"),
"%n %-", &irc_command_kickban, NULL);
"%(irc_channel_nicks) %-", &irc_command_kickban, NULL);
weechat_hook_command ("kill",
N_("close client-server connection"),
N_("nickname comment"),
N_("nickname: nickname\n"
" comment: comment for kill"),
"%n %-", &irc_command_kill, NULL);
"%(irc_channel_nicks) %-", &irc_command_kill, NULL);
weechat_hook_command ("links",
N_("list all servernames which are known by the "
"server answering the query"),
@@ -3734,7 +3737,7 @@ irc_command_init ()
" s: mark a user for receive server notices\n"
" w: user receives wallops\n"
" o: operator flag"),
"%c|%m", &irc_command_mode, NULL);
"%(irc_channel)|%m", &irc_command_mode, NULL);
weechat_hook_command ("motd",
N_("get the \"Message Of The Day\""),
N_("[target]"),
@@ -3751,7 +3754,7 @@ irc_command_init ()
N_("list nicknames on channels"),
N_("[channel[,channel]]"),
N_("channel: channel name"),
"%C|%*", &irc_command_names, NULL);
"%(irc_channels)|%*", &irc_command_names, NULL);
weechat_hook_command ("nick",
N_("change current nickname"),
N_("[-all] nickname"),
@@ -3764,7 +3767,7 @@ irc_command_init ()
N_("nickname text"),
N_("nickname: user to send notice to\n"
" text: text to send"),
"%n %-", &irc_command_notice, NULL);
"%(irc_channel_nicks) %-", &irc_command_notice, NULL);
weechat_hook_command ("op",
N_("gives channel operator status to nickname(s)"),
N_("nickname [nickname]"),
@@ -3782,7 +3785,7 @@ irc_command_init ()
N_(" channel: channel name to leave\n"
"part_message: part message (displayed to other "
"users)"),
"%p", &irc_command_part, NULL);
"%(irc_msg_part)", &irc_command_part, NULL);
weechat_hook_command ("ping",
N_("ping server"),
N_("server1 [server2]"),
@@ -3801,7 +3804,7 @@ irc_command_init ()
N_("nickname [text]"),
N_("nickname: nickname for private conversation\n"
" text: text to send"),
"%n %-", &irc_command_query, NULL);
"%(irc_channel_nicks) %-", &irc_command_query, NULL);
weechat_hook_command ("quote",
N_("send raw data to server without parsing"),
N_("data"),
@@ -3815,7 +3818,7 @@ irc_command_init ()
"servername: server name to reconnect\n"
" -nojoin: do not join any channel (even if "
"autojoin is enabled on server)"),
"%S|-all|-nojoin|%*", &irc_command_reconnect, NULL);
"%(irc_servers)|-all|-nojoin|%*", &irc_command_reconnect, NULL);
weechat_hook_command ("rehash",
N_("tell the server to reload its config file"),
"",
@@ -3876,7 +3879,8 @@ irc_command_init ()
" deloutq: delete messages out queue for all "
"servers (all messages "
"WeeChat is currently sending)"),
"add|copy|rename|keep|del|deloutq|list|listfull %S %S",
"add|copy|rename|keep|del|deloutq|list|listfull "
"%(irc_servers) %(irc_servers)",
&irc_command_server, NULL);
weechat_hook_command ("servlist",
N_("list services currently connected to the "
@@ -3924,7 +3928,7 @@ irc_command_init ()
"topic: new topic for "
"channel (if topic is \"-delete\" then topic "
"is deleted)"),
"%t|-delete %-", &irc_command_topic, NULL);
"%(irc_topic)|-delete %-", &irc_command_topic, NULL);
weechat_hook_command ("trace",
N_("find the route to specific server"),
N_("[target]"),
@@ -3940,7 +3944,7 @@ irc_command_init ()
N_("return a list of information about nicknames"),
N_("nickname [nickname ...]"),
N_("nickname: nickname"),
"%n", &irc_command_userhost, NULL);
"%(irc_channel_nicks)", &irc_command_userhost, NULL);
weechat_hook_command ("users",
N_("list of users logged into the server"),
N_("[target]"),
@@ -3952,7 +3956,7 @@ irc_command_init ()
N_("[server | nickname]"),
N_(" server: server name\n"
"nickname: nickname"),
"%n", &irc_command_version, NULL);
"%(irc_channel_nicks)", &irc_command_version, NULL);
weechat_hook_command ("voice",
N_("gives voice to nickname(s)"),
N_("[nickname [nickname]]"),
@@ -3971,7 +3975,7 @@ irc_command_init ()
N_("mask: only information which match this mask\n"
" o: only operators are returned according to "
"the mask supplied"),
"%C", &irc_command_who, NULL);
"%(irc_channels)", &irc_command_who, NULL);
weechat_hook_command ("whois",
N_("query information about user(s)"),
N_("[server] nickname[,nickname]"),
+2 -21
View File
@@ -22,27 +22,6 @@
#include "irc-server.h"
#define IRC_COMMAND_GET_SERVER(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category"));
#define IRC_COMMAND_GET_SERVER_CHANNEL(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
struct t_irc_channel *ptr_channel = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
{ \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category")); \
ptr_channel = irc_channel_search ( \
ptr_server, weechat_buffer_get (__buffer, "name")); \
}
#define IRC_COMMAND_TOO_FEW_ARGUMENTS(__buffer, __command) \
weechat_printf (__buffer, \
_("%sirc: too few arguments for \"%s\" command"), \
@@ -50,7 +29,9 @@
return WEECHAT_RC_ERROR;
extern void irc_command_away_server (struct t_irc_server *, char *);
extern void irc_command_join_server (struct t_irc_server *, char *);
extern void irc_command_mode_server (struct t_irc_server *, char *);
extern void irc_command_quit_server (struct t_irc_server *, char *);
extern void irc_command_init ();
+341
View File
@@ -0,0 +1,341 @@
/*
* Copyright (c) 2003-2007 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-command.c: IRC commands managment */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "irc.h"
#include "irc-completion.h"
#include "irc-config.h"
#include "irc-server.h"
#include "irc-channel.h"
#include "irc-nick.h"
/*
* irc_completion_server_cb: callback for completion with current IRC server
*/
int
irc_completion_server_cb (void *data, char *completion, void *buffer,
void *list)
{
IRC_GET_SERVER(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
if (ptr_server)
weechat_list_add (list, ptr_server->name, "sort");
return WEECHAT_RC_OK;
}
/*
* irc_completion_server_nicks_cb: callback for completion with nicks
* of all IRC servers
*/
int
irc_completion_server_nicks_cb (void *data, char *completion, void *buffer,
void *list)
{
struct t_irc_server *ptr_server2;
struct t_irc_channel *ptr_channel2;
struct t_irc_nick *ptr_nick;
IRC_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
(void) buffer;
if (ptr_server && ptr_channel)
{
for (ptr_server2 = irc_servers; ptr_server2;
ptr_server2 = ptr_server2->next_server)
{
for (ptr_channel2 = ptr_server2->channels; ptr_channel2;
ptr_channel2 = ptr_channel2->next_channel)
{
if ((ptr_channel2 != ptr_channel)
&& (ptr_channel2->type == IRC_CHANNEL_TYPE_CHANNEL))
{
for (ptr_nick = ptr_channel2->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
weechat_list_add (list, ptr_nick->nick, "sort");
}
}
}
}
/* add current channel nicks at beginning */
if (ptr_channel && (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
{
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
weechat_list_add (list, ptr_nick->nick, "beginning");
}
}
/* add self nick at the end */
weechat_list_add (list, ptr_server->nick, "end");
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_servers_cb: callback for completion with IRC servers
*/
int
irc_completion_servers_cb (void *data, char *completion, void *buffer,
void *list)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
(void) data;
(void) completion;
(void) buffer;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
weechat_list_add (list, ptr_server->name, "sort");
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_channel_cb: callback for completion with current IRC channel
*/
int
irc_completion_channel_cb (void *data, char *completion, void *buffer,
void *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
if (ptr_channel)
weechat_list_add (list, ptr_channel->name, "sort");
return WEECHAT_RC_OK;
}
/*
* irc_completion_channel_nicks_cb: callback for completion with nicks
* of current IRC channel
*/
int
irc_completion_channel_nicks_cb (void *data, char *completion, void *buffer,
void *list)
{
struct t_irc_nick *ptr_nick;
char *nick;
int list_size, i;
IRC_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
if (ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
weechat_list_add (list, ptr_nick->nick, "sort");
}
/* add nicks speaking recently on this channel */
if (weechat_config_boolean (irc_config_irc_nick_completion_smart))
{
list_size = weechat_list_size (ptr_channel->nicks_speaking);
for (i = 0; i < list_size; i++)
{
nick = weechat_list_string (weechat_list_get (ptr_channel->nicks_speaking, i));
if (nick && irc_nick_search (ptr_channel, nick))
{
weechat_list_add (list, nick, "beginning");
}
}
}
/* add self nick at the end */
weechat_list_add (list, ptr_server->nick, "end");
}
if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
|| (ptr_channel->type == IRC_CHANNEL_TYPE_DCC_CHAT))
{
weechat_list_add (list, ptr_channel->name, "sort");
}
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_channel_nicks_hosts_cb: callback for completion with nicks
* and hosts of current IRC channel
*/
int
irc_completion_channel_nicks_hosts_cb (void *data, char *completion, void *buffer,
void *list)
{
struct t_irc_nick *ptr_nick;
char *buf;
int length;
IRC_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
if (ptr_channel)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
{
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
weechat_list_add (list, ptr_nick->nick, "sort");
if (ptr_nick->host)
{
length = strlen (ptr_nick->nick) + 1 +
strlen (ptr_nick->host) + 1;
buf = (char *) malloc (length);
if (buf)
{
snprintf (buf, length, "%s!%s",
ptr_nick->nick, ptr_nick->host);
weechat_list_add (list, buf, "sort");
free (buf);
}
}
}
}
if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
|| (ptr_channel->type == IRC_CHANNEL_TYPE_DCC_CHAT))
{
weechat_list_add (list, ptr_channel->name, "sort");
}
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_channel_topic_cb: callback for completion with topic of
* current IRC channel
*/
int
irc_completion_channel_topic_cb (void *data, char *completion, void *buffer,
void *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
(void) data;
(void) completion;
if (ptr_channel && ptr_channel->topic && ptr_channel->topic[0])
{
weechat_list_add (list, ptr_channel->topic, "sort");
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_channels_cb: callback for completion with IRC channels
*/
int
irc_completion_channels_cb (void *data, char *completion, void *buffer,
void *list)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) data;
(void) completion;
(void) buffer;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
weechat_list_add (list, ptr_channel->name, "sort");
}
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_msg_part_cb: callback for completion with default part message
*/
int
irc_completion_msg_part_cb (void *data, char *completion, void *buffer,
void *list)
{
/* make C compiler happy */
(void) data;
(void) completion;
(void) buffer;
if (weechat_config_string (irc_config_irc_default_msg_part)
&& weechat_config_string (irc_config_irc_default_msg_part)[0])
{
weechat_list_add (list,
weechat_config_string (irc_config_irc_default_msg_part),
"sort");
}
return WEECHAT_RC_OK;
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2003-2007 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_IRC_COMPLETION_H
#define __WEECHAT_IRC_COMPLETION_H 1
extern int irc_completion_server_cb (void *, char *, void *, void *);
extern int irc_completion_server_nicks_cb (void *, char *, void *, void *);
extern int irc_completion_servers_cb (void *, char *, void *, void *);
extern int irc_completion_channel_cb (void *, char *, void *, void *);
extern int irc_completion_channel_nicks_cb (void *, char *, void *, void *);
extern int irc_completion_channel_nicks_hosts_cb (void *, char *, void *,
void *);
extern int irc_completion_channel_topic_cb (void *, char *, void *, void *);
extern int irc_completion_channels_cb (void *, char *, void *, void *);
extern int irc_completion_msg_part_cb (void *, char *, void *, void *);
#endif /* irc-completion.h */
+12 -7
View File
@@ -44,6 +44,7 @@ struct t_config_option *irc_config_irc_one_server_buffer;
struct t_config_option *irc_config_irc_open_near_server;
struct t_config_option *irc_config_irc_nick_prefix;
struct t_config_option *irc_config_irc_nick_suffix;
struct t_config_option *irc_config_irc_nick_completion_smart;
struct t_config_option *irc_config_irc_display_away;
struct t_config_option *irc_config_irc_show_away_once;
struct t_config_option *irc_config_irc_default_msg_part;
@@ -130,20 +131,20 @@ irc_config_change_one_server_buffer ()
void
irc_config_change_away_check ()
{
if (irc_timer_check_away)
if (irc_hook_timer_check_away)
{
weechat_unhook (irc_timer_check_away);
irc_timer_check_away = NULL;
weechat_unhook (irc_hook_timer_check_away);
irc_hook_timer_check_away = NULL;
}
if (weechat_config_integer (irc_config_irc_away_check) == 0)
{
/* reset away flag for all nicks/chans/servers */
//irc_server_remove_away ();
}
/*irc_timer_check_away = weechat_hook_timer (weechat_config_integer (irc_config_irc_away_check) * 60 * 1000,
0,
irc_server_timer_check_away,
NULL);
/*irc_hook_timer_check_away = weechat_hook_timer (weechat_config_integer (irc_config_irc_away_check) * 60 * 1000,
0,
irc_server_timer_check_away,
NULL);
*/
}
@@ -434,6 +435,10 @@ irc_config_init ()
ptr_section, "irc_nick_suffix", "string",
N_("text to display after nick in chat window"),
NULL, 0, 0, "", NULL);
irc_config_irc_nick_completion_smart = weechat_config_new_option (
ptr_section, "irc_nick_completion_smart", "boolean",
N_("smart completion for nicks (completes with last speakers first)"),
NULL, 0, 0, "on", NULL);
irc_config_irc_display_away = weechat_config_new_option (
ptr_section, "irc_display_away", "integer",
N_("display message when (un)marking as away"),
+1
View File
@@ -32,6 +32,7 @@ struct t_config_option *irc_config_irc_one_server_buffer;
struct t_config_option *irc_config_irc_open_near_server;
struct t_config_option *irc_config_irc_nick_prefix;
struct t_config_option *irc_config_irc_nick_suffix;
struct t_config_option *irc_config_irc_nick_completion_smart;
struct t_config_option *irc_config_irc_display_away;
struct t_config_option *irc_config_irc_show_away_once;
struct t_config_option *irc_config_irc_default_msg_part;
+20 -2
View File
@@ -24,11 +24,13 @@
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "irc.h"
#include "irc-nick.h"
#include "irc-config.h"
#include "irc-server.h"
#include "irc-channel.h"
@@ -423,9 +425,25 @@ irc_nick_set_away (struct t_irc_channel *channel, struct t_irc_nick *nick,
*/
char *
irc_nick_as_prefix (struct t_irc_nick *nick)
irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname, char *force_color)
{
static char result[10] = "";
static char result[256];
snprintf (result, sizeof (result), "%s%s%s%s%s%s\t",
(weechat_config_string (irc_config_irc_nick_prefix)
&& weechat_config_string (irc_config_irc_nick_prefix)[0]) ?
IRC_COLOR_CHAT_DELIMITERS : "",
(weechat_config_string (irc_config_irc_nick_prefix)
&& weechat_config_string (irc_config_irc_nick_prefix)[0]) ?
weechat_config_string (irc_config_irc_nick_prefix) : "",
(force_color) ? force_color : ((nick) ? nick->color : IRC_COLOR_CHAT_NICK),
(nick) ? nick->nick : nickname,
(weechat_config_string (irc_config_irc_nick_suffix)
&& weechat_config_string (irc_config_irc_nick_suffix)[0]) ?
IRC_COLOR_CHAT_DELIMITERS : "",
(weechat_config_string (irc_config_irc_nick_suffix)
&& weechat_config_string (irc_config_irc_nick_suffix)[0]) ?
weechat_config_string (irc_config_irc_nick_suffix) : "");
return result;
}
+2 -2
View File
@@ -45,7 +45,7 @@ struct t_irc_nick
char *host; /* full hostname */
int flags; /* chanowner/chanadmin (unrealircd), */
/* op, halfop, voice, away */
int color; /* color for nickname in chat window */
char *color; /* color for nickname in chat window */
struct t_irc_nick *prev_nick; /* link to previous nick on channel */
struct t_irc_nick *next_nick; /* link to next nick on channel */
};
@@ -62,7 +62,7 @@ extern void irc_nick_free_all (struct t_irc_channel *);
extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *, char *);
extern void irc_nick_count (struct t_irc_channel *, int *, int *, int *, int *, int *);
extern void irc_nick_set_away (struct t_irc_channel *, struct t_irc_nick *, int);
extern char *irc_nick_as_prefix (struct t_irc_nick *);
extern char *irc_nick_as_prefix (struct t_irc_nick *, char *, char *);
extern void irc_nick_print_log (struct t_irc_nick *);
#endif /* irc-nick.h */
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -49,6 +49,7 @@
#include "irc-channel.h"
#include "irc-config.h"
#include "irc-nick.h"
#include "irc-protocol.h"
struct t_irc_server *irc_servers = NULL;
@@ -1227,7 +1228,7 @@ irc_server_msgq_flush ()
irc_server_parse_message (ptr_msg, &host,
&command, &args);
/*switch (irc_protocol_recv_command (irc_recv_msgq->server,
switch (irc_protocol_recv_command (irc_recv_msgq->server,
ptr_msg,
host, command, args))
{
@@ -1254,7 +1255,7 @@ irc_server_msgq_flush ()
command, host, args);
break;
}
*/
if (host)
free (host);
if (command)
+24 -19
View File
@@ -31,6 +31,7 @@
#include "irc.h"
#include "irc-command.h"
#include "irc-completion.h"
#include "irc-config.h"
#include "irc-server.h"
@@ -41,8 +42,8 @@ char plugin_description[] = "IRC (Internet Relay Chat)";
struct t_weechat_plugin *weechat_irc_plugin = NULL;
struct t_hook *irc_timer = NULL;
struct t_hook *irc_timer_check_away = NULL;
struct t_hook *irc_hook_timer = NULL;
struct t_hook *irc_hook_timer_check_away = NULL;
#ifdef HAVE_GNUTLS
gnutls_certificate_credentials gnutls_xcred; /* gnutls client credentials */
@@ -163,10 +164,25 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
irc_command_init ();
/* hook events */
weechat_hook_event ("config_reload", &irc_config_reload_cb, NULL);
weechat_hook_event ("quit", &irc_quit_cb, NULL);
/* hook completions */
weechat_hook_completion ("irc_server", &irc_completion_server_cb, NULL);
weechat_hook_completion ("irc_server_nicks",
&irc_completion_server_nicks_cb, NULL);
weechat_hook_completion ("irc_servers", &irc_completion_servers_cb, NULL);
weechat_hook_completion ("irc_channel", &irc_completion_channel_cb, NULL);
weechat_hook_completion ("irc_channel_nicks",
&irc_completion_channel_nicks_cb, NULL);
weechat_hook_completion ("irc_channel_nicks_hosts",
&irc_completion_channel_nicks_hosts_cb, NULL);
weechat_hook_completion ("irc_channel_topic",
&irc_completion_channel_topic_cb, NULL);
weechat_hook_completion ("irc_channels", &irc_completion_channels_cb, NULL);
weechat_hook_completion ("irc_msg_part", &irc_completion_msg_part_cb, NULL);
//irc_server_auto_connect (1, 0);
/*
@@ -190,23 +206,12 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
int
weechat_plugin_end ()
{
if (irc_timer)
{
weechat_unhook (irc_timer);
irc_timer = NULL;
}
if (irc_timer_check_away)
{
weechat_unhook (irc_timer_check_away);
irc_timer_check_away = NULL;
}
//irc_server_disconnect_all ();
//irc_dcc_end ();
//irc_server_free_all ();
irc_config_write ();
irc_server_disconnect_all ();
//irc_dcc_end ();
irc_server_free_all ();
#ifdef HAVE_GNUTLS
/* GnuTLS end */
gnutls_certificate_free_credentials (gnutls_xcred);
+30 -1
View File
@@ -28,15 +28,44 @@
#define weechat_plugin weechat_irc_plugin
#define IRC_GET_SERVER(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category"));
#define IRC_GET_SERVER_CHANNEL(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
struct t_irc_channel *ptr_channel = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
{ \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category")); \
ptr_channel = irc_channel_search ( \
ptr_server, weechat_buffer_get (__buffer, "name")); \
}
#define IRC_COLOR_CHAT weechat_color("color_chat")
#define IRC_COLOR_CHAT_CHANNEL weechat_color("color_chat_channel")
#define IRC_COLOR_CHAT_DELIMITERS weechat_color("color_chat_delimiters")
#define IRC_COLOR_CHAT_HIGHLIGHT weechat_color("color_chat_highlight")
#define IRC_COLOR_CHAT_HOST weechat_color("color_chat_host")
#define IRC_COLOR_CHAT_NICK weechat_color("color_chat_nick")
#define IRC_COLOR_CHAT_NICK_OTHER weechat_color("color_chat_nick_other")
#define IRC_COLOR_CHAT_SERVER weechat_color("color_chat_server")
#define IRC_COLOR_INFOBAR_HIGHLIGHT weechat_color("color_infobar_highlight")
#define IRC_COLOR_NICKLIST_PREFIX1 weechat_color("color_nicklist_prefix1")
#define IRC_COLOR_NICKLIST_PREFIX2 weechat_color("color_nicklist_prefix2")
#define IRC_COLOR_NICKLIST_PREFIX3 weechat_color("color_nicklist_prefix3")
#define IRC_COLOR_NICKLIST_PREFIX4 weechat_color("color_nicklist_prefix4")
#define IRC_COLOR_NICKLIST_PREFIX5 weechat_color("color_nicklist_prefix5")
extern struct t_weechat_plugin *weechat_irc_plugin;
extern struct t_hook *irc_timer_check_away;
extern struct t_hook *irc_hook_timer_check_away;
extern gnutls_certificate_credentials gnutls_xcred;
+17 -15
View File
@@ -1235,33 +1235,35 @@ plugin_api_log_printf (struct t_weechat_plugin *plugin, char *format, ...)
}
/*
* plugin_api_print_infobar: print a message in infobar
* plugin_api_infobar_printf: print a message in infobar
*/
void
plugin_api_print_infobar (struct t_weechat_plugin *plugin, int time_displayed,
char *message, ...)
plugin_api_infobar_printf (struct t_weechat_plugin *plugin, int time_displayed,
char *color_name, char *format, ...)
{
(void) plugin;
(void) time_displayed;
(void) message;
/*va_list argptr;
va_list argptr;
static char buf[1024];
char *buf2;
int num_color;
if (!plugin || (time_displayed < 0) || !message)
if (!plugin || (time_displayed < 0) || !format)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_start (argptr, format);
vsnprintf (buf, sizeof (buf) - 1, format, argptr);
va_end (argptr);
buf2 = string_iconv_to_internal (plugin->charset, buf);
gui_infobar_printf (time_displayed, GUI_COLOR_WIN_INFOBAR, "%s",
num_color = gui_color_search_config (color_name);
if (num_color < 0)
num_color = GUI_COLOR_INFOBAR;
gui_infobar_printf (time_displayed,
num_color,
"%s",
(buf2) ? buf2 : buf);
if (buf2)
free (buf2);*/
free (buf2);
}
/*
@@ -1284,7 +1286,7 @@ plugin_api_infobar_remove (struct t_weechat_plugin *plugin, int how_many)
how_many--;
}
}
gui_infobar_draw (gui_current_window->buffer, 1);
//gui_infobar_draw (gui_current_window->buffer, 1);
}
/*
@@ -1402,7 +1404,7 @@ plugin_api_hook_config (struct t_weechat_plugin *plugin, char *config_type,
struct t_hook *
plugin_api_hook_completion (struct t_weechat_plugin *plugin, char *completion,
int (*callback)(void *, char *, void *),
int (*callback)(void *, char *, void *, void *),
void *data)
{
if (plugin && callback)
+3 -3
View File
@@ -136,8 +136,8 @@ extern void plugin_api_printf (struct t_weechat_plugin *, void *,
extern void plugin_api_printf_date (struct t_weechat_plugin *, void *,
time_t, char *, ...);
extern void plugin_api_log_printf (struct t_weechat_plugin *, char *, ...);
extern void plugin_api_print_infobar (struct t_weechat_plugin *, int,
char *, ...);
extern void plugin_api_infobar_printf (struct t_weechat_plugin *, int, char *,
char *, ...);
extern void plugin_api_infobar_remove (struct t_weechat_plugin *, int);
/* hooks */
@@ -165,7 +165,7 @@ extern struct t_hook *plugin_api_hook_config (struct t_weechat_plugin *,
void *);
extern struct t_hook *plugin_api_hook_completion (struct t_weechat_plugin *,
char *,
int (*)(void *, char *, void *),
int (*)(void *, char *, void *, void *),
void *);
extern void plugin_api_unhook (struct t_weechat_plugin *, void *);
extern void plugin_api_unhook_all (struct t_weechat_plugin *);
+1 -1
View File
@@ -296,7 +296,7 @@ plugin_load (char *filename)
new_plugin->printf = &plugin_api_printf;
new_plugin->printf_date = &plugin_api_printf_date;
new_plugin->log_printf = &plugin_api_log_printf;
new_plugin->print_infobar = &plugin_api_print_infobar;
new_plugin->infobar_printf = &plugin_api_infobar_printf;
new_plugin->infobar_remove = &plugin_api_infobar_remove;
new_plugin->hook_command = &plugin_api_hook_command;
+8 -2
View File
@@ -151,7 +151,8 @@ struct t_weechat_plugin
void (*printf_date) (struct t_weechat_plugin *, void *, time_t,
char *, ...);
void (*log_printf) (struct t_weechat_plugin *, char *, ...);
void (*print_infobar) (struct t_weechat_plugin *, int, char *, ...);
void (*infobar_printf) (struct t_weechat_plugin *, int, char *,
char *, ...);
void (*infobar_remove) (struct t_weechat_plugin *, int);
/* hooks */
@@ -173,7 +174,7 @@ struct t_weechat_plugin
int (*)(void *, char *, char *, char *),
void *);
struct t_hook *(*hook_completion) (struct t_weechat_plugin *, char *,
int (*)(void *, char *, void *),
int (*)(void *, char *, void *, void *),
void *);
void (*unhook) (struct t_weechat_plugin *, void *);
void (*unhook_all) (struct t_weechat_plugin *);
@@ -392,6 +393,11 @@ struct t_weechat_plugin
##__argz)
#define weechat_log_printf(__argz...) \
weechat_plugin->log_printf(weechat_plugin, ##__argz)
#define weechat_infobar_printf(__delay, __color, __argz...) \
weechat_plugin->infobar_printf(weechat_plugin, __delay, __color, \
##__argz)
#define weechat_infobar_remove(__number) \
weechat_plugin->infobar_remove(weechat_plugin, __number)
/* hooks */
#define weechat_hook_command(__command, __description, __args, \