summaryrefslogtreecommitdiff
path: root/modules/extra/m_ldap_authentication.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-05-05 01:55:04 -0400
committerAdam <Adam@anope.org>2013-05-05 01:55:04 -0400
commit1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b (patch)
tree4486f0784bdf050fd7eb225c0cb9df352ce1f45a /modules/extra/m_ldap_authentication.cpp
parent781defb7076ddfddf723ca08cd0a518b6657b64f (diff)
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
Diffstat (limited to 'modules/extra/m_ldap_authentication.cpp')
-rw-r--r--modules/extra/m_ldap_authentication.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index f39bb43e8..a8ece73ff 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -1,6 +1,6 @@
#include "module.h"
#include "nickserv.h"
-#include "ldap.h"
+#include "ldapapi.h"
static Module *me;
@@ -104,14 +104,9 @@ class IdentifyInterface : public LDAPInterface
if (na == NULL)
{
na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
- if (ii->user)
- {
- if (Config->NSAddAccessOnReg)
- na->nc->AddAccess(ii->user->Mask());
-
- if (NickServ)
- ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
- }
+ FOREACH_MOD(I_OnNickRegister, OnNickRegister(ii->user, na));
+ if (ii->user && NickServ)
+ ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
}
// encrypt and store the password in the nickcore
Anope::Encrypt(ii->req->GetPassword(), na->nc->pass);
@@ -226,21 +221,22 @@ class NSIdentifyLDAP : public Module
ModuleManager::SetPriority(this, PRIORITY_FIRST);
}
- void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override
+ void OnReload(Configuration::Conf *conf) anope_override
{
+ Configuration::Block *config = Config->GetModule(this);
- basedn = reader.ReadValue("m_ldap_authentication", "basedn", "", 0);
- search_filter = reader.ReadValue("m_ldap_authentication", "search_filter", "", 0);
- object_class = reader.ReadValue("m_ldap_authentication", "object_class", "", 0);
- username_attribute = reader.ReadValue("m_ldap_authentication", "username_attribute", "", 0);
- this->password_attribute = reader.ReadValue("m_ldap_authentication", "password_attribute", "", 0);
- email_attribute = reader.ReadValue("m_ldap_authentication", "email_attribute", "", 0);
- this->disable_register_reason = reader.ReadValue("m_ldap_authentication", "disable_register_reason", "", 0);
- this->disable_email_reason = reader.ReadValue("m_ldap_authentication", "disable_email_reason", "", 0);
+ basedn = conf->Get<const Anope::string &>("basedn");
+ search_filter = conf->Get<const Anope::string &>("search_filter");
+ object_class = conf->Get<const Anope::string &>("object_class");
+ username_attribute = conf->Get<const Anope::string &>("username_attribute");
+ this->password_attribute = conf->Get<const Anope::string &>("password_attribute");
+ email_attribute = conf->Get<const Anope::string &>("email_attribute");
+ this->disable_register_reason = conf->Get<const Anope::string &>("disable_register_reason");
+ this->disable_email_reason = conf->Get<const Anope::string &>("disable_email_reason");
if (!email_attribute.empty())
/* Don't complain to users about how they need to update their email, we will do it for them */
- Config->NSForceEmail = false;
+ Config->GetBlock("nickserv")->Set("forceemail", "false");
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
@@ -297,7 +293,7 @@ class NSIdentifyLDAP : public Module
}
}
- void OnNickRegister(NickAlias *na) anope_override
+ void OnNickRegister(User *, NickAlias *na) anope_override
{
if (!this->disable_register_reason.empty() || !this->ldap)
return;