[ejabberd] module dev question

Eric Cestari eric at ohmforce.com
Fri Sep 5 19:03:10 MSD 2008

Hi Gabriel,
Le 5 sept. 08 à 16:02, Gabriel Rossetti a écrit :

> Gabriel Rossetti wrote:
>> Hello everyone,
>> I'm trying to develop a module that will change the way the auth is  
>> done (add some verification on the resource). I have some questions:
>> 1) is that possible?
> From what I see, the resource isn't  sent during the authentication.  
> But if anyone has any interesting docs/examples of auth module  
> coding for ejabberd, I still interested.
and all other ejabberd_auth_* provide a good wealth of information.

>> 2) if so, does anyone know of any resources that could be useful?  
>> (posts, tutorials/howtos/examples, etc)

The best I can recommend is grab Joe Armstrong's book on erlang and  
peruse the source code of ejabberd.
mod_echo is a good start : https://svn.process-one.net/ejabberd/trunk/src/mod_echo.erl
and there are a few pages on the Process One website you might want to  
read :
>> I've never coded anything in Erlang and I haven't written anything  
>> using a functional language in over 2 years (Haskell). I'm  
>> currently evaluating ejabberd against Openfire to see which one  
>> fits my needs better (to be able to write a module/plugin to modify  
>> the auth mechanism).

I did that too, comparing OpenFire to ejabberd.
About OpenFire : source code is quite clean, and well documented.  
However I know from a Jive salesman that they are not really  
interested in OpenFire in the long term anymore
It's written in Java ; many people will *think* it's easier to code  
for :)
However, you'll quickly notice that erlang is the *perfect match* for  
writing an XMPP server with pattern matching and cheap process spawning.

Code is way smaller.
I've written the same component for OpenFire in Java and ejabberd in  
erlang. Java code was roughly 2000 LOC.  erlang code was less than  
1000 LOC. And I am not counting the XML files (the OpenFire version  
used Hibernate Spring and all the things I get for free with erlang).

Erlang/OTP is quite easy to grasp (especially compared to Java/JEE).  
Give yourself a week with Joe's book and the ejabberd codebase, you  
should be able to code something.

I just wish ejabberd's source code had more comments, but even that is  
a minor issue, once you get around the erlang syntax.


More information about the ejabberd mailing list