Skip to content

Commit a8daa81

Browse files
committed
Merge pull request #101 from Linnun/master
Add Channel#isEmpty, Channel#isFamilyEmpty and ChannelProperty.CHANNEL_DELETE_DELAY
2 parents 0811e7c + ca3d01e commit a8daa81

5 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/main/java/com/github/theholywaffle/teamspeak3/api/ChannelProperty.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public enum ChannelProperty implements Property {
3232
CHANNEL_CODEC_IS_UNENCRYPTED(true),
3333
CHANNEL_CODEC_LATENCY_FACTOR(false),
3434
CHANNEL_CODEC_QUALITY(true),
35+
CHANNEL_DELETE_DELAY(true),
3536
CHANNEL_DESCRIPTION(true),
3637
CHANNEL_FILEPATH(false),
3738
CHANNEL_FLAG_DEFAULT(true),
@@ -48,8 +49,8 @@ public enum ChannelProperty implements Property {
4849
CHANNEL_MAXFAMILYCLIENTS(true),
4950
CHANNEL_NAME(true),
5051
CHANNEL_NAME_PHONETIC(true),
51-
CHANNEL_NEEDED_TALK_POWER(true),
5252
CHANNEL_NEEDED_SUBSCRIBE_POWER(false),
53+
CHANNEL_NEEDED_TALK_POWER(true),
5354
CHANNEL_ORDER(true),
5455
CHANNEL_PASSWORD(true),
5556
CHANNEL_TOPIC(true),

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,16 @@ public int getTotalClients() {
5252
public int getNeededSubscribePower() {
5353
return getInt(ChannelProperty.CHANNEL_NEEDED_SUBSCRIBE_POWER);
5454
}
55+
56+
/**
57+
* @return {@code true}, if the channel is empty, {@code false} otherwise.
58+
*/
59+
public boolean isEmpty() {
60+
return (getTotalClients() == 0);
61+
}
62+
63+
@Override
64+
public boolean isFamilyEmpty() {
65+
return (getTotalClientsFamily() == 0);
66+
}
5567
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ public int getMaxClients() {
100100
public int getMaxFamilyClients() {
101101
return getInt(ChannelProperty.CHANNEL_MAXFAMILYCLIENTS);
102102
}
103+
104+
public int getSecondsEmpty() {
105+
return getInt(ChannelProperty.SECONDS_EMPTY);
106+
}
107+
108+
/**
109+
* @return {@code true}, if the channel and all child channels are empty, {@code false} otherwise.
110+
*/
111+
abstract public boolean isFamilyEmpty();
103112
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public String getPhoneticName() {
8484
return get(ChannelProperty.CHANNEL_NAME_PHONETIC);
8585
}
8686

87-
public int getSecondsEmpty() {
88-
return getInt(ChannelProperty.SECONDS_EMPTY);
87+
@Override
88+
public boolean isFamilyEmpty() {
89+
return (getSecondsEmpty() >= 0);
8990
}
9091
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public CChannelList() {
3737
add(new OptionParam("voice"));
3838
add(new OptionParam("limits"));
3939
add(new OptionParam("icon"));
40+
add(new OptionParam("secondsempty"));
4041
}
4142

4243
}

0 commit comments

Comments
 (0)