X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_privmsg.cpp;h=71e121a522bd6f2164b484934e3a131818096b4d;hb=0306a4231e85baeb5029ef2b9b36d0b5d241d147;hp=896aa4c3e11dd712465c48a029dfee0f9234b596;hpb=ee3a514fe2e12ec326b4505e6c5bec19f074a899;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index 896aa4c3e..71e121a52 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -2,12 +2,9 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits * - * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see * the file COPYING for details. * @@ -21,9 +18,7 @@ #include "wildcard.h" #include "commands/cmd_privmsg.h" - - -extern "C" command_t* init_command(InspIRCd* Instance) +extern "C" DllExport command_t* init_command(InspIRCd* Instance) { return new cmd_privmsg(Instance); } @@ -40,19 +35,19 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) return CMD_SUCCESS; - if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server)))) + if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server))) { int MOD_RESULT = 0; std::string temp = parameters[1]; FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,(void*)parameters[0],TYPE_SERVER,temp,0,except_list)); if (MOD_RESULT) return CMD_FAILURE; - parameters[1] = (char*)temp.c_str(); + parameters[1] = temp.c_str(); // notice to server mask const char* servermask = parameters[0] + 1; if (match(ServerInstance->Config->ServerName,servermask)) { - ServerInstance->ServerPrivmsgAll("%s",parameters[1]); + user->SendAll("PRIVMSG", "%s", parameters[1]); } FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list)); return CMD_SUCCESS; @@ -67,7 +62,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) { chan = ServerInstance->FindChan(parameters[0]); - except_list[user] = user; + except_list[user] = user->nick; if (chan) { @@ -93,13 +88,28 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) } parameters[1] = temp.c_str(); - if (temp == "") + if (temp.empty()) { user->WriteServ("412 %s No text to send", user->nick); return CMD_FAILURE; } - chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, parameters[1]); + if (status) + { + if (ServerInstance->Config->UndernetMsgPrefix) + { + chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%c %s", status, chan->name, status, parameters[1]); + } + else + { + chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name, parameters[1]); + } + } + else + { + chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, parameters[1]); + } + FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1],status,except_list)); } else @@ -114,7 +124,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) dest = ServerInstance->FindNick(parameters[0]); if (dest) { - if ((IS_LOCAL(user)) && (*dest->awaymsg)) + if (IS_AWAY(dest)) { /* auto respond with aweh msg */ user->WriteServ("301 %s %s :%s",user->nick,dest->nick,dest->awaymsg);