chipping away at c cruft

master
bqv 3 years ago
parent c5c197c562
commit ab15b4e43a
No known key found for this signature in database
GPG Key ID: 9E2FF3BDEBDFC910

@ -1254,7 +1254,7 @@ void connection__handler(xmpp_conn_t *conn, xmpp_conn_event_t status,
{ {
account->disconnected = 0; account->disconnected = 0;
xmpp_stanza_t *pres, *pres__c, *pres__status, *pres__status__text, xmpp_stanza_t *pres__c, *pres__status, *pres__status__text,
*pres__x, *pres__x__text, **children; *pres__x, *pres__x__text, **children;
xmpp_handler_add(conn, &connection__version_handler, xmpp_handler_add(conn, &connection__version_handler,
@ -1315,22 +1315,19 @@ void connection__handler(xmpp_conn_t *conn, xmpp_conn_event_t status,
children[3] = NULL; children[3] = NULL;
} }
pres = stanza__presence(account->context, NULL, xmpp_send(conn, stanza::presence()
children, NULL, strdup(account_jid(account)), .from(account_jid(account))
NULL, NULL); .build(account->context)
xmpp_send(conn, pres); .get());
xmpp_stanza_release(pres);
children[1] = NULL;
children[0] =
stanza__iq_enable(account->context, NULL, with_noop("urn:xmpp:carbons:2"));
children[0] =
stanza__iq(account->context, NULL, children,
strdup("jabber:client"), strdup("enable1"),
strdup(account_jid(account)), NULL, strdup("set"));
xmpp_send(conn, children[0]); xmpp_send(conn, stanza::iq()
xmpp_stanza_release(children[0]); .from(account_jid(account))
.type("set")
.id(stanza::uuid(account->context))
.xep0280()
.enable()
.build(account->context)
.get());
children[1] = NULL; children[1] = NULL;
children[0] = children[0] =

@ -166,6 +166,7 @@ namespace stanza {
#include "xep-0030.inl" #include "xep-0030.inl"
#include "xep-0045.inl" #include "xep-0045.inl"
#include "xep-0115.inl" #include "xep-0115.inl"
#include "xep-0280.inl"
#include "xep-0319.inl" #include "xep-0319.inl"
namespace stanza { namespace stanza {
@ -190,10 +191,16 @@ namespace stanza {
struct presence : virtual public spec { struct presence : virtual public spec {
presence() : spec("presence") {} presence() : spec("presence") {}
presence& id(std::string_view s) { attr("id", s); return *this; }
presence& from(std::string_view s) { attr("from", s); return *this; }
presence& to(std::string_view s) { attr("to", s); return *this; }
presence& lang(std::string_view s) { attr("lang", s); return *this; }
}; };
struct iq : virtual public spec, struct iq : virtual public spec,
public xep0030::iq { public xep0030::iq,
public xep0280::iq {
iq() : spec("iq") {} iq() : spec("iq") {}
iq& id(std::string_view s) { attr("id", s); return *this; } iq& id(std::string_view s) { attr("id", s); return *this; }

@ -25,6 +25,8 @@ namespace stanza {
struct iq : virtual public spec { struct iq : virtual public spec {
iq() : spec("iq") {} iq() : spec("iq") {}
iq& xep0030() { return *this; }
iq& query(query q = xep0030::query()) { child(q); return *this; } iq& query(query q = xep0030::query()) { child(q); return *this; }
}; };
}; };

@ -0,0 +1,34 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// 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/.
#pragma once
#include <optional>
#include <string>
#include "node.hh"
#pragma GCC visibility push(default)
#include "ns.hh"
#pragma GCC visibility pop
namespace stanza {
/* Message Carbons */
struct xep0280 {
struct enable : virtual public spec {
enable() : spec("enable") {
xmlns<urn::xmpp::carbons::_2>();
}
};
struct iq : virtual public spec {
iq() : spec("iq") {}
iq& xep0280() { xmlns<jabber::client>(); return *this; }
iq& enable(enable e = xep0280::enable()) { child(e); return *this; }
};
};
}
Loading…
Cancel
Save