examples/xep0163.lua
changeset 34 8206d7cb1447
parent 32 524fde5be49a
child 35 8deda77c72e5
equal deleted inserted replaced
33:db5396037b43 34:8206d7cb1447
   264 				print ( "Tune notifications disabled" )
   264 				print ( "Tune notifications disabled" )
   265 			end
   265 			end
   266 		else
   266 		else
   267 			enable_tune ( enable )
   267 			enable_tune ( enable )
   268 		end
   268 		end
   269 	end, 'yesno' )
   269 	end, false, 'yesno' )
   270 main.command ( 'mood',
   270 main.command ( 'mood',
   271 	function ( args )
   271 	function ( args )
   272 		args = main.parse_args ( args )
       
   273 		local data = { }
   272 		local data = { }
   274 		local mood, text = args[1], args[2]
   273 		local mood, text = args[1], args[2]
   275 		if text then
   274 		if text then
   276 			data.text  = { text }
   275 			data.text  = { text }
   277 		end
   276 		end
   278 		if mood then
   277 		if mood then
   279 			data[mood] = { }
   278 			data[mood] = { }
   280 		end
   279 		end
   281 		pep_publish ( 'mood', data )
   280 		pep_publish ( 'mood', data )
   282 	end )
   281 	end, true )
   283 main.command ( 'activity',
   282 main.command ( 'activity',
   284 	function ( args )
   283 	function ( args )
   285 		args = main.parse_args ( args )
       
   286 		local data = { }
   284 		local data = { }
   287 		local activity, text = args[1], args[2]
   285 		local activity, text = args[1], args[2]
   288 		if text then
   286 		if text then
   289 			data.text = { text }
   287 			data.text = { text }
   290 		end
   288 		end
   297 			if subact then
   295 			if subact then
   298 				data[act][subact] = { }
   296 				data[act][subact] = { }
   299 			end
   297 			end
   300 		end
   298 		end
   301 		pep_publish ( 'activity', data )
   299 		pep_publish ( 'activity', data )
   302 	end )
   300 	end, true )
   303 main.command ( 'location',
   301 main.command ( 'location',
   304 	function ( args )
   302 	function ( args )
   305 		args = main.parse_args ( args )
       
   306 		local data = { }
   303 		local data = { }
   307 		for key, val in pairs ( args ) do
   304 		for key, val in pairs ( args ) do
   308 			data[key] = { val }
   305 			data[key] = { val }
   309 		end
   306 		end
   310 		pep_publish ( 'geoloc', data )
   307 		pep_publish ( 'geoloc', data )
   311 	end )
   308 	end, true )
   312 
   309 
   313 commands_help['tune']     = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables publishing of notifications about playing music in your player (currently only mpd is supported)."
   310 commands_help['tune']     = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables publishing of notifications about playing music in your player (currently only mpd is supported)."
   314 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."
   311 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."
   315 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."
   312 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."
   316 commands_help['location'] = "[-key value [-key value ...]]\n\nPublishes your current geolocation.\nValid keys are accuracy, alt, area, bearing, building, country, datum, description, error, floor, lat, locality, lon, postalcode, region, room, speed, street, text, timestamp and uri, according to xep0080."
   313 commands_help['location'] = "[-key value [-key value ...]]\n\nPublishes your current geolocation.\nValid keys are accuracy, alt, area, bearing, building, country, datum, description, error, floor, lat, locality, lon, postalcode, region, room, speed, street, text, timestamp and uri, according to xep0080."