From bd951a1180b1e5690de6e1bf8462b81deca51830 Mon Sep 17 00:00:00 2001 From: Renan de Souza Date: Sat, 30 Jun 2018 16:15:37 -0300 Subject: [PATCH] #30 #43 Solved 911 error messages on login; Solved infinite loop on login for some accounts; Added condition for skype4business contacts --- src/main/java/fr/delthas/skype/NotifConnector.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/delthas/skype/NotifConnector.java b/src/main/java/fr/delthas/skype/NotifConnector.java index c112442..7e3e00f 100644 --- a/src/main/java/fr/delthas/skype/NotifConnector.java +++ b/src/main/java/fr/delthas/skype/NotifConnector.java @@ -675,7 +675,9 @@ public synchronized void disconnect() { } private synchronized void sendPacket(String command, String parameters, String body) throws IOException { - String headerString = registration != null ? "Registration: " + registration + "\r\n" : ""; +// String headerString = registration != null ? "Registration: " + registration + "\r\n" : ""; + // Weird, but it's working better without sending the registration token. Solved the 911 problem but needs more testing. + String headerString = ""; String messageString = String.format("%s %d %s %d\r\n%s\r\n%s", command, ++sequenceNumber, parameters, body.getBytes(StandardCharsets.UTF_8).length + 2 + headerString.length(), headerString, body); try { @@ -698,6 +700,7 @@ private void connectTo(String hostname, int port) throws IOException { writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8)); inputStream = new BufferedInputStream(socket.getInputStream()); sequenceNumber = 0; + authenticated = false; sendPacket("CNT", "CON", "2WindowsWindows 10.0 (build8 3600 I-586-6-45-7 Intel Core ien-US"); } @@ -779,7 +782,7 @@ private Object parseEntity(String rawEntity) { } else { name = rawEntity.substring(senderBegin + 1, senderEnd); } - if (network == 8) { + if (network == 8 || network == 2) { // Skype4Business contacts come with network == 2, courtesy of @metasonic return skype.getUser(name); } else if (network == 19) { return skype.getGroup(name);