[vlc-commits] dialog: add store var in dialog_Login

Thomas Guillem git at videolan.org
Thu Jan 7 20:12:44 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jan  6 18:27:31 2016 +0100| [0619fa923407f3f01fd1aeaf5f8e4356c18bb567] | committer: Thomas Guillem

dialog: add store var in dialog_Login

If set to true, then the user asked to store the password.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0619fa923407f3f01fd1aeaf5f8e4356c18bb567
---

 include/vlc_dialog.h   |    8 +++++---
 src/interface/dialog.c |    4 ++--
 src/misc/keystore.c    |    4 +---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index f6070bb..345d36f 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -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.
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index f90e7c8..cb84a04 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -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);
     }
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index eb20214..8e0b765 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -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;
 



More information about the vlc-commits mailing list