Fix sending to MUC

Stephen Paul Weber created

Change summary

config.dhall.sample | 2 +-
sgx_jmp.rb          | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

Detailed changes

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 = [
 		{

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