examples/mc_mood.lua
changeset 68 742878c74b8e
parent 67 d33ca5572e91
child 69 ab6d4ee8974c
--- a/examples/mc_mood.lua	Sat Mar 28 19:43:12 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-local lm     = require 'lm'
-local mood   = require 'mood'
-local pubsub = require 'pubsub'
-
-pubsub.handler ( 'http://jabber.org/protocol/mood',
-	function ( from, node, data )
-		if not main.yesno ( main.option ( 'lua_pep_notification' ) ) then
-			return true
-		end
-		local item = data:child ()
-		local mood, desc
-		while item do
-			if item:name () == 'text' then
-				desc = item:value ()
-			else
-				mood = item:name ()
-				-- here we can add child elements handling (by namespace)
-			end
-			item = item:next ()
-		end
-		if mood then
-			main.print_info ( from, ("Buddy's mood now %s %s"):format ( mood, desc or '' ) )
-		else
-			main.print_info ( from, "Buddy hides his mood" )
-		end
-	end )
-
-main.command ( 'mood',
-	function ( args )
-		mood.publish ( lm.connection.bless ( main.connection () ),
-			function ()
-				print ( 'Mood published' )
-			end,
-			function ( mesg )
-				print ( 'Error publishing mood: ' .. mesg )
-			end, args[1], args[2] )
-	end, true )
-
-commands_help['mood'] = "[mood [message]]\n\nPublishes your mood.\nNote, that for now it does not checks for mood validity, so, see xep0107 for valid moods."
-
-main.add_feature ( 'http://jabber.org/protocol/mood+notify' )
-main.add_feature ( 'http://jabber.org/protocol/mood' )
-
--- vim: se ts=4: --