From 8f1f87ce10097e05419dda9d24419047e463daf9 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 19 Jul 2006 09:16:45 +0000 Subject: Fix motd with new buffering git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4434 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/helperfuncs.cpp | 30 +++--------------------------- 1 file 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) -- cgit v1.2.3