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:
parent
588b43f9b7
commit
a78ea8fb54
@ -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)
|
||||||
|
@ -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}
|
||||||
|
|
||||||
|
@ -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,32 +34,38 @@ 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 ->
|
||||||
OSType = case os:type() of
|
Host = To#jid.server,
|
||||||
{Osfamily, Osname} ->
|
OS = case gen_mod:get_module_opt(Host, ?MODULE, show_os, true) of
|
||||||
atom_to_list(Osfamily) ++ "/" ++
|
true -> [get_os()];
|
||||||
atom_to_list(Osname);
|
false -> []
|
||||||
Osfamily ->
|
end,
|
||||||
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,
|
|
||||||
IQ#iq{type = result,
|
IQ#iq{type = result,
|
||||||
sub_el = [{xmlelement, "query",
|
sub_el = [{xmlelement, "query",
|
||||||
[{"xmlns", ?NS_VERSION}],
|
[{"xmlns", ?NS_VERSION}],
|
||||||
[{xmlelement, "name", [],
|
[{xmlelement, "name", [],
|
||||||
[{xmlcdata, "ejabberd"}]},
|
[{xmlcdata, "ejabberd"}]},
|
||||||
{xmlelement, "version", [],
|
{xmlelement, "version", [],
|
||||||
[{xmlcdata, ?VERSION}]},
|
[{xmlcdata, ?VERSION}]}
|
||||||
{xmlelement, "os", [],
|
] ++ OS
|
||||||
[{xmlcdata, OS}]}
|
}]}
|
||||||
]}]}
|
|
||||||
end.
|
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}]}.
|
||||||
|
Loading…
Reference in New Issue
Block a user