char seenstr[MAXLEN];
struct Table *table;
struct ChanUser *chanuser;
- printf_mysql_query("SELECT `chanuser_access`, `user_user`, `chanuser_seen`, `chanuser_flags` FROM `chanusers` LEFT JOIN `users` ON `chanuser_uid` = `user_id` WHERE `chanuser_cid` = '%d'", chan->channel_id);
+ printf_mysql_query("SELECT `chanuser_access`, `user_user`, `chanuser_seen`, `chanuser_flags` FROM `chanusers` LEFT JOIN `users` ON `chanuser_uid` = `user_id` WHERE `chanuser_cid` = '%d' ORDER BY `chanuser_access` DESC, `user_user` ASC", chan->channel_id);
res = mysql_use();
table = table_init(4, mysql_num_rows(res) + 1, 0);
if(usermask)
table_add(table, content);
while ((row = mysql_fetch_row(res)) != NULL) {
caccess = atoi(row[0]);
- if((!usermask || match(usermask, row[1])) && caccess >= min_access && caccess <= max_access) {
+ if((!usermask || !match(usermask, row[1])) && caccess >= min_access && caccess <= max_access) {
content[0] = row[0];
content[1] = row[1];
is_here = 0;
if(!content_count)
reply(textclient, user, "NS_TABLE_NONE");
if(usermask || min_access != 1 || max_access != 500)
- reply(textclient, user, (table->length == 2 ? "NS_USERS_COUNT_MATCH_1" : "NS_USERS_COUNT_MATCH"), table->length - 1, chan->name, min_access, max_access, content_count);
+ reply(textclient, user, (table->length == 2 ? "NS_USERS_COUNT_MATCH_1" : "NS_USERS_COUNT_MATCH"), table->length - 1, chan->name, content_count);
else
- reply(textclient, user, (table->length == 2 ? "NS_USERS_COUNT_1" : "NS_USERS_COUNT"), table->length - 1, chan->name, min_access, max_access);
+ reply(textclient, user, (table->length == 2 ? "NS_USERS_COUNT_1" : "NS_USERS_COUNT"), table->length - 1, chan->name);
table_free(table);
}