/* <- :twisted.oscnet.org 330 w00t2 w00t2 w00t :is logged in as */
virtual void OnWhois(userrec* source, userrec* dest)
{
- char *account = dest->GetExt("accountname");
+ std::string *account;
+ dest->GetExt("accountname", account);
if (account)
{
- std::string* accountn = (std::string*)account;
- WriteServ(source->fd, "330 %s %s %s :is logged in as", source->nick, dest->nick, accountn->c_str());
+ source->WriteServ("330 %s %s %s :is logged in as", source->nick, dest->nick, account->c_str());
}
}
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status)
{
- char *account = user->GetExt("accountname");
+ std::string *account;
+ user->GetExt("accountname", account);
if (target_type == TYPE_CHANNEL)
{
}
// user messaging a +M channel and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel");
return 1;
}
}
}
// user messaging a +R user and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user");
return 1;
}
}
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
{
- char *account = user->GetExt("accountname");
+ std::string *account;
+ user->GetExt("accountname", account);
if (chan)
{
return 0;
}
// joining a +R channel and not identified
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel");
return 1;
}
}
if (extname == "accountname")
{
// check if this user has an swhois field to send
- char* field = user->GetExt("accountname");
- if (field)
+ std::string* account;
+ user->GetExt("accountname", account);
+ if (account)
{
- // get our extdata out with a cast
- std::string* account = (std::string*)field;
// call this function in the linking module, let it format the data how it
// sees fit, and send it on its way. We dont need or want to know how.
proto->ProtoSendMetaData(opaque,TYPE_USER,user,extname,*account);
// when a user quits, tidy up their metadata
virtual void OnUserQuit(userrec* user, const std::string &message)
{
- char* field = user->GetExt("accountname");
- if (field)
+ std::string* account;
+ user->GetExt("accountname", account);
+ if (account)
{
- std::string* account = (std::string*)field;
user->Shrink("accountname");
delete account;
}
if (target_type == TYPE_USER)
{
userrec* user = (userrec*)item;
- char* field = user->GetExt("accountname");
- if (field)
+ std::string* account;
+ user->GetExt("accountname", account);
+ if (account)
{
- std::string* account = (std::string*)field;
user->Shrink("accountname");
delete account;
}
/* logging them out? */
if (extdata == "")
{
- char* field = dest->GetExt("accountname");
- if (field)
+ std::string* account;
+ dest->GetExt("accountname", account);
+ if (account)
{
- std::string* account = (std::string*)field;
dest->Shrink("accountname");
delete account;
}
else
{
// if they dont already have an accountname field, accept the remote server's
- if (!dest->GetExt("accountname"))
+ std::string* text;
+ if (!dest->GetExt("accountname", text))
{
- std::string* text = new std::string(extdata);
- dest->Extend("accountname",(char*)text);
+ text = new std::string(extdata);
+ dest->Extend("accountname", text);
}
}
}