Added user channel update info

This commit is contained in:
Michiel Broek 2005-04-27 18:53:30 +00:00
parent 1ecb94354d
commit be9f2513d1
2 changed files with 30 additions and 15 deletions

View File

@ -281,13 +281,13 @@ int join(pid_t pid, char *channel, int sysop)
chat_users[j].chatting = TRUE; chat_users[j].chatting = TRUE;
Syslog('-', "Added user %d to channel %s", j, channel); Syslog('-', "Added user %d to channel %s", j, channel);
chat_dump(); chat_dump();
sprintf(buf, "%s has joined channel #%s, now %d users", chat_users[j].nick, channel, tmp->users); sprintf(buf, "%s has joined channel %s, now %d users", chat_users[j].nick, channel, tmp->users);
chat_msg(channel, NULL, buf); chat_msg(channel, NULL, buf);
/* /*
* The sysop channel is private to the system, no broadcast * The sysop channel is private to the system, no broadcast
*/ */
if (strcasecmp(channel, "sysop")) if (strcasecmp(channel, "#sysop"))
send_all("JOIN %s@%s %s\r\n", chat_users[j].nick, CFG.myfqdn, channel); send_all("JOIN %s@%s %s\r\n", chat_users[j].nick, CFG.myfqdn, channel);
return TRUE; return TRUE;
} }
@ -414,7 +414,7 @@ int part(pid_t pid, char *reason)
*/ */
if (reason != NULL) if (reason != NULL)
chat_msg(chat_users[i].channel, chat_users[i].nick, reason); chat_msg(chat_users[i].channel, chat_users[i].nick, reason);
sprintf(buf, "%s has left channel #%s, %d users left", chat_users[i].nick, tmp->name, tmp->users); sprintf(buf, "%s has left channel %s, %d users left", chat_users[i].nick, tmp->name, tmp->users);
chat_msg(chat_users[i].channel, NULL, buf); chat_msg(chat_users[i].channel, NULL, buf);
if (strcmp(tmp->name, (char *)"sysop")) { if (strcmp(tmp->name, (char *)"sysop")) {
if (reason && strlen(reason)) if (reason && strlen(reason))
@ -744,7 +744,11 @@ char *chat_put(char *data)
system_msg(chat_users[i].pid, buf); system_msg(chat_users[i].pid, buf);
} else { } else {
Syslog('-', "Trying to join channel %s", cmd); Syslog('-', "Trying to join channel %s", cmd);
#ifdef USE_EXPERIMENT
join(chat_users[i].pid, cmd, chat_users[i].sysop);
#else
join(chat_users[i].pid, cmd+1, chat_users[i].sysop); join(chat_users[i].pid, cmd+1, chat_users[i].sysop);
#endif
} }
chat_dump(); chat_dump();
goto ack; goto ack;

View File

