prevent channel owners from deleting their selves with cmd_delme
authorpk910 <philipp@zoelle1.de>
Tue, 8 Nov 2011 15:06:49 +0000 (16:06 +0100)
committerpk910 <philipp@zoelle1.de>
Tue, 8 Nov 2011 15:09:34 +0000 (16:09 +0100)
src/bot_NeonServ.c
src/cmd_neonserv_delme.c

index 4a5de6955fdea3251bc3cfa4180d787b24d711f0..a920e8a085129943945582982c90db447f495610 100644 (file)
@@ -89,6 +89,7 @@ static const struct default_language_entry msgtab[] = {
     {"NS_SUSPEND_NOT", "$b%s$b is not suspended." }, /* {ARGS: "TestUser"} */
     {"NS_SUSPEND_DONE", "$b%s$b's access to $b%s$b has been suspended." }, /* {ARGS: "TestUser", "#TestChan"} */
     {"NS_SUSPEND_RESTORED", "$b%s$b's access to $b%s$b has been restored." }, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_DELME_OWNER", "You cannot delete your owner access in $b%s$b."}, /* {ARGS: "#TestChan"} */
     {"NS_DELME_KEY", "To really remove yourself, you must use 'deleteme %s'."}, /* {ARGS: "abc123"} */
     {"NS_DELME_DONE", "Your $b%d$b access has been deleted from $b%s$b."}, /* {ARGS: 123, "#TestChan"} */
     {"NS_MYACCESS_SELF_ONLY", "You may only see the list of infolines for yourself (by using $bmyaccess$b with no arguments)."},
index e5edeeee26f74b6263438f297e6c85838834c434..6f56de82d9cfacb90ba479fd6677eeb9e28bb66a 100644 (file)
@@ -33,6 +33,10 @@ CMD_BIND(neonserv_cmd_delme) {
         printf_mysql_query("SELECT `chanuser_access`, `chanuser_id` FROM `chanusers` WHERE `chanuser_cid` = '%d' AND `chanuser_uid` = '%d'", chan->channel_id, userid);
         res = mysql_use();
         if ((row = mysql_fetch_row(res)) != NULL) {
+            if(atoi(row[0]) == 500) {
+                reply(getTextBot(), user, "NS_DELME_OWNER", chan->name);
+                return;
+            }
             //check key
             int seed = 0;
             char *tmp;