From 42876ae30c513a02d6742ca1d715e1a2e9fdf36d Mon Sep 17 00:00:00 2001 From: veclav talica Date: Sat, 26 Aug 2023 20:23:27 +0500 Subject: [PATCH] cleanup, escape resource --- scenes/Connections.gd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scenes/Connections.gd b/scenes/Connections.gd index 7c29592..93b3326 100644 --- a/scenes/Connections.gd +++ b/scenes/Connections.gd @@ -6,15 +6,13 @@ class Connection extends Reference: var domain: String var bare_jid: String var jid: String - var id_counter: int = 0 + var _id_counter: int = 0 func generate_id() -> int: - self.id_counter += 1 - return hash(self.id_counter) + self._id_counter += 1 + return hash(self._id_counter) func establish_new_connection(domain: String, identity: String, password: String) -> Connection: - ## XMPP uses unidirectional pipes for communication, which means - ## multiple connections are open over different predefined ports. var stream := StreamPeerTCP.new() if stream.connect_to_host(domain, 5222) != OK: push_error("Cannot establish client->server pipe to " + domain) @@ -245,7 +243,7 @@ func _bind_resource(connection: Connection, resource: String = "tochie-facade") {resource} """.format({ "id": iq_id, - "resource": resource + "resource": resource.xml_escape() }).to_utf8()) != OK: return ERR_CONNECTION_ERROR