Skip to content

Commit

Permalink
delthas#30 delthas#43 Solved 911 error messages on login; Solved infi…
Browse files Browse the repository at this point in the history
…nite loop on login for some accounts; Added condition for skype4business contacts
  • Loading branch information
haroflow authored and fabiodepin committed Jun 30, 2018
1 parent c14d2d7 commit bd951a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/fr/delthas/skype/NotifConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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", "<connect><ver>2</ver><agent><os>Windows</os><osVer>Windows 10.0 (build</osVer><proc>8 3600 I-586-6-45-7 Intel Core i</proc><lcid>en-US</lcid></agent></connect>");
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bd951a1

Please sign in to comment.