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