summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-30 22:49:46 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-30 22:49:46 +0000
commitbe1286835c016ed2602db8e42f7ca0b367767242 (patch)
tree3b0469eac6930b883f13f64051718058e72e807a
parent6cc66282a534c7630dca0e7d22e6f50f29ead3f9 (diff)
Add support for nick@server requested by many. We are not likely to backport this, cant actually find reference to it in rfc1459
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8424 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/commands/cmd_notice.cpp23
-rw-r--r--src/commands/cmd_privmsg.cpp23
2 files changed, 42 insertions, 4 deletions
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 937feaf93..ca693d62b 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -120,10 +120,29 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
return CMD_SUCCESS;
}
+ const char* destnick = parameters[0];
+
if (IS_LOCAL(user))
- dest = ServerInstance->FindNickOnly(parameters[0]);
+ {
+ const char* targetserver = strchr(destnick, '@');
+
+ if (targetserver)
+ {
+ char nickonly[NICKMAX+1];
+ strlcpy(nickonly, destnick, targetserver - destnick + 1);
+ dest = ServerInstance->FindNickOnly(nickonly);
+ if (dest && strcasecmp(dest->server, targetserver + 1))
+ {
+ /* Incorrect server for user */
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
+ }
+ }
+ else
+ dest = ServerInstance->FindNickOnly(destnick);
+ }
else
- dest = ServerInstance->FindNick(parameters[0]);
+ dest = ServerInstance->FindNick(destnick);
if (dest)
{
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 474eb4b3d..5be9d4cff 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -121,10 +121,29 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
return CMD_SUCCESS;
}
+ const char* destnick = parameters[0];
+
if (IS_LOCAL(user))
- dest = ServerInstance->FindNickOnly(parameters[0]);
+ {
+ const char* targetserver = strchr(destnick, '@');
+
+ if (targetserver)
+ {
+ char nickonly[NICKMAX+1];
+ strlcpy(nickonly, destnick, targetserver - destnick + 1);
+ dest = ServerInstance->FindNickOnly(nickonly);
+ if (dest && strcasecmp(dest->server, targetserver + 1))
+ {
+ /* Incorrect server for user */
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
+ }
+ }
+ else
+ dest = ServerInstance->FindNickOnly(destnick);
+ }
else
- dest = ServerInstance->FindNick(parameters[0]);
+ dest = ServerInstance->FindNick(destnick);
if (dest)
{