char a[MAXBUF],b[MAXBUF];
strlcpy(a,s1.c_str(),MAXBUF);
strlcpy(b,s2.c_str(),MAXBUF);
+ strlower(a);
+ strlower(b);
return (strcasecmp(a,b) == 0);
}
}
// this must be propogated so that channel membership is kept in step network-wide
-
char buffer[MAXBUF];
snprintf(buffer,MAXBUF,"k %s %s %s :%s",user->nick,u->nick,Ptr->name,reason);
NetSendToAll(buffer);
sleep(1);
for (int i = 0; i < 65536; i++)
{
- int on = 0;
+ int on = 1;
struct linger linger = { 0 };
setsockopt(i, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
linger.l_onoff = 1;
- linger.l_linger = 0;
+ linger.l_linger = 1;
setsockopt(i, SOL_SOCKET, SO_LINGER, (const char*)&linger,sizeof(linger));
Blocking(i);
close(i);
}
- sleep(5);
+ sleep(2);
execv(MyExecutable,argv);
log(DEBUG,"kill: %s %s",parameters[0],parameters[1]);
if (u)
{
+ log(DEBUG,"into kill mechanism");
int MOD_RESULT = 0;
FOREACH_RESULT(OnKill(user,u,parameters[1]));
if (MOD_RESULT) {
+ log(DEBUG,"A module prevented the kill with result %d",MOD_RESULT);
return;
}
log(DEBUG,"deleting user hash value %d",iter->second);
if ((iter->second) && (user->registered == 7)) {
delete iter->second;
- }
- clientlist.erase(iter);
+ }
+ clientlist.erase(iter);
}
purge_empty_chans();
}
else
{
// local kill
+ log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]);
WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]);
WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]);
snprintf(killreason,MAXBUF,"Killed (%s (%s))",user->nick,parameters[1]);
WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name);
return;
}
-
+
char topic[MAXBUF];
strlcpy(topic,parameters[1],MAXBUF);
if (strlen(topic)>MAXTOPIC)
{
topic[MAXTOPIC-1] = '\0';
}
-
+
+ if (!strcasecmp(user->server,ServerName))
+ {
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnLocalTopicChange(user,Ptr,topic));
+ if (MOD_RESULT)
+ return;
+ }
+
strlcpy(Ptr->topic,topic,MAXBUF);
strlcpy(Ptr->setby,user->nick,NICKMAX);
Ptr->topicset = TIME;
void handle_info(char **parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"371 %s :The Inspire IRCd Project Has been brought to you by the following people..",user->nick);
- WriteServ(user->fd,"371 %s :Craig Edwards, Craig McLure, and Others..",user->nick);
- WriteServ(user->fd,"371 %s :Will finish this later when i can be arsed :p",user->nick);
+ WriteServ(user->fd,"371 %s :. o O (The Inspire Internet Relay Chat Server) O o .",user->nick);
+ WriteServ(user->fd,"371 %s : ",user->nick);
+ WriteServ(user->fd,"371 %s :Core developers: Craig Edwards (Brain)",user->nick);
+ WriteServ(user->fd,"371 %s : Craig McLure",user->nick);
+ WriteServ(user->fd,"371 %s : ",user->nick);
+ WriteServ(user->fd,"371 %s :Contributors: typobox43",user->nick);
+ WriteServ(user->fd,"371 %s : w00t",user->nick);
+ WriteServ(user->fd,"371 %s : Om",user->nick);
+ WriteServ(user->fd,"371 %s : Jazza",user->nick);
+ WriteServ(user->fd,"371 %s : ",user->nick);
+ WriteServ(user->fd,"371 %s :Testers: CC",user->nick);
+ WriteServ(user->fd,"371 %s : Piggles",user->nick);
+ WriteServ(user->fd,"371 %s : Foamy",user->nick);
+ WriteServ(user->fd,"371 %s : Hart",user->nick);
+ WriteServ(user->fd,"371 %s : RageD",user->nick);
+ WriteServ(user->fd,"371 %s : [ed]",user->nick);
+ WriteServ(user->fd,"371 %s : Azhrarn",user->nick);
+ WriteServ(user->fd,"371 %s : nenolod",user->nick);
+ WriteServ(user->fd,"371 %s : luigiman",user->nick);
+ WriteServ(user->fd,"371 %s : Chu",user->nick);
+ WriteServ(user->fd,"371 %s : aquanight",user->nick);
+ WriteServ(user->fd,"371 %s : xptek",user->nick);
+ WriteServ(user->fd,"371 %s : Grantlinks",user->nick);
+ WriteServ(user->fd,"371 %s : Rob",user->nick);
+ WriteServ(user->fd,"371 %s : angelic",user->nick);
+ WriteServ(user->fd,"371 %s : Jason",user->nick);
+ WriteServ(user->fd,"371 %s : ",user->nick);
+ WriteServ(user->fd,"371 %s :Thanks to irc-junkie and searchirc",user->nick);
+ WriteServ(user->fd,"371 %s :for the nice comments and the help",user->nick);
+ WriteServ(user->fd,"371 %s :you gave us in attracting users to",user->nick);
+ WriteServ(user->fd,"371 %s :this software.",user->nick);
+ WriteServ(user->fd,"371 %s : ",user->nick);
+ WriteServ(user->fd,"371 %s :Best experienced with: An IRC client.",user->nick);
FOREACH_MOD OnInfo(user);
WriteServ(user->fd,"374 %s :End of /INFO list",user->nick);
}
WriteServ(user->fd,"461 %s USER :Not enough parameters",user->nick);
}
else {
- WriteServ(user->fd,"NOTICE Auth :No ident response, ident prefixed with ~");
strcpy(user->ident,"~"); /* we arent checking ident... but these days why bother anyway? */
strlcat(user->ident,parameters[0],IDENTMAX);
strlcpy(user->fullname,parameters[3],128);
if (user->registered == 3)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
+ FOREACH_MOD OnUserRegister(user);
ConnectUser(user);
}
}
}
+ FOREACH_MOD OnStats(*parameters[0]);
+
if (!strcasecmp(parameters[0],"c"))
{
for (int i = 0; i < ConfValueEnum("link",&config_f); i++)
if (!fail2)
{
WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick);
- WriteOpers("*** WARNING! qFailed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
+ WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.",user->nick,user->ident,user->host);
}
else
if (user->registered == 3)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
+ FOREACH_MOD OnUserRegister(user);
ConnectUser(user);
}
if (user->registered == 7)
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_gline(atoi(duration),who,reason,mask);
+ add_gline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
gline_set_creation_time(mask,atoi(create_time));
char* who = strtok(NULL," ");
if (mask)
{
- if (del_gline(mask))
+ if (del_gline((const char*)mask))
{
if (who)
{
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_qline(atoi(duration),who,reason,mask);
+ add_qline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
qline_set_creation_time(mask,atoi(create_time));
char* who = strtok(NULL," ");
if (mask)
{
- if (del_qline(mask))
+ if (del_qline((const char*)mask))
{
if (who)
{
char* create_time = strtok(NULL," ");
char* duration = strtok(NULL," :");
char* reason = strtok(NULL,"\r\n");
- add_zline(atoi(duration),who,reason,mask);
+ add_zline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask);
// we must update the creation time on this gline
// now that we've added it, or it wont expire at the right time.
zline_set_creation_time(mask,atoi(create_time));
char* who = strtok(NULL," ");
if (mask)
{
- if (del_zline(mask))
+ if (del_zline((const char*)mask))
{
if (who)
{
void process_restricted_commands(char token,char* params,serverrec* source,serverrec* reply, char* tcp_host,char* ipaddr,int port)
{
char buffer[MAXBUF];
+ int MOD_RESULT = 0;
switch(token)
{
break;
// anything else
default:
- WriteOpers("WARNING! Unknown datagram type '%c'",token);
+ MOD_RESULT = 0;
+ string_list s;
+ char* data = strtok(params," ");
+ while (data)
+ {
+ if (*data == ':')
+ {
+ // the last item is a special case
+ data++;
+ char datalast[MAXBUF];
+ strlcpy(datalast,data,MAXBUF);
+ data = strtok(NULL," ");
+ while (data)
+ {
+ strlcpy(datalast," ",MAXBUF);
+ strlcpy(datalast,data,MAXBUF);
+ data = strtok(NULL," ");
+ }
+ s.push_back(data);
+ break;
+ }
+ s.push_back(data);
+ data = strtok(NULL," ");
+ }
+ FOREACH_RESULT(OnMeshToken(token,s,source,reply,tcp_host,ipaddr,port));
+ if (!MOD_RESULT)
+ WriteOpers("WARNING! Unknown datagram type '%c'",token);
break;
}
}
{
token = '*';
}
+ if (!strcmp(command,"PING"))
+ {
+ token = '*';
+ }
if (!strcmp(command,"NOTICE"))
{
snprintf(udp_msg,MAXBUF,"V %s %s",source,data);
char Link_Pass[1024];
char Link_SendPass[1024];
int LinkPort = 0;
+
+ log(DEBUG,"U-token linked server detected.");
// search for a corresponding <link> block in the config files
for (int i = 0; i < ConfValueEnum("link",&config_f); i++)
}
}
-long duration(char* str)
+long duration(const char* str)
{
char n_field[MAXBUF];
long total = 0;
- char* str_end = str + strlen(str);
+ const char* str_end = str + strlen(str);
n_field[0] = 0;
- for (char* i = str; i < str_end; i++)
+ for (char* i = (char*)str; i < str_end; i++)
{
// if we have digits, build up a string for the value in n_field,
// up to 10 digits in size.