From 825661af34b1f655deec3b72535dbc219e290380 Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Tue, 12 Aug 2025 20:21:47 +0200 Subject: [PATCH 1/2] Split nicknames into components when sending ISON command to honor IRC size limit --- Sources/App/Classes/IRC/IRCClient.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/App/Classes/IRC/IRCClient.m b/Sources/App/Classes/IRC/IRCClient.m index f00f66d80..b26abf044 100644 --- a/Sources/App/Classes/IRC/IRCClient.m +++ b/Sources/App/Classes/IRC/IRCClient.m @@ -12168,9 +12168,10 @@ - (void)_sendIsonForNicknames:(NSArray *)nicknames hideResponse:(BOO [self.requestedCommands recordIsonRequestOpened]; } - NSString *nicknamesString = [nicknames componentsJoinedByString:@" "]; - - [self send:@"ISON", nicknamesString, nil]; + [nicknames enumerateSubarraysOfSize:8 usingBlock:^(NSArray *objects, BOOL *stop) { + NSString *nicknamesString = [objects componentsJoinedByString:@" "]; + [self send:@"ISON", nicknamesString, nil]; + }]; } - (void)requestChannelList From f3ef6a1b53d3feb90e41673d0075b1049c87f973 Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Tue, 12 Aug 2025 22:12:58 +0200 Subject: [PATCH 2/2] Fix updating entire nickname list --- Sources/App/Classes/IRC/IRCClient.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sources/App/Classes/IRC/IRCClient.m b/Sources/App/Classes/IRC/IRCClient.m index b26abf044..135883466 100644 --- a/Sources/App/Classes/IRC/IRCClient.m +++ b/Sources/App/Classes/IRC/IRCClient.m @@ -224,6 +224,7 @@ @interface IRCClient () @property (nonatomic, strong) TLOTimer *whoTimer; @property (nonatomic, assign) BOOL capabilityNegotiationIsPaused; @property (nonatomic, assign) BOOL invokingISONCommandForFirstTime; +@property (nonatomic, assign) BOOL invokingBatchedISONCommand; @property (nonatomic, assign) BOOL isTerminating; // Is being destroyed @property (nonatomic, assign) BOOL inWhoisResponse; @property (nonatomic, assign) BOOL inWhowasResponse; @@ -241,6 +242,7 @@ @interface IRCClient () @property (nonatomic, assign) NSUInteger autojoinDelayedWarningCount; @property (nonatomic, copy, nullable) NSString *tryingNicknameSentNickname; @property (nonatomic, strong) NSMutableArray *channelListPrivate; +@property (nonatomic, strong) NSMutableArray *onlineNicknames; @property (nonatomic, strong, nullable) NSMutableArray *channelsToAutojoin; @property (nonatomic, strong) IRCAddressBookMatchCache *addressBookMatchCache; @property (nonatomic, strong) IRCAddressBookUserTrackingContainer *trackedUsers; @@ -320,6 +322,8 @@ - (void)prepareInitialState self.trackedUsers = [[IRCAddressBookUserTrackingContainer alloc] initWithClient:self]; + self.onlineNicknames = [NSMutableArray array]; + self.requestedCommands = [IRCClientRequestedCommands new]; self.lastMessageServerTime = self.config.lastMessageServerTime; @@ -9463,6 +9467,16 @@ - (void)receiveNumericReply:(IRCMessage *)m NSArray *onlineNicknames = [onlineNicknamesString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + [self.onlineNicknames addObjectsFromArray: onlineNicknames]; + + /* If we were invoking a batched ISON command and there's still + batches to process, wait until we've the last batch before + updating the channel list */ + if (self.invokingBatchedISONCommand) + return; + + onlineNicknames = self.onlineNicknames; + /* Start going over the list of tracked nicknames */ NSDictionary *trackedUsers = self.trackedUsers.trackedUsers; @@ -12161,6 +12175,8 @@ - (void)_sendIsonForNicknames:(NSArray *)nicknames hideResponse:(BOO if (nicknames.count == 0) { return; } + + [self.onlineNicknames removeAllObjects]; if (hideResponse == NO) { [self.requestedCommands recordIsonRequestOpenedAsVisible]; @@ -12168,10 +12184,12 @@ - (void)_sendIsonForNicknames:(NSArray *)nicknames hideResponse:(BOO [self.requestedCommands recordIsonRequestOpened]; } + self.invokingBatchedISONCommand = true; [nicknames enumerateSubarraysOfSize:8 usingBlock:^(NSArray *objects, BOOL *stop) { NSString *nicknamesString = [objects componentsJoinedByString:@" "]; [self send:@"ISON", nicknamesString, nil]; }]; + self.invokingBatchedISONCommand = false; } - (void)requestChannelList