summaryrefslogtreecommitdiff
path: root/src/modules/hs_request.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/hs_request.c')
-rw-r--r--src/modules/hs_request.c81
1 files changed, 34 insertions, 47 deletions
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c
index a5e8a016a..9d043e6d0 100644
--- a/src/modules/hs_request.c
+++ b/src/modules/hs_request.c
@@ -366,27 +366,6 @@ class HSListBase : public Command
}
};
-class CommandHSList : public HSListBase
-{
- public:
- CommandHSList() : HSListBase("LIST", 0, 1)
- {
- }
-
- CommandReturn Execute(User *u, std::vector<std::string> &params)
- {
- const char *key = params.size() ? params[0].c_str() : NULL;
-
- if (!key)
- return MOD_CONT;
-
- if (stricmp(key, "+req"))
- return MOD_CONT;
-
- return this->DoList(u, params);
- }
-};
-
class CommandHSWaiting : public HSListBase
{
public:
@@ -412,29 +391,6 @@ class CommandHSWaiting : public HSListBase
}
};
-class CommandNSDrop : public Command
-{
- public:
- CommandNSDrop() : Command("DROP", 0, 0)
- {
- }
-
- CommandReturn Execute(User *u, std::vector<std::string> &params)
- {
- HostCore *tmp;
- bool found = false;
- NickAlias *na;
-
- na = findnick(u->nick);
- tmp = findHostCore(hs_request_head, u->nick, &found);
-
- if (found && na)
- hs_request_head = deleteHostCore(hs_request_head, tmp);
-
- return MOD_CONT;
- }
-};
-
class HSRequest : public Module
{
public:
@@ -446,10 +402,8 @@ class HSRequest : public Module
this->AddCommand(HOSTSERV, new CommandHSActivate(), MOD_HEAD);
this->AddCommand(HOSTSERV, new CommandHSReject(), MOD_HEAD);
this->AddCommand(HOSTSERV, new CommandHSWaiting(), MOD_HEAD);
- this->AddCommand(HOSTSERV, new CommandHSList(), MOD_HEAD);
-
- this->AddCommand(NICKSERV, new CommandNSDrop(), MOD_HEAD);
+ ModuleManager::Attach(I_OnPreCommand, this);
ModuleManager::Attach(I_OnSaveDatabase, this);
ModuleManager::Attach(I_OnBackupDatabase, this);
@@ -731,6 +685,39 @@ class HSRequest : public Module
delete [] HSRequestDBName;
}
+ EventReturn OnPreCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params)
+ {
+ if (service == s_HostServ)
+ {
+ if (command == "LIST")
+ {
+ const char *key = params.size() ? params[0].c_str() : NULL;
+
+ if (key && !stricmp(key, "+req"))
+ {
+ std::vector<std::string> emptyParams;
+ Command *c = findCommand(HOSTSERV, "WAITING");
+ c->Execute(u, emptyParams);
+ return EVENT_STOP;
+ }
+ }
+ }
+ else if (service == s_NickServ)
+ {
+ if (command == "DROP")
+ {
+ bool found = false;
+ NickAlias *na = findnick(u->nick);
+ HostCore *tmp = findHostCore(hs_request_head, u->nick, &found);
+
+ if (found && na)
+ hs_request_head = deleteHostCore(hs_request_head, tmp);
+ }
+ }
+
+ return EVENT_CONTINUE;
+ }
+
void OnSaveDatabase()
{
FILE *fp;