mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Add support for #xmlel to parse_xdata_submit/1 and friends. This fixes
the user search in mod_vcard. SVN Revision: 1466
This commit is contained in:
parent
4a1e45070e
commit
a8ab6c1568
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
* src/mod_vcard.erl: One call to jlib:jid_to_string/1 was remaining.
|
* src/mod_vcard.erl: One call to jlib:jid_to_string/1 was remaining.
|
||||||
|
|
||||||
|
* src/jlib.erl: Add support for #xmlel to parse_xdata_submit/1 and
|
||||||
|
friends. This fixes the user search in mod_vcard.
|
||||||
|
|
||||||
2008-07-17 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-07-17 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
Merge revisions from 1444 to revision 1457 from trunk.
|
Merge revisions from 1444 to revision 1457 from trunk.
|
||||||
|
19
src/jlib.erl
19
src/jlib.erl
@ -448,6 +448,13 @@ iq_to_xml(#iq{id = ID, type = Type, sub_el = SubEl}) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
parse_xdata_submit({xmlel, _, _, _, Attrs, Els}) ->
|
||||||
|
case exmpp_xml:get_attribute_from_list(Attrs, 'type') of
|
||||||
|
"submit" ->
|
||||||
|
lists:reverse(parse_xdata_fields(Els, []));
|
||||||
|
_ ->
|
||||||
|
invalid
|
||||||
|
end;
|
||||||
parse_xdata_submit(El) ->
|
parse_xdata_submit(El) ->
|
||||||
{xmlelement, _Name, Attrs, Els} = El,
|
{xmlelement, _Name, Attrs, Els} = El,
|
||||||
case xml:get_attr_s("type", Attrs) of
|
case xml:get_attr_s("type", Attrs) of
|
||||||
@ -459,6 +466,15 @@ parse_xdata_submit(El) ->
|
|||||||
|
|
||||||
parse_xdata_fields([], Res) ->
|
parse_xdata_fields([], Res) ->
|
||||||
Res;
|
Res;
|
||||||
|
parse_xdata_fields([{xmlel, _, _, 'field', Attrs, SubEls} | Els],
|
||||||
|
Res) ->
|
||||||
|
case exmpp_xml:get_attribute_from_list(Attrs, 'var') of
|
||||||
|
"" ->
|
||||||
|
parse_xdata_fields(Els, Res);
|
||||||
|
Var ->
|
||||||
|
Field = {Var, lists:reverse(parse_xdata_values(SubEls, []))},
|
||||||
|
parse_xdata_fields(Els, [Field | Res])
|
||||||
|
end;
|
||||||
parse_xdata_fields([{xmlelement, Name, Attrs, SubEls} | Els], Res) ->
|
parse_xdata_fields([{xmlelement, Name, Attrs, SubEls} | Els], Res) ->
|
||||||
case Name of
|
case Name of
|
||||||
"field" ->
|
"field" ->
|
||||||
@ -478,6 +494,9 @@ parse_xdata_fields([_ | Els], Res) ->
|
|||||||
|
|
||||||
parse_xdata_values([], Res) ->
|
parse_xdata_values([], Res) ->
|
||||||
Res;
|
Res;
|
||||||
|
parse_xdata_values([{xmlel, _, _, 'value', _, SubEls} | Els], Res) ->
|
||||||
|
Val = exmpp_xml:get_cdata_from_list_as_list(SubEls),
|
||||||
|
parse_xdata_values(Els, [Val | Res]);
|
||||||
parse_xdata_values([{xmlelement, Name, _Attrs, SubEls} | Els], Res) ->
|
parse_xdata_values([{xmlelement, Name, _Attrs, SubEls} | Els], Res) ->
|
||||||
case Name of
|
case Name of
|
||||||
"value" ->
|
"value" ->
|
||||||
|
Loading…
Reference in New Issue
Block a user