summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-10-02 19:37:16 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-10-02 19:37:16 +0100
commit2385f7b944bb22acd85e6c089e509880a45a2cb1 (patch)
tree149c7005acbcc3aeb663661ed4b45ef7eef35ade /functions.c
parentbe3913f22cc03a6d804d720fb0d3efcc337c4150 (diff)
Try to make removenickfromallchannels() much faster when another user QUITs by ignoring unused channel indexes.
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/functions.c b/functions.c
index 730819f..c5e3cdc 100644
--- a/functions.c
+++ b/functions.c
@@ -1432,6 +1432,10 @@ int removenickfromallchannels(char *nickuserhost, struct channel *channels) {
// Go through all channels and remove nick if present
for (int i = 0; i < MAXCHANNELS; i++) {
+ // Don't bother checking this channel index if it isn't used
+ if (!channels[i].name[0]) {
+ continue;
+ }
// Go through all nicks in channel
for (int j = 0; j < MAXCHANNICKS; j++) {
// Remove the nick from the channel if present