[vlc-devel] [PATCH 12/14] dialog: add store var in dialog_Login

Thomas Guillem thomas at gllm.fr
Wed Jan 6 17:21:03 CET 2016


If set to true, then the user asked to store the password.
---
 include/vlc_dialog.h   | 7 ++++---
 src/interface/dialog.c | 4 +++-
 src/misc/keystore.c    | 5 +----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index f6070bb..881925d 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -74,11 +74,12 @@ typedef struct dialog_login_t
     const char *message;
     char **username;
     char **password;
+    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..163f8c4 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));
 
@@ -163,6 +163,8 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
         dialog_login_t dialog = { title, text, username, password, };
         var_SetAddress (provider, "dialog-login", &dialog);
         free (text);
+        if (store)
+            *store = dialog.store;
     }
     va_end (ap);
     vlc_object_release (provider);
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index 7b5e30e..4fb8e89 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -327,15 +327,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->b_store,
                          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;
-
                 b_found = true;
                 p_credential->psz_username = p_credential->psz_dialog_username;
                 p_credential->psz_password = p_credential->psz_dialog_password;
-- 
2.1.4



More information about the vlc-devel mailing list