--- a/lm.lua Sun Apr 05 14:55:51 2009 +0300
+++ b/lm.lua Sun Apr 05 16:55:48 2009 +0300
@@ -153,83 +153,9 @@
end
end
---[=[
--- recursively fills a node, see lm.message.create
-function lm.message_node.fill ( n, a )
- for name, value in pairs ( a ) do
- if type ( value ) == "table" then
- if type ( value[1] ) == "table" then
- for index, instance in ipairs ( value ) do
- lm.message_node.fill ( n:child ( name, "" ), instance )
- end
- else
- lm.message_node.fill ( n:child ( name, "" ), value )
- end
- elseif name == 1 then
- n:value ( value )
- else
- n:attribute ( name, value )
- end
- end
-end
---[[
--- recursively fills a message
-lm.message.create { mtype = 'iq-result', to = 'foo@bar.xyz',
- command = { xmlns = 'http://jabber.org/protocol/commands', node = 'http://jabber.org/protocol/rc#set-status', status = 'executing', sessionid = 'set-status:aaa3',
- x = { xmlns = 'jabber:x:data', type = 'form',
- title = { "Change Status" },
- instructions = { "Choose the status and status message" },
- field = {{ type = 'hidden', var = 'FORM_TYPE',
- value = { "http://jabber.org/protocol/rc" },
- },{ type = 'list-single', label = 'Status', var = 'status',
- required = { },
- value = { "online" },
- option = {{ label = 'Chat',
- value = { "chat" },
- },{ label = 'Online',
- value = { "online" },
- },{ label = 'Away',
- value = { "away" },
- },{ label = 'Extended Away',
- value = { "xa" },
- },{ label = 'Do Not Disturb',
- value = { "dnd" },
- },{ label = 'Invisible',
- value = { "invisible" },
- },{ label = 'Offline',
- value = { "offline" },
- }},
- },{ type = 'text-single', label = 'Priority', var = 'status-priority',
- value = { "5" },
- },{ type = 'text-multi', label = 'Message', var = 'status-message' }},
- },
- },
-}
---]]
-function lm.message.create ( a )
- if type ( a ) ~= "table" then
- error "table expected as argument"
- end
- if not a.mtype then
- error "you must specify message type"
- end
- local mtype, subtype = a.mtype:match ( "(.-)%-(.+)" )
- local m
- if not mtype then
- m = lm.message.new ( a.to, a.mtype )
- else
- m = lm.message.new ( a.to, mtype, subtype )
- end
- a.to = nil
- a.mtype = nil
- lm.message_node.fill ( m, a )
- return m
-end
---]=]
-
-- TODO: multiple nodes with same name
function lm.message_node.parse ( node, r )
- local n = node:children ()
+ local n = node:child ()
while n do
local name = n:name ()
r[name] = { }
--- a/lm_message.c Sun Apr 05 14:55:51 2009 +0300
+++ b/lm_message.c Sun Apr 05 16:55:48 2009 +0300
@@ -13,7 +13,7 @@
/// Module, representing individual message.
/// Message have a type and optionally a sub type.
/// Message have a set common methods with message node,
-/// these are name, next, prev, children, parent, value, child,
+/// these are name, next, prev, parent, value, child,
/// find_child, attribute, raw, xml and path. They just save
/// you typing :node() each time and save memory for
/// one node object.
@@ -263,7 +263,6 @@
{ "name", name_lm_node },
{ "next", next_lm_node },
{ "prev", prev_lm_node },
- { "children", children_lm_node },
{ "parent", parent_lm_node },
{ "value", value_lm_node },
{ "child", child_lm_node },
--- a/lm_message_node.c Sun Apr 05 14:55:51 2009 +0300
+++ b/lm_message_node.c Sun Apr 05 16:55:48 2009 +0300
@@ -59,22 +59,6 @@
return 1;
}
-/// message_node:children
-/// Gets first child node (raw access used).
-/// Note: this method is deprecated and soon will be removed.
-/// Use child without arguments instead.
-/// R: lm message node object or nil
-int children_lm_node (lua_State *L)
-{
- LmMessageNode *node = luaL_checkLmMessageNode (L, 1);
- LmMessageNode *child = node->children;
- if (child)
- bless_lm_node (L, child);
- else
- lua_pushnil (L);
- return 1;
-}
-
/// message_node:parent
/// Gets parent message node.
/// R: lm message node object or nil
@@ -245,7 +229,6 @@
{ "name", name_lm_node },
{ "next", next_lm_node },
{ "prev", prev_lm_node },
- { "children", children_lm_node },
{ "parent", parent_lm_node },
{ "value", value_lm_node },
{ "child", child_lm_node },
--- a/lm_message_node.h Sun Apr 05 14:55:51 2009 +0300
+++ b/lm_message_node.h Sun Apr 05 16:55:48 2009 +0300
@@ -7,7 +7,6 @@
int name_lm_node (lua_State *L);
int next_lm_node (lua_State *L);
int prev_lm_node (lua_State *L);
-int children_lm_node (lua_State *L);
int parent_lm_node (lua_State *L);
int value_lm_node (lua_State *L);
int child_lm_node (lua_State *L);