Skip to content

Commit b097cd4

Browse files
committed
Stop recording 'are supported by this server' as ISUPPORT
1 parent 691bcf2 commit b097cd4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/org/kitteh/irc/client/library/defaults/listener/DefaultISupportListener.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public DefaultISupportListener(Client.@NonNull WithManagement client) {
4848
@Handler(priority = Integer.MAX_VALUE - 1)
4949
public void iSupport(ClientReceiveNumericEvent event) {
5050
for (int i = 1; i < event.getParameters().size(); i++) {
51+
if ((i == event.getParameters().size() - 1) && event.getParameters().get(i).contains(" ")) {
52+
continue;
53+
}
5154
ISupportParameter parameter = this.getClient().getISupportManager().createParameter(event.getParameters().get(i));
5255
this.getClient().getServerInfo().addISupportParameter(parameter);
5356
this.fire(new ISupportParameterEvent(this.getClient(), event.getSource(), parameter));

src/test/java/org/kitteh/irc/client/library/defaults/DefaultEventListenerTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ public void test5ISUPPORT() {
204204
Mockito.verify(this.serverInfo, Mockito.times(5)).addISupportParameter(Mockito.any());
205205
}
206206

207+
@Test
208+
public void test5ISUPPORTLonger() {
209+
this.fireLine(":irc.network 005 Kitteh SAFELIST ELIST=CTU CHANTYPES=# EXCEPTS INVEX :are supported by this server");
210+
Mockito.verify(this.serverInfo, Mockito.times(1)).addISupportParameter(Mockito.argThat(this.iSupportParameter("SAFELIST")));
211+
Mockito.verify(this.serverInfo, Mockito.times(1)).addISupportParameter(Mockito.argThat(this.iSupportParameter("ELIST")));
212+
Mockito.verify(this.serverInfo, Mockito.times(1)).addISupportParameter(Mockito.argThat(this.iSupportParameter("CHANTYPES")));
213+
Mockito.verify(this.serverInfo, Mockito.times(1)).addISupportParameter(Mockito.argThat(this.iSupportParameter("EXCEPTS")));
214+
Mockito.verify(this.serverInfo, Mockito.times(1)).addISupportParameter(Mockito.argThat(this.iSupportParameter("INVEX")));
215+
Mockito.verify(this.serverInfo, Mockito.times(5)).addISupportParameter(Mockito.any());
216+
}
217+
207218
@Test
208219
public void testMOTD() {
209220
this.fireLine(":irc.network 375 Kitteh :- irc.network Message of the Day -");

0 commit comments

Comments
 (0)