|
|
|
@ -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*/
|