--- a/examples/pep.lua Mon Mar 23 02:01:16 2009 +0200
+++ b/examples/pep.lua Mon Mar 23 02:04:43 2009 +0200
@@ -13,16 +13,14 @@
handlers = {},
}
-function pep.publish ( conn, node, data, success, fail )
+function pep.publish ( conn, node, item, success, fail )
-- local bjid = conn:jid():gsub ( '/.*', '' )
- data.xmlns = 'http://jabber.org/protocol/' .. node
+-- item.id = 'current'
iq.send ( conn, nil, 'set',
{
pubsub = { xmlns = 'http://jabber.org/protocol/pubsub',
- publish = { node = 'http://jabber.org/protocol/' .. node,
- item = { -- id = "current",
- [node] = data,
- },
+ publish = { node = node,
+ item = item,
},
},
--[[
@@ -233,7 +231,8 @@
local function mpd_callback ()
local sdata = mpd_getstatus ()
if sdata then
- pep.publish ( lm.connection.bless ( main.connection () ), 'tune', sdata, dummy, dummy )
+ sdata.xmlns = 'http://jabber.org/protocol/tune'
+ pep.publish ( lm.connection.bless ( main.connection () ), 'http://jabber.org/protocol/tune', { tune = sdata }, dummy, dummy )
end
if tune_enabled then
return true
@@ -276,7 +275,7 @@
end, false, 'yesno' )
main.command ( 'mood',
function ( args )
- local data = { }
+ local data = { xmlns = 'http://jabber.org/protocol/mood' }
local mood, text = args[1], args[2]
if text then
data.text = { text }
@@ -284,11 +283,11 @@
if mood then
data[mood] = { }
end
- pep.publish ( lm.connection.bless ( main.connection () ), 'mood', data, dummy, dummy )
+ pep.publish ( lm.connection.bless ( main.connection () ), 'http://jabber.org/protocol/mood', { mood = data }, dummy, dummy )
end, true )
main.command ( 'activity',
function ( args )
- local data = { }
+ local data = { xmlns = 'http://jabber.org/protocol/activity' }
local activity, text = args[1], args[2]
if text then
data.text = { text }
@@ -303,15 +302,15 @@
data[act][subact] = { }
end
end
- pep.publish ( lm.connection.bless ( main.connection () ), 'activity', data, dummy, dummy )
+ pep.publish ( lm.connection.bless ( main.connection () ), 'http://jabber.org/protocol/activity', { activity = data }, dummy, dummy )
end, true )
main.command ( 'location',
function ( args )
- local data = { }
+ local data = { xmlns = 'http://jabber.org/protocol/geoloc' }
for key, val in pairs ( args ) do
data[key] = { val }
end
- pep.publish ( lm.connection.bless ( main.connection () ), 'geoloc', data, dummy, dummy )
+ pep.publish ( lm.connection.bless ( main.connection () ), 'http://jabber.org/protocol/geoloc', { geoloc = data }, dummy, dummy )
end, true )
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)."