Skip to content

Commit

Permalink
send message ack causing dead sessions too
Browse files Browse the repository at this point in the history
  • Loading branch information
Darker935 authored Jun 24, 2024
1 parent 4b946fb commit ab852ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/it/auties/whatsapp/socket/SocketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -751,15 +751,18 @@ private List<Node> toMessagesNode(List<String> messages) {

protected CompletableFuture<Void> sendMessageAck(Jid from, Node node) {
var attrs = node.attributes();
var to = from.withAgent(null);
var participant = attrs.getNullableString("participant");
var recipient = attrs.getNullableString("recipient");
var type = attrs.getOptionalString("type")
.filter(entry -> !Objects.equals(entry, "message"))
.orElse(null);
var attributes = Attributes.of()
.put("id", node.id())
.put("to", from)
.put("class", node.description())
.put("participant", attrs.getNullableString("participant"), Objects::nonNull)
.put("recipient", attrs.getNullableString("recipient"), Objects::nonNull)
.put("participant", Jid.of(participant).withAgent(null), Objects.nonNull(participant))
.put("recipient", Jid.of(recipient).withAgent(null), Objects.nonNull(recipient))
.put("type", type, Objects::nonNull)
.toMap();
return sendNodeWithNoResponse(Node.of("ack", attributes));
Expand Down

0 comments on commit ab852ca

Please sign in to comment.