changeset 1449:365f6db9531a

mod_statsd: Better accounting for invites, add declines
author daurnimator <quae@daurnimator.com>
date Mon, 23 Jun 2014 16:06:46 -0400
parents d722a4defea7
children 5107278268ae
files mod_statsd/mod_statsd.lua
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_statsd/mod_statsd.lua	Mon Jun 23 16:05:54 2014 -0400
+++ b/mod_statsd/mod_statsd.lua	Mon Jun 23 16:06:46 2014 -0400
@@ -56,9 +56,20 @@
 	send(prefix..clean(room_node)..".broadcast-message:1|c")
 end)
 module:hook("muc-invite", function(event)
+	-- Total count
 	send(prefix.."invite:1|c")
 	local room_node = jid.split(event.room.jid)
+	-- Counts per room
 	send(prefix..clean(room_node)..".invite:1|c")
-	local to_node, to_host, to_resource = jid.split(event.stanza.attr.to)
-	send(prefix..clean(to_node)..".invites:1|c")
+	-- Counts per recipient
+	send(prefix..clean(event.stanza.attr.to)..".invited:1|c")
 end)
+module:hook("muc-decline", function(event)
+	-- Total count
+	send(prefix.."decline:1|c")
+	local room_node = jid.split(event.room.jid)
+	-- Counts per room
+	send(prefix..clean(room_node)..".decline:1|c")
+	-- Counts per sender
+	send(prefix..clean(event.incoming.attr.from)..".declined:1|c")
+end)