summaryrefslogtreecommitdiff
path: root/src/modules/m_park.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 17:21:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 17:21:26 +0000
commit0942fe7405f0ff38038f7445c241fdae0bd7d1a2 (patch)
tree2d386c188161a949e7c32e28744a097c0d06247c /src/modules/m_park.cpp
parent3eefd1dfbdf611e526670b89dbd738e17c392c2c (diff)
Convert to templated GetExt
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4285 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_park.cpp')
-rw-r--r--src/modules/m_park.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index a5c62da19..8b800138a 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -80,12 +80,13 @@ class cmd_park : public command_t
{
awaylog* aw;
char msg[MAXBUF];
- unsigned long key = abs(random() * 12345);
- snprintf(msg,MAXBUF,"You are now parked. To unpark use /UNPARK %s %lu",user->nick,key);
+ unsigned long* key = new unsigned long;
+ *key = abs(random() * 12345);
+ snprintf(msg,MAXBUF,"You are now parked. To unpark use /UNPARK %s %lu",user->nick, *key);
Srv->UserToPseudo(user,std::string(msg));
aw = new awaylog;
- user->Extend("park_awaylog",(char*)aw);
- user->Extend("park_key",(char*)key);
+ user->Extend("park_awaylog", aw);
+ user->Extend("park_key", key);
pi.nick = user->nick;
pi.host = user->host;
pi.parktime = time(NULL);
@@ -143,14 +144,16 @@ class cmd_unpark : public command_t
WriteServ(user->fd,"942 %s %s :Invalid user specified.",user->nick, parameters[0]);
return;
}
- awaylog* awy = (awaylog*)unpark->GetExt("park_awaylog");
- long key = (long)unpark->GetExt("park_key");
+ awaylog* awy;
+ unpark->GetExt("park_awaylog", awy);
+ long* key;
+ unpark->GetExt("park_key", key);
if (!awy)
{
WriteServ(user->fd,"943 %s %s :This user is not parked.",user->nick, unpark->nick);
return;
}
- if (key == atoi(parameters[1]))
+ if (*key == atoi(parameters[1]))
{
// first part the user from all chans theyre on, so things dont get messy
for (std::vector<ucrec*>::iterator i = user->chans.begin(); i != user->chans.end(); i++)
@@ -177,6 +180,7 @@ class cmd_unpark : public command_t
WriteServ(unpark->fd,"NOTICE %s :From %s at %s: \2%s\2",unpark->nick,i->from.c_str(),timebuf,i->text.c_str());
}
DELETE(awy);
+ DELETE(key);
unpark->Shrink("park_awaylog");
unpark->Shrink("park_key");
for (parkinfo::iterator j = pinfo.begin(); j != pinfo.end(); j++)
@@ -262,7 +266,8 @@ class ModulePark : public Module
virtual void OnPrePrivmsg(userrec* user, userrec* dest, const std::string &text)
{
- awaylog* awy = (awaylog*)dest->GetExt("park_awaylog");
+ awaylog* awy;
+ dest->GetExt("park_awaylog", awy);
if (awy)
{
if (awy->size() <= (unsigned)ParkMaxMsgs)
@@ -334,7 +339,8 @@ class ModulePark : public Module
virtual void OnWhois(userrec* src, userrec* dst)
{
- if (dst->GetExt("park_awaylog"))
+ char* dummy;
+ if (dst->GetExt("park_awaylog", dummy))
Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a parked client");
}