extern time_t TIME;
-class ListData
+class ListData : public classbase
{
public:
long list_start;
* - If not, spool more channels
*/
userrec* u = (userrec*)(*iter);
- ListData* ld = (ListData*)u->GetExt("safelist_cache");
+ ListData* ld;
+ u->GetExt("safelist_cache", ld);
if (ld->list_position > Srv->GetChannelCount())
{
u->Shrink("safelist_cache");
- delete ld;
+ DELETE(ld);
listusers.erase(iter);
go_again = true;
break;
* OnPreCommand()
* Intercept the LIST command.
*/
- 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)
{
/* If the command doesnt appear to be valid, we dont want to mess with it. */
if (!validated)
* HandleList()
* Handle (override) the LIST command.
*/
- int HandleList(char** parameters, int pcnt, userrec* user)
+ int HandleList(const char** parameters, int pcnt, userrec* user)
{
/* First, let's check if the user is currently /list'ing */
- ListData *ld = (ListData*)user->GetExt("safelist_cache");
+ ListData *ld;
+ user->GetExt("safelist_cache", ld);
if (ld)
{
return 1;
}
- time_t* last_list_time = (time_t*)user->GetExt("safelist_last");
+ time_t* last_list_time;
+ user->GetExt("safelist_last", last_list_time);
if (last_list_time)
{
if (TIME < (*last_list_time)+60)
return 1;
}
- delete last_list_time;
+ DELETE(last_list_time);
user->Shrink("safelist_last");
}
* start at channel 0! ;)
*/
ld = new ListData(0,TIME);
- user->Extend("safelist_cache", (char*)ld);
+ user->Extend("safelist_cache", ld);
listusers.push_back(user);
time_t* llt = new time_t;
*llt = TIME;
- user->Extend("safelist_last",(char*)llt);
+ user->Extend("safelist_last", llt);
return 1;
}
if(target_type == TYPE_USER)
{
userrec* u = (userrec*)item;
- ListData* ld = (ListData*)u->GetExt("safelist_cache");
+ ListData* ld;
+ u->GetExt("safelist_cache", ld);
if (ld)
{
u->Shrink("safelist_cache");
- delete ld;
+ DELETE(ld);
}
for (UserList::iterator iter = listusers.begin(); iter != listusers.end(); iter++)
{
break;
}
}
- time_t* last_list_time = (time_t*)u->GetExt("safelist_last");
+ time_t* last_list_time;
+ u->GetExt("safelist_last", last_list_time);
if (last_list_time)
{
- delete last_list_time;
+ DELETE(last_list_time);
u->Shrink("safelist_last");
}
}