1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 17:23:15 +02:00

Add completion %(irc_privates), used by /buffer (completes with channels and pv)

This commit is contained in:
Sebastien Helleu
2009-05-09 13:50:41 +02:00
parent 8a783825de
commit 74f5fe7bc5
2 changed files with 39 additions and 0 deletions
+2
View File
@@ -3706,6 +3706,8 @@ command_init ()
" || localvar"
" || set"
" || %(buffers_names)"
" || %(irc_channels)"
" || %(irc_privates)"
" || %(buffers_numbers)",
&command_buffer, NULL);
hook_command (NULL, "command",
+37
View File
@@ -400,6 +400,40 @@ irc_completion_channels_cb (void *data, const char *completion_item,
return WEECHAT_RC_OK;
}
/*
* irc_completion_privates_cb: callback for completion with channels
*/
int
irc_completion_privates_cb (void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) data;
(void) completion_item;
(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)
{
if (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE)
{
weechat_hook_completion_list_add (completion, ptr_channel->name,
0, WEECHAT_LIST_POS_SORT);
}
}
}
return WEECHAT_RC_OK;
}
/*
* irc_completion_msg_part_cb: callback for completion with default part message
*/
@@ -488,6 +522,9 @@ irc_completion_init ()
weechat_hook_completion ("irc_channels",
N_("IRC channels (on all servers)"),
&irc_completion_channels_cb, NULL);
weechat_hook_completion ("irc_privates",
N_("IRC privates (on all servers)"),
&irc_completion_privates_cb, NULL);
weechat_hook_completion ("irc_msg_part",
N_("default part message for IRC channel"),
&irc_completion_msg_part_cb, NULL);