Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / m_privmsg.c
index fd4162389eb0c348e926b458e27bbd7b9289314b..09b5a4477401b21b64ee2236d6c4f532b0c8cb2b 100644 (file)
@@ -79,6 +79,8 @@
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
+#include "config.h"
+
 #if 0
 /*
  * No need to include handlers.h here the signatures must match
@@ -90,6 +92,7 @@
 #include "client.h"
 #include "ircd.h"
 #include "ircd_chattr.h"
+#include "ircd_features.h"
 #include "ircd_relay.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
@@ -114,13 +117,12 @@ int m_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   assert(0 != cptr);
   assert(cptr == sptr);
-  assert(0 != sptr->user);
+  assert(0 != cli_user(sptr));
 
-  sptr->flags &= ~FLAGS_TS8;
+  cli_flags(sptr) &= ~FLAGS_TS8;
 
-#ifdef IDLE_FROM_MSG
-  sptr->user->last = CurrentTime;
-#endif
+  if (feature_bool(FEAT_IDLE_FROM_MSG))
+    cli_user(sptr)->last = CurrentTime;
 
   if (parc < 2 || EmptyString(parv[1]))
     return send_reply(sptr, ERR_NORECIPIENT, MSG_PRIVATE);
@@ -158,7 +160,7 @@ int ms_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char* name;
   char* server;
 
-  sptr->flags &= ~FLAGS_TS8;
+  cli_flags(sptr) &= ~FLAGS_TS8;
 
   if (parc < 3) {
     /*
@@ -205,13 +207,12 @@ int mo_privmsg(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char*           vector[MAXTARGETS];
   assert(0 != cptr);
   assert(cptr == sptr);
-  assert(0 != sptr->user);
+  assert(0 != cli_user(sptr));
 
-  sptr->flags &= ~FLAGS_TS8;
+  cli_flags(sptr) &= ~FLAGS_TS8;
 
-#ifdef IDLE_FROM_MSG
-  sptr->user->last = CurrentTime;
-#endif
+  if (feature_bool(FEAT_IDLE_FROM_MSG))
+    cli_user(sptr)->last = CurrentTime;
 
   if (parc < 2 || EmptyString(parv[1]))
     return send_reply(sptr, ERR_NORECIPIENT, MSG_PRIVATE);
@@ -324,7 +325,8 @@ static int m_message(struct Client *cptr, struct Client *sptr,
         acptr = 0;
       if (acptr)
       {
-        if (MyUser(sptr) && check_target_limit(sptr, acptr, acptr->name, 0))
+        if (MyUser(sptr) && !IsChannelService(acptr) && 
+           check_target_limit(sptr, acptr, acptr->name, 0))
           continue;
         if (!is_silenced(sptr, acptr))
         {