Bug 37360 - TpChannel: high level API for Password
Summary: TpChannel: high level API for Password
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Guillaume Desmottes
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/ca...
Whiteboard: EmpathyTpChat, r+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-05-19 04:54 UTC by Guillaume Desmottes
Modified: 2011-05-31 02:11 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
textchan-group: implement Password (4.19 KB, patch)
2011-05-25 05:08 UTC, Guillaume Desmottes
Details | Splinter Review
TpChannel: add high-level API for Password (#37360) (14.06 KB, patch)
2011-05-25 05:08 UTC, Guillaume Desmottes
Details | Splinter Review
automatic-proxy-factory: prepare TP_CHANNEL_FEATURE_PASSWORD (2.01 KB, patch)
2011-05-25 05:08 UTC, Guillaume Desmottes
Details | Splinter Review

Comment 1 Guillaume Desmottes 2011-05-25 02:03:30 UTC
How do you feel about this API?

/* Channel.Interface.Password */
#define TP_CHANNEL_FEATURE_PASSWORD \
  tp_channel_get_feature_quark_password ()
GQuark tp_channel_get_feature_quark_password (void) G_GNUC_CONST;

void tp_channel_password_provide_password_async (TpChannel *self,
    const gchar *password,
    GAsyncReadyCallback callback,
    gpointer user_data);

gboolean tp_channel_password_provide_password_finish (TpChannel *self,
    GAsyncResult *result,
    GError **error);

gboolean tp_channel_password_needed (TpChannel *self);

/**
 * TpChannel:password-needed:
 *
 * If %TRUE, tp_channel_password_provide_password_async() has to be called
 * to be able to join the channel.
 *
 * This is not guaranteed to be meaningful until tp_proxy_prepare_async() has
 * finished preparing %TP_CHANNEL_FEATURE_PASSWORD; until then, it may return
 * %FALSE even if the channel is actually protected by a password.
 */


Maybe the provide async call should fail with TP_ERROR_AUTHENTICATION_FAILED if the password is not correct?
Comment 2 Guillaume Desmottes 2011-05-25 02:10:08 UTC
(In reply to comment #1)
> gboolean tp_channel_password_provide_password_finish (TpChannel *self,
>     GAsyncResult *result,
>     GError **error);


I meant:


gboolean
tp_channel_password_provide_password_finish (TpChannel *self,
    GAsyncResult *result,
    gboolean *correct,
    GError **error)

except, of course, if we decide to fail if the pass was wrong.
Comment 3 Simon McVittie 2011-05-25 02:21:55 UTC
(In reply to comment #1)
> /**
>  * TpChannel:password-needed:
>  *
>  * If %TRUE, tp_channel_password_provide_password_async() has to be called
>  * to be able to join the channel.
>  *
>  * This is not guaranteed to be meaningful until tp_proxy_prepare_async() has
>  * finished preparing %TP_CHANNEL_FEATURE_PASSWORD; until then, it may return
>  * %FALSE even if the channel is actually protected by a password.
>  */

For completeness, presumably this emits notify::password-needed when appropriate? (If so, it's worth mentioning that in the docstring.)

> Maybe the provide async call should fail with TP_ERROR_AUTHENTICATION_FAILED if
> the password is not correct?

I like this better than the "out" boolean. I'm not sure why we didn't do this in the D-Bus API...

(Looking at the D-Bus API again, I'm also not sure why ProvidePassword claims to be able to raise InvalidArgument.)
Comment 4 Guillaume Desmottes 2011-05-25 05:08:38 UTC
Created attachment 47137 [details] [review]
textchan-group: implement Password
Comment 5 Guillaume Desmottes 2011-05-25 05:08:41 UTC
Created attachment 47138 [details] [review]
TpChannel: add high-level API for Password (#37360)
Comment 6 Guillaume Desmottes 2011-05-25 05:08:45 UTC
Created attachment 47139 [details] [review]
automatic-proxy-factory: prepare TP_CHANNEL_FEATURE_PASSWORD
Comment 7 Simon McVittie 2011-05-30 07:32:56 UTC
Looks good to me.
Comment 8 Guillaume Desmottes 2011-05-31 01:47:51 UTC
Merged to master; will be in 0.15.2


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.