diff --git a/.gitignore b/.gitignore index 3ca5841..00be7c8 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ cscope* *.i*86 *.x86_64 *.hex +**/run # Debug files *.dSYM/ diff --git a/account.cpp b/account.cpp index e435a0b..f012b9a 100644 --- a/account.cpp +++ b/account.cpp @@ -14,13 +14,13 @@ #include "plugin.hh" #include "xmpp/stanza.hh" #include "config.hh" -#include "input.h" +#include "input.hh" #include "omemo.hh" #include "account.hh" #include "connection.hh" #include "user.hh" #include "channel.hh" -#include "buffer.h" +#include "buffer.hh" struct t_account *accounts = NULL; struct t_account *last_account = NULL; diff --git a/buffer.c b/buffer.cpp similarity index 97% rename from buffer.c rename to buffer.cpp index 3782ed8..7bd22b9 100644 --- a/buffer.c +++ b/buffer.cpp @@ -10,7 +10,7 @@ #include "plugin.hh" #include "account.hh" #include "channel.hh" -#include "buffer.h" +#include "buffer.hh" void buffer__get_account_and_channel(struct t_gui_buffer *buffer, struct t_account **account, @@ -145,7 +145,7 @@ int buffer__close_cb(const void *pointer, void *data, (void) pointer; (void) data; - buffer_plugin = weechat_buffer_get_pointer(buffer, "plugin"); + buffer_plugin = (struct t_weechat_plugin*)weechat_buffer_get_pointer(buffer, "plugin"); if (buffer_plugin != weechat_plugin) return WEECHAT_RC_OK; buffer__get_account_and_channel(buffer, &ptr_account, &ptr_channel); diff --git a/buffer.h b/buffer.hh similarity index 91% rename from buffer.h rename to buffer.hh index c07794c..e78a366 100644 --- a/buffer.h +++ b/buffer.hh @@ -2,8 +2,7 @@ // 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_BUFFER_H_ -#define _WEECHAT_XMPP_BUFFER_H_ +#pragma once void buffer__get_account_and_channel(struct t_gui_buffer *buffer, struct t_account **account, @@ -22,5 +21,3 @@ int buffer__nickcmp_cb(const void *pointer, void *data, int buffer__close_cb(const void *pointer, void *data, struct t_gui_buffer *buffer); - -#endif /*WEECHAT_XMPP_BUFFER_H*/ diff --git a/channel.cpp b/channel.cpp index a3281fa..6b7d2c9 100644 --- a/channel.cpp +++ b/channel.cpp @@ -15,8 +15,8 @@ #include "omemo.hh" #include "user.hh" #include "channel.hh" -#include "input.h" -#include "buffer.h" +#include "input.hh" +#include "buffer.hh" #include "pgp.hh" #include "util.hh" diff --git a/command.cpp b/command.cpp index 5cfff16..55d4824 100644 --- a/command.cpp +++ b/command.cpp @@ -14,8 +14,8 @@ #include "account.hh" #include "user.hh" #include "channel.hh" -#include "buffer.h" -#include "message.h" +#include "buffer.hh" +#include "message.hh" #include "command.hh" #define MAM_DEFAULT_DAYS 2 diff --git a/completion.c b/completion.cpp similarity index 98% rename from completion.c rename to completion.cpp index b386e0d..6e10875 100644 --- a/completion.c +++ b/completion.cpp @@ -14,8 +14,8 @@ #include "account.hh" #include "channel.hh" #include "user.hh" -#include "buffer.h" -#include "completion.h" +#include "buffer.hh" +#include "completion.hh" void completion__channel_nicks_add_speakers(struct t_gui_completion *completion, struct t_account *account, @@ -146,7 +146,7 @@ void completion__init() size_t length = snprintf(NULL, 0, "%s|%s", default_template, "%(account)") + 1; - char *new_template = malloc(length); + char *new_template = (char*)malloc(length); snprintf(new_template, length, "%s|%s", default_template, "%(account)"); diff --git a/completion.h b/completion.hh similarity index 68% rename from completion.h rename to completion.hh index da99b23..9d1b619 100644 --- a/completion.h +++ b/completion.hh @@ -2,9 +2,6 @@ // 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_COMPLETION_H_ -#define _WEECHAT_XMPP_COMPLETION_H_ +#pragma once void completion__init(); - -#endif /*WEECHAT_XMPP_COMPLETION_H*/ diff --git a/input.c b/input.cpp similarity index 94% rename from input.c rename to input.cpp index 215dad9..01377bd 100644 --- a/input.c +++ b/input.cpp @@ -10,9 +10,9 @@ #include "plugin.hh" #include "account.hh" #include "channel.hh" -#include "buffer.h" -#include "message.h" -#include "input.h" +#include "buffer.hh" +#include "message.hh" +#include "input.hh" int input__data(struct t_gui_buffer *buffer, const char *text) { @@ -85,5 +85,5 @@ int input__text_changed_cb(const void *pointer, void *data, (void) signal; (void) type_data; - return input__typing(signal_data); + return input__typing((struct t_gui_buffer*)signal_data); } diff --git a/input.h b/input.hh similarity index 84% rename from input.h rename to input.hh index 50bdd01..db84216 100644 --- a/input.h +++ b/input.hh @@ -2,8 +2,7 @@ // 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_INPUT_H_ -#define _WEECHAT_XMPP_INPUT_H_ +#pragma once int input__data_cb(const void *pointer, void *data, struct t_gui_buffer *buffer, @@ -12,5 +11,3 @@ int input__data_cb(const void *pointer, void *data, int input__text_changed_cb(const void *pointer, void *data, const char *signal, const char *type_data, void *signal_data); - -#endif /*WEECHAT_XMPP_INPUT_H*/ diff --git a/makefile b/makefile index 6fc07e7..e22df34 100644 --- a/makefile +++ b/makefile @@ -41,14 +41,14 @@ LIBDIR ?= $(PREFIX)/lib HDRS=plugin.hh \ account.hh \ - buffer.h \ + buffer.hh \ channel.hh \ command.hh \ - completion.h \ + completion.hh \ config.hh \ connection.hh \ - input.h \ - message.h \ + input.hh \ + message.hh \ omemo.hh \ pgp.hh \ user.hh \ @@ -57,14 +57,14 @@ HDRS=plugin.hh \ SRCS=plugin.cpp \ account.cpp \ - buffer.c \ + buffer.cpp \ channel.cpp \ command.cpp \ - completion.c \ + completion.cpp \ config.cpp \ connection.cpp \ - input.c \ - message.c \ + input.cpp \ + message.cpp \ omemo.cpp \ pgp.cpp \ user.cpp \ diff --git a/message.c b/message.cpp similarity index 98% rename from message.c rename to message.cpp index 49deb8a..13ca97b 100644 --- a/message.c +++ b/message.cpp @@ -14,7 +14,7 @@ #include "account.hh" #include "channel.hh" #include "user.hh" -#include "message.h" +#include "message.hh" static const char format_regex[] = "<([^>]*?)>"; static const size_t max_groups = 2; @@ -93,13 +93,13 @@ char *message__translate_code(struct t_account *account, symbol = strdup(code); break; } - + free(identifier); resultlen = snprintf(NULL, 0, "%s%s%s%s", weechat_color("chat_nick"), prefix, symbol, weechat_color("reset")) + 1; - result = malloc(resultlen); + result = (char*)malloc(resultlen); snprintf(result, resultlen, "%s%s%s%s", weechat_color("chat_nick"), prefix, symbol, weechat_color("reset")); free(symbol); - + return result; } @@ -170,7 +170,7 @@ char *message__decode(struct t_account *account, return strdup(text); } - decoded_text = malloc(MESSAGE_MAX_LENGTH); + decoded_text = (char*)malloc(MESSAGE_MAX_LENGTH); if (!decoded_text) { regfree(®); diff --git a/message.h b/message.hh similarity index 76% rename from message.h rename to message.hh index fdf7263..a5ff8ce 100644 --- a/message.h +++ b/message.hh @@ -2,12 +2,9 @@ // 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_MESSAGE_H_ -#define _WEECHAT_XMPP_MESSAGE_H_ +#pragma once #define MESSAGE_MAX_LENGTH 40000 char *message__decode(struct t_account *account, const char *text); - -#endif /*WEECHAT_XMPP_MESSAGE_H*/ diff --git a/plugin.cpp b/plugin.cpp index bc95522..a073f5b 100644 --- a/plugin.cpp +++ b/plugin.cpp @@ -15,9 +15,9 @@ extern "C" { #include "account.hh" #include "connection.hh" #include "command.hh" -#include "input.h" -#include "buffer.h" -#include "completion.h" +#include "input.hh" +#include "buffer.hh" +#include "completion.hh" WEECHAT_PLUGIN_NAME(WEECHAT_XMPP_PLUGIN_NAME); WEECHAT_PLUGIN_DESCRIPTION(N_("XMPP client protocol")); diff --git a/tests/run b/tests/run deleted file mode 100755 index 8a35afb..0000000 Binary files a/tests/run and /dev/null differ