xmpp/stanza.h -> hh

This commit is contained in:
Tony Olagbaiye 2022-01-11 19:50:27 +00:00
parent 0e2df206f8
commit 1dbd8164e1
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910
11 changed files with 30 additions and 22 deletions

View File

@ -12,7 +12,7 @@
#include <weechat/weechat-plugin.h>
#include "plugin.hh"
#include "xmpp/stanza.h"
#include "xmpp/stanza.hh"
#include "config.h"
#include "input.h"
#include "omemo.h"
@ -749,6 +749,8 @@ int account__timer_cb(const void *pointer, void *data, int remaining_calls)
struct t_account *ptr_account;
if (!accounts) return WEECHAT_RC_ERROR;
for (ptr_account = accounts; ptr_account;
ptr_account = ptr_account ? ptr_account->next_account : NULL)
{

View File

@ -13,7 +13,7 @@
#include "plugin.hh"
#include "diff/diff.h"
#include "xmpp/stanza.h"
#include "xmpp/stanza.hh"
#include "config.h"
#include "account.h"
#include "user.h"

1
diff

@ -1 +0,0 @@
Subproject commit aadb3d7fe4dcb4b212c77e4fc6c2599826aeb50a

View File

@ -53,7 +53,7 @@ HDRS=plugin.hh \
pgp.h \
user.h \
util.h \
xmpp/stanza.h \
xmpp/stanza.hh \
SRCS=plugin.cpp \
account.c \
@ -69,12 +69,12 @@ SRCS=plugin.cpp \
pgp.c \
user.c \
util.c \
xmpp/presence.c \
xmpp/iq.c \
xmpp/presence.cpp \
xmpp/iq.cpp \
DEPS=deps/diff/libdiff.a \
OBJS=$(patsubst %.cpp,.%.o,$(patsubst %.c,.%.o,$(patsubst xmpp/%.c,xmpp/.%.o,$(SRCS))))
OBJS=$(patsubst %.cpp,.%.o,$(patsubst %.c,.%.o,$(patsubst xmpp/%.cpp,xmpp/.%.o,$(patsubst xmpp/%.c,xmpp/.%.o,$(SRCS)))))
all:
make depend
@ -97,6 +97,9 @@ xmpp.so: $(OBJS) $(DEPS) $(HDRS)
xmpp/.%.o: xmpp/%.c
@$(CC) $(CFLAGS) -c $< -o $@
xmpp/.%.o: xmpp/%.cpp
@$(CXX) $(CPPFLAGS) -c $< -o $@
deps/diff/libdiff.a:
git submodule update --init --recursive
cd deps/diff && env -u MAKEFLAGS ./configure

View File

@ -31,7 +31,7 @@ struct t_pre_key {
};
#include "plugin.hh"
#include "xmpp/stanza.h"
#include "xmpp/stanza.hh"
#include "account.h"
#include "omemo.h"
#include "util.h"

View File

@ -9,8 +9,8 @@
#include <strophe.h>
#include <weechat/weechat-plugin.h>
extern "C" {
#include "plugin.hh"
extern "C" {
#include "config.h"
#include "account.h"
#include "connection.h"
@ -25,6 +25,7 @@ WEECHAT_PLUGIN_AUTHOR("bqv <weechat@fron.io>");
WEECHAT_PLUGIN_VERSION(WEECHAT_XMPP_PLUGIN_VERSION);
WEECHAT_PLUGIN_LICENSE("MPL2");
WEECHAT_PLUGIN_PRIORITY(5500);
}
struct t_weechat_plugin *weechat_xmpp_plugin = NULL;
@ -32,6 +33,7 @@ struct t_hook *weechat_xmpp_process_timer = NULL;
struct t_gui_bar_item *weechat_xmpp_typing_bar_item = NULL;
extern "C"
int weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[])
{
(void) argc;
@ -71,6 +73,7 @@ int weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_OK;
}
extern "C"
int weechat_plugin_end(struct t_weechat_plugin *plugin)
{
// make C compiler happy
@ -92,4 +95,3 @@ int weechat_plugin_end(struct t_weechat_plugin *plugin)
return WEECHAT_RC_OK;
}
}

View File

@ -6,7 +6,7 @@
#define weechat_plugin weechat_xmpp_plugin
#define WEECHAT_XMPP_PLUGIN_NAME "xmpp"
#define WEECHAT_XMPP_PLUGIN_VERSION "0.1.1"
#define WEECHAT_XMPP_PLUGIN_VERSION "0.2.0"
#define TIMER_INTERVAL_SEC 0.01
extern struct t_weechat_plugin *weechat_xmpp_plugin;

BIN
tests/run

Binary file not shown.

View File

@ -2,10 +2,10 @@
// 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/.
#include <stdlib.h>
#include <cstdlib>
#include <strophe.h>
#include "stanza.h"
#include "stanza.hh"
xmpp_stanza_t *stanza__iq(xmpp_ctx_t *context, xmpp_stanza_t *base,
xmpp_stanza_t **children, char *ns, char *id,

View File

@ -2,7 +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/.
#include <stdlib.h>
#include <cstdlib>
#include <strophe.h>
xmpp_stanza_t *stanza__presence(xmpp_ctx_t *context, xmpp_stanza_t *base,

View File

@ -2,8 +2,12 @@
// 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_STANZA_H_
#define _WEECHAT_XMPP_STANZA_H_
#pragma once
#ifdef __cplusplus
#include <cstdlib>
#include <strophe.h>
#endif
struct t_string
{
@ -20,11 +24,11 @@ static void t_string_free(struct t_string *string)
{ free(string->value); }
static void t_string_xmpp_free(struct t_string *string)
{ xmpp_free(string->pointer, string->value); }
{ xmpp_free((const xmpp_ctx_t*)string->pointer, string->value); }
static inline struct t_string *with_noop(const char *const value)
{
struct t_string *string = malloc(sizeof(struct t_string));
struct t_string *string = (struct t_string *)malloc(sizeof(struct t_string));
string->value = (char*)value;
string->finalize = &t_string_noop;
string->pointer = NULL;
@ -33,7 +37,7 @@ static inline struct t_string *with_noop(const char *const value)
static inline struct t_string *with_free(char *value)
{
struct t_string *string = malloc(sizeof(struct t_string));
struct t_string *string = (struct t_string *)malloc(sizeof(struct t_string));
string->value = value;
string->finalize = &t_string_free;
string->pointer = NULL;
@ -42,7 +46,7 @@ static inline struct t_string *with_free(char *value)
static inline struct t_string *with_xmpp_free(char *value, xmpp_ctx_t *pointer)
{
struct t_string *string = malloc(sizeof(struct t_string));
struct t_string *string = (struct t_string *)malloc(sizeof(struct t_string));
string->value = value;
string->finalize = &t_string_xmpp_free;
string->pointer = pointer;
@ -119,5 +123,3 @@ xmpp_stanza_t *stanza__iq_ping(xmpp_ctx_t *context, xmpp_stanza_t *base,
xmpp_stanza_t *stanza__iq_query(xmpp_ctx_t *context, xmpp_stanza_t *base,
struct t_string *ns, struct t_string *node);
#endif /*WEECHAT_XMPP_STANZA_H*/