From a884ba4e8a8447799ab5fbaa2cf490d83639add0 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Thu, 25 Aug 2005 20:48:45 +0000 Subject: * src/mod_vcard_ldap.erl: Bugfix * src/mod_vcard.erl: Bugfix * src/ejabberd_auth_odbc.erl: Bugfix * doc/dev.tex: Updated SVN Revision: 406 --- doc/dev.html | 89 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 37 deletions(-) (limited to 'doc/dev.html') diff --git a/doc/dev.html b/doc/dev.html index 48a96e7a7..22ee142bb 100644 --- a/doc/dev.html +++ b/doc/dev.html @@ -4,7 +4,7 @@ Ejabberd Developers Guide - + @@ -21,7 +21,7 @@ mailto:alexey@sevcom.net
xmpp:aleksey@jabber.ru -

September 10, 2003

+

August 21, 2005

@@ -47,11 +47,12 @@
  • 2  XML representation
  • 3  Module xml -
  • 4  ejabberd modules +
  • 4  Module xml_stream +
  • 5  ejabberd modules @@ -90,9 +91,6 @@ Works on most of popular platforms: *nix (tested on Linux, FreeBSD and
  • Support for Statistics Gathering.
  • Support for xml:lang -ejabberd is a Free and Open Source fault-tolerant distributed Jabber -server. It is written mostly in Erlang.
    -

    1.1  How it works

    @@ -158,7 +156,7 @@ does not exist, then it is opened and registered.

    2  XML representation

    -Each XML stanza represented as following tuple: +Each XML stanza is represented as the following tuple:
     XMLElement = {xmlelement, Name, Attrs, [ElementOrCDATA]}
             Name = string()
    @@ -173,7 +171,7 @@ XMLElement = {xmlelement, Name, Attrs, [ElementOrCDATA]}
     <message to='test@conference.example.org' type='groupchat'>
       <body>test</body>
     </message>
    -
    represented as following structure: +is represented as the following structure:
     {xmlelement, "message",
         [{"to", "test@conference.example.org"},
    @@ -233,21 +231,34 @@ Res = string() | XMLElement
              get_tag_attr/2, get_tag_attr_s/2
              get_subtag/2
     
    + + +

    4  Module xml_stream

    + + +
    +parse_element(Str) -> XMLElement | {error, Err}
    +
    +Str = string()
    +Err = term()
    +
    Parses Str using XML parser, returns either parsed element or error + tuple. +
    -

    4  ejabberd modules

    +

    5  ejabberd modules

    -

    4.1  gen_mod behaviour

    +

    5.1  gen_mod behaviour

    TBD

    -

    4.2  Module gen_iq_handler

    +

    5.2  Module gen_iq_handler

    The module gen_iq_handler allows to easily write handlers for IQ packets @@ -255,23 +266,25 @@ of particular XML namespaces that addressed to server or to users bare JIDs.

    In this module the following functions are defined:
    -add_iq_handler(Component, NS, Module, Function, Type)
    +add_iq_handler(Component, Host, NS, Module, Function, Type)
     Component = Module = Function = atom()
    -NS = string()
    +Host = NS = string()
     Type = no_queue | one_queue | parallel
    -
    Registers function Module:Function as handler for IQ packets that - contain child of namespace NS in Component. Queueing - discipline is Type. There are at least two components defined: +Registers function Module:Function as handler for IQ packets on + virtual host Host that contain child of namespace NS in + Component. Queueing discipline is Type. There are at least + two components defined:
    ejabberd_local
    Handles packets that addressed to server JID;
    ejabberd_sm
    Handles packets that addressed to users bare JIDs.
    -
    remove_iq_handler(Component, NS)
    +
    remove_iq_handler(Component, Host, NS)
     Component = atom()
    -NS = string()
    -
    Removes IQ handler for namespace NS from Component. +Host = NS = string() +Removes IQ handler on virtual host Host for namespace NS from + Component.
    Handler function must have the following type:
    @@ -284,8 +297,8 @@ From = To = jid() -behaviour(gen_mod). --export([start/1, - stop/0, +-export([start/2, + stop/1, process_local_iq/3]). -include("ejabberd.hrl"). @@ -293,13 +306,13 @@ From = To = jid() -define(NS_CPUTIME, "ejabberd:cputime"). -start(Opts) -> +start(Host, Opts) -> IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue), - gen_iq_handler:add_iq_handler(ejabberd_local, ?NS_CPUTIME, + gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_CPUTIME, ?MODULE, process_local_iq, IQDisc). -stop() -> - gen_iq_handler:remove_iq_handler(ejabberd_local, ?NS_CPUTIME). +stop(Host) -> + gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_CPUTIME). process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) -> case Type of @@ -317,7 +330,7 @@ process_local_iq(From, To, {iq, ID, Type, XMLNS, SubEl}) -> -

    4.3  Services

    +

    5.3  Services

    TBD
    @@ -328,14 +341,15 @@ TODO: use proc_lib -behaviour(gen_mod). --export([start/1, init/1, stop/0]). +-export([start/2, init/1, stop/1]). -include("ejabberd.hrl"). -include("jlib.hrl"). -start(Opts) -> - Host = gen_mod:get_opt(host, Opts, "echo." ++ ?MYNAME), - register(ejabberd_mod_echo, spawn(?MODULE, init, [Host])). +start(Host, Opts) -> + MyHost = gen_mod:get_opt(host, Opts, "echo." ++ Host), + register(gen_mod:get_module_proc(Host, ?PROCNAME), + spawn(?MODULE, init, [MyHost])). init(Host) -> ejabberd_router:register_local_route(Host), @@ -347,15 +361,16 @@ loop(Host) -> ejabberd_router:route(To, From, Packet), loop(Host); stop -> - ejabberd_router:unregister_local_route(Host), + ejabberd_router:unregister_route(Host), ok; _ -> loop(Host) end. -stop() -> - ejabberd_mod_echo ! stop, - ok. +stop(Host) -> + Proc = gen_mod:get_module_proc(Host, ?PROCNAME), + Proc ! stop, + {wait, Proc}. -- cgit v1.2.3