enum BlockAction { IBLOCK_KILL, IBLOCK_KILLOPERS, IBLOCK_NOTICE, IBLOCK_NOTICEOPERS, IBLOCK_SILENT };
-class BlockedMessage
+class BlockedMessage : public classbase
{
public:
std::string message;
else
action = IBLOCK_KILLOPERS;
- delete Conf;
+ DELETE(Conf);
}
- virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated)
+ virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated)
{
// Don't do anything with unregistered users, or remote ones.
- if(!user || (user->registered != 7) || !IS_LOCAL(user))
+ if(!user || (user->registered != REG_ALL) || !IS_LOCAL(user))
return 0;
// We want case insensitive command comparison.
if(*parameters[0] != '#')
targets--;
- for(char* c = parameters[0]; *c; c++)
+ for(const char* c = parameters[0]; *c; c++)
if((*c == ',') && *(c+1) && (*(c+1) == '#'))
targets++;
userchans++;
// Check that this message wasn't already sent within a few seconds.
- BlockedMessage* m = (BlockedMessage*)user->GetExt("amsgblock");
+ BlockedMessage* m;
+ user->GetExt("amsgblock", m);
// If the message is identical and within the time.
// We check the target is *not* identical, that'd straying into the realms of flood control. Which isn't what we're doing...
if(target_type == TYPE_USER)
{
userrec* user = (userrec*)item;
- BlockedMessage* m = (BlockedMessage*)user->GetExt("amsgblock");
+ BlockedMessage* m;
+ user->GetExt("amsgblock", m);
if(m)
{
- delete m;
+ DELETE(m);
user->Shrink("amsgblock");
}
}