25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

* src/mod_irc/mod_irc_connection.erl: Added /msg and /ctcp

commands, improved handling of channel topic and kick, mirc colors
now filtered, other minor improvements (thanks to Oleg
V. Motienko)

* src/mod_configure.erl: Improved strings (thanks to Sander
Devrieze)
* src/mod_vcard.erl: Likewise
* src/mod_vcard_ldap.erl: Likewise
* src/mod_vcard_odbc.erl: Likewise
* src/web/ejabberd_web_admin.erl: Likewise

SVN Revision: 508
This commit is contained in:
Alexey Shchepin 2006-02-18 19:56:16 +00:00
parent 0234b83be4
commit 44fdd72041
7 changed files with 289 additions and 174 deletions

View File

@ -1,3 +1,17 @@
2006-02-18 Alexey Shchepin <alexey@sevcom.net>
* src/mod_irc/mod_irc_connection.erl: Added /msg and /ctcp
commands, improved handling of channel topic and kick, mirc colors
now filtered, other minor improvements (thanks to Oleg
V. Motienko)
* src/mod_configure.erl: Improved strings (thanks to Sander
Devrieze)
* src/mod_vcard.erl: Likewise
* src/mod_vcard_ldap.erl: Likewise
* src/mod_vcard_odbc.erl: Likewise
* src/web/ejabberd_web_admin.erl: Likewise
2006-02-15 Alexey Shchepin <alexey@sevcom.net> 2006-02-15 Alexey Shchepin <alexey@sevcom.net>
* src/mod_service_log.erl: Bugfix (thanks to Badlop) * src/mod_service_log.erl: Bugfix (thanks to Badlop)

View File

@ -385,7 +385,7 @@ get_local_items(_Host, [], Server, Lang) ->
[?NODE("Configuration", "config"), [?NODE("Configuration", "config"),
?NODE("Online Users", "online users"), ?NODE("Online Users", "online users"),
?NODE("All Users", "all users"), ?NODE("All Users", "all users"),
?NODE("Outgoing S2S connections", "outgoing s2s"), ?NODE("Outgoing s2s Connections", "outgoing s2s"),
?NODE("Running Nodes", "running nodes"), ?NODE("Running Nodes", "running nodes"),
?NODE("Stopped Nodes", "stopped nodes") ?NODE("Stopped Nodes", "stopped nodes")
]}; ]};
@ -446,10 +446,10 @@ get_local_items(_Host, ["stopped nodes"], _Server, Lang) ->
get_local_items(_Host, ["running nodes", ENode], Server, Lang) -> get_local_items(_Host, ["running nodes", ENode], Server, Lang) ->
{result, {result,
[?NODE("DB", "running nodes/" ++ ENode ++ "/DB"), [?NODE("Database", "running nodes/" ++ ENode ++ "/DB"),
?NODE("Modules", "running nodes/" ++ ENode ++ "/modules"), ?NODE("Modules", "running nodes/" ++ ENode ++ "/modules"),
?NODE("Backup Management", "running nodes/" ++ ENode ++ "/backup"), ?NODE("Backup Management", "running nodes/" ++ ENode ++ "/backup"),
?NODE("Import users from jabberd1.4 spool files", ?NODE("Import Users From jabberd 1.4 Spool Files",
"running nodes/" ++ ENode ++ "/import") "running nodes/" ++ ENode ++ "/import")
]}; ]};
@ -744,7 +744,7 @@ get_form(_Host, ["running nodes", ENode, "DB"], Lang) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, [{xmlcdata,
translate:translate( translate:translate(
Lang, "DB Tables Configuration at ") ++ Lang, "Database Tables Configuration at ") ++
ENode}]}, ENode}]},
{xmlelement, "instructions", [], {xmlelement, "instructions", [],
[{xmlcdata, [{xmlcdata,

View File

@ -115,7 +115,7 @@ open_socket(init, StateData) ->
wait_for_registration(closed, StateData) -> wait_for_registration(closed, StateData) ->
{stop, normal, StateData}. {stop, normal, StateData}.
stream_established({xmlstreamend, Name}, StateData) -> stream_established({xmlstreamend, _Name}, StateData) ->
{stop, normal, StateData}; {stop, normal, StateData};
stream_established(timeout, StateData) -> stream_established(timeout, StateData) ->
@ -145,7 +145,7 @@ stream_established(closed, StateData) ->
%% {next_state, NextStateName, NextStateData, Timeout} | %% {next_state, NextStateName, NextStateData, Timeout} |
%% {stop, Reason, NewStateData} %% {stop, Reason, NewStateData}
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_event(Event, StateName, StateData) -> handle_event(_Event, StateName, StateData) ->
{next_state, StateName, StateData}. {next_state, StateName, StateData}.
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
@ -157,11 +157,11 @@ handle_event(Event, StateName, StateData) ->
%% {stop, Reason, NewStateData} | %% {stop, Reason, NewStateData} |
%% {stop, Reason, Reply, NewStateData} %% {stop, Reason, Reply, NewStateData}
%%---------------------------------------------------------------------- %%----------------------------------------------------------------------
handle_sync_event(Event, From, StateName, StateData) -> handle_sync_event(_Event, _From, StateName, StateData) ->
Reply = ok, Reply = ok,
{reply, Reply, StateName, StateData}. {reply, Reply, StateName, StateData}.
code_change(OldVsn, StateName, StateData, Extra) -> code_change(_OldVsn, StateName, StateData, _Extra) ->
{ok, StateName, StateData}. {ok, StateName, StateData}.
-define(SEND(S), -define(SEND(S),
@ -243,15 +243,36 @@ handle_info({route_chan, Channel, Resource,
case Body of case Body of
"/quote " ++ Rest -> "/quote " ++ Rest ->
?SEND(Rest ++ "\r\n"); ?SEND(Rest ++ "\r\n");
"/msg " ++ Rest ->
?SEND("PRIVMSG " ++ Rest ++ "\r\n");
"/me " ++ Rest ->
Strings = string:tokens(Rest, "\n"),
Res = lists:concat(
lists:map(
fun(S) ->
io_lib:format(
"PRIVMSG #~s :\001ACTION ~s\001\r\n",
[Channel, S])
end, Strings)),
?SEND(Res);
"/ctcp " ++ Rest ->
Words = string:tokens(Rest, " "),
case Words of
[CtcpDest | _] ->
CtcpCmd =
toupper(
string:substr(
Rest,
string:str(Rest, " ") + 1)),
Res = io_lib:format(
"PRIVMSG ~s :\001~s\001\r\n",
[CtcpDest, CtcpCmd]),
?SEND(Res);
_ -> _ ->
Body1 = ok
case Body of end;
[$/, $m, $e, $ | Rest] ->
"\001ACTION " ++ Rest ++ "\001";
_ -> _ ->
Body Strings = string:tokens(Body, "\n"),
end,
Strings = string:tokens(Body1, "\n"),
Res = lists:concat( Res = lists:concat(
lists:map( lists:map(
fun(S) -> fun(S) ->
@ -271,19 +292,40 @@ handle_info({route_chan, Channel, Resource,
end, Strings)), end, Strings)),
?SEND(Res) ?SEND(Res)
end; end;
"chat" -> Type when Type == "chat"; Type == ""; Type == "normal" ->
Body = xml:get_path_s(El, [{elem, "body"}, cdata]), Body = xml:get_path_s(El, [{elem, "body"}, cdata]),
case Body of case Body of
"/quote " ++ Rest -> "/quote " ++ Rest ->
?SEND(Rest ++ "\r\n"); ?SEND(Rest ++ "\r\n");
"/msg " ++ Rest ->
?SEND("PRIVMSG " ++ Rest ++ "\r\n");
"/me " ++ Rest ->
Strings = string:tokens(Rest, "\n"),
Res = lists:concat(
lists:map(
fun(S) ->
io_lib:format(
"PRIVMSG ~s :\001ACTION ~s\001\r\n",
[Resource, S])
end, Strings)),
?SEND(Res);
"/ctcp " ++ Rest ->
Words = string:tokens(Rest, " "),
case Words of
[CtcpDest | _ ] ->
CtcpCmd =
toupper(
string:substr(
Rest, string:str(Rest, " ") + 1)),
Res = io_lib:format(
"PRIVMSG ~s :~s\r\n",
[CtcpDest, "\001" ++ CtcpCmd ++ "\001"]),
?SEND(Res);
_ -> _ ->
Body1 = case Body of ok
[$/, $m, $e, $ | Rest] -> end;
"\001ACTION " ++ Rest ++ "\001";
_ -> _ ->
Body Strings = string:tokens(Body, "\n"),
end,
Strings = string:tokens(Body1, "\n"),
Res = lists:concat( Res = lists:concat(
lists:map( lists:map(
fun(S) -> fun(S) ->
@ -358,14 +400,32 @@ handle_info({route_nick, Nick,
case Body of case Body of
"/quote " ++ Rest -> "/quote " ++ Rest ->
?SEND(Rest ++ "\r\n"); ?SEND(Rest ++ "\r\n");
"/msg " ++ Rest ->
?SEND("PRIVMSG " ++ Rest ++ "\r\n");
"/me " ++ Rest ->
Strings = string:tokens(Rest, "\n"),
Res = lists:concat(
lists:map(
fun(S) ->
io_lib:format(
"PRIVMSG ~s :\001ACTION ~s\001\r\n",
[Nick, S])
end, Strings)),
?SEND(Res);
"/ctcp " ++ Rest ->
Words = string:tokens(Rest, " "),
case Words of
[CtcpDest | _ ] ->
CtcpCmd = toupper(string:substr(Rest, string:str(Rest, " ")+1 )),
Res = io_lib:format(
"PRIVMSG ~s :~s\r\n",
[CtcpDest, "\001" ++ CtcpCmd ++ "\001"]),
?SEND(Res);
_ -> _ ->
Body1 = case Body of ok
[$/, $m, $e, $ | Rest] -> end;
"\001ACTION " ++ Rest ++ "\001";
_ -> _ ->
Body Strings = string:tokens(Body, "\n"),
end,
Strings = string:tokens(Body1, "\n"),
Res = lists:concat( Res = lists:concat(
lists:map( lists:map(
fun(S) -> fun(S) ->
@ -403,6 +463,9 @@ handle_info({ircstring, [$: | String]}, StateName, StateData) ->
[_, "332", Nick, [$# | Chan] | _] -> [_, "332", Nick, [$# | Chan] | _] ->
process_channel_topic(StateData, Chan, String), process_channel_topic(StateData, Chan, String),
StateData; StateData;
[_, "333", Nick, [$# | Chan] | _] ->
process_channel_topic_who(StateData, Chan, String),
StateData;
[_, "318", _, Nick | _] -> [_, "318", _, Nick | _] ->
process_endofwhois(StateData, String, Nick), process_endofwhois(StateData, String, Nick),
StateData; StateData;
@ -451,7 +514,7 @@ handle_info({ircstring, [$: | String]}, StateName, StateData) ->
"member", "participant"), "member", "participant"),
StateData; StateData;
[From, "KICK", [$# | Chan], Nick | _] -> [From, "KICK", [$# | Chan], Nick | _] ->
process_kick(StateData, Chan, From, Nick), process_kick(StateData, Chan, From, Nick, String),
StateData; StateData;
[From, "NICK", Nick | _] -> [From, "NICK", Nick | _] ->
process_nick(StateData, From, Nick); process_nick(StateData, From, Nick);
@ -626,16 +689,43 @@ process_channel_list_user(StateData, Chan, User) ->
process_channel_topic(StateData, Chan, String) -> process_channel_topic(StateData, Chan, String) ->
FromUser = "someone",
{ok, Msg, _} = regexp:sub(String, ".*332[^:]*:", ""), {ok, Msg, _} = regexp:sub(String, ".*332[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid( jlib:make_jid(
lists:concat([Chan, "%", StateData#state.server]), lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, FromUser), StateData#state.host, ""),
StateData#state.user, StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}], {xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "subject", [], [{xmlcdata, Msg1}]}]}). [{xmlelement, "subject", [], [{xmlcdata, Msg1}]},
{xmlelement, "body", [], [{xmlcdata, "Topic for #" ++ Chan ++ ": " ++ Msg1}]}
]}).
process_channel_topic_who(StateData, Chan, String) ->
Words = string:tokens(String, " "),
Msg1 = case Words of
[_, "333", _, _Chan, Whoset , Timeset] ->
case string:to_integer(Timeset) of
{Unixtimeset, Rest} ->
"Topic for #" ++ Chan ++ " set by " ++ Whoset ++
" at " ++ unixtime2string(Unixtimeset);
_->
"Topic for #" ++ Chan ++ " set by " ++ Whoset
end;
[_, "333", _, _Chan, Whoset | _] ->
"Topic for #" ++ Chan ++ " set by " ++ Whoset;
_ ->
String
end,
Msg2 = filter_message(Msg1),
ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, ""),
StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [], [{xmlcdata, Msg2}]}]}).
process_endofwhois(StateData, String, Nick) -> process_endofwhois(StateData, String, Nick) ->
@ -708,7 +798,7 @@ process_channotice(StateData, Chan, From, String) ->
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
_ -> _ ->
Msg "/me NOTICE: " ++ Msg
end, end,
Msg2 = filter_message(Msg1), Msg2 = filter_message(Msg1),
ejabberd_router:route( ejabberd_router:route(
@ -716,7 +806,7 @@ process_channotice(StateData, Chan, From, String) ->
StateData#state.host, FromUser), StateData#state.host, FromUser),
StateData#state.user, StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}], {xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [], [{xmlcdata, "NOTICE: " ++ Msg2}]}]}). [{xmlelement, "body", [], [{xmlcdata, Msg2}]}]}).
@ -746,7 +836,7 @@ process_notice(StateData, Nick, From, String) ->
[1, $A, $C, $T, $I, $O, $N, $ | Rest] -> [1, $A, $C, $T, $I, $O, $N, $ | Rest] ->
"/me " ++ Rest; "/me " ++ Rest;
_ -> _ ->
Msg "/me NOTICE: " ++ Msg
end, end,
Msg2 = filter_message(Msg1), Msg2 = filter_message(Msg1),
ejabberd_router:route( ejabberd_router:route(
@ -754,7 +844,7 @@ process_notice(StateData, Nick, From, String) ->
StateData#state.host, ""), StateData#state.host, ""),
StateData#state.user, StateData#state.user,
{xmlelement, "message", [{"type", "chat"}], {xmlelement, "message", [{"type", "chat"}],
[{xmlelement, "body", [], [{xmlcdata, "NOTICE: " ++ Msg2}]}]}). [{xmlelement, "body", [], [{xmlcdata, Msg2}]}]}).
process_version(StateData, Nick, From) -> process_version(StateData, Nick, From) ->
@ -776,7 +866,7 @@ process_userinfo(StateData, Nick, From) ->
send_text( send_text(
StateData, StateData,
io_lib:format("NOTICE ~s :\001USERINFO " io_lib:format("NOTICE ~s :\001USERINFO "
"This user uses xmpp:~s" "xmpp:~s"
"\001\r\n", "\001\r\n",
[FromUser, [FromUser,
jlib:jid_to_string(StateData#state.user)])). jlib:jid_to_string(StateData#state.user)])).
@ -798,17 +888,8 @@ process_topic(StateData, Chan, From, String) ->
process_part(StateData, Chan, From, String) -> process_part(StateData, Chan, From, String) ->
[FromUser | FromIdent] = string:tokens(From, "!"), [FromUser | FromIdent] = string:tokens(From, "!"),
{ok, Msg, _} = regexp:sub(String, ".*PART[^:]*", ""), {ok, Msg, _} = regexp:sub(String, ".*PART[^:]*:", ""),
Msg1 = filter_message(Msg), Msg1 = filter_message(Msg),
ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, FromUser),
StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [],
[{xmlcdata, "/me has part: " ++
Msg1 ++ "(" ++ FromIdent ++ ")" }]}]}),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]), jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, FromUser), StateData#state.host, FromUser),
@ -820,7 +901,7 @@ process_part(StateData, Chan, From, String) ->
{"role", "none"}], {"role", "none"}],
[]}]}, []}]},
{xmlelement, "status", [], {xmlelement, "status", [],
[{xmlcdata, Msg1 ++ "(" ++ FromIdent ++ ")"}]}] [{xmlcdata, Msg1 ++ " (" ++ FromIdent ++ ")"}]}]
}), }),
case catch dict:update(Chan, case catch dict:update(Chan,
fun(Ps) -> fun(Ps) ->
@ -843,16 +924,6 @@ process_quit(StateData, From, String) ->
fun(Chan, Ps) -> fun(Chan, Ps) ->
case ?SETS:is_member(FromUser, Ps) of case ?SETS:is_member(FromUser, Ps) of
true -> true ->
ejabberd_router:route(
jlib:make_jid(
lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, FromUser),
StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [],
[{xmlcdata, "/me has quit: " ++
Msg1 ++ "(" ++ FromIdent ++ ")" }]}]}),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid( jlib:make_jid(
lists:concat([Chan, "%", StateData#state.server]), lists:concat([Chan, "%", StateData#state.server]),
@ -865,7 +936,7 @@ process_quit(StateData, From, String) ->
{"role", "none"}], {"role", "none"}],
[]}]}, []}]},
{xmlelement, "status", [], {xmlelement, "status", [],
[{xmlcdata, Msg1 ++ "(" ++ FromIdent ++ ")"}]} [{xmlcdata, Msg1 ++ " (" ++ FromIdent ++ ")"}]}
]}), ]}),
remove_element(FromUser, Ps); remove_element(FromUser, Ps);
_ -> _ ->
@ -890,16 +961,6 @@ process_join(StateData, Channel, From, String) ->
[]}]}, []}]},
{xmlelement, "status", [], {xmlelement, "status", [],
[{xmlcdata, FromIdent}]}]}), [{xmlcdata, FromIdent}]}]}),
{ok, Msg, _} = regexp:sub(String, ".*JOIN[^:]*:", ""),
Msg1 = filter_message(Msg),
ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, FromUser),
StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [],
[{xmlcdata, "/me has joined " ++
Msg1 ++ "(" ++ FromIdent ++ ")" }]}]}),
case catch dict:update(Chan, case catch dict:update(Chan,
fun(Ps) -> fun(Ps) ->
@ -926,8 +987,15 @@ process_mode_o(StateData, Chan, From, Nick, Affiliation, Role) ->
{"role", Role}], {"role", Role}],
[]}]}]}). []}]}]}).
process_kick(StateData, Chan, From, Nick) -> process_kick(StateData, Chan, From, Nick, String) ->
%Msg = lists:last(string:tokens(String, ":")), Msg = lists:last(string:tokens(String, ":")),
Msg2 = Nick ++ " kicked by " ++ From ++ " (" ++ filter_message(Msg) ++ ")",
ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, ""),
StateData#state.user,
{xmlelement, "message", [{"type", "groupchat"}],
[{xmlelement, "body", [], [{xmlcdata, Msg2}]}]}),
ejabberd_router:route( ejabberd_router:route(
jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]), jlib:make_jid(lists:concat([Chan, "%", StateData#state.server]),
StateData#state.host, Nick), StateData#state.host, Nick),
@ -1086,4 +1154,36 @@ filter_message(Msg) ->
false; false;
true -> true true -> true
end end
end, Msg). end, filter_mirc_colors(Msg)).
filter_mirc_colors(Msg) ->
case regexp:gsub(Msg, "(\\003[0-9]+)(,[0-9]+)?", "") of
{ok, Msg2, _} ->
Msg2;
_ ->
Msg
end.
unixtime2string(Unixtime) ->
Secs = Unixtime + calendar:datetime_to_gregorian_seconds(
{{1970, 1, 1}, {0,0,0}}),
case calendar:universal_time_to_local_time(
calendar:gregorian_seconds_to_datetime(Secs)) of
{{Year, Month, Day}, {Hour, Minute, Second}} ->
lists:flatten(
io_lib:format("~4..0w-~2..0w-~2..0w ~2..0w:~2..0w:~2..0w",
[Year, Month, Day, Hour, Minute, Second]));
_->
"0000-00-00 00:00:00"
end.
toupper([C | Cs]) ->
if
C >= $a, C =< $z ->
[C - 32 | toupper(Cs)];
true ->
[C | toupper(Cs)]
end;
toupper([]) ->
[].

View File

@ -281,7 +281,7 @@ set_vcard(User, LServer, VCARD) ->
?TLFIELD("text-single", "Birthday", "bday"), ?TLFIELD("text-single", "Birthday", "bday"),
?TLFIELD("text-single", "Country", "ctry"), ?TLFIELD("text-single", "Country", "ctry"),
?TLFIELD("text-single", "City", "locality"), ?TLFIELD("text-single", "City", "locality"),
?TLFIELD("text-single", "email", "email"), ?TLFIELD("text-single", "Email", "email"),
?TLFIELD("text-single", "Organization Name", "orgname"), ?TLFIELD("text-single", "Organization Name", "orgname"),
?TLFIELD("text-single", "Organization Unit", "orgunit") ?TLFIELD("text-single", "Organization Unit", "orgunit")
]}]). ]}]).
@ -439,10 +439,10 @@ find_xdata_el1([_ | Els]) ->
search_result(Lang, JID, ServerHost, Data) -> search_result(Lang, JID, ServerHost, Data) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Results of search in ") ++ [{xmlcdata, translate:translate(Lang, "Search Results for ") ++
jlib:jid_to_string(JID)}]}, jlib:jid_to_string(JID)}]},
{xmlelement, "reported", [], {xmlelement, "reported", [],
[?LFIELD("JID", "jid"), [?LFIELD("Jabber ID", "jid"),
?LFIELD("Full Name", "fn"), ?LFIELD("Full Name", "fn"),
?LFIELD("Name", "given"), ?LFIELD("Name", "given"),
?LFIELD("Middle Name", "middle"), ?LFIELD("Middle Name", "middle"),
@ -451,7 +451,7 @@ search_result(Lang, JID, ServerHost, Data) ->
?LFIELD("Birthday", "bday"), ?LFIELD("Birthday", "bday"),
?LFIELD("Country", "ctry"), ?LFIELD("Country", "ctry"),
?LFIELD("City", "locality"), ?LFIELD("City", "locality"),
?LFIELD("email", "email"), ?LFIELD("Email", "email"),
?LFIELD("Organization Name", "orgname"), ?LFIELD("Organization Name", "orgname"),
?LFIELD("Organization Unit", "orgunit") ?LFIELD("Organization Unit", "orgunit")
]}] ++ lists:map(fun record_to_item/1, search(ServerHost, Data)). ]}] ++ lists:map(fun record_to_item/1, search(ServerHost, Data)).

