aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-11 20:34:12 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-11 21:10:43 +0800
commit9a0c691c865b369438ef789638f33fd21aab0551 (patch)
tree1f9c6c5a024a8500a0a7f7b134ed0709106b087b
parent8be106a4c0b7ae2ddfe91b796669488db8e38c1f (diff)
downloadgsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar.gz
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar.bz2
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar.lz
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar.xz
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.tar.zst
gsoc2013-empathy-9a0c691c865b369438ef789638f33fd21aab0551.zip
sasl-handler: factor out channel_has_may_save_response()
-rw-r--r--libempathy/empathy-server-sasl-handler.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/libempathy/empathy-server-sasl-handler.c b/libempathy/empathy-server-sasl-handler.c
index bc139df30..8e767c5a6 100644
--- a/libempathy/empathy-server-sasl-handler.c
+++ b/libempathy/empathy-server-sasl-handler.c
@@ -369,6 +369,26 @@ auth_cb (GObject *source,
g_object_unref (self);
}
+static gboolean
+channel_has_may_save_response (TpChannel *channel)
+{
+ /* determine if we are permitted to save the password locally */
+ gboolean may_save_response, may_save_response_valid;
+
+ may_save_response = tp_asv_get_boolean (
+ tp_channel_borrow_immutable_properties (channel),
+ TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_MAY_SAVE_RESPONSE,
+ &may_save_response_valid);
+
+ if (!may_save_response_valid)
+ {
+ DEBUG ("MaySaveResponse unknown, assuming TRUE");
+ return TRUE;
+ }
+
+ return may_save_response;
+}
+
void
empathy_server_sasl_handler_provide_password (
EmpathyServerSASLHandler *handler,
@@ -376,7 +396,7 @@ empathy_server_sasl_handler_provide_password (
gboolean remember)
{
EmpathyServerSASLHandlerPriv *priv;
- gboolean may_save_response, may_save_response_valid;
+ gboolean may_save_response;
g_return_if_fail (EMPATHY_IS_SERVER_SASL_HANDLER (handler));
@@ -387,17 +407,7 @@ empathy_server_sasl_handler_provide_password (
DEBUG ("%sremembering the password", remember ? "" : "not ");
- /* determine if we are permitted to save the password locally */
- may_save_response = tp_asv_get_boolean (
- tp_channel_borrow_immutable_properties (priv->channel),
- TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_MAY_SAVE_RESPONSE,
- &may_save_response_valid);
-
- if (!may_save_response_valid)
- {
- DEBUG ("MaySaveResponse unknown, assuming TRUE");
- may_save_response = TRUE;
- }
+ may_save_response = channel_has_may_save_response (priv->channel);
if (remember)
{
@@ -501,24 +511,14 @@ empathy_server_sasl_handler_can_save_response_somewhere (
EmpathyServerSASLHandler *self)
{
EmpathyServerSASLHandlerPriv *priv;
- gboolean may_save_response, may_save_response_valid;
+ gboolean may_save_response;
gboolean has_storage_iface;
g_return_val_if_fail (EMPATHY_IS_SERVER_SASL_HANDLER (self), FALSE);
priv = self->priv;
- /* determine if we are permitted to save the password locally */
- may_save_response = tp_asv_get_boolean (
- tp_channel_borrow_immutable_properties (priv->channel),
- TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_MAY_SAVE_RESPONSE,
- &may_save_response_valid);
-
- if (!may_save_response_valid)
- {
- DEBUG ("MaySaveResponse unknown, assuming TRUE");
- may_save_response = TRUE;
- }
+ may_save_response = channel_has_may_save_response (priv->channel);
has_storage_iface = tp_proxy_has_interface_by_id (priv->channel,
EMP_IFACE_QUARK_CHANNEL_INTERFACE_CREDENTIALS_STORAGE);