Skip to content

Commit 177cf46

Browse files
committed
Channel: Add getters for new unique IDs and channel banner modes
1 parent 37c122b commit 177cf46

File tree

4 files changed

+79
-1
lines changed

4 files changed

+79
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.github.theholywaffle.teamspeak3.api;
2+
3+
/*
4+
* #%L
5+
* TeamSpeak 3 Java API
6+
* %%
7+
* Copyright (C) 2021 Bert De Geyter, Roger Baumgartner
8+
* %%
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
* #L%
27+
*/
28+
29+
/**
30+
* The values in this enum are <b>speculative</b>.
31+
* There does not appear to be any documentation on channel banner modes.
32+
*/
33+
public enum ChannelBannerMode {
34+
35+
NO_ADJUST(0),
36+
IGNORE_ASPECT(1),
37+
KEEP_ASPECT(2),
38+
39+
/**
40+
* An unknown channel banner mode.
41+
* <p>
42+
* If you ever encounter an unknown banner mode, please tell us!
43+
* We may have to update the API.
44+
* </p>
45+
*/
46+
UNKNOWN(-1);
47+
48+
private final int i;
49+
50+
ChannelBannerMode(int i) {
51+
this.i = i;
52+
}
53+
54+
public int getIndex() {
55+
return i;
56+
}
57+
}

src/main/java/com/github/theholywaffle/teamspeak3/api/wrapper/ChannelBase.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* #L%
2727
*/
2828

29+
import com.github.theholywaffle.teamspeak3.api.ChannelBannerMode;
2930
import com.github.theholywaffle.teamspeak3.api.ChannelProperty;
3031
import com.github.theholywaffle.teamspeak3.api.Codec;
3132

@@ -71,6 +72,20 @@ public boolean isSemiPermanent() {
7172
return getBoolean(ChannelProperty.CHANNEL_FLAG_SEMI_PERMANENT);
7273
}
7374

75+
public ChannelBannerMode getBannerMode() {
76+
final int mode = getInt(ChannelProperty.CHANNEL_BANNER_MODE);
77+
for (final ChannelBannerMode m : ChannelBannerMode.values()) {
78+
if (m.getIndex() == mode) {
79+
return m;
80+
}
81+
}
82+
return ChannelBannerMode.UNKNOWN;
83+
}
84+
85+
public String getBannerGraphicsUrl() {
86+
return get(ChannelProperty.CHANNEL_BANNER_GFX_URL);
87+
}
88+
7489
public Codec getCodec() {
7590
final int codec = getInt(ChannelProperty.CHANNEL_CODEC);
7691
for (final Codec c : Codec.values()) {

src/main/java/com/github/theholywaffle/teamspeak3/api/wrapper/ChannelInfo.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
import java.util.Map;
30+
import java.util.UUID;
3031

3132
import com.github.theholywaffle.teamspeak3.api.ChannelProperty;
3233

@@ -56,6 +57,10 @@ public int getCodecLatencyFactor() {
5657
return getInt(ChannelProperty.CHANNEL_CODEC_LATENCY_FACTOR);
5758
}
5859

60+
public UUID getUniqueIdentifier() {
61+
return UUID.fromString(get(ChannelProperty.CHANNEL_UNIQUE_IDENTIFIER));
62+
}
63+
5964
public boolean isEncrypted() {
6065
return !getBoolean(ChannelProperty.CHANNEL_CODEC_IS_UNENCRYPTED);
6166
}

src/main/java/com/github/theholywaffle/teamspeak3/commands/ChannelCommands.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,14 @@ public static Command channelInfo(int channelId) {
7676
}
7777

7878
public static Command channelList() {
79-
CommandBuilder builder = new CommandBuilder("channellist", 6);
79+
CommandBuilder builder = new CommandBuilder("channellist", 7);
8080
builder.add(new OptionParam("topic"));
8181
builder.add(new OptionParam("flags"));
8282
builder.add(new OptionParam("voice"));
8383
builder.add(new OptionParam("limits"));
8484
builder.add(new OptionParam("icon"));
8585
builder.add(new OptionParam("secondsempty"));
86+
builder.add(new OptionParam("banners"));
8687
return builder.build();
8788
}
8889

0 commit comments

Comments
 (0)