diff --git a/client/js/teaforo.ts b/client/js/teaforo.ts
index e00b1d90..b94cab4b 100644
--- a/client/js/teaforo.ts
+++ b/client/js/teaforo.ts
@@ -22,4 +22,8 @@ namespace forum {
export function open() {
ipc.send("teaforo-login");
}
+
+ export function logout() {
+ ipc.send("teaforo-logout");
+ }
}
\ No newline at end of file
diff --git a/shared/js/ConnectionHandler.ts b/shared/js/ConnectionHandler.ts
index dc7184f4..a07fd5cc 100644
--- a/shared/js/ConnectionHandler.ts
+++ b/shared/js/ConnectionHandler.ts
@@ -10,8 +10,6 @@
///
///
-import spawnConnectModal = Modals.spawnConnectModal;
-
enum DisconnectReason {
HANDLER_DESTROYED,
REQUESTED,
@@ -23,6 +21,8 @@ enum DisconnectReason {
CLIENT_KICKED,
CLIENT_BANNED,
HANDSHAKE_FAILED,
+ HANDSHAKE_TEAMSPEAK_REQUIRED,
+ HANDSHAKE_BANNED,
SERVER_CLOSED,
SERVER_REQUIRES_PASSWORD,
IDENTITY_TOO_LOW,
@@ -407,6 +407,14 @@ class ConnectionHandler {
tr("Failed to process handshake: ") + data as string
).open();
break;
+ case DisconnectReason.HANDSHAKE_TEAMSPEAK_REQUIRED:
+ createErrorModal(
+ tr("Target server is a TeamSpeak server"),
+ MessageHelper.formatMessage(tr("The target server is a TeamSpeak 3 server!{:br:}Only TeamSpeak 3 based identities are able to connect.{:br}Please select another profile or change the identify type."))
+ ).open();
+ this.sound.play(Sound.CONNECTION_DISCONNECTED);
+ auto_reconnect = false;
+ break;
case DisconnectReason.IDENTITY_TOO_LOW:
createErrorModal(
tr("Identity level is too low"),
@@ -457,11 +465,18 @@ class ConnectionHandler {
}).open();
break;
case DisconnectReason.CLIENT_KICKED:
- this.chat.serverChat().appendError(tr("You got kicked from the server by {0}{1}"),
+ createErrorModal(
+ tr("You've been banned"),
+ MessageHelper.formatMessage(tr("You've been banned from this server.{:br:}{0}"), data["extra_message"])
+ ).open();
+ this.sound.play(Sound.SERVER_KICKED);
+ auto_reconnect = false;
+ break;
+ case DisconnectReason.HANDSHAKE_BANNED:
+ this.chat.serverChat().appendError(tr("You got banned from the server by {0}{1}"),
ClientEntry.chatTag(data["invokerid"], data["invokername"], data["invokeruid"]),
data["reasonmsg"] ? " (" + data["reasonmsg"] + ")" : "");
- this.sound.play(Sound.SERVER_KICKED);
- auto_reconnect = true;
+ this.sound.play(Sound.CONNECTION_BANNED); //TODO findout if it was a disconnect or a connect refuse
break;
case DisconnectReason.CLIENT_BANNED:
this.chat.serverChat().appendError(tr("You got banned from the server by {0}{1}"),
diff --git a/shared/js/connection/HandshakeHandler.ts b/shared/js/connection/HandshakeHandler.ts
index a522fb42..83d70002 100644
--- a/shared/js/connection/HandshakeHandler.ts
+++ b/shared/js/connection/HandshakeHandler.ts
@@ -49,6 +49,19 @@ namespace connection {
this.handshake_handler.start_handshake();
}
+ on_teamspeak() {
+ const type = this.profile.selected_type();
+ if(type == profiles.identities.IdentitifyType.TEAMSPEAK)
+ this.handshake_finished();
+ else {
+
+ if(this.failed) return;
+
+ this.failed = true;
+ this.connection.client.handleDisconnect(DisconnectReason.HANDSHAKE_TEAMSPEAK_REQUIRED);
+ }
+ }
+
private handshake_failed(message: string) {
if(this.failed) return;
@@ -71,7 +84,6 @@ namespace connection {
const git_version = settings.static_global("version", "unknown");
const browser_name = (navigator.browserSpecs || {})["name"] || " ";
let data = {
- //TODO variables!
client_nickname: this.name,
client_platform: (browser_name ? browser_name + " " : "") + navigator.platform,
client_version: "TeaWeb " + git_version + " (" + navigator.userAgent + ")",
@@ -119,6 +131,8 @@ namespace connection {
} else if(error.id == 783 || error.id == 519) {
error.extra_message = parseInt(error.extra_message) == NaN ? "8" : error.extra_message;
this.connection.client.handleDisconnect(DisconnectReason.IDENTITY_TOO_LOW, error);
+ } else if(error.id == 3329) {
+ this.connection.client.handleDisconnect(DisconnectReason.HANDSHAKE_BANNED, error);
} else {
this.connection.client.handleDisconnect(DisconnectReason.CLIENT_KICKED, error);
}
diff --git a/shared/js/load.ts b/shared/js/load.ts
index 2097a79f..6fbba84a 100644
--- a/shared/js/load.ts
+++ b/shared/js/load.ts
@@ -504,7 +504,13 @@ const loader_javascript = {
name: "javascript web",
priority: 10,
function: loader_javascript.load_scripts_debug_web
- })
+ });
+ } else {
+ loader.register_task(loader.Stage.JAVASCRIPT, {
+ name: "javascript client",
+ priority: 10,
+ function: loader_javascript.load_scripts_debug_client
+ });
}
/* load some extends classes */
@@ -618,6 +624,11 @@ const loader_javascript = {
["js/WebPPTListener.js"]
]);
},
+ load_scripts_debug_client: async () => {
+ await loader.load_scripts([
+ ["js/teaforo.js"]
+ ]);
+ },
load_release: async () => {
console.log("Load for release!");
diff --git a/shared/js/profiles/identities/TeamSpeakIdentity.ts b/shared/js/profiles/identities/TeamSpeakIdentity.ts
index 16c2a990..2d3559d1 100644
--- a/shared/js/profiles/identities/TeamSpeakIdentity.ts
+++ b/shared/js/profiles/identities/TeamSpeakIdentity.ts
@@ -222,10 +222,6 @@ namespace profiles.identities {
});
}
- skip_and_initialize() {
- this.trigger_success();
- }
-
private handle_proof(json) {
if(!json[0]["digest"]) {
this.trigger_fail("server too old");
diff --git a/shared/js/ui/modal/ModalSettings.ts b/shared/js/ui/modal/ModalSettings.ts
index 01d2e902..b1f674de 100644
--- a/shared/js/ui/modal/ModalSettings.ts
+++ b/shared/js/ui/modal/ModalSettings.ts
@@ -238,11 +238,23 @@ namespace Modals {
} else {
tag.find(".connected").hide();
}
+
tag.find(".button-logout").on('click', event => {
- window.location.href = settings.static("forum_path") + "auth.php?type=logout";
+ if(native_client) {
+ modal.close(); /* we cant update the modal so we close it */
+ forum.logout();
+ } else {
+ window.location.href = settings.static("forum_path") + "auth.php?type=logout";
+ }
});
tag.find(".button-login").on('click', event => {
- window.location.href = settings.static("forum_path") + "login.php";
+ if(native_client) {
+ modal.close(); /* we cant update the modal so we close it */
+ forum.open();
+ } else {
+ window.location.href = settings.static("forum_path") + "login.php";
+ }
+
});
}
}
@@ -761,7 +773,7 @@ namespace Modals {
if (identity && identity.valid()) {
forum_tag.find(".connected").show();
} else {
- forum_tag.find(".disconnected").show();
+ _tag.find(".disconnected").show();
}
} else if (selected_type == profiles.identities.IdentitifyType.TEAMSPEAK) {
console.log("Set: " + identity);
@@ -930,7 +942,7 @@ namespace Modals {
});
}
- { //The forum
+ { //The
const teaforo_tag = settings_tag.find(".identity-settings-teaforo");
if (native_client) {
teaforo_tag.find(".native-teaforo-login").on('click', event => {