File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/main/java/org/kitteh/irc/client/library/defaults/listener Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,8 @@ public void cap(ClientReceiveCommandEvent event) {
160160 private void fireAndCapReq (@ NonNull CapabilityNegotiationResponseEventWithRequestBase responseEvent ) {
161161 Set <String > capabilities = this .getClient ().getCapabilityManager ().getSupportedCapabilities ().stream ().map (CapabilityState ::getName ).collect (Collectors .toCollection (HashSet ::new ));
162162 capabilities .retainAll (CapabilityManager .Defaults .getDefaults ());
163- capabilities .removeAll (this .getClient ().getCapabilityManager ().getCapabilities ().stream ().map (CapabilityState ::getName ).collect (Collectors .toList ()));
163+ List <String > currentCapabilities = this .getClient ().getCapabilityManager ().getCapabilities ().stream ().map (CapabilityState ::getName ).collect (Collectors .toList ());
164+ capabilities .removeAll (currentCapabilities );
164165 if (!capabilities .isEmpty ()) {
165166 responseEvent .setEndingNegotiation (false );
166167 capabilities .forEach (responseEvent ::addRequest );
@@ -169,7 +170,7 @@ private void fireAndCapReq(@NonNull CapabilityNegotiationResponseEventWithReques
169170 List <String > requests = responseEvent .getRequests ();
170171 if (!requests .isEmpty ()) {
171172 CapabilityRequestCommand capabilityRequestCommand = new CapabilityRequestCommand (this .getClient ());
172- requests .stream ().distinct ().forEach (capabilityRequestCommand ::enable );
173+ requests .stream ().distinct ().filter ( c -> ! currentCapabilities . contains ( c )). forEach (capabilityRequestCommand ::enable );
173174 capabilityRequestCommand .execute ();
174175 }
175176 }
You can’t perform that action at this time.
0 commit comments