typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, irc::StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, irc::InAddr_HashComp> address_cache;
typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, irc::StrHashComp> whowas_hash;
typedef std::deque<command_t> command_table;
typedef std::map<std::string,time_t> autoconnects;
typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, irc::StrHashComp> chan_hash;
typedef nspace::hash_map<in_addr,string*, nspace::hash<in_addr>, irc::InAddr_HashComp> address_cache;
typedef nspace::hash_map<std::string, WhoWasUser*, nspace::hash<string>, irc::StrHashComp> whowas_hash;
typedef std::deque<command_t> command_table;
typedef std::map<std::string,time_t> autoconnects;
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
+void AddServerName(std::string servername)
+{
+ for (servernamelist::iterator a = servernames.begin(); a < servernames.end(); a++)
+ {
+ if (*a == servername)
+ return;
+ }
+ servernames.push_back(servername);
+}
+
+const char* FindServerNamePtr(std::string servername)
+{
+ for (servernamelist::iterator a = servernames.begin(); a < servernames.end(); a++)
+ {
+ if (*a == servername)
+ return a->c_str();
+ }
+ return "";
+}
+
void DeleteOper(userrec* user)
{
for (std::vector<userrec*>::iterator a = all_opers.begin(); a < all_opers.end(); a++)
void DeleteOper(userrec* user)
{
for (std::vector<userrec*>::iterator a = all_opers.begin(); a < all_opers.end(); a++)
char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF],thold[MAXBUF],sqmax[MAXBUF],rqmax[MAXBUF];
ConnectClass c;
std::stringstream errstr;
char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF],thold[MAXBUF],sqmax[MAXBUF],rqmax[MAXBUF];
ConnectClass c;
std::stringstream errstr;
}
log(DEBUG,"add_channel: %s %s",user->nick,cname);
}
log(DEBUG,"add_channel: %s %s",user->nick,cname);
- WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason);
+ // fix by brain: only show local quits because we only show local connects (it just makes SENSE)
+ if (!strcmp(user->server,ServerName))
+ WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason);
whowas_hash::iterator iter = whowas.find(u->nick);
WhoWasUser *a = new WhoWasUser();
strlcpy(a->nick,u->nick,NICKMAX);
whowas_hash::iterator iter = whowas.find(u->nick);
WhoWasUser *a = new WhoWasUser();
strlcpy(a->nick,u->nick,NICKMAX);
strlcpy(a->dhost,u->dhost,160);
strlcpy(a->host,u->host,160);
strlcpy(a->dhost,u->dhost,160);
strlcpy(a->host,u->host,160);
log(DEBUG,"AddClient: %lu %s %d %s",(unsigned long)socket,host,port,ip);
clientlist[tempnick]->fd = socket;
log(DEBUG,"AddClient: %lu %s %d %s",(unsigned long)socket,host,port,ip);
clientlist[tempnick]->fd = socket;
- strncpy(clientlist[tempnick]->nick, tn2,NICKMAX);
- strncpy(clientlist[tempnick]->host, host,160);
- strncpy(clientlist[tempnick]->dhost, host,160);
- strncpy(clientlist[tempnick]->server, ServerName,256);
- strncpy(clientlist[tempnick]->ident, "unknown",15);
+ strlcpy(clientlist[tempnick]->nick, tn2,NICKMAX);
+ strlcpy(clientlist[tempnick]->host, host,160);
+ strlcpy(clientlist[tempnick]->dhost, host,160);
+ clientlist[tempnick]->server = (char*)FindServerNamePtr(ServerName);
+ strlcpy(clientlist[tempnick]->ident, "unknown",IDENTMAX);
clientlist[tempnick]->registered = 0;
clientlist[tempnick]->signon = TIME+dns_timeout;
clientlist[tempnick]->lastping = 1;
clientlist[tempnick]->port = port;
clientlist[tempnick]->registered = 0;
clientlist[tempnick]->signon = TIME+dns_timeout;
clientlist[tempnick]->lastping = 1;
clientlist[tempnick]->port = port;
// fix by brain: these should be AFTER the N token, so other servers know what the HELL we're on about... :)
FOREACH_MOD OnUserConnect(user);
// fix by brain: these should be AFTER the N token, so other servers know what the HELL we're on about... :)
FOREACH_MOD OnUserConnect(user);
WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,user->ip);
}
WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,user->ip);
}
{
// command is disabled!
WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command);
return;
}
{
// command is disabled!
WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command);
return;
}
}
if ((user->registered == 7) || (!strncmp(command,"USER",4)) || (!strncmp(command,"NICK",4)) || (!strncmp(command,"PASS",4)))
{
}
if ((user->registered == 7) || (!strncmp(command,"USER",4)) || (!strncmp(command,"NICK",4)) || (!strncmp(command,"PASS",4)))
{
int clientportcount = 0, serverportcount = 0;
for (count = 0; count < ConfValueEnum("bind",&config_f); count++)
int clientportcount = 0, serverportcount = 0;
for (count = 0; count < ConfValueEnum("bind",&config_f); count++)
msgs.clear();
while ((me[x]) && (me[x]->RecvPacket(msgs, tcp_host, sums))) // returns 0 or more lines (can be multiple lines!)
{
msgs.clear();
while ((me[x]) && (me[x]->RecvPacket(msgs, tcp_host, sums))) // returns 0 or more lines (can be multiple lines!)
{
for (int ctr = 0; ctr < msgs.size(); ctr++)
{
strlcpy(tcp_msg,msgs[ctr].c_str(),MAXBUF);
for (int ctr = 0; ctr < msgs.size(); ctr++)
{
strlcpy(tcp_msg,msgs[ctr].c_str(),MAXBUF);