aports/testing/perl-anyevent-xmpp/delivery-receipt-1.patch
2024-01-06 22:13:39 +00:00

46 lines
2.3 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Patch-Source: https://github.com/AnyEvent-XMPP/AnyEvent-XMPP/commit/9106dcd0a294dd6329d5e0883da757a1da176c0a.patch
--
From 9106dcd0a294dd6329d5e0883da757a1da176c0a Mon Sep 17 00:00:00 2001
From: jlfranklin <franklin@sentaidigital.com>
Date: Mon, 9 May 2016 10:28:04 -0400
Subject: [PATCH] Always send a delivery receipt request, but only re-send the
message if we know they support receipts. (#7)
---
lib/AnyEvent/XMPP/Ext/Receipts.pm | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/lib/AnyEvent/XMPP/Ext/Receipts.pm b/lib/AnyEvent/XMPP/Ext/Receipts.pm
index 82c2cbe..ebee4fb 100644
--- a/lib/AnyEvent/XMPP/Ext/Receipts.pm
+++ b/lib/AnyEvent/XMPP/Ext/Receipts.pm
@@ -168,18 +168,6 @@ sub init {
ext_before_send_message_hook => sub {
my ($self, $con, $id, $to, $type, $attrs, $create_cb) = @_;
- # We can only handle full jids as per XEP-0184 5.1:
- # "If the sender knows only the recipient's bare JID, it cannot
- # cannot determine [...] whether the intended recipient supports
- # the Message Delivery Receipts protoocl. [...] the sender MUST NOT
- # depend on receiving an ack message in reply."
- # If we cant rely on ack messages, receipts are useless.
- return if is_bare_jid($to);
-
- # If we have already figured out that the recipient does not
- # support message receipts, sending them (and especially waiting
- # for acknowledge) is pointless.
- return if exists($supports_receipts{$to}) && !$supports_receipts{$to};
# If this is a message receipt (sent by us), do not add a receipt
# request, that might lead to an endless loop.
@@ -200,7 +188,8 @@ sub init {
$w->endTag;
};
- if ($self->{auto_resend} > 0) {
+ # Only resend when we know they support delivery receipts
+ if (exists($supports_receipts{$to}) && !$supports_receipts{$to} && ($self->{auto_resend} > 0)) {
print "(xep0184) expecting reply within " . $self->{auto_resend} . "s\n" if $self->{debug};
# This timer will be deleted when the recipient acknowledges the
# message. Otherwise, it re-sends the message.