added joinflood scanner
[NeonServV5.git] / src / event_neonspam_chanmsg.c
index bb473443716763fa74bfbbd0f331b018158427be..f55635a0e08b5c8608db34234db265345642a286 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
  */
 
-#define SPAMSERV_CHECK_IGNORE 0
-#define SPAMSERV_CHECK_WARN   1
-#define SPAMSERV_CHECK_PUNISH 2
-
-#define SPAMSERV_MSG_SPAM       "Spamming"
-#define SPAMSERV_MSG_FLOOD      "Flooding the channel/network"
-#define SPAMSERV_MSG_ADV        "Advertising"
-#define SPAMSERV_MSG_JOINFLOOD  "Join flooding the channel"
-#define SPAMSERV_MSG_WARNING    "%s is against the network rules"
-
 static int neonspam_spamscan(struct NeonSpamSettings *settings, struct ChanUser *chanuser, char *message);
 static int neonspam_floodscan(struct NeonSpamSettings *settings, struct ChanUser *chanuser);
 
@@ -85,13 +75,13 @@ static void neonspam_event_chanmsg(struct UserNode *user, struct ChanNode *chan,
             case SPAMSERV_CHECK_WARN:
                 if(action == SPAMSERV_CHECK_IGNORE) {
                     action = result;
-                    sprintf(reason, SPAMSERV_MSG_WARNING, SPAMSERV_MSG_SPAM);
+                    sprintf(reason, SPAMSERV_MSG_WARNING, SPAMSERV_MSG_FLOOD);
                 }
                 break;
             case SPAMSERV_CHECK_PUNISH:
                 if(action != SPAMSERV_CHECK_PUNISH) {
                     action = result;
-                    sprintf(reason, SPAMSERV_MSG_WARNING, SPAMSERV_MSG_SPAM);
+                    sprintf(reason, SPAMSERV_MSG_WARNING, SPAMSERV_MSG_FLOOD);
                     reaction = "channel_floodreaction";
                 }
                 break;
@@ -142,6 +132,11 @@ static void neonspam_event_chanmsg_punish(struct ClientSocket *client, struct Ch
         printf_mysql_query("SELECT `%s` FROM `channels` WHERE `channel_id` = '%d'", reaction, chanuser->chan->channel_id);
         res = mysql_use();
         row = mysql_fetch_row(res);
+        if(!row[0]) {
+            printf_mysql_query("SELECT `%s` FROM `channels` WHERE `channel_name` = 'defaults'", reaction);
+            res = mysql_use();
+            row = mysql_fetch_row(res);
+        }
         int duration = 0;
         char banmaskBuf[NICKLEN+USERLEN+HOSTLEN+3];
         char *banmask = NULL;