diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-21 21:54:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-21 21:54:19 +0000 |
commit | c605a319a7502bd930cdc9649115877b51fbcbd8 (patch) | |
tree | 117fdbdcfaec7a5450113836666ae8875ef4c3c3 | |
parent | 6c9a863c019952343ea558e16d3157f8ee575eab (diff) |
Various services compatibility stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@687 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/connection.h | 1 | ||||
-rw-r--r-- | src/InspIRCd.layout | 32 | ||||
-rw-r--r-- | src/commands.cpp | 53 | ||||
-rw-r--r-- | src/inspircd.cpp | 2 |
4 files changed, 64 insertions, 24 deletions
diff --git a/include/connection.h b/include/connection.h index 0d9bdb683..12d6dc754 100644 --- a/include/connection.h +++ b/include/connection.h @@ -24,6 +24,7 @@ #define STATE_SYNC 2 #define STATE_NOAUTH_INBOUND 3 #define STATE_NOAUTH_OUTBOUND 4 +#define STATE_SERVICES 5 /** Each connection has one or more of these * each represents ONE outbound connection to another ircd diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 60c14f03f..487179601 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=44 -CursorRow=2785 -TopLine=2772 +CursorCol=2 +CursorRow=845 +TopLine=833 LeftChar=1 [Editor_2] @@ -107,11 +107,11 @@ TopLine=1 LeftChar=1 [Editor_13] -Open=0 +Open=1 Top=0 -CursorCol=51 -CursorRow=125 -TopLine=34 +CursorCol=37 +CursorRow=61 +TopLine=7 LeftChar=1 [Editor_14] @@ -197,9 +197,9 @@ LeftChar=1 [Editor_24] Open=1 Top=0 -CursorCol=1 -CursorRow=15 -TopLine=1 +CursorCol=2 +CursorRow=365 +TopLine=341 LeftChar=1 [Editor_25] Open=1 @@ -302,9 +302,9 @@ LeftChar=1 [Editor_39] Open=1 Top=0 -CursorCol=1 -CursorRow=37 -TopLine=103 +CursorCol=11 +CursorRow=245 +TopLine=220 LeftChar=1 [Editor_40] Open=0 @@ -330,9 +330,9 @@ LeftChar=1 [Editor_43] Open=1 Top=1 -CursorCol=23 -CursorRow=2096 -TopLine=2061 +CursorCol=22 +CursorRow=2152 +TopLine=2109 LeftChar=1 [Editor_44] Open=0 diff --git a/src/commands.cpp b/src/commands.cpp index 4c391aeb4..41906537e 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1506,9 +1506,12 @@ void handle_M(char token,char* params,serverrec* source,serverrec* reply, char* strncpy(target,parameter,MAXBUF); while (parameter) { + if (parameter[0] == ':') + parameter++; pars[index++] = parameter; parameter = strtok(NULL," "); } + log(DEBUG,"*** MODE: %s %s",pars[0],pars[1]); merge_mode(pars,index); if (FindChan(target)) { @@ -1516,7 +1519,7 @@ void handle_M(char token,char* params,serverrec* source,serverrec* reply, char* } if (Find(target)) { - WriteTo(NULL,Find(target),"MODE %s",original); + Write(Find(target)->fd,":%s MODE %s",ServerName,original); } } @@ -2112,13 +2115,48 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) { char response[10240]; char token = udp_msg[0]; + char* old = udp_msg; if (token == ':') // leading :servername or details - strip them off (services does this, sucky) { + char* src = udp_msg+1; while (udp_msg[0] != ' ') udp_msg++; + udp_msg[0] = 0; udp_msg++; - token = udp_msg[0]; + char* comd = udp_msg; + while (udp_msg[0] != ' ') + udp_msg++; + udp_msg[0] = 0; + udp_msg++; + char data[MAXBUF]; + char source[MAXBUF]; + char command[MAXBUF]; + strcpy(data,udp_msg); + strcpy(source,src); + strcpy(command,comd); + udp_msg = old; + if (!strcmp(command,"NOTICE")) + { + snprintf(udp_msg,MAXBUF,"V %s %s",source,data); + log(DEBUG,"Rewrote NOTICE from services to: '%s'",udp_msg); + token = udp_msg[0]; + } + if (!strcmp(command,"SVSMODE")) + { + snprintf(udp_msg,MAXBUF,"M %s",data); + log(DEBUG,"Rewrote SVSMODE from services to: '%s'",udp_msg); + token = udp_msg[0]; + } + // todo: this wont work without u:lines + // in give_ops etc allow nick on a u:lined serv to do just about anything + if (!strcmp(command,"MODE")) + { + snprintf(udp_msg,MAXBUF,"m %s %s",source,data); + log(DEBUG,"Rewrote MODE from services to: '%s'",udp_msg); + token = udp_msg[0]; + } + } @@ -2307,7 +2345,6 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) { char buffer[MAXBUF]; me[j]->connectors[k].SetDescription(serverdesc); - me[j]->connectors[k].SetState(STATE_CONNECTED); sprintf(buffer,"X 0"); serv->SendPacket(buffer,tcp_host); DoSync(me[j],tcp_host); @@ -2371,13 +2408,13 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) { if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),tcp_host)) { - char buffer[MAXBUF]; + char buffer[MAXBUF]; me[j]->connectors[k].SetDescription(serverdesc); me[j]->connectors[k].SetServerName(servername); - me[j]->connectors[k].SetState(STATE_CONNECTED); + me[j]->connectors[k].SetState(STATE_SERVICES); sprintf(buffer,"X 0"); - serv->SendPacket(buffer,tcp_host); - DoSync(me[j],tcp_host); + serv->SendPacket(buffer,servername); + DoSync(me[j],servername); NetSendMyRoutingTable(); return; } @@ -2418,7 +2455,7 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) log(DEBUG,"Servers are: '%s' '%s'",tcp_host,me[j]->connectors[x].GetServerName().c_str()); if (!strcasecmp(me[j]->connectors[x].GetServerName().c_str(),tcp_host)) { - if (me[j]->connectors[x].GetState() == STATE_CONNECTED) + if ((me[j]->connectors[x].GetState() == STATE_CONNECTED) || (me[j]->connectors[x].GetState() == STATE_SERVICES)) { // found a valid ircd_connector. process_restricted_commands(token,params,me[j],serv,tcp_host,me[j]->connectors[x].GetServerIP(),me[j]->connectors[x].GetServerPort()); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ac32b0e92..c31464733 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2785,6 +2785,7 @@ void process_buffer(const char* cmdbuf,userrec *user) void DoSync(serverrec* serv, char* tcp_host) { char data[MAXBUF]; + log(DEBUG,"Sending sync"); // send start of sync marker: Y <timestamp> // at this point the ircd receiving it starts broadcasting this netburst to all ircds // except the ones its receiving it from. @@ -2821,6 +2822,7 @@ void DoSync(serverrec* serv, char* tcp_host) } snprintf(data,MAXBUF,"F %d",time(NULL)); serv->SendPacket(data,tcp_host); + log(DEBUG,"Sent sync"); // ircd sends its serverlist after the end of sync here } |