Commit c512b811 authored by Thomas Guillem's avatar Thomas Guillem

dialog: add dialog_vaLogin (see #16404)

parent 7e421dca
......@@ -83,6 +83,11 @@ VLC_API void dialog_Login(vlc_object_t *, const char *, char **, char **, bool *
#define dialog_Login(o, u, p, s, t, v, w, ...) \
dialog_Login(VLC_OBJECT(o), u, p, s, t, v, w, __VA_ARGS__)
VLC_API void dialog_vaLogin(vlc_object_t *, const char *, char **, char **, bool *, const char *, const char *, va_list args);
#define dialog_vaLogin(o, u, p, s, t, v, w, x) \
dialog_vaLogin(VLC_OBJECT(o), u, p, s, t, v, w, x)
/**
* A question dialog.
*/
......
......@@ -128,22 +128,10 @@ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
vlc_object_release (provider);
}
#undef dialog_Login
/**
* Requests a username and password through the user interface.
* @param obj the VLC object requesting credential information
* @param username a pointer to the specified username [OUT]
* @param password a pointer to the specified password [OUT]
* @param title title for the dialog
* @param fmt format string for the message in the dialog
* @return Nothing. If a user name resp. a password was specified,
* it will be returned as a heap-allocated character array
* into the username resp password pointer. Those must be freed with free().
* Otherwise *username resp *password will be NULL.
*/
void dialog_Login (vlc_object_t *obj, const char *default_username,
char **username, char **password,
bool *store, const char *title, const char *fmt, ...)
#undef dialog_vaLogin
void dialog_vaLogin (vlc_object_t *obj, const char *default_username,
char **username, char **password, bool *store,
const char *title, const char *fmt, va_list ap)
{
assert ((username != NULL) && (password != NULL));
......@@ -156,9 +144,7 @@ void dialog_Login (vlc_object_t *obj, const char *default_username,
return;
char *text;
va_list ap;
va_start (ap, fmt);
if (vasprintf (&text, fmt, ap) != -1)
{
dialog_login_t dialog = { title, text, default_username, username,
......@@ -166,10 +152,32 @@ void dialog_Login (vlc_object_t *obj, const char *default_username,
var_SetAddress (provider, "dialog-login", &dialog);
free (text);
}
va_end (ap);
vlc_object_release (provider);
}
#undef dialog_Login
/**
* Requests a username and password through the user interface.
* @param obj the VLC object requesting credential information
* @param username a pointer to the specified username [OUT]
* @param password a pointer to the specified password [OUT]
* @param title title for the dialog
* @param fmt format string for the message in the dialog
* @return Nothing. If a user name resp. a password was specified,
* it will be returned as a heap-allocated character array
* into the username resp password pointer. Those must be freed with free().
* Otherwise *username resp *password will be NULL.
*/
void dialog_Login (vlc_object_t *obj, const char *default_username,
char **username, char **password,
bool *store, const char *title, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
dialog_vaLogin (obj, default_username, username, password, store,
title, fmt, ap);
va_end (ap);
}
#undef dialog_Question
/**
......
......@@ -96,6 +96,7 @@ demux_vaControl
demux_vaControlHelper
dialog_ExtensionUpdate
dialog_Login
dialog_vaLogin
dialog_ProgressCancelled
dialog_ProgressCreate
dialog_ProgressDestroy
......
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