summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 07:51:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-06 07:51:44 +0000
commitb13975318539561a39624e95ee41c32f2f749663 (patch)
treee1676f5c11ded2ad7989e7f09e7bf3487efe4dc2 /src/modules
parent0d37047da236818ea62add6b510f4a52f0dd10e7 (diff)
Tidy up m_safelist to avoid strlen on every line output, we're strlen()ing a constant-ish string so instead record the value for later use.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5425 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_safelist.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index da4635442..9008e485a 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -55,11 +55,13 @@ class ListTimer : public InspTimer
chanrec *chan;
InspIRCd* ServerInstance;
const std::string glob;
+ size_t ServerNameSize;
public:
ListTimer(InspIRCd* Instance, long interval) : InspTimer(interval,Instance->Time()), ServerInstance(Instance)
{
+ ServerNameSize = 4 + strlen(ServerInstance->Config->ServerName);
}
virtual void Tick(time_t TIME)
@@ -92,7 +94,7 @@ class ListTimer : public InspTimer
ServerInstance->Log(DEBUG, "m_safelist.so: resuming spool of list to client %s at channel %ld", u->nick, ld->list_position);
chan = NULL;
- /* Attempt to fill up to half the user's sendq with /LIST output */
+ /* Attempt to fill up to 25% the user's sendq with /LIST output */
long amount_sent = 0;
do
{
@@ -105,14 +107,14 @@ class ListTimer : public InspTimer
if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user)))
{
bool display = match(chan->name, ld->glob.c_str());
-
long users = chan->GetUserCounter();
+
if ((users) && (display))
{
- int counter = snprintf(buffer,MAXBUF,"322 %s %s %ld :[+%s] %s",u->nick,chan->name,users,chan->ChanModes(has_user),chan->topic);
+ int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s",u->nick, chan->name, users, chan->ChanModes(has_user), chan->topic);
/* Increment total plus linefeed */
- amount_sent += counter + 4 + strlen(ServerInstance->Config->ServerName);
- ServerInstance->Log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
+ amount_sent += counter + ServerNameSize;
+ ServerInstance->Log(DEBUG, "m_safelist.so: Sent %ld of safe %ld / 4", amount_sent, u->sendqmax);
u->WriteServ(std::string(buffer));
}
}