- I noted that the megaphone replies were missing the content-length header.
- I decided to try a simple pass-through.
- I got a simple pass-through to work.
I worked on getting a reasonably simple, single-connection program to work. It's not quite there yet, but it's a lot further along than the multi-connection program.
One thing that I did differently was that the ejabberd side was much simpler. All that is really needed for an ejabberd module is to create a start function and a stop function. To use the module create a line in the ejabberd.cfg file in the section for modules. For example:
{modules,
{mod_adhoc, []},
...
{mod_simple, [7280]}
}
In this example, a module called mod_simple gets passed the parameter 7280. The function would look something like this:
-module(mod_simple).
-export([start/2, stop/1, start_module/1]).
-behavior(gen_mod).
-include("ejabberd.hrl").
start(_Host, [Port]) ->
spawn(?MODULE, start_module, [Port]),
ok.
stop(_Ignored) ->
ok.
start_module(Port) ->
<do whatever>.
In the example above, the value passed to start for Port would be 7280.
Next time: more ejabberd module details.
One thing that I did differently was that the ejabberd side was much simpler. All that is really needed for an ejabberd module is to create a start function and a stop function. To use the module create a line in the ejabberd.cfg file in the section for modules. For example:
{modules,
{mod_adhoc, []},
...
{mod_simple, [7280]}
}
In this example, a module called mod_simple gets passed the parameter 7280. The function would look something like this:
-module(mod_simple).
-export([start/2, stop/1, start_module/1]).
-behavior(gen_mod).
-include("ejabberd.hrl").
start(_Host, [Port]) ->
spawn(?MODULE, start_module, [Port]),
ok.
stop(_Ignored) ->
ok.
start_module(Port) ->
<do whatever>.
In the example above, the value passed to start for Port would be 7280.
Next time: more ejabberd module details.
No comments:
Post a Comment