Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Add enabling of experimental features + update to b1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vlOd2 committed Oct 8, 2023
1 parent 067bd84 commit 199d3e1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group "me.vlod"
version "b1.0"
version "b1.1"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/vlod/pinto/PintoServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import me.vlod.sql.SQLiteInterface;

public class PintoServer implements Runnable {
public static final String VERSION_STRING = "b1.0";
public static final String VERSION_STRING = "b1.1";
public static final String ASCII_LOGO = ""
+ " _____ _ _ _____ \n"
+ "| __ (_) | | / ____| \n"
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/me/vlod/pinto/configuration/MainConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.vlod.pinto.configuration;

import java.util.ArrayList;
import java.util.HashMap;

public class MainConfig implements Config {
Expand All @@ -16,6 +17,7 @@ public class MainConfig implements Config {
public String heartbeatURL = "http://ponso00.com:8880/pinto-server-list/heartbeat.php";
public String heartbeatTags = "";
public String serverID = "";
public ArrayList<String> enableExperimentsToUsers = new ArrayList<String>();
@SuppressWarnings("serial")
public HashMap<String, String> filesToServeOnHTTP = new HashMap<String, String>() {{
put("welcome.html", "text/html");
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/me/vlod/pinto/networking/NetworkHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
import me.vlod.pinto.networking.packet.PacketRegister;
import me.vlod.pinto.networking.packet.PacketRemoveContact;
import me.vlod.pinto.networking.packet.PacketServerID;
import me.vlod.pinto.networking.packet.PacketSetOption;
import me.vlod.pinto.networking.packet.PacketStatus;
import me.vlod.pinto.networking.packet.PacketTyping;

public class NetworkHandler {
public static final int PROTOCOL_VERSION = 2;
public static final int PROTOCOL_VERSION = 3;
public static final int USERNAME_MAX = 16;
public static final int MESSAGE_RATE_LIMIT_TIME = 1;
private PintoServer server;
Expand Down Expand Up @@ -247,6 +248,11 @@ private void finishLogin() {
this.userName, this.clientVersion);
}

// Experimental features
if (MainConfig.instance.enableExperimentsToUsers.contains(this.userName)) {
this.sendPacket(new PacketSetOption("exp_calls", "1"));
}

// Send a heart beat with the updated users count
this.server.sendHeartbeat();
}
Expand Down Expand Up @@ -553,6 +559,12 @@ public void handleCallChangeStatusPacket(PacketCallChangeStatus packet) {

switch (packet.callStatus) {
case CONNECTING:
if (!MainConfig.instance.enableExperimentsToUsers.contains(this.userName)) {
this.sendPacket(new PacketCallChangeStatus(CallStatus.ERROR,
"Feature unavailable"));
return;
}

if (!packet.details.contains("@")) {
this.kick("Protocol violation!");
return;
Expand Down

0 comments on commit 199d3e1

Please sign in to comment.