extern time_t TIME;
extern char lowermap[255];
extern userrec* fd_ref_table[MAX_DESCRIPTORS];
-static char already_sent[MAX_DESCRIPTORS];
+static unsigned long already_sent[MAX_DESCRIPTORS] = {0};
extern std::vector<userrec*> all_opers;
extern user_hash clientlist;
extern chan_hash chanlist;
static time_t LAST = 0;
/* XXX: Used for speeding up WriteCommon operations */
-int uniq_id = 0;
+unsigned long uniq_id = 0;
/** log()
* Write a line of text `text' to the logfile (and stdout, if in nofork) if the level `level'
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- // XXX: Save on memset calls by only requiring memset every 4 billion or so
- // messages. This clever trick thought of during discussion with nazzy and w00t.
+ // XXX: Save on memset calls by using an ID. This clever trick thought of during discussion with nazzy and w00t.
uniq_id++;
- if (!uniq_id)
- {
- memset(&already_sent,0,MAX_DESCRIPTORS);
- uniq_id++;
- }
for (std::vector<ucrec*>::const_iterator v = u->chans.begin(); v != u->chans.end(); v++)
{
// XXX: See comment in WriteCommon
uniq_id++;
- if (!uniq_id)
- {
- memset(&already_sent,0,MAX_DESCRIPTORS);
- uniq_id++;
- }
for (std::vector<ucrec*>::const_iterator v = u->chans.begin(); v != u->chans.end(); v++)
{
}
uniq_id++;
- if (!uniq_id)
- {
- memset(&already_sent,0,MAX_DESCRIPTORS);
- uniq_id++;
- }
for (std::vector<ucrec*>::const_iterator v = u->chans.begin(); v != u->chans.end(); v++)
{
}
uniq_id++;
- if (!uniq_id)
- {
- memset(&already_sent,0,MAX_DESCRIPTORS);
- uniq_id++;
- }
for (std::vector<ucrec*>::const_iterator v = u->chans.begin(); v != u->chans.end(); v++)
{
// firstly decrement the count on each channel
for (std::vector<ucrec*>::iterator f = u->chans.begin(); f != u->chans.end(); f++)
{
- if (((ucrec*)(*f))->channel)
+ ucrec* uc = (ucrec*)(*f);
+ if (uc->channel)
{
- if (((ucrec*)(*f))->channel->DelUser(u) == 0)
+ if (uc->channel->DelUser(u) == 0)
{
/* No users left in here, mark it for deletion */
- to_delete.push_back(((ucrec*)(*f))->channel);
- ((ucrec*)(*f))->channel = NULL;
+ to_delete.push_back(uc->channel);
+ uc->channel = NULL;
}
}
}
WriteServ(user->fd,"375 %s :%s message of the day", user->nick, Config->ServerName);
for (unsigned int i = 0; i < Config->MOTD.size(); i++)
- WriteServ(user->fd,"372 %s :- ",user->nick,Config->MOTD[i].c_str());
+ WriteServ(user->fd,"372 %s :- %s",user->nick,Config->MOTD[i].c_str());
WriteServ(user->fd,"376 %s :End of message of the day.", user->nick);
}