From 6a45489e9f28875b2b326efcc62dafed36fd1d61 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Tue, 26 May 2009 18:25:10 -0400 Subject: Always advertise Location.DRAFT Even if a server does not support PEP the user can receive notifications for geolocation of other users from other servers. --- src/connection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/connection.c') diff --git a/src/connection.c b/src/connection.c index b129ef1d8..e0d3703e3 100644 --- a/src/connection.c +++ b/src/connection.c @@ -587,6 +587,7 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) TP_IFACE_CONNECTION_INTERFACE_REQUESTS, GABBLE_IFACE_OLPC_GADGET, GABBLE_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES, + GABBLE_IFACE_CONNECTION_INTERFACE_LOCATION, NULL }; static TpDBusPropertiesMixinPropImpl olpc_gadget_props[] = { { "GadgetAvailable", NULL, NULL }, @@ -2151,7 +2152,7 @@ connection_disco_cb (GabbleDisco *disco, { const gchar *ifaces[] = { GABBLE_IFACE_OLPC_BUDDY_INFO, GABBLE_IFACE_OLPC_ACTIVITY_PROPERTIES, - GABBLE_IFACE_CONNECTION_INTERFACE_LOCATION, NULL }; + NULL }; tp_base_connection_add_interfaces ((TpBaseConnection *) conn, ifaces); } -- cgit v1.2.3 From 3e501f5d45a886fa6de8f3a9823092eb8bfed99d Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 9 Jun 2009 18:01:38 +0100 Subject: Add gabble_connection_get_full_jid() --- src/connection.c | 17 +++++++++++++++++ src/connection.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'src/connection.c') diff --git a/src/connection.c b/src/connection.c index e0d3703e3..32e348df2 100644 --- a/src/connection.c +++ b/src/connection.c @@ -973,6 +973,23 @@ OUT: return result; } +/** + * gabble_connection_get_full_jid: + * + * Returns: the full jid (including resource) of this connection, which must be + * freed by the caller. + */ +gchar * +gabble_connection_get_full_jid (GabbleConnection *conn) +{ + TpBaseConnection *base = TP_BASE_CONNECTION (conn); + TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, + TP_HANDLE_TYPE_CONTACT); + TpHandle self = tp_base_connection_get_self_handle (base); + const gchar *bare_jid = tp_handle_inspect (contact_handles, self); + + return g_strconcat (bare_jid, "/", conn->priv->resource, NULL); +} /** * _gabble_connection_send diff --git a/src/connection.h b/src/connection.h index cd060ac26..4fe8d0c98 100644 --- a/src/connection.h +++ b/src/connection.h @@ -225,6 +225,8 @@ GType gabble_connection_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_CONNECTION, \ GabbleConnectionClass)) +gchar *gabble_connection_get_full_jid (GabbleConnection *conn); + gboolean _gabble_connection_set_properties_from_account ( GabbleConnection *conn, const gchar *account, GError **error); gboolean _gabble_connection_send (GabbleConnection *conn, LmMessage *msg, -- cgit v1.2.3 From 642c464129fd106b13dae03ebdd5054670ade5d0 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 15 Jun 2009 10:58:55 +0100 Subject: Add a keepalive-interval connection parameter. This allows clients to specify the interval between TCP and/or whitespace keepalives (at the whim of Loudmouth) rather than hardcoding the interval to 30 seconds (which is still the default). This might be useful in situations where reducing network activity is more important than realising the network has gone away quickly. --- src/connection-manager.c | 9 +++++++++ src/connection.c | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src/connection.c') diff --git a/src/connection-manager.c b/src/connection-manager.c index f736e9242..cd11d730f 100644 --- a/src/connection-manager.c +++ b/src/connection-manager.c @@ -90,6 +90,7 @@ struct _GabbleParams { gboolean ignore_ssl_errors; gchar *alias; GStrv fallback_socks5_proxies; + guint keepalive_interval; }; enum { @@ -113,6 +114,8 @@ enum { JABBER_PARAM_IGNORE_SSL_ERRORS, JABBER_PARAM_ALIAS, JABBER_PARAM_FALLBACK_SOCKS5_PROXIES, + JABBER_PARAM_KEEPALIVE_INTERVAL, + LAST_JABBER_PARAM }; @@ -212,6 +215,10 @@ static TpCMParamSpec jabber_params[] = { G_STRUCT_OFFSET (GabbleParams, fallback_socks5_proxies), NULL, NULL }, + { "keepalive-interval", "u", G_TYPE_UINT, + TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER (30), + G_STRUCT_OFFSET (GabbleParams, keepalive_interval), NULL, NULL }, + { NULL, NULL, 0, 0, NULL, 0 } }; @@ -317,6 +324,8 @@ _gabble_connection_manager_new_connection (TpBaseConnectionManager *self, SET_PROPERTY_IF_PARAM_SET ("alias", JABBER_PARAM_ALIAS, params->alias); SET_PROPERTY_IF_PARAM_SET ("fallback-socks5-proxies", JABBER_PARAM_FALLBACK_SOCKS5_PROXIES, params->fallback_socks5_proxies); + SET_PROPERTY_IF_PARAM_SET ("keepalive-interval", + JABBER_PARAM_KEEPALIVE_INTERVAL, params->keepalive_interval); /* split up account into username, stream-server and resource */ if (!_gabble_connection_set_properties_from_account (conn, params->account, diff --git a/src/connection.c b/src/connection.c index e0d3703e3..412bd6d02 100644 --- a/src/connection.c +++ b/src/connection.c @@ -141,6 +141,7 @@ enum PROP_IGNORE_SSL_ERRORS, PROP_ALIAS, PROP_FALLBACK_SOCKS5_PROXIES, + PROP_KEEPALIVE_INTERVAL, LAST_PROPERTY }; @@ -169,6 +170,8 @@ struct _GabbleConnectionPrivate gboolean low_bandwidth; + guint keepalive_interval; + gchar *https_proxy_server; guint16 https_proxy_port; @@ -420,6 +423,9 @@ gabble_connection_get_property (GObject *object, case PROP_FALLBACK_SOCKS5_PROXIES: g_value_set_boxed (value, priv->fallback_socks5_proxies); break; + case PROP_KEEPALIVE_INTERVAL: + g_value_set_uint (value, priv->keepalive_interval); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -509,6 +515,9 @@ gabble_connection_set_property (GObject *object, case PROP_FALLBACK_SOCKS5_PROXIES: priv->fallback_socks5_proxies = g_value_dup_boxed (value); break; + case PROP_KEEPALIVE_INTERVAL: + priv->keepalive_interval = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -800,6 +809,13 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_KEEPALIVE_INTERVAL, + g_param_spec_uint ( + "keepalive-interval", "keepalive interval", + "Seconds between keepalive packets, or 0 to disable", + 0, G_MAXUINT, 30, + G_PARAM_CONSTRUCT_ONLY | 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)); @@ -1362,8 +1378,7 @@ _gabble_connection_connect (TpBaseConnection *base, lm_ssl_unref (ssl); } - /* send whitespace to the server every 30 seconds */ - lm_connection_set_keep_alive_rate (conn->lmconn, 30); + lm_connection_set_keep_alive_rate (conn->lmconn, priv->keepalive_interval); lm_connection_set_disconnect_function (conn->lmconn, connection_disconnected_cb, -- cgit v1.2.3