1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 20:16:38 +02:00

Moved the core pseudo clients out into their own modules

This commit is contained in:
Adam
2011-04-22 03:16:11 -04:00
parent 1782ce260c
commit c8c23158a4
226 changed files with 5187 additions and 4891 deletions
-97
View File
@@ -12,59 +12,6 @@
#include "services.h"
#include "modules.h"
E void moduleAddHostServCmds();
/*************************************************************************/
void moduleAddHostServCmds()
{
ModuleManager::LoadModuleList(Config->HostServCoreModules);
}
/*************************************************************************/
/**
* Return information on memory use.
* Assumes pointers are valid.
**/
void get_hostserv_stats(long *nrec, long *memuse)
{
long count = 0, mem = 0;
for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it)
{
NickAlias *na = it->second;
if (!na->hostinfo.HasVhost())
continue;
if (!na->hostinfo.GetIdent().empty())
mem += na->hostinfo.GetIdent().length();
if (!na->hostinfo.GetHost().empty())
mem += na->hostinfo.GetHost().length();
if (!na->hostinfo.GetCreator().empty())
mem += na->hostinfo.GetCreator().length();
++count;
}
*nrec = count;
*memuse = mem;
}
/*************************************************************************/
/**
* HostServ initialization.
* @return void
*/
void hostserv_init()
{
if (!Config->s_HostServ.empty())
moduleAddHostServCmds();
}
/*************************************************************************/
/** Set a vhost for the user
* @param ident The ident
@@ -130,47 +77,3 @@ const time_t HostInfo::GetTime() const
return Time;
}
/*************************************************************************/
/* Start of Generic Functions */
/*************************************************************************/
/** Sync all vhosts in a group to the same thing
* @param na The nick with the vhost wanting to by synced
*/
void HostServSyncVhosts(NickAlias *na)
{
if (!na || !na->hostinfo.HasVhost())
return;
for (std::list<NickAlias *>::iterator it = na->nc->aliases.begin(), it_end = na->nc->aliases.end(); it != it_end; ++it)
{
NickAlias *nick = *it;
nick->hostinfo.SetVhost(na->hostinfo.GetIdent(), na->hostinfo.GetHost(), na->hostinfo.GetCreator());
}
}
/*************************************************************************/
void do_on_id(User *u)
{
if (!u)
return;
NickAlias *na = findnick(u->nick);
if (!na || !na->hostinfo.HasVhost())
return;
if (u->vhost.empty() || !u->vhost.equals_cs(na->hostinfo.GetHost()) || (!na->hostinfo.GetIdent().empty() && !u->GetVIdent().equals_cs(na->hostinfo.GetIdent())))
{
ircdproto->SendVhost(u, na->hostinfo.GetIdent(), na->hostinfo.GetHost());
if (ircd->vhost)
u->vhost = na->hostinfo.GetHost();
if (ircd->vident && !na->hostinfo.GetIdent().empty())
u->SetVIdent(na->hostinfo.GetIdent());
u->UpdateHost();
if (!na->hostinfo.GetIdent().empty())
u->SendMessage(HostServ, _("Your vhost of \002%s\002@\002%s\002 is now activated."), na->hostinfo.GetIdent().c_str(), na->hostinfo.GetHost().c_str());
else
u->SendMessage(HostServ, _("Your vhost of \002%s\002 is now activated."), na->hostinfo.GetHost().c_str());
}
}