You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
834 B
37 lines
834 B
package com.jotuntech.sketcher.client.command;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import com.jotuntech.sketcher.client.Client;
|
|
import com.jotuntech.sketcher.client.Command;
|
|
import com.jotuntech.sketcher.client.Connection;
|
|
import com.jotuntech.sketcher.common.User;
|
|
|
|
public class VoiceCommand implements Command {
|
|
boolean voiceEnabled;
|
|
|
|
public VoiceCommand() {
|
|
|
|
}
|
|
|
|
public VoiceCommand(boolean voiceEnabled) {
|
|
this.voiceEnabled = voiceEnabled;
|
|
}
|
|
|
|
public int perform(Client client, User user) {
|
|
if(user.isViewer()) {
|
|
return Connection.SEND_NONE;
|
|
}
|
|
|
|
client.setVoiceEnabled(voiceEnabled);
|
|
return Connection.SEND_OTHERS;
|
|
}
|
|
|
|
public void decode(ByteBuffer in) {
|
|
voiceEnabled = in.get() != 0;
|
|
}
|
|
|
|
public void encode(ByteBuffer out) {
|
|
out.put((byte) (voiceEnabled ? 0xFF : 0x00));
|
|
}
|
|
}
|
|
|