M config.dhall.sample => config.dhall.sample +1 -1
@@ 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 = [
{
M sgx_jmp.rb => sgx_jmp.rb +4 -4
@@ 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