View File

@ -239,7 +239,7 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) ->
?TLFIELD("text-single", "Birthday", "bday"), ?TLFIELD("text-single", "Birthday", "bday"),
?TLFIELD("text-single", "Country", "ctry"), ?TLFIELD("text-single", "Country", "ctry"),
?TLFIELD("text-single", "City", "locality"), ?TLFIELD("text-single", "City", "locality"),
?TLFIELD("text-single", "email", "email"), ?TLFIELD("text-single", "Email", "email"),
?TLFIELD("text-single", "Organization Name", "orgname"), ?TLFIELD("text-single", "Organization Name", "orgname"),
?TLFIELD("text-single", "Organization Unit", "orgunit") ?TLFIELD("text-single", "Organization Unit", "orgunit")
]}]). ]}]).
@ -397,10 +397,10 @@ find_xdata_el1([_ | Els]) ->
search_result(Lang, JID, ServerHost, Data) -> search_result(Lang, JID, ServerHost, Data) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Results of search in ") ++ [{xmlcdata, translate:translate(Lang, "Search Results for ") ++
jlib:jid_to_string(JID)}]}, jlib:jid_to_string(JID)}]},
{xmlelement, "reported", [], {xmlelement, "reported", [],
[?LFIELD("JID", "jid"), [?LFIELD("Jabber ID", "jid"),
?LFIELD("Full Name", "fn"), ?LFIELD("Full Name", "fn"),
?LFIELD("Given Name", "given"), ?LFIELD("Given Name", "given"),
?LFIELD("Middle Name", "middle"), ?LFIELD("Middle Name", "middle"),
@ -409,7 +409,7 @@ search_result(Lang, JID, ServerHost, Data) ->
?LFIELD("Birthday", "bday"), ?LFIELD("Birthday", "bday"),
?LFIELD("Country", "ctry"), ?LFIELD("Country", "ctry"),
?LFIELD("City", "locality"), ?LFIELD("City", "locality"),
?LFIELD("email", "email"), ?LFIELD("Email", "email"),
?LFIELD("Organization Name", "orgname"), ?LFIELD("Organization Name", "orgname"),
?LFIELD("Organization Unit", "orgunit") ?LFIELD("Organization Unit", "orgunit")
]}] ++ lists:map(fun(E) -> ]}] ++ lists:map(fun(E) ->

View File

@ -281,7 +281,7 @@ set_vcard(User, LServer, VCARD) ->
?TLFIELD("text-single", "Birthday", "bday"), ?TLFIELD("text-single", "Birthday", "bday"),
?TLFIELD("text-single", "Country", "ctry"), ?TLFIELD("text-single", "Country", "ctry"),
?TLFIELD("text-single", "City", "locality"), ?TLFIELD("text-single", "City", "locality"),
?TLFIELD("text-single", "email", "email"), ?TLFIELD("text-single", "Email", "email"),
?TLFIELD("text-single", "Organization Name", "orgname"), ?TLFIELD("text-single", "Organization Name", "orgname"),
?TLFIELD("text-single", "Organization Unit", "orgunit") ?TLFIELD("text-single", "Organization Unit", "orgunit")
]}]). ]}]).
@ -436,10 +436,10 @@ find_xdata_el1([_ | Els]) ->
search_result(Lang, JID, ServerHost, Data) -> search_result(Lang, JID, ServerHost, Data) ->
[{xmlelement, "title", [], [{xmlelement, "title", [],
[{xmlcdata, translate:translate(Lang, "Results of search in ") ++ [{xmlcdata, translate:translate(Lang, "Search Results for ") ++
jlib:jid_to_string(JID)}]}, jlib:jid_to_string(JID)}]},
{xmlelement, "reported", [], {xmlelement, "reported", [],
[?LFIELD("JID", "jid"), [?LFIELD("Jabber ID", "jid"),
?LFIELD("Full Name", "fn"), ?LFIELD("Full Name", "fn"),
?LFIELD("Name", "given"), ?LFIELD("Name", "given"),
?LFIELD("Middle Name", "middle"), ?LFIELD("Middle Name", "middle"),
@ -448,7 +448,7 @@ search_result(Lang, JID, ServerHost, Data) ->
?LFIELD("Birthday", "bday"), ?LFIELD("Birthday", "bday"),
?LFIELD("Country", "ctry"), ?LFIELD("Country", "ctry"),
?LFIELD("City", "locality"), ?LFIELD("City", "locality"),
?LFIELD("email", "email"), ?LFIELD("Email", "email"),
?LFIELD("Organization Name", "orgname"), ?LFIELD("Organization Name", "orgname"),
?LFIELD("Organization Unit", "orgunit") ?LFIELD("Organization Unit", "orgunit")
]}] ++ lists:map(fun(R) -> record_to_item(ServerHost, R) end, ]}] ++ lists:map(fun(R) -> record_to_item(ServerHost, R) end,

View File

@ -72,7 +72,7 @@ make_xhtml(Els, global, Lang) ->
[?XAE("div", [?XAE("div",
[{"id", "header"}], [{"id", "header"}],
[?XE("h1", [?XE("h1",
[?ACT("/admin/", "ejabberd administration")] [?ACT("/admin/", "Administration")]
)]), )]),
?XAE("div", ?XAE("div",
[{"id", "navigation"}], [{"id", "navigation"}],
@ -118,7 +118,7 @@ make_xhtml(Els, Host, Lang) ->
[?XAE("div", [?XAE("div",
[{"id", "header"}], [{"id", "header"}],
[?XE("h1", [?XE("h1",
[?ACT(Base, "ejabberd administration")] [?ACT(Base, "Administration")]
)]), )]),
?XAE("div", ?XAE("div",
[{"id", "navigation"}], [{"id", "navigation"}],
@ -527,12 +527,12 @@ process_admin(global,
path = [], path = [],
q = Query, q = Query,
lang = Lang} = Request) -> lang = Lang} = Request) ->
make_xhtml([?XCT("h1", "ejabberd administration"), make_xhtml([?XCT("h1", "Administration"),
?XE("ul", ?XE("ul",
[?LI([?ACT("/admin/acls/", "Access Control Lists"), ?C(" "), [?LI([?ACT("/admin/acls/", "Access Control Lists"), ?C(" "),
?ACT("/admin/acls-raw/", "(raw)")]), ?ACT("/admin/acls-raw/", "(Raw)")]),
?LI([?ACT("/admin/access/", "Access Rules"), ?C(" "), ?LI([?ACT("/admin/access/", "Access Rules"), ?C(" "),
?ACT("/admin/access-raw/", "(raw)")]), ?ACT("/admin/access-raw/", "(Raw)")]),
?LI([?ACT("/admin/vhosts/", "Virtual Hosts")]), ?LI([?ACT("/admin/vhosts/", "Virtual Hosts")]),
?LI([?ACT("/admin/nodes/", "Nodes")]), ?LI([?ACT("/admin/nodes/", "Nodes")]),
?LI([?ACT("/admin/stats/", "Statistics")]) ?LI([?ACT("/admin/stats/", "Statistics")])
@ -546,12 +546,12 @@ process_admin(Host,
q = Query, q = Query,
lang = Lang} = Request) -> lang = Lang} = Request) ->
Base = "/admin/server/" ++ Host ++ "/", Base = "/admin/server/" ++ Host ++ "/",
make_xhtml([?XCT("h1", "ejabberd administration"), make_xhtml([?XCT("h1", "Administration"),
?XE("ul", ?XE("ul",
[?LI([?ACT(Base ++ "acls/", "Access Control Lists"), ?C(" "), [?LI([?ACT(Base ++ "acls/", "Access Control Lists"), ?C(" "),
?ACT(Base ++ "acls-raw/", "(raw)")]), ?ACT(Base ++ "acls-raw/", "(Raw)")]),
?LI([?ACT(Base ++ "access/", "Access Rules"), ?C(" "), ?LI([?ACT(Base ++ "access/", "Access Rules"), ?C(" "),
?ACT(Base ++ "access-raw/", "(raw)")]), ?ACT(Base ++ "access-raw/", "(Raw)")]),
?LI([?ACT(Base ++ "users/", "Users")]), ?LI([?ACT(Base ++ "users/", "Users")]),
?LI([?ACT(Base ++ "online-users/", "Online Users")]), ?LI([?ACT(Base ++ "online-users/", "Online Users")]),
?LI([?ACT(Base ++ "last-activity/", "Last Activity")]), ?LI([?ACT(Base ++ "last-activity/", "Last Activity")]),
@ -620,10 +620,10 @@ process_admin(Host,
"~p.", [lists:keysort( "~p.", [lists:keysort(
2, ets:select(acl, [{{acl, {'$1', Host}, '$2'}, 2, ets:select(acl, [{{acl, {'$1', Host}, '$2'},
[], [{{acl, '$1', '$2'}}]}]))])), [], [{{acl, '$1', '$2'}}]}]))])),
make_xhtml([?XCT("h1", "ejabberd access control lists configuration")] ++ make_xhtml([?XCT("h1", "Access Control Lists")] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -664,13 +664,13 @@ process_admin(Host,
ACLs = lists:keysort( ACLs = lists:keysort(
2, ets:select(acl, [{{acl, {'$1', Host}, '$2'}, 2, ets:select(acl, [{{acl, {'$1', Host}, '$2'},
[], [{{acl, '$1', '$2'}}]}])), [], [{{acl, '$1', '$2'}}]}])),
make_xhtml([?XCT("h1", "ejabberd access control lists configuration")] ++ make_xhtml([?XCT("h1", "Access Control Lists")] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XE("p", [?ACT("../acls-raw/", "raw")])] ++ [?XE("p", [?ACT("../acls-raw/", "Raw")])] ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
[acls_to_xhtml(ACLs), [acls_to_xhtml(ACLs),
?BR, ?BR,
@ -733,10 +733,10 @@ process_admin(Host,
[{{config, {access, '$1', Host}, '$2'}, [{{config, {access, '$1', Host}, '$2'},
[], [],
[{{access, '$1', '$2'}}]}])])), [{{access, '$1', '$2'}}]}])])),
make_xhtml([?XCT("h1", "ejabberd access rules configuration")] ++ make_xhtml([?XCT("h1", "Access Rules")] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -772,10 +772,10 @@ process_admin(Host,
[{{config, {access, '$1', Host}, '$2'}, [{{config, {access, '$1', Host}, '$2'},
[], [],
[{{access, '$1', '$2'}}]}]), [{{access, '$1', '$2'}}]}]),
make_xhtml([?XCT("h1", "ejabberd access rules configuration")] ++ make_xhtml([?XCT("h1", "Access Rules")] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XE("p", [?ACT("../access-raw/", "raw")])] ++ [?XE("p", [?ACT("../access-raw/", "raw")])] ++
@ -816,8 +816,8 @@ process_admin(Host,
make_xhtml([?XC("h1", make_xhtml([?XC("h1",
io_lib:format(?T("~s access rule configuration"), [SName]))] ++ io_lib:format(?T("~s access rule configuration"), [SName]))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -841,7 +841,7 @@ process_admin(Host,
q = Query, q = Query,
lang = Lang} = Request) when is_list(Host) -> lang = Lang} = Request) when is_list(Host) ->
Res = list_users(Host, Query, Lang, fun url_func/1), Res = list_users(Host, Query, Lang, fun url_func/1),
make_xhtml([?XCT("h1", "ejabberd users")] ++ Res, Host, Lang); make_xhtml([?XCT("h1", "Users")] ++ Res, Host, Lang);
process_admin(Host, process_admin(Host,
#request{us = US, #request{us = US,
@ -849,7 +849,7 @@ process_admin(Host,
q = Query, q = Query,
lang = Lang} = Request) when is_list(Host) -> lang = Lang} = Request) when is_list(Host) ->
Res = list_users_in_diapason(Host, Diap, Lang, fun url_func/1), Res = list_users_in_diapason(Host, Diap, Lang, fun url_func/1),
make_xhtml([?XCT("h1", "ejabberd users")] ++ Res, Host, Lang); make_xhtml([?XCT("h1", "Users")] ++ Res, Host, Lang);
process_admin(Host, process_admin(Host,
#request{us = US, #request{us = US,
@ -857,7 +857,7 @@ process_admin(Host,
q = Query, q = Query,
lang = Lang} = Request) when is_list(Host) -> lang = Lang} = Request) when is_list(Host) ->
Res = list_online_users(Host, Lang), Res = list_online_users(Host, Lang),
make_xhtml([?XCT("h1", "ejabberd users")] ++ Res, Host, Lang); make_xhtml([?XCT("h1", "Online Users")] ++ Res, Host, Lang);
process_admin(Host, process_admin(Host,
#request{method = Method, #request{method = Method,
@ -878,7 +878,7 @@ 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", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
[?CT("Period: "), [?CT("Period: "),
?XAE("select", [{"name", "period"}], ?XAE("select", [{"name", "period"}],
@ -906,7 +906,7 @@ process_admin(Host,
q = Query, q = Query,
lang = Lang} = Request) -> lang = Lang} = Request) ->
Res = get_stats(Host, Lang), Res = get_stats(Host, Lang),
make_xhtml([?XCT("h1", "ejabberd stats")] ++ Res, Host, Lang); make_xhtml([?XCT("h1", "Statistics")] ++ Res, Host, Lang);
process_admin(Host, process_admin(Host,
#request{us = US, #request{us = US,
@ -971,7 +971,7 @@ process_admin(Host,
process_admin(Host, process_admin(Host,
#request{lang = Lang}) -> #request{lang = Lang}) ->
setelement(1, make_xhtml([?XC("h1", "Not found")], Host, Lang), 404). setelement(1, make_xhtml([?XC("h1", "Not Found")], Host, Lang), 404).
@ -1209,8 +1209,8 @@ list_vhosts(Lang) ->
[?XE("thead", [?XE("thead",
[?XE("tr", [?XE("tr",
[?XCT("td", "Host"), [?XCT("td", "Host"),
?XCT("td", "Registered users"), ?XCT("td", "Registered Users"),
?XCT("td", "Online users") ?XCT("td", "Online Users")
])]), ])]),
?XE("tbody", ?XE("tbody",
lists:map( lists:map(
@ -1254,8 +1254,8 @@ list_users(Host, Query, Lang, URLFunc) ->
end, lists:seq(1, N, M)) end, lists:seq(1, N, M))
end, end,
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -1313,7 +1313,7 @@ list_given_users(Users, Prefix, Lang, URLFunc) ->
[?XE("thead", [?XE("thead",
[?XE("tr", [?XE("tr",
[?XCT("td", "User"), [?XCT("td", "User"),
?XCT("td", "Offline messages"), ?XCT("td", "Offline Messages"),
?XCT("td", "Last Activity")])]), ?XCT("td", "Last Activity")])]),
?XE("tbody", ?XE("tbody",
lists:map( lists:map(
@ -1371,15 +1371,15 @@ get_stats(global, Lang) ->
S2SServers = length(lists:usort([element(2, C) || C <- S2SConns])), S2SServers = length(lists:usort([element(2, C) || C <- S2SConns])),
[?XAE("table", [], [?XAE("table", [],
[?XE("tbody", [?XE("tbody",
[?XE("tr", [?XCT("td", "Registered users"), [?XE("tr", [?XCT("td", "Registered Users:"),
?XC("td", integer_to_list(RegisteredUsers))]), ?XC("td", integer_to_list(RegisteredUsers))]),
?XE("tr", [?XCT("td", "Authenticated users"), ?XE("tr", [?XCT("td", "Authenticated Users:"),
?XC("td", integer_to_list(AuthUsers))]), ?XC("td", integer_to_list(AuthUsers))]),
?XE("tr", [?XCT("td", "Online users"), ?XE("tr", [?XCT("td", "Online Users:"),
?XC("td", integer_to_list(OnlineUsers))]), ?XC("td", integer_to_list(OnlineUsers))]),
?XE("tr", [?XCT("td", "Outgoing S2S connections"), ?XE("tr", [?XCT("td", "Outgoing s2s Connections:"),
?XC("td", integer_to_list(S2SConnections))]), ?XC("td", integer_to_list(S2SConnections))]),
?XE("tr", [?XCT("td", "Outgoing S2S servers"), ?XE("tr", [?XCT("td", "Outgoing s2s Servers:"),
?XC("td", integer_to_list(S2SServers))]) ?XC("td", integer_to_list(S2SServers))])
]) ])
])]; ])];
@ -1389,9 +1389,9 @@ get_stats(Host, Lang) ->
RegisteredUsers = length(ejabberd_auth:get_vh_registered_users(Host)), RegisteredUsers = length(ejabberd_auth:get_vh_registered_users(Host)),
[?XAE("table", [], [?XAE("table", [],
[?XE("tbody", [?XE("tbody",
[?XE("tr", [?XCT("td", "Registered users"), [?XE("tr", [?XCT("td", "Registered Users:"),
?XC("td", integer_to_list(RegisteredUsers))]), ?XC("td", integer_to_list(RegisteredUsers))]),
?XE("tr", [?XCT("td", "Online users"), ?XE("tr", [?XCT("td", "Online Users:"),
?XC("td", integer_to_list(OnlineUsers))]) ?XC("td", integer_to_list(OnlineUsers))])
]) ])
])]. ])].
@ -1429,14 +1429,14 @@ user_info(User, Server, Query, Lang) ->
integer_to_list(QueueLen))], integer_to_list(QueueLen))],
[?XC("h1", ?T("User ") ++ us_to_list(US))] ++ [?XC("h1", ?T("User ") ++ us_to_list(US))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
[?XCT("h3", "Connected Resources:")] ++ FResources ++ [?XCT("h3", "Connected Resources:")] ++ FResources ++
[?XCT("h3", "Password:")] ++ FPassword ++ [?XCT("h3", "Password:")] ++ FPassword ++
[?XCT("h3", "Offline messages:")] ++ FQueueLen ++ [?XCT("h3", "Offline Messages:")] ++ FQueueLen ++
[?XE("h3", [?ACT("roster/", "Roster")])] ++ [?XE("h3", [?ACT("roster/", "Roster")])] ++
[?BR, ?INPUTT("submit", "removeuser", "Remove User")])]. [?BR, ?INPUTT("submit", "removeuser", "Remove User")])].
@ -1493,11 +1493,11 @@ user_queue(User, Server, Query, Lang) ->
?XAE("td", [{"class", "valign"}], [?XC("pre", FPacket)])] ?XAE("td", [{"class", "valign"}], [?XC("pre", FPacket)])]
) )
end, Msgs), end, Msgs),
[?XC("h1", io_lib:format(?T("~s offline messages queue"), [?XC("h1", io_lib:format(?T("~s's Offline Messages Queue"),
[us_to_list(US)]))] ++ [us_to_list(US)]))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -1578,7 +1578,7 @@ user_roster(User, Server, Query, Lang, Admin) ->
[?XE("table", [?XE("table",
[?XE("thead", [?XE("thead",
[?XE("tr", [?XE("tr",
[?XCT("td", "JID"), [?XCT("td", "Jabber ID"),
?XCT("td", "Nickname"), ?XCT("td", "Nickname"),
?XCT("td", "Subscription"), ?XCT("td", "Subscription"),
?XCT("td", "Pending"), ?XCT("td", "Pending"),
@ -1622,15 +1622,15 @@ user_roster(User, Server, Query, Lang, Admin) ->
end, end,
[?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++ [?XC("h1", ?T("Roster of ") ++ us_to_list(US))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
FItems ++ FItems ++
[?P, [?P,
?INPUT("text", "newjid", ""), ?C(" "), ?INPUT("text", "newjid", ""), ?C(" "),
?INPUTT("submit", "addjid", "Add JID") ?INPUTT("submit", "addjid", "Add Jabber ID")
])]. ])].
user_roster_parse_query(User, Server, Items, Query, Admin) -> user_roster_parse_query(User, Server, Items, Query, Admin) ->
@ -1734,7 +1734,7 @@ list_last_activity(Host, Lang, Integral, Period) ->
Hist = histogram(Vals, Integral), Hist = histogram(Vals, Integral),
if if
Hist == [] -> Hist == [] ->
[?CT("No data")]; [?CT("No Data")];
true -> true ->
Left = if Left = if
Days == infinity -> Days == infinity ->
@ -1833,14 +1833,14 @@ get_node(global, Node, [], Query, Lang) ->
Res = node_parse_query(Node, Query), Res = node_parse_query(Node, Query),
[?XC("h1", ?T("Node ") ++ atom_to_list(Node))] ++ [?XC("h1", ?T("Node ") ++ atom_to_list(Node))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XE("ul", [?XE("ul",
[?LI([?ACT("db/", "DB Management")]), [?LI([?ACT("db/", "Database")]),
?LI([?ACT("backup/", "Backup Management")]), ?LI([?ACT("backup/", "Backup")]),
?LI([?ACT("ports/", "Listened Ports Management")]), ?LI([?ACT("ports/", "Listened Ports")]),
?LI([?ACT("stats/", "Statistics")]) ?LI([?ACT("stats/", "Statistics")])
]), ]),
?XAE("form", [{"action", ""}, {"method", "post"}], ?XAE("form", [{"action", ""}, {"method", "post"}],
@ -1852,13 +1852,13 @@ get_node(global, Node, [], Query, Lang) ->
get_node(Host, Node, [], Query, Lang) -> get_node(Host, Node, [], Query, Lang) ->
[?XC("h1", ?T("Node ") ++ atom_to_list(Node)), [?XC("h1", ?T("Node ") ++ atom_to_list(Node)),
?XE("ul", ?XE("ul",
[?LI([?ACT("modules/", "Modules Management")])]) [?LI([?ACT("modules/", "Modules")])])
]; ];
get_node(global, Node, ["db"], Query, Lang) -> get_node(global, Node, ["db"], Query, Lang) ->
case rpc:call(Node, mnesia, system_info, [tables]) of case rpc:call(Node, mnesia, system_info, [tables]) of
{badrpc, _Reason} -> {badrpc, _Reason} ->
[?XCT("h1", "RPC call error")]; [?XCT("h1", "RPC Call Error")];
Tables -> Tables ->
Res = node_db_parse_query(Node, Tables, Query), Res = node_db_parse_query(Node, Tables, Query),
STables = lists:sort(Tables), STables = lists:sort(Tables),
@ -1896,10 +1896,10 @@ get_node(global, Node, ["db"], Query, Lang) ->
integer_to_list(Memory)) integer_to_list(Memory))
]) ])
end, STables), end, STables),
[?XC("h1", ?T("DB Tables at ") ++ atom_to_list(Node))] ++ [?XC("h1", ?T("Database Tables at ") ++ atom_to_list(Node))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -1924,19 +1924,20 @@ get_node(global, Node, ["db"], Query, Lang) ->
get_node(global, Node, ["backup"], Query, Lang) -> get_node(global, Node, ["backup"], Query, Lang) ->
Res = node_backup_parse_query(Node, Query), Res = node_backup_parse_query(Node, Query),
[?XC("h1", ?T("Backup Management at ") ++ atom_to_list(Node)), [?XC("h1", ?T("Backup of ") ++ atom_to_list(Node)),
?XCT("p", "Remark 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", [{"action", ""}, {"method", "post"}], ?XAE("form", [{"action", ""}, {"method", "post"}],
[?XAE("table", [], [?XAE("table", [],
[?XE("tbody", [?XE("tbody",
[?XE("tr", [?XE("tr",
[?XCT("td", "Store a backup in a file"), [?XCT("td", "Store binary backup:"),
?XE("td", [?INPUT("text", "storepath", ?XE("td", [?INPUT("text", "storepath",
"ejabberd.backup")]), "ejabberd.backup")]),
?XE("td", [?INPUTT("submit", "store", ?XE("td", [?INPUTT("submit", "store",
"OK")]) "OK")])
]), ]),
?XE("tr", ?XE("tr",
[?XCT("td", "Restore a backup from a file"), [?XCT("td", "Restore binary backup immediately:"),
?XE("td", [?INPUT("text", "restorepath", ?XE("td", [?INPUT("text", "restorepath",
"ejabberd.backup")]), "ejabberd.backup")]),
?XE("td", [?INPUTT("submit", "restore", ?XE("td", [?INPUTT("submit", "restore",
@ -1944,21 +1945,21 @@ get_node(global, Node, ["backup"], Query, Lang) ->
]), ]),
?XE("tr", ?XE("tr",
[?XCT("td", [?XCT("td",
"Install a database fallback from a file"), "Restore binary backup after next ejabberd restart (requires less memory):"),
?XE("td", [?INPUT("text", "fallbackpath", ?XE("td", [?INPUT("text", "fallbackpath",
"ejabberd.backup")]), "ejabberd.backup")]),
?XE("td", [?INPUTT("submit", "fallback", ?XE("td", [?INPUTT("submit", "fallback",
"OK")]) "OK")])
]), ]),
?XE("tr", ?XE("tr",
[?XCT("td", "Dump a database in a text file"), [?XCT("td", "Store plain text backup:"),
?XE("td", [?INPUT("text", "dumppath", ?XE("td", [?INPUT("text", "dumppath",
"ejabberd.dump")]), "ejabberd.dump")]),
?XE("td", [?INPUTT("submit", "dump", ?XE("td", [?INPUTT("submit", "dump",
"OK")]) "OK")])
]), ]),
?XE("tr", ?XE("tr",
[?XCT("td", "Restore a database from a text file"), [?XCT("td", "Restore plain text backup immediately:"),
?XE("td", [?INPUT("text", "loadpath", ?XE("td", [?INPUT("text", "loadpath",
"ejabberd.dump")]), "ejabberd.dump")]),
?XE("td", [?INPUTT("submit", "load", ?XE("td", [?INPUTT("submit", "load",
@ -1981,8 +1982,8 @@ get_node(global, Node, ["ports"], Query, Lang) ->
rpc:call(Node, ejabberd_config, get_local_option, [listen])), rpc:call(Node, ejabberd_config, get_local_option, [listen])),
[?XC("h1", ?T("Listened Ports at ") ++ atom_to_list(Node))] ++ [?XC("h1", ?T("Listened Ports at ") ++ atom_to_list(Node))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -2004,8 +2005,8 @@ get_node(Host, Node, ["modules"], Query, Lang) when is_list(Host) ->
rpc:call(Node, gen_mod, loaded_modules_with_opts, [Host])), rpc:call(Node, gen_mod, loaded_modules_with_opts, [Host])),
[?XC("h1", ?T("Modules at ") ++ atom_to_list(Node))] ++ [?XC("h1", ?T("Modules at ") ++ atom_to_list(Node))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -2028,35 +2029,35 @@ get_node(global, Node, ["stats"], Query, Lang) ->
TransactionsLogged = TransactionsLogged =
rpc:call(Node, mnesia, system_info, [transaction_log_writes]), rpc:call(Node, mnesia, system_info, [transaction_log_writes]),
[?XC("h1", io_lib:format(?T("~p statistics"), [Node])), [?XC("h1", io_lib:format(?T("Statistics of ~p"), [Node])),
?XAE("table", [], ?XAE("table", [],
[?XE("tbody", [?XE("tbody",
[?XE("tr", [?XCT("td", "Uptime"), [?XE("tr", [?XCT("td", "Uptime:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
UpTimeS)]), UpTimeS)]),
?XE("tr", [?XCT("td", "CPU Time"), ?XE("tr", [?XCT("td", "CPU Time:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
CPUTimeS)]), CPUTimeS)]),
?XE("tr", [?XCT("td", "Authenticated users"), ?XE("tr", [?XCT("td", "Authenticated Users:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
integer_to_list(Users))]), integer_to_list(Users))]),
?XE("tr", [?XCT("td", "Transactions commited"), ?XE("tr", [?XCT("td", "Transactions Commited:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
integer_to_list(TransactionsCommited))]), integer_to_list(TransactionsCommited))]),
?XE("tr", [?XCT("td", "Transactions aborted"), ?XE("tr", [?XCT("td", "Transactions Aborted:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
integer_to_list(TransactionsAborted))]), integer_to_list(TransactionsAborted))]),
?XE("tr", [?XCT("td", "Transactions restarted"), ?XE("tr", [?XCT("td", "Transactions Restarted:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
integer_to_list(TransactionsRestarted))]), integer_to_list(TransactionsRestarted))]),
?XE("tr", [?XCT("td", "Transactions logged"), ?XE("tr", [?XCT("td", "Transactions Logged:"),
?XAC("td", [{"class", "alignright"}], ?XAC("td", [{"class", "alignright"}],
integer_to_list(TransactionsLogged))]) integer_to_list(TransactionsLogged))])
]) ])
])]; ])];
get_node(Host, Node, NPath, Query, Lang) -> get_node(Host, Node, NPath, Query, Lang) ->
[?XCT("h1", "Not found")]. [?XCT("h1", "Not Found")].
node_parse_query(Node, Query) -> node_parse_query(Node, Query) ->
@ -2395,10 +2396,10 @@ list_shared_roster_groups(Host, Query, Lang) ->
] ]
)] )]
)]), )]),
[?XC("h1", ?T("Shared roster groups"))] ++ [?XC("h1", ?T("Shared Roster Groups"))] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],
@ -2494,11 +2495,11 @@ shared_roster_group(Host, Group, Query, Lang) ->
] ]
)] )]
)]), )]),
[?XC("h1", ?T("Shared roster groups"))] ++ [?XC("h1", ?T("Shared Roster Groups"))] ++
[?XC("h2", ?T("Group ") ++ Group)] ++ [?XC("h2", ?T("Group ") ++ Group)] ++
case Res of case Res of
ok -> [?CT("submitted"), ?P]; ok -> [?CT("Submitted"), ?P];
error -> [?CT("bad format"), ?P]; error -> [?CT("Bad format"), ?P];
nothing -> [] nothing -> []
end ++ end ++
[?XAE("form", [{"action", ""}, {"method", "post"}], [?XAE("form", [{"action", ""}, {"method", "post"}],