diff --git a/.envrc b/.envrc index a949951..44230a4 100644 --- a/.envrc +++ b/.envrc @@ -45,11 +45,11 @@ ln -sf $(guix build --source lmdb)/libraries/liblmdb/mdb.c mdb.c use guix \ ${ENVIRONMENTS[@]} --ad-hoc ${PACKAGES[@]} \ - --with-debug-info=profanity\ + --with-debug-info=profanity \ --with-debug-info=weechat \ --with-debug-info=libstrophe \ --with-debug-info=libsignal-protocol-c \ - --with-debug-info=libomemo-c\ + --with-debug-info=libomemo-c \ --with-debug-info=lmdb \ --with-debug-info=rnp \ clang clang:extra ccls gdb diff --git a/account.c b/account.c index 4357d82..a34a550 100644 --- a/account.c +++ b/account.c @@ -13,7 +13,7 @@ #include "plugin.hh" #include "xmpp/stanza.hh" -#include "config.h" +#include "config.hh" #include "input.h" #include "omemo.h" #include "account.h" diff --git a/completion.c b/completion.c index af9c283..3bf9da7 100644 --- a/completion.c +++ b/completion.c @@ -10,7 +10,7 @@ #include #include "plugin.hh" -#include "config.h" +#include "config.hh" #include "account.h" #include "channel.h" #include "user.h" @@ -59,7 +59,7 @@ int completion__channel_nicks_cb(const void *pointer, void *data, (void) pointer; (void) data; (void) completion_item; - + ptr_account = NULL; ptr_channel = NULL; buffer__get_account_and_channel(buffer, &ptr_account, &ptr_channel); @@ -128,12 +128,12 @@ void completion__init() struct t_config_option *option; const char *default_template; - + weechat_hook_completion("nick", N_("nicks of current Slack channel"), &completion__channel_nicks_cb, NULL, NULL); - + weechat_hook_completion("account", N_("xmpp accounts"), &completion__accounts_cb, diff --git a/config.c b/config.cpp similarity index 99% rename from config.c rename to config.cpp index ae60dac..4c538f2 100644 --- a/config.c +++ b/config.cpp @@ -10,7 +10,7 @@ #include "plugin.hh" #include "account.h" -#include "config.h" +#include "config.hh" struct t_config_file *config_file; @@ -302,7 +302,7 @@ int config__account_read_cb (const void *pointer, void *data, if (option_name) { - pos_option = strrchr(option_name, '.'); + pos_option = const_cast(strrchr(option_name, '.')); if (pos_option) { account_name = weechat_strndup(option_name, diff --git a/config.h b/config.h deleted file mode 100644 index 8b2214d..0000000 --- a/config.h +++ /dev/null @@ -1,57 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, version 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef _WEECHAT_XMPP_CONFIG_H_ -#define _WEECHAT_XMPP_CONFIG_H_ - -#define WEECHAT_XMPP_CONFIG_NAME "xmpp" - -enum t_config_nick_completion -{ - CONFIG_NICK_COMPLETION_SMART_OFF = 0, - CONFIG_NICK_COMPLETION_SMART_SPEAKERS, - CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS, -}; - -extern struct t_config_file *config_file; - -extern struct t_config_section *config_section_account_default; -extern struct t_config_section *config_section_account; - -extern struct t_config_option *config_look_nick_completion_smart; - -extern struct t_config_option *config_account_default[]; - -int config__account_check_value_cb(const void *pointer, void *data, - struct t_config_option *option, - const char *value); - -void config__account_change_cb(const void *pointer, void *data, - struct t_config_option *option); - -struct t_config_option *config__account_new_option (struct t_config_file *config_file, - struct t_config_section *section, - int index_option, - const char *option_name, - const char *default_value, - const char *value, - int null_value_allowed, - int (*callback_check_value)(const void *pointer, - void *data, - struct t_config_option *option, - const char *value), - const void *callback_check_value_pointer, - void *callback_check_value_data, - void (*callback_change)(const void *pointer, - void *data, - struct t_config_option *option), - const void *callback_change_pointer, - void *callback_change_data); - -extern int config__init(); -extern int config__read(); -extern int config__write(); -extern void config__free(); - -#endif /*WEECHAT_XMPP_CONFIG_H*/ diff --git a/config.hh b/config.hh new file mode 100644 index 0000000..bb33ae7 --- /dev/null +++ b/config.hh @@ -0,0 +1,55 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, version 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#pragma once + +#define WEECHAT_XMPP_CONFIG_NAME "xmpp" + +enum t_config_nick_completion +{ + CONFIG_NICK_COMPLETION_SMART_OFF = 0, + CONFIG_NICK_COMPLETION_SMART_SPEAKERS, + CONFIG_NICK_COMPLETION_SMART_SPEAKERS_HIGHLIGHTS, +}; + +extern struct t_config_file *config_file; + +extern struct t_config_section *config_section_account_default; +extern struct t_config_section *config_section_account; + +extern struct t_config_option *config_look_nick_completion_smart; + +extern struct t_config_option *config_account_default[]; + +int config__account_check_value_cb(const void *pointer, void *data, + struct t_config_option *option, + const char *value); + +void config__account_change_cb(const void *pointer, void *data, + struct t_config_option *option); + +struct t_config_option *config__account_new_option ( + struct t_config_file *config_file, + struct t_config_section *section, + int index_option, + const char *option_name, + const char *default_value, + const char *value, + int null_value_allowed, + int (*callback_check_value)(const void *pointer, + void *data, + struct t_config_option *option, + const char *value), + const void *callback_check_value_pointer, + void *callback_check_value_data, + void (*callback_change)(const void *pointer, + void *data, + struct t_config_option *option), + const void *callback_change_pointer, + void *callback_change_data); + +extern int config__init(); +extern int config__read(); +extern int config__write(); +extern void config__free(); diff --git a/connection.c b/connection.c index 0b4d24e..643fac7 100644 --- a/connection.c +++ b/connection.c @@ -12,9 +12,8 @@ #include #include "plugin.hh" -#include "diff/diff.h" #include "xmpp/stanza.hh" -#include "config.h" +#include "config.hh" #include "account.h" #include "user.h" #include "channel.h" @@ -22,6 +21,7 @@ #include "omemo.h" #include "pgp.h" #include "util.h" +#include "diff/diff.h" void connection__init() { diff --git a/makefile b/makefile index 3aaf743..b601f45 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,7 @@ endif RM=rm -f FIND=find -INCLUDES=-Ilibstrophe \ +INCLUDES=-Ilibstrophe -Ideps \ $(shell xml2-config --cflags) \ $(shell pkg-config --cflags librnp-0) \ $(shell pkg-config --cflags libomemo-c) @@ -45,7 +45,7 @@ HDRS=plugin.hh \ channel.h \ command.h \ completion.h \ - config.h \ + config.hh \ connection.h \ input.h \ message.h \ @@ -61,7 +61,7 @@ SRCS=plugin.cpp \ channel.c \ command.c \ completion.c \ - config.c \ + config.cpp \ connection.c \ input.c \ message.c \ diff --git a/plugin.cpp b/plugin.cpp index e1cbbba..6490a85 100644 --- a/plugin.cpp +++ b/plugin.cpp @@ -10,8 +10,8 @@ #include #include "plugin.hh" +#include "config.hh" extern "C" { -#include "config.h" #include "account.h" #include "connection.h" #include "command.h" diff --git a/tests/run b/tests/run index 21b73ce..f158e82 100755 Binary files a/tests/run and b/tests/run differ