diff options
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/blabouncer.c b/blabouncer.c index 2eabd11..1fa1d60 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -7,7 +7,7 @@ // - Get CAP from server and relay to client // - Add blabouncer MOTD (375, 372, 376) // - "01:53:47 -!- ServerMode/#test [b] by irc.tghost.co.uk" on existing clients when new client connects -// - We might not track new users JOINing a channel (only users who were already in a channel when we joined) +// - Keep track of changing user nicks/modes // // Example WHOIS reply: // BOUNCER-SERVER RECEIVED: :irc.tghost.co.uk 307 blabounce l_bratch :is identified for this nick @@ -424,7 +424,7 @@ int processircmessage(int *serversockfd, int *clientsockfd, char *str, int sourc return 1; } - // Server JOIN received? Add to our local channel array if it's us. + // Server JOIN received? Add to our local channel array if it's us, or record the user in the channel if it's not us. if (strncmp(tokens[1], "JOIN", strlen(tokens[1])) == 0) { printf("Server JOIN found and it is: %s with length %zd! Next token is '%s'. Adding to local channel list if it's us.\n", tokens[0], strlen(tokens[0]), tokens[2]); // Next token should be the channel name but it probably needs the leading ':' stripping @@ -433,7 +433,6 @@ int processircmessage(int *serversockfd, int *clientsockfd, char *str, int sourc printf("processircmessage(): Channel name now '%s'\n", tokens[2]); // If the user JOINing is us, then we must have joined a channel, so add to our local channel array. - // (If it's not us, then it's another user JOINing a channel, so just pass straight through to letting all our clients know.) // Copy to a temporary string so we still have the original in case we need it char *prefixcopy = strdup(tokens[0]); stripprefix(prefixcopy); @@ -442,8 +441,12 @@ int processircmessage(int *serversockfd, int *clientsockfd, char *str, int sourc // TODO - Saner way to initialise this since we don't have the variables yet? // TODO - Defaulting to type '=' which is "public" since I don't know what else to guess. createchannel(channels, tokens[2], "TOPIC", "TOPICWHO", "0", "CHANNELMODES", "="); + // If the user JOINing is not us, record the user in our channel array. } else { printf("Server JOIN: nickuserhost is NOT ours ('%s' vs '%s').\n", prefixcopy, ircdstrings->nickuserhost); + extractnickfromprefix(prefixcopy); + printf("Server JOIN: adding user '%s' to channel '%s'.\n", prefixcopy, tokens[2]); + addusertochannel(channels, tokens[2], prefixcopy); } // And then send to all clients |