Commit 176ac080 authored by Marc Dequènes (Duck)'s avatar Marc Dequènes (Duck)

[evol] move user authentication from class IRC into IM and check properly for...

[evol] move user authentication from class IRC into IM and check properly for user existance _before_ creating a new IM instance (which would create the user config directory which is used for existence test)
parent 89c6b9e9
......@@ -113,6 +113,11 @@ string IM::getPassword() const
return purple_prefs_get_string("/minbif/password");
}
bool IM::authenticate(const string password)
{
return getPassword() == password
}
void IM::setTypingNotice(bool enabled)
{
purple_prefs_set_int("/minbif/typing_notice", enabled ? 1 : 0);
......
......@@ -430,9 +430,7 @@ void IRC::sendWelcome()
try
{
im = new im::IM(this, user->getNickname());
if(im->getPassword().empty())
if(!IM::exists(user->getNickname()))
{
/* New user. */
......@@ -443,13 +441,16 @@ void IRC::sendWelcome()
return;
}
im = new im::IM(this, user->getNickname());
im->setPassword(user->getPassword());
}
else if(im->getPassword() != user->getPassword())
else if(im->authenticate(user->getPassword()))
{
quit("Incorrect password");
return;
}
else
im = new im::IM(this, user->getNickname());
user->setFlag(Nick::REGISTERED);
......
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