aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonnylamb@gnome.org>2010-12-03 21:03:28 +0800
committerJonny Lamb <jonnylamb@gnome.org>2011-01-26 21:28:40 +0800
commitbde7600cd918d7654667f0543b2fc904b8a79680 (patch)
tree0752f29ae08b1baddda2bb91a2163dcae990fbf0
parent0b8d4b2aa09ea0a1e4829ced9a0ba626202bc069 (diff)
downloadgsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar.gz
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar.bz2
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar.lz
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar.xz
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.tar.zst
gsoc2013-empathy-bde7600cd918d7654667f0543b2fc904b8a79680.zip
server-sasl-handler: add an account property
Signed-off-by: Jonny Lamb <jonnylamb@gnome.org>
-rw-r--r--libempathy/empathy-auth-factory.c3
-rw-r--r--libempathy/empathy-server-sasl-handler.c34
-rw-r--r--libempathy/empathy-server-sasl-handler.h5
3 files changed, 38 insertions, 4 deletions
diff --git a/libempathy/empathy-auth-factory.c b/libempathy/empathy-auth-factory.c
index 29af7dd44..58b24dc4f 100644
--- a/libempathy/empathy-auth-factory.c
+++ b/libempathy/empathy-auth-factory.c
@@ -223,7 +223,8 @@ handle_channels_cb (TpSimpleHandler *handler,
else if (tp_channel_get_channel_type_id (channel) ==
TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_AUTHENTICATION)
{
- priv->sasl_handler = empathy_server_sasl_handler_new (channel);
+ priv->sasl_handler = empathy_server_sasl_handler_new (
+ account, channel);
g_signal_connect (priv->sasl_handler, "invalidated",
G_CALLBACK (sasl_handler_invalidated_cb), self);
diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c
index 5c1e9d203..5c78591ed 100644
--- a/libempathy/empathy-server-sasl-handler.c
+++ b/libempathy/empathy-server-sasl-handler.c
@@ -27,6 +27,7 @@
enum {
PROP_CHANNEL = 1,
+ PROP_ACCOUNT,
LAST_PROPERTY,
};
@@ -40,6 +41,7 @@ static guint signals[LAST_SIGNAL] = {0};
typedef struct {
TpChannel *channel;
+ TpAccount *account;
GSimpleAsyncResult *result;
} EmpathyServerSASLHandlerPriv;
@@ -125,6 +127,9 @@ empathy_server_sasl_handler_get_property (GObject *object,
case PROP_CHANNEL:
g_value_set_object (value, priv->channel);
break;
+ case PROP_ACCOUNT:
+ g_value_set_object (value, priv->account);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -144,6 +149,9 @@ empathy_server_sasl_handler_set_property (GObject *object,
case PROP_CHANNEL:
priv->channel = g_value_dup_object (value);
break;
+ case PROP_ACCOUNT:
+ priv->account = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -158,6 +166,7 @@ empathy_server_sasl_handler_dispose (GObject *object)
DEBUG ("%p", object);
tp_clear_object (&priv->channel);
+ tp_clear_object (&priv->account);
G_OBJECT_CLASS (empathy_server_sasl_handler_parent_class)->dispose (object);
}
@@ -181,6 +190,12 @@ empathy_server_sasl_handler_class_init (EmpathyServerSASLHandlerClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (oclass, PROP_CHANNEL, pspec);
+ pspec = g_param_spec_object ("account", "The TpAccount",
+ "The TpAccount this channel belongs to.",
+ TP_TYPE_ACCOUNT,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (oclass, PROP_ACCOUNT, pspec);
+
signals[INVALIDATED] = g_signal_new ("invalidated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0,
@@ -197,12 +212,15 @@ empathy_server_sasl_handler_init (EmpathyServerSASLHandler *self)
}
EmpathyServerSASLHandler *
-empathy_server_sasl_handler_new (TpChannel *channel)
+empathy_server_sasl_handler_new (TpAccount *account,
+ TpChannel *channel)
{
g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
return g_object_new (EMPATHY_TYPE_SERVER_SASL_HANDLER,
- "channel", channel, NULL);
+ "account", account,
+ "channel", channel,
+ NULL);
}
static void
@@ -262,3 +280,15 @@ empathy_server_sasl_handler_cancel (EmpathyServerSASLHandler *handler)
"User cancelled the authentication",
NULL, NULL, NULL, NULL);
}
+
+TpAccount *
+empathy_server_sasl_handler_get_account (EmpathyServerSASLHandler *handler)
+{
+ EmpathyServerSASLHandlerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_SERVER_SASL_HANDLER (handler), NULL);
+
+ priv = GET_PRIV (handler);
+
+ return priv->account;
+}
diff --git a/libempathy/empathy-server-sasl-handler.h b/libempathy/empathy-server-sasl-handler.h
index 71f8d2a78..47f49e2a4 100644
--- a/libempathy/empathy-server-sasl-handler.h
+++ b/libempathy/empathy-server-sasl-handler.h
@@ -23,6 +23,7 @@
#include <glib-object.h>
#include <gio/gio.h>
+#include <telepathy-glib/account.h>
#include <telepathy-glib/channel.h>
G_BEGIN_DECLS
@@ -58,13 +59,15 @@ GType empathy_server_sasl_handler_get_type (void);
EmpathyServerSASLHandlerClass))
EmpathyServerSASLHandler * empathy_server_sasl_handler_new (
- TpChannel *channel);
+ TpAccount *account, TpChannel *channel);
void empathy_server_sasl_handler_provide_password (
EmpathyServerSASLHandler *handler, const gchar *password);
void empathy_server_sasl_handler_cancel (EmpathyServerSASLHandler *handler);
+TpAccount * empathy_server_sasl_handler_get_account (
+ EmpathyServerSASLHandler *handler);
G_END_DECLS