Skip to content

Commit

Permalink
Adding support to LIDs
Browse files Browse the repository at this point in the history
Idk if it's the best and correct way to identify lids, but I noticed that when a JID comes with `agent: 1` it's a lid

Ps: not every LID comes with `agent: 1`, but every `agent: 1` is a lid
  • Loading branch information
Darker935 authored Jun 16, 2024
1 parent 6c9b930 commit 484aaee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/it/auties/whatsapp/model/jid/Jid.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public record Jid(String user, JidServer server, Integer device, Integer agent)
*/
public Jid(String user, JidServer server, Integer device, Integer agent) {
this.user = user != null && user.startsWith("+") ? user.substring(1) : user;
this.server = server;
this.server = agent != null && agent == 1 ? JidServer.LID : server;
this.device = device;
this.agent = agent;
}
Expand Down Expand Up @@ -274,4 +274,4 @@ public boolean hasAgent() {
public int hashCode() {
return Objects.hashCode(toString());
}
}
}

0 comments on commit 484aaee

Please sign in to comment.