summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-22 13:55:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-22 13:55:16 +0000
commit443016b4f2fccca39755c1d7e33edfe1ec61718f (patch)
tree1c10cb6363f51f473ba367c4039ac77bd3fad956
parentc605a319a7502bd930cdc9649115877b51fbcbd8 (diff)
Added tons of services/uline stuff. DO NOT USE YET! services data isnt replicated across the network!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@688 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--docs/inspircd.conf.example16
-rw-r--r--include/commands.h3
-rw-r--r--src/InspIRCd.layout34
-rw-r--r--src/commands.cpp70
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/inspircd_io.cpp6
-rw-r--r--src/mode.cpp24
-rw-r--r--src/modules.cpp2
8 files changed, 121 insertions, 36 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index c9756c858..9ecf02f5f 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -203,6 +203,14 @@
# recvpass - Password to receive to accept an inbound connection #
# from this server. #
# #
+# to u:line a server (give it extra privilages required for running #
+# services, Q, etc) you must include the <uline server> tag as shown #
+# in the example below. You can have as many of these as you like. #
+# #
+# WARNING: Unlike other ircds, u:lining a server allows ALL users on #
+# that server to operoverride modes. This should only be used for #
+# services and protected oper servers! #
+# #
<link name="hub.penguin.org"
ipaddr="12.34.56.78"
@@ -210,6 +218,14 @@
sendpass="outgoing!password"
recvpass="incoming!password">
+<link name="services.antarctic.com"
+ ipaddr="98.76.54.32"
+ port="7000"
+ sendpass="penguins"
+ recvpass="polarbears">
+
+<uline server="services.antarctic.com">
+
#-#-#-#-#-#-#-#-#-#- MISCELLANEOUS CONFIGURATION -#-#-#-#-#-#-#-#-#-#
diff --git a/include/commands.h b/include/commands.h
index f092423ab..a9046d4d1 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -88,5 +88,8 @@ void handle_i(char token,char* params,serverrec* source,serverrec* reply, char*
void handle_P(char token,char* params,serverrec* source,serverrec* reply, char* tcp_host);
void handle_V(char token,char* params,serverrec* source,serverrec* reply, char* tcp_host);
+/** Functions for u:lined servers
+ */
+bool is_uline(const char* server);
#endif
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 487179601..227c6af8f 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -13,9 +13,9 @@ LeftChar=1
[Editor_1]
Open=1
Top=0
-CursorCol=2
-CursorRow=845
-TopLine=833
+CursorCol=99
+CursorRow=1570
+TopLine=1552
LeftChar=1
[Editor_2]
@@ -204,8 +204,8 @@ LeftChar=1
[Editor_25]
Open=1
Top=0
-CursorCol=6
-CursorRow=10
+CursorCol=4
+CursorRow=39
TopLine=1
LeftChar=1
[Editor_26]
@@ -302,8 +302,8 @@ LeftChar=1
[Editor_39]
Open=1
Top=0
-CursorCol=11
-CursorRow=245
+CursorCol=16
+CursorRow=263
TopLine=220
LeftChar=1
[Editor_40]
@@ -323,21 +323,21 @@ LeftChar=1
[Editor_42]
Open=1
Top=0
-CursorCol=21
-CursorRow=36
-TopLine=16
+CursorCol=4
+CursorRow=1729
+TopLine=1685
LeftChar=1
[Editor_43]
Open=1
Top=1
-CursorCol=22
-CursorRow=2152
-TopLine=2109
+CursorCol=3
+CursorRow=2166
+TopLine=2146
LeftChar=1
[Editor_44]
-Open=0
+Open=1
Top=0
-CursorCol=89
-CursorRow=89
-TopLine=32
+CursorCol=4
+CursorRow=92
+TopLine=40
LeftChar=1
diff --git a/src/commands.cpp b/src/commands.cpp
index 41906537e..0e8d5e872 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -1256,6 +1256,22 @@ void handle_map(char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"007 %s :End of /MAP",user->nick);
}
+bool is_uline(const char* server)
+{
+ char ServName[MAXBUF];
+ int i,j;
+
+ for (int i = 0; i < ConfValueEnum("uline",&config_f); i++)
+ {
+ ConfValue("uline","server",i,ServName,&config_f);
+ if (!strcasecmp(server,ServName))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
void handle_oper(char **parameters, int pcnt, userrec *user)
{
@@ -1277,6 +1293,9 @@ void handle_oper(char **parameters, int pcnt, userrec *user)
WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType);
WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType);
WriteServ(user->fd,"MODE %s :+o",user->nick);
+ char global[MAXBUF];
+ snprintf(global,MAXBUF,"M %s +o",user->nick);
+ NetSendToAll(global);
for (j =0; j < ConfValueEnum("type",&config_f); j++)
{
ConfValue("type","name",j,TypeName,&config_f);
@@ -1471,6 +1490,7 @@ void handle_t(char token,char* params,serverrec* source,serverrec* reply, char*
WriteChannelLocal(c,u,"TOPIC %s :%s",c->name,topic);
strncpy(c->topic,topic,MAXTOPIC);
strncpy(c->setby,u->nick,NICKMAX);
+ c->topicset = time(NULL);
}
}
@@ -1642,6 +1662,13 @@ void handle_n(char token,char* params,serverrec* source,serverrec* reply, char*
if (user)
{
WriteCommon(user,"NICK %s",newnick);
+ if (is_uline(tcp_host))
+ {
+ // broadcast this because its a services thingy
+ char buffer[MAXBUF];
+ snprintf(buffer,MAXBUF,"n %s %s",user->nick,newnick);
+ NetSendToAll(buffer);
+ }
user = ReHashNick(user->nick, newnick);
if (!user) return;
if (!user->nick) return;
@@ -1664,6 +1691,14 @@ void handle_k(char token,char* params,serverrec* source,serverrec* reply, char*
if ((s) && (d) && (c))
{
kick_channel(s,d,c,reason);
+ return;
+ }
+ d = Find(channel);
+ c = FindChan(dest);
+ if ((s) && (d) && (c))
+ {
+ kick_channel(s,d,c,reason);
+ return;
}
}
@@ -2136,18 +2171,47 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv)
strcpy(source,src);
strcpy(command,comd);
udp_msg = old;
+
+ // unused numeric:
+ // :services-dev.chatspike.net 433 Craig Craig :Nickname is registered to someone else
+ if (!strcmp(command,"433"))
+ {
+ token = '*';
+ }
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,"QUIT"))
+ {
+ if (!strcmp(data,":"))
+ {
+ strcpy(data,":No reason");
+ }
+ snprintf(udp_msg,MAXBUF,"Q %s %s",source,data);
+ log(DEBUG,"Rewrote QUIT from services to: '%s'",udp_msg);
+ token = udp_msg[0];
+ }
+ if (!strcmp(command,"SQUIT"))
+ {
+ snprintf(udp_msg,MAXBUF,"& %s",source);
+ log(DEBUG,"Rewrote SQUIT 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];
}
+ if (!strcmp(command,"SVS2MODE"))
+ {
+ 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"))
@@ -2156,6 +2220,12 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv)
log(DEBUG,"Rewrote MODE from services to: '%s'",udp_msg);
token = udp_msg[0];
}
+ if (!strcmp(command,"KICK"))
+ {
+ snprintf(udp_msg,MAXBUF,"k %s %s",source,data);
+ log(DEBUG,"Rewrote KICK from services to: '%s'",udp_msg);
+ token = udp_msg[0];
+ }
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c31464733..f55a6f1b6 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1567,7 +1567,7 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason)
WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name);
return;
}
- if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr)))
+ if (((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) && (!is_uline(src->server)))
{
if (cstatus(src,Ptr) == STATUS_HOP)
{
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index b9e7fa40b..b267e98ca 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -331,7 +331,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
const char* buf = config->str().c_str();
long bptr = 0;
long len = strlen(buf);
- log(DEBUG,"Data length: %d",len);
ptr = 0;
in_token = 0;
@@ -378,7 +377,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
{
/* value not found in tag */
strcpy(result,"");
- log(DEBUG,"ReadConf: value '%s' was not found in tag",var);
return 0;
}
else
@@ -390,7 +388,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
{
/* missing quote */
strcpy(result,"");
- log(DEBUG,"ReadConf: possible missing quote!");
return 0;
}
key++;
@@ -404,7 +401,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
}
}
strcpy(result,key);
- log(DEBUG,"ReadConf: Got value '%s'",result);
return 1;
}
}
@@ -412,7 +408,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
}
if (!strcmp(c_tag,tag))
{
- log(DEBUG,"Tag name correct but index value incorrect");
/* correct tag, but wrong index */
idx++;
}
@@ -430,7 +425,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
}
}
}
- log(DEBUG,"ReadConf: neither value '%s' or tag '%s' were found at all!",var,tag);
strcpy(result,""); // value or its tag not found at all
return 0;
}
diff --git a/src/mode.cpp b/src/mode.cpp
index 3458cab28..38756ffcf 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -32,6 +32,7 @@
#include "dynamic.h"
#include "wildcard.h"
#include "message.h"
+#include "commands.h"
using namespace std;
@@ -64,7 +65,7 @@ int give_ops(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** give_ops was given an invalid parameter");
return 0;
}
- if (status < STATUS_OP)
+ if ((status < STATUS_OP) && (!is_uline(user->server)))
{
log(DEBUG,"%s cant give ops to %s because they nave status %d and needs %d",user->nick,dest,status,STATUS_OP);
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
@@ -119,7 +120,7 @@ int give_hops(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** give_hops was given an invalid parameter");
return 0;
}
- if (status != STATUS_OP)
+ if ((status < STATUS_OP) && (!is_uline(user->server)))
{
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
return 0;
@@ -169,7 +170,7 @@ int give_voice(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** give_voice was given an invalid parameter");
return 0;
}
- if (status < STATUS_HOP)
+ if ((status < STATUS_HOP) && (!is_uline(user->server)))
{
WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, chan->name);
return 0;
@@ -219,7 +220,7 @@ int take_ops(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** take_ops was given an invalid parameter");
return 0;
}
- if (status < STATUS_OP)
+ if ((status < STATUS_OP) && (!is_uline(user->server)))
{
log(DEBUG,"%s cant give ops to %s because they have status %d and needs %d",user->nick,dest,status,STATUS_OP);
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
@@ -273,7 +274,7 @@ int take_hops(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** take_hops was given an invalid parameter");
return 0;
}
- if (status != STATUS_OP)
+ if ((status < STATUS_OP) && (!is_uline(user->server)))
{
WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
return 0;
@@ -323,7 +324,7 @@ int take_voice(userrec *user,char *dest,chanrec *chan,int status)
log(DEFAULT,"*** BUG *** take_voice was given an invalid parameter");
return 0;
}
- if (status < STATUS_HOP)
+ if ((status < STATUS_HOP) && (!is_uline(user->server)))
{
WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, chan->name);
return 0;
@@ -1723,12 +1724,15 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
Ptr = FindChan(parameters[0]);
if (Ptr)
{
- if ((cstatus(user,Ptr) < STATUS_HOP) && (Ptr))
+ log(DEBUG,"merge_mode2: found channel %s",Ptr->name);
+ if (Ptr)
{
- return;
+ if ((cstatus(user,Ptr) < STATUS_HOP) && (!is_uline(user->server)))
+ {
+ return;
+ }
+ process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true);
}
-
- process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true);
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index ca3c2e423..59833b6bd 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -355,14 +355,12 @@ ConfigReader::ConfigReader(std::string filename)
std::string ConfigReader::ReadValue(std::string tag, std::string name, int index)
{
- log(DEBUG,"ConfigReader::ReadValue '%s' '%s' %d",tag.c_str(),name.c_str(),index);
char val[MAXBUF];
char t[MAXBUF];
char n[MAXBUF];
strncpy(t,tag.c_str(),MAXBUF);
strncpy(n,name.c_str(),MAXBUF);
ReadConf(cache,t,n,index,val);
- log(DEBUG,"ConfigReader::ReadValue read '%s'",val);
return std::string(val);
}