Top |
This class makes it easy to implement the X-TELEPATHY-PASSWORD SASL
mechanism in a connection manger. It implements the
TpChannelManager interface and pops up a ServerAuthentication
channel when tp_simple_password_manager_prompt_async()
is called to
enable a channel handler to pass in the password using the
appropriate D-Bus methods.
This channel manager is only useful for connection managers only wanting to implement the X-TELEPATHY-PASSWORD SASL mechanism in authentication channels. For connections with more SASL mechanisms, the channel manager and channel itself should be reimplemented to support the desired mechanisms.
A new TpSimplePasswordManager object should be created in the
TpBaseConnectionClass->create_channel_managers implementation and
added to the GPtrArray of channel managers. Then, in the
TpBaseConnectionClass->start_connecting implementation, once the
connection status has been changed to CONNECTING, the connection
should check whether a password parameter was given when creating
the connection through RequestConnection. If a password is present,
the connection should go ahead and use it. If it is not present,
tp_simple_password_manager_prompt_async()
should be called.
Once a password is retrieved using the server authentication
channel, or an error is occurred, the callback that was passed to
tp_simple_password_manager_prompt_async()
is called and the
connection should call tp_simple_password_manager_prompt_finish()
to get the result of the process. If the GString returned from
said finish function is non-NULL, the connection can then proceed
with that password, otherwise the connection must deal with the
error reached.
TpSimplePasswordManager *
tp_simple_password_manager_new (TpBaseConnection *connection
);
Creates a new simple server authentication channel manager.
void tp_simple_password_manager_prompt_async (TpSimplePasswordManager *self
,GAsyncReadyCallback callback
,gpointer user_data
);
Pops up a new server authentication channel and handles the X-TELEPATHY-PASSWORD mechanism to obtain a password for the connection.
When the operation is finished, callback
will be called. You must then
call tp_simple_password_manager_prompt_finish()
to get the
result of the request.
self |
||
callback |
a callback to call when the request is satisfied |
|
user_data |
data to pass to |
Since 0.13.8
const GString * tp_simple_password_manager_prompt_finish (TpSimplePasswordManager *self
,GAsyncResult *result
,GError **error
);
Retrieve the value of the request begun with
tp_simple_password_manager_prompt_async()
.
Since 0.13.8
void tp_simple_password_manager_prompt_for_channel_async (TpSimplePasswordManager *self
,TpBasePasswordChannel *channel
,GAsyncReadyCallback callback
,gpointer user_data
);
Pops up a new server authentication channel and handles the X-TELEPATHY-PASSWORD mechanism to obtain a password for the connection.
When the operation is finished, callback
will be called. You must then
call tp_simple_password_manager_prompt_for_channel_finish()
to get the
result of the request.
Most of the time, tp_simple_password_manager_prompt_async()
should be used
instead. This function enables applications to provide custom channels
instead of letting the password manager handle all of the channel details
automatically. This may be useful if your SASL channel needs to implement
additional interfaces (such as Channel.Interface.CredentialsStorage)
self |
||
channel |
||
callback |
a callback to call when the request is satisfied |
|
user_data |
data to pass to |
Since 0.13.15
const GString * tp_simple_password_manager_prompt_for_channel_finish (TpSimplePasswordManager *self
,GAsyncResult *result
,TpBasePasswordChannel **channel
,GError **error
);
Retrieve the value of the request begun with
tp_simple_password_manager_prompt_for_channel_async()
.
self |
||
result |
||
channel |
an output location to retrieve the custom
password channel that was passed to
|
[transfer none] |
error |
a GError to fill |
Since 0.13.15
“connection”
property“connection” TpBaseConnection *
The connection object that owns this channel manager.
Flags: Read / Write / Construct Only