Commit 0619fa92 authored by Thomas Guillem's avatar Thomas Guillem

dialog: add store var in dialog_Login

If set to true, then the user asked to store the password.
parent c4e7180c
......@@ -74,11 +74,13 @@ typedef struct dialog_login_t
const char *message;
char **username;
char **password;
/* if store is NULL, password can't be stored (there is no keystore) */
bool *store;
} dialog_login_t;
VLC_API void dialog_Login(vlc_object_t *, char **, char **, const char *, const char *, ...) VLC_FORMAT (5, 6);
#define dialog_Login(o, u, p, t, ...) \
dialog_Login(VLC_OBJECT(o), u, p, t, __VA_ARGS__)
VLC_API void dialog_Login(vlc_object_t *, char **, char **, bool *, const char *, const char *, ...) VLC_FORMAT (6, 7);
#define dialog_Login(o, u, p, s, t, ...) \
dialog_Login(VLC_OBJECT(o), u, p, s, t, __VA_ARGS__)
/**
* A question dialog.
......
......@@ -142,7 +142,7 @@ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
* Otherwise *username resp *password will be NULL.
*/
void dialog_Login (vlc_object_t *obj, char **username, char **password,
const char *title, const char *fmt, ...)
bool *store, const char *title, const char *fmt, ...)
{
assert ((username != NULL) && (password != NULL));
......@@ -160,7 +160,7 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
va_start (ap, fmt);
if (vasprintf (&text, fmt, ap) != -1)
{
dialog_login_t dialog = { title, text, username, password, };
dialog_login_t dialog = { title, text, username, password, store };
var_SetAddress (provider, "dialog-login", &dialog);
free (text);
}
......
......@@ -398,14 +398,12 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
va_end(ap);
dialog_Login(p_parent, &p_credential->psz_dialog_username,
&p_credential->psz_dialog_password,
p_credential->p_keystore ? &p_credential->b_store : NULL,
psz_dialog_title, psz_dialog_text);
free(psz_dialog_text);
if (p_credential->psz_dialog_username
&& p_credential->psz_dialog_password)
{
/* TODO: add a dialog option to know if the user want to store
* the credential */
p_credential->b_store = true;
p_credential->psz_username = p_credential->psz_dialog_username;
p_credential->psz_password = p_credential->psz_dialog_password;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment