25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01: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> 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/zh.msg: Updated (thanks to Shelley Shyan)
* src/msgs/es.msg: Updated (thanks to Badlop) * src/msgs/es.msg: Updated (thanks to Badlop)

View File

@ -2946,6 +2946,8 @@ answers \ejabberd{}'s version when queried.
Options: Options:
\begin{description} \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})} \iqdiscitem{Software Version (\ns{jabber:iq:version})}
\end{description} \end{description}

View File

@ -1,14 +1,12 @@
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%% File : mod_version.erl %%% File : mod_version.erl
%%% Author : Alexey Shchepin <alexey@sevcom.net> %%% Author : Alexey Shchepin <alexey@sevcom.net>
%%% Purpose : %%% Purpose : XEP-0092: Software Version
%%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@sevcom.net> %%% Created : 18 Jan 2003 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(mod_version). -module(mod_version).
-author('alexey@sevcom.net'). -author('alexey@sevcom.net').
-vsn('$Revision$ ').
-behaviour(gen_mod). -behaviour(gen_mod).
@ -36,6 +34,24 @@ process_local_iq(From, To, #iq{id = ID, type = Type,
set -> set ->
IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]}; IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
get -> get ->
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}]}
] ++ OS
}]}
end.
get_os() ->
OSType = case os:type() of OSType = case os:type() of
{Osfamily, Osname} -> {Osfamily, Osname} ->
atom_to_list(Osfamily) ++ "/" ++ atom_to_list(Osfamily) ++ "/" ++
@ -52,16 +68,4 @@ process_local_iq(From, To, #iq{id = ID, type = Type,
VersionString VersionString
end, end,
OS = OSType ++ " " ++ OSVersion, OS = OSType ++ " " ++ OSVersion,
IQ#iq{type = result, {xmlelement, "os", [], [{xmlcdata, OS}]}.
sub_el = [{xmlelement, "query",
[{"xmlns", ?NS_VERSION}],
[{xmlelement, "name", [],
[{xmlcdata, "ejabberd"}]},
{xmlelement, "version", [],
[{xmlcdata, ?VERSION}]},
{xmlelement, "os", [],
[{xmlcdata, OS}]}
]}]}
end.