diff options
author | Leonard Kugis <leonard@kug.is> | 2022-04-25 18:49:40 +0200 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2022-04-25 18:49:40 +0200 |
commit | 319e82391bfb8822fd75684f17ae28b26c1e3b0c (patch) | |
tree | ccdb434f57e486871f5603d3235003bfe0162161 /src/com/encrox/twitchbot/client/messages/Login.java |
Diffstat (limited to 'src/com/encrox/twitchbot/client/messages/Login.java')
-rwxr-xr-x | src/com/encrox/twitchbot/client/messages/Login.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/com/encrox/twitchbot/client/messages/Login.java b/src/com/encrox/twitchbot/client/messages/Login.java new file mode 100755 index 0000000..b439c99 --- /dev/null +++ b/src/com/encrox/twitchbot/client/messages/Login.java @@ -0,0 +1,49 @@ +package com.encrox.twitchbot.client.messages;
+
+import java.io.UnsupportedEncodingException;
+
+import com.encrox.twitchbot.client.Utils;
+
+public class Login extends Message {
+
+ private byte id = 1;
+ private String username, password;
+
+ public Login(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public Login() {
+ username = null;
+ password = null;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public byte getID() {
+ return id;
+ }
+
+ public byte[] getData() {
+ byte[] output = new byte[160];
+ try {
+ byte[] user = Utils.fill(username.getBytes("UTF-8"), 32), pass = Utils.fill(password.getBytes("UTF-8"), 128);
+ for(int i = 0; i < 32; i++)
+ output[i] = user[i];
+ for(int i = 0; i < 128; i++)
+ output[32+i] = pass[i];
+ return output;
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+}
|