summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rexmpp.c17
-rw-r--r--src/rexmpp.h7
2 files changed, 14 insertions, 10 deletions
diff --git a/src/rexmpp.c b/src/rexmpp.c
index 7e48bab..f57c611 100644
--- a/src/rexmpp.c
+++ b/src/rexmpp.c
@@ -79,6 +79,8 @@ rexmpp_err_t rexmpp_init (rexmpp_t *s,
s->manual_direct_tls = 0;
s->socks_host = NULL;
s->server_host = NULL;
+ s->enable_carbons = 1;
+ s->enable_service_discovery = 1;
s->send_buffer = NULL;
s->send_queue = NULL;
s->server_srv = NULL;
@@ -225,9 +227,6 @@ void rexmpp_cleanup (rexmpp_t *s) {
s->server_srv_tls_cur = NULL;
}
s->sm_state = REXMPP_SM_INACTIVE;
- if (s->carbons_state != REXMPP_CARBONS_DISABLED) {
- s->carbons_state = REXMPP_CARBONS_INACTIVE;
- }
}
/* Frees the things that persist through reconnects. */
@@ -1021,7 +1020,7 @@ void rexmpp_discovery_info (rexmpp_t *s, xmlNodePtr req, xmlNodePtr response) {
if (rexmpp_xml_match(child, "http://jabber.org/protocol/disco#info",
"feature")) {
char *var = xmlGetProp(child, "var");
- if (s->carbons_state != REXMPP_CARBONS_DISABLED &&
+ if (s->enable_carbons &&
strcmp(var, "urn:xmpp:carbons:2") == 0) {
xmlNodePtr carbons_enable = xmlNewNode(NULL, "enable");
xmlNewNs(carbons_enable, "urn:xmpp:carbons:2", NULL);
@@ -1039,10 +1038,12 @@ void rexmpp_stream_is_ready(rexmpp_t *s) {
s->stream_state = REXMPP_STREAM_READY;
rexmpp_resend_stanzas(s);
rexmpp_send(s, xmlNewNode(NULL, "presence"));
- xmlNodePtr disco_query = xmlNewNode(NULL, "query");
- xmlNewNs(disco_query, "http://jabber.org/protocol/disco#info", NULL);
- rexmpp_iq_new(s, "get", jid_bare_to_host(s->initial_jid),
- disco_query, rexmpp_discovery_info);
+ if (s->enable_service_discovery) {
+ xmlNodePtr disco_query = xmlNewNode(NULL, "query");
+ xmlNewNs(disco_query, "http://jabber.org/protocol/disco#info", NULL);
+ rexmpp_iq_new(s, "get", jid_bare_to_host(s->initial_jid),
+ disco_query, rexmpp_discovery_info);
+ }
}
/* Resource binding,
diff --git a/src/rexmpp.h b/src/rexmpp.h
index 254bf08..5156142 100644
--- a/src/rexmpp.h
+++ b/src/rexmpp.h
@@ -150,8 +150,7 @@ enum sm_st {
enum carbons_st {
REXMPP_CARBONS_INACTIVE,
REXMPP_CARBONS_NEGOTIATION,
- REXMPP_CARBONS_ACTIVE,
- REXMPP_CARBONS_DISABLED
+ REXMPP_CARBONS_ACTIVE
};
/** Error codes. */
@@ -221,6 +220,10 @@ struct rexmpp
const char *socks_host;
uint16_t socks_port;
+ /* Various knobs (these are used instead of loadable modules). */
+ int enable_carbons;
+ int enable_service_discovery;
+
/* Resource limits. */
uint32_t stanza_queue_size;
uint32_t send_queue_size;