Add preference/commands for carbons message
This commit is contained in:
@@ -463,10 +463,14 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
message_add_handlers();
|
||||
presence_add_handlers();
|
||||
iq_add_handlers();
|
||||
iq_enable_carbons();
|
||||
|
||||
roster_request();
|
||||
bookmark_request();
|
||||
|
||||
if (prefs_get_boolean(PREF_CARBONS)){
|
||||
iq_enable_carbons();
|
||||
}
|
||||
|
||||
jabber_conn.conn_status = JABBER_CONNECTED;
|
||||
|
||||
if (prefs_get_reconnect() != 0) {
|
||||
|
||||
@@ -162,6 +162,16 @@ iq_enable_carbons()
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
void
|
||||
iq_disable_carbons()
|
||||
{
|
||||
xmpp_conn_t * const conn = connection_get_conn();
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_disable_carbons(ctx);
|
||||
xmpp_send(conn, iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
void
|
||||
iq_disco_info_request(gchar *jid)
|
||||
{
|
||||
|
||||
@@ -206,12 +206,32 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){
|
||||
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
|
||||
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
free(id);
|
||||
|
||||
xmpp_stanza_t *carbon_enable = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(carbon_enable, STANZA_NAME_ENABLE);
|
||||
xmpp_stanza_set_ns(carbon_enable, STANZA_NS_CARBONS);
|
||||
xmpp_stanza_t *carbons_enable = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(carbons_enable, STANZA_NAME_ENABLE);
|
||||
xmpp_stanza_set_ns(carbons_enable, STANZA_NS_CARBONS);
|
||||
|
||||
xmpp_stanza_add_child(iq, carbon_enable);
|
||||
xmpp_stanza_add_child(iq, carbons_enable);
|
||||
|
||||
return iq;
|
||||
}
|
||||
|
||||
xmpp_stanza_t *
|
||||
stanza_disable_carbons(xmpp_ctx_t *ctx){
|
||||
xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
|
||||
char *id = create_unique_id(NULL);
|
||||
|
||||
xmpp_stanza_set_name(iq, STANZA_NAME_IQ);
|
||||
xmpp_stanza_set_type(iq, STANZA_TYPE_SET);
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
free(id);
|
||||
|
||||
xmpp_stanza_t *carbons_disable = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(carbons_disable, STANZA_NAME_DISABLE);
|
||||
xmpp_stanza_set_ns(carbons_disable, STANZA_NS_CARBONS);
|
||||
|
||||
xmpp_stanza_add_child(iq, carbons_disable);
|
||||
|
||||
return iq;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
#define STANZA_NAME_DESTROY "destroy"
|
||||
#define STANZA_NAME_ACTOR "actor"
|
||||
#define STANZA_NAME_ENABLE "enable"
|
||||
#define STANZA_NAME_DISABLE "disable"
|
||||
|
||||
// error conditions
|
||||
#define STANZA_NAME_BAD_REQUEST "bad-request"
|
||||
@@ -183,6 +184,8 @@ xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx);
|
||||
|
||||
xmpp_stanza_t * stanza_enable_carbons(xmpp_ctx_t *ctx);
|
||||
|
||||
xmpp_stanza_t * stanza_disable_carbons(xmpp_ctx_t *ctx);
|
||||
|
||||
xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx,
|
||||
const char * const fulljid, const char * const state);
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ gboolean presence_sub_request_exists(const char * const bare_jid);
|
||||
|
||||
// iq functions
|
||||
void iq_enable_carbons();
|
||||
void iq_disable_carbons();
|
||||
void iq_send_software_version(const char * const fulljid);
|
||||
void iq_room_list_request(gchar *conferencejid);
|
||||
void iq_disco_info_request(gchar *jid);
|
||||
|
||||
Reference in New Issue
Block a user