xmpp/stanza.h -> hh

master
Tony Olagbaiye 3 years ago
parent 0e2df206f8
commit 1dbd8164e1
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -12,7 +12,7 @@
#include <weechat/weechat-plugin.h> #include <weechat/weechat-plugin.h>
#include "plugin.hh" #include "plugin.hh"
#include "xmpp/stanza.h" #include "xmpp/stanza.hh"
#include "config.h" #include "config.h"
#include "input.h" #include "input.h"
#include "omemo.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; struct t_account *ptr_account;
if (!accounts) return WEECHAT_RC_ERROR;
for (ptr_account = accounts; ptr_account; for (ptr_account = accounts; ptr_account;
ptr_account = ptr_account ? ptr_account->next_account : NULL) ptr_account = ptr_account ? ptr_account->next_account : NULL)
{ {

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

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

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

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

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

@ -6,7 +6,7 @@
#define weechat_plugin weechat_xmpp_plugin #define weechat_plugin weechat_xmpp_plugin
#define WEECHAT_XMPP_PLUGIN_NAME "xmpp" #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 #define TIMER_INTERVAL_SEC 0.01
extern struct t_weechat_plugin *weechat_xmpp_plugin; extern struct t_weechat_plugin *weechat_xmpp_plugin;

Binary file not shown.

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

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

@ -2,8 +2,12 @@
// 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_STANZA_H_ #pragma once
#define _WEECHAT_XMPP_STANZA_H_
#ifdef __cplusplus
#include <cstdlib>
#include <strophe.h>
#endif
struct t_string struct t_string
{ {
@ -20,11 +24,11 @@ static void t_string_free(struct t_string *string)
{ free(string->value); } { free(string->value); }
static void t_string_xmpp_free(struct t_string *string) 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) 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->value = (char*)value;
string->finalize = &t_string_noop; string->finalize = &t_string_noop;
string->pointer = NULL; 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) 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->value = value;
string->finalize = &t_string_free; string->finalize = &t_string_free;
string->pointer = NULL; 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) 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->value = value;
string->finalize = &t_string_xmpp_free; string->finalize = &t_string_xmpp_free;
string->pointer = pointer; 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, xmpp_stanza_t *stanza__iq_query(xmpp_ctx_t *context, xmpp_stanza_t *base,
struct t_string *ns, struct t_string *node); struct t_string *ns, struct t_string *node);
#endif /*WEECHAT_XMPP_STANZA_H*/
Loading…
Cancel
Save