summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-19 09:16:45 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-19 09:16:45 +0000
commit8f1f87ce10097e05419dda9d24419047e463daf9 (patch)
tree61f55f09941046ec4ade222e295d9faca0ca4f9a
parent983f18f8348c96edd3086e750db29778bec8b042 (diff)
Fix motd with new buffering
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4434 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/helperfuncs.cpp30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index f83d0f618..a94d5f915 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -1549,42 +1549,18 @@ void ShowMOTD(userrec *user)
{
static char mbuf[MAXBUF];
static char crud[MAXBUF];
- std::string WholeMOTD = "";
if (!Config->MOTD.size())
{
WriteServ(user->fd,"422 %s :Message of the day file is missing.",user->nick);
return;
}
-
- snprintf(crud,MAXBUF,":%s 372 %s :- ", Config->ServerName, user->nick);
- snprintf(mbuf,MAXBUF,":%s 375 %s :- %s message of the day\r\n", Config->ServerName, user->nick, Config->ServerName);
- WholeMOTD = WholeMOTD + mbuf;
+ WriteServ(user->fd,"375 %s :%s message of the day", user->nick, Config->ServerName);
for (unsigned int i = 0; i < Config->MOTD.size(); i++)
- WholeMOTD = WholeMOTD + std::string(crud) + Config->MOTD[i].c_str() + std::string("\r\n");
-
- snprintf(mbuf,MAXBUF,":%s 376 %s :End of message of the day.\r\n", Config->ServerName, user->nick);
- WholeMOTD = WholeMOTD + mbuf;
-
- // only one write operation
- if (Config->GetIOHook(user->port))
- {
- try
- {
- Config->GetIOHook(user->port)->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- user->AddWriteBuf(WholeMOTD);
- }
+ WriteServ(user->fd,"372 %s :- ",user->nick,Config->MOTD[i].c_str());
- ServerInstance->stats->statsSent += WholeMOTD.length();
+ WriteServ(user->fd,"376 %s :End of message of the day.", user->nick);
}
void ShowRULES(userrec *user)