mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
* src/mod_service_log.erl: Support for logging of user packets via
external service (e.g. bandersnatch) * doc/guide.tex: Updated SVN Revision: 261
This commit is contained in:
parent
d543a63e9b
commit
6755925676
@ -1,3 +1,9 @@
|
||||
2004-08-24 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_service_log.erl: Support for logging of user packets via
|
||||
external service (e.g. bandersnatch)
|
||||
* doc/guide.tex: Updated
|
||||
|
||||
2004-08-23 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_offline.erl: Added entire table locking on large message
|
||||
|
@ -98,12 +98,13 @@
|
||||
<LI><A HREF="#htoc42">A.12 <TT>mod_pubsub</TT></A>
|
||||
<LI><A HREF="#htoc43">A.13 <TT>mod_register</TT></A>
|
||||
<LI><A HREF="#htoc44">A.14 <TT>mod_roster</TT></A>
|
||||
<LI><A HREF="#htoc45">A.15 <TT>mod_stats</TT></A>
|
||||
<LI><A HREF="#htoc46">A.16 <TT>mod_time</TT></A>
|
||||
<LI><A HREF="#htoc47">A.17 <TT>mod_vcard</TT></A>
|
||||
<LI><A HREF="#htoc48">A.18 <TT>mod_version</TT></A>
|
||||
<LI><A HREF="#htoc45">A.15 <TT>mod_service_log</TT></A>
|
||||
<LI><A HREF="#htoc46">A.16 <TT>mod_stats</TT></A>
|
||||
<LI><A HREF="#htoc47">A.17 <TT>mod_time</TT></A>
|
||||
<LI><A HREF="#htoc48">A.18 <TT>mod_vcard</TT></A>
|
||||
<LI><A HREF="#htoc49">A.19 <TT>mod_version</TT></A>
|
||||
</UL>
|
||||
<LI><A HREF="#htoc49">B I18n/L10n</A>
|
||||
<LI><A HREF="#htoc50">B I18n/L10n</A>
|
||||
</UL>
|
||||
|
||||
<!--TOC section Introduction-->
|
||||
@ -1083,9 +1084,32 @@ Options:
|
||||
<B><TT>iqdisc</TT></B><DD> <TT>jabber:iq:roster</TT> IQ queries processing
|
||||
discipline (see <A HREF="#sec:modiqdiscoption">A.1.1</A>).
|
||||
</DL>
|
||||
<!--TOC subsection <TT>mod_service_log</TT>-->
|
||||
|
||||
<H3><A NAME="htoc45">A.15</A> <TT>mod_service_log</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:modservicelog"></A>
|
||||
This module adds support for logging of user packets via any jabber service.
|
||||
These packets encapsulated in <route/> element and sended to specified
|
||||
services.<BR>
|
||||
<BR>
|
||||
Options:
|
||||
<DL COMPACT=compact><DT>
|
||||
<B><TT>loggers</TT></B><DD> Specifies a list of services which will receive users
|
||||
packets.
|
||||
</DL>
|
||||
Example:
|
||||
<PRE>
|
||||
{modules,
|
||||
[
|
||||
...
|
||||
{mod_service_log, [{loggers, ["bandersnatch.example.com"]}]},
|
||||
...
|
||||
]}.
|
||||
</PRE>
|
||||
<!--TOC subsection <TT>mod_stats</TT>-->
|
||||
|
||||
<H3><A NAME="htoc45">A.15</A> <TT>mod_stats</TT></H3><!--SEC END -->
|
||||
<H3><A NAME="htoc46">A.16</A> <TT>mod_stats</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:modstats"></A>
|
||||
This module adds support for <A HREF="http://www.jabber.org/jeps/jep-0039.html">JEP-0039</A> (Statistics Gathering).<BR>
|
||||
@ -1099,7 +1123,7 @@ TBD about access.<BR>
|
||||
<BR>
|
||||
<!--TOC subsection <TT>mod_time</TT>-->
|
||||
|
||||
<H3><A NAME="htoc46">A.16</A> <TT>mod_time</TT></H3><!--SEC END -->
|
||||
<H3><A NAME="htoc47">A.17</A> <TT>mod_time</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:modtime"></A>
|
||||
This module answers UTC time on <TT>jabber:iq:time</TT> queries.<BR>
|
||||
@ -1111,7 +1135,7 @@ discipline (see <A HREF="#sec:modiqdiscoption">A.1.1</A>).
|
||||
</DL>
|
||||
<!--TOC subsection <TT>mod_vcard</TT>-->
|
||||
|
||||
<H3><A NAME="htoc47">A.17</A> <TT>mod_vcard</TT></H3><!--SEC END -->
|
||||
<H3><A NAME="htoc48">A.18</A> <TT>mod_vcard</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:modvcard"></A>
|
||||
This module implements simple Jabber User Directory (based on user vCards)
|
||||
@ -1139,7 +1163,7 @@ Example:
|
||||
</PRE>
|
||||
<!--TOC subsection <TT>mod_version</TT>-->
|
||||
|
||||
<H3><A NAME="htoc48">A.18</A> <TT>mod_version</TT></H3><!--SEC END -->
|
||||
<H3><A NAME="htoc49">A.19</A> <TT>mod_version</TT></H3><!--SEC END -->
|
||||
|
||||
<A NAME="sec:modversion"></A>
|
||||
This module answers <TT>ejabberd</TT> version on <TT>jabber:iq:version</TT> queries.<BR>
|
||||
@ -1151,7 +1175,7 @@ discipline (see <A HREF="#sec:modiqdiscoption">A.1.1</A>).
|
||||
</DL>
|
||||
<!--TOC section I18n/L10n-->
|
||||
|
||||
<H2><A NAME="htoc49">B</A> I18n/L10n</H2><!--SEC END -->
|
||||
<H2><A NAME="htoc50">B</A> I18n/L10n</H2><!--SEC END -->
|
||||
|
||||
<A NAME="sec:i18nl10n"></A>
|
||||
All built-in modules support <TT>xml:lang</TT> attribute inside IQ queries.
|
||||
|
@ -47,6 +47,7 @@
|
||||
\newcommand{\modpubsub}{\module{mod\_pubsub}}
|
||||
\newcommand{\modregister}{\module{mod\_register}}
|
||||
\newcommand{\modroster}{\module{mod\_roster}}
|
||||
\newcommand{\modservicelog}{\module{mod\_service\_log}}
|
||||
\newcommand{\modstats}{\module{mod\_stats}}
|
||||
\newcommand{\modtime}{\module{mod\_time}}
|
||||
\newcommand{\modvcard}{\module{mod\_vcard}}
|
||||
@ -1068,6 +1069,30 @@ Options:
|
||||
\end{description}
|
||||
|
||||
|
||||
\subsection{\modservicelog{}}
|
||||
\label{sec:modservicelog}
|
||||
|
||||
This module adds support for logging of user packets via any jabber service.
|
||||
These packets encapsulated in <route/> element and sended to specified
|
||||
services.
|
||||
|
||||
Options:
|
||||
\begin{description}
|
||||
\titem{loggers} Specifies a list of services which will receive users
|
||||
packets.
|
||||
\end{description}
|
||||
|
||||
Example:
|
||||
\begin{verbatim}
|
||||
{modules,
|
||||
[
|
||||
...
|
||||
{mod_service_log, [{loggers, ["bandersnatch.example.com"]}]},
|
||||
...
|
||||
]}.
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{\modstats{}}
|
||||
\label{sec:modstats}
|
||||
|
||||
|
59
src/mod_service_log.erl
Normal file
59
src/mod_service_log.erl
Normal file
@ -0,0 +1,59 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% File : mod_service_log.erl
|
||||
%%% Author : Alexey Shchepin <alexey@sevcom.net>
|
||||
%%% Purpose : Manage announce messages
|
||||
%%% Created : 24 Aug 2003 by Alexey Shchepin <alexey@sevcom.net>
|
||||
%%% Id : $Id$
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
-module(mod_service_log).
|
||||
-author('alexey@sevcom.net').
|
||||
|
||||
-behaviour(gen_mod).
|
||||
|
||||
-export([start/1,
|
||||
stop/0,
|
||||
log_user_send/3,
|
||||
log_user_receive/4]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
-include("jlib.hrl").
|
||||
|
||||
start(_) ->
|
||||
ejabberd_hooks:add(user_send_packet,
|
||||
?MODULE, log_user_send, 50),
|
||||
ejabberd_hooks:add(user_receive_packet,
|
||||
?MODULE, log_user_receive, 50),
|
||||
ok.
|
||||
|
||||
stop() ->
|
||||
ejabberd_hooks:delete(user_send_packet,
|
||||
?MODULE, log_user_send, 50),
|
||||
ejabberd_hooks:delete(user_receive_packet,
|
||||
?MODULE, log_user_receive, 50),
|
||||
ok.
|
||||
|
||||
log_user_send(From, To, Packet) ->
|
||||
log_packet(From, To, Packet).
|
||||
|
||||
log_user_receive(_JID, From, To, Packet) ->
|
||||
log_packet(From, To, Packet).
|
||||
|
||||
|
||||
log_packet(From, To, {xmlelement, Name, Attrs, Els}) ->
|
||||
Loggers = gen_mod:get_module_opt(?MODULE, loggers, []),
|
||||
ServerJID = #jid{user = "", server = ?MYNAME, resource = "",
|
||||
luser = "", lserver = ?MYNAME, lresource = ""},
|
||||
NewAttrs = jlib:replace_from_to_attrs(jlib:jid_to_string(From),
|
||||
jlib:jid_to_string(To),
|
||||
Attrs),
|
||||
FixedPacket = {xmlelement, Name, NewAttrs, Els},
|
||||
lists:foreach(
|
||||
fun(Logger) ->
|
||||
ejabberd_router:route(
|
||||
ServerJID,
|
||||
#jid{user = "", server = Logger, resource = "",
|
||||
luser = "", lserver = Logger, lresource = ""},
|
||||
{xmlelement, "route", [], [FixedPacket]})
|
||||
end, Loggers).
|
||||
|
Loading…
Reference in New Issue
Block a user