*/
#include "inspircd.h"
-#include "configreader.h"
-#include "users.h"
-#include "modules.h"
#include "wildcard.h"
#include "commands/cmd_privmsg.h"
-
-
extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_privmsg(Instance);
{
userrec *dest;
chanrec *chan;
-
CUList except_list;
user->idle_lastmsg = ServerInstance->Time();
{
if (IS_LOCAL(user))
{
- if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
+ if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
return CMD_FAILURE;
}
- if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
+ if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
return CMD_FAILURE;
}
parameters[1] = temp.c_str();
+ /* Check again, a module may have zapped the input string */
if (temp.empty())
{
- user->WriteServ("412 %s No text to send", user->nick);
+ user->WriteServ("412 %s :No text to send", user->nick);
return CMD_FAILURE;
}
return CMD_SUCCESS;
}
- dest = ServerInstance->FindNick(parameters[0]);
+ if (IS_LOCAL(user))
+ dest = ServerInstance->FindNickOnly(parameters[0]);
+ else
+ dest = ServerInstance->FindNick(parameters[0]);
+
if (dest)
{
+ if (!*parameters[1])
+ {
+ user->WriteServ("412 %s :No text to send", user->nick);
+ return CMD_FAILURE;
+ }
+
if (IS_AWAY(dest))
{
/* auto respond with aweh msg */