From 28d302ad3b63a3de815a72e3fbfe45588eccbcbe Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 20 Jul 2021 12:51:47 -0500 Subject: [PATCH] Fix sending to MUC --- config.dhall.sample | 2 +- sgx_jmp.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config.dhall.sample b/config.dhall.sample index 9b87d0a..e8b9fd2 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -39,7 +39,7 @@ xep0157 = [ { var = "support-addresses", value = "xmpp:+14169938000@cheogram.com" } ], - notify_admin = "muc_or_user@example.com", + notify_admin = "muc@example.com", sip_host = "sip.jmp.chat", plans = [ { diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 89fbbcd..193f194 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -170,7 +170,7 @@ end # Ignore messages to component # Especially if we have the component join MUC for notifications -message(to: /\A#{CONFIG[:component][:jid]}\Z/) {} +message(to: /\A#{CONFIG[:component][:jid]}\Z/) { true } def billable_message(m) !m.body.empty? || m.find("ns:x", ns: OOB.registered_ns).first @@ -186,8 +186,7 @@ message do |m| id: customer.customer_id, jid: m.from.stripped.to_s ) EMPromise.all([ - customer, - (customer.incr_message_usage if billable_message(m)), + customer, (customer.incr_message_usage if billable_message(m)), REDIS.exists("jmp_usage_notify-#{customer.customer_id}"), customer.stanza_from(m) ]) @@ -200,7 +199,8 @@ message do |m| BLATHER.join(CONFIG[:notify_admin], "sgx-jmp") BLATHER.say( CONFIG[:notify_admin], - "#{customer.customer_id} has used #{usage} messages since #{today - 30}" + "#{customer.customer_id} has used #{usage} messages since #{today - 30}", + :groupchat ) REDIS.set("jmp_usage_notify-#{customer.customer_id}", ex: 60 * 60 * 24) end -- 2.38.5