int DieDelay = 5;
time_t startup_time = time(NULL);
int NetBufferSize = 10240; // NetBufferSize used as the buffer size for all read() ops
+extern int MaxWhoResults;
time_t nb_start = 0;
extern vector<Module*> modules;
void ReadConfig(void)
{
- char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF];
+ char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF];
ConnectClass c;
LoadConf(CONFIG_FILE,&config_f);
ConfValue("die","value",0,DieValue,&config_f);
ConfValue("options","loglevel",0,dbg,&config_f);
ConfValue("options","netbuffersize",0,NB,&config_f);
+ ConfValue("options","maxwho",0,MW,&config_f);
NetBufferSize = atoi(NB);
+ MaxWhoResults = atoi(MW);
if ((!NetBufferSize) || (NetBufferSize > 65535) || (NetBufferSize < 1024))
{
log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
NetBufferSize = 10240;
}
+ if ((!MaxWhoResults) || (MaxWhoResults > 65535) || (MaxWhoResults < 1))
+ {
+ log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
+ MaxWhoResults = 128;
+ }
if (!strcmp(dbg,"debug"))
LogLevel = DEBUG;
if (!strcmp(dbg,"verbose"))
}
if (strcmp(chan->key,""))
{
+ strncat(sparam," ",MAXBUF);
strncat(sparam,chan->key,MAXBUF);
}
if (chan->limit)
{
// use the stamdard J token with no privilages.
char buffer[MAXBUF];
- snprintf(buffer,MAXBUF,"J %s %s",user->nick,Ptr->name);
+ if (created == 2)
+ {
+ snprintf(buffer,MAXBUF,"J %s @%s",user->nick,Ptr->name);
+ }
+ else
+ {
+ snprintf(buffer,MAXBUF,"J %s %s",user->nick,Ptr->name);
+ }
NetSendToAll(buffer);
}
}
}
+void kill_link_silent(userrec *user,const char* r)
+{
+ user_hash::iterator iter = clientlist.find(user->nick);
+
+ char reason[MAXBUF];
+
+ strncpy(reason,r,MAXBUF);
+
+ if (strlen(reason)>MAXQUIT)
+ {
+ reason[MAXQUIT-1] = '\0';
+ }
+
+ log(DEBUG,"kill_link: %s '%s'",user->nick,reason);
+ Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
+ log(DEBUG,"closing fd %d",user->fd);
+
+ /* bugfix, cant close() a nonblocking socket (sux!) */
+ if (user->registered == 7) {
+ FOREACH_MOD OnUserQuit(user);
+ WriteCommonExcept(user,"QUIT :%s",reason);
+
+ // Q token must go to ALL servers!!!
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"Q %s :%s",user->nick,reason);
+ NetSendToAll(buffer);
+ }
+
+ /* push the socket on a stack of sockets due to be closed at the next opportunity
+ * 'Client exited' is an exception to this as it means the client side has already
+ * closed the socket, we don't need to do it.
+ */
+ fd_reap.push_back(user->fd);
+
+ bool do_purge = false;
+
+ if (iter != clientlist.end())
+ {
+ log(DEBUG,"deleting user hash value %d",iter->second);
+ if ((iter->second) && (user->registered == 7)) {
+ delete iter->second;
+ }
+ clientlist.erase(iter);
+ }
+
+ if (user->registered == 7) {
+ purge_empty_chans();
+ }
+}
+
// looks up a users password for their connection class (<ALLOW>/<DENY> tags)
clientlist[tempnick] = new userrec();
NonBlocking(socket);
- log(DEBUG,"AddClient: %d %s %d",socket,host,port);
+ log(DEBUG,"AddClient: %d %s %d %s",socket,host,port,ip);
clientlist[tempnick]->fd = socket;
strncpy(clientlist[tempnick]->nick, tn2,NICKMAX);
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"G-Lined: %s",r);
- kill_link(user,reason);
+ kill_link_silent(user,reason);
return;
}
{
char reason[MAXBUF];
snprintf(reason,MAXBUF,"K-Lined: %s",r);
- kill_link(user,reason);
+ kill_link_silent(user,reason);
return;
}
WriteOpers("*** Client connecting on port %d: %s!%s@%s",user->port,user->nick,user->ident,user->host);
char buffer[MAXBUF];
- snprintf(buffer,MAXBUF,"N %d %s %s %s %s +%s %s :%s",user->age,user->nick,user->host,user->dhost,user->ident,user->modes,ServerName,user->fullname);
+ snprintf(buffer,MAXBUF,"N %d %s %s %s %s +%s %s %s :%s",user->age,user->nick,user->host,user->dhost,user->ident,user->modes,user->ip,ServerName,user->fullname);
NetSendToAll(buffer);
}
// send users and channels
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
- snprintf(data,MAXBUF,"N %d %s %s %s %s +%s %s :%s",u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,u->second->server,u->second->fullname);
+ snprintf(data,MAXBUF,"N %d %s %s %s %s +%s %s %s :%s",u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,u->second->ip,u->second->server,u->second->fullname);
serv->SendPacket(data,tcp_host);
if (strcmp(chlist(u->second),""))
{
serv->SendPacket(data,tcp_host);
}
}
+ // sync global zlines, glines, etc
+ sync_xlines(serv,tcp_host);
snprintf(data,MAXBUF,"F %d",time(NULL));
serv->SendPacket(data,tcp_host);
log(DEBUG,"Sent sync");
}
else
{
- AddClient(incomingSockfd, resolved, ports[count], iscached, target);
+ AddClient(incomingSockfd, resolved, ports[count], iscached, inet_ntoa (client.sin_addr));
log(DEBUG,"InspIRCd: adding client on port %d fd=%d",ports[count],incomingSockfd);
}
goto label;