mirror of
https://github.com/profanity-im/profanity.git
synced 2024-10-27 20:30:13 -04:00
Only include receipts feature in disco responses when enabled
issue #829
This commit is contained in:
parent
41acaee955
commit
4de570b1ee
@ -5987,6 +5987,12 @@ cmd_receipts(ProfWin *window, const char *const command, gchar **args)
|
|||||||
{
|
{
|
||||||
if (g_strcmp0(args[0], "send") == 0) {
|
if (g_strcmp0(args[0], "send") == 0) {
|
||||||
_cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
|
_cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
|
||||||
|
if (g_strcmp0(args[1], "on") == 0) {
|
||||||
|
caps_add_feature(XMPP_FEATURE_RECEIPTS);
|
||||||
|
}
|
||||||
|
if (g_strcmp0(args[1], "off") == 0) {
|
||||||
|
caps_remove_feature(XMPP_FEATURE_RECEIPTS);
|
||||||
|
}
|
||||||
} else if (g_strcmp0(args[0], "request") == 0) {
|
} else if (g_strcmp0(args[0], "request") == 0) {
|
||||||
_cmd_set_boolean_preference(args[1], command, "Request delivery receipts", PREF_RECEIPTS_REQUEST);
|
_cmd_set_boolean_preference(args[1], command, "Request delivery receipts", PREF_RECEIPTS_REQUEST);
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,8 +54,10 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "event/client_events.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
#include "config/files.h"
|
#include "config/files.h"
|
||||||
|
#include "config/preferences.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/form.h"
|
#include "xmpp/form.h"
|
||||||
@ -100,12 +102,50 @@ caps_init(void)
|
|||||||
g_hash_table_add(prof_features, strdup(STANZA_NS_VERSION));
|
g_hash_table_add(prof_features, strdup(STANZA_NS_VERSION));
|
||||||
g_hash_table_add(prof_features, strdup(STANZA_NS_CHATSTATES));
|
g_hash_table_add(prof_features, strdup(STANZA_NS_CHATSTATES));
|
||||||
g_hash_table_add(prof_features, strdup(STANZA_NS_PING));
|
g_hash_table_add(prof_features, strdup(STANZA_NS_PING));
|
||||||
|
if (prefs_get_boolean(PREF_RECEIPTS_SEND)) {
|
||||||
g_hash_table_add(prof_features, strdup(STANZA_NS_RECEIPTS));
|
g_hash_table_add(prof_features, strdup(STANZA_NS_RECEIPTS));
|
||||||
|
}
|
||||||
g_hash_table_add(prof_features, strdup(STANZA_NS_LASTACTIVITY));
|
g_hash_table_add(prof_features, strdup(STANZA_NS_LASTACTIVITY));
|
||||||
|
|
||||||
my_sha1 = NULL;
|
my_sha1 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
caps_add_feature(char *feature)
|
||||||
|
{
|
||||||
|
if (g_hash_table_contains(prof_features, feature)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_add(prof_features, strdup(feature));
|
||||||
|
|
||||||
|
caps_reset_ver();
|
||||||
|
|
||||||
|
// resend presence to update server's disco info data for this client
|
||||||
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
|
resource_presence_t last_presence = accounts_get_last_presence(session_get_account_name());
|
||||||
|
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
caps_remove_feature(char *feature)
|
||||||
|
{
|
||||||
|
if (!g_hash_table_contains(prof_features, feature)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_remove(prof_features, feature);
|
||||||
|
|
||||||
|
caps_reset_ver();
|
||||||
|
|
||||||
|
// resend presence to update server's disco info data for this client
|
||||||
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
|
resource_presence_t last_presence = accounts_get_last_presence(session_get_account_name());
|
||||||
|
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GList*
|
GList*
|
||||||
caps_get_features(void)
|
caps_get_features(void)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#define JABBER_PRIORITY_MAX 127
|
#define JABBER_PRIORITY_MAX 127
|
||||||
|
|
||||||
#define XMPP_FEATURE_BLOCKING "urn:xmpp:blocking"
|
#define XMPP_FEATURE_BLOCKING "urn:xmpp:blocking"
|
||||||
|
#define XMPP_FEATURE_RECEIPTS "urn:xmpp:receipts"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JABBER_CONNECTING,
|
JABBER_CONNECTING,
|
||||||
@ -179,6 +180,8 @@ EntityCapabilities* caps_lookup(const char *const jid);
|
|||||||
void caps_close(void);
|
void caps_close(void);
|
||||||
void caps_destroy(EntityCapabilities *caps);
|
void caps_destroy(EntityCapabilities *caps);
|
||||||
void caps_reset_ver(void);
|
void caps_reset_ver(void);
|
||||||
|
void caps_add_feature(char *feature);
|
||||||
|
void caps_remove_feature(char *feature);
|
||||||
|
|
||||||
gboolean bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str);
|
gboolean bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str);
|
||||||
gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str);
|
gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str);
|
||||||
|
@ -203,6 +203,8 @@ void iq_last_activity_request(gchar *jid) {}
|
|||||||
void iq_autoping_check(void) {}
|
void iq_autoping_check(void) {}
|
||||||
|
|
||||||
// caps functions
|
// caps functions
|
||||||
|
void caps_add_feature(char *feature) {}
|
||||||
|
void caps_remove_feature(char *feature) {}
|
||||||
EntityCapabilities* caps_lookup(const char * const jid)
|
EntityCapabilities* caps_lookup(const char * const jid)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user