*** VERSION 5.2.0 ***
[NeonServV5.git] / src / event_neonserv_mode.c
index 4c766739abc85acef208b1e6bd7bfaf95ff1f8ed..583f2a26df8051c35dc18cc93b6a94b397514866 100644 (file)
@@ -1,4 +1,4 @@
-/* event_neonserv_mode.c - NeonServ v5.0
+/* event_neonserv_mode.c - NeonServ v5.2
  * Copyright (C) 2011  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -84,7 +84,7 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
     modeBuf = initModeBuffer(client, chan);
     printf_mysql_query("SELECT `channel_canop`, `channel_canvoice`, `channel_canban`, `channel_enfmodes`, `channel_modes` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
     row = mysql_fetch_row(mysql_use());
-    if(row[0] == NULL || row[1] == NULL || row[2] == NULL || row[3] == NULL) {
+    if(row[0] == NULL || row[1] == NULL || row[2] == NULL || row[3] == NULL || row[4] == NULL) {
         printf_mysql_query("SELECT `channel_canop`, `channel_canvoice`, `channel_canban`, `channel_enfmodes`, `channel_modes` FROM `channels` WHERE `channel_name` = 'defaults'");
         defaults = mysql_fetch_row(mysql_use());
     }
@@ -115,7 +115,8 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
                     break;
                 }
                 carg = argv[arg++];
-                if(modes[i] == 'o') {
+                cuser = searchUserByNick(carg);
+                if(modes[i] == 'o' && !(add && isBot(cuser))) {
                     if(uaccess < db_canop) {
                         reply(textclient, user, "NS_MODE_ENFOPS", chan->name);
                         db_canop = -1;
@@ -125,7 +126,7 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
                             modeBufferSet(modeBuf, !add, modes[i], carg);
                         break;
                     }
-                } else {
+                } else if(modes[i] == 'v') {
                     if(uaccess < db_canvoice) {
                         reply(textclient, user, "NS_MODE_ENFVOICE", chan->name);
                         db_canvoice = -1;
@@ -136,7 +137,6 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
                         break;
                     }
                 }
-                cuser = searchUserByNick(carg);
                 if(!cuser) {
                     break; //internal Bot error - this should never happen
                 }