summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-08 21:18:24 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-08 21:18:24 +0100
commit4733b6438fe267ec896526eb468fa9892e7752c3 (patch)
tree9af4d407d96bd8f493c16e1c557d73eaa1a182d1 /blabouncer.c
parent4c9ef597e5503fa571276fd16739410cd9847f91 (diff)
Add some STDIN based debugging commands.
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 4127b6a..07461b8 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -7,6 +7,8 @@
// - 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
+// - Other users PARTing causes us to PART
+// - We might not track new users JOINing a channel (only users who were already in a channel when we joined)
//
// Example WHOIS reply:
// BOUNCER-SERVER RECEIVED: :irc.tghost.co.uk 307 blabounce l_bratch :is identified for this nick
@@ -925,6 +927,28 @@ void dochat(int *serversockfd, int *clientsockfd) {
printf ("Error! Too long. Would have allowed up to: [%s]\n", outgoingmsg);
}
+ // STDIN based commands for debugging
+ if (strncmp(outgoingmsg, "listchannels", strlen("listchannels")) == 0) {
+ printf("STDIN command starting: listchannels\n");
+
+ int channelcount = getchannelcount(channels);
+
+ for (int i = 0; i < channelcount; i++) {
+ printf("Checking channel[%d] out of %d.\n", i, channelcount);
+ // Skip this one and increment channelcount if it's a blank channel
+ if (!channels[i].name[0]) {
+ printf("Skipping channel[%d], incrementing channelcount.\n", i);
+ channelcount++;
+ continue;
+ }
+
+ printf("Found channel '%s'.\n", channels[i].name);
+ }
+
+ printf("STDIN command complete: listchannels\n");
+ continue;
+ }
+
sendtoserver(serversockfd, outgoingmsg, strlen(outgoingmsg));
}