Added tox-weechat-completion.{h,c}.

This commit is contained in:
Håvard Pettersson 2014-09-19 16:55:11 +02:00
parent 95b9a2322f
commit 9810bf14d9
4 changed files with 45 additions and 0 deletions

View File

@ -42,6 +42,7 @@ add_library(tox MODULE
src/tox-weechat-utils.c src/tox-weechat-utils.c
src/tox-weechat-config.c src/tox-weechat-config.c
src/tox-weechat-json.c src/tox-weechat-json.c
src/tox-weechat-completion.c
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Werror-implicit-function-declaration -Wno-unused-parameter") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Werror-implicit-function-declaration -Wno-unused-parameter")

View File

@ -0,0 +1,35 @@
#include <stdlib.h>
#include <weechat/weechat-plugin.h>
#include "tox-weechat.h"
#include "tox-weechat-identities.h"
#include "tox-weechat-completion.h"
int
tox_weechat_completion_identity(void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
for (struct t_tox_weechat_identity *identity = tox_weechat_identities;
identity;
identity = identity->next_identity)
{
weechat_hook_completion_list_add(completion,
identity->name,
0,
WEECHAT_LIST_POS_SORT);
}
return WEECHAT_RC_OK;
}
void
tox_weechat_completion_init()
{
weechat_hook_completion("tox_identity",
"identity",
tox_weechat_completion_identity, NULL);
}

View File

@ -0,0 +1,7 @@
#ifndef TOX_WEECHAT_COMPLETION_H
#define TOX_WEECHAT_COMPLETION_H
void
tox_weechat_completion_init();
#endif // TOX_WEECHAT_COMPLETION_H

View File

@ -27,6 +27,7 @@
#include "tox-weechat-friend-requests.h" #include "tox-weechat-friend-requests.h"
#include "tox-weechat-config.h" #include "tox-weechat-config.h"
#include "tox-weechat-json.h" #include "tox-weechat-json.h"
#include "tox-weechat-completion.h"
#include "tox-weechat.h" #include "tox-weechat.h"
@ -51,6 +52,7 @@ weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[])
tox_weechat_config_read(); tox_weechat_config_read();
tox_weechat_commands_init(); tox_weechat_commands_init();
tox_weechat_gui_init(); tox_weechat_gui_init();
tox_weechat_completion_init();
tox_weechat_identity_autoconnect(); tox_weechat_identity_autoconnect();