From ddd88a56983e3cb619319231b4a901b17e8d2197 Mon Sep 17 00:00:00 2001 From: 0 <ÇY> Date: Sat, 30 Apr 2016 01:24:22 +0200 Subject: [PATCH] add connection parameter for message-carbons --- src/connection.c | 22 +++++++++++++++++++++- src/protocol.c | 5 +++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/connection.c b/src/connection.c index cf55f2f..2b93d76 100644 --- a/src/connection.c +++ b/src/connection.c @@ -170,6 +170,7 @@ enum PROP_EXTRA_CERTIFICATE_IDENTITIES, PROP_POWER_SAVING, PROP_DOWNLOAD_AT_CONNECTION, + PROP_MESSAGE_CARBONS, LAST_PROPERTY }; @@ -222,6 +223,8 @@ struct _GabbleConnectionPrivate gboolean power_saving; + gboolean message_carbons; + /* authentication properties */ gchar *stream_server; gchar *username; @@ -671,6 +674,10 @@ gabble_connection_get_property (GObject *object, break; } + case PROP_MESSAGE_CARBONS: + g_value_set_boolean (value, priv->message_carbons); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -818,6 +825,10 @@ gabble_connection_set_property (GObject *object, g_value_get_boolean (value), NULL); break; + case PROP_MESSAGE_CARBONS: + priv->message_carbons = g_value_get_boolean (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -1223,6 +1234,14 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property ( + object_class, PROP_MESSAGE_CARBONS, + g_param_spec_boolean ( + "message-carbons", "Message carbons enabled?", + "Client will receive other active resources messages", + FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gabble_connection_class->properties_class.interfaces = prop_interfaces; tp_dbus_properties_mixin_class_init (object_class, G_STRUCT_OFFSET (GabbleConnectionClass, properties_class)); @@ -3039,7 +3058,8 @@ connection_disco_cb (GabbleDisco *disco, conn_wlm_jid_lookup_finish); } - if (conn->features & GABBLE_CONNECTION_FEATURES_CARBONS) + if ((conn->features & GABBLE_CONNECTION_FEATURES_CARBONS) + && (conn->priv->message_carbons)) { WockyStanza *query; WockyPorter *porter; diff --git a/src/protocol.c b/src/protocol.c index ce2f59b..22aecc5 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -184,6 +184,10 @@ static TpCMParamSpec jabber_params[] = { { "account-path-suffix", "s", G_TYPE_STRING, 0, NULL, 0 /* unused */, NULL, NULL }, + { "message-carbons", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, + TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(FALSE), + 0 /* unused */, NULL, NULL }, + { NULL, NULL, 0, 0, NULL, 0 } }; @@ -264,6 +268,7 @@ struct ParamMapping { "decloak-automatically"), SAME ("fallback-servers"), SAME ("extra-certificate-identities"), + SAME ("message-carbons"), SAME (NULL) }; #undef SAME -- libgit2 0.24.0