Registering new IQ handlers

Hi,

Upon trying send a message to a new namespace direct to my IM host, I get a 'feature not implemented' error.

The module looks like this:

-module(mod_dyl1).

-behavior(gen_mod).

-include("ejabberd.hrl").
-include_lib("exmpp.hrl").
-export([start/2, stop/1,process_local_iq/3]).

-define(NS_FETCHMEDG, "http://jabber.org/protocol/test").

start(Host, Opts) when is_list(Host) -> start(list_to_binary(Host), Opts);
start(HostB, Opts) ->
ejabberd_local:refresh_iq_handlers(),
 ?INFO_MSG("Dg v0.1 starting...~p", [HostB]),
	IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
    gen_iq_handler:add_iq_handler(ejabberd_local, HostB, ?NS_FETCHMEDG,
				  ?MODULE, process_local_iq, IQDisc),
 ?INFO_MSG("DG v0.1 STARTED!", []),
    ok.

stop(Host) ->
HostB = list_to_binary(Host),
gen_iq_handler:remove_iq_handler(ejabberd_local, HostB, ?NS_FETCHMEDG),
 ?INFO_MSG("DG v0.1 shut down", []),
    ok.

process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
 ?INFO_MSG("In process local", []),
    Response = #xmlel{ns = ?NS_FETCHMEDG, name = 'query', attrs =
      [#xmlattr{name = 'seconds', value = <<"testme">>}]},
    exmpp_iq:result(IQ_Rec, Response);
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
    exmpp_iq:error(IQ_Rec, 'not-allowed').

It compiles and ejabberd starts it up without complaint.

Any ideas what I am doing wrong?

Syndicate content