From 3dfa8c7e6bdca5114f2e1effdf468e4395664e73 Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Thu, 5 Feb 2026 13:34:00 -0500 Subject: [PATCH] apply-hotfix: shuffle handling of message-failed this does not change any functionality, it removes a case where we initially lie about which values is `others_num` --- sgx-bwmsgsv2.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 6a8e9b45c2dd85fa723d270ed135bce7e78b5d1c..f1955bfc00dc0b4decdf03426417f8ca6a84e656 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -997,10 +997,13 @@ class WebhookHandler < Goliath::API return [400, {}, "Missing params\n"] unless jparams && type - users_num, others_num = if jparams['direction'] == 'in' + users_num, others_num = + if type == 'message-failed' # NOTE: This implies direction == 'out' + [jparams['from'], params['_json'][0]['to']] + elsif jparams['direction'] == 'in' [jparams['owner'], jparams['from']] elsif jparams['direction'] == 'out' - [jparams['from'], jparams['owner']] + [jparams['from'], jparams['owner']] # NOTE: for outbound, 'from' == 'owner' else puts "big prob: '#{jparams['direction']}'" return [400, {}, "OK"] @@ -1125,11 +1128,9 @@ class WebhookHandler < Goliath::API msg = msg.as_error( 'recipient-unavailable', :wait, - jparams['description'] + params['_json'][0]['description'] ) - # TODO: make prettier: this should be done above - others_num = params['_json'][0]['to'] when 'message-delivered' msg = ReceiptMessage.new(bare_jid)