summaryrefslogtreecommitdiff
path: root/src/commands.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-22 19:34:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-22 19:34:06 +0000
commit6129f2e4a0c3bd50c3f9ff62c7dfd0b27ecdcc7f (patch)
tree287bdc416487c8b226b42cc52272abaa69b297b3 /src/commands.cpp
parent8aeb34aa15bfc32e8894c652f09673c2fb27a32f (diff)
Added more services stuff
Added support for OnUserPreNick API command (used with qlines, etc) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@696 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands.cpp')
-rw-r--r--src/commands.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index f8a410dc8..3adf3fc33 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -1374,6 +1374,13 @@ void handle_nick(char **parameters, int pcnt, userrec *user)
if (user->registered == 7)
{
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnUserPreNick(user,parameters[0]));
+ if (MOD_RESULT) {
+ // if a module returns true, the nick change is silently forbidden.
+ return;
+ }
+
WriteCommon(user,"NICK %s",parameters[0]);
// Q token must go to ALL servers!!!
@@ -1664,6 +1671,14 @@ void handle_n(char token,char* params,serverrec* source,serverrec* reply, char*
WriteCommon(user,"NICK %s",newnick);
if (is_uline(tcp_host))
{
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnUserPreNick(user,newnick));
+ if (MOD_RESULT) {
+ // if a module returns true, the nick change couldnt be allowed
+ kill_link(user,"Nickname collision");
+ return;
+ }
+
// broadcast this because its a services thingy
char buffer[MAXBUF];
snprintf(buffer,MAXBUF,"n %s %s",user->nick,newnick);
@@ -2148,6 +2163,13 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve
void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv)
{
+ if ((!strncmp(udp_msg,"USER ",5)) || (!strncmp(udp_msg,"NICK ",5)))
+ {
+ // a user on a server port, just close their connection.
+ RemoveServer(tcp_host);
+ return;
+ }
+
char response[10240];
char token = udp_msg[0];
char* old = udp_msg;