Current->GetDesc().c_str());
}
-int ModuleSpanningTree::CountServs()
-{
- return Utils->serverlist.size();
-}
-
void ModuleSpanningTree::HandleLinks(const std::vector<std::string>& parameters, User* user)
{
ShowLinks(Utils->TreeRoot,user,0);
user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick.c_str());
- return;
}
std::string ModuleSpanningTree::TimeToStr(time_t secs)
Utils->DoOneToMany(user->uuid,"TOPIC",params);
}
-void ModuleSpanningTree::LocalMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list, const char* message_type)
+void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype)
{
- /* Server or remote origin, dest should always be non-null */
- if ((!user) || (!IS_LOCAL(user)) || (!dest))
+ if (!IS_LOCAL(user))
return;
+ const char* message_type = (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE");
if (target_type == TYPE_USER)
{
User* d = (User*) dest;
}
}
-void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype)
-{
- LocalMessage(user, dest, target_type, text, status, exempt_list, (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"));
-}
-
void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
{
AutoConnectServers(curtime);
class ModuleSpanningTree : public Module
{
SpanningTreeCommands* commands;
- void LocalMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list, const char* message_type);
public:
dynamic_reference<DNS::Manager> DNS;
*/
void ShowLinks(TreeServer* Current, User* user, int hops);
- /** Counts local and remote servers
- */
- int CountServs();
-
/** Handle LINKS command
*/
void HandleLinks(const std::vector<std::string>& parameters, User* user);
/** Display a time as a human readable string
*/
- std::string TimeToStr(time_t secs);
+ static std::string TimeToStr(time_t secs);
/**
** *** MODULE EVENTS ***
// "scratch" draw to, as the console device of an irc
// client does not provide for a proper terminal.
int totusers = ServerInstance->Users->clientlist->size();
- int totservers = this->CountServs();
+ int totservers = Utils->serverlist.size();
int maxnamew = 0;
int line = 0;
char* names = new char[totservers * 100];
* This is used during netsplits to automatically tidy up the
* server tree. It is slow, we don't use it for much else.
*/
-bool TreeServer::Tidy()
+void TreeServer::Tidy()
{
while (1)
{
std::vector<TreeServer*>::iterator a = Children.begin();
if (a == Children.end())
- return true;
+ return;
TreeServer* s = *a;
s->Tidy();
s->cull();
* This is used during netsplits to automatically tidy up the
* server tree. It is slow, we don't use it for much else.
*/
- bool Tidy();
+ void Tidy();
/** Get server ID
*/
time_t server_uptime = ServerInstance->Time() - this->age;
if (server_uptime)
{
- std::string timestr = Utils->Creator->TimeToStr(server_uptime);
+ std::string timestr = ModuleSpanningTree::TimeToStr(server_uptime);
ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", linkID.c_str(), timestr.c_str());
}
}
return FullLine;
}
-bool SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& omit)
+void SpanningTreeUtilities::DoOneToAllButSender(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& omit)
{
TreeServer* omitroute = this->BestRouteTo(omit);
std::string FullLine = ConstructLine(prefix, command, params);
Sock->WriteLine(FullLine);
}
}
- return true;
}
-bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms)
+void SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms)
{
std::string FullLine = ConstructLine(prefix, command, params);
Sock->WriteLine(FullLine);
}
}
- return true;
}
bool SpanningTreeUtilities::DoOneToOne(const std::string& prefix, const std::string& command, const parameterlist& params, const std::string& target)
/** Send a message from this server to all but one other, local or remote
*/
- bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist& params, const std::string& omit);
+ void DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist& params, const std::string& omit);
/** Send a message from this server to all others
*/
- bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms);
+ void DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist ¶ms);
/** Read the spanningtree module's tags from the config file
*/