motd.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "inspircd.h"
00015 #include "xline.h"
00016
00017 #include "m_spanningtree/treesocket.h"
00018 #include "m_spanningtree/treeserver.h"
00019 #include "m_spanningtree/utils.h"
00020
00021
00022
00023
00024
00026 bool TreeSocket::Motd(const std::string &prefix, std::deque<std::string> ¶ms)
00027 {
00028 if (params.size() > 0)
00029 {
00030 if (InspIRCd::Match(this->ServerInstance->Config->ServerName, params[0]))
00031 {
00032
00033 string_list results;
00034 User* source = this->ServerInstance->FindNick(prefix);
00035
00036 if (source)
00037 {
00038 std::deque<std::string> par;
00039 par.push_back(prefix);
00040 par.push_back("");
00041
00042 if (!ServerInstance->Config->MOTD.size())
00043 {
00044 par[1] = std::string("::")+ServerInstance->Config->ServerName+" 422 "+source->nick+" :Message of the day file is missing.";
00045 Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server);
00046 return true;
00047 }
00048
00049 par[1] = std::string("::")+ServerInstance->Config->ServerName+" 375 "+source->nick+" :"+ServerInstance->Config->ServerName+" message of the day";
00050 Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server);
00051
00052 for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++)
00053 {
00054 par[1] = std::string("::")+ServerInstance->Config->ServerName+" 372 "+source->nick+" :- "+ServerInstance->Config->MOTD[i];
00055 Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server);
00056 }
00057
00058 par[1] = std::string("::")+ServerInstance->Config->ServerName+" 376 "+source->nick+" :End of message of the day.";
00059 Utils->DoOneToOne(this->ServerInstance->Config->GetSID(), "PUSH",par, source->server);
00060 }
00061 }
00062 else
00063 {
00064
00065 User* source = this->ServerInstance->FindNick(prefix);
00066 if (source)
00067 Utils->DoOneToOne(prefix, "MOTD", params, params[0]);
00068 }
00069 }
00070 return true;
00071 }
00072