Fixed channel members list

This commit is contained in:
Michiel Broek 2005-04-27 21:09:23 +00:00
parent 12d3223176
commit 054c44a10b

View File

@ -676,11 +676,13 @@ char *chat_put(char *data)
{ {
static char buf[200]; static char buf[200];
char *pid, *msg, *cmd; char *pid, *msg, *cmd;
int i, j, first, count; int i, first, count;
#ifdef USE_EXPERIMENT #ifdef USE_EXPERIMENT
int found; int found;
usr_list *tmp; usr_list *tmp;
chn_list *tmpc; chn_list *tmpc;
#else
int j;
#endif #endif
Syslog('-', "CPUT:%s", data); Syslog('-', "CPUT:%s", data);
@ -789,18 +791,25 @@ char *chat_put(char *data)
sprintf(buf, "Present in this channel:"); sprintf(buf, "Present in this channel:");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
count = 0; count = 0;
for (j = 0; j < MAXCLIENT; j++) {
#ifdef USE_EXPERIMENT #ifdef USE_EXPERIMENT
if ((strcmp(chat_users[j].channel, chat_users[i].channel) == 0) && chat_users[j].pid) { for (tmp = users; tmp; tmp = tmp->next) {
if (strcmp(tmp->channel, chat_users[i].channel) == 0) {
sprintf(buf, "%s@%s (%s)%s", tmp->nick, tmp->server, tmp->realname,
tmp->chanop ? (char *)" (chanop)" : (char *)"");
system_msg(chat_users[i].pid, buf);
count++;
}
}
#else #else
for (j = 0; j < MAXCLIENT; j++) {
if ((chat_users[j].channel == chat_users[i].channel) && chat_users[j].pid) { if ((chat_users[j].channel == chat_users[i].channel) && chat_users[j].pid) {
#endif
sprintf(buf, "%s %s", chat_users[j].nick, sprintf(buf, "%s %s", chat_users[j].nick,
chat_users[j].chanop ?"(chanop)": chat_users[j].sysop ?"(sysop)":""); chat_users[j].chanop ?"(chanop)": chat_users[j].sysop ?"(sysop)":"");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
count++; count++;
} }
} }
#endif
sprintf(buf, "%d user%s in this channel", count, (count == 1) ?"":"s"); sprintf(buf, "%d user%s in this channel", count, (count == 1) ?"":"s");
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
} else { } else {