@ -815,10 +815,6 @@ int command_pass(char *hostname, char *parameters)
version = strtok(NULL, " \0"); version = strtok(NULL, " \0");
lnk = strtok(NULL, " \0"); lnk = strtok(NULL, " \0");
// Syslog('r', "passwd \"%s\"", printable(passwd, 0));
// Syslog('r', "version \"%s\"", printable(version, 0));
// Syslog('r', "link \"%s\"", printable(lnk, 0));
if (version == NULL) { if (version == NULL) {
send_msg(tnsl, "461 PASS: Not enough parameters\r\n"); send_msg(tnsl, "461 PASS: Not enough parameters\r\n");
return 461; return 461;
@ -844,6 +840,7 @@ int command_server(char *hostname, char *parameters)
ncs_list *tnsl; ncs_list *tnsl;
srv_list *ta; srv_list *ta;
usr_list *tmp; usr_list *tmp;
chn_list *tmpc;
char *name, *hops, *id, *prod, *vers, *fullname; char *name, *hops, *id, *prod, *vers, *fullname;
unsigned long token; unsigned long token;
int ihops, found = FALSE; int ihops, found = FALSE;
@ -863,13 +860,6 @@ int command_server(char *hostname, char *parameters)
} }
} }
// Syslog('r', "name \"%s\"", printable(name, 0));
// Syslog('r', "hops \"%s\"", printable(hops, 0));
// Syslog('r', "id \"%s\"", printable(id, 0));
// Syslog('r', "prod \"%s\"", printable(prod, 0));
// Syslog('r', "vers \"%s\"", printable(vers, 0));
// Syslog('r', "full \"%s\"", printable(fullname, 0));
if (fullname == NULL) { if (fullname == NULL) {
send_msg(tnsl, "461 SERVER: Not enough parameters\r\n"); send_msg(tnsl, "461 SERVER: Not enough parameters\r\n");
return 461; return 461;
@ -906,6 +896,16 @@ int command_server(char *hostname, char *parameters)
send_msg(tnsl, "USER %s@%s %s\r\n", tmp->name, tmp->server, tmp->realname); send_msg(tnsl, "USER %s@%s %s\r\n", tmp->name, tmp->server, tmp->realname);
if (strcmp(tmp->name, tmp->nick)) if (strcmp(tmp->name, tmp->nick))
send_msg(tnsl, "NICK %s %s %s %s\r\n", tmp->nick, tmp->name, tmp->server, tmp->realname); send_msg(tnsl, "NICK %s %s %s %s\r\n", tmp->nick, tmp->name, tmp->server, tmp->realname);
if (strlen(tmp->channel)) {
for (tmpc = channels; tmpc; tmpc = tmpc->next) {
if (strcasecmp(tmpc->name, tmp->channel) == 0) {
send_msg(tnsl, "JOIN %s@%s %s\r\n", tmpc->owner, tmpc->server, tmpc->name);
if (strlen(tmpc->topic) && (strcmp(tmpc->server, CFG.myfqdn) == 0)) {
send_msg(tnsl, "TOPIC %s %s\r\n", tmpc->name, tmpc->topic);
}
}
}
}
} }
add_server(&servers, tnsl->server, ihops, prod, vers, fullname, hostname); add_server(&servers, tnsl->server, ihops, prod, vers, fullname, hostname);
return 0; return 0;
@ -938,12 +938,23 @@ int command_server(char *hostname, char *parameters)
} }
} }
/* /*
* Send all known users * Send all known users. If a user is in a channel, send a JOIN.
* If the user is one of our own and has set a channel topic, send it.
*/ */
for (tmp = users; tmp; tmp = tmp->next) { for (tmp = users; tmp; tmp = tmp->next) {
send_msg(tnsl, "USER %s@%s %s\r\n", tmp->name, tmp->server, tmp->realname); send_msg(tnsl, "USER %s@%s %s\r\n", tmp->name, tmp->server, tmp->realname);
if (strcmp(tmp->name, tmp->nick)) if (strcmp(tmp->name, tmp->nick))
send_msg(tnsl, "NICK %s %s %s %s\r\n", tmp->nick, tmp->name, tmp->server, tmp->realname); send_msg(tnsl, "NICK %s %s %s %s\r\n", tmp->nick, tmp->name, tmp->server, tmp->realname);
if (strlen(tmp->channel)) {
for (tmpc = channels; tmpc; tmpc = tmpc->next) {
if (strcasecmp(tmpc->name, tmp->channel) == 0) {
send_msg(tnsl, "JOIN %s@%s %s\r\n", tmpc->owner, tmpc->server, tmpc->name);
if (strlen(tmpc->topic) && (strcmp(tmpc->server, CFG.myfqdn) == 0)) {
send_msg(tnsl, "TOPIC %s %s\r\n", tmpc->name, tmpc->topic);
}
}
}
}
} }
add_server(&servers, tnsl->server, ihops, prod, vers, fullname, hostname); add_server(&servers, tnsl->server, ihops, prod, vers, fullname, hostname);
changed = TRUE; changed = TRUE;