do not display mpd password in clear text

This commit is contained in:
Andrzej Rybczak
2009-02-05 20:22:03 +01:00
parent 94edefae44
commit 4943dea1d3
3 changed files with 9 additions and 5 deletions

View File

@@ -139,7 +139,7 @@ void NcmpcppErrorCallback(Connection *Mpd, int errorid, const char *msg, void *)
{
wFooter->SetGetStringHelper(NULL);
Statusbar() << "Password: ";
string password = wFooter->GetString();
string password = wFooter->GetString(-1, 0, 1);
Mpd->SetPassword(password);
Mpd->SendPassword();
Mpd->UpdateStatus();

View File

@@ -350,7 +350,7 @@ void Window::WriteXY(int x, int y, bool cte, const char *format, ...) const
wclrtoeol(itsWindow);
}
string Window::GetString(const string &base, size_t length, size_t width) const
string Window::GetString(const string &base, size_t length, size_t width, bool encrypted) const
{
int input;
size_t beginning, maxbeginning, minx, x, real_x, y, maxx, real_maxx;
@@ -414,7 +414,11 @@ string Window::GetString(const string &base, size_t length, size_t width) const
}
mvwhline(itsWindow, y, minx, 32, width+1);
if (encrypted)
mvwprintw(itsWindow, y, minx, "%ls", tmp.substr(beginning, width+1).c_str());
else
mvwhline(itsWindow, y, minx, '*', maxx-minx);
if (itsGetStringHelper)
itsGetStringHelper();

View File

@@ -97,8 +97,8 @@ class Window
const std::string &GetTitle() const;
Color GetColor() const;
Border GetBorder() const;
std::string GetString(const std::string &, size_t = -1, size_t = 0) const;
string GetString(unsigned int length = -1, int width = 0) const { return GetString("", length, width); }
std::string GetString(const std::string &, size_t = -1, size_t = 0, bool = 0) const;
string GetString(size_t length = -1, size_t width = 0, bool encrypted = 0) const { return GetString("", length, width, encrypted); }
void GetXY(int &, int &);
void GotoXY(int, int);
const int &X() const;