Skip to content

Commit bd79dd7

Browse files
committed
Add ISUPPORT: ELIST, EXCEPTS, EXTBAN, HOSTLEN, INVEX, MAXTARGETS, SILENCE, STATUSMSG, USERLEN
1 parent 82813bb commit bd79dd7

18 files changed

+714
-24
lines changed

src/main/java/org/kitteh/irc/client/library/defaults/element/isupport/DefaultISupportCaseMapping.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ public class DefaultISupportCaseMapping extends DefaultISupportParameterValueReq
4646
*/
4747
public DefaultISupportCaseMapping(@NonNull Client client, @NonNull String name, @Nullable String value) {
4848
super(client, name, value);
49-
if (value == null) {
50-
throw new KittehServerISupportException(name, "No casemapping value");
51-
}
5249
Optional<org.kitteh.irc.client.library.feature.CaseMapping> caseMapping = org.kitteh.irc.client.library.feature.CaseMapping.getByName(value);
5350
if (caseMapping.isPresent()) {
5451
this.caseMapping = caseMapping.get();

src/main/java/org/kitteh/irc/client/library/defaults/element/isupport/DefaultISupportChanLimit.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public class DefaultISupportChanLimit extends DefaultISupportParameterValueRequi
4848
*/
4949
public DefaultISupportChanLimit(@NonNull Client client, @NonNull String name, @Nullable String value) {
5050
super(client, name, value);
51-
if (value == null) {
52-
throw new KittehServerISupportException(name, "No limits defined");
53-
}
5451
String[] pairs = value.split(",");
5552
Map<Character, Integer> limits = new HashMap<>();
5653
for (String p : pairs) {

src/main/java/org/kitteh/irc/client/library/defaults/element/isupport/DefaultISupportChanModes.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.kitteh.irc.client.library.defaults.element.mode.DefaultChannelMode;
3030
import org.kitteh.irc.client.library.element.ISupportParameter;
3131
import org.kitteh.irc.client.library.element.mode.ChannelMode;
32-
import org.kitteh.irc.client.library.exception.KittehServerISupportException;
3332

3433
import java.util.ArrayList;
3534
import java.util.Collections;
@@ -50,9 +49,6 @@ public class DefaultISupportChanModes extends DefaultISupportParameterValueRequi
5049
*/
5150
public DefaultISupportChanModes(@NonNull Client client, @NonNull String name, @Nullable String value) {
5251
super(client, name, value);
53-
if (value == null) {
54-
throw new KittehServerISupportException(name, "No modes defined");
55-
}
5652
String[] modes = value.split(",");
5753
List<ChannelMode> modesList = new ArrayList<>();
5854
for (int typeId = 0; (typeId < modes.length) && (typeId < 4); typeId++) {

src/main/java/org/kitteh/irc/client/library/defaults/element/isupport/DefaultISupportChanTypes.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.checkerframework.checker.nullness.qual.Nullable;
2828
import org.kitteh.irc.client.library.Client;
2929
import org.kitteh.irc.client.library.element.ISupportParameter;
30-
import org.kitteh.irc.client.library.exception.KittehServerISupportException;
3130

3231
import java.util.ArrayList;
3332
import java.util.Collections;
@@ -48,9 +47,6 @@ public class DefaultISupportChanTypes extends DefaultISupportParameterValueRequi
4847
*/
4948
public DefaultISupportChanTypes(@NonNull Client client, @NonNull String name, @Nullable String value) {
5049
super(client, name, value);
51-
if (value == null) {
52-
throw new KittehServerISupportException(name, "No chantypes defined");
53-
}
5450
List<Character> prefixes = new ArrayList<>();
5551
for (char c : value.toCharArray()) {
5652
prefixes.add(c);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.element.ISupportParameter;
30+
31+
import java.util.Collections;
32+
import java.util.HashSet;
33+
import java.util.Set;
34+
35+
/**
36+
* Default implementation of {@link EList}.
37+
*/
38+
public class DefaultISupportEList extends DefaultISupportParameterValueRequired implements ISupportParameter.EList {
39+
private final Set<Character> extensions;
40+
41+
/**
42+
* Constructs the object.
43+
*
44+
* @param client client
45+
* @param name parameter name
46+
* @param value parameter value, if present
47+
*/
48+
public DefaultISupportEList(@NonNull Client client, @NonNull String name, @Nullable String value) {
49+
super(client, name, value);
50+
if (value == null) {
51+
this.extensions = Collections.emptySet();
52+
return;
53+
}
54+
Set<Character> extensions = new HashSet<>();
55+
for (char c : value.toCharArray()) {
56+
extensions.add(c);
57+
}
58+
this.extensions = Collections.unmodifiableSet(extensions);
59+
}
60+
61+
@Override
62+
public @NonNull Set<Character> getExtensions() {
63+
return this.extensions;
64+
}
65+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.defaults.element.DefaultISupportParameter;
30+
import org.kitteh.irc.client.library.element.ISupportParameter;
31+
32+
/**
33+
* Default implementation of {@link Excepts}.
34+
*/
35+
public class DefaultISupportExcepts extends DefaultISupportParameter implements ISupportParameter.Excepts {
36+
/**
37+
* Constructs the object.
38+
*
39+
* @param client client
40+
* @param name parameter name
41+
* @param value parameter value, if present
42+
*/
43+
public DefaultISupportExcepts(@NonNull Client client, @NonNull String name, @Nullable String value) {
44+
super(client, name, value);
45+
}
46+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.element.ISupportParameter;
30+
31+
import java.util.Collections;
32+
import java.util.HashSet;
33+
import java.util.Optional;
34+
import java.util.Set;
35+
36+
/**
37+
* Default implementation of {@link ExtBan}.
38+
*/
39+
public class DefaultISupportExtBan extends DefaultISupportParameterValueRequired implements ISupportParameter.ExtBan {
40+
private final Character prefix;
41+
private final Set<Character> types;
42+
43+
/**
44+
* Constructs the object.
45+
*
46+
* @param client client
47+
* @param name parameter name
48+
* @param value parameter value, if present
49+
*/
50+
public DefaultISupportExtBan(@NonNull Client client, @NonNull String name, @Nullable String value) {
51+
super(client, name, value);
52+
String[] split = value.split(",");
53+
this.prefix = split[0].isEmpty() ? null : split[0].charAt(0);
54+
Set<Character> types = new HashSet<>();
55+
for (char c : split[1].toCharArray()) {
56+
types.add(c);
57+
}
58+
this.types = Collections.unmodifiableSet(types);
59+
}
60+
61+
@Override
62+
public @NonNull Optional<Character> getPrefix() {
63+
return Optional.of(this.prefix);
64+
}
65+
66+
@Override
67+
public @NonNull Set<Character> getTypes() {
68+
return this.types;
69+
}
70+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.element.ISupportParameter;
30+
31+
/**
32+
* Default implementation of {@link HostLen}.
33+
*/
34+
public class DefaultISupportHostLen extends DefaultISupportParameterInteger implements ISupportParameter.HostLen {
35+
/**
36+
* Constructs the object.
37+
*
38+
* @param client client
39+
* @param name parameter name
40+
* @param value parameter value, if present
41+
*/
42+
public DefaultISupportHostLen(@NonNull Client client, @NonNull String name, @Nullable String value) {
43+
super(client, name, value);
44+
}
45+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.defaults.element.DefaultISupportParameter;
30+
import org.kitteh.irc.client.library.element.ISupportParameter;
31+
32+
/**
33+
* Default implementation of {@link InvEx}.
34+
*/
35+
public class DefaultISupportInvEx extends DefaultISupportParameter implements ISupportParameter.InvEx {
36+
/**
37+
* Constructs the object.
38+
*
39+
* @param client client
40+
* @param name parameter name
41+
* @param value parameter value, if present
42+
*/
43+
public DefaultISupportInvEx(@NonNull Client client, @NonNull String name, @Nullable String value) {
44+
super(client, name, value);
45+
}
46+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* * Copyright (C) 2013-2019 Matt Baxter https://kitteh.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person
5+
* obtaining a copy of this software and associated documentation
6+
* files (the "Software"), to deal in the Software without
7+
* restriction, including without limitation the rights to use, copy,
8+
* modify, merge, publish, distribute, sublicense, and/or sell copies
9+
* of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be
13+
* included in all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.kitteh.irc.client.library.defaults.element.isupport;
25+
26+
import org.checkerframework.checker.nullness.qual.NonNull;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
28+
import org.kitteh.irc.client.library.Client;
29+
import org.kitteh.irc.client.library.element.ISupportParameter;
30+
31+
/**
32+
* Default implementation of {@link MaxTargets}.
33+
*/
34+
public class DefaultISupportMaxTargets extends DefaultISupportParameterOptionalInteger implements ISupportParameter.MaxTargets {
35+
/**
36+
* Constructs the object.
37+
*
38+
* @param client client
39+
* @param name parameter name
40+
* @param value parameter value, if present
41+
*/
42+
public DefaultISupportMaxTargets(@NonNull Client client, @NonNull String name, @Nullable String value) {
43+
super(client, name, value);
44+
}
45+
}

0 commit comments

Comments
 (0)