mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Port to latest exmpp changes (attribute names as binary()).
All atributes are now binary() instead of atoms.
This commit is contained in:
parent
f9e2466867
commit
ef572c815f
@ -43,9 +43,9 @@ parse_request(#iq{type = Type, ns = NS, payload = SubEl, lang = Lang}) ->
|
|||||||
case {Type, NS} of
|
case {Type, NS} of
|
||||||
{set, ?NS_ADHOC} ->
|
{set, ?NS_ADHOC} ->
|
||||||
?DEBUG("entering parse_request...", []),
|
?DEBUG("entering parse_request...", []),
|
||||||
Node = exmpp_xml:get_attribute_as_list(SubEl, 'node', ""),
|
Node = exmpp_xml:get_attribute_as_list(SubEl, <<"node">>, ""),
|
||||||
SessionID = exmpp_xml:get_attribute_as_list(SubEl, 'sessionid', ""),
|
SessionID = exmpp_xml:get_attribute_as_list(SubEl, <<"sessionid">>, ""),
|
||||||
Action = exmpp_xml:get_attribute_as_list(SubEl, 'action', ""),
|
Action = exmpp_xml:get_attribute_as_list(SubEl, <<"action">>, ""),
|
||||||
XData = find_xdata_el(SubEl),
|
XData = find_xdata_el(SubEl),
|
||||||
AllEls = exmpp_xml:get_child_elements(SubEl),
|
AllEls = exmpp_xml:get_child_elements(SubEl),
|
||||||
Others = case XData of
|
Others = case XData of
|
||||||
@ -114,7 +114,7 @@ produce_response(#adhoc_response{lang = _Lang,
|
|||||||
"" ->
|
"" ->
|
||||||
ActionsElAttrs = [];
|
ActionsElAttrs = [];
|
||||||
_ ->
|
_ ->
|
||||||
ActionsElAttrs = [?XMLATTR('execute', DefaultAction)]
|
ActionsElAttrs = [?XMLATTR(<<"execute">>, DefaultAction)]
|
||||||
end,
|
end,
|
||||||
ActionsEls = [#xmlel{ns = ?NS_ADHOC, name = 'actions', attrs =
|
ActionsEls = [#xmlel{ns = ?NS_ADHOC, name = 'actions', attrs =
|
||||||
ActionsElAttrs, children =
|
ActionsElAttrs, children =
|
||||||
@ -122,11 +122,11 @@ produce_response(#adhoc_response{lang = _Lang,
|
|||||||
end,
|
end,
|
||||||
NotesEls = lists:map(fun({Type, Text}) ->
|
NotesEls = lists:map(fun({Type, Text}) ->
|
||||||
#xmlel{ns = ?NS_ADHOC, name = 'note', attrs =
|
#xmlel{ns = ?NS_ADHOC, name = 'note', attrs =
|
||||||
[?XMLATTR('type', Type)],
|
[?XMLATTR(<<"type">>, Type)],
|
||||||
children = [#xmlcdata{cdata = list_to_binary(Text)}]}
|
children = [#xmlcdata{cdata = list_to_binary(Text)}]}
|
||||||
end, Notes),
|
end, Notes),
|
||||||
#xmlel{ns = ?NS_ADHOC, name = 'command', attrs =
|
#xmlel{ns = ?NS_ADHOC, name = 'command', attrs =
|
||||||
[?XMLATTR('sessionid', SessionID),
|
[?XMLATTR(<<"sessionid">>, SessionID),
|
||||||
?XMLATTR('node', Node),
|
?XMLATTR(<<"node">>, Node),
|
||||||
?XMLATTR('status', Status)], children =
|
?XMLATTR(<<"status">>, Status)], children =
|
||||||
ActionsEls ++ NotesEls ++ Elements}.
|
ActionsEls ++ NotesEls ++ Elements}.
|
||||||
|
@ -1256,17 +1256,17 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
|
|||||||
?DEBUG("broadcast~n~p~n", [Packet#xmlel.children]),
|
?DEBUG("broadcast~n~p~n", [Packet#xmlel.children]),
|
||||||
case Packet#xmlel.ns of
|
case Packet#xmlel.ns of
|
||||||
roster_item ->
|
roster_item ->
|
||||||
IJID = exmpp_jid:make(exmpp_xml:get_attribute(Packet, u, <<"">>),
|
IJID = exmpp_jid:make(exmpp_xml:get_attribute(Packet, <<"u">>, <<"">>),
|
||||||
exmpp_xml:get_attribute(Packet, s, <<"">>),
|
exmpp_xml:get_attribute(Packet, <<"s">>, <<"">>),
|
||||||
exmpp_xml:get_attribute(Packet, r, <<"">>)),
|
exmpp_xml:get_attribute(Packet, <<"r">>, <<"">>)),
|
||||||
ISubscription = exmpp_xml:get_attribute(Packet, subs, <<"none">>),
|
ISubscription = exmpp_xml:get_attribute(Packet, <<"subs">>, <<"none">>),
|
||||||
{false, Attrs,
|
{false, Attrs,
|
||||||
roster_change(IJID, ISubscription, StateData)};
|
roster_change(IJID, ISubscription, StateData)};
|
||||||
exit ->
|
exit ->
|
||||||
Reason = exmpp_xml:get_attribute_as_list(Packet, reason, "Unknown reason"),
|
Reason = exmpp_xml:get_attribute_as_list(Packet, <<"reason">>, "Unknown reason"),
|
||||||
{exit, Attrs, Reason};
|
{exit, Attrs, Reason};
|
||||||
privacy_list ->
|
privacy_list ->
|
||||||
PrivListName = exmpp_xml:get_attribute_as_list(Packet, list_name, "Unknown list name"),
|
PrivListName = exmpp_xml:get_attribute_as_list(Packet, <<"list_name">>, "Unknown list name"),
|
||||||
CDataString = exmpp_xml:get_cdata_as_list(Packet),
|
CDataString = exmpp_xml:get_cdata_as_list(Packet),
|
||||||
{ok, A2, _} = erl_scan:string(CDataString),
|
{ok, A2, _} = erl_scan:string(CDataString),
|
||||||
{_, W} = erl_parse:parse_exprs(A2),
|
{_, W} = erl_parse:parse_exprs(A2),
|
||||||
@ -1516,22 +1516,22 @@ send_header(StateData, Server, Version, Lang)
|
|||||||
VersionAttr =
|
VersionAttr =
|
||||||
case Version of
|
case Version of
|
||||||
"" -> [];
|
"" -> [];
|
||||||
_ -> [{"version", Version}]
|
_ -> [?XMLATTR(<<"version">>, Version)]
|
||||||
end,
|
end,
|
||||||
LangAttr =
|
LangAttr =
|
||||||
case Lang of
|
case Lang of
|
||||||
"" -> [];
|
"" -> [];
|
||||||
_ -> [{"xml:lang", Lang}]
|
_ -> [?XMLATTR(<<"xml:lang">>, Lang)]
|
||||||
end,
|
end,
|
||||||
Header =
|
Header =
|
||||||
{xmlstreamstart,
|
{xmlstreamstart,
|
||||||
"stream:stream",
|
"stream:stream",
|
||||||
VersionAttr ++
|
VersionAttr ++
|
||||||
LangAttr ++
|
LangAttr ++
|
||||||
[{"xmlns", "jabber:client"},
|
[?XMLATTR(<<"xmlns">>, "jabber:client"),
|
||||||
{"xmlns:stream", "http://etherx.jabber.org/streams"},
|
?XMLATTR(<<"xmlns:stream">>, "http://etherx.jabber.org/streams"),
|
||||||
{"id", StateData#state.streamid},
|
?XMLATTR(<<"id">>, StateData#state.streamid),
|
||||||
{"from", Server}]},
|
?XMLATTR(<<"from">>, Server)]},
|
||||||
(StateData#state.sockmod):send_xml(
|
(StateData#state.sockmod):send_xml(
|
||||||
StateData#state.socket, Header);
|
StateData#state.socket, Header);
|
||||||
send_header(StateData, Server, Version, Lang) ->
|
send_header(StateData, Server, Version, Lang) ->
|
||||||
|
@ -64,10 +64,10 @@
|
|||||||
-define(VFIELD(Type, Var, Value),
|
-define(VFIELD(Type, Var, Value),
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = Type
|
value = Type
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'var',
|
#xmlattr{name = <<"var">>,
|
||||||
value = Var
|
value = Var
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -111,13 +111,13 @@ create_captcha(SID, From, To, Lang, Args)
|
|||||||
name = 'data',
|
name = 'data',
|
||||||
ns = ?NS_BOB,
|
ns = ?NS_BOB,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'cid',
|
#xmlattr{name = <<"cid">>,
|
||||||
value = CID
|
value = CID
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'max-age',
|
#xmlattr{name = <<"max-age">>,
|
||||||
value = <<"0">>
|
value = <<"0">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = Type
|
value = Type
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -142,7 +142,7 @@ create_captcha(SID, From, To, Lang, Args)
|
|||||||
#xmlel{name = 'x',
|
#xmlel{name = 'x',
|
||||||
ns = ?NS_DATA_FORMS_s,
|
ns = ?NS_DATA_FORMS_s,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"form">>
|
value = <<"form">>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -153,10 +153,10 @@ create_captcha(SID, From, To, Lang, Args)
|
|||||||
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
|
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'var',
|
#xmlattr{name = <<"var">>,
|
||||||
value = <<"ocr">>
|
value = <<"ocr">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'label',
|
#xmlattr{name = <<"label">>,
|
||||||
value = ?CAPTCHA_TEXT(Lang)
|
value = ?CAPTCHA_TEXT(Lang)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -167,7 +167,7 @@ create_captcha(SID, From, To, Lang, Args)
|
|||||||
children = [
|
children = [
|
||||||
#xmlel{name = 'uri',
|
#xmlel{name = 'uri',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = Type
|
value = Type
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -229,13 +229,13 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
|
|||||||
name = 'data',
|
name = 'data',
|
||||||
ns = ?NS_BOB,
|
ns = ?NS_BOB,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'cid',
|
#xmlattr{name = <<"cid">>,
|
||||||
value = CID
|
value = CID
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'max-age',
|
#xmlattr{name = <<"max-age">>,
|
||||||
value = <<"0">>
|
value = <<"0">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = Type
|
value = Type
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -249,25 +249,25 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
|
|||||||
#xmlel{name = 'x',
|
#xmlel{name = 'x',
|
||||||
ns = ?NS_DATA_FORMS_s,
|
ns = ?NS_DATA_FORMS_s,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"form">>
|
value = <<"form">>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
children = [
|
children = [
|
||||||
?VFIELD(<<"hidden">>, <<"FORM_TYPE">>, #xmlcdata{cdata = ?NS_CAPTCHA_b}) | HeadEls] ++ [
|
?VFIELD(<<"hidden">>, <<"FORM_TYPE">>, #xmlcdata{cdata = ?NS_CAPTCHA_b}) | HeadEls] ++ [
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"fixed">>), ?XMLATTR('label', HelpTxt)]},
|
[?XMLATTR(<<"type">>, <<"fixed">>), ?XMLATTR(<<"label">>, HelpTxt)]},
|
||||||
?VFIELD(<<"hidden">>, <<"captchahidden">>, #xmlcdata{cdata = <<"workaround-for-psi">>}),
|
?VFIELD(<<"hidden">>, <<"captchahidden">>, #xmlcdata{cdata = <<"workaround-for-psi">>}),
|
||||||
|
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"text-single">>
|
value = <<"text-single">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'label',
|
#xmlattr{name = <<"label">>,
|
||||||
value = list_to_binary(translate:translate(Lang, "CAPTCHA web page"))
|
value = list_to_binary(translate:translate(Lang, "CAPTCHA web page"))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'var',
|
#xmlattr{name = <<"var">>,
|
||||||
value = <<"url">>
|
value = <<"url">>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -281,10 +281,10 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
|
|||||||
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
|
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'var',
|
#xmlattr{name = <<"var">>,
|
||||||
value = <<"ocr">>
|
value = <<"ocr">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'label',
|
#xmlattr{name = <<"label">>,
|
||||||
value = ?CAPTCHA_TEXT(Lang)
|
value = ?CAPTCHA_TEXT(Lang)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -295,7 +295,7 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
|
|||||||
children = [
|
children = [
|
||||||
#xmlel{name = 'uri',
|
#xmlel{name = 'uri',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = Type
|
value = Type
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -329,7 +329,7 @@ build_captcha_html(Id, Lang) ->
|
|||||||
ImgEl =
|
ImgEl =
|
||||||
#xmlel{name = 'img',
|
#xmlel{name = 'img',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'src',
|
#xmlattr{name = <<"src">>,
|
||||||
value = list_to_binary(get_url(Id ++ "/image"))
|
value = list_to_binary(get_url(Id ++ "/image"))
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -342,13 +342,13 @@ build_captcha_html(Id, Lang) ->
|
|||||||
IdEl =
|
IdEl =
|
||||||
#xmlel{name = 'input',
|
#xmlel{name = 'input',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"hidden">>
|
value = <<"hidden">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'name',
|
#xmlattr{name = <<"name">>,
|
||||||
value = <<"id">>
|
value = <<"id">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'value',
|
#xmlattr{name = <<"value">>,
|
||||||
value = list_to_binary(Id)
|
value = list_to_binary(Id)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -359,13 +359,13 @@ build_captcha_html(Id, Lang) ->
|
|||||||
KeyEl =
|
KeyEl =
|
||||||
#xmlel{name = 'input',
|
#xmlel{name = 'input',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"text">>
|
value = <<"text">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'name',
|
#xmlattr{name = <<"name">>,
|
||||||
value = <<"key">>
|
value = <<"key">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'size',
|
#xmlattr{name = <<"size">>,
|
||||||
value = <<"10">>
|
value = <<"10">>
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -387,13 +387,13 @@ build_captcha_html(Id, Lang) ->
|
|||||||
FormEl =
|
FormEl =
|
||||||
#xmlel{name = 'form',
|
#xmlel{name = 'form',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'action',
|
#xmlattr{name = <<"action">>,
|
||||||
value = list_to_binary(get_url(Id))
|
value = list_to_binary(get_url(Id))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'name',
|
#xmlattr{name = <<"name">>,
|
||||||
value = <<"captcha">>
|
value = <<"captcha">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'method',
|
#xmlattr{name = <<"method">>,
|
||||||
value = <<"POST">>
|
value = <<"POST">>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -410,13 +410,13 @@ build_captcha_html(Id, Lang) ->
|
|||||||
},
|
},
|
||||||
#xmlel{name = 'input',
|
#xmlel{name = 'input',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
value = <<"submit">>
|
value = <<"submit">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'name',
|
#xmlattr{name = <<"name">>,
|
||||||
value = <<"enter">>
|
value = <<"enter">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'value',
|
#xmlattr{name = <<"value">>,
|
||||||
value = <<"OK">>
|
value = <<"OK">>
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -481,7 +481,7 @@ process(_Handlers, #request{method='GET', lang=Lang, path=[_, Id]}) ->
|
|||||||
%[FormEl]},
|
%[FormEl]},
|
||||||
#xmlel{name = 'div',
|
#xmlel{name = 'div',
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'align',
|
#xmlattr{name = <<"align">>,
|
||||||
value = <<"center">>
|
value = <<"center">>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -123,13 +123,13 @@ process_element(El=#xmlel{name=user, ns=_XMLNS},
|
|||||||
State;
|
State;
|
||||||
|
|
||||||
process_element(H=#xmlel{name=host},State) ->
|
process_element(H=#xmlel{name=host},State) ->
|
||||||
State#parsing_state{host=exmpp_xml:get_attribute(H,"jid",none)};
|
State#parsing_state{host=exmpp_xml:get_attribute(H,<<"jid">>,none)};
|
||||||
|
|
||||||
process_element(#xmlel{name='server-data'},State) ->
|
process_element(#xmlel{name='server-data'},State) ->
|
||||||
State;
|
State;
|
||||||
|
|
||||||
process_element(El=#xmlel{name=include, ns=?NS_XINCLUDE}, State=#parsing_state{dir=Dir}) ->
|
process_element(El=#xmlel{name=include, ns=?NS_XINCLUDE}, State=#parsing_state{dir=Dir}) ->
|
||||||
case exmpp_xml:get_attribute(El, href, none) of
|
case exmpp_xml:get_attribute(El, <<"href">>, none) of
|
||||||
none ->
|
none ->
|
||||||
ok;
|
ok;
|
||||||
HrefB ->
|
HrefB ->
|
||||||
@ -158,8 +158,8 @@ process_element(El,State) ->
|
|||||||
%%%% Add user
|
%%%% Add user
|
||||||
|
|
||||||
add_user(El, Domain) ->
|
add_user(El, Domain) ->
|
||||||
User = exmpp_xml:get_attribute(El,name,none),
|
User = exmpp_xml:get_attribute(El,<<"name">>,none),
|
||||||
Password = exmpp_xml:get_attribute(El,password,none),
|
Password = exmpp_xml:get_attribute(El,<<"password">>,none),
|
||||||
add_user(El, Domain, User, Password).
|
add_user(El, Domain, User, Password).
|
||||||
|
|
||||||
%% @spec (El::xmlel(), Domain::string(), User::string(), Password::string())
|
%% @spec (El::xmlel(), Domain::string(), User::string(), Password::string())
|
||||||
@ -301,7 +301,7 @@ populate_user(User,Domain,El=#xmlel{name='offline-messages'}) ->
|
|||||||
fun (_Element, {xmlcdata, _}) ->
|
fun (_Element, {xmlcdata, _}) ->
|
||||||
ok;
|
ok;
|
||||||
(_Element, Child) ->
|
(_Element, Child) ->
|
||||||
From = exmpp_xml:get_attribute(Child,from,none),
|
From = exmpp_xml:get_attribute(Child,<<"from">>,none),
|
||||||
FullFrom = exmpp_jid:parse(From),
|
FullFrom = exmpp_jid:parse(From),
|
||||||
FullUser = exmpp_jid:make(User, Domain),
|
FullUser = exmpp_jid:make(User, Domain),
|
||||||
_R = M:store_packet(FullFrom, FullUser, Child)
|
_R = M:store_packet(FullFrom, FullUser, Child)
|
||||||
@ -558,7 +558,7 @@ mnesia_pop_offline_messages(Ls, User, Server) ->
|
|||||||
fun(R) ->
|
fun(R) ->
|
||||||
[Packet] = exmpp_xml:parse_document(R#offline_msg.packet, [names_as_atom]),
|
[Packet] = exmpp_xml:parse_document(R#offline_msg.packet, [names_as_atom]),
|
||||||
FromString = exmpp_jid:prep_to_list(R#offline_msg.from),
|
FromString = exmpp_jid:prep_to_list(R#offline_msg.from),
|
||||||
Packet2 = exmpp_xml:set_attribute(Packet, "from", FromString),
|
Packet2 = exmpp_xml:set_attribute(Packet, <<"from">>, FromString),
|
||||||
Packet3 = Packet2#xmlel{ns = ?NS_JABBER_CLIENT},
|
Packet3 = Packet2#xmlel{ns = ?NS_JABBER_CLIENT},
|
||||||
exmpp_xml:append_children(
|
exmpp_xml:append_children(
|
||||||
Packet3,
|
Packet3,
|
||||||
|
@ -443,7 +443,6 @@ new_xmlstream(C2SPid, MaxStanzaSize) ->
|
|||||||
Parser = exmpp_xml:start_parser([{names_as_atom, true},
|
Parser = exmpp_xml:start_parser([{names_as_atom, true},
|
||||||
{check_nss, xmpp},
|
{check_nss, xmpp},
|
||||||
{check_elems, xmpp},
|
{check_elems, xmpp},
|
||||||
{check_attrs, xmpp},
|
|
||||||
{max_size, MaxStanzaSize}
|
{max_size, MaxStanzaSize}
|
||||||
]),
|
]),
|
||||||
exmpp_xmlstream:start({gen_fsm, C2SPid}, Parser,
|
exmpp_xmlstream:start({gen_fsm, C2SPid}, Parser,
|
||||||
|
@ -370,9 +370,9 @@ code_change(_OldVsn, State, _Extra) ->
|
|||||||
%%% Internal functions
|
%%% Internal functions
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
route_check_id(From, To, #xmlel{name = iq} = Packet) ->
|
route_check_id(From, To, #xmlel{name = iq} = Packet) ->
|
||||||
case exmpp_xml:get_attribute_as_list(Packet, 'id', "") of
|
case exmpp_xml:get_attribute_as_list(Packet, <<"id">>, "") of
|
||||||
?ROUTE_PREFIX ++ Rest ->
|
?ROUTE_PREFIX ++ Rest ->
|
||||||
Type = exmpp_xml:get_attribute_as_list(Packet, 'type', ""),
|
Type = exmpp_xml:get_attribute_as_list(Packet, <<"type">>, ""),
|
||||||
if Type == "error"; Type == "result" ->
|
if Type == "error"; Type == "result" ->
|
||||||
case string:tokens(Rest, "-") of
|
case string:tokens(Rest, "-") of
|
||||||
[_, NodeID] ->
|
[_, NodeID] ->
|
||||||
|
@ -155,7 +155,7 @@ disconnect_removed_user(User, Server) ->
|
|||||||
exmpp_jid:make(User,
|
exmpp_jid:make(User,
|
||||||
Server),
|
Server),
|
||||||
#xmlel{name = 'broadcast', ns = exit,
|
#xmlel{name = 'broadcast', ns = exit,
|
||||||
attrs = [exmpp_xml:attribute(reason, "User removed")]}).
|
attrs = [?XMLATTR(<<"reason">>, <<"User removed">>)]}).
|
||||||
|
|
||||||
get_user_resources(User, Server)
|
get_user_resources(User, Server)
|
||||||
when is_binary(User), is_binary(Server) ->
|
when is_binary(User), is_binary(Server) ->
|
||||||
|
@ -127,7 +127,7 @@ xdb_data(User, Server, #xmlel{ns = NS} = El) ->
|
|||||||
catch mod_roster:set_items(UserB, ServerB, El),
|
catch mod_roster:set_items(UserB, ServerB, El),
|
||||||
ok;
|
ok;
|
||||||
?NS_LAST_ACTIVITY ->
|
?NS_LAST_ACTIVITY ->
|
||||||
TimeStamp = exmpp_xml:get_attribute_as_list(El, 'last', ""),
|
TimeStamp = exmpp_xml:get_attribute_as_list(El, <<"last">>, ""),
|
||||||
Status = exmpp_xml:get_cdata(El),
|
Status = exmpp_xml:get_cdata(El),
|
||||||
catch mod_last:store_last_info(
|
catch mod_last:store_last_info(
|
||||||
UserB,
|
UserB,
|
||||||
@ -145,7 +145,7 @@ xdb_data(User, Server, #xmlel{ns = NS} = El) ->
|
|||||||
process_offline(Server, From, El),
|
process_offline(Server, From, El),
|
||||||
ok;
|
ok;
|
||||||
XMLNS ->
|
XMLNS ->
|
||||||
case exmpp_xml:get_attribute_as_list(El, "j_private_flag", "") of
|
case exmpp_xml:get_attribute_as_list(El, <<"j_private_flag">>, "") of
|
||||||
"1" ->
|
"1" ->
|
||||||
catch mod_private:process_sm_iq(
|
catch mod_private:process_sm_iq(
|
||||||
From,
|
From,
|
||||||
|
12
src/jlib.erl
12
src/jlib.erl
@ -57,7 +57,7 @@
|
|||||||
%% R = binary().
|
%% R = binary().
|
||||||
|
|
||||||
parse_xdata_submit(#xmlel{attrs = Attrs, children = Els}) ->
|
parse_xdata_submit(#xmlel{attrs = Attrs, children = Els}) ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', "") of
|
case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"type">>, "") of
|
||||||
"submit" ->
|
"submit" ->
|
||||||
lists:reverse(parse_xdata_fields(Els, []));
|
lists:reverse(parse_xdata_fields(Els, []));
|
||||||
"form" -> %% This is a workaround to accept Psi's wrong forms
|
"form" -> %% This is a workaround to accept Psi's wrong forms
|
||||||
@ -70,7 +70,7 @@ parse_xdata_fields([], Res) ->
|
|||||||
Res;
|
Res;
|
||||||
parse_xdata_fields([#xmlel{name = 'field', attrs = Attrs, children = SubEls} |
|
parse_xdata_fields([#xmlel{name = 'field', attrs = Attrs, children = SubEls} |
|
||||||
Els], Res) ->
|
Els], Res) ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'var', "") of
|
case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"var">>, "") of
|
||||||
"" ->
|
"" ->
|
||||||
parse_xdata_fields(Els, Res);
|
parse_xdata_fields(Els, Res);
|
||||||
Var ->
|
Var ->
|
||||||
@ -140,7 +140,7 @@ rsm_encode_first(undefined, undefined, Arr) ->
|
|||||||
rsm_encode_first(First, undefined, Arr) ->
|
rsm_encode_first(First, undefined, Arr) ->
|
||||||
[#xmlel{ns = ?NS_RSM, name = 'first', children = [#xmlcdata{cdata = list_to_binary(First)}]}|Arr];
|
[#xmlel{ns = ?NS_RSM, name = 'first', children = [#xmlcdata{cdata = list_to_binary(First)}]}|Arr];
|
||||||
rsm_encode_first(First, Index, Arr) ->
|
rsm_encode_first(First, Index, Arr) ->
|
||||||
[#xmlel{ns = ?NS_RSM, name = 'first', attrs = [?XMLATTR('index', Index)], children = [#xmlcdata{cdata = list_to_binary(First)}]}|Arr].
|
[#xmlel{ns = ?NS_RSM, name = 'first', attrs = [?XMLATTR(<<"index">>, Index)], children = [#xmlcdata{cdata = list_to_binary(First)}]}|Arr].
|
||||||
|
|
||||||
rsm_encode_last(undefined, Arr) -> Arr;
|
rsm_encode_last(undefined, Arr) -> Arr;
|
||||||
rsm_encode_last(Last, Arr) ->
|
rsm_encode_last(Last, Arr) ->
|
||||||
@ -182,8 +182,8 @@ timestamp_to_xml(DateTime, Timezone, FromJID, Desc) ->
|
|||||||
{T_string, Tz_string} = timestamp_to_iso(DateTime, Timezone),
|
{T_string, Tz_string} = timestamp_to_iso(DateTime, Timezone),
|
||||||
From = exmpp_jid:to_list(FromJID),
|
From = exmpp_jid:to_list(FromJID),
|
||||||
P1 = exmpp_xml:set_attributes(#xmlel{ns = ?NS_DELAY, name = 'delay'},
|
P1 = exmpp_xml:set_attributes(#xmlel{ns = ?NS_DELAY, name = 'delay'},
|
||||||
[{'from', From},
|
[{<<"from">>, From},
|
||||||
{'stamp', T_string ++ Tz_string}]),
|
{<<"stamp">>, T_string ++ Tz_string}]),
|
||||||
exmpp_xml:set_cdata(P1, Desc).
|
exmpp_xml:set_cdata(P1, Desc).
|
||||||
|
|
||||||
%% TODO: Remove this function once XEP-0091 is Obsolete
|
%% TODO: Remove this function once XEP-0091 is Obsolete
|
||||||
@ -192,7 +192,7 @@ timestamp_to_xml({{Year, Month, Day}, {Hour, Minute, Second}}) ->
|
|||||||
io_lib:format("~4..0w~2..0w~2..0wT~2..0w:~2..0w:~2..0w",
|
io_lib:format("~4..0w~2..0w~2..0wT~2..0w:~2..0w:~2..0w",
|
||||||
[Year, Month, Day, Hour, Minute, Second])),
|
[Year, Month, Day, Hour, Minute, Second])),
|
||||||
exmpp_xml:set_attribute(#xmlel{ns = ?NS_DELAY_OLD, name = 'x'},
|
exmpp_xml:set_attribute(#xmlel{ns = ?NS_DELAY_OLD, name = 'x'},
|
||||||
'stamp', Timestamp).
|
<<"stamp">>, Timestamp).
|
||||||
|
|
||||||
now_to_utc_string({MegaSecs, Secs, MicroSecs}) ->
|
now_to_utc_string({MegaSecs, Secs, MicroSecs}) ->
|
||||||
{{Year, Month, Day}, {Hour, Minute, Second}} =
|
{{Year, Month, Day}, {Hour, Minute, Second}} =
|
||||||
|
@ -95,9 +95,9 @@ get_local_commands(Acc, _From, To, <<>>, Lang) ->
|
|||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item', attrs =
|
name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Server),
|
[?XMLATTR(<<"jid">>, Server),
|
||||||
?XMLATTR('node', ?NS_ADHOC_s),
|
?XMLATTR(<<"node">>, ?NS_ADHOC_s),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Commands"))]
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Commands"))]
|
||||||
}],
|
}],
|
||||||
{result, Items ++ Nodes}
|
{result, Items ++ Nodes}
|
||||||
end;
|
end;
|
||||||
@ -126,9 +126,9 @@ get_sm_commands(Acc, _From, To, <<>>, Lang) ->
|
|||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item', attrs =
|
name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(To)),
|
||||||
?XMLATTR('node', ?NS_ADHOC_s),
|
?XMLATTR(<<"node">>, ?NS_ADHOC_s),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Commands"))]
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Commands"))]
|
||||||
}],
|
}],
|
||||||
{result, Items ++ Nodes}
|
{result, Items ++ Nodes}
|
||||||
end;
|
end;
|
||||||
@ -144,15 +144,15 @@ get_sm_commands(Acc, _From, _To, _Node, _Lang) ->
|
|||||||
%% On disco info request to the ad-hoc node, return automation/command-list.
|
%% On disco info request to the ad-hoc node, return automation/command-list.
|
||||||
get_local_identity(Acc, _From, _To, ?NS_ADHOC_b, Lang) ->
|
get_local_identity(Acc, _From, _To, ?NS_ADHOC_b, Lang) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', <<"automation">>),
|
[?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-list">>),
|
?XMLATTR(<<"type">>, <<"command-list">>),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Commands"))]} | Acc];
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Commands"))]} | Acc];
|
||||||
|
|
||||||
get_local_identity(Acc, _From, _To, <<"ping">>, Lang) ->
|
get_local_identity(Acc, _From, _To, <<"ping">>, Lang) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', <<"automation">>),
|
[?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-node">>),
|
?XMLATTR(<<"type">>, <<"command-node">>),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Ping"))]} | Acc];
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Ping"))]} | Acc];
|
||||||
|
|
||||||
get_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
get_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||||
Acc.
|
Acc.
|
||||||
@ -162,9 +162,9 @@ get_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
|||||||
%% On disco info request to the ad-hoc node, return automation/command-list.
|
%% On disco info request to the ad-hoc node, return automation/command-list.
|
||||||
get_sm_identity(Acc, _From, _To, ?NS_ADHOC_s, Lang) ->
|
get_sm_identity(Acc, _From, _To, ?NS_ADHOC_s, Lang) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', <<"automation">>),
|
[?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-list">>),
|
?XMLATTR(<<"type">>, <<"command-list">>),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Commands"))]} | Acc];
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Commands"))]} | Acc];
|
||||||
|
|
||||||
get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||||
Acc.
|
Acc.
|
||||||
@ -244,9 +244,9 @@ ping_item(Acc, _From, To, Lang) ->
|
|||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_INFO, name = 'item', attrs =
|
Nodes = [#xmlel{ns = ?NS_DISCO_INFO, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Server),
|
[?XMLATTR(<<"jid">>, Server),
|
||||||
?XMLATTR('node', <<"ping">>),
|
?XMLATTR(<<"node">>, <<"ping">>),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Ping"))]}],
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Ping"))]}],
|
||||||
{result, Items ++ Nodes}.
|
{result, Items ++ Nodes}.
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,9 +178,9 @@ announce(From, To, Packet) ->
|
|||||||
%% Announcing via ad-hoc commands
|
%% Announcing via ad-hoc commands
|
||||||
-define(INFO_COMMAND(Lang, Node),
|
-define(INFO_COMMAND(Lang, Node),
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', <<"automation">>),
|
[?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-node">>),
|
?XMLATTR(<<"type">>, <<"command-node">>),
|
||||||
?XMLATTR('name', get_title(Lang, Node))]}]).
|
?XMLATTR(<<"name">>, get_title(Lang, Node))]}]).
|
||||||
|
|
||||||
disco_identity(Acc, _From, _To, Node, Lang) ->
|
disco_identity(Acc, _From, _To, Node, Lang) ->
|
||||||
LNode = tokenize(binary_to_list(Node)),
|
LNode = tokenize(binary_to_list(Node)),
|
||||||
@ -276,9 +276,9 @@ disco_features(Acc, From, To, Node, _Lang) ->
|
|||||||
|
|
||||||
-define(NODE_TO_ITEM(Lang, Server, Node),
|
-define(NODE_TO_ITEM(Lang, Server, Node),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Server),
|
[?XMLATTR(<<"jid">>, Server),
|
||||||
?XMLATTR('node', Node),
|
?XMLATTR(<<"node">>, Node),
|
||||||
?XMLATTR('name', get_title(Lang, Node))]}).
|
?XMLATTR(<<"name">>, get_title(Lang, Node))]}).
|
||||||
|
|
||||||
-define(ITEMS_RESULT(Allow, Items),
|
-define(ITEMS_RESULT(Allow, Items),
|
||||||
case Allow of
|
case Allow of
|
||||||
@ -487,8 +487,8 @@ announce_commands(From, To,
|
|||||||
_ -> [?VVALUE(Val)]
|
_ -> [?VVALUE(Val)]
|
||||||
end).
|
end).
|
||||||
-define(TVFIELD(Type, Var, Val),
|
-define(TVFIELD(Type, Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
?VVALUEL(Val)}).
|
?VVALUEL(Val)}).
|
||||||
-define(HFIELD(), ?TVFIELD(<<"hidden">>, <<"FORM_TYPE">>, list_to_binary(?NS_ADMIN_s))).
|
-define(HFIELD(), ?TVFIELD(<<"hidden">>, <<"FORM_TYPE">>, list_to_binary(?NS_ADMIN_s))).
|
||||||
|
|
||||||
@ -501,28 +501,28 @@ generate_adhoc_form(Lang, Node, ServerHost) ->
|
|||||||
{[], []}
|
{[], []}
|
||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[?HFIELD(),
|
[?HFIELD(),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children = [#xmlcdata{cdata = list_to_binary(get_title(Lang, Node))}]}]
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children = [#xmlcdata{cdata = list_to_binary(get_title(Lang, Node))}]}]
|
||||||
++
|
++
|
||||||
if (LNode == ?NS_ADMINL("delete-motd"))
|
if (LNode == ?NS_ADMINL("delete-motd"))
|
||||||
or (LNode == ?NS_ADMINL("delete-motd-allhosts")) ->
|
or (LNode == ?NS_ADMINL("delete-motd-allhosts")) ->
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"confirm">>),
|
[?XMLATTR(<<"var">>, <<"confirm">>),
|
||||||
?XMLATTR('type', <<"boolean">>),
|
?XMLATTR(<<"type">>, <<"boolean">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Really delete message of the day?"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Really delete message of the day?"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = <<"true">>}]}]}];
|
[#xmlcdata{cdata = <<"true">>}]}]}];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"subject">>),
|
[?XMLATTR(<<"var">>, <<"subject">>),
|
||||||
?XMLATTR('type', <<"text-single">>),
|
?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Subject"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Subject"))], children =
|
||||||
?VVALUEL(list_to_binary(OldSubject))},
|
?VVALUEL(list_to_binary(OldSubject))},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"body">>),
|
[?XMLATTR(<<"var">>, <<"body">>),
|
||||||
?XMLATTR('type', <<"text-multi">>),
|
?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Message body"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Message body"))], children =
|
||||||
?VVALUEL(list_to_binary(OldBody))}]
|
?VVALUEL(list_to_binary(OldBody))}]
|
||||||
end}.
|
end}.
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ handle_adhoc_form(From, To,
|
|||||||
node = Node,
|
node = Node,
|
||||||
sessionid = SessionID,
|
sessionid = SessionID,
|
||||||
status = completed},
|
status = completed},
|
||||||
Packet = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', attrs = [?XMLATTR('type', <<"normal">>)], children =
|
Packet = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', attrs = [?XMLATTR(<<"type">>, <<"normal">>)], children =
|
||||||
if Subject /= [] ->
|
if Subject /= [] ->
|
||||||
[#xmlel{ns = ?NS_JABBER_CLIENT, name = 'subject', children =
|
[#xmlel{ns = ?NS_JABBER_CLIENT, name = 'subject', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(Subject)}]}];
|
[#xmlcdata{cdata = list_to_binary(Subject)}]}];
|
||||||
@ -870,7 +870,7 @@ send_announcement_to_all(Host, SubjectS, BodyS) ->
|
|||||||
true ->
|
true ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
Packet = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', attrs = [?XMLATTR('type', <<"normal">>)], children = SubjectEls ++ BodyEls},
|
Packet = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', attrs = [?XMLATTR(<<"type">>, <<"normal">>)], children = SubjectEls ++ BodyEls},
|
||||||
Sessions = ejabberd_sm:dirty_get_sessions_list(),
|
Sessions = ejabberd_sm:dirty_get_sessions_list(),
|
||||||
Local = exmpp_jid:make(Host),
|
Local = exmpp_jid:make(Host),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
|
@ -116,9 +116,9 @@ get_features(#caps{node = Node, version = Version, exts = Exts}) ->
|
|||||||
read_caps(Els) ->
|
read_caps(Els) ->
|
||||||
read_caps(Els, nothing).
|
read_caps(Els, nothing).
|
||||||
read_caps([#xmlel{ns = ?NS_CAPS, name = 'c'} = El | Tail], _Result) ->
|
read_caps([#xmlel{ns = ?NS_CAPS, name = 'c'} = El | Tail], _Result) ->
|
||||||
Node = exmpp_xml:get_attribute_as_list(El, 'node', ""),
|
Node = exmpp_xml:get_attribute_as_list(El, <<"node">>, ""),
|
||||||
Version = exmpp_xml:get_attribute_as_list(El, 'ver', ""),
|
Version = exmpp_xml:get_attribute_as_list(El, <<"ver">>, ""),
|
||||||
Exts = string:tokens(exmpp_xml:get_attribute_as_list(El, 'ext', ""), " "),
|
Exts = string:tokens(exmpp_xml:get_attribute_as_list(El, <<"ext">>, ""), " "),
|
||||||
read_caps(Tail, #caps{node = Node, version = Version, exts = Exts});
|
read_caps(Tail, #caps{node = Node, version = Version, exts = Exts});
|
||||||
read_caps([#xmlel{ns = ?NS_MUC_USER, name = 'x'} | _Tail], _Result) ->
|
read_caps([#xmlel{ns = ?NS_MUC_USER, name = 'x'} | _Tail], _Result) ->
|
||||||
nothing;
|
nothing;
|
||||||
@ -133,7 +133,7 @@ read_caps([], Result) ->
|
|||||||
user_send_packet(From, To, #xmlel{name = 'presence', attrs = Attrs, children = Els}) ->
|
user_send_packet(From, To, #xmlel{name = 'presence', attrs = Attrs, children = Els}) ->
|
||||||
case exmpp_jid:bare_compare(From, To) of
|
case exmpp_jid:bare_compare(From, To) of
|
||||||
true ->
|
true ->
|
||||||
Type = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', ""),
|
Type = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"type">>, ""),
|
||||||
if Type == ""; Type == "available" ->
|
if Type == ""; Type == "available" ->
|
||||||
case read_caps(Els) of
|
case read_caps(Els) of
|
||||||
nothing ->
|
nothing ->
|
||||||
@ -158,9 +158,9 @@ caps_stream_features(Acc, MyHost) ->
|
|||||||
Hash ->
|
Hash ->
|
||||||
[#xmlel{name = c,
|
[#xmlel{name = c,
|
||||||
ns = ?NS_CAPS,
|
ns = ?NS_CAPS,
|
||||||
attrs = [?XMLATTR(hash, "sha-1"),
|
attrs = [?XMLATTR(<<"hash">>, "sha-1"),
|
||||||
?XMLATTR(node, ?EJABBERD_URI),
|
?XMLATTR(<<"node">>, ?EJABBERD_URI),
|
||||||
?XMLATTR(ver, Hash)]} | Acc]
|
?XMLATTR(<<"ver">>, Hash)]} | Acc]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
disco_features(_Acc, From, To, <<?EJABBERD_URI, $#, _/binary>>, Lang) ->
|
disco_features(_Acc, From, To, <<?EJABBERD_URI, $#, _/binary>>, Lang) ->
|
||||||
@ -262,7 +262,7 @@ feature_request(Host, From, Caps, [SubNode | Tail] = SubNodes) ->
|
|||||||
IQ = #iq{type = get,
|
IQ = #iq{type = get,
|
||||||
iq_ns = ?NS_JABBER_CLIENT,
|
iq_ns = ?NS_JABBER_CLIENT,
|
||||||
payload = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
payload = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
||||||
attrs = [?XMLATTR('node', Node ++ "#" ++ SubNode)]}},
|
attrs = [?XMLATTR(<<"node">>, Node ++ "#" ++ SubNode)]}},
|
||||||
F = fun(IQReply) ->
|
F = fun(IQReply) ->
|
||||||
feature_response(
|
feature_response(
|
||||||
IQReply, Host, From, Caps, SubNodes)
|
IQReply, Host, From, Caps, SubNodes)
|
||||||
@ -279,7 +279,7 @@ feature_response(#iq{type = result, payload = El},
|
|||||||
Host, From, Caps, [SubNode | SubNodes]) ->
|
Host, From, Caps, [SubNode | SubNodes]) ->
|
||||||
Features = lists:flatmap(
|
Features = lists:flatmap(
|
||||||
fun(#xmlel{name = 'feature', attrs = FAttrs}) ->
|
fun(#xmlel{name = 'feature', attrs = FAttrs}) ->
|
||||||
[exmpp_xml:get_attribute_from_list_as_list(FAttrs, 'var', "")];
|
[exmpp_xml:get_attribute_from_list_as_list(FAttrs, <<"var">>, "")];
|
||||||
(_) ->
|
(_) ->
|
||||||
[]
|
[]
|
||||||
end, El#xmlel.children),
|
end, El#xmlel.children),
|
||||||
@ -340,10 +340,10 @@ make_my_disco_hash(Host) ->
|
|||||||
Feats = lists:map(
|
Feats = lists:map(
|
||||||
fun({{Feat, _Host}}) ->
|
fun({{Feat, _Host}}) ->
|
||||||
#xmlel{name = feature,
|
#xmlel{name = feature,
|
||||||
attrs = [?XMLATTR(var, Feat)]};
|
attrs = [?XMLATTR(<<"var">>, Feat)]};
|
||||||
(Feat) ->
|
(Feat) ->
|
||||||
#xmlel{name = feature,
|
#xmlel{name = feature,
|
||||||
attrs = [?XMLATTR(var, Feat)]}
|
attrs = [?XMLATTR(<<"var">>, Feat)]}
|
||||||
end, Features),
|
end, Features),
|
||||||
make_disco_hash(Identities ++ Info ++ Feats, sha1);
|
make_disco_hash(Identities ++ Info ++ Feats, sha1);
|
||||||
_Err ->
|
_Err ->
|
||||||
@ -360,7 +360,7 @@ concat_features(Els) ->
|
|||||||
lists:usort(
|
lists:usort(
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(#xmlel{name = feature} = El) ->
|
fun(#xmlel{name = feature} = El) ->
|
||||||
[[exmpp_xml:get_attribute(El, var, <<>>), $<]];
|
[[exmpp_xml:get_attribute(El, <<"var">>, <<>>), $<]];
|
||||||
(_) ->
|
(_) ->
|
||||||
[]
|
[]
|
||||||
end, Els)).
|
end, Els)).
|
||||||
@ -369,10 +369,10 @@ concat_identities(Els) ->
|
|||||||
lists:sort(
|
lists:sort(
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(#xmlel{name = identity} = El) ->
|
fun(#xmlel{name = identity} = El) ->
|
||||||
[[exmpp_xml:get_attribute_as_binary(El, category, <<>>), $/,
|
[[exmpp_xml:get_attribute_as_binary(El, <<"category">>, <<>>), $/,
|
||||||
exmpp_xml:get_attribute_as_binary(El, type, <<>>), $/,
|
exmpp_xml:get_attribute_as_binary(El, <<"type">>, <<>>), $/,
|
||||||
exmpp_xml:get_attribute_as_binary(El, lang, <<>>), $/,
|
exmpp_xml:get_attribute_as_binary(El, <<"lang">>, <<>>), $/,
|
||||||
exmpp_xml:get_attribute_as_binary(El, name, <<>>), $<]];
|
exmpp_xml:get_attribute_as_binary(El, <<"name">>, <<>>), $<]];
|
||||||
(_) ->
|
(_) ->
|
||||||
[]
|
[]
|
||||||
end, Els)).
|
end, Els)).
|
||||||
@ -381,7 +381,7 @@ concat_info(Els) ->
|
|||||||
lists:sort(
|
lists:sort(
|
||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(#xmlel{name = x, ns = ?NS_DATA_FORMS, children = Fields} = El) ->
|
fun(#xmlel{name = x, ns = ?NS_DATA_FORMS, children = Fields} = El) ->
|
||||||
case exmpp_xml:get_attribute_as_list(El, 'type', "") of
|
case exmpp_xml:get_attribute_as_list(El, <<"type">>, "") of
|
||||||
"result" ->
|
"result" ->
|
||||||
[concat_xdata_fields(Fields)];
|
[concat_xdata_fields(Fields)];
|
||||||
_ ->
|
_ ->
|
||||||
@ -396,7 +396,7 @@ concat_xdata_fields(Fields) ->
|
|||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#xmlel{name = field, children = Els} = El,
|
fun(#xmlel{name = field, children = Els} = El,
|
||||||
[FormType, VarFields] = Acc) ->
|
[FormType, VarFields] = Acc) ->
|
||||||
case exmpp_xml:get_attribute_as_binary(El, var, <<>>) of
|
case exmpp_xml:get_attribute_as_binary(El, <<"var">>, <<>>) of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
Acc;
|
Acc;
|
||||||
<<"FORM_TYPE">> ->
|
<<"FORM_TYPE">> ->
|
||||||
|
@ -89,24 +89,24 @@ stop(Host) ->
|
|||||||
|
|
||||||
-define(INFO_IDENTITY(Category, Type, Name, Lang),
|
-define(INFO_IDENTITY(Category, Type, Name, Lang),
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', Category),
|
[?XMLATTR(<<"category">>, Category),
|
||||||
?XMLATTR('type', Type),
|
?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('name', ?T(Lang, Name))]}]).
|
?XMLATTR(<<"name">>, ?T(Lang, Name))]}]).
|
||||||
|
|
||||||
-define(INFO_COMMAND(Name, Lang),
|
-define(INFO_COMMAND(Name, Lang),
|
||||||
?INFO_IDENTITY(<<"automation">>, <<"command-node">>, Name, Lang)).
|
?INFO_IDENTITY(<<"automation">>, <<"command-node">>, Name, Lang)).
|
||||||
|
|
||||||
-define(NODEJID(To, Name, Node),
|
-define(NODEJID(To, Name, Node),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(To)),
|
||||||
?XMLATTR('name', ?T(Lang, Name)),
|
?XMLATTR(<<"name">>, ?T(Lang, Name)),
|
||||||
?XMLATTR('node', Node)]}).
|
?XMLATTR(<<"node">>, Node)]}).
|
||||||
|
|
||||||
-define(NODE(Name, Node),
|
-define(NODE(Name, Node),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Server),
|
[?XMLATTR(<<"jid">>, Server),
|
||||||
?XMLATTR('name', ?T(Lang, Name)),
|
?XMLATTR(<<"name">>, ?T(Lang, Name)),
|
||||||
?XMLATTR('node', Node)]}).
|
?XMLATTR(<<"node">>, Node)]}).
|
||||||
|
|
||||||
-define(NS_ADMINX(Sub), <<?NS_ADMIN_s,"#", Sub/binary>>).
|
-define(NS_ADMINX(Sub), <<?NS_ADMIN_s,"#", Sub/binary>>).
|
||||||
-define(NS_ADMINL(Sub), ["http:","jabber.org","protocol","admin", Sub]).
|
-define(NS_ADMINL(Sub), ["http:","jabber.org","protocol","admin", Sub]).
|
||||||
@ -277,9 +277,9 @@ adhoc_sm_items(Acc, From, To, Lang) ->
|
|||||||
empty -> []
|
empty -> []
|
||||||
end,
|
end,
|
||||||
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(To)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(To)),
|
||||||
?XMLATTR('name', ?T(Lang, "Configuration")),
|
?XMLATTR(<<"name">>, ?T(Lang, "Configuration")),
|
||||||
?XMLATTR('node', <<"config">>)]}],
|
?XMLATTR(<<"node">>, <<"config">>)]}],
|
||||||
{result, Items ++ Nodes};
|
{result, Items ++ Nodes};
|
||||||
_ ->
|
_ ->
|
||||||
Acc
|
Acc
|
||||||
@ -316,10 +316,10 @@ get_user_resources(BareJID) ->
|
|||||||
exmpp_jid:prep_domain(BareJID)),
|
exmpp_jid:prep_domain(BareJID)),
|
||||||
lists:map(fun(R) ->
|
lists:map(fun(R) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid',
|
[?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(
|
exmpp_jid:to_binary(
|
||||||
exmpp_jid:full(BareJID, R))),
|
exmpp_jid:full(BareJID, R))),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
exmpp_jid:prep_node(BareJID))]}
|
exmpp_jid:prep_node(BareJID))]}
|
||||||
end, lists:sort(Rs)).
|
end, lists:sort(Rs)).
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ adhoc_local_items(Acc, From, To, Lang) ->
|
|||||||
Lang),
|
Lang),
|
||||||
Nodes1 = lists:filter(
|
Nodes1 = lists:filter(
|
||||||
fun(N) ->
|
fun(N) ->
|
||||||
Nd = exmpp_xml:get_attribute_as_binary(N, 'node', ""),
|
Nd = exmpp_xml:get_attribute_as_binary(N, <<"node">>, ""),
|
||||||
F = get_local_features([], From, To, Nd, Lang),
|
F = get_local_features([], From, To, Nd, Lang),
|
||||||
case F of
|
case F of
|
||||||
{result, [?NS_ADHOC_s]} ->
|
{result, [?NS_ADHOC_s]} ->
|
||||||
@ -370,8 +370,8 @@ recursively_get_local_items(PermLev, LServer, Node, Server, Lang) ->
|
|||||||
Nodes = lists:flatten(
|
Nodes = lists:flatten(
|
||||||
lists:map(
|
lists:map(
|
||||||
fun(N) ->
|
fun(N) ->
|
||||||
S = exmpp_xml:get_attribute_as_list(N, 'jid', ""),
|
S = exmpp_xml:get_attribute_as_list(N, <<"jid">>, ""),
|
||||||
Nd = exmpp_xml:get_attribute_as_list(N, 'node', ""),
|
Nd = exmpp_xml:get_attribute_as_list(N, <<"node">>, ""),
|
||||||
if (S /= Server) or (Nd == "") ->
|
if (S /= Server) or (Nd == "") ->
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
@ -560,8 +560,8 @@ get_local_items({_, Host}, ["all users", [$@ | Diap]], _Server, _Lang) ->
|
|||||||
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
|
||||||
lists:map(fun({S, U}) ->
|
lists:map(fun({S, U}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(U, S)),
|
||||||
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
?XMLATTR(<<"name">>, exmpp_jid:to_binary(U, S))]}
|
||||||
end, Sub)
|
end, Sub)
|
||||||
end of
|
end of
|
||||||
{'EXIT', _Reason} ->
|
{'EXIT', _Reason} ->
|
||||||
@ -653,8 +653,8 @@ get_online_vh_users(Host) ->
|
|||||||
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
|
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
|
||||||
lists:map(fun({S, U, R}) ->
|
lists:map(fun({S, U, R}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(U, S, R)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(U, S, R)),
|
||||||
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
?XMLATTR(<<"name">>, exmpp_jid:to_binary(U, S))]}
|
||||||
end, SURs)
|
end, SURs)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -668,8 +668,8 @@ get_all_vh_users(Host) ->
|
|||||||
N when N =< 100 ->
|
N when N =< 100 ->
|
||||||
lists:map(fun({S, U}) ->
|
lists:map(fun({S, U}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(U, S)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(U, S)),
|
||||||
?XMLATTR('name', exmpp_jid:to_binary(U, S))]}
|
?XMLATTR(<<"name">>, exmpp_jid:to_binary(U, S))]}
|
||||||
end, SUsers);
|
end, SUsers);
|
||||||
N ->
|
N ->
|
||||||
NParts = trunc(math:sqrt(N * 0.618)) + 1,
|
NParts = trunc(math:sqrt(N * 0.618)) + 1,
|
||||||
@ -688,9 +688,9 @@ get_all_vh_users(Host) ->
|
|||||||
<<(list_to_binary(FU))/binary, "@", (list_to_binary(FS))/binary,
|
<<(list_to_binary(FU))/binary, "@", (list_to_binary(FS))/binary,
|
||||||
" -- ", (list_to_binary(LU))/binary, "@", (list_to_binary(LS))/binary>>,
|
" -- ", (list_to_binary(LU))/binary, "@", (list_to_binary(LS))/binary>>,
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Host),
|
[?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('node', <<"all users/", Node/binary>>),
|
?XMLATTR(<<"node">>, <<"all users/", Node/binary>>),
|
||||||
?XMLATTR('name', Name)]}
|
?XMLATTR(<<"name">>, Name)]}
|
||||||
end, lists:seq(1, N, M))
|
end, lists:seq(1, N, M))
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
@ -706,9 +706,9 @@ get_outgoing_s2s(Host, Lang) ->
|
|||||||
lists:map(
|
lists:map(
|
||||||
fun(T) ->
|
fun(T) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Host),
|
[?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('node', <<"outgoing s2s/", (list_to_binary(T))/binary>>),
|
?XMLATTR(<<"node">>, <<"outgoing s2s/", (list_to_binary(T))/binary>>),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
io_lib:format(?T(Lang, "To ~s"), [T]))]}
|
io_lib:format(?T(Lang, "To ~s"), [T]))]}
|
||||||
end, lists:usort(TConns))
|
end, lists:usort(TConns))
|
||||||
end.
|
end.
|
||||||
@ -721,9 +721,9 @@ get_outgoing_s2s(Host, Lang, To) ->
|
|||||||
lists:map(
|
lists:map(
|
||||||
fun({F, _T}) ->
|
fun({F, _T}) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Host),
|
[?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('node', <<"outgoing s2s/", (list_to_binary(To))/binary, "/", (list_to_binary(F))/binary>>),
|
?XMLATTR(<<"node">>, <<"outgoing s2s/", (list_to_binary(To))/binary, "/", (list_to_binary(F))/binary>>),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
io_lib:format(?T(Lang, "From ~s"), [F]))]}
|
io_lib:format(?T(Lang, "From ~s"), [F]))]}
|
||||||
end, lists:keysort(1, lists:filter(fun(E) ->
|
end, lists:keysort(1, lists:filter(fun(E) ->
|
||||||
element(2, E) == To
|
element(2, E) == To
|
||||||
@ -740,9 +740,9 @@ get_running_nodes(Server, _Lang) ->
|
|||||||
fun(N) ->
|
fun(N) ->
|
||||||
S = list_to_binary(atom_to_list(N)),
|
S = list_to_binary(atom_to_list(N)),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', Server),
|
[?XMLATTR(<<"jid">>, Server),
|
||||||
?XMLATTR('node', <<"running nodes/", S/binary>>),
|
?XMLATTR(<<"node">>, <<"running nodes/", S/binary>>),
|
||||||
?XMLATTR('name', S)]}
|
?XMLATTR(<<"name">>, S)]}
|
||||||
end, lists:sort(DBNodes))
|
end, lists:sort(DBNodes))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -757,9 +757,9 @@ get_stopped_nodes(_Lang) ->
|
|||||||
fun(N) ->
|
fun(N) ->
|
||||||
S = list_to_binary(atom_to_list(N)),
|
S = list_to_binary(atom_to_list(N)),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
|
||||||
[?XMLATTR('jid', ?MYNAME),
|
[?XMLATTR(<<"jid">>, ?MYNAME),
|
||||||
?XMLATTR('node', <<"stopped nodes/", S/binary>>),
|
?XMLATTR(<<"node">>, <<"stopped nodes/", S/binary>>),
|
||||||
?XMLATTR('name', S)]}
|
?XMLATTR(<<"name">>, S)]}
|
||||||
end, lists:sort(DBNodes))
|
end, lists:sort(DBNodes))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -858,45 +858,45 @@ adhoc_local_commands(From, To,
|
|||||||
|
|
||||||
|
|
||||||
-define(TVFIELD(Type, Var, Val),
|
-define(TVFIELD(Type, Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = Val}]}]}).
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = Val}]}]}).
|
||||||
-define(HFIELD(), ?TVFIELD(<<"hidden">>, <<"FORM_TYPE">>, list_to_binary(?NS_ADMIN_s))).
|
-define(HFIELD(), ?TVFIELD(<<"hidden">>, <<"FORM_TYPE">>, list_to_binary(?NS_ADMIN_s))).
|
||||||
|
|
||||||
-define(TLFIELD(Type, Label, Var),
|
-define(TLFIELD(Type, Label, Var),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', ?T(Lang, Label)),
|
?XMLATTR(<<"label">>, ?T(Lang, Label)),
|
||||||
?XMLATTR('var', Var)]}).
|
?XMLATTR(<<"var">>, Var)]}).
|
||||||
|
|
||||||
-define(XFIELD(Type, Label, Var, Val),
|
-define(XFIELD(Type, Label, Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', ?T(Lang, Label)),
|
?XMLATTR(<<"label">>, ?T(Lang, Label)),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = Val}]}]}).
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
-define(XMFIELD(Type, Label, Var, Vals),
|
-define(XMFIELD(Type, Label, Var, Vals),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', ?T(Lang, Label)),
|
?XMLATTR(<<"label">>, ?T(Lang, Label)),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]} || Val <- Vals]}).
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]} || Val <- Vals]}).
|
||||||
|
|
||||||
-define(TABLEFIELD(Table, Val),
|
-define(TABLEFIELD(Table, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', <<"list-single">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label', Table),
|
?XMLATTR(<<"label">>, Table),
|
||||||
?XMLATTR('var', Table)],
|
?XMLATTR(<<"var">>, Table)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(atom_to_list(Val))}]},
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(atom_to_list(Val))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR('label',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR(<<"label">>,
|
||||||
?T(Lang, "RAM copy"))],
|
?T(Lang, "RAM copy"))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"ram_copies">>}]}]},
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"ram_copies">>}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR('label',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR(<<"label">>,
|
||||||
?T(Lang,
|
?T(Lang,
|
||||||
"RAM and disc copy"))],
|
"RAM and disc copy"))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"disc_copies">>}]}]},
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"disc_copies">>}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR('label',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR(<<"label">>,
|
||||||
?T(Lang,
|
?T(Lang,
|
||||||
"Disc only copy"))],
|
"Disc only copy"))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"disc_only_copies">>}]}]},
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"disc_only_copies">>}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR('label',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs = [?XMLATTR(<<"label">>,
|
||||||
?T(Lang, "Remote copy"))],
|
?T(Lang, "Remote copy"))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"unknown">>}]}]}
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"unknown">>}]}]}
|
||||||
]}).
|
]}).
|
||||||
@ -1057,7 +1057,7 @@ get_form(_Host, ["running nodes", _ENode, "restart"], Lang) ->
|
|||||||
Make_option =
|
Make_option =
|
||||||
fun(LabelNum, LabelUnit, Value)->
|
fun(LabelNum, LabelUnit, Value)->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
||||||
[?XMLATTR('label', LabelNum ++ ?T(Lang, LabelUnit))], children =
|
[?XMLATTR(<<"label">>, LabelNum ++ ?T(Lang, LabelUnit))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Value)}]}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Value)}]}]}
|
||||||
end,
|
end,
|
||||||
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
||||||
@ -1065,9 +1065,9 @@ get_form(_Host, ["running nodes", _ENode, "restart"], Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Restart Service"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Restart Service"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"list-single">>),
|
[?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Time delay")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Time delay")),
|
||||||
?XMLATTR('var', <<"delay">>)], children =
|
?XMLATTR(<<"var">>, <<"delay">>)], children =
|
||||||
[Make_option("", "immediately", "1"),
|
[Make_option("", "immediately", "1"),
|
||||||
Make_option("15 ", "seconds", "15"),
|
Make_option("15 ", "seconds", "15"),
|
||||||
Make_option("30 ", "seconds", "30"),
|
Make_option("30 ", "seconds", "30"),
|
||||||
@ -1083,23 +1083,23 @@ get_form(_Host, ["running nodes", _ENode, "restart"], Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
||||||
]},
|
]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"fixed">>),
|
[?XMLATTR(<<"type">>, <<"fixed">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Send announcement to all online users on all hosts"))]},
|
?XMLATTR(<<"label">>, ?T(Lang, "Send announcement to all online users on all hosts"))]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"subject">>),
|
[?XMLATTR(<<"var">>, <<"subject">>),
|
||||||
?XMLATTR('type', <<"text-single">>),
|
?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Subject"))]},
|
?XMLATTR(<<"label">>, ?T(Lang, "Subject"))]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"announcement">>),
|
[?XMLATTR(<<"var">>, <<"announcement">>),
|
||||||
?XMLATTR('type', <<"text-multi">>),
|
?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Message body"))]}
|
?XMLATTR(<<"label">>, ?T(Lang, "Message body"))]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
get_form(_Host, ["running nodes", _ENode, "shutdown"], Lang) ->
|
get_form(_Host, ["running nodes", _ENode, "shutdown"], Lang) ->
|
||||||
Make_option =
|
Make_option =
|
||||||
fun(LabelNum, LabelUnit, Value)->
|
fun(LabelNum, LabelUnit, Value)->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
||||||
[?XMLATTR('label', LabelNum ++ ?T(Lang, LabelUnit))], children =
|
[?XMLATTR(<<"label">>, LabelNum ++ ?T(Lang, LabelUnit))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Value)}]}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Value)}]}]}
|
||||||
end,
|
end,
|
||||||
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
||||||
@ -1107,9 +1107,9 @@ get_form(_Host, ["running nodes", _ENode, "shutdown"], Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Shut Down Service"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Shut Down Service"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"list-single">>),
|
[?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Time delay")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Time delay")),
|
||||||
?XMLATTR('var', <<"delay">>)], children =
|
?XMLATTR(<<"var">>, <<"delay">>)], children =
|
||||||
[Make_option("", "immediately", "1"),
|
[Make_option("", "immediately", "1"),
|
||||||
Make_option("15 ", "seconds", "15"),
|
Make_option("15 ", "seconds", "15"),
|
||||||
Make_option("30 ", "seconds", "30"),
|
Make_option("30 ", "seconds", "30"),
|
||||||
@ -1125,16 +1125,16 @@ get_form(_Host, ["running nodes", _ENode, "shutdown"], Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
||||||
]},
|
]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"fixed">>),
|
[?XMLATTR(<<"type">>, <<"fixed">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Send announcement to all online users on all hosts"))]},
|
?XMLATTR(<<"label">>, ?T(Lang, "Send announcement to all online users on all hosts"))]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"subject">>),
|
[?XMLATTR(<<"var">>, <<"subject">>),
|
||||||
?XMLATTR('type', <<"text-single">>),
|
?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Subject"))]},
|
?XMLATTR(<<"label">>, ?T(Lang, "Subject"))]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"announcement">>),
|
[?XMLATTR(<<"var">>, <<"announcement">>),
|
||||||
?XMLATTR('type', <<"text-multi">>),
|
?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Message body"))]}
|
?XMLATTR(<<"label">>, ?T(Lang, "Message body"))]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
get_form(Host, ["config", "acls"], Lang) ->
|
get_form(Host, ["config", "acls"], Lang) ->
|
||||||
@ -1144,11 +1144,11 @@ get_form(Host, ["config", "acls"], Lang) ->
|
|||||||
[#xmlcdata{cdata =
|
[#xmlcdata{cdata =
|
||||||
list_to_binary(?T(
|
list_to_binary(?T(
|
||||||
Lang, "Access Control List Configuration"))}]},
|
Lang, "Access Control List Configuration"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', <<"text-multi">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
?T(
|
?T(
|
||||||
Lang, "Access control lists")),
|
Lang, "Access control lists")),
|
||||||
?XMLATTR('var', <<"acls">>)],
|
?XMLATTR(<<"var">>, <<"acls">>)],
|
||||||
children = lists:map(fun(S) ->
|
children = lists:map(fun(S) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(S)}]}
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(S)}]}
|
||||||
end,
|
end,
|
||||||
@ -1172,11 +1172,11 @@ get_form(Host, ["config", "access"], Lang) ->
|
|||||||
[#xmlcdata{cdata =
|
[#xmlcdata{cdata =
|
||||||
list_to_binary(?T(
|
list_to_binary(?T(
|
||||||
Lang, "Access Configuration"))}]},
|
Lang, "Access Configuration"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =[?XMLATTR('type', <<"text-multi">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =[?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
?T(
|
?T(
|
||||||
Lang, "Access rules")),
|
Lang, "Access rules")),
|
||||||
?XMLATTR('var', <<"access">>)],
|
?XMLATTR(<<"var">>, <<"access">>)],
|
||||||
children = lists:map(fun(S) ->
|
children = lists:map(fun(S) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =[#xmlcdata{cdata = list_to_binary(S)}]}
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =[#xmlcdata{cdata = list_to_binary(S)}]}
|
||||||
end,
|
end,
|
||||||
@ -1199,19 +1199,19 @@ get_form(_Host, ?NS_ADMINL("add-user"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Add User"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Add User"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"text-private">>),
|
[?XMLATTR(<<"type">>, <<"text-private">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Password")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Password")),
|
||||||
?XMLATTR('var', <<"password">>)], children =
|
?XMLATTR(<<"var">>, <<"password">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"text-private">>),
|
[?XMLATTR(<<"type">>, <<"text-private">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Password Verification")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Password Verification")),
|
||||||
?XMLATTR('var', <<"password-verify">>)], children =
|
?XMLATTR(<<"var">>, <<"password-verify">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1221,9 +1221,9 @@ get_form(_Host, ?NS_ADMINL("delete-user"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Delete User"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Delete User"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-multi">>),
|
[?XMLATTR(<<"type">>, <<"jid-multi">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjids">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjids">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1233,9 +1233,9 @@ get_form(_Host, ?NS_ADMINL("end-user-session"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "End User Session"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "End User Session"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1245,9 +1245,9 @@ get_form(_Host, ?NS_ADMINL("get-user-password"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Password"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Password"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1257,14 +1257,14 @@ get_form(_Host, ?NS_ADMINL("change-user-password"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Password"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Password"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"text-private">>),
|
[?XMLATTR(<<"type">>, <<"text-private">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Password")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Password")),
|
||||||
?XMLATTR('var', <<"password">>)], children =
|
?XMLATTR(<<"var">>, <<"password">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1274,9 +1274,9 @@ get_form(_Host, ?NS_ADMINL("get-user-lastlogin"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Last Login Time"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Last Login Time"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1286,9 +1286,9 @@ get_form(_Host, ?NS_ADMINL("user-stats"), Lang) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Statistics"))}]},
|
[#xmlcdata{cdata = list_to_binary(?T(Lang, "Get User Statistics"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"jid-single">>),
|
[?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Jabber ID")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Jabber ID")),
|
||||||
?XMLATTR('var', <<"accountjid">>)], children =
|
?XMLATTR(<<"var">>, <<"accountjid">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]}
|
||||||
]}]};
|
]}]};
|
||||||
|
|
||||||
@ -1298,9 +1298,9 @@ get_form(Host, ?NS_ADMINL("get-registered-users-num"), Lang) ->
|
|||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
||||||
[?HFIELD(),
|
[?HFIELD(),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"text-single">>),
|
[?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Number of registered users")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Number of registered users")),
|
||||||
?XMLATTR('var', <<"registeredusersnum">>)], children =
|
?XMLATTR(<<"var">>, <<"registeredusersnum">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
|
||||||
}]}]};
|
}]}]};
|
||||||
|
|
||||||
@ -1310,9 +1310,9 @@ get_form(Host, ?NS_ADMINL("get-online-users-num"), Lang) ->
|
|||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
||||||
[?HFIELD(),
|
[?HFIELD(),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"text-single">>),
|
[?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Number of online users")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Number of online users")),
|
||||||
?XMLATTR('var', <<"onlineusersnum">>)], children =
|
?XMLATTR(<<"var">>, <<"onlineusersnum">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
|
||||||
}]}]};
|
}]}]};
|
||||||
|
|
||||||
@ -1688,7 +1688,7 @@ set_form(From, Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
|
|||||||
_ ->
|
_ ->
|
||||||
?T(Lang, "Online")
|
?T(Lang, "Online")
|
||||||
end,
|
end,
|
||||||
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"result">>)], children =
|
{result, [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"result">>)], children =
|
||||||
[?HFIELD(),
|
[?HFIELD(),
|
||||||
?XFIELD(<<"jid-single">>, "Jabber ID", <<"accountjid">>, list_to_binary(AccountString)),
|
?XFIELD(<<"jid-single">>, "Jabber ID", <<"accountjid">>, list_to_binary(AccountString)),
|
||||||
?XFIELD(<<"text-single">>, "Last login", <<"lastlogin">>, list_to_binary(FLast))
|
?XFIELD(<<"text-single">>, "Last login", <<"lastlogin">>, list_to_binary(FLast))
|
||||||
@ -1748,12 +1748,12 @@ stop_node(From, Host, ENode, Action, XData) ->
|
|||||||
Delay = list_to_integer(get_value("delay", XData)),
|
Delay = list_to_integer(get_value("delay", XData)),
|
||||||
Subject = case get_value("subject", XData) of
|
Subject = case get_value("subject", XData) of
|
||||||
[] -> [];
|
[] -> [];
|
||||||
S -> [#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('var', <<"subject">>)], children =
|
S -> [#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"var">>, <<"subject">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(S)}]}]}]
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(S)}]}]}]
|
||||||
end,
|
end,
|
||||||
Announcement = case get_values("announcement", XData) of
|
Announcement = case get_values("announcement", XData) of
|
||||||
[] -> [];
|
[] -> [];
|
||||||
As -> [#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('var', <<"body">>)], children =
|
As -> [#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"var">>, <<"body">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Line)}]} || Line <- As] }]
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Line)}]} || Line <- As] }]
|
||||||
end,
|
end,
|
||||||
case Subject ++ Announcement of
|
case Subject ++ Announcement of
|
||||||
@ -1763,10 +1763,10 @@ stop_node(From, Host, ENode, Action, XData) ->
|
|||||||
node = binary_to_list(?NS_ADMINX(<<"announce-allhosts">>)),
|
node = binary_to_list(?NS_ADMINX(<<"announce-allhosts">>)),
|
||||||
action = "complete",
|
action = "complete",
|
||||||
xdata = #xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
xdata = #xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"submit">>)], children =
|
[?XMLATTR(<<"type">>, <<"submit">>)], children =
|
||||||
SubEls},
|
SubEls},
|
||||||
others= [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
others= [#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"submit">>)], children =
|
[?XMLATTR(<<"type">>, <<"submit">>)], children =
|
||||||
SubEls}]
|
SubEls}]
|
||||||
},
|
},
|
||||||
To = exmpp_jid:make(Host),
|
To = exmpp_jid:make(Host),
|
||||||
@ -1845,15 +1845,15 @@ get_sm_form(User, Server, "config", Lang) ->
|
|||||||
list_to_binary(?T(
|
list_to_binary(?T(
|
||||||
Lang, "Administration of ") ++ User)}]},
|
Lang, "Administration of ") ++ User)}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('type', <<"list-single">>),
|
[?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label', ?T(Lang, "Action on user")),
|
?XMLATTR(<<"label">>, ?T(Lang, "Action on user")),
|
||||||
?XMLATTR('var', <<"action">>)], children =
|
?XMLATTR(<<"var">>, <<"action">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"edit">>}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"edit">>}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
||||||
[?XMLATTR('label', ?T(Lang, "Edit Properties"))], children =
|
[?XMLATTR(<<"label">>, ?T(Lang, "Edit Properties"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"edit">>}]}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"edit">>}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', attrs =
|
||||||
[?XMLATTR('label', ?T(Lang, "Remove User"))], children =
|
[?XMLATTR(<<"label">>, ?T(Lang, "Remove User"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"remove">>}]}]}
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"remove">>}]}]}
|
||||||
]},
|
]},
|
||||||
?XFIELD(<<"text-private">>, "Password", <<"password">>,
|
?XFIELD(<<"text-private">>, "Password", <<"password">>,
|
||||||
|
@ -124,15 +124,15 @@ process_local_iq(From, To, #iq{type = Type, payload = Request} = IQ_Rec) ->
|
|||||||
process_get(#xmlel{ns = ?NS_ECONFIGURE, name = 'info'}) ->
|
process_get(#xmlel{ns = ?NS_ECONFIGURE, name = 'info'}) ->
|
||||||
S2SConns = ejabberd_s2s:dirty_get_connections(),
|
S2SConns = ejabberd_s2s:dirty_get_connections(),
|
||||||
TConns = lists:usort([element(2, C) || C <- S2SConns]),
|
TConns = lists:usort([element(2, C) || C <- S2SConns]),
|
||||||
Attrs = [?XMLATTR('registered-users', mnesia:table_info(passwd, size)),
|
Attrs = [?XMLATTR(<<"registered-users">>, mnesia:table_info(passwd, size)),
|
||||||
?XMLATTR('online-users', mnesia:table_info(presence, size)),
|
?XMLATTR(<<"online-users">>, mnesia:table_info(presence, size)),
|
||||||
?XMLATTR('running-nodes',
|
?XMLATTR(<<"running-nodes">>,
|
||||||
length(mnesia:system_info(running_db_nodes))),
|
length(mnesia:system_info(running_db_nodes))),
|
||||||
?XMLATTR('stopped-nodes',
|
?XMLATTR(<<"stopped-nodes">>,
|
||||||
length(lists:usort(mnesia:system_info(db_nodes) ++
|
length(lists:usort(mnesia:system_info(db_nodes) ++
|
||||||
mnesia:system_info(extra_db_nodes)) --
|
mnesia:system_info(extra_db_nodes)) --
|
||||||
mnesia:system_info(running_db_nodes))),
|
mnesia:system_info(running_db_nodes))),
|
||||||
?XMLATTR('outgoing-s2s-servers',
|
?XMLATTR(<<"outgoing-s2s-servers">>,
|
||||||
length(TConns))],
|
length(TConns))],
|
||||||
{result, #xmlel{ns = ?NS_ECONFIGURE, name = 'info', attrs = Attrs}};
|
{result, #xmlel{ns = ?NS_ECONFIGURE, name = 'info', attrs = Attrs}};
|
||||||
process_get(#xmlel{ns = ?NS_ECONFIGURE, name = 'welcome-message', attrs = Attrs}) ->
|
process_get(#xmlel{ns = ?NS_ECONFIGURE, name = 'welcome-message', attrs = Attrs}) ->
|
||||||
|
@ -124,14 +124,14 @@ unregister_extra_domain(HostB, Domain) when is_binary(HostB) ->
|
|||||||
|
|
||||||
process_local_iq_items(From, To, #iq{type = get, payload = SubEl,
|
process_local_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||||
lang = Lang} = IQ_Rec) ->
|
lang = Lang} = IQ_Rec) ->
|
||||||
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
|
Node = exmpp_xml:get_attribute_as_binary(SubEl, <<"node">>, <<>>),
|
||||||
|
|
||||||
Host = exmpp_jid:prep_domain(To),
|
Host = exmpp_jid:prep_domain(To),
|
||||||
case find_items(disco_local_items, Host, From, To, Node, Lang) of
|
case find_items(disco_local_items, Host, From, To, Node, Lang) of
|
||||||
{result, Items} ->
|
{result, Items} ->
|
||||||
ANode = case Node of
|
ANode = case Node of
|
||||||
<<>> -> [];
|
<<>> -> [];
|
||||||
_ -> [?XMLATTR('node', Node)]
|
_ -> [?XMLATTR(<<"node">>, Node)]
|
||||||
end,
|
end,
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
||||||
attrs = ANode, children = Items},
|
attrs = ANode, children = Items},
|
||||||
@ -145,7 +145,7 @@ process_local_iq_items(_From, _To, #iq{type = set} = IQ_Rec) ->
|
|||||||
|
|
||||||
process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
|
process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
|
||||||
lang = Lang} = IQ_Rec) ->
|
lang = Lang} = IQ_Rec) ->
|
||||||
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
|
Node = exmpp_xml:get_attribute_as_binary(SubEl, <<"node">>, <<>>),
|
||||||
HostB = exmpp_jid:prep_domain(To),
|
HostB = exmpp_jid:prep_domain(To),
|
||||||
Identity = ejabberd_hooks:run_fold(disco_local_identity,
|
Identity = ejabberd_hooks:run_fold(disco_local_identity,
|
||||||
HostB,
|
HostB,
|
||||||
@ -158,7 +158,7 @@ process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
|
|||||||
{result, Features} ->
|
{result, Features} ->
|
||||||
ANode = case Node of
|
ANode = case Node of
|
||||||
<<>> -> [];
|
<<>> -> [];
|
||||||
_ -> [?XMLATTR('node', Node)]
|
_ -> [?XMLATTR(<<"node">>, Node)]
|
||||||
end,
|
end,
|
||||||
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
||||||
attrs = ANode,
|
attrs = ANode,
|
||||||
@ -172,9 +172,9 @@ process_local_iq_info(_From, _To, #iq{type = set} = IQ_Rec) ->
|
|||||||
|
|
||||||
get_local_identity(Acc, _From, _To, <<>>, _Lang) ->
|
get_local_identity(Acc, _From, _To, <<>>, _Lang) ->
|
||||||
Acc ++ [#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [
|
Acc ++ [#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [
|
||||||
?XMLATTR('category', <<"server">>),
|
?XMLATTR(<<"category">>, <<"server">>),
|
||||||
?XMLATTR('type', <<"im">>),
|
?XMLATTR(<<"type">>, <<"im">>),
|
||||||
?XMLATTR('name', <<"ejabberd">>)
|
?XMLATTR(<<"name">>, <<"ejabberd">>)
|
||||||
]}];
|
]}];
|
||||||
|
|
||||||
get_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
get_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||||
@ -208,7 +208,7 @@ get_local_features(Acc, _From, _To, _Node, _Lang) ->
|
|||||||
features_to_xml(FeatureList) ->
|
features_to_xml(FeatureList) ->
|
||||||
%% Avoid duplicating features
|
%% Avoid duplicating features
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [?XMLATTR('var', Feat)]} ||
|
attrs = [?XMLATTR(<<"var">>, Feat)]} ||
|
||||||
Feat <- lists:usort(
|
Feat <- lists:usort(
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({{Feature, _Host}}) ->
|
fun({{Feature, _Host}}) ->
|
||||||
@ -228,7 +228,7 @@ domain_to_xml({Domain}) ->
|
|||||||
domain_to_xml(Domain);
|
domain_to_xml(Domain);
|
||||||
domain_to_xml(Domain) when is_binary(Domain)->
|
domain_to_xml(Domain) when is_binary(Domain)->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
||||||
?XMLATTR('jid', Domain)
|
?XMLATTR(<<"jid">>, Domain)
|
||||||
]};
|
]};
|
||||||
domain_to_xml(Domain) when is_list(Domain) ->
|
domain_to_xml(Domain) when is_list(Domain) ->
|
||||||
domain_to_xml(list_to_binary(Domain)).
|
domain_to_xml(list_to_binary(Domain)).
|
||||||
@ -284,13 +284,13 @@ get_vh_services(Host) ->
|
|||||||
|
|
||||||
process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
|
process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||||
lang = Lang} = IQ_Rec) ->
|
lang = Lang} = IQ_Rec) ->
|
||||||
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
|
Node = exmpp_xml:get_attribute_as_binary(SubEl, <<"node">>, <<>>),
|
||||||
Host = exmpp_jid:prep_domain(To),
|
Host = exmpp_jid:prep_domain(To),
|
||||||
case find_items(disco_sm_items, Host, From, To, Node, Lang) of
|
case find_items(disco_sm_items, Host, From, To, Node, Lang) of
|
||||||
{result, Items} ->
|
{result, Items} ->
|
||||||
ANode = case Node of
|
ANode = case Node of
|
||||||
<<>> -> [];
|
<<>> -> [];
|
||||||
_ -> [?XMLATTR('node', Node)]
|
_ -> [?XMLATTR(<<"node">>, Node)]
|
||||||
end,
|
end,
|
||||||
AItems = case Node of
|
AItems = case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
@ -362,7 +362,7 @@ process_sm_iq_info(From, To, #iq{type = get, payload = SubEl,
|
|||||||
lang = Lang} = IQ_Rec) ->
|
lang = Lang} = IQ_Rec) ->
|
||||||
case is_presence_subscribed(From, To) of
|
case is_presence_subscribed(From, To) of
|
||||||
true ->
|
true ->
|
||||||
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
|
Node = exmpp_xml:get_attribute_as_binary(SubEl, <<"node">>, <<>>),
|
||||||
Identity = ejabberd_hooks:run_fold(disco_sm_identity,
|
Identity = ejabberd_hooks:run_fold(disco_sm_identity,
|
||||||
exmpp_jid:prep_domain(To),
|
exmpp_jid:prep_domain(To),
|
||||||
[],
|
[],
|
||||||
@ -372,7 +372,7 @@ process_sm_iq_info(From, To, #iq{type = get, payload = SubEl,
|
|||||||
{result, Features} ->
|
{result, Features} ->
|
||||||
ANode = case Node of
|
ANode = case Node of
|
||||||
<<>> -> [];
|
<<>> -> [];
|
||||||
_ -> [?XMLATTR('node', Node)]
|
_ -> [?XMLATTR(<<"node">>, Node)]
|
||||||
end,
|
end,
|
||||||
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_INFO, name = 'query',
|
||||||
attrs = ANode,
|
attrs = ANode,
|
||||||
@ -421,9 +421,9 @@ get_user_resources(JID) ->
|
|||||||
exmpp_jid:prep_domain(JID)),
|
exmpp_jid:prep_domain(JID)),
|
||||||
lists:map(fun(R) ->
|
lists:map(fun(R) ->
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
|
||||||
?XMLATTR('jid',
|
?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(exmpp_jid:full(JID, R))),
|
exmpp_jid:to_binary(exmpp_jid:full(JID, R))),
|
||||||
?XMLATTR('name', exmpp_jid:prep_node(JID))
|
?XMLATTR(<<"name">>, exmpp_jid:prep_node(JID))
|
||||||
]}
|
]}
|
||||||
end, lists:sort(Rs)).
|
end, lists:sort(Rs)).
|
||||||
|
|
||||||
@ -440,13 +440,13 @@ get_info(Acc, Host, Mod, Node, _Lang) when Node == <<>> ->
|
|||||||
CData1 = #xmlcdata{cdata = list_to_binary(?NS_SERVERINFO_s)},
|
CData1 = #xmlcdata{cdata = list_to_binary(?NS_SERVERINFO_s)},
|
||||||
Value1 = #xmlel{name = 'value', children = [CData1]},
|
Value1 = #xmlel{name = 'value', children = [CData1]},
|
||||||
Field1 = #xmlel{name = 'field',
|
Field1 = #xmlel{name = 'field',
|
||||||
attrs = [?XMLATTR('type', <<"hidden">>),
|
attrs = [?XMLATTR(<<"type">>, <<"hidden">>),
|
||||||
?XMLATTR('var', <<"FORM_TYPE">>)],
|
?XMLATTR(<<"var">>, <<"FORM_TYPE">>)],
|
||||||
children = [Value1]
|
children = [Value1]
|
||||||
},
|
},
|
||||||
X = #xmlel{name = 'x',
|
X = #xmlel{name = 'x',
|
||||||
ns = ?NS_DATA_FORMS,
|
ns = ?NS_DATA_FORMS,
|
||||||
attrs = [?XMLATTR('type', <<"result">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"result">>)],
|
||||||
children = [Field1 | Serverinfo_fields]
|
children = [Field1 | Serverinfo_fields]
|
||||||
},
|
},
|
||||||
[X | Acc];
|
[X | Acc];
|
||||||
@ -475,7 +475,7 @@ fields_to_xml(Fields) ->
|
|||||||
field_to_xml({_, Var, Values}) ->
|
field_to_xml({_, Var, Values}) ->
|
||||||
Values_xml = values_to_xml(Values),
|
Values_xml = values_to_xml(Values),
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [?XMLATTR('var', list_to_binary(Var))],
|
attrs = [?XMLATTR(<<"var">>, list_to_binary(Var))],
|
||||||
children = Values_xml
|
children = Values_xml
|
||||||
}.
|
}.
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ stop(Host) ->
|
|||||||
process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
|
process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
|
||||||
Sec = get_node_uptime(),
|
Sec = get_node_uptime(),
|
||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
||||||
[?XMLATTR('seconds', Sec)]},
|
[?XMLATTR(<<"seconds">>, Sec)]},
|
||||||
exmpp_iq:result(IQ_Rec, Response);
|
exmpp_iq:result(IQ_Rec, Response);
|
||||||
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
@ -186,7 +186,7 @@ get_last_iq(IQ_Rec, LUser, LServer) ->
|
|||||||
_ ->
|
_ ->
|
||||||
Sec = 0,
|
Sec = 0,
|
||||||
#xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
#xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
||||||
attrs = [?XMLATTR('seconds', Sec)]}
|
attrs = [?XMLATTR(<<"seconds">>, Sec)]}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_last_iq_disconnected(IQ_Rec, LUser, LServer) ->
|
get_last_iq_disconnected(IQ_Rec, LUser, LServer) ->
|
||||||
@ -199,7 +199,7 @@ get_last_iq_disconnected(IQ_Rec, LUser, LServer) ->
|
|||||||
TimeStamp2 = now_to_seconds(now()),
|
TimeStamp2 = now_to_seconds(now()),
|
||||||
Sec = TimeStamp2 - TimeStamp,
|
Sec = TimeStamp2 - TimeStamp,
|
||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
||||||
attrs = [?XMLATTR('seconds', Sec)],
|
attrs = [?XMLATTR(<<"seconds">>, Sec)],
|
||||||
children = [#xmlcdata{cdata = Status}]},
|
children = [#xmlcdata{cdata = Status}]},
|
||||||
exmpp_iq:result(IQ_Rec, Response)
|
exmpp_iq:result(IQ_Rec, Response)
|
||||||
end.
|
end.
|
||||||
|
@ -71,7 +71,7 @@ stop(Host) ->
|
|||||||
process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
|
process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
|
||||||
Sec = get_node_uptime(),
|
Sec = get_node_uptime(),
|
||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
||||||
[?XMLATTR('seconds', Sec)]},
|
[?XMLATTR(<<"seconds">>, Sec)]},
|
||||||
exmpp_iq:result(IQ_Rec, Response);
|
exmpp_iq:result(IQ_Rec, Response);
|
||||||
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
@ -137,7 +137,7 @@ get_last(IQ_Rec, LUser, LServer) ->
|
|||||||
TimeStamp2 = now_to_seconds(now()),
|
TimeStamp2 = now_to_seconds(now()),
|
||||||
Sec = TimeStamp2 - TimeStamp,
|
Sec = TimeStamp2 - TimeStamp,
|
||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
||||||
attrs = [?XMLATTR('seconds', Sec)],
|
attrs = [?XMLATTR(<<"seconds">>, Sec)],
|
||||||
children = [#xmlcdata{cdata = list_to_binary(Status)}]},
|
children = [#xmlcdata{cdata = list_to_binary(Status)}]},
|
||||||
exmpp_iq:result(IQ_Rec, Response);
|
exmpp_iq:result(IQ_Rec, Response);
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -524,7 +524,7 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
end;
|
end;
|
||||||
'message' ->
|
'message' ->
|
||||||
case exmpp_xml:get_attribute_as_list(Packet,type, "chat") of
|
case exmpp_xml:get_attribute_as_list(Packet,<<"type">>, "chat") of
|
||||||
"error" ->
|
"error" ->
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
@ -676,32 +676,32 @@ register_room(Host, Room, Pid) ->
|
|||||||
|
|
||||||
iq_disco_info(Lang) ->
|
iq_disco_info(Lang) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [?XMLATTR('category',
|
attrs = [?XMLATTR(<<"category">>,
|
||||||
<<"conference">>),
|
<<"conference">>),
|
||||||
?XMLATTR('type',
|
?XMLATTR(<<"type">>,
|
||||||
<<"text">>),
|
<<"text">>),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
translate:translate(Lang, "Rooms"))]},
|
translate:translate(Lang, "Rooms"))]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_DISCO_INFO_s)]},
|
?NS_DISCO_INFO_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_DISCO_ITEMS_s)]},
|
?NS_DISCO_ITEMS_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_MUC_s)]},
|
?NS_MUC_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_MUC_UNIQUE_s)]},
|
?NS_MUC_UNIQUE_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_INBAND_REGISTER_s)]},
|
?NS_INBAND_REGISTER_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_RSM_s)]},
|
?NS_RSM_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs =
|
||||||
[?XMLATTR('var',
|
[?XMLATTR(<<"var">>,
|
||||||
?NS_VCARD_s)]}].
|
?NS_VCARD_s)]}].
|
||||||
|
|
||||||
|
|
||||||
@ -730,9 +730,9 @@ iq_disco_items(Host, From, Lang, Rsm) ->
|
|||||||
flush(),
|
flush(),
|
||||||
{true,
|
{true,
|
||||||
#xmlel{name = 'item',
|
#xmlel{name = 'item',
|
||||||
attrs = [?XMLATTR('jid',
|
attrs = [?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(exmpp_jid:make(Name, Host))),
|
exmpp_jid:to_binary(exmpp_jid:make(Name, Host))),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
Desc)]}};
|
Desc)]}};
|
||||||
_ ->
|
_ ->
|
||||||
false
|
false
|
||||||
@ -808,10 +808,10 @@ flush() ->
|
|||||||
|
|
||||||
-define(XFIELD(Type, Label, Var, Val),
|
-define(XFIELD(Type, Label, Var, Val),
|
||||||
#xmlel{name = "field",
|
#xmlel{name = "field",
|
||||||
attrs = [?XMLATTR('type', Type),
|
attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, Label)),
|
translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = Val}]}]}).
|
children = [#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ normal_state(_Event, StateData) ->
|
|||||||
%%----------------------------------------------------------------------
|
%%----------------------------------------------------------------------
|
||||||
handle_event({service_message, Msg}, _StateName, StateData) ->
|
handle_event({service_message, Msg}, _StateName, StateData) ->
|
||||||
MessagePkt = #xmlel{name = 'message',
|
MessagePkt = #xmlel{name = 'message',
|
||||||
attrs = [?XMLATTR('type', <<"groupchat">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"groupchat">>)],
|
||||||
children = [#xmlel{name = 'body',
|
children = [#xmlel{name = 'body',
|
||||||
children = [#xmlcdata{cdata = Msg}]}]},
|
children = [#xmlcdata{cdata = Msg}]}]},
|
||||||
send_multiple(
|
send_multiple(
|
||||||
@ -757,16 +757,16 @@ terminate(Reason, _StateName, StateData) ->
|
|||||||
_ -> <<"Room terminates">>
|
_ -> <<"Room terminates">>
|
||||||
end,
|
end,
|
||||||
ReasonEl = #xmlel{name = 'reason', children = [#xmlcdata{cdata = ReasonT}]},
|
ReasonEl = #xmlel{name = 'reason', children = [#xmlcdata{cdata = ReasonT}]},
|
||||||
ItemAttrs = [?XMLATTR('affiliation', <<"none">>),
|
ItemAttrs = [?XMLATTR(<<"affiliation">>, <<"none">>),
|
||||||
?XMLATTR('role', <<"none">>)],
|
?XMLATTR(<<"role">>, <<"none">>)],
|
||||||
XEls = [#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
XEls = [#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
||||||
attrs = ItemAttrs,
|
attrs = ItemAttrs,
|
||||||
children = [ReasonEl]},
|
children = [ReasonEl]},
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
||||||
attrs = [?XMLATTR('code', <<"332">>)]}],
|
attrs = [?XMLATTR(<<"code">>, <<"332">>)]}],
|
||||||
Packet = #xmlel{ns = ?NS_JABBER_CLIENT,
|
Packet = #xmlel{ns = ?NS_JABBER_CLIENT,
|
||||||
name = 'presence',
|
name = 'presence',
|
||||||
attrs = [?XMLATTR('type', <<"unavailable">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"unavailable">>)],
|
||||||
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||||
children = XEls}
|
children = XEls}
|
||||||
]},
|
]},
|
||||||
@ -1643,7 +1643,7 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
if not (NewState#state.config)#config.anonymous ->
|
if not (NewState#state.config)#config.anonymous ->
|
||||||
WPacket =
|
WPacket =
|
||||||
#xmlel{name = 'message',
|
#xmlel{name = 'message',
|
||||||
attrs = [?XMLATTR('type', <<"groupchat">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"groupchat">>)],
|
||||||
children = [
|
children = [
|
||||||
#xmlel{name = 'body',
|
#xmlel{name = 'body',
|
||||||
children = [#xmlcdata{cdata =
|
children = [#xmlcdata{cdata =
|
||||||
@ -1693,7 +1693,7 @@ add_new_user(From, Nick, Packet, StateData) ->
|
|||||||
SID, RoomJID, To, Lang, From) of
|
SID, RoomJID, To, Lang, From) of
|
||||||
{ok, ID, CaptchaEls} ->
|
{ok, ID, CaptchaEls} ->
|
||||||
MsgPkt = #xmlel{name = 'message',
|
MsgPkt = #xmlel{name = 'message',
|
||||||
attrs = [#xmlattr{name = 'id', value = list_to_binary(ID)}],
|
attrs = [#xmlattr{name = <<"id">>, value = list_to_binary(ID)}],
|
||||||
children = CaptchaEls},
|
children = CaptchaEls},
|
||||||
Robots = ?DICT:store(From,
|
Robots = ?DICT:store(From,
|
||||||
{Nick, Packet}, StateData#state.robots),
|
{Nick, Packet}, StateData#state.robots),
|
||||||
@ -1933,12 +1933,12 @@ send_new_presence(NJID, Reason, StateData) ->
|
|||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole)];
|
?XMLATTR(<<"role">>, SRole)];
|
||||||
_ ->
|
_ ->
|
||||||
[?XMLATTR('affiliation', SAffiliation),
|
[?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole)]
|
?XMLATTR(<<"role">>, SRole)]
|
||||||
end,
|
end,
|
||||||
ItemEls = case Reason of
|
ItemEls = case Reason of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
@ -1950,7 +1950,7 @@ send_new_presence(NJID, Reason, StateData) ->
|
|||||||
Status = case StateData#state.just_created of
|
Status = case StateData#state.just_created of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = 'status',
|
[#xmlel{name = 'status',
|
||||||
attrs = [?XMLATTR('code', <<"201">>)]}];
|
attrs = [?XMLATTR(<<"code">>, <<"201">>)]}];
|
||||||
false ->
|
false ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
@ -1958,7 +1958,7 @@ send_new_presence(NJID, Reason, StateData) ->
|
|||||||
andalso (NJID == Info#user.jid) of
|
andalso (NJID == Info#user.jid) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = 'status',
|
[#xmlel{name = 'status',
|
||||||
attrs = [?XMLATTR('code', <<"100">>)]}
|
attrs = [?XMLATTR(<<"code">>, <<"100">>)]}
|
||||||
| Status];
|
| Status];
|
||||||
false ->
|
false ->
|
||||||
Status
|
Status
|
||||||
@ -1998,14 +1998,14 @@ send_existing_presences(ToJID, StateData) ->
|
|||||||
((StateData#state.config)#config.anonymous ==
|
((StateData#state.config)#config.anonymous ==
|
||||||
false) of
|
false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(FromJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(FromJID)),
|
||||||
?XMLATTR('affiliation',
|
?XMLATTR(<<"affiliation">>,
|
||||||
affiliation_to_binary(FromAffiliation)),
|
affiliation_to_binary(FromAffiliation)),
|
||||||
?XMLATTR('role', role_to_binary(FromRole))];
|
?XMLATTR(<<"role">>, role_to_binary(FromRole))];
|
||||||
_ ->
|
_ ->
|
||||||
[?XMLATTR('affiliation',
|
[?XMLATTR(<<"affiliation">>,
|
||||||
affiliation_to_binary(FromAffiliation)),
|
affiliation_to_binary(FromAffiliation)),
|
||||||
?XMLATTR('role', role_to_binary(FromRole))]
|
?XMLATTR(<<"role">>, role_to_binary(FromRole))]
|
||||||
end,
|
end,
|
||||||
Packet = exmpp_xml:append_child(Presence,
|
Packet = exmpp_xml:append_child(Presence,
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||||
@ -2055,36 +2055,36 @@ send_nick_changing(JID, OldNick, StateData) ->
|
|||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole),
|
?XMLATTR(<<"role">>, SRole),
|
||||||
?XMLATTR('nick', Nick)];
|
?XMLATTR(<<"nick">>, Nick)];
|
||||||
_ ->
|
_ ->
|
||||||
[?XMLATTR('affiliation', SAffiliation),
|
[?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole),
|
?XMLATTR(<<"role">>, SRole),
|
||||||
?XMLATTR('nick', Nick)]
|
?XMLATTR(<<"nick">>, Nick)]
|
||||||
end,
|
end,
|
||||||
ItemAttrs2 =
|
ItemAttrs2 =
|
||||||
case (Info#user.role == moderator) orelse
|
case (Info#user.role == moderator) orelse
|
||||||
((StateData#state.config)#config.anonymous == false) of
|
((StateData#state.config)#config.anonymous == false) of
|
||||||
true ->
|
true ->
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(RealJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(RealJID)),
|
||||||
?XMLATTR('affiliation', SAffiliation),
|
?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole)];
|
?XMLATTR(<<"role">>, SRole)];
|
||||||
_ ->
|
_ ->
|
||||||
[?XMLATTR('affiliation', SAffiliation),
|
[?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', SRole)]
|
?XMLATTR(<<"role">>, SRole)]
|
||||||
end,
|
end,
|
||||||
Packet1 =
|
Packet1 =
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT,
|
#xmlel{ns = ?NS_JABBER_CLIENT,
|
||||||
name = 'presence',
|
name = 'presence',
|
||||||
attrs = [?XMLATTR('type', <<"unavailable">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"unavailable">>)],
|
||||||
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
||||||
attrs = ItemAttrs1},
|
attrs = ItemAttrs1},
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
||||||
attrs = [?XMLATTR('code',
|
attrs = [?XMLATTR(<<"code">>,
|
||||||
<<"303">>)]}]}]},
|
<<"303">>)]}]}]},
|
||||||
|
|
||||||
Packet2 = exmpp_xml:append_child(
|
Packet2 = exmpp_xml:append_child(
|
||||||
@ -2216,9 +2216,9 @@ process_iq_admin(From, get, Lang, SubEl, StateData) ->
|
|||||||
Item ->
|
Item ->
|
||||||
FAffiliation = get_affiliation(From, StateData),
|
FAffiliation = get_affiliation(From, StateData),
|
||||||
FRole = get_role(From, StateData),
|
FRole = get_role(From, StateData),
|
||||||
case exmpp_xml:get_attribute_as_binary(Item, 'role', false) of
|
case exmpp_xml:get_attribute_as_binary(Item, <<"role">>, false) of
|
||||||
false ->
|
false ->
|
||||||
case exmpp_xml:get_attribute_as_binary(Item, 'affiliation', false) of
|
case exmpp_xml:get_attribute_as_binary(Item, <<"affiliation">>, false) of
|
||||||
false ->
|
false ->
|
||||||
{error, 'bad-request'};
|
{error, 'bad-request'};
|
||||||
StrAffiliation ->
|
StrAffiliation ->
|
||||||
@ -2267,9 +2267,9 @@ items_with_affiliation(SAffiliation, StateData) ->
|
|||||||
fun({JID, {Affiliation, Reason}}) ->
|
fun({JID, {Affiliation, Reason}}) ->
|
||||||
{N, D, R} = JID,
|
{N, D, R} = JID,
|
||||||
#xmlel{name = 'item',
|
#xmlel{name = 'item',
|
||||||
attrs = [?XMLATTR('affiliation',
|
attrs = [?XMLATTR(<<"affiliation">>,
|
||||||
affiliation_to_binary(Affiliation)),
|
affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('jid',
|
?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(N, D, R))],
|
exmpp_jid:to_binary(N, D, R))],
|
||||||
children = [ #xmlel{name = 'reason',
|
children = [ #xmlel{name = 'reason',
|
||||||
children = [#xmlcdata{cdata = Reason}]}]};
|
children = [#xmlcdata{cdata = Reason}]}]};
|
||||||
@ -2277,9 +2277,9 @@ items_with_affiliation(SAffiliation, StateData) ->
|
|||||||
({JID, Affiliation}) ->
|
({JID, Affiliation}) ->
|
||||||
{N, D, R} = JID,
|
{N, D, R} = JID,
|
||||||
#xmlel{name = 'item',
|
#xmlel{name = 'item',
|
||||||
attrs = [?XMLATTR('affiliation',
|
attrs = [?XMLATTR(<<"affiliation">>,
|
||||||
affiliation_to_binary(Affiliation)),
|
affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('jid',
|
?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(N, D, R))]}
|
exmpp_jid:to_binary(N, D, R))]}
|
||||||
end, search_affiliation(SAffiliation, StateData)).
|
end, search_affiliation(SAffiliation, StateData)).
|
||||||
|
|
||||||
@ -2290,10 +2290,10 @@ user_to_item(#user{role = Role,
|
|||||||
Affiliation = get_affiliation(JID, StateData),
|
Affiliation = get_affiliation(JID, StateData),
|
||||||
#xmlel{name = 'item',
|
#xmlel{name = 'item',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('role', role_to_binary(Role)),
|
?XMLATTR(<<"role">>, role_to_binary(Role)),
|
||||||
?XMLATTR('affiliation', affiliation_to_binary(Affiliation)),
|
?XMLATTR(<<"affiliation">>, affiliation_to_binary(Affiliation)),
|
||||||
?XMLATTR('nick', Nick),
|
?XMLATTR(<<"nick">>, Nick),
|
||||||
?XMLATTR('jid', exmpp_jid:to_binary(JID))]
|
?XMLATTR(<<"jid">>, exmpp_jid:to_binary(JID))]
|
||||||
}.
|
}.
|
||||||
|
|
||||||
search_role(Role, StateData) ->
|
search_role(Role, StateData) ->
|
||||||
@ -2418,7 +2418,7 @@ find_changed_items(UJID, UAffiliation, URole, [#xmlcdata{} | Items],
|
|||||||
find_changed_items(UJID, UAffiliation, URole,
|
find_changed_items(UJID, UAffiliation, URole,
|
||||||
[#xmlel{name = 'item'} = Item | Items],
|
[#xmlel{name = 'item'} = Item | Items],
|
||||||
Lang, StateData, Res) ->
|
Lang, StateData, Res) ->
|
||||||
TJID = case exmpp_xml:get_attribute_as_binary(Item, 'jid',false) of
|
TJID = case exmpp_xml:get_attribute_as_binary(Item, <<"jid">>,false) of
|
||||||
S when S =/= false ->
|
S when S =/= false ->
|
||||||
try exmpp_jid:parse(S) of
|
try exmpp_jid:parse(S) of
|
||||||
J ->
|
J ->
|
||||||
@ -2432,7 +2432,7 @@ find_changed_items(UJID, UAffiliation, URole,
|
|||||||
{error, ?ERR(Item, 'not-acceptable', Lang, ErrText)}
|
{error, ?ERR(Item, 'not-acceptable', Lang, ErrText)}
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
case exmpp_xml:get_attribute(Item, 'nick', false) of
|
case exmpp_xml:get_attribute(Item, <<"nick">>, false) of
|
||||||
N when N =/= false ->
|
N when N =/= false ->
|
||||||
case find_jid_by_nick(N, StateData) of
|
case find_jid_by_nick(N, StateData) of
|
||||||
false ->
|
false ->
|
||||||
@ -2454,9 +2454,9 @@ find_changed_items(UJID, UAffiliation, URole,
|
|||||||
{value, JID} ->
|
{value, JID} ->
|
||||||
TAffiliation = get_affiliation(JID, StateData),
|
TAffiliation = get_affiliation(JID, StateData),
|
||||||
TRole = get_role(JID, StateData),
|
TRole = get_role(JID, StateData),
|
||||||
case exmpp_xml:get_attribute_as_binary(Item, 'role',false) of
|
case exmpp_xml:get_attribute_as_binary(Item, <<"role">>,false) of
|
||||||
false ->
|
false ->
|
||||||
case exmpp_xml:get_attribute_as_binary(Item, 'affiliation', false) of
|
case exmpp_xml:get_attribute_as_binary(Item, <<"affiliation">>, false) of
|
||||||
false ->
|
false ->
|
||||||
{error, 'bad-request'};
|
{error, 'bad-request'};
|
||||||
StrAffiliation ->
|
StrAffiliation ->
|
||||||
@ -2764,8 +2764,8 @@ send_kickban_presence1(UJID, Reason, Code, Affiliation, StateData) ->
|
|||||||
SAffiliation = affiliation_to_binary(Affiliation),
|
SAffiliation = affiliation_to_binary(Affiliation),
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({_LJID, Info}) ->
|
fun({_LJID, Info}) ->
|
||||||
ItemAttrs = [?XMLATTR('affiliation', SAffiliation),
|
ItemAttrs = [?XMLATTR(<<"affiliation">>, SAffiliation),
|
||||||
?XMLATTR('role', <<"none">>)],
|
?XMLATTR(<<"role">>, <<"none">>)],
|
||||||
ItemEls = case Reason of
|
ItemEls = case Reason of
|
||||||
"" ->
|
"" ->
|
||||||
[];
|
[];
|
||||||
@ -2776,14 +2776,14 @@ send_kickban_presence1(UJID, Reason, Code, Affiliation, StateData) ->
|
|||||||
Packet =
|
Packet =
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT,
|
#xmlel{ns = ?NS_JABBER_CLIENT,
|
||||||
name = 'presence',
|
name = 'presence',
|
||||||
attrs = [?XMLATTR('type', <<"unavailable">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"unavailable">>)],
|
||||||
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
#xmlel{ns = ?NS_MUC_USER, name = 'item',
|
||||||
attrs = ItemAttrs,
|
attrs = ItemAttrs,
|
||||||
children = ItemEls},
|
children = ItemEls},
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
#xmlel{ns = ?NS_MUC_USER, name = 'status',
|
||||||
attrs = [?XMLATTR('code',
|
attrs = [?XMLATTR(<<"code">>,
|
||||||
Code)]}]}]},
|
Code)]}]}]},
|
||||||
ejabberd_router:route(
|
ejabberd_router:route(
|
||||||
jid_replace_resource(StateData#state.jid, Nick),
|
jid_replace_resource(StateData#state.jid, Nick),
|
||||||
@ -2802,7 +2802,7 @@ process_iq_owner(From, set, Lang, SubEl, StateData) ->
|
|||||||
owner ->
|
owner ->
|
||||||
case exmpp_xml:get_child_elements(SubEl) of
|
case exmpp_xml:get_child_elements(SubEl) of
|
||||||
[#xmlel{ns = XMLNS, name = 'x'} = XEl] ->
|
[#xmlel{ns = XMLNS, name = 'x'} = XEl] ->
|
||||||
case {XMLNS, exmpp_xml:get_attribute_as_binary(XEl, 'type',false)} of
|
case {XMLNS, exmpp_xml:get_attribute_as_binary(XEl, <<"type">>,false)} of
|
||||||
{?NS_DATA_FORMS, <<"cancel">>} ->
|
{?NS_DATA_FORMS, <<"cancel">>} ->
|
||||||
{result, [], StateData};
|
{result, [], StateData};
|
||||||
{?NS_DATA_FORMS, <<"submit">>} ->
|
{?NS_DATA_FORMS, <<"submit">>} ->
|
||||||
@ -2842,7 +2842,7 @@ process_iq_owner(From, get, Lang, SubEl, StateData) ->
|
|||||||
[] ->
|
[] ->
|
||||||
get_config(Lang, StateData, From);
|
get_config(Lang, StateData, From);
|
||||||
[Item] ->
|
[Item] ->
|
||||||
case exmpp_xml:get_attribute_as_binary(Item, 'affiliation',false) of
|
case exmpp_xml:get_attribute_as_binary(Item, <<"affiliation">>,false) of
|
||||||
false ->
|
false ->
|
||||||
{error, 'bad-request'};
|
{error, 'bad-request'};
|
||||||
StrAffiliation ->
|
StrAffiliation ->
|
||||||
@ -2954,9 +2954,9 @@ is_password_settings_correct(XEl, StateData) ->
|
|||||||
|
|
||||||
-define(XFIELD(Type, Label, Var, Val),
|
-define(XFIELD(Type, Label, Var, Val),
|
||||||
#xmlel{name = 'field',
|
#xmlel{name = 'field',
|
||||||
attrs = [?XMLATTR('type', Type),
|
attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = Val} ]}]}).
|
children = [#xmlcdata{cdata = Val} ]}]}).
|
||||||
|
|
||||||
@ -2996,8 +2996,8 @@ get_config(Lang, StateData, From) ->
|
|||||||
list_to_binary(io_lib:format(translate:translate(Lang, "Configuration of room ~s"),
|
list_to_binary(io_lib:format(translate:translate(Lang, "Configuration of room ~s"),
|
||||||
[exmpp_jid:to_list(StateData#state.jid)]))
|
[exmpp_jid:to_list(StateData#state.jid)]))
|
||||||
}]},
|
}]},
|
||||||
#xmlel{name = 'field', attrs = [?XMLATTR('type', <<"hidden">>),
|
#xmlel{name = 'field', attrs = [?XMLATTR(<<"type">>, <<"hidden">>),
|
||||||
?XMLATTR('var', <<"FORM_TYPE">>)],
|
?XMLATTR(<<"var">>, <<"FORM_TYPE">>)],
|
||||||
children = [#xmlel{name = 'value', children = [#xmlcdata{cdata =
|
children = [#xmlel{name = 'value', children = [#xmlcdata{cdata =
|
||||||
<<"http://jabber.org/protocol/muc#roomconfig">>
|
<<"http://jabber.org/protocol/muc#roomconfig">>
|
||||||
}]}]},
|
}]}]},
|
||||||
@ -3032,44 +3032,44 @@ get_config(Lang, StateData, From) ->
|
|||||||
false -> ""
|
false -> ""
|
||||||
end),
|
end),
|
||||||
#xmlel{name = 'field', attrs = [
|
#xmlel{name = 'field', attrs = [
|
||||||
?XMLATTR('type', <<"list-single">>),
|
?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang,
|
?XMLATTR(<<"label">>, translate:translate(Lang,
|
||||||
"Maximum Number of Occupants")),
|
"Maximum Number of Occupants")),
|
||||||
?XMLATTR('var', <<"muc#roomconfig_maxusers">>)],
|
?XMLATTR(<<"var">>, <<"muc#roomconfig_maxusers">>)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata =
|
children = [#xmlcdata{cdata =
|
||||||
list_to_binary(MaxUsersRoomString)}]}] ++
|
list_to_binary(MaxUsersRoomString)}]}] ++
|
||||||
if
|
if
|
||||||
is_integer(ServiceMaxUsers) -> [];
|
is_integer(ServiceMaxUsers) -> [];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = 'option', attrs = [?XMLATTR('label',
|
[#xmlel{name = 'option', attrs = [?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, "No limit"))],
|
translate:translate(Lang, "No limit"))],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = <<"none">>}]}]}]
|
children = [#xmlcdata{cdata = <<"none">>}]}]}]
|
||||||
end ++
|
end ++
|
||||||
[#xmlel{name = 'option', attrs = [?XMLATTR('label', N)],
|
[#xmlel{name = 'option', attrs = [?XMLATTR(<<"label">>, N)],
|
||||||
children = [#xmlel{name = 'value', children = [
|
children = [#xmlel{name = 'value', children = [
|
||||||
#xmlcdata{cdata = list_to_binary(erlang:integer_to_list(N))}]}]} ||
|
#xmlcdata{cdata = list_to_binary(erlang:integer_to_list(N))}]}]} ||
|
||||||
N <- lists:usort([ServiceMaxUsers, DefaultRoomMaxUsers, MaxUsersRoomInteger |
|
N <- lists:usort([ServiceMaxUsers, DefaultRoomMaxUsers, MaxUsersRoomInteger |
|
||||||
?MAX_USERS_DEFAULT_LIST]), N =< ServiceMaxUsers]},
|
?MAX_USERS_DEFAULT_LIST]), N =< ServiceMaxUsers]},
|
||||||
#xmlel{name = 'field', attrs = [
|
#xmlel{name = 'field', attrs = [
|
||||||
?XMLATTR('type', <<"list-single">>),
|
?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, "Present real Jabber IDs to")),
|
translate:translate(Lang, "Present real Jabber IDs to")),
|
||||||
?XMLATTR('var', <<"muc#roomconfig_whois">>)],
|
?XMLATTR(<<"var">>, <<"muc#roomconfig_whois">>)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata =
|
children = [#xmlcdata{cdata =
|
||||||
if Config#config.anonymous -> <<"moderators">>;
|
if Config#config.anonymous -> <<"moderators">>;
|
||||||
true -> <<"anyone">>
|
true -> <<"anyone">>
|
||||||
end}]},
|
end}]},
|
||||||
#xmlel{name = 'option', attrs = [
|
#xmlel{name = 'option', attrs = [
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, "moderators only"))],
|
translate:translate(Lang, "moderators only"))],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata =
|
children = [#xmlcdata{cdata =
|
||||||
<<"moderators">>}]}]},
|
<<"moderators">>}]}]},
|
||||||
#xmlel{name = 'option', attrs = [
|
#xmlel{name = 'option', attrs = [
|
||||||
?XMLATTR('label',
|
?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, "anyone"))],
|
translate:translate(Lang, "anyone"))],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata =
|
children = [#xmlcdata{cdata =
|
||||||
@ -3122,7 +3122,7 @@ get_config(Lang, StateData, From) ->
|
|||||||
#xmlcdata{cdata = translate:translate(Lang,
|
#xmlcdata{cdata = translate:translate(Lang,
|
||||||
"You need an x:data capable client to configure room")}]},
|
"You need an x:data capable client to configure room")}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'x',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'x',
|
||||||
attrs = [?XMLATTR('type', <<"form">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"form">>)],
|
||||||
children = Res}],
|
children = Res}],
|
||||||
StateData}.
|
StateData}.
|
||||||
|
|
||||||
@ -3364,11 +3364,11 @@ destroy_room(DEl, StateData) ->
|
|||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({_LJID, Info}) ->
|
fun({_LJID, Info}) ->
|
||||||
Nick = Info#user.nick,
|
Nick = Info#user.nick,
|
||||||
ItemAttrs = [?XMLATTR('affiliation', <<"none">>),
|
ItemAttrs = [?XMLATTR(<<"affiliation">>, <<"none">>),
|
||||||
?XMLATTR('role', <<"none">>)],
|
?XMLATTR(<<"role">>, <<"none">>)],
|
||||||
Packet = #xmlel{ns = ?NS_JABBER_CLIENT,
|
Packet = #xmlel{ns = ?NS_JABBER_CLIENT,
|
||||||
name = 'presence',
|
name = 'presence',
|
||||||
attrs = [?XMLATTR('type',
|
attrs = [?XMLATTR(<<"type">>,
|
||||||
<<"unavailable">>)],
|
<<"unavailable">>)],
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_MUC_USER, name = 'x', children =
|
#xmlel{ns = ?NS_MUC_USER, name = 'x', children =
|
||||||
@ -3394,7 +3394,7 @@ destroy_room(DEl, StateData) ->
|
|||||||
% Disco
|
% Disco
|
||||||
|
|
||||||
-define(FEATURE(Var), #xmlel{name = 'feature',
|
-define(FEATURE(Var), #xmlel{name = 'feature',
|
||||||
attrs = [?XMLATTR('var', Var)]}).
|
attrs = [?XMLATTR(<<"var">>, Var)]}).
|
||||||
|
|
||||||
-define(CONFIG_OPT_TO_FEATURE(Opt, Fiftrue, Fiffalse),
|
-define(CONFIG_OPT_TO_FEATURE(Opt, Fiftrue, Fiffalse),
|
||||||
case Opt of
|
case Opt of
|
||||||
@ -3410,13 +3410,13 @@ process_iq_disco_info(_From, set, _Lang, _StateData) ->
|
|||||||
process_iq_disco_info(_From, get, Lang, StateData) ->
|
process_iq_disco_info(_From, get, Lang, StateData) ->
|
||||||
Config = StateData#state.config,
|
Config = StateData#state.config,
|
||||||
{result, [ #xmlel{name = 'identity',
|
{result, [ #xmlel{name = 'identity',
|
||||||
attrs = [?XMLATTR('category',
|
attrs = [?XMLATTR(<<"category">>,
|
||||||
<<"conference">>),
|
<<"conference">>),
|
||||||
?XMLATTR('type', <<"text">>),
|
?XMLATTR(<<"type">>, <<"text">>),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
get_title(StateData))]},
|
get_title(StateData))]},
|
||||||
#xmlel{name = 'feature',
|
#xmlel{name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_MUC_s)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_MUC_s)]},
|
||||||
|
|
||||||
?CONFIG_OPT_TO_FEATURE(Config#config.public,
|
?CONFIG_OPT_TO_FEATURE(Config#config.public,
|
||||||
"muc_public", "muc_hidden"),
|
"muc_public", "muc_hidden"),
|
||||||
@ -3433,15 +3433,15 @@ process_iq_disco_info(_From, get, Lang, StateData) ->
|
|||||||
] ++ iq_disco_info_extras(Lang, StateData), StateData}.
|
] ++ iq_disco_info_extras(Lang, StateData), StateData}.
|
||||||
|
|
||||||
-define(RFIELDT(Type, Var, Val),
|
-define(RFIELDT(Type, Var, Val),
|
||||||
#xmlel{name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
||||||
|
|
||||||
-define(RFIELD(Label, Var, Val),
|
-define(RFIELD(Label, Var, Val),
|
||||||
#xmlel{name = 'field', attrs = [?XMLATTR('label',
|
#xmlel{name = 'field', attrs = [?XMLATTR(<<"label">>,
|
||||||
translate:translate(Lang, Label)),
|
translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value', children = [
|
children = [#xmlel{name = 'value', children = [
|
||||||
#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
||||||
|
|
||||||
@ -3449,7 +3449,7 @@ iq_disco_info_extras(Lang, StateData) ->
|
|||||||
Len = length(?DICT:to_list(StateData#state.users)),
|
Len = length(?DICT:to_list(StateData#state.users)),
|
||||||
RoomDescription = (StateData#state.config)#config.description,
|
RoomDescription = (StateData#state.config)#config.description,
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x',
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x',
|
||||||
attrs = [?XMLATTR('type', <<"result">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"result">>)],
|
||||||
children =
|
children =
|
||||||
[?RFIELDT("hidden", "FORM_TYPE",
|
[?RFIELDT("hidden", "FORM_TYPE",
|
||||||
"http://jabber.org/protocol/muc#roominfo"),
|
"http://jabber.org/protocol/muc#roominfo"),
|
||||||
@ -3520,12 +3520,12 @@ get_mucroom_disco_items(StateData) ->
|
|||||||
lists:map(
|
lists:map(
|
||||||
fun({_LJID, Info}) ->
|
fun({_LJID, Info}) ->
|
||||||
Nick = Info#user.nick,
|
Nick = Info#user.nick,
|
||||||
#xmlel{name = 'item', attrs = [?XMLATTR('jid',
|
#xmlel{name = 'item', attrs = [?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(
|
exmpp_jid:to_binary(
|
||||||
StateData#state.room,
|
StateData#state.room,
|
||||||
StateData#state.host,
|
StateData#state.host,
|
||||||
Nick)),
|
Nick)),
|
||||||
?XMLATTR('name',
|
?XMLATTR(<<"name">>,
|
||||||
Nick)]}
|
Nick)]}
|
||||||
end,
|
end,
|
||||||
?DICT:to_list(StateData#state.users)).
|
?DICT:to_list(StateData#state.users)).
|
||||||
@ -3554,7 +3554,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
throw({error, 'bad-request'})
|
throw({error, 'bad-request'})
|
||||||
end,
|
end,
|
||||||
JID = try exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(InviteEl,
|
JID = try exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(InviteEl,
|
||||||
'to',
|
<<"to">>,
|
||||||
false)) of
|
false)) of
|
||||||
JID1 -> JID1
|
JID1 -> JID1
|
||||||
catch
|
catch
|
||||||
@ -3579,7 +3579,7 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
IEl =
|
IEl =
|
||||||
[#xmlel{ns = ?NS_MUC_USER,
|
[#xmlel{ns = ?NS_MUC_USER,
|
||||||
name = 'invite',
|
name = 'invite',
|
||||||
attrs = [?XMLATTR('from',
|
attrs = [?XMLATTR(<<"from">>,
|
||||||
exmpp_jid:to_binary(From))],
|
exmpp_jid:to_binary(From))],
|
||||||
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
|
children = [#xmlel{ns =?NS_MUC_USER, name = 'reason',
|
||||||
children = [#xmlcdata{cdata = Reason} ]}]
|
children = [#xmlcdata{cdata = Reason} ]}]
|
||||||
@ -3621,11 +3621,11 @@ check_invitation(From, Els, Lang, StateData) ->
|
|||||||
%%TODO: always NS_JABBER_CLIENT?
|
%%TODO: always NS_JABBER_CLIENT?
|
||||||
Msg =
|
Msg =
|
||||||
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'message',
|
#xmlel{ns = ?NS_JABBER_CLIENT, name = 'message',
|
||||||
attrs = [?XMLATTR('type', <<"normal">>)],
|
attrs = [?XMLATTR(<<"type">>, <<"normal">>)],
|
||||||
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
children = [#xmlel{ns = ?NS_MUC_USER, name = 'x',
|
||||||
children = IEl ++ PasswdEl},
|
children = IEl ++ PasswdEl},
|
||||||
#xmlel{ns = 'jabber:x:conference', name = 'x',
|
#xmlel{ns = 'jabber:x:conference', name = 'x',
|
||||||
attrs = [?XMLATTR('jid',
|
attrs = [?XMLATTR(<<"jid">>,
|
||||||
exmpp_jid:to_binary(
|
exmpp_jid:to_binary(
|
||||||
StateData#state.room,
|
StateData#state.room,
|
||||||
StateData#state.host)
|
StateData#state.host)
|
||||||
@ -3655,7 +3655,7 @@ check_decline_invitation(Packet) ->
|
|||||||
#xmlel{name = 'message'} = Packet,
|
#xmlel{name = 'message'} = Packet,
|
||||||
#xmlel{ns = ?NS_MUC_USER} = XEl = exmpp_xml:get_element(Packet, 'x'),
|
#xmlel{ns = ?NS_MUC_USER} = XEl = exmpp_xml:get_element(Packet, 'x'),
|
||||||
DEl = exmpp_xml:get_element(XEl, 'decline'),
|
DEl = exmpp_xml:get_element(XEl, 'decline'),
|
||||||
ToString = exmpp_xml:get_attribute_as_binary(DEl, 'to', false),
|
ToString = exmpp_xml:get_attribute_as_binary(DEl, <<"to">>, false),
|
||||||
ToJID = exmpp_jid:parse(ToString),
|
ToJID = exmpp_jid:parse(ToString),
|
||||||
{true, {Packet, XEl, DEl, ToJID}}.
|
{true, {Packet, XEl, DEl, ToJID}}.
|
||||||
|
|
||||||
@ -3666,7 +3666,7 @@ send_decline_invitation({Packet, XEl, DEl = #xmlel{name='decline'}, ToJID},
|
|||||||
FromString = exmpp_jid:to_binary(FromJID),
|
FromString = exmpp_jid:to_binary(FromJID),
|
||||||
|
|
||||||
DEl1 = exmpp_xml:remove_attribute(DEl, 'to'),
|
DEl1 = exmpp_xml:remove_attribute(DEl, 'to'),
|
||||||
DEl2 = exmpp_xml:set_attribute(DEl1, 'from',FromString),
|
DEl2 = exmpp_xml:set_attribute(DEl1, <<"from">>,FromString),
|
||||||
XEl2 = replace_subelement(XEl,DEl2),
|
XEl2 = replace_subelement(XEl,DEl2),
|
||||||
Packet2 = replace_subelement(Packet,XEl2),
|
Packet2 = replace_subelement(Packet,XEl2),
|
||||||
ejabberd_router:route(RoomJID, ToJID, Packet2).
|
ejabberd_router:route(RoomJID, ToJID, Packet2).
|
||||||
|
@ -206,7 +206,7 @@ handle_info({route, From, To, #xmlel{name=iq} = Packet}, State) ->
|
|||||||
ejabberd_router:route(To, From, Err);
|
ejabberd_router:route(To, From, Err);
|
||||||
reply ->
|
reply ->
|
||||||
LServiceS = jts(To),
|
LServiceS = jts(To),
|
||||||
case exmpp_xml:get_attribute_as_list(Packet, type, "error") of
|
case exmpp_xml:get_attribute_as_list(Packet, <<"type">>, "error") of
|
||||||
"result" -> process_iqreply_result(From, LServiceS, Packet, State);
|
"result" -> process_iqreply_result(From, LServiceS, Packet, State);
|
||||||
"error" -> process_iqreply_error(From, LServiceS, Packet)
|
"error" -> process_iqreply_error(From, LServiceS, Packet)
|
||||||
end
|
end
|
||||||
@ -299,13 +299,13 @@ process_iq(_, #iq{type=Type}, _) when Type==result; Type==error ->
|
|||||||
process_iq(_, _IQ, _) ->
|
process_iq(_, _IQ, _) ->
|
||||||
unknown_iq.
|
unknown_iq.
|
||||||
|
|
||||||
-define(FEATURE(Feat), #xmlel{name = feature, attrs = [#xmlattr{name = var, value = Feat}]}).
|
-define(FEATURE(Feat), #xmlel{name = feature, attrs = [#xmlattr{name = <<"var">>, value = Feat}]}).
|
||||||
|
|
||||||
iq_disco_info(From, Lang, State) ->
|
iq_disco_info(From, Lang, State) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"service">>),
|
attrs = [?XMLATTR(<<"category">>, <<"service">>),
|
||||||
?XMLATTR('type', <<"multicast">>),
|
?XMLATTR(<<"type">>, <<"multicast">>),
|
||||||
?XMLATTR('name', translate:translate(Lang,
|
?XMLATTR(<<"name">>, translate:translate(Lang,
|
||||||
"Multicast"))]},
|
"Multicast"))]},
|
||||||
?FEATURE(?NS_DISCO_INFO_b),
|
?FEATURE(?NS_DISCO_INFO_b),
|
||||||
?FEATURE(?NS_DISCO_ITEMS_b),
|
?FEATURE(?NS_DISCO_ITEMS_b),
|
||||||
@ -342,8 +342,8 @@ route_trusted(LServiceS, LServerS, FromJID, Destinations, Packet) ->
|
|||||||
DS = jts(D),
|
DS = jts(D),
|
||||||
XML = #xmlel{name = address,
|
XML = #xmlel{name = address,
|
||||||
ns = ?NS_ADDRESS,
|
ns = ?NS_ADDRESS,
|
||||||
attrs = [#xmlattr{name = type, value = <<"bcc">>},
|
attrs = [#xmlattr{name = <<"type">>, value = <<"bcc">>},
|
||||||
#xmlattr{name = jid, value = list_to_binary(DS)}] },
|
#xmlattr{name = <<"jid">>, value = list_to_binary(DS)}] },
|
||||||
#dest{jid_string = DS,
|
#dest{jid_string = DS,
|
||||||
jid_jid = D,
|
jid_jid = D,
|
||||||
type = "bcc",
|
type = "bcc",
|
||||||
@ -479,10 +479,10 @@ split_addresses_todeliver(Addresses) ->
|
|||||||
fun(XML) ->
|
fun(XML) ->
|
||||||
case XML of
|
case XML of
|
||||||
#xmlel{name = address} = Packet ->
|
#xmlel{name = address} = Packet ->
|
||||||
case exmpp_xml:get_attribute_as_binary(Packet, "delivered", no_delivered) of
|
case exmpp_xml:get_attribute_as_binary(Packet, <<"delivered">>, no_delivered) of
|
||||||
<<"true">> -> false;
|
<<"true">> -> false;
|
||||||
_ ->
|
_ ->
|
||||||
Type = exmpp_xml:get_attribute_as_binary(Packet, "type", no_type),
|
Type = exmpp_xml:get_attribute_as_binary(Packet, <<"type">>, no_type),
|
||||||
case Type of
|
case Type of
|
||||||
<<"to">> -> true;
|
<<"to">> -> true;
|
||||||
<<"cc">> -> true;
|
<<"cc">> -> true;
|
||||||
@ -516,11 +516,11 @@ check_limit_dests(SLimits, FromJID, Packet, Addresses) ->
|
|||||||
convert_dest_record(XMLs) ->
|
convert_dest_record(XMLs) ->
|
||||||
lists:map(
|
lists:map(
|
||||||
fun(XML) ->
|
fun(XML) ->
|
||||||
case exmpp_xml:get_attribute_as_list(XML, jid, "") of
|
case exmpp_xml:get_attribute_as_list(XML, <<"jid">>, "") of
|
||||||
[] ->
|
[] ->
|
||||||
#dest{jid_string = none, full_xml = XML};
|
#dest{jid_string = none, full_xml = XML};
|
||||||
JIDS ->
|
JIDS ->
|
||||||
Type = exmpp_xml:get_attribute_as_list(XML, type, ""),
|
Type = exmpp_xml:get_attribute_as_list(XML, <<"type">>, ""),
|
||||||
JIDJ = stj(JIDS),
|
JIDJ = stj(JIDS),
|
||||||
#dest{jid_string = JIDS,
|
#dest{jid_string = JIDS,
|
||||||
jid_jid = JIDJ,
|
jid_jid = JIDJ,
|
||||||
@ -603,7 +603,7 @@ build_other_xml(Dests) ->
|
|||||||
Dests).
|
Dests).
|
||||||
|
|
||||||
add_delivered(Stanza) ->
|
add_delivered(Stanza) ->
|
||||||
exmpp_xml:set_attribute(Stanza, delivered, 'true').
|
exmpp_xml:set_attribute(Stanza, <<"delivered">>, <<"true">>).
|
||||||
|
|
||||||
%%%==================================
|
%%%==================================
|
||||||
%%%% Add preliminary packets
|
%%%% Add preliminary packets
|
||||||
@ -782,7 +782,7 @@ process_discoinfo_result2(From, FromS, LServiceS, Els, Waiter) ->
|
|||||||
fun(XML) ->
|
fun(XML) ->
|
||||||
case XML of
|
case XML of
|
||||||
#xmlel{name = feature, attrs = Attrs} ->
|
#xmlel{name = feature, attrs = Attrs} ->
|
||||||
?NS_ADDRESS_b == exmpp_xml:get_attribute_from_list_as_binary(Attrs, var, "");
|
?NS_ADDRESS_b == exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"var">>, "");
|
||||||
_ -> false
|
_ -> false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -850,8 +850,9 @@ get_limits_els(Els) ->
|
|||||||
fun(XML, R) ->
|
fun(XML, R) ->
|
||||||
case XML of
|
case XML of
|
||||||
#xmlel{name = x, attrs = Attrs, children = SubEls} ->
|
#xmlel{name = x, attrs = Attrs, children = SubEls} ->
|
||||||
case (?NS_DATA_FORMS_b == exmpp_xml:get_attribute_from_list_as_binary(Attrs, xmlns, "")) and
|
%%TODO: do ask for "xmlns" works here?. Seems it should ask for namespace?
|
||||||
(<<"result">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, type, "")) of
|
case (?NS_DATA_FORMS_b == exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"xmlns">>, "")) and
|
||||||
|
(<<"result">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"type">>, "")) of
|
||||||
true -> get_limits_fields(SubEls) ++ R;
|
true -> get_limits_fields(SubEls) ++ R;
|
||||||
false -> R
|
false -> R
|
||||||
end;
|
end;
|
||||||
@ -867,8 +868,8 @@ get_limits_fields(Fields) ->
|
|||||||
fun(Field) ->
|
fun(Field) ->
|
||||||
case Field of
|
case Field of
|
||||||
#xmlel{name = field, attrs = Attrs} ->
|
#xmlel{name = field, attrs = Attrs} ->
|
||||||
(<<"FORM_TYPE">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, var, ""))
|
(<<"FORM_TYPE">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"var">>, ""))
|
||||||
and (<<"hidden">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, type, ""));
|
and (<<"hidden">> == exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"type">>, ""));
|
||||||
_ -> false
|
_ -> false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -887,7 +888,7 @@ get_limits_values(Values) ->
|
|||||||
%% TODO: Only one subel is expected here, but there may be several
|
%% TODO: Only one subel is expected here, but there may be several
|
||||||
#xmlel{children = SubElsV} = exmpp_xml:get_element(SubEls, value),
|
#xmlel{children = SubElsV} = exmpp_xml:get_element(SubEls, value),
|
||||||
Number = exmpp_xml:get_cdata_from_list_as_list(SubElsV),
|
Number = exmpp_xml:get_cdata_from_list_as_list(SubElsV),
|
||||||
Name = exmpp_xml:get_attribute_from_list_as_list(Attrs, var, ""),
|
Name = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"var">>, ""),
|
||||||
[{list_to_atom(Name), list_to_integer(Number)} | R];
|
[{list_to_atom(Name), list_to_integer(Number)} | R];
|
||||||
_ -> R
|
_ -> R
|
||||||
end
|
end
|
||||||
@ -906,7 +907,7 @@ process_discoitems_result(From, LServiceS, Els) ->
|
|||||||
%% For each one, if it's "item", look for jid
|
%% For each one, if it's "item", look for jid
|
||||||
case XML of
|
case XML of
|
||||||
#xmlel{name = item, attrs = Attrs} ->
|
#xmlel{name = item, attrs = Attrs} ->
|
||||||
Res ++ [exmpp_xml:get_attribute_from_list_as_list(Attrs, jid, "")];
|
Res ++ [exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"jid">>, "")];
|
||||||
_ -> Res
|
_ -> Res
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -1197,13 +1198,13 @@ fragment_dests(Dests, Limit_number) ->
|
|||||||
%% Some parts of code are borrowed from mod_muc_room.erl
|
%% Some parts of code are borrowed from mod_muc_room.erl
|
||||||
|
|
||||||
-define(RFIELDT(Type, Var, Val),
|
-define(RFIELDT(Type, Var, Val),
|
||||||
#xmlel{name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('var', Var)],
|
?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = Val}]}]}).
|
children = [#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
-define(RFIELDV(Var, Val),
|
-define(RFIELDV(Var, Val),
|
||||||
#xmlel{name = 'field', attrs = [?XMLATTR('var', Var)],
|
#xmlel{name = 'field', attrs = [?XMLATTR(<<"var">>, Var)],
|
||||||
children = [#xmlel{name = 'value',
|
children = [#xmlel{name = 'value',
|
||||||
children = [#xmlcdata{cdata = Val}]}]}).
|
children = [#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
@ -1214,7 +1215,7 @@ iq_disco_info_extras(From, State) ->
|
|||||||
[] -> [];
|
[] -> [];
|
||||||
List_limits_xmpp ->
|
List_limits_xmpp ->
|
||||||
Children = [?RFIELDT("hidden", "FORM_TYPE", ?NS_ADDRESS)] ++ List_limits_xmpp,
|
Children = [?RFIELDT("hidden", "FORM_TYPE", ?NS_ADDRESS)] ++ List_limits_xmpp,
|
||||||
[#xmlel{name = x, ns = ?NS_DATA_FORMS, attrs = [#xmlattr{name = type, value = <<"result">>}], children = Children}]
|
[#xmlel{name = x, ns = ?NS_DATA_FORMS, attrs = [#xmlattr{name = <<"type">>, value = <<"result">>}], children = Children}]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
sender_type(From) ->
|
sender_type(From) ->
|
||||||
|
@ -320,7 +320,7 @@ find_x_event_chatstates([_ | Els], {A, B, _}) ->
|
|||||||
find_x_expire(_, []) ->
|
find_x_expire(_, []) ->
|
||||||
0;
|
0;
|
||||||
find_x_expire(TimeStamp, [#xmlel{ns = ?NS_MESSAGE_EXPIRE} = El | _Els]) ->
|
find_x_expire(TimeStamp, [#xmlel{ns = ?NS_MESSAGE_EXPIRE} = El | _Els]) ->
|
||||||
Val = exmpp_xml:get_attribute_as_list(El, 'seconds', ""),
|
Val = exmpp_xml:get_attribute_as_list(El, <<"seconds">>, ""),
|
||||||
case catch list_to_integer(Val) of
|
case catch list_to_integer(Val) of
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
0;
|
0;
|
||||||
@ -541,7 +541,7 @@ find_x_timestamp([{xmlcdata, _} | Els]) ->
|
|||||||
find_x_timestamp(Els);
|
find_x_timestamp(Els);
|
||||||
|
|
||||||
find_x_timestamp([#xmlel{ns = ?NS_DELAY} = El | Els]) ->
|
find_x_timestamp([#xmlel{ns = ?NS_DELAY} = El | Els]) ->
|
||||||
Stamp = exmpp_xml:get_attribute_as_list(El, 'stamp', ""),
|
Stamp = exmpp_xml:get_attribute_as_list(El, <<"stamp">>, ""),
|
||||||
case jlib:datetime_string_to_timestamp(Stamp) of
|
case jlib:datetime_string_to_timestamp(Stamp) of
|
||||||
undefined -> find_x_timestamp(Els);
|
undefined -> find_x_timestamp(Els);
|
||||||
{MegaSecs, Secs, _MicroSecs} -> MegaSecs * 1000000 + Secs
|
{MegaSecs, Secs, _MicroSecs} -> MegaSecs * 1000000 + Secs
|
||||||
@ -611,11 +611,11 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
exmpp_xml:indent_document(Packet1, <<" ">>),
|
exmpp_xml:indent_document(Packet1, <<" ">>),
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XAE("td", [?XMLATTR('class', <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
[?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], Time),
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)], Time),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], SFrom),
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)], SFrom),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)], STo),
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)], STo),
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], [?XC("pre", FPacket)])]
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], [?XC("pre", FPacket)])]
|
||||||
)
|
)
|
||||||
end, Msgs),
|
end, Msgs),
|
||||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||||
@ -624,7 +624,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
ok -> [?CT("Submitted"), ?P];
|
ok -> [?CT("Submitted"), ?P];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XE("table",
|
[?XE("table",
|
||||||
[?XE("thead",
|
[?XE("thead",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
@ -638,7 +638,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
if
|
if
|
||||||
FMsgs == [] ->
|
FMsgs == [] ->
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XAC("td", [?XMLATTR('colspan', <<"4">>)], " ")]
|
[?XAC("td", [?XMLATTR(<<"colspan">>, <<"4">>)], " ")]
|
||||||
)];
|
)];
|
||||||
true ->
|
true ->
|
||||||
FMsgs
|
FMsgs
|
||||||
|
@ -289,7 +289,7 @@ find_x_event_chatstates([_ | Els], {A, B, _}) ->
|
|||||||
find_x_expire(_, []) ->
|
find_x_expire(_, []) ->
|
||||||
never;
|
never;
|
||||||
find_x_expire(TimeStamp, [#xmlel{ns = ?NS_MESSAGE_EXPIRE} = El | _Els]) ->
|
find_x_expire(TimeStamp, [#xmlel{ns = ?NS_MESSAGE_EXPIRE} = El | _Els]) ->
|
||||||
Val = exmpp_xml:get_attribute_as_list(El, 'seconds', ""),
|
Val = exmpp_xml:get_attribute_as_list(El, <<"seconds">>, ""),
|
||||||
case catch list_to_integer(Val) of
|
case catch list_to_integer(Val) of
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
never;
|
never;
|
||||||
@ -319,7 +319,7 @@ pop_offline_messages(Ls, User, Server)
|
|||||||
try
|
try
|
||||||
[El] = exmpp_xml:parse_document(XML,
|
[El] = exmpp_xml:parse_document(XML,
|
||||||
[names_as_atom, {check_elems, xmpp},
|
[names_as_atom, {check_elems, xmpp},
|
||||||
{check_nss,xmpp}, {check_attrs,xmpp}]),
|
{check_nss,xmpp} ]),
|
||||||
To = exmpp_jid:parse(
|
To = exmpp_jid:parse(
|
||||||
exmpp_stanza:get_recipient(El)),
|
exmpp_stanza:get_recipient(El)),
|
||||||
From = exmpp_jid:parse(
|
From = exmpp_jid:parse(
|
||||||
@ -400,7 +400,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
fun({_, XML}) ->
|
fun({_, XML}) ->
|
||||||
try exmpp_xml:parse_document(XML,
|
try exmpp_xml:parse_document(XML,
|
||||||
[names_as_atom, {check_elems, xmpp},
|
[names_as_atom, {check_elems, xmpp},
|
||||||
{check_nss,xmpp}, {check_attrs,xmpp}]) of
|
{check_nss,xmpp}]) of
|
||||||
[El] ->
|
[El] ->
|
||||||
[El]
|
[El]
|
||||||
catch
|
catch
|
||||||
@ -426,8 +426,8 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
exmpp_xml:indent_document(Packet, <<" ">>),
|
exmpp_xml:indent_document(Packet, <<" ">>),
|
||||||
[?DEFAULT_NS], ?PREFIXED_NS),
|
[?DEFAULT_NS], ?PREFIXED_NS),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[?XAE("td", [?XMLATTR('class', <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
[?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], [?INPUT("checkbox", "selected", ID)]),
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], [?XC("pre", FPacket)])]
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], [?XC("pre", FPacket)])]
|
||||||
)
|
)
|
||||||
end, Msgs),
|
end, Msgs),
|
||||||
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
[?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
|
||||||
@ -436,7 +436,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
ok -> [?XREST("Submitted")];
|
ok -> [?XREST("Submitted")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XE("table",
|
[?XE("table",
|
||||||
[?XE("thead",
|
[?XE("thead",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
@ -447,7 +447,7 @@ user_queue(User, Server, Query, Lang) ->
|
|||||||
if
|
if
|
||||||
FMsgs == [] ->
|
FMsgs == [] ->
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XAC("td", [?XMLATTR('colspan', <<"4">>)], " ")]
|
[?XAC("td", [?XMLATTR(<<"colspan">>, <<"4">>)], " ")]
|
||||||
)];
|
)];
|
||||||
true ->
|
true ->
|
||||||
FMsgs
|
FMsgs
|
||||||
@ -472,7 +472,7 @@ user_queue_parse_query(Username, LServer, Query) ->
|
|||||||
fun({XML, Seq}) ->
|
fun({XML, Seq}) ->
|
||||||
try exmpp_xml:parse_document(XML,
|
try exmpp_xml:parse_document(XML,
|
||||||
[names_as_atom, {check_elems, xmpp},
|
[names_as_atom, {check_elems, xmpp},
|
||||||
{check_nss,xmpp}, {check_attrs,xmpp}]) of
|
{check_nss,xmpp} ]) of
|
||||||
[El] ->
|
[El] ->
|
||||||
[{El, Seq}]
|
[{El, Seq}]
|
||||||
catch
|
catch
|
||||||
|
@ -204,7 +204,7 @@ process_iq_get(_, From, _To, #iq{payload = SubEl},
|
|||||||
[#xmlel{name = Name} = Child] ->
|
[#xmlel{name = Name} = Child] ->
|
||||||
case Name of
|
case Name of
|
||||||
list ->
|
list ->
|
||||||
ListName = exmpp_xml:get_attribute_as_list(Child, name, false),
|
ListName = exmpp_xml:get_attribute_as_list(Child, <<"name">>, false),
|
||||||
process_list_get(LUser, LServer, ListName);
|
process_list_get(LUser, LServer, ListName);
|
||||||
_ ->
|
_ ->
|
||||||
{error, 'bad-request'}
|
{error, 'bad-request'}
|
||||||
@ -236,20 +236,20 @@ process_lists_get(LUser, LServer, Active) ->
|
|||||||
[] ->
|
[] ->
|
||||||
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query'}};
|
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query'}};
|
||||||
_ ->
|
_ ->
|
||||||
LItems = [exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list}, name, N) || N <- Lists],
|
LItems = [exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list}, <<"name">>, N) || N <- Lists],
|
||||||
DItems =
|
DItems =
|
||||||
case Default of
|
case Default of
|
||||||
none ->
|
none ->
|
||||||
LItems;
|
LItems;
|
||||||
_ ->
|
_ ->
|
||||||
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = default}, name, Default) | LItems]
|
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = default}, <<"name">>, Default) | LItems]
|
||||||
end,
|
end,
|
||||||
ADItems =
|
ADItems =
|
||||||
case Active of
|
case Active of
|
||||||
none ->
|
none ->
|
||||||
DItems;
|
DItems;
|
||||||
_ ->
|
_ ->
|
||||||
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = active}, name, Active) | DItems]
|
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = active}, <<"name">>, Active) | DItems]
|
||||||
end,
|
end,
|
||||||
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = ADItems}}
|
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = ADItems}}
|
||||||
end
|
end
|
||||||
@ -279,20 +279,20 @@ process_list_get(LUser, LServer, Name) ->
|
|||||||
{error, 'item-not-found'};
|
{error, 'item-not-found'};
|
||||||
{atomic, List} ->
|
{atomic, List} ->
|
||||||
LItems = lists:map(fun item_to_xml/1, List),
|
LItems = lists:map(fun item_to_xml/1, List),
|
||||||
ListEl = exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list, children = LItems}, name, Name),
|
ListEl = exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list, children = LItems}, <<"name">>, Name),
|
||||||
{result,#xmlel{ns = ?NS_PRIVACY, name = 'query', children = [ListEl]}}
|
{result,#xmlel{ns = ?NS_PRIVACY, name = 'query', children = [ListEl]}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
Attrs1 = [?XMLATTR('action', action_to_binary(Item#privacy_list_data.action)),
|
Attrs1 = [?XMLATTR(<<"action">>, action_to_binary(Item#privacy_list_data.action)),
|
||||||
?XMLATTR('order', order_to_binary(Item#privacy_list_data.order))],
|
?XMLATTR(<<"order">>, order_to_binary(Item#privacy_list_data.order))],
|
||||||
Attrs2 = case Item#privacy_list_data.type of
|
Attrs2 = case Item#privacy_list_data.type of
|
||||||
none ->
|
none ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
Type ->
|
Type ->
|
||||||
[?XMLATTR('type', type_to_binary(Type)),
|
[?XMLATTR(<<"type">>, type_to_binary(Type)),
|
||||||
?XMLATTR('value', Item#privacy_list_data.value) |
|
?XMLATTR(<<"value">>, Item#privacy_list_data.value) |
|
||||||
Attrs1]
|
Attrs1]
|
||||||
end,
|
end,
|
||||||
SubEls = case Item#privacy_list_data.match_all of
|
SubEls = case Item#privacy_list_data.match_all of
|
||||||
@ -359,7 +359,7 @@ process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
|||||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||||
case exmpp_xml:get_child_elements(SubEl) of
|
case exmpp_xml:get_child_elements(SubEl) of
|
||||||
[#xmlel{name = Name} = Child] ->
|
[#xmlel{name = Name} = Child] ->
|
||||||
ListName = exmpp_xml:get_attribute_as_list(Child, 'name', false),
|
ListName = exmpp_xml:get_attribute_as_list(Child, <<"name">>, false),
|
||||||
case Name of
|
case Name of
|
||||||
list ->
|
list ->
|
||||||
process_list_set(LUser, LServer, ListName,
|
process_list_set(LUser, LServer, ListName,
|
||||||
@ -477,7 +477,7 @@ process_list_set(LUser, LServer, Name, Els) ->
|
|||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
#xmlel{name = 'broadcast', ns = privacy_list,
|
#xmlel{name = 'broadcast', ns = privacy_list,
|
||||||
attrs = [exmpp_xml:attribute(list_name, Name)],
|
attrs = [?XMLATTR(<<"list_name">>, Name)],
|
||||||
children = [exmpp_xml:cdata(ListString)]}),
|
children = [exmpp_xml:cdata(ListString)]}),
|
||||||
Res;
|
Res;
|
||||||
_ ->
|
_ ->
|
||||||
@ -512,7 +512,7 @@ process_list_set(LUser, LServer, Name, Els) ->
|
|||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
#xmlel{name = 'broadcast', ns = privacy_list,
|
#xmlel{name = 'broadcast', ns = privacy_list,
|
||||||
attrs = [exmpp_xml:attribute(list_name, Name)],
|
attrs = [?XMLATTR(<<"list_name">>, Name)],
|
||||||
children = [exmpp_xml:cdata(ListString)]}),
|
children = [exmpp_xml:cdata(ListString)]}),
|
||||||
Res;
|
Res;
|
||||||
_ ->
|
_ ->
|
||||||
@ -532,10 +532,10 @@ parse_items([], Res) ->
|
|||||||
%% lists:keysort(#listitem.order, Res);
|
%% lists:keysort(#listitem.order, Res);
|
||||||
lists:reverse(Res);
|
lists:reverse(Res);
|
||||||
parse_items([El = #xmlel{name = item} | Els], Res) ->
|
parse_items([El = #xmlel{name = item} | Els], Res) ->
|
||||||
Type = exmpp_xml:get_attribute_as_list(El, type, false),
|
Type = exmpp_xml:get_attribute_as_list(El, <<"type">>, false),
|
||||||
Value = exmpp_xml:get_attribute_as_binary(El, value, false),
|
Value = exmpp_xml:get_attribute_as_binary(El, <<"value">>, false),
|
||||||
SAction =exmpp_xml:get_attribute_as_list(El, action, false),
|
SAction =exmpp_xml:get_attribute_as_list(El, <<"action">>, false),
|
||||||
SOrder = exmpp_xml:get_attribute_as_list(El, order, false),
|
SOrder = exmpp_xml:get_attribute_as_list(El, <<"order">>, false),
|
||||||
Action = case catch list_to_action(SAction) of
|
Action = case catch list_to_action(SAction) of
|
||||||
{'EXIT', _} -> false;
|
{'EXIT', _} -> false;
|
||||||
Val -> Val
|
Val -> Val
|
||||||
@ -698,7 +698,7 @@ check_packet(_, User, Server,
|
|||||||
'message' -> message;
|
'message' -> message;
|
||||||
'iq' -> iq;
|
'iq' -> iq;
|
||||||
'presence' ->
|
'presence' ->
|
||||||
case exmpp_xml:get_attribute(El, type, '') of
|
case exmpp_xml:get_attribute(El, <<"type">>, '') of
|
||||||
%% notification
|
%% notification
|
||||||
'' -> presence;
|
'' -> presence;
|
||||||
'unavailable' -> presence;
|
'unavailable' -> presence;
|
||||||
|
@ -91,7 +91,7 @@ process_iq_get(_, From, _To, #iq{payload = SubEl},
|
|||||||
[#xmlel{name = Name} = Child] ->
|
[#xmlel{name = Name} = Child] ->
|
||||||
case Name of
|
case Name of
|
||||||
list ->
|
list ->
|
||||||
ListName = exmpp_xml:get_attribute_as_list(Child, name, false),
|
ListName = exmpp_xml:get_attribute_as_list(Child, <<"name">>, false),
|
||||||
process_list_get(LUser, LServer, ListName);
|
process_list_get(LUser, LServer, ListName);
|
||||||
_ ->
|
_ ->
|
||||||
{error, 'bad-request'}
|
{error, 'bad-request'}
|
||||||
@ -116,21 +116,21 @@ process_lists_get(LUser, LServer, Active) ->
|
|||||||
{selected, ["name"], Names} ->
|
{selected, ["name"], Names} ->
|
||||||
LItems = lists:map(
|
LItems = lists:map(
|
||||||
fun({N}) ->
|
fun({N}) ->
|
||||||
exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list}, name, N)
|
exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = list}, <<"name">>, N)
|
||||||
end, Names),
|
end, Names),
|
||||||
DItems =
|
DItems =
|
||||||
case Default of
|
case Default of
|
||||||
none ->
|
none ->
|
||||||
LItems;
|
LItems;
|
||||||
_ ->
|
_ ->
|
||||||
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = default}, name, Default) | LItems]
|
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = default}, <<"name">>, Default) | LItems]
|
||||||
end,
|
end,
|
||||||
ADItems =
|
ADItems =
|
||||||
case Active of
|
case Active of
|
||||||
none ->
|
none ->
|
||||||
DItems;
|
DItems;
|
||||||
_ ->
|
_ ->
|
||||||
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = active}, name, Active) | DItems]
|
[exmpp_xml:set_attribute(#xmlel{ns = ?NS_PRIVACY, name = active}, <<"name">>, Active) | DItems]
|
||||||
end,
|
end,
|
||||||
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = ADItems}};
|
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = ADItems}};
|
||||||
_ ->
|
_ ->
|
||||||
@ -155,7 +155,7 @@ process_list_get(LUser, LServer, Name) ->
|
|||||||
ListEl = exmpp_xml:set_attribute(#xmlel{name = list,
|
ListEl = exmpp_xml:set_attribute(#xmlel{name = list,
|
||||||
ns = ?NS_PRIVACY,
|
ns = ?NS_PRIVACY,
|
||||||
children = LItems},
|
children = LItems},
|
||||||
name,
|
<<"name">>,
|
||||||
Name),
|
Name),
|
||||||
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = [ListEl]}};
|
{result, #xmlel{ns = ?NS_PRIVACY, name = 'query', children = [ListEl]}};
|
||||||
_ ->
|
_ ->
|
||||||
@ -167,14 +167,14 @@ process_list_get(LUser, LServer, Name) ->
|
|||||||
|
|
||||||
|
|
||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
Attrs1 = [?XMLATTR('action', action_to_binary(Item#listitem.action)),
|
Attrs1 = [?XMLATTR(<<"action">>, action_to_binary(Item#listitem.action)),
|
||||||
?XMLATTR('order', order_to_binary(Item#listitem.order))],
|
?XMLATTR(<<"order">>, order_to_binary(Item#listitem.order))],
|
||||||
Attrs2 = case Item#listitem.type of
|
Attrs2 = case Item#listitem.type of
|
||||||
none ->
|
none ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
Type ->
|
Type ->
|
||||||
[?XMLATTR('type', type_to_binary(Item#listitem.type)),
|
[?XMLATTR(<<"type">>, type_to_binary(Item#listitem.type)),
|
||||||
?XMLATTR('value', value_to_binary(Type, Item#listitem.value)) |
|
?XMLATTR(<<"value">>, value_to_binary(Type, Item#listitem.value)) |
|
||||||
Attrs1]
|
Attrs1]
|
||||||
end,
|
end,
|
||||||
SubEls = case Item#listitem.match_all of
|
SubEls = case Item#listitem.match_all of
|
||||||
@ -256,7 +256,7 @@ process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
|||||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||||
case exmpp_xml:get_child_elements(SubEl) of
|
case exmpp_xml:get_child_elements(SubEl) of
|
||||||
[#xmlel{name = Name} = Child] ->
|
[#xmlel{name = Name} = Child] ->
|
||||||
ListName = exmpp_xml:get_attribute_as_list(Child, 'name', false),
|
ListName = exmpp_xml:get_attribute_as_list(Child, <<"name">>, false),
|
||||||
case Name of
|
case Name of
|
||||||
list ->
|
list ->
|
||||||
process_list_set(LUser, LServer, ListName,
|
process_list_set(LUser, LServer, ListName,
|
||||||
@ -370,7 +370,7 @@ process_list_set(LUser, LServer, Name, Els) ->
|
|||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
#xmlel{name = 'broadcast', ns = privacy_list,
|
#xmlel{name = 'broadcast', ns = privacy_list,
|
||||||
attrs = [exmpp_xml:attribute(list_name, Name)],
|
attrs = [?XMLATTR(<<"list_name">>, Name)],
|
||||||
children = [exmpp_xml:cdata(ListString)]}),
|
children = [exmpp_xml:cdata(ListString)]}),
|
||||||
Res;
|
Res;
|
||||||
_ ->
|
_ ->
|
||||||
@ -407,7 +407,7 @@ process_list_set(LUser, LServer, Name, Els) ->
|
|||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
exmpp_jid:make(LUser, LServer),
|
exmpp_jid:make(LUser, LServer),
|
||||||
#xmlel{name = 'broadcast', ns = privacy_list,
|
#xmlel{name = 'broadcast', ns = privacy_list,
|
||||||
attrs = [exmpp_xml:attribute(list_name, Name)],
|
attrs = [?XMLATTR(<<"list_name">>, Name)],
|
||||||
children = [exmpp_xml:cdata(ListString)]}),
|
children = [exmpp_xml:cdata(ListString)]}),
|
||||||
Res;
|
Res;
|
||||||
_ ->
|
_ ->
|
||||||
@ -426,10 +426,10 @@ parse_items([], Res) ->
|
|||||||
%% Sort the items by their 'order' attribute
|
%% Sort the items by their 'order' attribute
|
||||||
lists:keysort(#listitem.order, Res);
|
lists:keysort(#listitem.order, Res);
|
||||||
parse_items([El = #xmlel{name = item} | Els], Res) ->
|
parse_items([El = #xmlel{name = item} | Els], Res) ->
|
||||||
Type = exmpp_xml:get_attribute_as_list(El, type, false),
|
Type = exmpp_xml:get_attribute_as_list(El, <<"type">>, false),
|
||||||
Value = exmpp_xml:get_attribute_as_list(El, value, false),
|
Value = exmpp_xml:get_attribute_as_list(El, <<"value">>, false),
|
||||||
SAction =exmpp_xml:get_attribute_as_list(El, action, false),
|
SAction =exmpp_xml:get_attribute_as_list(El, <<"action">>, false),
|
||||||
SOrder = exmpp_xml:get_attribute_as_list(El, order, false),
|
SOrder = exmpp_xml:get_attribute_as_list(El, <<"order">>, false),
|
||||||
Action = case catch list_to_action(SAction) of
|
Action = case catch list_to_action(SAction) of
|
||||||
{'EXIT', _} -> false;
|
{'EXIT', _} -> false;
|
||||||
Val -> Val
|
Val -> Val
|
||||||
|
@ -158,7 +158,7 @@ get_data(LUser, LServer, [El | Els], Res) ->
|
|||||||
{selected, ["data"], [{SData}]} ->
|
{selected, ["data"], [{SData}]} ->
|
||||||
[Data] = exmpp_xml:parse_document(SData,
|
[Data] = exmpp_xml:parse_document(SData,
|
||||||
[names_as_atom, {check_elems, xmpp},
|
[names_as_atom, {check_elems, xmpp},
|
||||||
{check_nss,xmpp}, {check_attrs,xmpp}]),
|
{check_nss,xmpp} ]),
|
||||||
get_data(LUser, LServer, Els, [Data | Res]);
|
get_data(LUser, LServer, Els, [Data | Res]);
|
||||||
%% MREMOND: I wonder when the query could return a vcard ?
|
%% MREMOND: I wonder when the query could return a vcard ?
|
||||||
{selected, ["vcard"], []} ->
|
{selected, ["vcard"], []} ->
|
||||||
|
@ -163,7 +163,7 @@ process_iq(InitiatorJID, #iq{type = set, payload = SubEl, ns = ?NS_BYTESTREAMS}
|
|||||||
case acl:match_rule(ServerHost, ACL, InitiatorJID) of
|
case acl:match_rule(ServerHost, ACL, InitiatorJID) of
|
||||||
allow ->
|
allow ->
|
||||||
ActivateEl = exmpp_xml:get_path(SubEl, [{element, 'activate'}]),
|
ActivateEl = exmpp_xml:get_path(SubEl, [{element, 'activate'}]),
|
||||||
SID = exmpp_xml:get_attribute_as_list(SubEl, 'sid', ""),
|
SID = exmpp_xml:get_attribute_as_list(SubEl, <<"sid">>, ""),
|
||||||
case catch exmpp_jid:parse(exmpp_xml:get_cdata_as_list(ActivateEl)) of
|
case catch exmpp_jid:parse(exmpp_xml:get_cdata_as_list(ActivateEl)) of
|
||||||
TargetJID when ?IS_JID(TargetJID), SID /= "",
|
TargetJID when ?IS_JID(TargetJID), SID /= "",
|
||||||
length(SID) =< 128, TargetJID /= InitiatorJID ->
|
length(SID) =< 128, TargetJID /= InitiatorJID ->
|
||||||
@ -201,13 +201,13 @@ process_iq(_, _, _) ->
|
|||||||
%%% Auxiliary functions.
|
%%% Auxiliary functions.
|
||||||
%%%-------------------------
|
%%%-------------------------
|
||||||
-define(FEATURE(Feat), #xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
-define(FEATURE(Feat), #xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [?XMLATTR('var', Feat)]}).
|
attrs = [?XMLATTR(<<"var">>, Feat)]}).
|
||||||
|
|
||||||
iq_disco_info(Lang, Name) ->
|
iq_disco_info(Lang, Name) ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', <<"proxy">>),
|
[?XMLATTR(<<"category">>, <<"proxy">>),
|
||||||
?XMLATTR('type', <<"bytestreams">>),
|
?XMLATTR(<<"type">>, <<"bytestreams">>),
|
||||||
?XMLATTR('name', translate:translate(Lang, Name))]},
|
?XMLATTR(<<"name">>, translate:translate(Lang, Name))]},
|
||||||
?FEATURE(?NS_DISCO_INFO_s),
|
?FEATURE(?NS_DISCO_INFO_s),
|
||||||
?FEATURE(?NS_VCARD_s),
|
?FEATURE(?NS_VCARD_s),
|
||||||
?FEATURE(?NS_BYTESTREAMS_s)].
|
?FEATURE(?NS_BYTESTREAMS_s)].
|
||||||
@ -238,8 +238,8 @@ parse_options(ServerHost, Opts) ->
|
|||||||
HostNameStr ->
|
HostNameStr ->
|
||||||
HostNameStr
|
HostNameStr
|
||||||
end,
|
end,
|
||||||
StreamAddr = [?XMLATTR('jid', MyHost), ?XMLATTR('host', HostName),
|
StreamAddr = [?XMLATTR(<<"jid">>, MyHost), ?XMLATTR(<<"host">>, HostName),
|
||||||
?XMLATTR('port', Port)],
|
?XMLATTR(<<"port">>, Port)],
|
||||||
#state{myhost = MyHost,
|
#state{myhost = MyHost,
|
||||||
serverhost = ServerHost,
|
serverhost = ServerHost,
|
||||||
name = Name,
|
name = Name,
|
||||||
|
@ -692,7 +692,7 @@ disco_local_identity(Acc, _From, #jid{domain = Host} = _To, <<>> = _NodeId, _Lan
|
|||||||
case lists:member(?PEPNODE, plugins(Host)) of
|
case lists:member(?PEPNODE, plugins(Host)) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]}
|
||||||
| Acc];
|
| Acc];
|
||||||
false -> Acc
|
false -> Acc
|
||||||
end;
|
end;
|
||||||
@ -762,19 +762,19 @@ disco_sm_identity(Acc, From, To, NodeId, _Lang) ->
|
|||||||
|
|
||||||
disco_identity(_Host, <<>> = _NodeId, _From) ->
|
disco_identity(_Host, <<>> = _NodeId, _From) ->
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]}];
|
||||||
disco_identity(#jid{node = U, domain = S, resource = R} = Host, NodeId, From) ->
|
disco_identity(#jid{node = U, domain = S, resource = R} = Host, NodeId, From) ->
|
||||||
Action = fun(#pubsub_node{idx = NodeIdx, type = Type, options = Options, owners = Owners}) ->
|
Action = fun(#pubsub_node{idx = NodeIdx, type = Type, options = Options, owners = Owners}) ->
|
||||||
case get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
{result,
|
{result,
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]},
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]},
|
||||||
#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"leaf">>)
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"leaf">>)
|
||||||
| case get_option(Options, 'title') of
|
| case get_option(Options, 'title') of
|
||||||
false -> [];
|
false -> [];
|
||||||
Title -> [?XMLATTR('name', Title)]
|
Title -> [?XMLATTR(<<"name">>, Title)]
|
||||||
end
|
end
|
||||||
]}]};
|
]}]};
|
||||||
{error, _} -> {result, []}
|
{error, _} -> {result, []}
|
||||||
@ -858,11 +858,11 @@ disco_items(#jid{raw = JID, node = U, domain = S, resource = R} = Host, <<>>, Fr
|
|||||||
case get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('jid', JID),
|
attrs = [?XMLATTR(<<"jid">>, JID),
|
||||||
?XMLATTR('node', NodeId) |
|
?XMLATTR(<<"node">>, NodeId) |
|
||||||
case get_option(Options, 'title') of
|
case get_option(Options, 'title') of
|
||||||
false -> [];
|
false -> [];
|
||||||
[Title] -> [?XMLATTR('title', Title)]
|
[Title] -> [?XMLATTR(<<"title">>, Title)]
|
||||||
end]}
|
end]}
|
||||||
| Acc];
|
| Acc];
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
@ -879,8 +879,8 @@ disco_items(#jid{raw = JID, node = U, domain = S, resource = R} = Host, NodeId,
|
|||||||
{result, Items} ->
|
{result, Items} ->
|
||||||
{result,
|
{result,
|
||||||
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('jid', JID),
|
attrs = [?XMLATTR(<<"jid">>, JID),
|
||||||
?XMLATTR('name', ItemId)]}
|
?XMLATTR(<<"name">>, ItemId)]}
|
||||||
|| #pubsub_item{id = {ItemId,_}} <- Items]};
|
|| #pubsub_item{id = {ItemId,_}} <- Items]};
|
||||||
_ -> {result, []}
|
_ -> {result, []}
|
||||||
end
|
end
|
||||||
@ -1164,7 +1164,7 @@ do_route(ServerHost, Access, Plugins, Host, From, To, #xmlel{name = 'iq'} = Pack
|
|||||||
case exmpp_iq:xmlel_to_iq(Packet) of
|
case exmpp_iq:xmlel_to_iq(Packet) of
|
||||||
%% Service discovery : disco#info
|
%% Service discovery : disco#info
|
||||||
#iq{type = 'get', ns = ?NS_DISCO_INFO, payload = #xmlel{attrs = Attrs}, lang = Lang} ->
|
#iq{type = 'get', ns = ?NS_DISCO_INFO, payload = #xmlel{attrs = Attrs}, lang = Lang} ->
|
||||||
NodeId = exmpp_xml:get_attribute_from_list(Attrs, 'node', <<>>),
|
NodeId = exmpp_xml:get_attribute_from_list(Attrs, <<"node">>, <<>>),
|
||||||
Info = ejabberd_hooks:run_fold(
|
Info = ejabberd_hooks:run_fold(
|
||||||
disco_info, ServerHost, [],
|
disco_info, ServerHost, [],
|
||||||
[ServerHost, ?MODULE, <<>>, ""]),
|
[ServerHost, ?MODULE, <<>>, ""]),
|
||||||
@ -1181,7 +1181,7 @@ do_route(ServerHost, Access, Plugins, Host, From, To, #xmlel{name = 'iq'} = Pack
|
|||||||
ejabberd_router:route(To, From, Res);
|
ejabberd_router:route(To, From, Res);
|
||||||
%% Service discovery : disco#items
|
%% Service discovery : disco#items
|
||||||
#iq{type = 'get', ns = ?NS_DISCO_ITEMS, payload = #xmlel{attrs = Attrs}} ->
|
#iq{type = 'get', ns = ?NS_DISCO_ITEMS, payload = #xmlel{attrs = Attrs}} ->
|
||||||
NodeId = exmpp_xml:get_attribute_from_list(Attrs, 'node', <<>>),
|
NodeId = exmpp_xml:get_attribute_from_list(Attrs, <<"node">>, <<>>),
|
||||||
Res = case iq_disco_items(Host, NodeId, From) of
|
Res = case iq_disco_items(Host, NodeId, From) of
|
||||||
{result, IQRes} ->
|
{result, IQRes} ->
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
@ -1258,8 +1258,8 @@ do_route(ServerHost, _Access, _Plugins, Host, From, To,
|
|||||||
undefined ->
|
undefined ->
|
||||||
ok;
|
ok;
|
||||||
#xmlel{attrs = Attrs, children = Els} = _Item ->
|
#xmlel{attrs = Attrs, children = Els} = _Item ->
|
||||||
NodeId = exmpp_xml:get_attribute(Publish, 'node', <<>>),
|
NodeId = exmpp_xml:get_attribute(Publish, <<"node">>, <<>>),
|
||||||
ItemId = exmpp_xml:get_attribute_from_list(Attrs, 'id', <<>>),
|
ItemId = exmpp_xml:get_attribute_from_list(Attrs, <<"id">>, <<>>),
|
||||||
case publish_item(Host, ServerHost, NodeId, From, ItemId, Els) of
|
case publish_item(Host, ServerHost, NodeId, From, ItemId, Els) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
ok;
|
ok;
|
||||||
@ -1302,19 +1302,19 @@ command_disco_info(_Host, ?NS_ADHOC_b = _NodeId, _From) ->
|
|||||||
{result,
|
{result,
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'identity',
|
name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"automation">>),
|
attrs = [?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-list">>)]}]};
|
?XMLATTR(<<"type">>, <<"command-list">>)]}]};
|
||||||
command_disco_info(_Host, ?NS_PUBSUB_GET_PENDING_b = _NodeId, _From) ->
|
command_disco_info(_Host, ?NS_PUBSUB_GET_PENDING_b = _NodeId, _From) ->
|
||||||
{result,
|
{result,
|
||||||
% Identity
|
% Identity
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'identity',
|
name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"automation">>),
|
attrs = [?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-node">>)]},
|
?XMLATTR(<<"type">>, <<"command-node">>)]},
|
||||||
% Features
|
% Features
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_ADHOC)]}]}.
|
attrs = [?XMLATTR(<<"var">>, ?NS_ADHOC)]}]}.
|
||||||
|
|
||||||
|
|
||||||
-spec(node_disco_info/3 ::
|
-spec(node_disco_info/3 ::
|
||||||
@ -1343,16 +1343,16 @@ node_disco_info(Host, NodeId, From) ->
|
|||||||
%% Identities
|
%% Identities
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'identity',
|
name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>),
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>),
|
||||||
?XMLATTR('type', Type)]} || Type <- Types ]
|
?XMLATTR(<<"type">>, Type)]} || Type <- Types ]
|
||||||
++
|
++
|
||||||
%% Features
|
%% Features
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_PUBSUB_b)]} |
|
attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_b)]} |
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', list_to_binary(?NS_PUBSUB_s++"#"++Type))]}
|
attrs = [?XMLATTR(<<"var">>, list_to_binary(?NS_PUBSUB_s++"#"++Type))]}
|
||||||
|| Type <- features(Plugin)]]}
|
|| Type <- features(Plugin)]]}
|
||||||
end,
|
end,
|
||||||
case transaction(Host, NodeId, Action, sync_dirty) of
|
case transaction(Host, NodeId, Action, sync_dirty) of
|
||||||
@ -1377,29 +1377,29 @@ iq_disco_info(Host, <<>> = _NodeId, _From, Lang) ->
|
|||||||
%% Identities
|
%% Identities
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'identity',
|
name = 'identity',
|
||||||
attrs = [?XMLATTR('category', "pubsub"),
|
attrs = [?XMLATTR(<<"category">>, "pubsub"),
|
||||||
?XMLATTR('type', "service"),
|
?XMLATTR(<<"type">>, "service"),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Publish-Subscribe"))]},
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Publish-Subscribe"))]},
|
||||||
%% Features
|
%% Features
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_DISCO_INFO_b)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_DISCO_INFO_b)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_DISCO_ITEMS_b)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_DISCO_ITEMS_b)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_PUBSUB_b)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_b)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_ADHOC_b)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_ADHOC_b)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO,
|
#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_VCARD_b)]}]
|
attrs = [?XMLATTR(<<"var">>, ?NS_VCARD_b)]}]
|
||||||
++
|
++
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO,
|
[#xmlel{ns = ?NS_DISCO_INFO,
|
||||||
name = 'feature',
|
name = 'feature',
|
||||||
attrs = [?XMLATTR('var', list_to_binary(?NS_PUBSUB_s++"#"++Feature))]}
|
attrs = [?XMLATTR(<<"var">>, list_to_binary(?NS_PUBSUB_s++"#"++Feature))]}
|
||||||
|| Feature <- features(Host, <<>>)]};
|
|| Feature <- features(Host, <<>>)]};
|
||||||
iq_disco_info(Host, NodeId, From, _Lang)
|
iq_disco_info(Host, NodeId, From, _Lang)
|
||||||
when NodeId == ?NS_ADHOC_b orelse NodeId == ?NS_PUBSUB_GET_PENDING_b ->
|
when NodeId == ?NS_ADHOC_b orelse NodeId == ?NS_PUBSUB_GET_PENDING_b ->
|
||||||
@ -1425,9 +1425,9 @@ iq_disco_items(Host, <<>> = _NodeId, From) ->
|
|||||||
Attrs =
|
Attrs =
|
||||||
case get_option(Options, 'title') of
|
case get_option(Options, 'title') of
|
||||||
false ->
|
false ->
|
||||||
[?XMLATTR('jid', Host) | nodeAttr(SubNodeId)];
|
[?XMLATTR(<<"jid">>, Host) | nodeAttr(SubNodeId)];
|
||||||
Title ->
|
Title ->
|
||||||
[?XMLATTR('jid', Host), ?XMLATTR('name', Title) | nodeAttr(SubNodeId)]
|
[?XMLATTR(<<"jid">>, Host), ?XMLATTR(<<"name">>, Title) | nodeAttr(SubNodeId)]
|
||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
||||||
end, Nodes)};
|
end, Nodes)};
|
||||||
@ -1439,9 +1439,9 @@ iq_disco_items(Host, ?NS_ADHOC_b = _NodeId, _From) ->
|
|||||||
{result,
|
{result,
|
||||||
[#xmlel{ns = ?NS_DISCO_ITEMS,
|
[#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item',
|
name = 'item',
|
||||||
attrs = [?XMLATTR('jid', Host),
|
attrs = [?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('node', ?NS_PUBSUB_GET_PENDING_b),
|
?XMLATTR(<<"node">>, ?NS_PUBSUB_GET_PENDING_b),
|
||||||
?XMLATTR('name', "Get Pending")]}]};
|
?XMLATTR(<<"name">>, "Get Pending")]}]};
|
||||||
iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING_b = _NodeId, _From) ->
|
iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING_b = _NodeId, _From) ->
|
||||||
%% TODO
|
%% TODO
|
||||||
{result, []};
|
{result, []};
|
||||||
@ -1456,9 +1456,9 @@ iq_disco_items(Host, NodeId, From) ->
|
|||||||
Attrs =
|
Attrs =
|
||||||
case get_option(SubOptions, 'title') of
|
case get_option(SubOptions, 'title') of
|
||||||
false ->
|
false ->
|
||||||
[?XMLATTR('jid', Host) | nodeAttr(SubNodeId)];
|
[?XMLATTR(<<"jid">>, Host) | nodeAttr(SubNodeId)];
|
||||||
Title ->
|
Title ->
|
||||||
[?XMLATTR('jid', Host), ?XMLATTR('name', Title) | nodeAttr(SubNodeId)]
|
[?XMLATTR(<<"jid">>, Host), ?XMLATTR(<<"name">>, Title) | nodeAttr(SubNodeId)]
|
||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS,
|
#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item',
|
name = 'item',
|
||||||
@ -1469,8 +1469,8 @@ iq_disco_items(Host, NodeId, From) ->
|
|||||||
{result, Name} = node_call(Type, get_item_name, [Host, NodeId, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, NodeId, RN]),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS,
|
#xmlel{ns = ?NS_DISCO_ITEMS,
|
||||||
name = 'item',
|
name = 'item',
|
||||||
attrs = [?XMLATTR('jid', Host),
|
attrs = [?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('name', Name)]}
|
?XMLATTR(<<"name">>, Name)]}
|
||||||
end, NodeItems),
|
end, NodeItems),
|
||||||
{result, Nodes ++ Items}
|
{result, Nodes ++ Items}
|
||||||
end,
|
end,
|
||||||
@ -1573,7 +1573,7 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
case exmpp_xml:remove_cdata_from_list(Els) of
|
case exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{name = Name, attrs = Attrs, children = SubEls} | Rest] ->
|
[#xmlel{name = Name, attrs = Attrs, children = SubEls} | Rest] ->
|
||||||
%% Fix bug when owner retrieves his affiliations
|
%% Fix bug when owner retrieves his affiliations
|
||||||
NodeId = exmpp_xml:get_attribute_from_list(Attrs, 'node', <<>>),
|
NodeId = exmpp_xml:get_attribute_from_list(Attrs, <<"node">>, <<>>),
|
||||||
case {IQType, Name} of
|
case {IQType, Name} of
|
||||||
{'set', 'create'} ->
|
{'set', 'create'} ->
|
||||||
Config = case Rest of
|
Config = case Rest of
|
||||||
@ -1581,7 +1581,7 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
%% Get the type of the node
|
%% Get the type of the node
|
||||||
Plugin = case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', "") of
|
Plugin = case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"type">>, "") of
|
||||||
"" -> hd(Plugins);
|
"" -> hd(Plugins);
|
||||||
T -> T
|
T -> T
|
||||||
end,
|
end,
|
||||||
@ -1596,7 +1596,7 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
{'set', 'publish'} ->
|
{'set', 'publish'} ->
|
||||||
case exmpp_xml:remove_cdata_from_list(SubEls) of
|
case exmpp_xml:remove_cdata_from_list(SubEls) of
|
||||||
[#xmlel{name = 'item', attrs = ItemAttrs, children = Payload}] ->
|
[#xmlel{name = 'item', attrs = ItemAttrs, children = Payload}] ->
|
||||||
ItemId = exmpp_xml:get_attribute_from_list(ItemAttrs, 'id', <<>>),
|
ItemId = exmpp_xml:get_attribute_from_list(ItemAttrs, <<"id">>, <<>>),
|
||||||
publish_item(Host, ServerHost, NodeId, From, ItemId,
|
publish_item(Host, ServerHost, NodeId, From, ItemId,
|
||||||
exmpp_xml:remove_cdata_from_list(Payload));
|
exmpp_xml:remove_cdata_from_list(Payload));
|
||||||
[] ->
|
[] ->
|
||||||
@ -1607,14 +1607,14 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
{error, extended_error('bad-request', "invalid-payload")}
|
{error, extended_error('bad-request', "invalid-payload")}
|
||||||
end;
|
end;
|
||||||
{'set', 'retract'} ->
|
{'set', 'retract'} ->
|
||||||
ForceNotify = case exmpp_xml:get_attribute_from_list(Attrs, 'notify', <<>>) of
|
ForceNotify = case exmpp_xml:get_attribute_from_list(Attrs, <<"notify">>, <<>>) of
|
||||||
<<"1">> -> true;
|
<<"1">> -> true;
|
||||||
<<"true">> -> true;
|
<<"true">> -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end,
|
||||||
case exmpp_xml:remove_cdata_from_list(SubEls) of
|
case exmpp_xml:remove_cdata_from_list(SubEls) of
|
||||||
[#xmlel{name = 'item', attrs = ItemAttrs}] ->
|
[#xmlel{name = 'item', attrs = ItemAttrs}] ->
|
||||||
ItemId = exmpp_xml:get_attribute_from_list(ItemAttrs, 'id', <<>>),
|
ItemId = exmpp_xml:get_attribute_from_list(ItemAttrs, <<"id">>, <<>>),
|
||||||
delete_item(Host, NodeId, From, ItemId, ForceNotify);
|
delete_item(Host, NodeId, From, ItemId, ForceNotify);
|
||||||
_ ->
|
_ ->
|
||||||
%% Request does not specify an item
|
%% Request does not specify an item
|
||||||
@ -1625,18 +1625,18 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
[#xmlel{name = 'options', children = C}] -> C;
|
[#xmlel{name = 'options', children = C}] -> C;
|
||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
JID = exmpp_xml:get_attribute_from_list(Attrs, 'jid', <<>>),
|
JID = exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, <<>>),
|
||||||
subscribe_node(Host, NodeId, From, JID, Config);
|
subscribe_node(Host, NodeId, From, JID, Config);
|
||||||
{'set', 'unsubscribe'} ->
|
{'set', 'unsubscribe'} ->
|
||||||
JID = exmpp_xml:get_attribute_from_list(Attrs, 'jid', <<>>),
|
JID = exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, <<>>),
|
||||||
SubId = exmpp_xml:get_attribute_from_list(Attrs, 'subid', <<>>),
|
SubId = exmpp_xml:get_attribute_from_list(Attrs, <<"subid">>, <<>>),
|
||||||
unsubscribe_node(Host, NodeId, From, JID, SubId);
|
unsubscribe_node(Host, NodeId, From, JID, SubId);
|
||||||
{'get', 'items'} ->
|
{'get', 'items'} ->
|
||||||
MaxItems = exmpp_xml:get_attribute_from_list(Attrs, 'max_items', <<>>),
|
MaxItems = exmpp_xml:get_attribute_from_list(Attrs, <<"max_items">>, <<>>),
|
||||||
SubId = exmpp_xml:get_attribute_from_list(Attrs, 'subid', <<>>),
|
SubId = exmpp_xml:get_attribute_from_list(Attrs, <<"subid">>, <<>>),
|
||||||
ItemIds = lists:foldl(fun
|
ItemIds = lists:foldl(fun
|
||||||
(#xmlel{name = 'item', attrs = ItemAttrs}, Acc) ->
|
(#xmlel{name = 'item', attrs = ItemAttrs}, Acc) ->
|
||||||
case exmpp_xml:get_attribute_from_list(ItemAttrs, 'id', <<>>) of
|
case exmpp_xml:get_attribute_from_list(ItemAttrs, <<"id">>, <<>>) of
|
||||||
<<>> -> Acc;
|
<<>> -> Acc;
|
||||||
ItemId -> [ItemId|Acc]
|
ItemId -> [ItemId|Acc]
|
||||||
end;
|
end;
|
||||||
@ -1648,12 +1648,12 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
{'get', 'affiliations'} ->
|
{'get', 'affiliations'} ->
|
||||||
get_affiliations(Host, From, Plugins);
|
get_affiliations(Host, From, Plugins);
|
||||||
{'get', 'options'} ->
|
{'get', 'options'} ->
|
||||||
SubId = exmpp_xml:get_attribute_from_list(Attrs, 'subid', <<>>),
|
SubId = exmpp_xml:get_attribute_from_list(Attrs, <<"subid">>, <<>>),
|
||||||
JID = exmpp_xml:get_attribute_from_list(Attrs, 'jid', <<>>),
|
JID = exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, <<>>),
|
||||||
get_options(Host, NodeId, JID, SubId, Lang);
|
get_options(Host, NodeId, JID, SubId, Lang);
|
||||||
{'set', 'options'} ->
|
{'set', 'options'} ->
|
||||||
SubId = exmpp_xml:get_attribute_from_list(Attrs, 'subid', <<>>),
|
SubId = exmpp_xml:get_attribute_from_list(Attrs, <<"subid">>, <<>>),
|
||||||
JID = exmpp_xml:get_attribute_from_list(Attrs, 'jid', <<>>),
|
JID = exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, <<>>),
|
||||||
set_options(Host, NodeId, JID, SubId, SubEls);
|
set_options(Host, NodeId, JID, SubId, SubEls);
|
||||||
_ ->
|
_ ->
|
||||||
{error, 'feature-not-implemented'}
|
{error, 'feature-not-implemented'}
|
||||||
@ -1678,7 +1678,7 @@ iq_pubsub(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang, Access,
|
|||||||
iq_pubsub_owner(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang) ->
|
iq_pubsub_owner(Host, ServerHost, From, IQType, #xmlel{children = Els}, Lang) ->
|
||||||
case Action = exmpp_xml:remove_cdata_from_list(Els) of
|
case Action = exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{name = Name, attrs = Attrs, children = SubEls}] ->
|
[#xmlel{name = Name, attrs = Attrs, children = SubEls}] ->
|
||||||
NodeId = exmpp_xml:get_attribute_from_list(Attrs, 'node', <<>>),
|
NodeId = exmpp_xml:get_attribute_from_list(Attrs, <<"node">>, <<>>),
|
||||||
case {IQType, Name} of
|
case {IQType, Name} of
|
||||||
{'get', 'configure'} ->
|
{'get', 'configure'} ->
|
||||||
get_configure(Host, ServerHost, NodeId, From, Lang);
|
get_configure(Host, ServerHost, NodeId, From, Lang);
|
||||||
@ -1814,11 +1814,11 @@ send_pending_node_form(Host, Owner, _Lang, Plugins) ->
|
|||||||
children = [
|
children = [
|
||||||
exmpp_xml:cdata(node_to_string(Node))]}]}
|
exmpp_xml:cdata(node_to_string(Node))]}]}
|
||||||
end, get_pending_nodes(Host, Owner, Ps)),
|
end, get_pending_nodes(Host, Owner, Ps)),
|
||||||
XForm = #xmlel{ns = ?NS_DATA_FORMS, name ='x', attrs = [?XMLATTR('type', <<"form">>)],
|
XForm = #xmlel{ns = ?NS_DATA_FORMS, name ='x', attrs = [?XMLATTR(<<"type">>, <<"form">>)],
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field',
|
||||||
attrs = [?XMLATTR('type', <<"list-single">>),
|
attrs = [?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('var', <<"pubsub#node">>)],
|
?XMLATTR(<<"var">>, <<"pubsub#node">>)],
|
||||||
children = lists:usort(XOpts)}]},
|
children = lists:usort(XOpts)}]},
|
||||||
#adhoc_response{status = executing,
|
#adhoc_response{status = executing,
|
||||||
defaultaction = "execute",
|
defaultaction = "execute",
|
||||||
@ -1881,28 +1881,28 @@ send_authorization_request(#pubsub_node{owners = Owners, id = {Host, Node}}, Sub
|
|||||||
Lang = <<"en">>, %% TODO fix
|
Lang = <<"en">>, %% TODO fix
|
||||||
{U, S, R} = Subscriber,
|
{U, S, R} = Subscriber,
|
||||||
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "PubSub subscriber request"))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "PubSub subscriber request"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'instructions', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Choose whether to approve this entity's subscription."))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Choose whether to approve this entity's subscription."))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"FORM_TYPE">>), ?XMLATTR('type', <<"hidden">>)], children =
|
[?XMLATTR(<<"var">>, <<"FORM_TYPE">>), ?XMLATTR(<<"type">>, <<"hidden">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(?NS_PUBSUB_SUBSCRIBE_AUTH_s)}]}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(?NS_PUBSUB_SUBSCRIBE_AUTH_s)}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"pubsub#node">>), ?XMLATTR('type', <<"text-single">>),
|
[?XMLATTR(<<"var">>, <<"pubsub#node">>), ?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Node ID"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Node ID"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = Node}]}]},
|
[#xmlcdata{cdata = Node}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('var', <<"pubsub#subscriber_jid">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"var">>, <<"pubsub#subscriber_jid">>),
|
||||||
?XMLATTR('type', <<"jid-single">>),
|
?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Subscriber Address"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Subscriber Address"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = exmpp_jid:to_binary(U, S, R)}]}]},
|
[#xmlcdata{cdata = exmpp_jid:to_binary(U, S, R)}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"pubsub#allow">>),
|
[?XMLATTR(<<"var">>, <<"pubsub#allow">>),
|
||||||
?XMLATTR('type', <<"boolean">>),
|
?XMLATTR(<<"type">>, <<"boolean">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"false">>}]}]}]}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"false">>}]}]}]}]},
|
||||||
lists:foreach(fun(Owner) ->
|
lists:foreach(fun(Owner) ->
|
||||||
{U, S, R} = Owner,
|
{U, S, R} = Owner,
|
||||||
@ -1912,7 +1912,7 @@ send_authorization_request(#pubsub_node{owners = Owners, id = {Host, Node}}, Sub
|
|||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
Els = Packet#xmlel.children,
|
Els = Packet#xmlel.children,
|
||||||
XData1 = lists:map(fun(#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = XAttrs} = XEl) ->
|
XData1 = lists:map(fun(#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = XAttrs} = XEl) ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(XAttrs, 'type', "") of
|
case exmpp_xml:get_attribute_from_list_as_list(XAttrs, <<"type">>, "") of
|
||||||
"cancel" ->
|
"cancel" ->
|
||||||
none;
|
none;
|
||||||
_ ->
|
_ ->
|
||||||
@ -1943,13 +1943,13 @@ find_authorization_response(Packet) ->
|
|||||||
%% @doc Send a message to JID with the supplied Subscription
|
%% @doc Send a message to JID with the supplied Subscription
|
||||||
send_authorization_approval(Host, JID, SNode, Subscription) ->
|
send_authorization_approval(Host, JID, SNode, Subscription) ->
|
||||||
SubAttrs = case Subscription of
|
SubAttrs = case Subscription of
|
||||||
{S, SID} -> [?XMLATTR('subscription', subscription_to_string(S)),
|
{S, SID} -> [?XMLATTR(<<"subscription">>, subscription_to_string(S)),
|
||||||
?XMLATTR('subid', SID)];
|
?XMLATTR(<<"subid">>, SID)];
|
||||||
S -> [?XMLATTR('subscription', subscription_to_string(S))]
|
S -> [?XMLATTR(<<"subscription">>, subscription_to_string(S))]
|
||||||
end,
|
end,
|
||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(JID)) | nodeAttr(SNode)] ++ SubAttrs
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(JID)) | nodeAttr(SNode)] ++ SubAttrs
|
||||||
}]),
|
}]),
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
||||||
|
|
||||||
@ -2014,9 +2014,9 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-define(XFIELD(Type, Label, Var, Val),
|
-define(XFIELD(Type, Label, Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
||||||
|
|
||||||
-define(BOOLXFIELD(Label, Var, Val),
|
-define(BOOLXFIELD(Label, Var, Val),
|
||||||
@ -2032,17 +2032,17 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
-define(STRINGMXFIELD(Label, Var, Vals),
|
-define(STRINGMXFIELD(Label, Var, Vals),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('type', <<"text-multi">>),
|
attrs = [?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)
|
?XMLATTR(<<"var">>, Var)
|
||||||
],
|
],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value',
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value',
|
||||||
children = [?XMLCDATA(V)]} || V <- Vals]}).
|
children = [?XMLCDATA(V)]} || V <- Vals]}).
|
||||||
|
|
||||||
-define(XFIELDOPT(Type, Label, Var, Val, Opts),
|
-define(XFIELDOPT(Type, Label, Var, Val, Opts),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
lists:map(fun(Opt) ->
|
lists:map(fun(Opt) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
@ -2054,9 +2054,9 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
?XFIELDOPT("list-single", Label, Var, Val, Opts)).
|
?XFIELDOPT("list-single", Label, Var, Val, Opts)).
|
||||||
|
|
||||||
-define(LISTMXFIELD(Label, Var, Vals, Opts),
|
-define(LISTMXFIELD(Label, Var, Vals, Opts),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', <<"list-multi">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, <<"list-multi">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
lists:map(fun(Opt) ->
|
lists:map(fun(Opt) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
@ -2315,13 +2315,13 @@ subscribe_node(Host, Node, From, JID, Configuration) ->
|
|||||||
%% TODO, this is subscription-notification, should depends on node features
|
%% TODO, this is subscription-notification, should depends on node features
|
||||||
SubAttrs = case Subscription of
|
SubAttrs = case Subscription of
|
||||||
{subscribed, SubId} ->
|
{subscribed, SubId} ->
|
||||||
[?XMLATTR("subscription", subscription_to_string(subscribed)),
|
[?XMLATTR(<<"subscription">>, subscription_to_string(subscribed)),
|
||||||
?XMLATTR("subid", SubId)];
|
?XMLATTR(<<"subid">>, SubId)];
|
||||||
Other ->
|
Other ->
|
||||||
[?XMLATTR("subscription", subscription_to_string(Other))]
|
[?XMLATTR(<<"subscription">>, subscription_to_string(Other))]
|
||||||
end,
|
end,
|
||||||
Fields =
|
Fields =
|
||||||
[ ?XMLATTR('jid', JID) | SubAttrs],
|
[ ?XMLATTR(<<"jid">>, JID) | SubAttrs],
|
||||||
#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs = Fields}]}
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs = Fields}]}
|
||||||
end,
|
end,
|
||||||
@ -2796,8 +2796,8 @@ get_affiliations(Host, JID, Plugins) when is_list(Plugins) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({#pubsub_node{id = {_, Node}}, Affiliation}) ->
|
({#pubsub_node{id = {_, Node}}, Affiliation}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliation', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliation', attrs =
|
||||||
[?XMLATTR('node', node_to_string(Node)),
|
[?XMLATTR(<<"node">>, node_to_string(Node)),
|
||||||
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
|
?XMLATTR(<<"affiliation">>, affiliation_to_string(Affiliation))]}]
|
||||||
end, lists:usort(lists:flatten(Affiliations))),
|
end, lists:usort(lists:flatten(Affiliations))),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliations', children =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliations', children =
|
||||||
@ -2827,8 +2827,8 @@ get_affiliations(Host, Node, JID) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({{AU, AS, AR}, Affiliation}) ->
|
({{AU, AS, AR}, Affiliation}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
|
?XMLATTR(<<"affiliation">>, affiliation_to_string(Affiliation))]}]
|
||||||
end, Affiliations),
|
end, Affiliations),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliations', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliations', attrs = nodeAttr(Node), children =
|
||||||
@ -2850,12 +2850,12 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
|
|||||||
#xmlel{name = 'affiliation', attrs = Attrs} ->
|
#xmlel{name = 'affiliation', attrs = Attrs} ->
|
||||||
JID = try
|
JID = try
|
||||||
exmpp_jid:parse(
|
exmpp_jid:parse(
|
||||||
exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
|
exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, ""))
|
||||||
catch
|
catch
|
||||||
_:_ -> error
|
_:_ -> error
|
||||||
end,
|
end,
|
||||||
Affiliation = string_to_affiliation(
|
Affiliation = string_to_affiliation(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'affiliation', "")),
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"affiliation">>, "")),
|
||||||
if
|
if
|
||||||
(JID == error) or
|
(JID == error) or
|
||||||
(Affiliation == false) ->
|
(Affiliation == false) ->
|
||||||
@ -2958,8 +2958,8 @@ read_sub(Subscriber, Node, NodeId, SubId, Lang) ->
|
|||||||
{result, #pubsub_subscription{options = Options}} ->
|
{result, #pubsub_subscription{options = Options}} ->
|
||||||
{result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options),
|
{result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options),
|
||||||
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
||||||
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
attrs = [ ?XMLATTR(<<"jid">>, exmpp_jid:to_binary(Subscriber)),
|
||||||
?XMLATTR('subid', SubId) | nodeAttr(Node)],
|
?XMLATTR(<<"subid">>, SubId) | nodeAttr(Node)],
|
||||||
children = [XdataEl]},
|
children = [XdataEl]},
|
||||||
PubsubEl = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = [OptionsEl]},
|
PubsubEl = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = [OptionsEl]},
|
||||||
{result, PubsubEl}
|
{result, PubsubEl}
|
||||||
@ -3052,11 +3052,11 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', node_to_string(SubsNode)),
|
[?XMLATTR(<<"node">>, node_to_string(SubsNode)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
[?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end;
|
end;
|
||||||
@ -3066,14 +3066,14 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name='subscription',
|
[#xmlel{ns = ?NS_PUBSUB, name='subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subid', SubId),
|
?XMLATTR(<<"subid">>, SubId),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription)) | nodeAttr(SubsNode)]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription)) | nodeAttr(SubsNode)]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription',
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subid', SubId),
|
?XMLATTR(<<"subid">>, SubId),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end;
|
end;
|
||||||
@ -3081,13 +3081,13 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', node_to_string(SubsNode)),
|
[?XMLATTR(<<"node">>, node_to_string(SubsNode)),
|
||||||
?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
@ -3124,13 +3124,13 @@ get_subscriptions(Host, Node, JID) ->
|
|||||||
({_, pending, _}) -> [];
|
({_, pending, _}) -> [];
|
||||||
({{AU, AS, AR}, Subscription}) ->
|
({{AU, AS, AR}, Subscription}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
({{AU, AS, AR}, Subscription, SubId}) ->
|
({{AU, AS, AR}, Subscription, SubId}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription)),
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription)),
|
||||||
?XMLATTR('subid', SubId)]}]
|
?XMLATTR(<<"subid">>, SubId)]}]
|
||||||
end, Subscriptions),
|
end, Subscriptions),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscriptions', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscriptions', attrs = nodeAttr(Node), children =
|
||||||
@ -3152,14 +3152,14 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
#xmlel{name = 'subscription', attrs = Attrs} ->
|
#xmlel{name = 'subscription', attrs = Attrs} ->
|
||||||
JID = try
|
JID = try
|
||||||
exmpp_jid:parse(
|
exmpp_jid:parse(
|
||||||
exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
|
exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, ""))
|
||||||
catch
|
catch
|
||||||
_:_ ->
|
_:_ ->
|
||||||
error
|
error
|
||||||
end,
|
end,
|
||||||
Subscription = string_to_subscription(
|
Subscription = string_to_subscription(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subscription', false)),
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subscription">>, false)),
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, "subid", false),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, false),
|
||||||
if
|
if
|
||||||
(JID == error) or
|
(JID == error) or
|
||||||
(Subscription == false) ->
|
(Subscription == false) ->
|
||||||
@ -3183,8 +3183,8 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
children =
|
children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB,
|
[#xmlel{ns = ?NS_PUBSUB,
|
||||||
name = 'subscription',
|
name = 'subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(JID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(JID)),
|
||||||
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
?XMLATTR(<<"subsription">>, subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
||||||
end,
|
end,
|
||||||
Action = fun(#pubsub_node{owners = Owners, type = Type, idx = Nidx}) ->
|
Action = fun(#pubsub_node{owners = Owners, type = Type, idx = Nidx}) ->
|
||||||
@ -3519,14 +3519,14 @@ broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) ->
|
|||||||
SubsByDepth when is_list(SubsByDepth) ->
|
SubsByDepth when is_list(SubsByDepth) ->
|
||||||
Content = case get_option(NodeOptions, deliver_payloads) of
|
Content = case get_option(NodeOptions, deliver_payloads) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, NodeOptions, Lang, [])}];
|
get_configure_xfields(Type, NodeOptions, Lang, [])}];
|
||||||
false ->
|
false ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR('id', <<"configuration">>)], children =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR(<<"id">>, <<"configuration">>)], children =
|
||||||
Content}]}]),
|
Content}]}]),
|
||||||
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
|
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
|
||||||
{result, true};
|
{result, true};
|
||||||
@ -3773,7 +3773,7 @@ get_configure(Host, ServerHost, Node, #jid{node = User, domain = Server} = From,
|
|||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'configure', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'configure', attrs =
|
||||||
nodeAttr(Node), children =
|
nodeAttr(Node), children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, Options, Lang, Groups)
|
get_configure_xfields(Type, Options, Lang, Groups)
|
||||||
}]}]}};
|
}]}]}};
|
||||||
_ ->
|
_ ->
|
||||||
@ -3790,7 +3790,7 @@ get_default(Host, Node, _From, Lang) ->
|
|||||||
Options = node_options(Type),
|
Options = node_options(Type),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'default', children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'default', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, Options, Lang, [])
|
get_configure_xfields(Type, Options, Lang, [])
|
||||||
}]}]}}.
|
}]}]}}.
|
||||||
|
|
||||||
@ -3947,7 +3947,7 @@ get_configure_xfields(_Type, Options, Lang, Groups) ->
|
|||||||
set_configure(Host, Node, From, Els, Lang) ->
|
set_configure(Host, Node, From, Els, Lang) ->
|
||||||
case exmpp_xml:remove_cdata_from_list(Els) of
|
case exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x'} = XEl] ->
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x'} = XEl] ->
|
||||||
case exmpp_xml:get_attribute_as_list(XEl, 'type', undefined) of
|
case exmpp_xml:get_attribute_as_list(XEl, <<"type">>, undefined) of
|
||||||
"cancel" ->
|
"cancel" ->
|
||||||
{result, []};
|
{result, []};
|
||||||
"submit" ->
|
"submit" ->
|
||||||
@ -4476,7 +4476,7 @@ extended_error(Error, Ext) ->
|
|||||||
extended_error(Error, Ext, []).
|
extended_error(Error, Ext, []).
|
||||||
extended_error(Error, unsupported, Feature) ->
|
extended_error(Error, unsupported, Feature) ->
|
||||||
extended_error(Error, unsupported,
|
extended_error(Error, unsupported,
|
||||||
[?XMLATTR('feature', Feature)]);
|
[?XMLATTR(<<"feature">>, Feature)]);
|
||||||
extended_error(Error, Ext, ExtAttrs) ->
|
extended_error(Error, Ext, ExtAttrs) ->
|
||||||
%Pubsub_Err = #xmlel{ns = ?NS_PUBSUB_ERRORS, name = Ext, attrs = ExtAttrs},
|
%Pubsub_Err = #xmlel{ns = ?NS_PUBSUB_ERRORS, name = Ext, attrs = ExtAttrs},
|
||||||
exmpp_xml:append_child(exmpp_stanza:error(?NS_JABBER_CLIENT, Error),
|
exmpp_xml:append_child(exmpp_stanza:error(?NS_JABBER_CLIENT, Error),
|
||||||
@ -4491,13 +4491,13 @@ uniqid() ->
|
|||||||
|
|
||||||
% node attributes
|
% node attributes
|
||||||
nodeAttr(Node) when is_list(Node) ->
|
nodeAttr(Node) when is_list(Node) ->
|
||||||
[?XMLATTR('node', Node)];
|
[?XMLATTR(<<"node">>, Node)];
|
||||||
nodeAttr(Node) ->
|
nodeAttr(Node) ->
|
||||||
[?XMLATTR('node', node_to_string(Node))].
|
[?XMLATTR(<<"node">>, node_to_string(Node))].
|
||||||
|
|
||||||
% item attributes
|
% item attributes
|
||||||
itemAttr([]) -> [];
|
itemAttr([]) -> [];
|
||||||
itemAttr(ItemId) -> [?XMLATTR('id', ItemId)].
|
itemAttr(ItemId) -> [?XMLATTR(<<"id">>, ItemId)].
|
||||||
|
|
||||||
|
|
||||||
% build item elements from item list
|
% build item elements from item list
|
||||||
@ -4545,19 +4545,19 @@ add_headers(#xmlel{children = Els} = Stanza, HeaderName, HeaderNS, HeaderEls) ->
|
|||||||
%% identifier of the collection".
|
%% identifier of the collection".
|
||||||
collection_shim(Node) ->
|
collection_shim(Node) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
||||||
attrs = [?XMLATTR('name', <<"Collection">>)],
|
attrs = [?XMLATTR(<<"name">>, <<"Collection">>)],
|
||||||
children = [?XMLCDATA(node_to_string(Node))]}].
|
children = [?XMLCDATA(node_to_string(Node))]}].
|
||||||
|
|
||||||
subid_shim(SubIds) ->
|
subid_shim(SubIds) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
||||||
attrs = [?XMLATTR('name', <<"SubId">>)],
|
attrs = [?XMLATTR(<<"name">>, <<"SubId">>)],
|
||||||
children = [?XMLCDATA(SubId)]}
|
children = [?XMLCDATA(SubId)]}
|
||||||
|| SubId <- SubIds].
|
|| SubId <- SubIds].
|
||||||
|
|
||||||
|
|
||||||
extended_headers(JIDs) ->
|
extended_headers(JIDs) ->
|
||||||
[#xmlel{ns = ?NS_ADDRESS, name = 'address',
|
[#xmlel{ns = ?NS_ADDRESS, name = 'address',
|
||||||
attrs = [?XMLATTR('type', <<"replyto">>), ?XMLATTR('jid', JID)]}
|
attrs = [?XMLATTR(<<"type">>, <<"replyto">>), ?XMLATTR(<<"jid">>, JID)]}
|
||||||
|| JID <- JIDs].
|
|| JID <- JIDs].
|
||||||
|
|
||||||
feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
||||||
@ -4570,7 +4570,7 @@ feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
|||||||
case exmpp_xml:get_element(El, 'event') of
|
case exmpp_xml:get_element(El, 'event') of
|
||||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
Feature = exmpp_xml:get_attribute_as_list(Items, <<"node">>, ""),
|
||||||
case is_feature_supported(Pres, Feature) of
|
case is_feature_supported(Pres, Feature) of
|
||||||
true -> allow;
|
true -> allow;
|
||||||
false -> deny
|
false -> deny
|
||||||
@ -4661,9 +4661,9 @@ notify_owners(true, JID, Host, Node, Owners, State) ->
|
|||||||
Message = #xmlel{name = 'message', ns = ?NS_JABBER_CLIENT,
|
Message = #xmlel{name = 'message', ns = ?NS_JABBER_CLIENT,
|
||||||
children = [#xmlel{name = 'pubsub', ns = ?NS_PUBSUB,
|
children = [#xmlel{name = 'pubsub', ns = ?NS_PUBSUB,
|
||||||
children = [#xmlel{name = 'subscription', ns = ?NS_PUBSUB,
|
children = [#xmlel{name = 'subscription', ns = ?NS_PUBSUB,
|
||||||
attrs = [?XMLATTR('node', Node),
|
attrs = [?XMLATTR(<<"node">>, Node),
|
||||||
?XMLATTR('jid', exmpp_jid:prep_to_binary(exmpp_jid:make(JID))),
|
?XMLATTR(<<"jid">>, exmpp_jid:prep_to_binary(exmpp_jid:make(JID))),
|
||||||
?XMLATTR('subscription', State)]}]}]},
|
?XMLATTR(<<"subscription">>, State)]}]}]},
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Owner) ->
|
fun(Owner) ->
|
||||||
ejabberd_router:route(exmpp_jid:make(Host), exmpp_jid:make(Owner), Message)
|
ejabberd_router:route(exmpp_jid:make(Host), exmpp_jid:make(Owner), Message)
|
||||||
|
@ -391,7 +391,7 @@ disco_local_identity(Acc, _From, To, <<>>, _Lang) ->
|
|||||||
case lists:member(?PEPNODE, plugins(exmpp_jid:prep_domain_as_list(To))) of
|
case lists:member(?PEPNODE, plugins(exmpp_jid:prep_domain_as_list(To))) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]}
|
||||||
| Acc];
|
| Acc];
|
||||||
false -> Acc
|
false -> Acc
|
||||||
end;
|
end;
|
||||||
@ -420,7 +420,7 @@ disco_sm_identity(Acc, From, To, Node, _Lang) ->
|
|||||||
|
|
||||||
disco_identity(_Host, <<>>, _From) ->
|
disco_identity(_Host, <<>>, _From) ->
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]}];
|
||||||
disco_identity(Host, Node, From) ->
|
disco_identity(Host, Node, From) ->
|
||||||
Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options}) ->
|
Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options}) ->
|
||||||
Owners = node_owners_call(Type, Nidx),
|
Owners = node_owners_call(Type, Nidx),
|
||||||
@ -428,12 +428,12 @@ disco_identity(Host, Node, From) ->
|
|||||||
{result, _} ->
|
{result, _} ->
|
||||||
{result,
|
{result,
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]},
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"pep">>)]},
|
||||||
#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"leaf">>)
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR(<<"type">>, <<"leaf">>)
|
||||||
| case get_option(Options, title) of
|
| case get_option(Options, title) of
|
||||||
false -> [];
|
false -> [];
|
||||||
Title -> [?XMLATTR('name', Title)]
|
Title -> [?XMLATTR(<<"name">>, Title)]
|
||||||
end
|
end
|
||||||
]}]};
|
]}]};
|
||||||
{error, _} -> {result, []}
|
{error, _} -> {result, []}
|
||||||
@ -479,11 +479,11 @@ disco_items(Host, <<>>, From) ->
|
|||||||
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
case get_allowed_items_call(Host, Nidx, From, Type, Options, Owners) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(Host)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(Host)),
|
||||||
?XMLATTR('node', NodeId) |
|
?XMLATTR(<<"node">>, NodeId) |
|
||||||
case get_option(Options, title) of
|
case get_option(Options, title) of
|
||||||
false -> [];
|
false -> [];
|
||||||
[Title] -> [?XMLATTR('title', Title)]
|
[Title] -> [?XMLATTR(<<"title">>, Title)]
|
||||||
end]}
|
end]}
|
||||||
| Acc];
|
| Acc];
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
@ -501,8 +501,8 @@ disco_items(Host, Node, From) ->
|
|||||||
{result, Items} ->
|
{result, Items} ->
|
||||||
{result,
|
{result,
|
||||||
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'item', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(Host)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(Host)),
|
||||||
?XMLATTR('name', ItemId)]}
|
?XMLATTR(<<"name">>, ItemId)]}
|
||||||
|| #pubsub_item{id = {ItemId,_}} <- Items]};
|
|| #pubsub_item{id = {ItemId,_}} <- Items]};
|
||||||
_ -> {result, []}
|
_ -> {result, []}
|
||||||
end
|
end
|
||||||
@ -744,7 +744,7 @@ do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
|||||||
#iq{type = get, ns = ?NS_DISCO_INFO,
|
#iq{type = get, ns = ?NS_DISCO_INFO,
|
||||||
payload = SubEl, lang = Lang} ->
|
payload = SubEl, lang = Lang} ->
|
||||||
QAttrs = SubEl#xmlel.attrs,
|
QAttrs = SubEl#xmlel.attrs,
|
||||||
Node = exmpp_xml:get_attribute_from_list_as_list(QAttrs, 'node', ""),
|
Node = exmpp_xml:get_attribute_from_list_as_list(QAttrs, <<"node">>, ""),
|
||||||
ServerHostB = list_to_binary(ServerHost),
|
ServerHostB = list_to_binary(ServerHost),
|
||||||
Info = ejabberd_hooks:run_fold(
|
Info = ejabberd_hooks:run_fold(
|
||||||
disco_info, ServerHostB, [],
|
disco_info, ServerHostB, [],
|
||||||
@ -762,7 +762,7 @@ do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
|||||||
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
#iq{type = get, ns = ?NS_DISCO_ITEMS,
|
||||||
payload = SubEl} = IQ ->
|
payload = SubEl} = IQ ->
|
||||||
QAttrs = SubEl#xmlel.attrs,
|
QAttrs = SubEl#xmlel.attrs,
|
||||||
Node = exmpp_xml:get_attribute_from_list_as_list(QAttrs, 'node', ""),
|
Node = exmpp_xml:get_attribute_from_list_as_list(QAttrs, <<"node">>, ""),
|
||||||
Rsm = jlib:rsm_decode(IQ),
|
Rsm = jlib:rsm_decode(IQ),
|
||||||
Res = case iq_disco_items(Host, Node, From, Rsm) of
|
Res = case iq_disco_items(Host, Node, From, Rsm) of
|
||||||
{result, IQRes} ->
|
{result, IQRes} ->
|
||||||
@ -838,12 +838,12 @@ do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
|||||||
undefined ->
|
undefined ->
|
||||||
ok;
|
ok;
|
||||||
Publish ->
|
Publish ->
|
||||||
Node = exmpp_xml:get_attribute(Publish, 'node', <<>>),
|
Node = exmpp_xml:get_attribute(Publish, <<"node">>, <<>>),
|
||||||
case exmpp_xml:get_element(Publish, 'item') of
|
case exmpp_xml:get_element(Publish, 'item') of
|
||||||
undefined ->
|
undefined ->
|
||||||
ok;
|
ok;
|
||||||
Item ->
|
Item ->
|
||||||
ItemId = exmpp_xml:get_attribute_as_list(Item, 'id', ""),
|
ItemId = exmpp_xml:get_attribute_as_list(Item, <<"id">>, ""),
|
||||||
case publish_item(Host, ServerHost, Node, From, ItemId, Item#xmlel.children) of
|
case publish_item(Host, ServerHost, Node, From, ItemId, Item#xmlel.children) of
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
ok;
|
ok;
|
||||||
@ -875,16 +875,16 @@ do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
|||||||
command_disco_info(_Host, ?NS_ADHOC_b, _From) ->
|
command_disco_info(_Host, ?NS_ADHOC_b, _From) ->
|
||||||
IdentityEl =
|
IdentityEl =
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"automation">>),
|
attrs = [?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-list">>)]},
|
?XMLATTR(<<"type">>, <<"command-list">>)]},
|
||||||
{result, [IdentityEl]};
|
{result, [IdentityEl]};
|
||||||
command_disco_info(_Host, ?NS_PUBSUB_GET_PENDING_b, _From) ->
|
command_disco_info(_Host, ?NS_PUBSUB_GET_PENDING_b, _From) ->
|
||||||
IdentityEl =
|
IdentityEl =
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [?XMLATTR('category', <<"automation">>),
|
attrs = [?XMLATTR(<<"category">>, <<"automation">>),
|
||||||
?XMLATTR('type', <<"command-node">>)]},
|
?XMLATTR(<<"type">>, <<"command-node">>)]},
|
||||||
FeaturesEl = #xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
FeaturesEl = #xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [?XMLATTR('var', ?NS_ADHOC)]},
|
attrs = [?XMLATTR(<<"var">>, ?NS_ADHOC)]},
|
||||||
{result, [IdentityEl, FeaturesEl]}.
|
{result, [IdentityEl, FeaturesEl]}.
|
||||||
|
|
||||||
node_disco_info(Host, Node, From) ->
|
node_disco_info(Host, Node, From) ->
|
||||||
@ -908,18 +908,18 @@ node_disco_info(Host, Node, From, Identity, Features) ->
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
lists:map(fun(T) ->
|
lists:map(fun(T) ->
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [?XMLATTR('category', <<"pubsub">>),
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [?XMLATTR(<<"category">>, <<"pubsub">>),
|
||||||
?XMLATTR('type', T)]}
|
?XMLATTR(<<"type">>, T)]}
|
||||||
end, Types)
|
end, Types)
|
||||||
end,
|
end,
|
||||||
F = case Features of
|
F = case Features of
|
||||||
false ->
|
false ->
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s)]} |
|
||||||
lists:map(fun
|
lists:map(fun
|
||||||
("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_RSM_s)]};
|
("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_RSM_s)]};
|
||||||
(T) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++T)]}
|
(T) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++T)]}
|
||||||
end, features(Type))]
|
end, features(Type))]
|
||||||
end,
|
end,
|
||||||
%% TODO: add meta-data info (spec section 5.4)
|
%% TODO: add meta-data info (spec section 5.4)
|
||||||
@ -940,17 +940,17 @@ iq_disco_info(Host, SNode, From, Lang) ->
|
|||||||
<<>> ->
|
<<>> ->
|
||||||
{result,
|
{result,
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs =
|
||||||
[?XMLATTR('category', "pubsub"),
|
[?XMLATTR(<<"category">>, "pubsub"),
|
||||||
?XMLATTR('type', "service"),
|
?XMLATTR(<<"type">>, "service"),
|
||||||
?XMLATTR('name', translate:translate(Lang, "Publish-Subscribe"))]},
|
?XMLATTR(<<"name">>, translate:translate(Lang, "Publish-Subscribe"))]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_INFO_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_DISCO_INFO_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_DISCO_ITEMS_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_DISCO_ITEMS_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_ADHOC_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_VCARD_s)]}] ++
|
||||||
lists:map(fun
|
lists:map(fun
|
||||||
("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_RSM_s)]};
|
("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_RSM_s)]};
|
||||||
(Feature) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]}
|
(Feature) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++Feature)]}
|
||||||
end, features(Host, Node))};
|
end, features(Host, Node))};
|
||||||
?NS_ADHOC_b ->
|
?NS_ADHOC_b ->
|
||||||
command_disco_info(Host, Node, From);
|
command_disco_info(Host, Node, From);
|
||||||
@ -968,9 +968,9 @@ iq_disco_items(Host, [], From, _RSM) ->
|
|||||||
Attrs =
|
Attrs =
|
||||||
case get_option(Options, title) of
|
case get_option(Options, title) of
|
||||||
false ->
|
false ->
|
||||||
[?XMLATTR('jid', Host) | nodeAttr(SubNode)];
|
[?XMLATTR(<<"jid">>, Host) | nodeAttr(SubNode)];
|
||||||
Title ->
|
Title ->
|
||||||
[?XMLATTR('jid', Host), ?XMLATTR('name', Title) | nodeAttr(SubNode)]
|
[?XMLATTR(<<"jid">>, Host), ?XMLATTR(<<"name">>, Title) | nodeAttr(SubNode)]
|
||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
||||||
end, Nodes)};
|
end, Nodes)};
|
||||||
@ -981,9 +981,9 @@ iq_disco_items(Host, ?NS_ADHOC_s, _From, _RSM) ->
|
|||||||
%% TODO: support localization of this string
|
%% TODO: support localization of this string
|
||||||
CommandItems = [
|
CommandItems = [
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
||||||
attrs = [?XMLATTR('jid', Host),
|
attrs = [?XMLATTR(<<"jid">>, Host),
|
||||||
?XMLATTR('node', ?NS_PUBSUB_GET_PENDING),
|
?XMLATTR(<<"node">>, ?NS_PUBSUB_GET_PENDING),
|
||||||
?XMLATTR('name', "Get Pending")
|
?XMLATTR(<<"name">>, "Get Pending")
|
||||||
]}],
|
]}],
|
||||||
{result, CommandItems};
|
{result, CommandItems};
|
||||||
iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From, _RSM) ->
|
iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From, _RSM) ->
|
||||||
@ -1006,16 +1006,16 @@ iq_disco_items(Host, Item, From, RSM) ->
|
|||||||
Attrs =
|
Attrs =
|
||||||
case get_option(SubOptions, title) of
|
case get_option(SubOptions, title) of
|
||||||
false ->
|
false ->
|
||||||
[?XMLATTR('jid', Host) | nodeAttr(SubNode)];
|
[?XMLATTR(<<"jid">>, Host) | nodeAttr(SubNode)];
|
||||||
Title ->
|
Title ->
|
||||||
[?XMLATTR('jid', Host), ?XMLATTR('name', Title) | nodeAttr(SubNode)]
|
[?XMLATTR(<<"jid">>, Host), ?XMLATTR(<<"name">>, Title) | nodeAttr(SubNode)]
|
||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Attrs}
|
||||||
end, tree_call(Host, get_subnodes, [Host, Node, From])),
|
end, tree_call(Host, get_subnodes, [Host, Node, From])),
|
||||||
Items = lists:map(
|
Items = lists:map(
|
||||||
fun(#pubsub_item{id = {RN, _}}) ->
|
fun(#pubsub_item{id = {RN, _}}) ->
|
||||||
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR('jid', Host), ?XMLATTR('name', Name)]}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR(<<"jid">>, Host), ?XMLATTR(<<"name">>, Name)]}
|
||||||
end, NodeItems),
|
end, NodeItems),
|
||||||
{result, Nodes ++ Items ++ jlib:rsm_encode(RsmOut)}
|
{result, Nodes ++ Items ++ jlib:rsm_encode(RsmOut)}
|
||||||
end,
|
end,
|
||||||
@ -1067,7 +1067,7 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of
|
case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of
|
||||||
[#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] ->
|
[#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] ->
|
||||||
%% Fix bug when owner retrieves his affiliations
|
%% Fix bug when owner retrieves his affiliations
|
||||||
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")),
|
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"node">>, "")),
|
||||||
case {IQType, Name} of
|
case {IQType, Name} of
|
||||||
{set, 'create'} ->
|
{set, 'create'} ->
|
||||||
Config = case Rest of
|
Config = case Rest of
|
||||||
@ -1075,7 +1075,7 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
%% Get the type of the node
|
%% Get the type of the node
|
||||||
Type = case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'type', "") of
|
Type = case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"type">>, "") of
|
||||||
[] -> hd(Plugins);
|
[] -> hd(Plugins);
|
||||||
T -> T
|
T -> T
|
||||||
end,
|
end,
|
||||||
@ -1093,7 +1093,7 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
{set, 'publish'} ->
|
{set, 'publish'} ->
|
||||||
case exmpp_xml:remove_cdata_from_list(Els) of
|
case exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{name = 'item', attrs = ItemAttrs, children = Payload}] ->
|
[#xmlel{name = 'item', attrs = ItemAttrs, children = Payload}] ->
|
||||||
ItemId = exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, 'id', ""),
|
ItemId = exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, <<"id">>, ""),
|
||||||
publish_item(Host, ServerHost, Node, From, ItemId, Payload);
|
publish_item(Host, ServerHost, Node, From, ItemId, Payload);
|
||||||
[] ->
|
[] ->
|
||||||
%% Publisher attempts to publish to persistent node with no item
|
%% Publisher attempts to publish to persistent node with no item
|
||||||
@ -1105,14 +1105,14 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
"invalid-payload")}
|
"invalid-payload")}
|
||||||
end;
|
end;
|
||||||
{set, 'retract'} ->
|
{set, 'retract'} ->
|
||||||
ForceNotify = case exmpp_xml:get_attribute_from_list_as_list(Attrs, 'notify', "") of
|
ForceNotify = case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"notify">>, "") of
|
||||||
"1" -> true;
|
"1" -> true;
|
||||||
"true" -> true;
|
"true" -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end,
|
||||||
case exmpp_xml:remove_cdata_from_list(Els) of
|
case exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{name = 'item', attrs = ItemAttrs}] ->
|
[#xmlel{name = 'item', attrs = ItemAttrs}] ->
|
||||||
ItemId = exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, 'id', ""),
|
ItemId = exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, <<"id">>, ""),
|
||||||
delete_item(Host, Node, From, ItemId, ForceNotify);
|
delete_item(Host, Node, From, ItemId, ForceNotify);
|
||||||
_ ->
|
_ ->
|
||||||
%% Request does not specify an item
|
%% Request does not specify an item
|
||||||
@ -1124,18 +1124,18 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
[#xmlel{name = 'options', children = C}] -> C;
|
[#xmlel{name = 'options', children = C}] -> C;
|
||||||
_ -> []
|
_ -> []
|
||||||
end,
|
end,
|
||||||
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', ""),
|
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"jid">>, ""),
|
||||||
subscribe_node(Host, Node, From, JID, Config);
|
subscribe_node(Host, Node, From, JID, Config);
|
||||||
{set, 'unsubscribe'} ->
|
{set, 'unsubscribe'} ->
|
||||||
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', ""),
|
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"jid">>, ""),
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subid', ""),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, ""),
|
||||||
unsubscribe_node(Host, Node, From, JID, SubId);
|
unsubscribe_node(Host, Node, From, JID, SubId);
|
||||||
{get, 'items'} ->
|
{get, 'items'} ->
|
||||||
MaxItems = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'max_items', ""),
|
MaxItems = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"max_items">>, ""),
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subid', ""),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, ""),
|
||||||
ItemIds = lists:foldl(fun
|
ItemIds = lists:foldl(fun
|
||||||
(#xmlel{name = 'item', attrs = ItemAttrs}, Acc) ->
|
(#xmlel{name = 'item', attrs = ItemAttrs}, Acc) ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, 'id', "") of
|
case exmpp_xml:get_attribute_from_list_as_list(ItemAttrs, <<"id">>, "") of
|
||||||
"" -> Acc;
|
"" -> Acc;
|
||||||
ItemId -> [ItemId|Acc]
|
ItemId -> [ItemId|Acc]
|
||||||
end;
|
end;
|
||||||
@ -1148,12 +1148,12 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
|
|||||||
{get, 'affiliations'} ->
|
{get, 'affiliations'} ->
|
||||||
get_affiliations(Host, From, Plugins);
|
get_affiliations(Host, From, Plugins);
|
||||||
{get, 'options'} ->
|
{get, 'options'} ->
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subid', ""),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, ""),
|
||||||
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', ""),
|
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"jid">>, ""),
|
||||||
get_options(Host, Node, JID, SubId, Lang);
|
get_options(Host, Node, JID, SubId, Lang);
|
||||||
{set, 'options'} ->
|
{set, 'options'} ->
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subid', ""),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, ""),
|
||||||
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', ""),
|
JID = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"jid">>, ""),
|
||||||
set_options(Host, Node, JID, SubId, Els);
|
set_options(Host, Node, JID, SubId, Els);
|
||||||
_ ->
|
_ ->
|
||||||
{error, 'feature-not-implemented'}
|
{error, 'feature-not-implemented'}
|
||||||
@ -1168,7 +1168,7 @@ iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
|||||||
Action = exmpp_xml:remove_cdata_from_list(SubEls),
|
Action = exmpp_xml:remove_cdata_from_list(SubEls),
|
||||||
case Action of
|
case Action of
|
||||||
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
||||||
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', "")),
|
Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"node">>, "")),
|
||||||
case {IQType, Name} of
|
case {IQType, Name} of
|
||||||
{get, 'configure'} ->
|
{get, 'configure'} ->
|
||||||
get_configure(Host, ServerHost, Node, From, Lang);
|
get_configure(Host, ServerHost, Node, From, Lang);
|
||||||
@ -1280,11 +1280,11 @@ send_pending_node_form(Host, Owner, _Lang, Plugins) ->
|
|||||||
children = [
|
children = [
|
||||||
exmpp_xml:cdata(node_to_string(Node))]}]}
|
exmpp_xml:cdata(node_to_string(Node))]}]}
|
||||||
end, get_pending_nodes(Host, Owner, Ps)),
|
end, get_pending_nodes(Host, Owner, Ps)),
|
||||||
XForm = #xmlel{ns = ?NS_DATA_FORMS, name ='x', attrs = [?XMLATTR('type', <<"form">>)],
|
XForm = #xmlel{ns = ?NS_DATA_FORMS, name ='x', attrs = [?XMLATTR(<<"type">>, <<"form">>)],
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field',
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field',
|
||||||
attrs = [?XMLATTR('type', <<"list-single">>),
|
attrs = [?XMLATTR(<<"type">>, <<"list-single">>),
|
||||||
?XMLATTR('var', <<"pubsub#node">>)],
|
?XMLATTR(<<"var">>, <<"pubsub#node">>)],
|
||||||
children = lists:usort(XOpts)}]},
|
children = lists:usort(XOpts)}]},
|
||||||
#adhoc_response{status = executing,
|
#adhoc_response{status = executing,
|
||||||
defaultaction = "execute",
|
defaultaction = "execute",
|
||||||
@ -1348,28 +1348,28 @@ send_authorization_request(#pubsub_node{id = {Host, Node}, type = Type, idx = Ni
|
|||||||
Lang = <<"en">>, %% TODO fix
|
Lang = <<"en">>, %% TODO fix
|
||||||
{U, S, R} = Subscriber,
|
{U, S, R} = Subscriber,
|
||||||
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
Stanza = #xmlel{ns = ?NS_JABBER_CLIENT, name = 'message', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "PubSub subscriber request"))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "PubSub subscriber request"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'instructions', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Choose whether to approve this entity's subscription."))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Choose whether to approve this entity's subscription."))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"FORM_TYPE">>), ?XMLATTR('type', <<"hidden">>)], children =
|
[?XMLATTR(<<"var">>, <<"FORM_TYPE">>), ?XMLATTR(<<"type">>, <<"hidden">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(?NS_PUBSUB_SUBSCRIBE_AUTH_s)}]}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(?NS_PUBSUB_SUBSCRIBE_AUTH_s)}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"pubsub#node">>), ?XMLATTR('type', <<"text-single">>),
|
[?XMLATTR(<<"var">>, <<"pubsub#node">>), ?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Node ID"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Node ID"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = Node}]}]},
|
[#xmlcdata{cdata = Node}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('var', <<"pubsub#subscriber_jid">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"var">>, <<"pubsub#subscriber_jid">>),
|
||||||
?XMLATTR('type', <<"jid-single">>),
|
?XMLATTR(<<"type">>, <<"jid-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Subscriber Address"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Subscriber Address"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = exmpp_jid:to_binary(U, S, R)}]}]},
|
[#xmlcdata{cdata = exmpp_jid:to_binary(U, S, R)}]}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"pubsub#allow">>),
|
[?XMLATTR(<<"var">>, <<"pubsub#allow">>),
|
||||||
?XMLATTR('type', <<"boolean">>),
|
?XMLATTR(<<"type">>, <<"boolean">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?"))], children =
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Allow this Jabber ID to subscribe to this pubsub node?"))], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"false">>}]}]}]}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = <<"false">>}]}]}]}]},
|
||||||
lists:foreach(fun(Owner) ->
|
lists:foreach(fun(Owner) ->
|
||||||
{U, S, R} = Owner,
|
{U, S, R} = Owner,
|
||||||
@ -1379,7 +1379,7 @@ send_authorization_request(#pubsub_node{id = {Host, Node}, type = Type, idx = Ni
|
|||||||
find_authorization_response(Packet) ->
|
find_authorization_response(Packet) ->
|
||||||
Els = Packet#xmlel.children,
|
Els = Packet#xmlel.children,
|
||||||
XData1 = lists:map(fun(#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = XAttrs} = XEl) ->
|
XData1 = lists:map(fun(#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = XAttrs} = XEl) ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(XAttrs, 'type', "") of
|
case exmpp_xml:get_attribute_from_list_as_list(XAttrs, <<"type">>, "") of
|
||||||
"cancel" ->
|
"cancel" ->
|
||||||
none;
|
none;
|
||||||
_ ->
|
_ ->
|
||||||
@ -1410,13 +1410,13 @@ find_authorization_response(Packet) ->
|
|||||||
%% @doc Send a message to JID with the supplied Subscription
|
%% @doc Send a message to JID with the supplied Subscription
|
||||||
send_authorization_approval(Host, JID, SNode, Subscription) ->
|
send_authorization_approval(Host, JID, SNode, Subscription) ->
|
||||||
SubAttrs = case Subscription of
|
SubAttrs = case Subscription of
|
||||||
{S, SID} -> [?XMLATTR('subscription', subscription_to_string(S)),
|
{S, SID} -> [?XMLATTR(<<"subscription">>, subscription_to_string(S)),
|
||||||
?XMLATTR('subid', SID)];
|
?XMLATTR(<<"subid">>, SID)];
|
||||||
S -> [?XMLATTR('subscription', subscription_to_string(S))]
|
S -> [?XMLATTR(<<"subscription">>, subscription_to_string(S))]
|
||||||
end,
|
end,
|
||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(JID)) | nodeAttr(SNode)] ++ SubAttrs
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(JID)) | nodeAttr(SNode)] ++ SubAttrs
|
||||||
}]),
|
}]),
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
ejabberd_router:route(service_jid(Host), JID, Stanza).
|
||||||
|
|
||||||
@ -1481,9 +1481,9 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-define(XFIELD(Type, Label, Var, Val),
|
-define(XFIELD(Type, Label, Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Val)}]}]}).
|
||||||
|
|
||||||
-define(BOOLXFIELD(Label, Var, Val),
|
-define(BOOLXFIELD(Label, Var, Val),
|
||||||
@ -1499,17 +1499,17 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
-define(STRINGMXFIELD(Label, Var, Vals),
|
-define(STRINGMXFIELD(Label, Var, Vals),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('type', <<"text-multi">>),
|
attrs = [?XMLATTR(<<"type">>, <<"text-multi">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)
|
?XMLATTR(<<"var">>, Var)
|
||||||
],
|
],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value',
|
children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'value',
|
||||||
children = [?XMLCDATA(V)]} || V <- Vals]}).
|
children = [?XMLCDATA(V)]} || V <- Vals]}).
|
||||||
|
|
||||||
-define(XFIELDOPT(Type, Label, Var, Val, Opts),
|
-define(XFIELDOPT(Type, Label, Var, Val, Opts),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', Type),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
lists:map(fun(Opt) ->
|
lists:map(fun(Opt) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
@ -1521,9 +1521,9 @@ update_auth(Host, Node, Type, Nidx, Subscriber,
|
|||||||
?XFIELDOPT("list-single", Label, Var, Val, Opts)).
|
?XFIELDOPT("list-single", Label, Var, Val, Opts)).
|
||||||
|
|
||||||
-define(LISTMXFIELD(Label, Var, Vals, Opts),
|
-define(LISTMXFIELD(Label, Var, Vals, Opts),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR('type', <<"list-multi">>),
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = [?XMLATTR(<<"type">>, <<"list-multi">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)], children =
|
?XMLATTR(<<"var">>, Var)], children =
|
||||||
lists:map(fun(Opt) ->
|
lists:map(fun(Opt) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'option', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
@ -1783,13 +1783,13 @@ subscribe_node(Host, Node, From, JID, Configuration) ->
|
|||||||
%% TODO, this is subscription-notification, should depends on node features
|
%% TODO, this is subscription-notification, should depends on node features
|
||||||
SubAttrs = case Subscription of
|
SubAttrs = case Subscription of
|
||||||
{subscribed, SubId} ->
|
{subscribed, SubId} ->
|
||||||
[?XMLATTR("subscription", subscription_to_string(subscribed)),
|
[?XMLATTR(<<"subscription">>, subscription_to_string(subscribed)),
|
||||||
?XMLATTR("subid", SubId)];
|
?XMLATTR(<<"subid">>, SubId)];
|
||||||
Other ->
|
Other ->
|
||||||
[?XMLATTR("subscription", subscription_to_string(Other))]
|
[?XMLATTR(<<"subscription">>, subscription_to_string(Other))]
|
||||||
end,
|
end,
|
||||||
Fields =
|
Fields =
|
||||||
[ ?XMLATTR('jid', JID) | SubAttrs],
|
[ ?XMLATTR(<<"jid">>, JID) | SubAttrs],
|
||||||
#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
#xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs = Fields}]}
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs = Fields}]}
|
||||||
end,
|
end,
|
||||||
@ -2271,8 +2271,8 @@ get_affiliations(Host, JID, Plugins) when is_list(Plugins) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({#pubsub_node{id = {_, Node}}, Affiliation}) ->
|
({#pubsub_node{id = {_, Node}}, Affiliation}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliation', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliation', attrs =
|
||||||
[?XMLATTR('node', node_to_string(Node)),
|
[?XMLATTR(<<"node">>, node_to_string(Node)),
|
||||||
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
|
?XMLATTR(<<"affiliation">>, affiliation_to_string(Affiliation))]}]
|
||||||
end, lists:usort(lists:flatten(Affiliations))),
|
end, lists:usort(lists:flatten(Affiliations))),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliations', children =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'affiliations', children =
|
||||||
@ -2302,8 +2302,8 @@ get_affiliations(Host, Node, JID) ->
|
|||||||
fun({_, none}) -> [];
|
fun({_, none}) -> [];
|
||||||
({{AU, AS, AR}, Affiliation}) ->
|
({{AU, AS, AR}, Affiliation}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliation', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('affiliation', affiliation_to_string(Affiliation))]}]
|
?XMLATTR(<<"affiliation">>, affiliation_to_string(Affiliation))]}]
|
||||||
end, Affiliations),
|
end, Affiliations),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliations', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'affiliations', attrs = nodeAttr(Node), children =
|
||||||
@ -2325,12 +2325,12 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
|
|||||||
#xmlel{name = 'affiliation', attrs = Attrs} ->
|
#xmlel{name = 'affiliation', attrs = Attrs} ->
|
||||||
JID = try
|
JID = try
|
||||||
exmpp_jid:parse(
|
exmpp_jid:parse(
|
||||||
exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
|
exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, ""))
|
||||||
catch
|
catch
|
||||||
_:_ -> error
|
_:_ -> error
|
||||||
end,
|
end,
|
||||||
Affiliation = string_to_affiliation(
|
Affiliation = string_to_affiliation(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'affiliation', "")),
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"affiliation">>, "")),
|
||||||
if
|
if
|
||||||
(JID == error) or
|
(JID == error) or
|
||||||
(Affiliation == false) ->
|
(Affiliation == false) ->
|
||||||
@ -2418,8 +2418,8 @@ read_sub(Subscriber, Node, NodeId, SubId, Lang) ->
|
|||||||
{result, #pubsub_subscription{options = Options}} ->
|
{result, #pubsub_subscription{options = Options}} ->
|
||||||
{result, XdataEl} = pubsub_subscription_odbc:get_options_xform(Lang, Options),
|
{result, XdataEl} = pubsub_subscription_odbc:get_options_xform(Lang, Options),
|
||||||
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
||||||
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
attrs = [ ?XMLATTR(<<"jid">>, exmpp_jid:to_binary(Subscriber)),
|
||||||
?XMLATTR('subid', SubId) | nodeAttr(Node)],
|
?XMLATTR(<<"subid">>, SubId) | nodeAttr(Node)],
|
||||||
children = [XdataEl]},
|
children = [XdataEl]},
|
||||||
PubsubEl = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = [OptionsEl]},
|
PubsubEl = #xmlel{ns = ?NS_PUBSUB, name = 'pubsub', children = [OptionsEl]},
|
||||||
{result, PubsubEl}
|
{result, PubsubEl}
|
||||||
@ -2512,11 +2512,11 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', node_to_string(SubsNode)),
|
[?XMLATTR(<<"node">>, node_to_string(SubsNode)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
[?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end;
|
end;
|
||||||
@ -2526,14 +2526,14 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name='subscription',
|
[#xmlel{ns = ?NS_PUBSUB, name='subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subid', SubId),
|
?XMLATTR(<<"subid">>, SubId),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription)) | nodeAttr(SubsNode)]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription)) | nodeAttr(SubsNode)]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription',
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subid', SubId),
|
?XMLATTR(<<"subid">>, SubId),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end;
|
end;
|
||||||
@ -2541,13 +2541,13 @@ get_subscriptions(Host, Node, JID, Plugins) when is_list(Plugins) ->
|
|||||||
case Node of
|
case Node of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('node', node_to_string(SubsNode)),
|
[?XMLATTR(<<"node">>, node_to_string(SubsNode)),
|
||||||
?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
SubsNode ->
|
SubsNode ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(SubJID)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(SubJID)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
@ -2584,13 +2584,13 @@ get_subscriptions(Host, Node, JID) ->
|
|||||||
({_, pending, _}) -> [];
|
({_, pending, _}) -> [];
|
||||||
({{AU, AS, AR}, Subscription}) ->
|
({{AU, AS, AR}, Subscription}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription))]}];
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription))]}];
|
||||||
({{AU, AS, AR}, Subscription, SubId}) ->
|
({{AU, AS, AR}, Subscription, SubId}) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscription', attrs =
|
||||||
[?XMLATTR('jid', exmpp_jid:to_binary(AU, AS, AR)),
|
[?XMLATTR(<<"jid">>, exmpp_jid:to_binary(AU, AS, AR)),
|
||||||
?XMLATTR('subscription', subscription_to_string(Subscription)),
|
?XMLATTR(<<"subscription">>, subscription_to_string(Subscription)),
|
||||||
?XMLATTR('subid', SubId)]}]
|
?XMLATTR(<<"subid">>, SubId)]}]
|
||||||
end, Subscriptions),
|
end, Subscriptions),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscriptions', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'subscriptions', attrs = nodeAttr(Node), children =
|
||||||
@ -2612,14 +2612,14 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
#xmlel{name = 'subscription', attrs = Attrs} ->
|
#xmlel{name = 'subscription', attrs = Attrs} ->
|
||||||
JID = try
|
JID = try
|
||||||
exmpp_jid:parse(
|
exmpp_jid:parse(
|
||||||
exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
|
exmpp_xml:get_attribute_from_list(Attrs, <<"jid">>, ""))
|
||||||
catch
|
catch
|
||||||
_:_ ->
|
_:_ ->
|
||||||
error
|
error
|
||||||
end,
|
end,
|
||||||
Subscription = string_to_subscription(
|
Subscription = string_to_subscription(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'subscription', false)),
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subscription">>, false)),
|
||||||
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, "subid", false),
|
SubId = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"subid">>, false),
|
||||||
if
|
if
|
||||||
(JID == error) or
|
(JID == error) or
|
||||||
(Subscription == false) ->
|
(Subscription == false) ->
|
||||||
@ -2643,8 +2643,8 @@ set_subscriptions(Host, Node, From, EntitiesEls) ->
|
|||||||
children =
|
children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB,
|
[#xmlel{ns = ?NS_PUBSUB,
|
||||||
name = 'subscription',
|
name = 'subscription',
|
||||||
attrs = [?XMLATTR('jid', exmpp_jid:to_binary(JID)),
|
attrs = [?XMLATTR(<<"jid">>, exmpp_jid:to_binary(JID)),
|
||||||
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
?XMLATTR(<<"subsription">>, subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
||||||
end,
|
end,
|
||||||
Action = fun(#pubsub_node{type = Type, idx = Nidx}) ->
|
Action = fun(#pubsub_node{type = Type, idx = Nidx}) ->
|
||||||
@ -2973,14 +2973,14 @@ broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) ->
|
|||||||
SubsByDepth when is_list(SubsByDepth) ->
|
SubsByDepth when is_list(SubsByDepth) ->
|
||||||
Content = case get_option(NodeOptions, deliver_payloads) of
|
Content = case get_option(NodeOptions, deliver_payloads) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, NodeOptions, Lang, [])}];
|
get_configure_xfields(Type, NodeOptions, Lang, [])}];
|
||||||
false ->
|
false ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
Stanza = event_stanza(
|
Stanza = event_stanza(
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'items', attrs = nodeAttr(Node), children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR('id', <<"configuration">>)], children =
|
[#xmlel{ns = ?NS_PUBSUB_EVENT, name = 'item', attrs = [?XMLATTR(<<"id">>, <<"configuration">>)], children =
|
||||||
Content}]}]),
|
Content}]}]),
|
||||||
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
|
broadcast_stanza(Host, Node, NodeId, Type, NodeOptions, SubsByDepth, nodes, Stanza, false),
|
||||||
{result, true};
|
{result, true};
|
||||||
@ -3191,7 +3191,7 @@ get_configure(Host, ServerHost, Node, From, Lang) ->
|
|||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'configure', attrs =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'configure', attrs =
|
||||||
nodeAttr(Node), children =
|
nodeAttr(Node), children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, Options, Lang, Groups)
|
get_configure_xfields(Type, Options, Lang, Groups)
|
||||||
}]}]}};
|
}]}]}};
|
||||||
_ ->
|
_ ->
|
||||||
@ -3208,7 +3208,7 @@ get_default(Host, Node, _From, Lang) ->
|
|||||||
Options = node_options(Type),
|
Options = node_options(Type),
|
||||||
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
{result, #xmlel{ns = ?NS_PUBSUB_OWNER, name = 'pubsub', children =
|
||||||
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'default', children =
|
[#xmlel{ns = ?NS_PUBSUB_OWNER, name = 'default', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
get_configure_xfields(Type, Options, Lang, [])
|
get_configure_xfields(Type, Options, Lang, [])
|
||||||
}]}]}}.
|
}]}]}}.
|
||||||
|
|
||||||
@ -3359,7 +3359,7 @@ get_configure_xfields(_Type, Options, Lang, Groups) ->
|
|||||||
set_configure(Host, Node, From, Els, Lang) ->
|
set_configure(Host, Node, From, Els, Lang) ->
|
||||||
case exmpp_xml:remove_cdata_from_list(Els) of
|
case exmpp_xml:remove_cdata_from_list(Els) of
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x'} = XEl] ->
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x'} = XEl] ->
|
||||||
case exmpp_xml:get_attribute_as_list(XEl, 'type', undefined) of
|
case exmpp_xml:get_attribute_as_list(XEl, <<"type">>, undefined) of
|
||||||
"cancel" ->
|
"cancel" ->
|
||||||
{result, []};
|
{result, []};
|
||||||
"submit" ->
|
"submit" ->
|
||||||
@ -3761,7 +3761,7 @@ extended_error(Error, Ext) ->
|
|||||||
extended_error(Error, Ext, []).
|
extended_error(Error, Ext, []).
|
||||||
extended_error(Error, unsupported, Feature) ->
|
extended_error(Error, unsupported, Feature) ->
|
||||||
extended_error(Error, unsupported,
|
extended_error(Error, unsupported,
|
||||||
[?XMLATTR('feature', Feature)]);
|
[?XMLATTR(<<"feature">>, Feature)]);
|
||||||
extended_error(Error, Ext, ExtAttrs) ->
|
extended_error(Error, Ext, ExtAttrs) ->
|
||||||
Pubsub_Err = #xmlel{ns = ?NS_PUBSUB_ERRORS, name = Ext, attrs = ExtAttrs},
|
Pubsub_Err = #xmlel{ns = ?NS_PUBSUB_ERRORS, name = Ext, attrs = ExtAttrs},
|
||||||
exmpp_xml:append_child(exmpp_stanza:error(?NS_JABBER_CLIENT, Error),
|
exmpp_xml:append_child(exmpp_stanza:error(?NS_JABBER_CLIENT, Error),
|
||||||
@ -3774,13 +3774,13 @@ uniqid() ->
|
|||||||
|
|
||||||
% node attributes
|
% node attributes
|
||||||
nodeAttr(Node) when is_list(Node) ->
|
nodeAttr(Node) when is_list(Node) ->
|
||||||
[?XMLATTR('node', Node)];
|
[?XMLATTR(<<"node">>, Node)];
|
||||||
nodeAttr(Node) ->
|
nodeAttr(Node) ->
|
||||||
[?XMLATTR('node', node_to_string(Node))].
|
[?XMLATTR(<<"node">>, node_to_string(Node))].
|
||||||
|
|
||||||
% item attributes
|
% item attributes
|
||||||
itemAttr([]) -> [];
|
itemAttr([]) -> [];
|
||||||
itemAttr(ItemId) -> [?XMLATTR('id', ItemId)].
|
itemAttr(ItemId) -> [?XMLATTR(<<"id">>, ItemId)].
|
||||||
|
|
||||||
% build item elements from item list
|
% build item elements from item list
|
||||||
itemsEls(Items) ->
|
itemsEls(Items) ->
|
||||||
@ -3821,19 +3821,19 @@ add_headers(#xmlel{children = Els} = Stanza, HeaderName, HeaderNS, HeaderEls) ->
|
|||||||
%% identifier of the collection".
|
%% identifier of the collection".
|
||||||
collection_shim(Node) ->
|
collection_shim(Node) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
||||||
attrs = [?XMLATTR('name', <<"Collection">>)],
|
attrs = [?XMLATTR(<<"name">>, <<"Collection">>)],
|
||||||
children = [?XMLCDATA(node_to_string(Node))]}].
|
children = [?XMLCDATA(node_to_string(Node))]}].
|
||||||
|
|
||||||
subid_shim(SubIds) ->
|
subid_shim(SubIds) ->
|
||||||
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
[#xmlel{ns = ?NS_PUBSUB, name ='header',
|
||||||
attrs = [?XMLATTR('name', <<"SubId">>)],
|
attrs = [?XMLATTR(<<"name">>, <<"SubId">>)],
|
||||||
children = [?XMLCDATA(SubId)]}
|
children = [?XMLCDATA(SubId)]}
|
||||||
|| SubId <- SubIds].
|
|| SubId <- SubIds].
|
||||||
|
|
||||||
|
|
||||||
extended_headers(JIDs) ->
|
extended_headers(JIDs) ->
|
||||||
[#xmlel{ns = ?NS_ADDRESS, name = 'address',
|
[#xmlel{ns = ?NS_ADDRESS, name = 'address',
|
||||||
attrs = [?XMLATTR('type', <<"replyto">>), ?XMLATTR('jid', JID)]}
|
attrs = [?XMLATTR(<<"type">>, <<"replyto">>), ?XMLATTR(<<"jid">>, JID)]}
|
||||||
|| JID <- JIDs].
|
|| JID <- JIDs].
|
||||||
|
|
||||||
feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
||||||
@ -3846,7 +3846,7 @@ feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
|||||||
case exmpp_xml:get_element(El, 'event') of
|
case exmpp_xml:get_element(El, 'event') of
|
||||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
Feature = exmpp_xml:get_attribute_as_list(Items, <<"node">>, ""),
|
||||||
case is_feature_supported(Pres, Feature) of
|
case is_feature_supported(Pres, Feature) of
|
||||||
true -> allow;
|
true -> allow;
|
||||||
false -> deny
|
false -> deny
|
||||||
@ -3937,9 +3937,9 @@ notify_owners(true, JID, Host, Node, Owners, State) ->
|
|||||||
Message = #xmlel{name = 'message', ns = ?NS_JABBER_CLIENT,
|
Message = #xmlel{name = 'message', ns = ?NS_JABBER_CLIENT,
|
||||||
children = [#xmlel{name = 'pubsub', ns = ?NS_PUBSUB,
|
children = [#xmlel{name = 'pubsub', ns = ?NS_PUBSUB,
|
||||||
children = [#xmlel{name = 'subscription', ns = ?NS_PUBSUB,
|
children = [#xmlel{name = 'subscription', ns = ?NS_PUBSUB,
|
||||||
attrs = [?XMLATTR('node', Node),
|
attrs = [?XMLATTR(<<"node">>, Node),
|
||||||
?XMLATTR('jid', exmpp_jid:prep_to_binary(exmpp_jid:make(JID))),
|
?XMLATTR(<<"jid">>, exmpp_jid:prep_to_binary(exmpp_jid:make(JID))),
|
||||||
?XMLATTR('subscription', State)]}]}]},
|
?XMLATTR(<<"subscription">>, State)]}]}]},
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Owner) ->
|
fun(Owner) ->
|
||||||
ejabberd_router:route(exmpp_jid:make(Host), exmpp_jid:make(Owner), Message)
|
ejabberd_router:route(exmpp_jid:make(Host), exmpp_jid:make(Owner), Message)
|
||||||
|
@ -276,7 +276,7 @@
|
|||||||
if (SubJID == LJID) or (SubJID == BJID) ->
|
if (SubJID == LJID) or (SubJID == BJID) ->
|
||||||
@@ -616,7 +422,8 @@
|
@@ -616,7 +422,8 @@
|
||||||
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
[#xmlel{name = 'identity', ns = ?NS_DISCO_INFO,
|
||||||
attrs = [?XMLATTR('category', <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
attrs = [?XMLATTR(<<"category">>, <<"pubsub">>), ?XMLATTR('type', <<"pep">>)]}];
|
||||||
disco_identity(Host, Node, From) ->
|
disco_identity(Host, Node, From) ->
|
||||||
- Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options, owners = Owners}) ->
|
- Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options, owners = Owners}) ->
|
||||||
+ Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options}) ->
|
+ Action = fun(#pubsub_node{idx = Nidx, type = Type, options = Options}) ->
|
||||||
@ -360,24 +360,24 @@
|
|||||||
@@ -1106,8 +917,9 @@
|
@@ -1106,8 +917,9 @@
|
||||||
[];
|
[];
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]} |
|
[#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s)]} |
|
||||||
- lists:map(fun(T) ->
|
- lists:map(fun(T) ->
|
||||||
- #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++T)]}
|
- #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++T)]}
|
||||||
+ lists:map(fun
|
+ lists:map(fun
|
||||||
+ ("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_RSM_s)]};
|
+ ("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_RSM_s)]};
|
||||||
+ (T) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++T)]}
|
+ (T) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++T)]}
|
||||||
end, features(Type))]
|
end, features(Type))]
|
||||||
end,
|
end,
|
||||||
%% TODO: add meta-data info (spec section 5.4)
|
%% TODO: add meta-data info (spec section 5.4)
|
||||||
@@ -1136,8 +948,9 @@
|
@@ -1136,8 +948,9 @@
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_ADHOC_s)]},
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_ADHOC_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_VCARD_s)]}] ++
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_VCARD_s)]}] ++
|
||||||
- lists:map(fun(Feature) ->
|
- lists:map(fun(Feature) ->
|
||||||
- #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]}
|
- #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++Feature)]}
|
||||||
+ lists:map(fun
|
+ lists:map(fun
|
||||||
+ ("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_RSM_s)]};
|
+ ("rsm") -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_RSM_s)]};
|
||||||
+ (Feature) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR('var', ?NS_PUBSUB_s++"#"++Feature)]}
|
+ (Feature) -> #xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [?XMLATTR(<<"var">>, ?NS_PUBSUB_s++"#"++Feature)]}
|
||||||
end, features(Host, Node))};
|
end, features(Host, Node))};
|
||||||
?NS_ADHOC_b ->
|
?NS_ADHOC_b ->
|
||||||
command_disco_info(Host, Node, From);
|
command_disco_info(Host, Node, From);
|
||||||
@ -400,7 +400,7 @@
|
|||||||
CommandItems = [
|
CommandItems = [
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item',
|
||||||
@@ -1173,19 +986,20 @@
|
@@ -1173,19 +986,20 @@
|
||||||
?XMLATTR('name', "Get Pending")
|
?XMLATTR(<<"name">>, "Get Pending")
|
||||||
]}],
|
]}],
|
||||||
{result, CommandItems};
|
{result, CommandItems};
|
||||||
-iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From) ->
|
-iq_disco_items(_Host, ?NS_PUBSUB_GET_PENDING, _From) ->
|
||||||
@ -427,7 +427,7 @@
|
|||||||
fun(#pubsub_node{id = {_, SubNode}, options = SubOptions}) ->
|
fun(#pubsub_node{id = {_, SubNode}, options = SubOptions}) ->
|
||||||
@@ -1203,7 +1017,7 @@
|
@@ -1203,7 +1017,7 @@
|
||||||
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
{result, Name} = node_call(Type, get_item_name, [Host, Node, RN]),
|
||||||
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR('jid', Host), ?XMLATTR('name', Name)]}
|
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [?XMLATTR(<<"jid">>, Host), ?XMLATTR('name', Name)]}
|
||||||
end, NodeItems),
|
end, NodeItems),
|
||||||
- {result, Nodes ++ Items}
|
- {result, Nodes ++ Items}
|
||||||
+ {result, Nodes ++ Items ++ jlib:rsm_encode(RsmOut)}
|
+ {result, Nodes ++ Items ++ jlib:rsm_encode(RsmOut)}
|
||||||
@ -680,8 +680,8 @@
|
|||||||
- {result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options),
|
- {result, XdataEl} = pubsub_subscription:get_options_xform(Lang, Options),
|
||||||
+ {result, XdataEl} = pubsub_subscription_odbc:get_options_xform(Lang, Options),
|
+ {result, XdataEl} = pubsub_subscription_odbc:get_options_xform(Lang, Options),
|
||||||
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
OptionsEl = #xmlel{ns = ?NS_PUBSUB, name = 'options',
|
||||||
attrs = [ ?XMLATTR('jid', exmpp_jid:to_binary(Subscriber)),
|
attrs = [ ?XMLATTR(<<"jid">>, exmpp_jid:to_binary(Subscriber)),
|
||||||
?XMLATTR('subid', SubId) | nodeAttr(Node)],
|
?XMLATTR(<<"subid">>, SubId) | nodeAttr(Node)],
|
||||||
@@ -2623,7 +2443,7 @@
|
@@ -2623,7 +2443,7 @@
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -701,7 +701,7 @@
|
|||||||
{error, extended_error('not-acceptable', "invalid-subid")};
|
{error, extended_error('not-acceptable', "invalid-subid")};
|
||||||
{result, _} ->
|
{result, _} ->
|
||||||
@@ -2827,8 +2647,8 @@
|
@@ -2827,8 +2647,8 @@
|
||||||
?XMLATTR('subsription', subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
?XMLATTR(<<"subsription">>, subscription_to_string(Sub)) | nodeAttr(Node)]}]}]},
|
||||||
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
ejabberd_router:route(service_jid(Host), JID, Stanza)
|
||||||
end,
|
end,
|
||||||
- Action = fun(#pubsub_node{owners = Owners, type = Type, idx = Nidx}) ->
|
- Action = fun(#pubsub_node{owners = Owners, type = Type, idx = Nidx}) ->
|
||||||
|
@ -170,10 +170,10 @@ get_options_xform(Lang, Options) ->
|
|||||||
Keys = [deliver, digest, digest_frequency, expire, include_body, show_values, subscription_type, subscription_depth],
|
Keys = [deliver, digest, digest_frequency, expire, include_body, show_values, subscription_type, subscription_depth],
|
||||||
XFields = [get_option_xfield(Lang, Key, Options) || Key <- Keys],
|
XFields = [get_option_xfield(Lang, Key, Options) || Key <- Keys],
|
||||||
|
|
||||||
{result, #xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR('type', <<"form">>)], children =
|
{result, #xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = [?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('var', <<"FORM_TYPE">>), ?XMLATTR('type', <<"hidden">>)],
|
attrs = [?XMLATTR(<<"var">>, <<"FORM_TYPE">>), ?XMLATTR(<<"type">>, <<"hidden">>)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'value',
|
name = 'value',
|
||||||
children = [?XMLCDATA(?NS_PUBSUB_SUBSCRIBE_OPTIONS_s)]}]}] ++ XFields}}.
|
children = [?XMLCDATA(?NS_PUBSUB_SUBSCRIBE_OPTIONS_s)]}]}] ++ XFields}}.
|
||||||
@ -349,7 +349,7 @@ get_option_xfield(Lang, Key, Options) ->
|
|||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('var', Var), ?XMLATTR('type', Type), ?XMLATTR('label', translate:translate(Lang, Label))],
|
attrs = [?XMLATTR(<<"var">>, Var), ?XMLATTR(<<"type">>, Type), ?XMLATTR(<<"label">>, translate:translate(Lang, Label))],
|
||||||
children = OptEls ++ Vals}.
|
children = OptEls ++ Vals}.
|
||||||
|
|
||||||
%% TODO : check input type data
|
%% TODO : check input type data
|
||||||
@ -362,7 +362,7 @@ type_and_options(Type, _Lang) ->
|
|||||||
tr_xfield_options({Value, Label}, Lang) ->
|
tr_xfield_options({Value, Label}, Lang) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'option',
|
name = 'option',
|
||||||
attrs = [?XMLATTR('label', translate:translate(Lang, Label))],
|
attrs = [?XMLATTR(<<"label">>, translate:translate(Lang, Label))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'value',
|
name = 'value',
|
||||||
children = [?XMLCDATA(Value)]}]}.
|
children = [?XMLCDATA(Value)]}]}.
|
||||||
|
@ -125,7 +125,7 @@ get_options_xform(Lang, Options) ->
|
|||||||
{result, #xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
{result, #xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('var', <<"FORM_TYPE">>), ?XMLATTR('type', <<"hidden">>)],
|
attrs = [?XMLATTR(<<"var">>, <<"FORM_TYPE">>), ?XMLATTR(<<"type">>, <<"hidden">>)],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'value',
|
name = 'value',
|
||||||
children = [?XMLCDATA(?NS_PUBSUB_SUBSCRIBE_OPTIONS_s)]}]}] ++ XFields}}.
|
children = [?XMLCDATA(?NS_PUBSUB_SUBSCRIBE_OPTIONS_s)]}]}] ++ XFields}}.
|
||||||
@ -226,7 +226,7 @@ get_option_xfield(Lang, Key, Options) ->
|
|||||||
end,
|
end,
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'field',
|
name = 'field',
|
||||||
attrs = [?XMLATTR('var', Var), ?XMLATTR('type', Type), ?XMLATTR('label', translate:translate(Lang, Label))],
|
attrs = [?XMLATTR(<<"var">>, Var), ?XMLATTR(<<"type">>, Type), ?XMLATTR('label', translate:translate(Lang, Label))],
|
||||||
children = OptEls ++ Vals}.
|
children = OptEls ++ Vals}.
|
||||||
|
|
||||||
type_and_options({Type, Options}, Lang) ->
|
type_and_options({Type, Options}, Lang) ->
|
||||||
@ -237,7 +237,7 @@ type_and_options(Type, _Lang) ->
|
|||||||
tr_xfield_options({Value, Label}, Lang) ->
|
tr_xfield_options({Value, Label}, Lang) ->
|
||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'option',
|
name = 'option',
|
||||||
attrs = [?XMLATTR('label', translate:translate(Lang, Label))],
|
attrs = [?XMLATTR(<<"label">>, translate:translate(Lang, Label))],
|
||||||
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
children = [#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'value',
|
name = 'value',
|
||||||
children = [?XMLCDATA(Value)]}]}.
|
children = [?XMLCDATA(Value)]}]}.
|
||||||
|
@ -221,16 +221,16 @@ process_iq(From, To,
|
|||||||
"Choose a username and password "
|
"Choose a username and password "
|
||||||
"to register with this server"))}]},
|
"to register with this server"))}]},
|
||||||
UField = #xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
UField = #xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"username">>),
|
[?XMLATTR(<<"var">>, <<"username">>),
|
||||||
?XMLATTR('type', <<"text-single">>),
|
?XMLATTR(<<"type">>, <<"text-single">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "User"))],
|
?XMLATTR(<<"label">>, translate:translate(Lang, "User"))],
|
||||||
children =
|
children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}]},
|
||||||
PField =
|
PField =
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', <<"password">>),
|
[?XMLATTR(<<"var">>, <<"password">>),
|
||||||
?XMLATTR('type', <<"text-private">>),
|
?XMLATTR(<<"type">>, <<"text-private">>),
|
||||||
?XMLATTR('label', translate:translate(Lang, "Password"))],
|
?XMLATTR(<<"label">>, translate:translate(Lang, "Password"))],
|
||||||
children = [
|
children = [
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'required'}
|
||||||
]
|
]
|
||||||
|
@ -291,7 +291,7 @@ process_iq_get(From, To, IQ_Rec) ->
|
|||||||
US = {_, LServer} = {exmpp_jid:prep_node(From), exmpp_jid:prep_domain(From)},
|
US = {_, LServer} = {exmpp_jid:prep_node(From), exmpp_jid:prep_domain(From)},
|
||||||
try
|
try
|
||||||
{ItemsToSend, VersionToSend} =
|
{ItemsToSend, VersionToSend} =
|
||||||
case {exmpp_xml:get_attribute_as_list(exmpp_iq:get_request(IQ_Rec), ver, not_found),
|
case {exmpp_xml:get_attribute_as_list(exmpp_iq:get_request(IQ_Rec), <<"ver">>, not_found),
|
||||||
roster_versioning_enabled(LServer),
|
roster_versioning_enabled(LServer),
|
||||||
roster_version_on_db(LServer)} of
|
roster_version_on_db(LServer)} of
|
||||||
{not_found, _ , _} ->
|
{not_found, _ , _} ->
|
||||||
@ -332,7 +332,7 @@ process_iq_get(From, To, IQ_Rec) ->
|
|||||||
{Items, false} ->
|
{Items, false} ->
|
||||||
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [] , Items));
|
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [] , Items));
|
||||||
{Items, Version} ->
|
{Items, Version} ->
|
||||||
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [?XMLATTR('ver', Version)], Items))
|
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [?XMLATTR(<<"ver">>, Version)], Items))
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
_:_ ->
|
_:_ ->
|
||||||
@ -408,22 +408,22 @@ convert_to_string(A) when is_list(A) -> A.
|
|||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R} = Item#roster.jid,
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
||||||
'jid', exmpp_jid:to_binary(U, S, R)),
|
<<"jid">>, exmpp_jid:to_binary(U, S, R)),
|
||||||
Attrs2 = case Item#roster.name of
|
Attrs2 = case Item#roster.name of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
Name ->
|
Name ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs1, 'name', Name)
|
exmpp_xml:set_attribute_in_list(Attrs1, <<"name">>, Name)
|
||||||
end,
|
end,
|
||||||
Attrs3 = exmpp_xml:set_attribute_in_list(Attrs2,
|
Attrs3 = exmpp_xml:set_attribute_in_list(Attrs2,
|
||||||
'subscription', Item#roster.subscription),
|
<<"subscription">>, Item#roster.subscription),
|
||||||
Attrs4 = case ask_to_pending(Item#roster.ask) of
|
Attrs4 = case ask_to_pending(Item#roster.ask) of
|
||||||
out ->
|
out ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs3,
|
exmpp_xml:set_attribute_in_list(Attrs3,
|
||||||
'ask', <<"subscribe">>);
|
<<"ask">>, <<"subscribe">>);
|
||||||
both ->
|
both ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs3,
|
exmpp_xml:set_attribute_in_list(Attrs3,
|
||||||
'ask', <<"subscribe">>);
|
<<"ask">>, <<"subscribe">>);
|
||||||
_ ->
|
_ ->
|
||||||
Attrs3
|
Attrs3
|
||||||
end,
|
end,
|
||||||
@ -466,7 +466,7 @@ try_process_iq_set(From, To, IQ) ->
|
|||||||
|
|
||||||
process_item_set(From, To, #xmlel{} = El) ->
|
process_item_set(From, To, #xmlel{} = El) ->
|
||||||
try
|
try
|
||||||
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
|
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, <<"jid">>, <<>>)),
|
||||||
User = exmpp_jid:node(From),
|
User = exmpp_jid:node(From),
|
||||||
LUser = exmpp_jid:prep_node(From),
|
LUser = exmpp_jid:prep_node(From),
|
||||||
LServer = exmpp_jid:prep_domain(From),
|
LServer = exmpp_jid:prep_domain(From),
|
||||||
@ -577,9 +577,9 @@ process_item_set(_From, _To, _) ->
|
|||||||
|
|
||||||
process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
||||||
case Attr of
|
case Attr of
|
||||||
'name' ->
|
<<"name">> ->
|
||||||
process_item_attrs(Item#roster{name = Val}, Attrs);
|
process_item_attrs(Item#roster{name = Val}, Attrs);
|
||||||
'subscription' ->
|
<<"subscription">> ->
|
||||||
case Val of
|
case Val of
|
||||||
<<"remove">> ->
|
<<"remove">> ->
|
||||||
process_item_attrs(Item#roster{subscription = remove},
|
process_item_attrs(Item#roster{subscription = remove},
|
||||||
@ -587,7 +587,7 @@ process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
|||||||
_ ->
|
_ ->
|
||||||
process_item_attrs(Item, Attrs)
|
process_item_attrs(Item, Attrs)
|
||||||
end;
|
end;
|
||||||
'ask' ->
|
<<"ask">> ->
|
||||||
process_item_attrs(Item, Attrs);
|
process_item_attrs(Item, Attrs);
|
||||||
_ ->
|
_ ->
|
||||||
process_item_attrs(Item, Attrs)
|
process_item_attrs(Item, Attrs)
|
||||||
@ -631,10 +631,10 @@ push_item(User, Server, From, Item)
|
|||||||
ejabberd_sm:route(exmpp_jid:make(),
|
ejabberd_sm:route(exmpp_jid:make(),
|
||||||
exmpp_jid:make(User, Server),
|
exmpp_jid:make(User, Server),
|
||||||
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
||||||
[exmpp_xml:attribute(u, U),
|
[?XMLATTR(<<"u">>, U),
|
||||||
exmpp_xml:attribute(s, S),
|
?XMLATTR(<<"s">>, S),
|
||||||
exmpp_xml:attribute(r, R),
|
?XMLATTR(<<"r">>, R),
|
||||||
exmpp_xml:attribute(subs, Item#roster.subscription)]}),
|
?XMLATTR(<<"subs">>, Item#roster.subscription)]}),
|
||||||
|
|
||||||
case roster_versioning_enabled(Server) of
|
case roster_versioning_enabled(Server) of
|
||||||
true ->
|
true ->
|
||||||
@ -673,7 +673,7 @@ push_item_version(Server, User, From, Item, RosterVersion) ->
|
|||||||
end, ejabberd_sm:get_user_resources(User, Server)).
|
end, ejabberd_sm:get_user_resources(User, Server)).
|
||||||
|
|
||||||
push_item_version(User, Server, Resource, From, Item, RosterVersion) ->
|
push_item_version(User, Server, Resource, From, Item, RosterVersion) ->
|
||||||
Request = #xmlel{ns = ?NS_ROSTER, name = 'query', attrs = [?XMLATTR('ver', RosterVersion)],
|
Request = #xmlel{ns = ?NS_ROSTER, name = 'query', attrs = [?XMLATTR(<<"ver">>, RosterVersion)],
|
||||||
children = [mod_roster:item_to_xml(Item)]},
|
children = [mod_roster:item_to_xml(Item)]},
|
||||||
ResIQ = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
ResIQ = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
||||||
"push" ++ randoms:get_string()),
|
"push" ++ randoms:get_string()),
|
||||||
@ -1053,7 +1053,7 @@ set_items(User, Server, #xmlel{children = Els})
|
|||||||
|
|
||||||
process_item_set_t(LUser, LServer, #xmlel{} = El) ->
|
process_item_set_t(LUser, LServer, #xmlel{} = El) ->
|
||||||
try
|
try
|
||||||
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_list(El, 'jid', <<>>)),
|
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_list(El, <<"jid">>, <<>>)),
|
||||||
JID = jlib:short_jid(JID1),
|
JID = jlib:short_jid(JID1),
|
||||||
LJID = jlib:short_prepd_jid(JID1),
|
LJID = jlib:short_prepd_jid(JID1),
|
||||||
Item = #roster{usj = {LUser, LServer, LJID},
|
Item = #roster{usj = {LUser, LServer, LJID},
|
||||||
@ -1097,9 +1097,9 @@ process_item_set_t(_LUser, _LServer, _) ->
|
|||||||
|
|
||||||
process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
||||||
case Attr of
|
case Attr of
|
||||||
'name' ->
|
<<"name">> ->
|
||||||
process_item_attrs_ws(Item#roster{name = Val}, Attrs);
|
process_item_attrs_ws(Item#roster{name = Val}, Attrs);
|
||||||
'subscription' ->
|
<<"subscription">> ->
|
||||||
case Val of
|
case Val of
|
||||||
<<"remove">> ->
|
<<"remove">> ->
|
||||||
process_item_attrs_ws(Item#roster{subscription = remove},
|
process_item_attrs_ws(Item#roster{subscription = remove},
|
||||||
@ -1119,7 +1119,7 @@ process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
|||||||
_ ->
|
_ ->
|
||||||
process_item_attrs_ws(Item, Attrs)
|
process_item_attrs_ws(Item, Attrs)
|
||||||
end;
|
end;
|
||||||
'ask' ->
|
<<"ask">> ->
|
||||||
process_item_attrs_ws(Item, Attrs);
|
process_item_attrs_ws(Item, Attrs);
|
||||||
_ ->
|
_ ->
|
||||||
process_item_attrs_ws(Item, Attrs)
|
process_item_attrs_ws(Item, Attrs)
|
||||||
@ -1363,16 +1363,16 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
TDJID = build_contact_jid_td(R#roster.jid),
|
TDJID = build_contact_jid_td(R#roster.jid),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[TDJID,
|
[TDJID,
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
R#roster.name),
|
R#roster.name),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
atom_to_list(R#roster.subscription)),
|
atom_to_list(R#roster.subscription)),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
atom_to_list(Pending)),
|
atom_to_list(Pending)),
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], Groups),
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], Groups),
|
||||||
if
|
if
|
||||||
Pending == in ->
|
Pending == in ->
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
[?INPUTT("submit",
|
[?INPUTT("submit",
|
||||||
"validate" ++
|
"validate" ++
|
||||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||||
@ -1380,7 +1380,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
true ->
|
true ->
|
||||||
?X("td")
|
?X("td")
|
||||||
end,
|
end,
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
[?INPUTT("submit",
|
[?INPUTT("submit",
|
||||||
"remove" ++
|
"remove" ++
|
||||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||||
@ -1393,7 +1393,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
FItems ++
|
FItems ++
|
||||||
[?P,
|
[?P,
|
||||||
?INPUT("text", "newjid", ""), ?C(" "),
|
?INPUT("text", "newjid", ""), ?C(" "),
|
||||||
@ -1403,7 +1403,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
_ ->
|
_ ->
|
||||||
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
||||||
[?CT("Bad format"), ?P] ++
|
[?CT("Bad format"), ?P] ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?P,
|
[?P,
|
||||||
?INPUT("text", "newjid", ""), ?C(" "),
|
?INPUT("text", "newjid", ""), ?C(" "),
|
||||||
?INPUTT("submit", "addjid", "Add Jabber ID")
|
?INPUTT("submit", "addjid", "Add Jabber ID")
|
||||||
@ -1429,9 +1429,9 @@ build_contact_jid_td({U, S, R}) ->
|
|||||||
end,
|
end,
|
||||||
case JIDURI of
|
case JIDURI of
|
||||||
[] ->
|
[] ->
|
||||||
?XAC('td', [?XMLATTR('class', <<"valign">>)], exmpp_jid:to_list(ContactJID));
|
?XAC('td', [?XMLATTR(<<"class">>, <<"valign">>)], exmpp_jid:to_list(ContactJID));
|
||||||
URI when is_list(URI) ->
|
URI when is_list(URI) ->
|
||||||
?XAE('td', [?XMLATTR('class', <<"valign">>)], [?AC(JIDURI, exmpp_jid:to_list(ContactJID))])
|
?XAE('td', [?XMLATTR(<<"class">>, <<"valign">>)], [?AC(JIDURI, exmpp_jid:to_list(ContactJID))])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @spec (User, Server, Items, Query) -> ok | nothing | error
|
%% @spec (User, Server, Items, Query) -> ok | nothing | error
|
||||||
@ -1509,9 +1509,9 @@ user_roster_item_parse_query(User, Server, Items, Query) ->
|
|||||||
{U, S, R} = JID,
|
{U, S, R} = JID,
|
||||||
UJID = exmpp_jid:make(User, Server),
|
UJID = exmpp_jid:make(User, Server),
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
||||||
'jid', exmpp_jid:to_list(U, S, R)),
|
<<"jid">>, exmpp_jid:to_list(U, S, R)),
|
||||||
Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1,
|
Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1,
|
||||||
'subscription', "remove"),
|
<<"subscription">>, "remove"),
|
||||||
Item = #xmlel{ns = ?NS_ROSTER, name = 'item',
|
Item = #xmlel{ns = ?NS_ROSTER, name = 'item',
|
||||||
attrs = Attrs2},
|
attrs = Attrs2},
|
||||||
Request = #xmlel{
|
Request = #xmlel{
|
||||||
|
@ -178,7 +178,7 @@ process_iq_get(From, To, IQ_Rec) ->
|
|||||||
US = {LUser, LServer} = {exmpp_jid:prep_node(From), exmpp_jid:prep_domain(From)},
|
US = {LUser, LServer} = {exmpp_jid:prep_node(From), exmpp_jid:prep_domain(From)},
|
||||||
try
|
try
|
||||||
{ItemsToSend, VersionToSend} =
|
{ItemsToSend, VersionToSend} =
|
||||||
case {exmpp_xml:get_attribute_as_list(exmpp_iq:get_request(IQ_Rec), ver, not_found),
|
case {exmpp_xml:get_attribute_as_list(exmpp_iq:get_request(IQ_Rec), <<"ver">>, not_found),
|
||||||
roster_versioning_enabled(LServer),
|
roster_versioning_enabled(LServer),
|
||||||
roster_version_on_db(LServer)} of
|
roster_version_on_db(LServer)} of
|
||||||
{not_found, _ , _} ->
|
{not_found, _ , _} ->
|
||||||
@ -222,7 +222,7 @@ process_iq_get(From, To, IQ_Rec) ->
|
|||||||
{Items, false} ->
|
{Items, false} ->
|
||||||
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [] , Items));
|
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [] , Items));
|
||||||
{Items, Version} ->
|
{Items, Version} ->
|
||||||
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [?XMLATTR('ver', Version)], Items))
|
exmpp_iq:result(IQ_Rec, exmpp_xml:element(?NS_ROSTER, 'query', [?XMLATTR(<<"ver">>, Version)], Items))
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
_:_ ->
|
_:_ ->
|
||||||
@ -278,22 +278,22 @@ get_roster(LUser, LServer) when is_binary(LUser), is_binary(LServer)->
|
|||||||
item_to_xml(Item) ->
|
item_to_xml(Item) ->
|
||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R} = Item#roster.jid,
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
||||||
'jid', exmpp_jid:to_binary(U, S, R)),
|
<<"jid">>, exmpp_jid:to_binary(U, S, R)),
|
||||||
Attrs2 = case Item#roster.name of
|
Attrs2 = case Item#roster.name of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
Attrs1;
|
Attrs1;
|
||||||
Name ->
|
Name ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs1, 'name', Name)
|
exmpp_xml:set_attribute_in_list(Attrs1, <<"name">>, Name)
|
||||||
end,
|
end,
|
||||||
Attrs3 = exmpp_xml:set_attribute_in_list(Attrs2,
|
Attrs3 = exmpp_xml:set_attribute_in_list(Attrs2,
|
||||||
'subscription', Item#roster.subscription),
|
<<"subscription">>, Item#roster.subscription),
|
||||||
Attrs = case ask_to_pending(Item#roster.ask) of
|
Attrs = case ask_to_pending(Item#roster.ask) of
|
||||||
out ->
|
out ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs3,
|
exmpp_xml:set_attribute_in_list(Attrs3,
|
||||||
'ask', <<"subscribe">>);
|
<<"ask">>, <<"subscribe">>);
|
||||||
both ->
|
both ->
|
||||||
exmpp_xml:set_attribute_in_list(Attrs3,
|
exmpp_xml:set_attribute_in_list(Attrs3,
|
||||||
'ask', <<"subscribe">>);
|
<<"ask">>, <<"subscribe">>);
|
||||||
_ ->
|
_ ->
|
||||||
Attrs3
|
Attrs3
|
||||||
end,
|
end,
|
||||||
@ -315,7 +315,7 @@ process_iq_set(From, To, #iq{payload = Request} = IQ_Rec) ->
|
|||||||
|
|
||||||
process_item_set(From, To, #xmlel{} = El) ->
|
process_item_set(From, To, #xmlel{} = El) ->
|
||||||
try
|
try
|
||||||
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
|
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, <<"jid">>, <<>>)),
|
||||||
User = exmpp_jid:prep_node(From),
|
User = exmpp_jid:prep_node(From),
|
||||||
Server = exmpp_jid:prep_domain(From),
|
Server = exmpp_jid:prep_domain(From),
|
||||||
LServer = binary_to_list(Server),
|
LServer = binary_to_list(Server),
|
||||||
@ -416,9 +416,9 @@ process_item_set(_From, _To, _) ->
|
|||||||
|
|
||||||
process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
||||||
case Attr of
|
case Attr of
|
||||||
'name' ->
|
<<"name">> ->
|
||||||
process_item_attrs(Item#roster{name = Val}, Attrs);
|
process_item_attrs(Item#roster{name = Val}, Attrs);
|
||||||
'subscription' ->
|
<<"subscription">> ->
|
||||||
case Val of
|
case Val of
|
||||||
<<"remove">> ->
|
<<"remove">> ->
|
||||||
process_item_attrs(Item#roster{subscription = remove},
|
process_item_attrs(Item#roster{subscription = remove},
|
||||||
@ -426,7 +426,7 @@ process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
|||||||
_ ->
|
_ ->
|
||||||
process_item_attrs(Item, Attrs)
|
process_item_attrs(Item, Attrs)
|
||||||
end;
|
end;
|
||||||
'ask' ->
|
<<"ask">> ->
|
||||||
process_item_attrs(Item, Attrs);
|
process_item_attrs(Item, Attrs);
|
||||||
_ ->
|
_ ->
|
||||||
process_item_attrs(Item, Attrs)
|
process_item_attrs(Item, Attrs)
|
||||||
@ -454,10 +454,10 @@ push_item(User, Server, From, Item) when is_binary(User), is_binary(Server) ->
|
|||||||
ejabberd_sm:route(exmpp_jid:make(),
|
ejabberd_sm:route(exmpp_jid:make(),
|
||||||
exmpp_jid:make(User, Server),
|
exmpp_jid:make(User, Server),
|
||||||
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
||||||
[exmpp_xml:attribute(u, U),
|
[?XMLATTR(<<"u">>, U),
|
||||||
exmpp_xml:attribute(s, S),
|
?XMLATTR(<<"s">>, S),
|
||||||
exmpp_xml:attribute(r, R),
|
?XMLATTR(<<"r">>, R),
|
||||||
exmpp_xml:attribute(subs, Item#roster.subscription)]}),
|
?XMLATTR(<<"subs">>, Item#roster.subscription)]}),
|
||||||
case roster_versioning_enabled(Server) of
|
case roster_versioning_enabled(Server) of
|
||||||
true ->
|
true ->
|
||||||
push_item_version(Server, User, From, Item, roster_version(Server, User));
|
push_item_version(Server, User, From, Item, roster_version(Server, User));
|
||||||
@ -487,7 +487,7 @@ push_item_version(Server, User, From, Item, RosterVersion) ->
|
|||||||
end, ejabberd_sm:get_user_resources(User, Server)).
|
end, ejabberd_sm:get_user_resources(User, Server)).
|
||||||
|
|
||||||
push_item_version(User, Server, Resource, From, Item, RosterVersion) ->
|
push_item_version(User, Server, Resource, From, Item, RosterVersion) ->
|
||||||
Request = #xmlel{ns = ?NS_ROSTER, name = 'query', attrs = [?XMLATTR('ver', RosterVersion)],
|
Request = #xmlel{ns = ?NS_ROSTER, name = 'query', attrs = [?XMLATTR(<<"ver">>, RosterVersion)],
|
||||||
children = [mod_roster:item_to_xml(Item)]},
|
children = [mod_roster:item_to_xml(Item)]},
|
||||||
ResIQ = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
ResIQ = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
||||||
"push" ++ randoms:get_string()),
|
"push" ++ randoms:get_string()),
|
||||||
@ -827,7 +827,7 @@ set_items(User, Server, #xmlel{children = Els}) when is_binary(User), is_binary(
|
|||||||
|
|
||||||
process_item_set_t(LUser, LServer, #xmlel{} = El) ->
|
process_item_set_t(LUser, LServer, #xmlel{} = El) ->
|
||||||
try
|
try
|
||||||
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
|
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, <<"jid">>, <<>>)),
|
||||||
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
|
||||||
Username = ejabberd_odbc:escape(LUser),
|
Username = ejabberd_odbc:escape(LUser),
|
||||||
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U0, S0, R0)),
|
SJID = ejabberd_odbc:escape(exmpp_jid:to_binary(U0, S0, R0)),
|
||||||
@ -853,9 +853,9 @@ process_item_set_t(_LUser, _LServer, _) ->
|
|||||||
|
|
||||||
process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
|
||||||
case Attr of
|
case Attr of
|
||||||
'name' ->
|
<<"name">> ->
|
||||||
process_item_attrs_ws(Item#roster{name = Val}, Attrs);
|
process_item_attrs_ws(Item#roster{name = Val}, Attrs);
|
||||||
'subscription' ->
|
<<"subscription">> ->
|
||||||
case Val of
|
case Val of
|
||||||
<<"remove">> ->
|
<<"remove">> ->
|
||||||
process_item_attrs_ws(Item#roster{subscription = remove},
|
process_item_attrs_ws(Item#roster{subscription = remove},
|
||||||
@ -1103,16 +1103,16 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
TDJID = build_contact_jid_td(R#roster.jid),
|
TDJID = build_contact_jid_td(R#roster.jid),
|
||||||
?XE("tr",
|
?XE("tr",
|
||||||
[TDJID,
|
[TDJID,
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
binary_to_list(R#roster.name)),
|
binary_to_list(R#roster.name)),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
atom_to_list(R#roster.subscription)),
|
atom_to_list(R#roster.subscription)),
|
||||||
?XAC("td", [?XMLATTR('class', <<"valign">>)],
|
?XAC("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
atom_to_list(Pending)),
|
atom_to_list(Pending)),
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)], Groups),
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)], Groups),
|
||||||
if
|
if
|
||||||
Pending == in ->
|
Pending == in ->
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
[?INPUTT("submit",
|
[?INPUTT("submit",
|
||||||
"validate" ++
|
"validate" ++
|
||||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||||
@ -1120,7 +1120,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
true ->
|
true ->
|
||||||
?X("td")
|
?X("td")
|
||||||
end,
|
end,
|
||||||
?XAE("td", [?XMLATTR('class', <<"valign">>)],
|
?XAE("td", [?XMLATTR(<<"class">>, <<"valign">>)],
|
||||||
[?INPUTT("submit",
|
[?INPUTT("submit",
|
||||||
"remove" ++
|
"remove" ++
|
||||||
ejabberd_web_admin:term_to_id(R#roster.jid),
|
ejabberd_web_admin:term_to_id(R#roster.jid),
|
||||||
@ -1133,7 +1133,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
FItems ++
|
FItems ++
|
||||||
[?P,
|
[?P,
|
||||||
?INPUT("text", "newjid", ""), ?C(" "),
|
?INPUT("text", "newjid", ""), ?C(" "),
|
||||||
@ -1143,7 +1143,7 @@ user_roster(User, Server, Query, Lang) ->
|
|||||||
_ ->
|
_ ->
|
||||||
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
[?XC("h1", ?T("Roster of ") ++ us_to_list({User, Server}))] ++
|
||||||
[?CT("Bad format"), ?P] ++
|
[?CT("Bad format"), ?P] ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?P,
|
[?P,
|
||||||
?INPUT("text", "newjid", ""), ?C(" "),
|
?INPUT("text", "newjid", ""), ?C(" "),
|
||||||
?INPUTT("submit", "addjid", "Add Jabber ID")
|
?INPUTT("submit", "addjid", "Add Jabber ID")
|
||||||
@ -1165,9 +1165,9 @@ build_contact_jid_td({U, S, R}) ->
|
|||||||
end,
|
end,
|
||||||
case JIDURI of
|
case JIDURI of
|
||||||
[] ->
|
[] ->
|
||||||
?XAC('td', [?XMLATTR('class', <<"valign">>)], exmpp_jid:to_list(ContactJID));
|
?XAC('td', [?XMLATTR(<<"class">>, <<"valign">>)], exmpp_jid:to_list(ContactJID));
|
||||||
URI when is_list(URI) ->
|
URI when is_list(URI) ->
|
||||||
?XAE('td', [?XMLATTR('class', <<"valign">>)], [?AC(JIDURI, exmpp_jid:to_list(ContactJID))])
|
?XAE('td', [?XMLATTR(<<"class">>, <<"valign">>)], [?AC(JIDURI, exmpp_jid:to_list(ContactJID))])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
user_roster_parse_query(User, Server, Items, Query) ->
|
user_roster_parse_query(User, Server, Items, Query) ->
|
||||||
@ -1228,9 +1228,9 @@ user_roster_item_parse_query(User, Server, Items, Query) ->
|
|||||||
{value, _} ->
|
{value, _} ->
|
||||||
UJID = exmpp_jid:make(User, Server),
|
UJID = exmpp_jid:make(User, Server),
|
||||||
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
Attrs1 = exmpp_xml:set_attribute_in_list([],
|
||||||
'jid', exmpp_jid:to_list(JID)),
|
<<"jid">>, exmpp_jid:to_list(JID)),
|
||||||
Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1,
|
Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1,
|
||||||
'subscription', "remove"),
|
<<"subscription">>, "remove"),
|
||||||
Item = #xmlel{ns = ?NS_ROSTER, name = 'item',
|
Item = #xmlel{ns = ?NS_ROSTER, name = 'item',
|
||||||
attrs = Attrs2},
|
attrs = Attrs2},
|
||||||
Request = #xmlel{
|
Request = #xmlel{
|
||||||
|
@ -740,10 +740,10 @@ push_item(User, Server, From, Item) ->
|
|||||||
{U, S, R} = Item#roster.jid,
|
{U, S, R} = Item#roster.jid,
|
||||||
ejabberd_sm:route(From, exmpp_jid:make(User, Server),
|
ejabberd_sm:route(From, exmpp_jid:make(User, Server),
|
||||||
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
#xmlel{name = 'broadcast', ns = roster_item, attrs =
|
||||||
[exmpp_xml:attribute(u, U),
|
[?XMLATTR(<<"u">>, U),
|
||||||
exmpp_xml:attribute(s, S),
|
?XMLATTR(<<"s">>, S),
|
||||||
exmpp_xml:attribute(r, R),
|
?XMLATTR(<<"r">>, R),
|
||||||
exmpp_xml:attribute(subs, Item#roster.subscription)]}),
|
?XMLATTR(<<"subs">>, Item#roster.subscription)]}),
|
||||||
Request = #xmlel{ns = ?NS_ROSTER, name = 'query',
|
Request = #xmlel{ns = ?NS_ROSTER, name = 'query',
|
||||||
children = [mod_roster:item_to_xml(Item)]},
|
children = [mod_roster:item_to_xml(Item)]},
|
||||||
Stanza = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
Stanza = exmpp_iq:set(?NS_JABBER_CLIENT, Request,
|
||||||
@ -817,7 +817,7 @@ list_shared_roster_groups(Host, Query, Lang) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[FGroups,
|
[FGroups,
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "delete", "Delete Selected")
|
?INPUTT("submit", "delete", "Delete Selected")
|
||||||
@ -879,7 +879,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
|||||||
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
|
FDisplayedGroups = [[DG, $\n] || DG <- DisplayedGroups],
|
||||||
DescNL = length(re:split(Description, "\n", [{return, list}])),
|
DescNL = length(re:split(Description, "\n", [{return, list}])),
|
||||||
FGroup =
|
FGroup =
|
||||||
?XAE("table", [?XMLATTR('class', <<"withtextareas">>)],
|
?XAE("table", [?XMLATTR(<<"class">>, <<"withtextareas">>)],
|
||||||
[?XE("tbody",
|
[?XE("tbody",
|
||||||
[?XE("tr",
|
[?XE("tr",
|
||||||
[?XCT("td", "Group ID:"),
|
[?XCT("td", "Group ID:"),
|
||||||
@ -923,7 +923,7 @@ shared_roster_group(Host, Group, Query, Lang) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE("form", [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE("form", [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[FGroup,
|
[FGroup,
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
|
@ -46,7 +46,7 @@ stop(Host) ->
|
|||||||
|
|
||||||
process_local_iq(_From, To, #iq{type = get,
|
process_local_iq(_From, To, #iq{type = get,
|
||||||
ns = XMLNS, payload = SubEl} = IQ_Rec) ->
|
ns = XMLNS, payload = SubEl} = IQ_Rec) ->
|
||||||
Node = string:tokens(exmpp_xml:get_attribute_as_list(SubEl, 'node', ""), "/"),
|
Node = string:tokens(exmpp_xml:get_attribute_as_list(SubEl, <<"node">>, ""), "/"),
|
||||||
Names = get_names(exmpp_xml:get_child_elements(SubEl), []),
|
Names = get_names(exmpp_xml:get_child_elements(SubEl), []),
|
||||||
|
|
||||||
case get_local_stats(exmpp_jid:domain(To), Node, Names) of
|
case get_local_stats(exmpp_jid:domain(To), Node, Names) of
|
||||||
@ -63,7 +63,7 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
|||||||
get_names([], Res) ->
|
get_names([], Res) ->
|
||||||
Res;
|
Res;
|
||||||
get_names([#xmlel{name = "stat", attrs = Attrs} | Els], Res) ->
|
get_names([#xmlel{name = "stat", attrs = Attrs} | Els], Res) ->
|
||||||
Name = exmpp_xml:get_attribute_from_list_as_binary(Attrs, 'name', <<>>),
|
Name = exmpp_xml:get_attribute_from_list_as_binary(Attrs, <<"name">>, <<>>),
|
||||||
case Name of
|
case Name of
|
||||||
<<>> ->
|
<<>> ->
|
||||||
get_names(Els, Res);
|
get_names(Els, Res);
|
||||||
@ -74,7 +74,7 @@ get_names([_ | Els], Res) ->
|
|||||||
get_names(Els, Res).
|
get_names(Els, Res).
|
||||||
|
|
||||||
|
|
||||||
-define(STAT(Name), #xmlel{ns = ?NS_STATS_s, name = 'stat', attrs = [?XMLATTR('name', Name)]}).
|
-define(STAT(Name), #xmlel{ns = ?NS_STATS_s, name = 'stat', attrs = [?XMLATTR(<<"name">>, Name)]}).
|
||||||
|
|
||||||
get_local_stats(_Server, [], []) ->
|
get_local_stats(_Server, [], []) ->
|
||||||
{result,
|
{result,
|
||||||
@ -116,16 +116,16 @@ get_local_stats(_Server, _, _) ->
|
|||||||
|
|
||||||
-define(STATVAL(Val, Unit),
|
-define(STATVAL(Val, Unit),
|
||||||
#xmlel{ns = ?NS_STATS_s, name = 'stat', attrs =
|
#xmlel{ns = ?NS_STATS_s, name = 'stat', attrs =
|
||||||
[?XMLATTR('name', Name),
|
[?XMLATTR(<<"name">>, Name),
|
||||||
?XMLATTR('units', Unit),
|
?XMLATTR(<<"units">>, Unit),
|
||||||
?XMLATTR('value', Val)
|
?XMLATTR(<<"value">>, Val)
|
||||||
]}).
|
]}).
|
||||||
|
|
||||||
-define(STATERR(Code, Desc),
|
-define(STATERR(Code, Desc),
|
||||||
#xmlel{ns = ?NS_STATS_s, name = 'stat', attrs=
|
#xmlel{ns = ?NS_STATS_s, name = 'stat', attrs=
|
||||||
[?XMLATTR('name', Name)], children =
|
[?XMLATTR(<<"name">>, Name)], children =
|
||||||
[#xmlel{ns = ?NS_STATS_s, name = 'error', attrs =
|
[#xmlel{ns = ?NS_STATS_s, name = 'error', attrs =
|
||||||
[?XMLATTR('code', Code)], children =
|
[?XMLATTR(<<"code">>, Code)], children =
|
||||||
[#xmlcdata{cdata = Desc}]}]}).
|
[#xmlcdata{cdata = Desc}]}]}).
|
||||||
|
|
||||||
|
|
||||||
|
@ -339,16 +339,16 @@ set_vcard(User, LServer, LServerB, VCARD) ->
|
|||||||
|
|
||||||
-define(TLFIELD(Type, Label, Var),
|
-define(TLFIELD(Type, Label, Var),
|
||||||
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
||||||
?XMLATTR('type', Type),
|
?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)]}).
|
?XMLATTR(<<"var">>, Var)]}).
|
||||||
|
|
||||||
|
|
||||||
-define(FORM(JID),
|
-define(FORM(JID),
|
||||||
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:to_list(JID))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:to_list(JID))}]},
|
||||||
#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
||||||
@ -410,7 +410,7 @@ do_route(ServerHost, From, To, Packet) ->
|
|||||||
children =
|
children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'x',
|
name = 'x',
|
||||||
attrs = [?XMLATTR('type',
|
attrs = [?XMLATTR(<<"type">>,
|
||||||
<<"result">>)],
|
<<"result">>)],
|
||||||
children = search_result(Lang,
|
children = search_result(Lang,
|
||||||
To, ServerHost, XData)}]},
|
To, ServerHost, XData)}]},
|
||||||
@ -439,19 +439,19 @@ do_route(ServerHost, From, To, Packet) ->
|
|||||||
children = Info ++ [
|
children = Info ++ [
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('category', <<"directory">>),
|
?XMLATTR(<<"category">>, <<"directory">>),
|
||||||
?XMLATTR('type', <<"user">>),
|
?XMLATTR(<<"type">>, <<"user">>),
|
||||||
?XMLATTR('name', translate:translate(Lang,
|
?XMLATTR(<<"name">>, translate:translate(Lang,
|
||||||
"vCard User Search"))]},
|
"vCard User Search"))]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_DISCO_INFO_s)]},
|
?XMLATTR(<<"var">>, ?NS_DISCO_INFO_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_SEARCH_s)]},
|
?XMLATTR(<<"var">>, ?NS_SEARCH_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_VCARD_s)]}
|
?XMLATTR(<<"var">>, ?NS_VCARD_s)]}
|
||||||
]},
|
]},
|
||||||
ResIQ = exmpp_iq:result(Packet, Result),
|
ResIQ = exmpp_iq:result(Packet, Result),
|
||||||
ejabberd_router:route(To,
|
ejabberd_router:route(To,
|
||||||
@ -528,7 +528,7 @@ search_result(Lang, JID, ServerHost, Data) ->
|
|||||||
|
|
||||||
-define(FIELD(Var, Val),
|
-define(FIELD(Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', Var)], children =
|
[?XMLATTR(<<"var">>, Var)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = Val}]}]}).
|
[#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
@ -862,9 +862,9 @@ user_vcard(User, Server, Query, Lang) ->
|
|||||||
{error, M} -> [?XREST(M)];
|
{error, M} -> [?XREST(M)];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XCT('h3', "vCard Photo:"),
|
[?XCT('h3', "vCard Photo:"),
|
||||||
?XAE('img', [?XMLATTR('src', <<"photo">>), ?XMLATTR('border', <<"1px">>)], []),
|
?XAE('img', [?XMLATTR(<<"src">>, <<"photo">>), ?XMLATTR(<<"border">>, <<"1px">>)], []),
|
||||||
?XC('h3', ?T("vCard")++":"),
|
?XC('h3', ?T("vCard")++":"),
|
||||||
?XE('pre', [?C(VcardString)]),
|
?XE('pre', [?C(VcardString)]),
|
||||||
?INPUTT("submit", "removevcard", "Remove vCard")
|
?INPUTT("submit", "removevcard", "Remove vCard")
|
||||||
|
@ -387,15 +387,15 @@ ldap_attribute_to_vcard(_, _) ->
|
|||||||
|
|
||||||
-define(TLFIELD(Type, Label, Var),
|
-define(TLFIELD(Type, Label, Var),
|
||||||
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
||||||
?XMLATTR('type', Type),
|
?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)]}).
|
?XMLATTR(<<"var">>, Var)]}).
|
||||||
|
|
||||||
-define(FORM(JID, SearchFields),
|
-define(FORM(JID, SearchFields),
|
||||||
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++
|
||||||
exmpp_jid:to_list(JID))}]},
|
exmpp_jid:to_list(JID))}]},
|
||||||
@ -442,7 +442,7 @@ route(State, From, To, Packet) ->
|
|||||||
children =
|
children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS,
|
[#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'x',
|
name = 'x',
|
||||||
attrs = [?XMLATTR('type',
|
attrs = [?XMLATTR(<<"type">>,
|
||||||
<<"result">>)],
|
<<"result">>)],
|
||||||
children = search_result(Lang, To, State, XData)}]},
|
children = search_result(Lang, To, State, XData)}]},
|
||||||
ResIQ = exmpp_iq:result(Packet,
|
ResIQ = exmpp_iq:result(Packet,
|
||||||
@ -471,16 +471,16 @@ route(State, From, To, Packet) ->
|
|||||||
children = Info ++ [
|
children = Info ++ [
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('category', <<"directory">>),
|
?XMLATTR(<<"category">>, <<"directory">>),
|
||||||
?XMLATTR('type', <<"user">>),
|
?XMLATTR(<<"type">>, <<"user">>),
|
||||||
?XMLATTR('name', translate:translate(Lang,
|
?XMLATTR(<<"name">>, translate:translate(Lang,
|
||||||
"vCard User Search"))]},
|
"vCard User Search"))]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_SEARCH_s)]},
|
?XMLATTR(<<"var">>, ?NS_SEARCH_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_VCARD_s)]}
|
?XMLATTR(<<"var">>, ?NS_VCARD_s)]}
|
||||||
]},
|
]},
|
||||||
ResIQ = exmpp_iq:result(Packet, Result),
|
ResIQ = exmpp_iq:result(Packet, Result),
|
||||||
ejabberd_router:route(To,
|
ejabberd_router:route(To,
|
||||||
@ -545,7 +545,7 @@ search_result(Lang, JID, State, Data) ->
|
|||||||
|
|
||||||
-define(FIELD(Var, Val),
|
-define(FIELD(Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', Var)], children =
|
[?XMLATTR(<<"var">>, Var)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = Val}]}]}).
|
[#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
|||||||
{selected, ["vcard"], [{SVCARD}]} ->
|
{selected, ["vcard"], [{SVCARD}]} ->
|
||||||
try exmpp_xml:parse_document(SVCARD,
|
try exmpp_xml:parse_document(SVCARD,
|
||||||
[names_as_atom, {check_elems, xmpp},
|
[names_as_atom, {check_elems, xmpp},
|
||||||
{check_nss,xmpp}, {check_attrs,xmpp}]) of
|
{check_nss,xmpp} ]) of
|
||||||
[VCARD] ->
|
[VCARD] ->
|
||||||
exmpp_iq:result(IQ_Rec, VCARD)
|
exmpp_iq:result(IQ_Rec, VCARD)
|
||||||
catch
|
catch
|
||||||
@ -253,16 +253,16 @@ set_vcard(User, LServer, VCARD) ->
|
|||||||
|
|
||||||
-define(TLFIELD(Type, Label, Var),
|
-define(TLFIELD(Type, Label, Var),
|
||||||
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
#xmlel{ns = ?NS_VCARD, name = 'field', attrs = [
|
||||||
?XMLATTR('type', Type),
|
?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('label', translate:translate(Lang, Label)),
|
?XMLATTR(<<"label">>, translate:translate(Lang, Label)),
|
||||||
?XMLATTR('var', Var)]}).
|
?XMLATTR(<<"var">>, Var)]}).
|
||||||
|
|
||||||
|
|
||||||
-define(FORM(JID),
|
-define(FORM(JID),
|
||||||
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
[#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "You need an x:data capable client to search"))}]},
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
|
||||||
[?XMLATTR('type', <<"form">>)], children =
|
[?XMLATTR(<<"type">>, <<"form">>)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:to_list(JID))}]},
|
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:to_list(JID))}]},
|
||||||
#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
#xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
|
||||||
@ -321,7 +321,7 @@ do_route(ServerHost, From, To, Packet) ->
|
|||||||
#xmlel{ns = ?NS_DATA_FORMS,
|
#xmlel{ns = ?NS_DATA_FORMS,
|
||||||
name = 'x',
|
name = 'x',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('type',
|
?XMLATTR(<<"type">>,
|
||||||
<<"result">>)],
|
<<"result">>)],
|
||||||
children = search_result(Lang,
|
children = search_result(Lang,
|
||||||
To, ServerHost, XData)}]},
|
To, ServerHost, XData)}]},
|
||||||
@ -349,16 +349,16 @@ do_route(ServerHost, From, To, Packet) ->
|
|||||||
children = Info ++ [
|
children = Info ++ [
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('category', <<"directory">>),
|
?XMLATTR(<<"category">>, <<"directory">>),
|
||||||
?XMLATTR('type', <<"user">>),
|
?XMLATTR(<<"type">>, <<"user">>),
|
||||||
?XMLATTR('name', translate:translate(Lang,
|
?XMLATTR(<<"name">>, translate:translate(Lang,
|
||||||
"vCard User Search"))]},
|
"vCard User Search"))]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_SEARCH_s)]},
|
?XMLATTR(<<"var">>, ?NS_SEARCH_s)]},
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature',
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('var', ?NS_VCARD_s)]}
|
?XMLATTR(<<"var">>, ?NS_VCARD_s)]}
|
||||||
]},
|
]},
|
||||||
ResIQ = exmpp_iq:result(Packet, Result),
|
ResIQ = exmpp_iq:result(Packet, Result),
|
||||||
ejabberd_router:route(To,
|
ejabberd_router:route(To,
|
||||||
@ -436,7 +436,7 @@ search_result(Lang, JID, ServerHost, Data) ->
|
|||||||
|
|
||||||
-define(FIELD(Var, Val),
|
-define(FIELD(Var, Val),
|
||||||
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
|
||||||
[?XMLATTR('var', Var)], children =
|
[?XMLATTR(<<"var">>, Var)], children =
|
||||||
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children =
|
||||||
[#xmlcdata{cdata = Val}]}]}).
|
[#xmlcdata{cdata = Val}]}]}).
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ stop(Host) ->
|
|||||||
|
|
||||||
update_presence(Packet, User, Host) ->
|
update_presence(Packet, User, Host) ->
|
||||||
case exmpp_presence:is_presence(Packet) andalso
|
case exmpp_presence:is_presence(Packet) andalso
|
||||||
exmpp_xml:get_attribute_as_binary(Packet, type, undefined)
|
exmpp_xml:get_attribute_as_binary(Packet, <<"type">>, undefined)
|
||||||
== undefined of
|
== undefined of
|
||||||
true ->
|
true ->
|
||||||
presence_with_xupdate(Packet, User, Host);
|
presence_with_xupdate(Packet, User, Host);
|
||||||
|
@ -207,7 +207,7 @@ process_request(Data, IP) ->
|
|||||||
case catch parse_request(Data, PayloadSize, MaxStanzaSize) of
|
case catch parse_request(Data, PayloadSize, MaxStanzaSize) of
|
||||||
%% No existing session:
|
%% No existing session:
|
||||||
{ok, {"", Rid, Attrs, Payload}} ->
|
{ok, {"", Rid, Attrs, Payload}} ->
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(Attrs, "to", "") of
|
case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"to">>, "") of
|
||||||
"" ->
|
"" ->
|
||||||
?DEBUG("Session not created (Improper addressing)", []),
|
?DEBUG("Session not created (Improper addressing)", []),
|
||||||
{200, ?HEADER, "<body type='terminate' "
|
{200, ?HEADER, "<body type='terminate' "
|
||||||
@ -231,13 +231,13 @@ process_request(Data, IP) ->
|
|||||||
%% Existing session
|
%% Existing session
|
||||||
{ok, {Sid, Rid, Attrs, Payload1}} ->
|
{ok, {Sid, Rid, Attrs, Payload1}} ->
|
||||||
StreamStart =
|
StreamStart =
|
||||||
case exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, restart, "") of
|
case exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, <<"restart">>, "") of
|
||||||
"true" ->
|
"true" ->
|
||||||
true;
|
true;
|
||||||
_ ->
|
_ ->
|
||||||
false
|
false
|
||||||
end,
|
end,
|
||||||
Payload2 = case exmpp_xml:get_attribute_from_list_as_list(Attrs, "type", "") of
|
Payload2 = case exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"type">>, "") of
|
||||||
"terminate" ->
|
"terminate" ->
|
||||||
%% close stream
|
%% close stream
|
||||||
Payload1 ++ [{xmlstreamend, "stream:stream"}];
|
Payload1 ++ [{xmlstreamend, "stream:stream"}];
|
||||||
@ -264,7 +264,7 @@ process_request(Data, IP) ->
|
|||||||
handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
|
handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
|
||||||
Payload, PayloadSize, IP) ->
|
Payload, PayloadSize, IP) ->
|
||||||
?DEBUG("got pid: ~p", [Pid]),
|
?DEBUG("got pid: ~p", [Pid]),
|
||||||
Wait = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, "wait", "")) of
|
Wait = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"wait">>, "")) of
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
?MAX_WAIT;
|
?MAX_WAIT;
|
||||||
{CWait, _} ->
|
{CWait, _} ->
|
||||||
@ -275,7 +275,7 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
|
|||||||
CWait
|
CWait
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Hold = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, "hold", "")) of
|
Hold = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"hold">>, "")) of
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
(?MAX_REQUESTS - 1);
|
(?MAX_REQUESTS - 1);
|
||||||
{CHold, _} ->
|
{CHold, _} ->
|
||||||
@ -286,7 +286,7 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
|
|||||||
CHold
|
CHold
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Pdelay = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, "process-delay", "")) of
|
Pdelay = case string:to_integer(exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"process-delay">>, "")) of
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
?PROCESS_DELAY_DEFAULT;
|
?PROCESS_DELAY_DEFAULT;
|
||||||
{CPdelay, _} when
|
{CPdelay, _} when
|
||||||
@ -298,11 +298,11 @@ handle_session_start(Pid, XmppDomain, Sid, Rid, Attrs,
|
|||||||
end,
|
end,
|
||||||
Version =
|
Version =
|
||||||
case catch list_to_float(
|
case catch list_to_float(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, "ver", "")) of
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"ver">>, "")) of
|
||||||
{'EXIT', _} -> 0.0;
|
{'EXIT', _} -> 0.0;
|
||||||
V -> V
|
V -> V
|
||||||
end,
|
end,
|
||||||
XmppVersion = exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, version, ""),
|
XmppVersion = exmpp_xml:get_attribute_from_list_as_list(Attrs, ?NS_BOSH, <<"version">>, ""),
|
||||||
?DEBUG("Create session: ~p", [Sid]),
|
?DEBUG("Create session: ~p", [Sid]),
|
||||||
mnesia:async_dirty(
|
mnesia:async_dirty(
|
||||||
fun() ->
|
fun() ->
|
||||||
@ -638,8 +638,8 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload,
|
|||||||
StateName, StateData, RidAllow) ->
|
StateName, StateData, RidAllow) ->
|
||||||
?DEBUG("Actually processing request: ~p", [Request]),
|
?DEBUG("Actually processing request: ~p", [Request]),
|
||||||
%% Check if key valid
|
%% Check if key valid
|
||||||
Key = exmpp_xml:get_attribute_from_list_as_list(Attrs, "key", ""),
|
Key = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"key">>, ""),
|
||||||
NewKey = exmpp_xml:get_attribute_from_list_as_list(Attrs, "newkey", ""),
|
NewKey = exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"newkey">>, ""),
|
||||||
KeyAllow =
|
KeyAllow =
|
||||||
case RidAllow of
|
case RidAllow of
|
||||||
repeat ->
|
repeat ->
|
||||||
@ -746,7 +746,7 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload,
|
|||||||
{To, ""} ->
|
{To, ""} ->
|
||||||
DecNs = [{?NS_XMPP, "stream"},
|
DecNs = [{?NS_XMPP, "stream"},
|
||||||
{?NS_JABBER_CLIENT, none}],
|
{?NS_JABBER_CLIENT, none}],
|
||||||
StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)}],
|
StreamAttrs = [#xmlattr{name = <<"to">>, value = list_to_binary(To)}],
|
||||||
StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs,
|
StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs,
|
||||||
attrs = StreamAttrs},
|
attrs = StreamAttrs},
|
||||||
gen_fsm:send_event(
|
gen_fsm:send_event(
|
||||||
@ -755,8 +755,8 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs, payload = Payload,
|
|||||||
{To, Version} ->
|
{To, Version} ->
|
||||||
DecNs = [{?NS_XMPP, "stream"},
|
DecNs = [{?NS_XMPP, "stream"},
|
||||||
{?NS_JABBER_CLIENT, none}],
|
{?NS_JABBER_CLIENT, none}],
|
||||||
StreamAttrs = [#xmlattr{name = 'to', value = list_to_binary(To)},
|
StreamAttrs = [?XMLATTR(<<"to">>, list_to_binary(To)),
|
||||||
#xmlattr{name = 'version', value = list_to_binary(Version)}],
|
?XMLATTR(<<"version">>, list_to_binary(Version))],
|
||||||
StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs,
|
StreamEl = #xmlel{name = stream, ns = ?NS_XMPP, declared_ns = DecNs,
|
||||||
attrs = StreamAttrs},
|
attrs = StreamAttrs},
|
||||||
gen_fsm:send_event(
|
gen_fsm:send_event(
|
||||||
@ -869,11 +869,11 @@ handle_http_put_error(Reason, #http_bind{pid=FsmRef, version=Version})
|
|||||||
#xmlel{name = 'body',
|
#xmlel{name = 'body',
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"terminate">>
|
value = <<"terminate">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"item-not-found">>
|
value = <<"item-not-found">>
|
||||||
}
|
}
|
||||||
@ -885,11 +885,11 @@ handle_http_put_error(Reason, #http_bind{pid=FsmRef, version=Version})
|
|||||||
#xmlel{name = 'body',
|
#xmlel{name = 'body',
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"terminate">>
|
value = <<"terminate">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"item-not-found">>
|
value = <<"item-not-found">>
|
||||||
}
|
}
|
||||||
@ -901,11 +901,11 @@ handle_http_put_error(Reason, #http_bind{pid=FsmRef, version=Version})
|
|||||||
#xmlel{name = 'body',
|
#xmlel{name = 'body',
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"terminate">>
|
value = <<"terminate">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'type',
|
#xmlattr{name = <<"type">>,
|
||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
value = <<"policy-violation">>
|
value = <<"policy-violation">>
|
||||||
}
|
}
|
||||||
@ -936,7 +936,7 @@ rid_allow(OldRid, NewRid, Attrs, Hold, MaxPause) ->
|
|||||||
%% We did not miss any packet, we can process it immediately:
|
%% We did not miss any packet, we can process it immediately:
|
||||||
NewRid == OldRid + 1 ->
|
NewRid == OldRid + 1 ->
|
||||||
case catch list_to_integer(
|
case catch list_to_integer(
|
||||||
exmpp_xml:get_attribute_from_list_as_list(Attrs, "pause", "")) of
|
exmpp_xml:get_attribute_from_list_as_list(Attrs, <<"pause">>, "")) of
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
{true, 0};
|
{true, 0};
|
||||||
Pause1 when Pause1 =< MaxPause ->
|
Pause1 when Pause1 =< MaxPause ->
|
||||||
@ -1004,9 +1004,9 @@ prepare_outpacket_response(#http_bind{id=Sid, wait=Wait,
|
|||||||
Rid, OutPacket, true) ->
|
Rid, OutPacket, true) ->
|
||||||
case OutPacket of
|
case OutPacket of
|
||||||
[{xmlstreamstart, _, OutAttrs} | Els] ->
|
[{xmlstreamstart, _, OutAttrs} | Els] ->
|
||||||
AuthID = exmpp_xml:get_attribute_from_list_as_list(OutAttrs, "id", ""),
|
AuthID = exmpp_xml:get_attribute_from_list_as_list(OutAttrs, <<"id">>, ""),
|
||||||
FromB = exmpp_xml:get_attribute_from_list_as_binary(OutAttrs, "from", ""),
|
FromB = exmpp_xml:get_attribute_from_list_as_binary(OutAttrs, <<"from">>, <<>>),
|
||||||
Version = exmpp_xml:get_attribute_from_list_as_list(OutAttrs, "version", ""),
|
Version = exmpp_xml:get_attribute_from_list_as_list(OutAttrs, <<"version">>, ""),
|
||||||
OutEls =
|
OutEls =
|
||||||
case Els of
|
case Els of
|
||||||
[] ->
|
[] ->
|
||||||
@ -1045,9 +1045,9 @@ prepare_outpacket_response(#http_bind{id=Sid, wait=Wait,
|
|||||||
"xmlns='"++?NS_HTTP_BIND_s++"'/>"};
|
"xmlns='"++?NS_HTTP_BIND_s++"'/>"};
|
||||||
_ ->
|
_ ->
|
||||||
BOSH_attribs =
|
BOSH_attribs =
|
||||||
[#xmlattr{name = 'authid', value = list_to_binary(AuthID)},
|
[#xmlattr{name = <<"authid">>, value = list_to_binary(AuthID)},
|
||||||
#xmlattr{name = 'xmlns:stream', value = ?NS_XMPP_b}] ++
|
#xmlattr{name = <<"xmlns:stream">>, value = ?NS_XMPP_b}] ++
|
||||||
[#xmlattr{name = 'version', ns = ?NS_BOSH_s, value = list_to_binary(Version)}],
|
[#xmlattr{name = <<"version">>, ns = ?NS_BOSH_s, value = list_to_binary(Version)}],
|
||||||
MaxInactivity = get_max_inactivity(To, ?MAX_INACTIVITY),
|
MaxInactivity = get_max_inactivity(To, ?MAX_INACTIVITY),
|
||||||
MaxPause = get_max_pause(To),
|
MaxPause = get_max_pause(To),
|
||||||
{200, ?HEADER,
|
{200, ?HEADER,
|
||||||
@ -1056,31 +1056,31 @@ prepare_outpacket_response(#http_bind{id=Sid, wait=Wait,
|
|||||||
ns = ?NS_HTTP_BIND_s,
|
ns = ?NS_HTTP_BIND_s,
|
||||||
declared_ns = [{?NS_XBOSH_s, ?NS_XBOSH_pfx}],
|
declared_ns = [{?NS_XBOSH_s, ?NS_XBOSH_pfx}],
|
||||||
attrs = [
|
attrs = [
|
||||||
#xmlattr{name = 'sid',
|
#xmlattr{name = <<"sid">>,
|
||||||
value = list_to_binary(Sid)
|
value = list_to_binary(Sid)
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'wait',
|
#xmlattr{name = <<"wait">>,
|
||||||
value = list_to_binary(integer_to_list(Wait))
|
value = list_to_binary(integer_to_list(Wait))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'requests',
|
#xmlattr{name = <<"requests">>,
|
||||||
value = list_to_binary(integer_to_list(Hold+1))
|
value = list_to_binary(integer_to_list(Hold+1))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'inactivity',
|
#xmlattr{name = <<"inactivity">>,
|
||||||
value = list_to_binary(integer_to_list(trunc(MaxInactivity/1000)))
|
value = list_to_binary(integer_to_list(trunc(MaxInactivity/1000)))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'maxpause',
|
#xmlattr{name = <<"maxpause">>,
|
||||||
value = list_to_binary(integer_to_list(MaxPause))
|
value = list_to_binary(integer_to_list(MaxPause))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'polling',
|
#xmlattr{name = <<"polling">>,
|
||||||
value = list_to_binary(integer_to_list(trunc(?MIN_POLLING/1000000)))
|
value = list_to_binary(integer_to_list(trunc(?MIN_POLLING/1000000)))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'ver',
|
#xmlattr{name = <<"ver">>,
|
||||||
value = ?BOSH_VERSION_b
|
value = ?BOSH_VERSION_b
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'from',
|
#xmlattr{name = <<"from">>,
|
||||||
value = FromB
|
value = FromB
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'secure',
|
#xmlattr{name = <<"secure">>,
|
||||||
value = <<"true">>
|
value = <<"true">>
|
||||||
}
|
}
|
||||||
] ++ BOSH_attribs,
|
] ++ BOSH_attribs,
|
||||||
@ -1252,7 +1252,7 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
|
|||||||
{error, bad_request};
|
{error, bad_request};
|
||||||
true ->
|
true ->
|
||||||
%case catch list_to_integer(xml:get_attr_s("rid", Attrs)) of
|
%case catch list_to_integer(xml:get_attr_s("rid", Attrs)) of
|
||||||
case catch list_to_integer(exmpp_xml:get_attribute_as_list(Xml, "rid", "")) of
|
case catch list_to_integer(exmpp_xml:get_attribute_as_list(Xml, <<"rid">>, "")) of
|
||||||
|
|
||||||
{'EXIT', _} ->
|
{'EXIT', _} ->
|
||||||
{error, bad_request};
|
{error, bad_request};
|
||||||
@ -1269,7 +1269,7 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
end, Els),
|
end, Els),
|
||||||
Sid = exmpp_xml:get_attribute_as_list(Xml, "sid", ""),
|
Sid = exmpp_xml:get_attribute_as_list(Xml, <<"sid">>, ""),
|
||||||
if
|
if
|
||||||
PayloadSize =< MaxStanzaSize ->
|
PayloadSize =< MaxStanzaSize ->
|
||||||
{ok, {Sid, Rid, Attrs, FixedEls}};
|
{ok, {Sid, Rid, Attrs, FixedEls}};
|
||||||
|
@ -173,7 +173,7 @@ get_human_html_xmlel() ->
|
|||||||
Par1 = #xmlel{name = p, children =
|
Par1 = #xmlel{name = p, children =
|
||||||
[#xmlcdata{cdata = <<"An implementation of ">>},
|
[#xmlcdata{cdata = <<"An implementation of ">>},
|
||||||
#xmlel{name = a,
|
#xmlel{name = a,
|
||||||
attrs = [#xmlattr{name=href, value = <<"http://xmpp.org/extensions/xep-0025.html">>}],
|
attrs = [#xmlattr{name = <<"href">>, value = <<"http://xmpp.org/extensions/xep-0025.html">>}],
|
||||||
children = [#xmlcdata{cdata = <<"Jabber HTTP Polling (XEP-0025)">>}]
|
children = [#xmlcdata{cdata = <<"Jabber HTTP Polling (XEP-0025)">>}]
|
||||||
}
|
}
|
||||||
]},
|
]},
|
||||||
@ -182,7 +182,7 @@ get_human_html_xmlel() ->
|
|||||||
"To use HTTP-Poll you need a Jabber/XMPP client that supports it.">>}
|
"To use HTTP-Poll you need a Jabber/XMPP client that supports it.">>}
|
||||||
]},
|
]},
|
||||||
#xmlel{name = html,
|
#xmlel{name = html,
|
||||||
attrs = [#xmlattr{name = xmlns, value= <<"http://www.w3.org/1999/xhtml">>}],
|
attrs = [#xmlattr{name = <<"xmlns">>, value= <<"http://www.w3.org/1999/xhtml">>}],
|
||||||
children =
|
children =
|
||||||
[#xmlel{name = head, children = [#xmlel{name = title, children = [#xmlcdata{cdata = Heading}]}]},
|
[#xmlel{name = head, children = [#xmlel{name = title, children = [#xmlcdata{cdata = Heading}]}]},
|
||||||
#xmlel{name = body, children = [H, Par1, Par2]}]}.
|
#xmlel{name = body, children = [H, Par1, Par2]}]}.
|
||||||
|
@ -48,12 +48,12 @@ make_xhtml(Els) ->
|
|||||||
|
|
||||||
make_xhtml(HeadEls, Els) ->
|
make_xhtml(HeadEls, Els) ->
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'html', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'html', attrs = [
|
||||||
exmpp_xml:attribute(?NS_XML, 'lang', <<"en">>),
|
exmpp_xml:attribute(?NS_XML, <<"lang">>, <<"en">>),
|
||||||
?XMLATTR('lang', <<"en">>)], children = [
|
?XMLATTR(<<"lang">>, <<"en">>)], children = [
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'head', children = [
|
#xmlel{ns = ?NS_XHTML, name = 'head', children = [
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'meta', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'meta', attrs = [
|
||||||
?XMLATTR('http-equiv', <<"Content-Type">>),
|
?XMLATTR(<<"http-equiv">>, <<"Content-Type">>),
|
||||||
?XMLATTR('content', <<"text/html; charset=utf-8">>)
|
?XMLATTR(<<"content">>, <<"text/html; charset=utf-8">>)
|
||||||
]}
|
]}
|
||||||
| HeadEls
|
| HeadEls
|
||||||
]},
|
]},
|
||||||
@ -71,14 +71,14 @@ make_xhtml(HeadEls, Els) ->
|
|||||||
-define(XAC(Name, Attrs, Text), ?XAE(Name, Attrs, [?C(Text)])).
|
-define(XAC(Name, Attrs, Text), ?XAE(Name, Attrs, [?C(Text)])).
|
||||||
|
|
||||||
-define(LI(Els), ?XE('li', Els)).
|
-define(LI(Els), ?XE('li', Els)).
|
||||||
-define(A(URL, Els), ?XAE('a', [?XMLATTR('href', URL)], Els)).
|
-define(A(URL, Els), ?XAE('a', [?XMLATTR(<<"href">>, URL)], Els)).
|
||||||
-define(AC(URL, Text), ?A(URL, [?C(Text)])).
|
-define(AC(URL, Text), ?A(URL, [?C(Text)])).
|
||||||
-define(P, ?X('p')).
|
-define(P, ?X('p')).
|
||||||
-define(BR, ?X('br')).
|
-define(BR, ?X('br')).
|
||||||
-define(INPUT(Type, Name, Value),
|
-define(INPUT(Type, Name, Value),
|
||||||
?XA('input', [?XMLATTR('type', Type),
|
?XA('input', [?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('name', Name),
|
?XMLATTR(<<"name">>, Name),
|
||||||
?XMLATTR('value', Value)])).
|
?XMLATTR(<<"value">>, Value)])).
|
||||||
|
|
||||||
error(not_found) ->
|
error(not_found) ->
|
||||||
{404, [], make_xhtml([?XC('h1', "404 Not Found")])};
|
{404, [], make_xhtml([?XC('h1', "404 Not Found")])};
|
||||||
|
@ -43,9 +43,9 @@
|
|||||||
|
|
||||||
-define(INPUTATTRS(Type, Name, Value, Attrs),
|
-define(INPUTATTRS(Type, Name, Value, Attrs),
|
||||||
?XA("input", Attrs ++
|
?XA("input", Attrs ++
|
||||||
[?XMLATTR('type', Type),
|
[?XMLATTR(<<"type">>, Type),
|
||||||
?XMLATTR('name', Name),
|
?XMLATTR(<<"name">>, Name),
|
||||||
?XMLATTR('value', Value)])).
|
?XMLATTR(<<"value">>, Value)])).
|
||||||
|
|
||||||
%%%==================================
|
%%%==================================
|
||||||
%%%% get_acl_access
|
%%%% get_acl_access
|
||||||
@ -274,50 +274,50 @@ make_xhtml(Els, Host, Node, Lang, JID) ->
|
|||||||
MenuItems = make_navigation(Host, Node, Lang, JID),
|
MenuItems = make_navigation(Host, Node, Lang, JID),
|
||||||
{200, [html],
|
{200, [html],
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'html', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'html', attrs = [
|
||||||
exmpp_xml:attribute(?NS_XML, 'lang', Lang),
|
exmpp_xml:attribute(?NS_XML, <<"lang">>, Lang),
|
||||||
?XMLATTR('lang', Lang)], children =
|
?XMLATTR(<<"lang">>, Lang)], children =
|
||||||
[#xmlel{ns = ?NS_XHTML, name = 'head', children =
|
[#xmlel{ns = ?NS_XHTML, name = 'head', children =
|
||||||
[?XCT('title', "ejabberd Web Admin"),
|
[?XCT('title', "ejabberd Web Admin"),
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'meta', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'meta', attrs = [
|
||||||
?XMLATTR('http-equiv', <<"Content-Type">>),
|
?XMLATTR(<<"http-equiv">>, <<"Content-Type">>),
|
||||||
?XMLATTR('content', <<"text/html; charset=utf-8">>)]},
|
?XMLATTR(<<"content">>, <<"text/html; charset=utf-8">>)]},
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'script',
|
#xmlel{ns = ?NS_XHTML, name = 'script',
|
||||||
%% This children is to ensure exmpp puts: <script ...></script>
|
%% This children is to ensure exmpp puts: <script ...></script>
|
||||||
children = [?C(".")],
|
children = [?C(".")],
|
||||||
attrs = [
|
attrs = [
|
||||||
?XMLATTR('src', Base ++ "additions.js"),
|
?XMLATTR(<<"src">>, Base ++ "additions.js"),
|
||||||
?XMLATTR('type', <<"text/javascript">>)]},
|
?XMLATTR(<<"type">>, <<"text/javascript">>)]},
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'link', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'link', attrs = [
|
||||||
?XMLATTR('href', Base ++ "favicon.ico"),
|
?XMLATTR(<<"href">>, Base ++ "favicon.ico"),
|
||||||
?XMLATTR('type', <<"image/x-icon">>),
|
?XMLATTR(<<"type">>, <<"image/x-icon">>),
|
||||||
?XMLATTR('rel', <<"shortcut icon">>)]},
|
?XMLATTR(<<"rel">>, <<"shortcut icon">>)]},
|
||||||
#xmlel{ns = ?NS_XHTML, name = 'link', attrs = [
|
#xmlel{ns = ?NS_XHTML, name = 'link', attrs = [
|
||||||
?XMLATTR('href', Base ++ "style.css"),
|
?XMLATTR(<<"href">>, Base ++ "style.css"),
|
||||||
?XMLATTR('type', <<"text/css">>),
|
?XMLATTR(<<"type">>, <<"text/css">>),
|
||||||
?XMLATTR('rel', <<"stylesheet">>)]}]},
|
?XMLATTR(<<"rel">>, <<"stylesheet">>)]}]},
|
||||||
?XE('body',
|
?XE('body',
|
||||||
[?XAE('div',
|
[?XAE('div',
|
||||||
[?XMLATTR('id', <<"container">>)],
|
[?XMLATTR(<<"id">>, <<"container">>)],
|
||||||
[?XAE('div',
|
[?XAE('div',
|
||||||
[?XMLATTR('id', <<"header">>)],
|
[?XMLATTR(<<"id">>, <<"header">>)],
|
||||||
[?XE('h1',
|
[?XE('h1',
|
||||||
[?ACT("/admin/", "ejabberd Web Admin")]
|
[?ACT("/admin/", "ejabberd Web Admin")]
|
||||||
)]),
|
)]),
|
||||||
?XAE('div',
|
?XAE('div',
|
||||||
[?XMLATTR('id', <<"navigation">>)],
|
[?XMLATTR(<<"id">>, <<"navigation">>)],
|
||||||
[?XE('ul',
|
[?XE('ul',
|
||||||
MenuItems
|
MenuItems
|
||||||
)]),
|
)]),
|
||||||
?XAE('div',
|
?XAE('div',
|
||||||
[?XMLATTR('id', <<"content">>)],
|
[?XMLATTR(<<"id">>, <<"content">>)],
|
||||||
Els),
|
Els),
|
||||||
?XAE('div',
|
?XAE('div',
|
||||||
[?XMLATTR('id', <<"clearcopyright">>)],
|
[?XMLATTR(<<"id">>, <<"clearcopyright">>)],
|
||||||
[#xmlcdata{cdata = <<>>}])]),
|
[#xmlcdata{cdata = <<>>}])]),
|
||||||
?XAE('div',
|
?XAE('div',
|
||||||
[?XMLATTR('id', <<"copyrightouter">>)],
|
[?XMLATTR(<<"id">>, <<"copyrightouter">>)],
|
||||||
[?XAE('div',
|
[?XAE('div',
|
||||||
[?XMLATTR('id', <<"copyright">>)],
|
[?XMLATTR(<<"id">>, <<"copyright">>)],
|
||||||
[?XC('p',
|
[?XC('p',
|
||||||
"ejabberd (c) 2002-2010 ProcessOne")
|
"ejabberd (c) 2002-2010 ProcessOne")
|
||||||
])])])
|
])])])
|
||||||
@ -837,7 +837,7 @@ process_admin(Host,
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?TEXTAREA("acls", integer_to_list(lists:max([16, NumLines])), "80", ACLsP++"."),
|
[?TEXTAREA("acls", integer_to_list(lists:max([16, NumLines])), "80", ACLsP++"."),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
@ -879,7 +879,7 @@ process_admin(Host,
|
|||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XE('p', [?ACT("../acls-raw/", "Raw")])] ++
|
[?XE('p', [?ACT("../acls-raw/", "Raw")])] ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[acls_to_xhtml(ACLs),
|
[acls_to_xhtml(ACLs),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "delete", "Delete Selected"),
|
?INPUTT("submit", "delete", "Delete Selected"),
|
||||||
@ -946,7 +946,7 @@ process_admin(Host,
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?TEXTAREA("access", integer_to_list(lists:max([16, NumLines])), "80", AccessP++"."),
|
[?TEXTAREA("access", integer_to_list(lists:max([16, NumLines])), "80", AccessP++"."),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
@ -983,7 +983,7 @@ process_admin(Host,
|
|||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XE('p', [?ACT("../access-raw/", "Raw")])] ++
|
[?XE('p', [?ACT("../access-raw/", "Raw")])] ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[access_rules_to_xhtml(AccessRules, Lang),
|
[access_rules_to_xhtml(AccessRules, Lang),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "delete", "Delete Selected")
|
?INPUTT("submit", "delete", "Delete Selected")
|
||||||
@ -1023,7 +1023,7 @@ process_admin(Host,
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[access_rule_to_xhtml(Rules),
|
[access_rule_to_xhtml(Rules),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "submit", "Submit")
|
?INPUTT("submit", "submit", "Submit")
|
||||||
@ -1079,17 +1079,17 @@ process_admin(Host,
|
|||||||
list_last_activity(Host, Lang, true, Month)
|
list_last_activity(Host, Lang, true, Month)
|
||||||
end,
|
end,
|
||||||
make_xhtml([?XCT('h1', "Users Last Activity")] ++
|
make_xhtml([?XCT('h1', "Users Last Activity")] ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?CT("Period: "),
|
[?CT("Period: "),
|
||||||
?XAE('select', [?XMLATTR('name', <<"period">>)],
|
?XAE('select', [?XMLATTR(<<"name">>, <<"period">>)],
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({O, V}) ->
|
fun({O, V}) ->
|
||||||
Sel = if
|
Sel = if
|
||||||
O == Month -> [?XMLATTR('selected', <<"selected">>)];
|
O == Month -> [?XMLATTR(<<"selected">>, <<"selected">>)];
|
||||||
true -> []
|
true -> []
|
||||||
end,
|
end,
|
||||||
?XAC('option',
|
?XAC('option',
|
||||||
Sel ++ [?XMLATTR('value', O)], V)
|
Sel ++ [?XMLATTR(<<"value">>, O)], V)
|
||||||
end, [{"month", ?T("Last month")},
|
end, [{"month", ?T("Last month")},
|
||||||
{"year", ?T("Last year")},
|
{"year", ?T("Last year")},
|
||||||
{"all", ?T("All activity")}])),
|
{"all", ?T("All activity")}])),
|
||||||
@ -1245,15 +1245,15 @@ acl_spec_to_xhtml(ID, Spec) ->
|
|||||||
|
|
||||||
acl_spec_select(ID, Opt) ->
|
acl_spec_select(ID, Opt) ->
|
||||||
?XE('td',
|
?XE('td',
|
||||||
[?XAE('select', [?XMLATTR('name', "type" ++ ID)],
|
[?XAE('select', [?XMLATTR(<<"name">>, "type" ++ ID)],
|
||||||
lists:map(
|
lists:map(
|
||||||
fun(O) ->
|
fun(O) ->
|
||||||
Sel = if
|
Sel = if
|
||||||
O == Opt -> [?XMLATTR('selected', <<"selected">>)];
|
O == Opt -> [?XMLATTR(<<"selected">>, <<"selected">>)];
|
||||||
true -> []
|
true -> []
|
||||||
end,
|
end,
|
||||||
?XAC('option',
|
?XAC('option',
|
||||||
Sel ++ [?XMLATTR('value', O)],
|
Sel ++ [?XMLATTR(<<"value">>, O)],
|
||||||
atom_to_list(O))
|
atom_to_list(O))
|
||||||
end, [user, server, user_regexp, server_regexp,
|
end, [user, server, user_regexp, server_regexp,
|
||||||
node_regexp, user_glob, server_glob, node_glob, all, raw]))]).
|
node_regexp, user_glob, server_glob, node_glob, all, raw]))]).
|
||||||
@ -1454,9 +1454,9 @@ access_rule_to_xhtml(Rules) ->
|
|||||||
SACL = atom_to_list(ACL),
|
SACL = atom_to_list(ACL),
|
||||||
SAccess ++ "\s\t" ++ SACL ++ "\n"
|
SAccess ++ "\s\t" ++ SACL ++ "\n"
|
||||||
end, Rules),
|
end, Rules),
|
||||||
?XAC('textarea', [?XMLATTR('name', <<"rules">>),
|
?XAC('textarea', [?XMLATTR(<<"name">>, <<"rules">>),
|
||||||
?XMLATTR('rows', <<"16">>),
|
?XMLATTR(<<"rows">>, <<"16">>),
|
||||||
?XMLATTR('cols', <<"80">>)],
|
?XMLATTR(<<"cols">>, <<"80">>)],
|
||||||
Text).
|
Text).
|
||||||
|
|
||||||
parse_access_rule(Text) ->
|
parse_access_rule(Text) ->
|
||||||
@ -1546,7 +1546,7 @@ list_users(Host, Query, Lang, URLFunc) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XE('table',
|
[?XE('table',
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
[?XC('td', ?T("User") ++ ":"),
|
[?XC('td', ?T("User") ++ ":"),
|
||||||
@ -1560,7 +1560,7 @@ list_users(Host, Query, Lang, URLFunc) ->
|
|||||||
]),
|
]),
|
||||||
?XE('tr',
|
?XE('tr',
|
||||||
[?X('td'),
|
[?X('td'),
|
||||||
?XAE('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAE('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
[?INPUTT("submit", "addnewuser", "Add User")]),
|
[?INPUTT("submit", "addnewuser", "Add User")]),
|
||||||
?X('td')
|
?X('td')
|
||||||
])]),
|
])]),
|
||||||
@ -1796,7 +1796,7 @@ user_info(User, Server, Query, Lang) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XCT('h3', "Connected Resources:")] ++ FResources ++
|
[?XCT('h3', "Connected Resources:")] ++ FResources ++
|
||||||
[?XCT('h3', "Password:")] ++ FPassword ++
|
[?XCT('h3', "Password:")] ++ FPassword ++
|
||||||
[?XCT('h3', "Last Activity")] ++ [?C(LastActivity)] ++
|
[?XCT('h3', "Last Activity")] ++ [?C(LastActivity)] ++
|
||||||
@ -1876,9 +1876,9 @@ list_last_activity(Host, Lang, Integral, Period) ->
|
|||||||
end,
|
end,
|
||||||
Max = lists:max(Hist),
|
Max = lists:max(Hist),
|
||||||
[?XAE('ol',
|
[?XAE('ol',
|
||||||
[?XMLATTR('id', <<"lastactivity">>), ?XMLATTR('start', <<"0">>)],
|
[?XMLATTR(<<"id">>, <<"lastactivity">>), ?XMLATTR(<<"start">>, <<"0">>)],
|
||||||
[?XAE('li',
|
[?XAE('li',
|
||||||
[?XMLATTR('style',
|
[?XMLATTR(<<"style">>,
|
||||||
"width:" ++ integer_to_list(
|
"width:" ++ integer_to_list(
|
||||||
trunc(90 * V / Max)) ++ "%;")],
|
trunc(90 * V / Max)) ++ "%;")],
|
||||||
[#xmlcdata{cdata = list_to_binary(pretty_string_int(V))}])
|
[#xmlcdata{cdata = list_to_binary(pretty_string_int(V))}])
|
||||||
@ -1934,13 +1934,13 @@ get_miscopts(Lang, Method, Query) ->
|
|||||||
end ++
|
end ++
|
||||||
[
|
[
|
||||||
?XCT("h2", "Global"),
|
?XCT("h2", "Global"),
|
||||||
?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[options_to_xhtml("global", GlobalOptions, Lang),
|
[options_to_xhtml("global", GlobalOptions, Lang),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "deleteglobal", "Delete Selected")
|
?INPUTT("submit", "deleteglobal", "Delete Selected")
|
||||||
]),
|
]),
|
||||||
?XCT("h2", "Local"),
|
?XCT("h2", "Local"),
|
||||||
?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[options_to_xhtml("local", LocalOptions, Lang),
|
[options_to_xhtml("local", LocalOptions, Lang),
|
||||||
?BR,
|
?BR,
|
||||||
?INPUTT("submit", "deletelocal", "Delete Selected")
|
?INPUTT("submit", "deletelocal", "Delete Selected")
|
||||||
@ -2076,7 +2076,7 @@ get_miscopt(Lang, Query, SType, OldSKey) ->
|
|||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XCT("h2", UpSType),
|
[?XCT("h2", UpSType),
|
||||||
?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?TEXTAREA("miscopt", integer_to_list(lists:max([16, NumLines])),
|
[?TEXTAREA("miscopt", integer_to_list(lists:max([16, NumLines])),
|
||||||
"80", SOpt++"."),
|
"80", SOpt++"."),
|
||||||
?BR,
|
?BR,
|
||||||
@ -2163,7 +2163,7 @@ get_node(global, Node, [], Query, Lang) ->
|
|||||||
?LI([?ACT(Base ++ "stats/", "Statistics")]),
|
?LI([?ACT(Base ++ "stats/", "Statistics")]),
|
||||||
?LI([?ACT(Base ++ "update/", "Update")])
|
?LI([?ACT(Base ++ "update/", "Update")])
|
||||||
] ++ MenuItems2),
|
] ++ MenuItems2),
|
||||||
?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?INPUTT('submit', "restart", "Restart"),
|
[?INPUTT('submit', "restart", "Restart"),
|
||||||
?C(" "),
|
?C(" "),
|
||||||
?INPUTT('submit', "stop", "Stop")])
|
?INPUTT('submit', "stop", "Stop")])
|
||||||
@ -2215,15 +2215,15 @@ get_node(global, Node, ["db"], Query, Lang) ->
|
|||||||
[?XC('td', STable),
|
[?XC('td', STable),
|
||||||
?XE('td', [db_storage_select(
|
?XE('td', [db_storage_select(
|
||||||
STable, Type, Lang)]),
|
STable, Type, Lang)]),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(Size)),
|
pretty_string_int(Size)),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(Memory))
|
pretty_string_int(Memory))
|
||||||
])
|
])
|
||||||
end, STables),
|
end, STables),
|
||||||
[?XC('h1', ?T("Database Tables at ") ++ atom_to_list(Node))] ++
|
[?XC('h1', ?T("Database Tables at ") ++ atom_to_list(Node))] ++
|
||||||
ResS ++
|
ResS ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XAE('table', [],
|
[?XAE('table', [],
|
||||||
[?XE('thead',
|
[?XE('thead',
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
@ -2235,8 +2235,8 @@ get_node(global, Node, ["db"], Query, Lang) ->
|
|||||||
?XE('tbody',
|
?XE('tbody',
|
||||||
Rows ++
|
Rows ++
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
[?XAE('td', [?XMLATTR('colspan', <<"4">>),
|
[?XAE('td', [?XMLATTR(<<"colspan">>, <<"4">>),
|
||||||
?XMLATTR('class', <<"alignright">>)],
|
?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
[?INPUTT("submit", "submit",
|
[?INPUTT("submit", "submit",
|
||||||
"Submit")])
|
"Submit")])
|
||||||
])]
|
])]
|
||||||
@ -2258,7 +2258,7 @@ get_node(global, Node, ["backup"], Query, Lang) ->
|
|||||||
[?XC('h1', ?T("Backup of ") ++ atom_to_list(Node))] ++
|
[?XC('h1', ?T("Backup of ") ++ atom_to_list(Node))] ++
|
||||||
ResS ++
|
ResS ++
|
||||||
[?XCT('p', "Please note that these options will only backup the builtin Mnesia database. If you are using the ODBC module, you also need to backup your SQL database separately."),
|
[?XCT('p', "Please note that these options will only backup the builtin Mnesia database. If you are using the ODBC module, you also need to backup your SQL database separately."),
|
||||||
?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[?XAE('table', [],
|
[?XAE('table', [],
|
||||||
[?XE('tbody',
|
[?XE('tbody',
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
@ -2351,7 +2351,7 @@ get_node(global, Node, ["pid"], _Query, Lang) ->
|
|||||||
?XAE('table', [],
|
?XAE('table', [],
|
||||||
[?XE('tbody',
|
[?XE('tbody',
|
||||||
[?XE('tr', [?XCT('td', "Number of processes:"),
|
[?XE('tr', [?XCT('td', "Number of processes:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(ProcessesNumber))])
|
pretty_string_int(ProcessesNumber))])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@ -2426,7 +2426,7 @@ get_node(global, Node, ["ports"], Query, Lang) ->
|
|||||||
{error, ReasonT} -> [?XRES(?T("Error") ++ ": " ++ ReasonT)];
|
{error, ReasonT} -> [?XRES(?T("Error") ++ ": " ++ ReasonT)];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[node_ports_to_xhtml(NewPorts, Lang)])
|
[node_ports_to_xhtml(NewPorts, Lang)])
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -2450,7 +2450,7 @@ get_node(Host, Node, ["modules"], Query, Lang) when is_list(Host) ->
|
|||||||
error -> [?XREST("Bad format")];
|
error -> [?XREST("Bad format")];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[node_modules_to_xhtml(NewModules, Lang)])
|
[node_modules_to_xhtml(NewModules, Lang)])
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -2473,25 +2473,25 @@ get_node(global, Node, ["stats"], _Query, Lang) ->
|
|||||||
?XAE('table', [],
|
?XAE('table', [],
|
||||||
[?XE('tbody',
|
[?XE('tbody',
|
||||||
[?XE('tr', [?XCT('td', "Uptime:"),
|
[?XE('tr', [?XCT('td', "Uptime:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
UpTimeS)]),
|
UpTimeS)]),
|
||||||
?XE('tr', [?XCT('td', "CPU Time:"),
|
?XE('tr', [?XCT('td', "CPU Time:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
CPUTimeS)]),
|
CPUTimeS)]),
|
||||||
?XE('tr', [?XCT('td', "Online Users:"),
|
?XE('tr', [?XCT('td', "Online Users:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(OnlineUsers))]),
|
pretty_string_int(OnlineUsers))]),
|
||||||
?XE('tr', [?XCT('td', "Transactions Committed:"),
|
?XE('tr', [?XCT('td', "Transactions Committed:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(TransactionsCommitted))]),
|
pretty_string_int(TransactionsCommitted))]),
|
||||||
?XE('tr', [?XCT('td', "Transactions Aborted:"),
|
?XE('tr', [?XCT('td', "Transactions Aborted:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(TransactionsAborted))]),
|
pretty_string_int(TransactionsAborted))]),
|
||||||
?XE('tr', [?XCT('td', "Transactions Restarted:"),
|
?XE('tr', [?XCT('td', "Transactions Restarted:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(TransactionsRestarted))]),
|
pretty_string_int(TransactionsRestarted))]),
|
||||||
?XE('tr', [?XCT('td', "Transactions Logged:"),
|
?XE('tr', [?XCT('td', "Transactions Logged:"),
|
||||||
?XAC('td', [?XMLATTR('class', <<"alignright">>)],
|
?XAC('td', [?XMLATTR(<<"class">>, <<"alignright">>)],
|
||||||
pretty_string_int(TransactionsLogged))])
|
pretty_string_int(TransactionsLogged))])
|
||||||
])
|
])
|
||||||
])];
|
])];
|
||||||
@ -2525,13 +2525,13 @@ get_node(global, Node, ["update"], Query, Lang) ->
|
|||||||
[?BR,
|
[?BR,
|
||||||
?INPUTATTRS(<<"button">>, <<"selectall">>,
|
?INPUTATTRS(<<"button">>, <<"selectall">>,
|
||||||
<<"Select All">>,
|
<<"Select All">>,
|
||||||
[?XMLATTR('onClick', <<"selectAll()">>)]),
|
[?XMLATTR(<<"onClick">>, <<"selectAll()">>)]),
|
||||||
?C(" "),
|
?C(" "),
|
||||||
?INPUTATTRS(<<"button">>, <<"unselectall">>,
|
?INPUTATTRS(<<"button">>, <<"unselectall">>,
|
||||||
<<"Unselect All">>,
|
<<"Unselect All">>,
|
||||||
[?XMLATTR('onClick', <<"unSelectAll()">>)])],
|
[?XMLATTR(<<"onClick">>, <<"unSelectAll()">>)])],
|
||||||
%%?XE("ul", BeamsLis)
|
%%?XE("ul", BeamsLis)
|
||||||
?XAE('ul', [?XMLATTR('class', <<"noliststyle">>)],
|
?XAE('ul', [?XMLATTR(<<"class">>, <<"noliststyle">>)],
|
||||||
BeamsLis ++ SelectButtons)
|
BeamsLis ++ SelectButtons)
|
||||||
end,
|
end,
|
||||||
FmtScript = ?XC('pre', io_lib:format("~p", [Script])),
|
FmtScript = ?XC('pre', io_lib:format("~p", [Script])),
|
||||||
@ -2542,7 +2542,7 @@ get_node(global, Node, ["update"], Query, Lang) ->
|
|||||||
{error, ErrorText} -> [?XREST("Error: " ++ ErrorText)];
|
{error, ErrorText} -> [?XREST("Error: " ++ ErrorText)];
|
||||||
nothing -> []
|
nothing -> []
|
||||||
end ++
|
end ++
|
||||||
[?XAE('form', [?XMLATTR('action', <<>>), ?XMLATTR('method', <<"post">>)],
|
[?XAE('form', [?XMLATTR(<<"action">>, <<>>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[
|
[
|
||||||
?XCT('h2', "Update plan"),
|
?XCT('h2', "Update plan"),
|
||||||
?XCT('h3', "Modified modules"), Mods,
|
?XCT('h3', "Modified modules"), Mods,
|
||||||
@ -2592,15 +2592,15 @@ node_parse_query(Node, Query) ->
|
|||||||
|
|
||||||
|
|
||||||
db_storage_select(ID, Opt, Lang) ->
|
db_storage_select(ID, Opt, Lang) ->
|
||||||
?XAE('select', [?XMLATTR('name', "table" ++ ID)],
|
?XAE('select', [?XMLATTR(<<"name">>, "table" ++ ID)],
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({O, Desc}) ->
|
fun({O, Desc}) ->
|
||||||
Sel = if
|
Sel = if
|
||||||
O == Opt -> [?XMLATTR('selected', <<"selected">>)];
|
O == Opt -> [?XMLATTR(<<"selected">>, <<"selected">>)];
|
||||||
true -> []
|
true -> []
|
||||||
end,
|
end,
|
||||||
?XACT('option',
|
?XACT('option',
|
||||||
Sel ++ [?XMLATTR('value', O)],
|
Sel ++ [?XMLATTR(<<"value">>, O)],
|
||||||
Desc)
|
Desc)
|
||||||
end, [{ram_copies, "RAM copy"},
|
end, [{ram_copies, "RAM copy"},
|
||||||
{disc_copies, "RAM and disc copy"},
|
{disc_copies, "RAM and disc copy"},
|
||||||
@ -2713,7 +2713,7 @@ node_backup_parse_query(Node, Query) ->
|
|||||||
"import_piefxis_file", "export_piefxis_dir", "export_piefxis_host_dir"]).
|
"import_piefxis_file", "export_piefxis_dir", "export_piefxis_host_dir"]).
|
||||||
|
|
||||||
node_ports_to_xhtml(Ports, Lang) ->
|
node_ports_to_xhtml(Ports, Lang) ->
|
||||||
?XAE('table', [?XMLATTR('class', <<"withtextareas">>)],
|
?XAE('table', [?XMLATTR(<<"class">>, <<"withtextareas">>)],
|
||||||
[?XE('thead',
|
[?XE('thead',
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
[?XCT('td', "Port"),
|
[?XCT('td', "Port"),
|
||||||
@ -2731,9 +2731,9 @@ node_ports_to_xhtml(Ports, Lang) ->
|
|||||||
{NumLines, SOptsClean} = term_to_paragraph(OptsClean, 40),
|
{NumLines, SOptsClean} = term_to_paragraph(OptsClean, 40),
|
||||||
%%ID = term_to_id(E),
|
%%ID = term_to_id(E),
|
||||||
?XE('tr',
|
?XE('tr',
|
||||||
[?XAE('td', [?XMLATTR('size', <<"6">>)], [?C(SPort)]),
|
[?XAE('td', [?XMLATTR(<<"size">>, <<"6">>)], [?C(SPort)]),
|
||||||
?XAE('td', [?XMLATTR('size', <<"15">>)], [?C(SIP)]),
|
?XAE('td', [?XMLATTR(<<"size">>, <<"15">>)], [?C(SIP)]),
|
||||||
?XAE('td', [?XMLATTR('size', <<"4">>)], [?C(atom_to_list(NetProt))]),
|
?XAE('td', [?XMLATTR(<<"size">>, <<"4">>)], [?C(atom_to_list(NetProt))]),
|
||||||
?XE('td', [?INPUTS("text", "module" ++ SSPort,
|
?XE('td', [?INPUTS("text", "module" ++ SSPort,
|
||||||
SModule, "15")]),
|
SModule, "15")]),
|
||||||
?XE('td', [?TEXTAREA("opts" ++ SSPort, integer_to_list(NumLines), "35", SOptsClean)]),
|
?XE('td', [?TEXTAREA("opts" ++ SSPort, integer_to_list(NumLines), "35", SOptsClean)]),
|
||||||
@ -2750,22 +2750,22 @@ node_ports_to_xhtml(Ports, Lang) ->
|
|||||||
?XE("td", [make_netprot_html("tcp")]),
|
?XE("td", [make_netprot_html("tcp")]),
|
||||||
?XE('td', [?INPUTS("text", "modulenew", "", "15")]),
|
?XE('td', [?INPUTS("text", "modulenew", "", "15")]),
|
||||||
?XE('td', [?TEXTAREA("optsnew", "2", "35", "[]")]),
|
?XE('td', [?TEXTAREA("optsnew", "2", "35", "[]")]),
|
||||||
?XAE('td', [?XMLATTR("colspan", "2")],
|
?XAE('td', [?XMLATTR(<<"colspan">>, "2")],
|
||||||
[?INPUTT("submit", "addnew", "Add New")])
|
[?INPUTT("submit", "addnew", "Add New")])
|
||||||
]
|
]
|
||||||
)]
|
)]
|
||||||
)]).
|
)]).
|
||||||
|
|
||||||
make_netprot_html(NetProt) ->
|
make_netprot_html(NetProt) ->
|
||||||
?XAE('select', [?XMLATTR('name', "netprotnew")],
|
?XAE('select', [?XMLATTR(<<"name">>, "netprotnew")],
|
||||||
lists:map(
|
lists:map(
|
||||||
fun(O) ->
|
fun(O) ->
|
||||||
Sel = if
|
Sel = if
|
||||||
O == NetProt -> [?XMLATTR('selected', <<"selected">>)];
|
O == NetProt -> [?XMLATTR(<<"selected">>, <<"selected">>)];
|
||||||
true -> []
|
true -> []
|
||||||
end,
|
end,
|
||||||
?XAC('option',
|
?XAC('option',
|
||||||
Sel ++ [?XMLATTR('value', O)],
|
Sel ++ [?XMLATTR(<<"value">>, O)],
|
||||||
O)
|
O)
|
||||||
end, ["tcp", "udp"])).
|
end, ["tcp", "udp"])).
|
||||||
|
|
||||||
@ -2843,7 +2843,7 @@ node_ports_parse_query(Node, Ports, Query) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
node_modules_to_xhtml(Modules, Lang) ->
|
node_modules_to_xhtml(Modules, Lang) ->
|
||||||
?XAE('table', [?XMLATTR('class', <<"withtextareas">>)],
|
?XAE('table', [?XMLATTR(<<"class">>, <<"withtextareas">>)],
|
||||||
[?XE('thead',
|
[?XE('thead',
|
||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
[?XCT('td', "Module"),
|
[?XCT('td', "Module"),
|
||||||
@ -2868,7 +2868,7 @@ node_modules_to_xhtml(Modules, Lang) ->
|
|||||||
[?XE('tr',
|
[?XE('tr',
|
||||||
[?XE('td', [?INPUT("text", "modulenew", "")]),
|
[?XE('td', [?INPUT("text", "modulenew", "")]),
|
||||||
?XE('td', [?TEXTAREA("optsnew", "2", "40", "[]")]),
|
?XE('td', [?TEXTAREA("optsnew", "2", "40", "[]")]),
|
||||||
?XAE('td', [?XMLATTR("colspan", "2")],
|
?XAE('td', [?XMLATTR(<<"colspan">>, "2")],
|
||||||
[?INPUTT("submit", "start", "Start")])
|
[?INPUTT("submit", "start", "Start")])
|
||||||
]
|
]
|
||||||
)]
|
)]
|
||||||
@ -3103,17 +3103,17 @@ make_menu_items2(Lang, Deep, {MURI, MName, [Item | Items]}, Res) ->
|
|||||||
make_menu_items2(Lang, Deep, {MURI, MName, Items}, Res2).
|
make_menu_items2(Lang, Deep, {MURI, MName, Items}, Res2).
|
||||||
|
|
||||||
make_menu_item(header, 1, URI, Name, _Lang) ->
|
make_menu_item(header, 1, URI, Name, _Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navhead">>)], [?AC(URI, Name)] )]);
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navhead">>)], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(header, 2, URI, Name, _Lang) ->
|
make_menu_item(header, 2, URI, Name, _Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navheadsub">>)], [?AC(URI, Name)] )]);
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navheadsub">>)], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(header, 3, URI, Name, _Lang) ->
|
make_menu_item(header, 3, URI, Name, _Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navheadsubsub">>)], [?AC(URI, Name)] )]);
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navheadsubsub">>)], [?AC(URI, Name)] )]);
|
||||||
make_menu_item(item, 1, URI, Name, Lang) ->
|
make_menu_item(item, 1, URI, Name, Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navitem">>)], [?ACT(URI, Name)] )]);
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navitem">>)], [?ACT(URI, Name)] )]);
|
||||||
make_menu_item(item, 2, URI, Name, Lang) ->
|
make_menu_item(item, 2, URI, Name, Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navitemsub">>)], [?ACT(URI, Name)] )]);
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navitemsub">>)], [?ACT(URI, Name)] )]);
|
||||||
make_menu_item(item, 3, URI, Name, Lang) ->
|
make_menu_item(item, 3, URI, Name, Lang) ->
|
||||||
?LI([?XAE('div', [?XMLATTR('id', <<"navitemsubsub">>)], [?ACT(URI, Name)] )]).
|
?LI([?XAE('div', [?XMLATTR(<<"id">>, <<"navitemsubsub">>)], [?ACT(URI, Name)] )]).
|
||||||
|
|
||||||
%%%==================================
|
%%%==================================
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ get_human_html_xmlel() ->
|
|||||||
Par1 = #xmlel{name = p, children =
|
Par1 = #xmlel{name = p, children =
|
||||||
[#xmlcdata{cdata = <<"An implementation of ">>},
|
[#xmlcdata{cdata = <<"An implementation of ">>},
|
||||||
#xmlel{name = a,
|
#xmlel{name = a,
|
||||||
attrs = [#xmlattr{name=href, value = <<"http://xmpp.org/extensions/xep-0206.html">>}],
|
attrs = [#xmlattr{name = <<"href">>, value = <<"http://xmpp.org/extensions/xep-0206.html">>}],
|
||||||
children = [#xmlcdata{cdata = <<"XMPP over BOSH (XEP-0206)">>}]
|
children = [#xmlcdata{cdata = <<"XMPP over BOSH (XEP-0206)">>}]
|
||||||
}
|
}
|
||||||
]},
|
]},
|
||||||
@ -95,7 +95,7 @@ get_human_html_xmlel() ->
|
|||||||
"To use HTTP-Bind you need a Jabber/XMPP client that supports it.">>}
|
"To use HTTP-Bind you need a Jabber/XMPP client that supports it.">>}
|
||||||
]},
|
]},
|
||||||
#xmlel{name = html,
|
#xmlel{name = html,
|
||||||
attrs = [#xmlattr{name = xmlns, value= <<"http://www.w3.org/1999/xhtml">>}],
|
attrs = [#xmlattr{name = <<"xmlns">>, value= <<"http://www.w3.org/1999/xhtml">>}],
|
||||||
children =
|
children =
|
||||||
[#xmlel{name = head, children = [#xmlel{name = title, children = [#xmlcdata{cdata = Heading}]}]},
|
[#xmlel{name = head, children = [#xmlel{name = title, children = [#xmlcdata{cdata = Heading}]}]},
|
||||||
#xmlel{name = body, children = [H, Par1, Par2]}]}.
|
#xmlel{name = body, children = [H, Par1, Par2]}]}.
|
||||||
|
@ -159,13 +159,13 @@ css() ->
|
|||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
make_xa_link_css() ->
|
make_xa_link_css() ->
|
||||||
?XA('link', [?XMLATTR('href', <<"/register/register.css">>),
|
?XA('link', [?XMLATTR(<<"href">>, <<"/register/register.css">>),
|
||||||
?XMLATTR('type', <<"text/css">>),
|
?XMLATTR(<<"type">>, <<"text/css">>),
|
||||||
?XMLATTR('rel', <<"stylesheet">>)]).
|
?XMLATTR(<<"rel">>, <<"stylesheet">>)]).
|
||||||
|
|
||||||
make_h1_title(TextString, Lang) ->
|
make_h1_title(TextString, Lang) ->
|
||||||
?XACT('h1',
|
?XACT('h1',
|
||||||
[?XMLATTR('class', <<"title">>), ?XMLATTR('style', <<"text-align:center;">>)],
|
[?XMLATTR(<<"class">>, <<"title">>), ?XMLATTR(<<"style">>, <<"text-align:center;">>)],
|
||||||
TextString).
|
TextString).
|
||||||
|
|
||||||
index_page(Lang) ->
|
index_page(Lang) ->
|
||||||
@ -205,7 +205,7 @@ form_new_get(Host, Lang) ->
|
|||||||
"Please read carefully the instructions to fill correctly the fields."),
|
"Please read carefully the instructions to fill correctly the fields."),
|
||||||
%% <!-- JID's take the form of 'username@server.com'. For example, my JID is 'kirjava@jabber.org'.
|
%% <!-- JID's take the form of 'username@server.com'. For example, my JID is 'kirjava@jabber.org'.
|
||||||
%% The maximum length for a JID is 255 characters. -->
|
%% The maximum length for a JID is 255 characters. -->
|
||||||
?XAE('form', [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[
|
[
|
||||||
?XE('ol', [
|
?XE('ol', [
|
||||||
?XE('li', [
|
?XE('li', [
|
||||||
@ -364,7 +364,7 @@ form_changepass_get(Host, Lang) ->
|
|||||||
],
|
],
|
||||||
Els=[
|
Els=[
|
||||||
make_h1_title("Change Password", Lang),
|
make_h1_title("Change Password", Lang),
|
||||||
?XAE('form', [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[
|
[
|
||||||
?XE('ol', [
|
?XE('ol', [
|
||||||
?XE('li', [
|
?XE('li', [
|
||||||
@ -482,7 +482,7 @@ form_del_get(Host, Lang) ->
|
|||||||
make_h1_title("Unregister a Jabber account", Lang),
|
make_h1_title("Unregister a Jabber account", Lang),
|
||||||
?XCT('p',
|
?XCT('p',
|
||||||
"This page allows to unregister a Jabber account in this Jabber server."),
|
"This page allows to unregister a Jabber account in this Jabber server."),
|
||||||
?XAE('form', [?XMLATTR('action', <<"">>), ?XMLATTR('method', <<"post">>)],
|
?XAE('form', [?XMLATTR(<<"action">>, <<"">>), ?XMLATTR(<<"method">>, <<"post">>)],
|
||||||
[
|
[
|
||||||
?XE('ol', [
|
?XE('ol', [
|
||||||
?XE('li', [
|
?XE('li', [
|
||||||
|
Loading…
Reference in New Issue
Block a user