do not display mpd password in clear text

master
Andrzej Rybczak 17 years ago
parent 94edefae44
commit 4943dea1d3
  1. 2
      src/status_checker.cpp
  2. 8
      src/window.cpp
  3. 4
      src/window.h

@ -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();

@ -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);
mvwprintw(itsWindow, y, minx, "%ls", tmp.substr(beginning, width+1).c_str());
if (encrypted)
mvwprintw(itsWindow, y, minx, "%ls", tmp.substr(beginning, width+1).c_str());
else
mvwhline(itsWindow, y, minx, '*', maxx-minx);
if (itsGetStringHelper)
itsGetStringHelper();

@ -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;

Loading…
Cancel
Save