rest//.c -> cpp

master
Tony Olagbaiye 2 years ago
parent 665457ad56
commit 2482fd4691
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

1
.gitignore vendored

@ -40,6 +40,7 @@ cscope*
*.i*86 *.i*86
*.x86_64 *.x86_64
*.hex *.hex
**/run
# Debug files # Debug files
*.dSYM/ *.dSYM/

@ -14,13 +14,13 @@
#include "plugin.hh" #include "plugin.hh"
#include "xmpp/stanza.hh" #include "xmpp/stanza.hh"
#include "config.hh" #include "config.hh"
#include "input.h" #include "input.hh"
#include "omemo.hh" #include "omemo.hh"
#include "account.hh" #include "account.hh"
#include "connection.hh" #include "connection.hh"
#include "user.hh" #include "user.hh"
#include "channel.hh" #include "channel.hh"
#include "buffer.h" #include "buffer.hh"
struct t_account *accounts = NULL; struct t_account *accounts = NULL;
struct t_account *last_account = NULL; struct t_account *last_account = NULL;

@ -10,7 +10,7 @@
#include "plugin.hh" #include "plugin.hh"
#include "account.hh" #include "account.hh"
#include "channel.hh" #include "channel.hh"
#include "buffer.h" #include "buffer.hh"
void buffer__get_account_and_channel(struct t_gui_buffer *buffer, void buffer__get_account_and_channel(struct t_gui_buffer *buffer,
struct t_account **account, struct t_account **account,
@ -145,7 +145,7 @@ int buffer__close_cb(const void *pointer, void *data,
(void) pointer; (void) pointer;
(void) data; (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) if (buffer_plugin != weechat_plugin)
return WEECHAT_RC_OK; return WEECHAT_RC_OK;
buffer__get_account_and_channel(buffer, &ptr_account, &ptr_channel); buffer__get_account_and_channel(buffer, &ptr_account, &ptr_channel);

@ -2,8 +2,7 @@
// License, version 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef _WEECHAT_XMPP_BUFFER_H_ #pragma once
#define _WEECHAT_XMPP_BUFFER_H_
void buffer__get_account_and_channel(struct t_gui_buffer *buffer, void buffer__get_account_and_channel(struct t_gui_buffer *buffer,
struct t_account **account, 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, int buffer__close_cb(const void *pointer, void *data,
struct t_gui_buffer *buffer); struct t_gui_buffer *buffer);
#endif /*WEECHAT_XMPP_BUFFER_H*/

@ -15,8 +15,8 @@
#include "omemo.hh" #include "omemo.hh"
#include "user.hh" #include "user.hh"
#include "channel.hh" #include "channel.hh"
#include "input.h" #include "input.hh"
#include "buffer.h" #include "buffer.hh"
#include "pgp.hh" #include "pgp.hh"
#include "util.hh" #include "util.hh"

@ -14,8 +14,8 @@
#include "account.hh" #include "account.hh"
#include "user.hh" #include "user.hh"
#include "channel.hh" #include "channel.hh"
#include "buffer.h" #include "buffer.hh"
#include "message.h" #include "message.hh"
#include "command.hh" #include "command.hh"
#define MAM_DEFAULT_DAYS 2 #define MAM_DEFAULT_DAYS 2

@ -14,8 +14,8 @@
#include "account.hh" #include "account.hh"
#include "channel.hh" #include "channel.hh"
#include "user.hh" #include "user.hh"
#include "buffer.h" #include "buffer.hh"
#include "completion.h" #include "completion.hh"
void completion__channel_nicks_add_speakers(struct t_gui_completion *completion, void completion__channel_nicks_add_speakers(struct t_gui_completion *completion,
struct t_account *account, struct t_account *account,
@ -146,7 +146,7 @@ void completion__init()
size_t length = snprintf(NULL, 0, "%s|%s", size_t length = snprintf(NULL, 0, "%s|%s",
default_template, default_template,
"%(account)") + 1; "%(account)") + 1;
char *new_template = malloc(length); char *new_template = (char*)malloc(length);
snprintf(new_template, length, "%s|%s", snprintf(new_template, length, "%s|%s",
default_template, default_template,
"%(account)"); "%(account)");

@ -2,9 +2,6 @@
// License, version 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef _WEECHAT_XMPP_COMPLETION_H_ #pragma once
#define _WEECHAT_XMPP_COMPLETION_H_
void completion__init(); void completion__init();
#endif /*WEECHAT_XMPP_COMPLETION_H*/

@ -10,9 +10,9 @@
#include "plugin.hh" #include "plugin.hh"
#include "account.hh" #include "account.hh"
#include "channel.hh" #include "channel.hh"
#include "buffer.h" #include "buffer.hh"
#include "message.h" #include "message.hh"
#include "input.h" #include "input.hh"
int input__data(struct t_gui_buffer *buffer, const char *text) 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) signal;
(void) type_data; (void) type_data;
return input__typing(signal_data); return input__typing((struct t_gui_buffer*)signal_data);
} }

@ -2,8 +2,7 @@
// License, version 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef _WEECHAT_XMPP_INPUT_H_ #pragma once
#define _WEECHAT_XMPP_INPUT_H_
int input__data_cb(const void *pointer, void *data, int input__data_cb(const void *pointer, void *data,
struct t_gui_buffer *buffer, 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, int input__text_changed_cb(const void *pointer, void *data,
const char *signal, const char *type_data, const char *signal, const char *type_data,
void *signal_data); void *signal_data);
#endif /*WEECHAT_XMPP_INPUT_H*/

@ -41,14 +41,14 @@ LIBDIR ?= $(PREFIX)/lib
HDRS=plugin.hh \ HDRS=plugin.hh \
account.hh \ account.hh \
buffer.h \ buffer.hh \
channel.hh \ channel.hh \
command.hh \ command.hh \
completion.h \ completion.hh \
config.hh \ config.hh \
connection.hh \ connection.hh \
input.h \ input.hh \
message.h \ message.hh \
omemo.hh \ omemo.hh \
pgp.hh \ pgp.hh \
user.hh \ user.hh \
@ -57,14 +57,14 @@ HDRS=plugin.hh \
SRCS=plugin.cpp \ SRCS=plugin.cpp \
account.cpp \ account.cpp \
buffer.c \ buffer.cpp \
channel.cpp \ channel.cpp \
command.cpp \ command.cpp \
completion.c \ completion.cpp \
config.cpp \ config.cpp \
connection.cpp \ connection.cpp \
input.c \ input.cpp \
message.c \ message.cpp \
omemo.cpp \ omemo.cpp \
pgp.cpp \ pgp.cpp \
user.cpp \ user.cpp \

@ -14,7 +14,7 @@
#include "account.hh" #include "account.hh"
#include "channel.hh" #include "channel.hh"
#include "user.hh" #include "user.hh"
#include "message.h" #include "message.hh"
static const char format_regex[] = "<([^>]*?)>"; static const char format_regex[] = "<([^>]*?)>";
static const size_t max_groups = 2; static const size_t max_groups = 2;
@ -93,13 +93,13 @@ char *message__translate_code(struct t_account *account,
symbol = strdup(code); symbol = strdup(code);
break; break;
} }
free(identifier); free(identifier);
resultlen = snprintf(NULL, 0, "%s%s%s%s", weechat_color("chat_nick"), prefix, symbol, weechat_color("reset")) + 1; 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")); snprintf(result, resultlen, "%s%s%s%s", weechat_color("chat_nick"), prefix, symbol, weechat_color("reset"));
free(symbol); free(symbol);
return result; return result;
} }
@ -170,7 +170,7 @@ char *message__decode(struct t_account *account,
return strdup(text); return strdup(text);
} }
decoded_text = malloc(MESSAGE_MAX_LENGTH); decoded_text = (char*)malloc(MESSAGE_MAX_LENGTH);
if (!decoded_text) if (!decoded_text)
{ {
regfree(&reg); regfree(&reg);

@ -2,12 +2,9 @@
// License, version 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef _WEECHAT_XMPP_MESSAGE_H_ #pragma once
#define _WEECHAT_XMPP_MESSAGE_H_
#define MESSAGE_MAX_LENGTH 40000 #define MESSAGE_MAX_LENGTH 40000
char *message__decode(struct t_account *account, char *message__decode(struct t_account *account,
const char *text); const char *text);
#endif /*WEECHAT_XMPP_MESSAGE_H*/

@ -15,9 +15,9 @@ extern "C" {
#include "account.hh" #include "account.hh"
#include "connection.hh" #include "connection.hh"
#include "command.hh" #include "command.hh"
#include "input.h" #include "input.hh"
#include "buffer.h" #include "buffer.hh"
#include "completion.h" #include "completion.hh"
WEECHAT_PLUGIN_NAME(WEECHAT_XMPP_PLUGIN_NAME); WEECHAT_PLUGIN_NAME(WEECHAT_XMPP_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION(N_("XMPP client protocol")); WEECHAT_PLUGIN_DESCRIPTION(N_("XMPP client protocol"));

Binary file not shown.
Loading…
Cancel
Save