25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-03 14:45:16 +02:00

* src/mod_version.erl: Added option to hide OS version (thanks to

Badlop)
* doc/guide.tex: Updated

SVN Revision: 848
This commit is contained in:
Alexey Shchepin 2007-07-31 04:13:58 +00:00
parent 588b43f9b7
commit a78ea8fb54
3 changed files with 33 additions and 23 deletions

View File

@ -1,5 +1,9 @@
2007-07-31 Alexey Shchepin <alexey@sevcom.net>
* src/mod_version.erl: Added option to hide OS version (thanks to
Badlop)
* doc/guide.tex: Updated
* src/msgs/zh.msg: Updated (thanks to Shelley Shyan)
* src/msgs/es.msg: Updated (thanks to Badlop)

View File

@ -2946,6 +2946,8 @@ answers \ejabberd{}'s version when queried.
Options:
\begin{description}
\titem{show\_os}\ind{options!showos}Should the operating system be revealed or not.
The default value is \term{true}.
\iqdiscitem{Software Version (\ns{jabber:iq:version})}
\end{description}

View File

@ -1,14 +1,12 @@
%%%----------------------------------------------------------------------
%%% File : mod_version.erl
%%% Author : Alexey Shchepin <alexey@sevcom.net>
%%% Purpose :
%%% Purpose : XEP-0092: Software Version
%%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%%----------------------------------------------------------------------
-module(mod_version).
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
-behaviour(gen_mod).
@ -36,32 +34,38 @@ process_local_iq(From, To, #iq{id = ID, type = Type,
set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
get ->
OSType = case os:type() of
{Osfamily, Osname} ->
atom_to_list(Osfamily) ++ "/" ++
atom_to_list(Osname);
Osfamily ->
atom_to_list(Osfamily)
end,
OSVersion = case os:version() of
{Major, Minor, Release} ->
lists:flatten(
io_lib:format("~w.~w.~w",
[Major, Minor, Release]));
VersionString ->
VersionString
end,
OS = OSType ++ " " ++ OSVersion,
Host = To#jid.server,
OS = case gen_mod:get_module_opt(Host, ?MODULE, show_os, true) of
true -> [get_os()];
false -> []
end,
IQ#iq{type = result,
sub_el = [{xmlelement, "query",
[{"xmlns", ?NS_VERSION}],
[{xmlelement, "name", [],
[{xmlcdata, "ejabberd"}]},
{xmlelement, "version", [],
[{xmlcdata, ?VERSION}]},
{xmlelement, "os", [],
[{xmlcdata, OS}]}
]}]}
[{xmlcdata, ?VERSION}]}
] ++ OS
}]}
end.
get_os() ->
OSType = case os:type() of
{Osfamily, Osname} ->
atom_to_list(Osfamily) ++ "/" ++
atom_to_list(Osname);
Osfamily ->
atom_to_list(Osfamily)
end,
OSVersion = case os:version() of
{Major, Minor, Release} ->
lists:flatten(
io_lib:format("~w.~w.~w",
[Major, Minor, Release]));
VersionString ->
VersionString
end,
OS = OSType ++ " " ++ OSVersion,
{xmlelement, "os", [], [{xmlcdata, OS}]}.