made some information in cmd_info only visible for owners or supporters
authorpk910 <philipp@zoelle1.de>
Tue, 4 Oct 2011 18:29:30 +0000 (20:29 +0200)
committerpk910 <philipp@zoelle1.de>
Tue, 4 Oct 2011 18:29:30 +0000 (20:29 +0200)
src/cmd_neonserv_info.c

index ce9544c013aad014f37c2efbe62e664e591ed4dc..40277ce372ed962d82d9b40169009f2980eeb117 100644 (file)
@@ -45,9 +45,13 @@ CMD_BIND(neonserv_cmd_info) {
     res = mysql_use();
     char ownerstr[MAXLEN];
     int ownerpos = 0, usercount = 0;
+    int userisowner = 0;
     while((row2 = mysql_fetch_row(res))) {
-        if(!strcmp(row2[1], "500"))
+        if(!strcmp(row2[1], "500")) {
             ownerpos += sprintf(ownerstr + ownerpos, (ownerpos ? ", %s" : "%s"), row2[0]);
+            if((user->flags & USERFLAG_ISAUTHED) && !stricmp(row2[0], user->auth))
+                userisowner = 1;
+        }
         usercount++;
     }
     content[0] = get_language_string(user, "NS_INFO_OWNER");
@@ -71,7 +75,7 @@ CMD_BIND(neonserv_cmd_info) {
         content[1] = timeToStr(user, time(0) - atoi(row[4]), 2, ownerstr);
         table_add(table, content);
     }
-    if(row[5]) {
+    if(row[5] && isGodMode(user)) {
         content[0] = get_language_string(user, "NS_INFO_REGISTRAR");
         content[1] = row[5];
         table_add(table, content);
@@ -82,18 +86,20 @@ CMD_BIND(neonserv_cmd_info) {
         reply(getTextBot(), user, table_lines[i]);
     }
     table_free(table);
-    printf_mysql_query("SELECT `owner_history_time`, a.`user_user`, b.`user_user` FROM `owner_history` LEFT JOIN `users` a ON `owner_history_from_uid` = a.`user_id` LEFT JOIN `users` b ON `owner_history_to_uid` = b.`user_id` WHERE `owner_history_cid` = '%d'", chan->channel_id);
-    res = mysql_use();
-    if(mysql_num_rows(res)) {
-        reply(getTextBot(), user, "NS_INFO_OWNERLOG", chan->name);
-        time_t rawtime;
-        struct tm *timeinfo;
-        char timeBuf[80];
-        while((row = mysql_fetch_row(res))) {
-            rawtime = (time_t) atol(row[0]);
-            timeinfo = localtime(&rawtime);
-            strftime(timeBuf, 80, "%c", timeinfo);
-            reply(getTextBot(), user, "NS_INFO_OWNERCHANGE", row[1], row[2], timeBuf);
+    if(userisowner || isGodMode(user)) {
+        printf_mysql_query("SELECT `owner_history_time`, a.`user_user`, b.`user_user` FROM `owner_history` LEFT JOIN `users` a ON `owner_history_from_uid` = a.`user_id` LEFT JOIN `users` b ON `owner_history_to_uid` = b.`user_id` WHERE `owner_history_cid` = '%d'", chan->channel_id);
+        res = mysql_use();
+        if(mysql_num_rows(res)) {
+            reply(getTextBot(), user, "NS_INFO_OWNERLOG", chan->name);
+            time_t rawtime;
+            struct tm *timeinfo;
+            char timeBuf[80];
+            while((row = mysql_fetch_row(res))) {
+                rawtime = (time_t) atol(row[0]);
+                timeinfo = localtime(&rawtime);
+                strftime(timeBuf, 80, "%c", timeinfo);
+                reply(getTextBot(), user, "NS_INFO_OWNERCHANGE", row[1], row[2], timeBuf);
+            }
         }
     }
 }