summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2014-06-02 12:58:55 +0200
committerLars-Dominik Braun <lars@6xq.net>2014-06-02 13:01:36 +0200
commit47a24f476ef551a75ccf6b082c8139e15942c081 (patch)
tree99d611a64635f2d05f98939c0941a4eb24ff8107
parent0a64272db65201fc2ecb3406b89d895966933b99 (diff)
downloadpianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.tar.gz
pianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.tar.bz2
pianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.zip
Show username stored in config if asking for password
Thanks to Unit 193 for the suggestion.
-rw-r--r--src/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 2e9203c..887bb84 100644
--- a/src/main.c
+++ b/src/main.c
@@ -98,17 +98,24 @@ static bool BarMainLoginUser (BarApp_t *app) {
*/
static bool BarMainGetLoginCredentials (BarSettings_t *settings,
BarReadlineFds_t *input) {
+ bool usernameFromConfig = true;
+
if (settings->username == NULL) {
char nameBuf[100];
BarUiMsg (settings, MSG_QUESTION, "Email: ");
BarReadlineStr (nameBuf, sizeof (nameBuf), input, BAR_RL_DEFAULT);
settings->username = strdup (nameBuf);
+ usernameFromConfig = false;
}
if (settings->password == NULL) {
char passBuf[100];
+ if (usernameFromConfig) {
+ BarUiMsg (settings, MSG_QUESTION, "Email: %s\n", settings->username);
+ }
+
if (settings->passwordCmd == NULL) {
BarUiMsg (settings, MSG_QUESTION, "Password: ");
BarReadlineStr (passBuf, sizeof (passBuf), input, BAR_RL_NOECHO);
@@ -163,8 +170,7 @@ static bool BarMainGetLoginCredentials (BarSettings_t *settings,
return false;
}
}
-
- }
+ } /* end else passwordCmd */
}
return true;