+/* cmd_global_staff.c - NeonServ v5.2
+ * Copyright (C) 2011 Philipp Kreil (pk910)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "cmd_global.h"
+
+/*
+* no arguments
+*/
+
+CMD_BIND(global_cmd_staff) {
+ MYSQL_RES *res, *res2;
+ MYSQL_ROW row, row2;
+ printf_mysql_query("SELECT `rank_id`, `rank_name` FROM `support_ranks` ORDER BY `rank_order` ASC");
+ res = mysql_use();
+ while ((row = mysql_fetch_row(res)) != NULL) {
+ printf_mysql_query("SELECT `user_user`, `user_god` FROM `users` WHERE `user_rank` = '%s'", row[0]);
+ res2 = mysql_use();
+ if(mysql_num_rows(res2)) {
+ reply(getTextBot(), user, "\002%s\002", row[1]);
+ while ((row2 = mysql_fetch_row(res2)) != NULL) {
+ if(strcmp(row2[1], "0")) {
+ //god enabled - show nicks
+ char loggedinBuf[MAXLEN];
+ int loggedinPos = 0;
+ struct UserNode *cuser;
+ for(cuser = getUsersWithAuth(row2[0], NULL); cuser; cuser = getUsersWithAuth(row2[0], cuser)) {
+ loggedinPos += sprintf(loggedinBuf+loggedinPos, (loggedinPos ? ", %s" : "%s"), cuser->nick);
+ }
+ if(loggedinPos)
+ reply(getTextBot(), user, " %s (%s: %s)", row2[0], get_language_string(user, "NS_STAFF_LOGGEDIN"), loggedinBuf);
+ else
+ reply(getTextBot(), user, " %s", row2[0]);
+ } else
+ reply(getTextBot(), user, " %s", row2[0]);
+ }
+ }
+ }
+}