[ejabberd] mod_roster hook (in_subscription) not being called

Stephan Maihöfer sma at turtle-entertainment.de
Mon Dec 8 21:27:08 MSK 2008


hi,
 
since I am currently writing a new mod_roster to authenticate against
out api-server and handling it's JSON repsonses, I am reading through
all the sourcecode and documentation I can get. It's been quite "ok"
up until now, but now I have a problem.
 
I have hooks registered for process_iq and process_local_iq that handle
invitations and then push items to the connected clients, this seems
to be working fine, but i have problems with the hooks for in_subscription
and out_subscription.
 
-export([start/2, stop/1,
   process_iq/3,
   process_sm_iq/3,
   process_local_iq/3,
   get_user_roster/2,
   in_subscription/6,
   out_subscription/4,
   get_in_pending_subscriptions/3,
   get_subscription_lists/3]).

start(Host, Opts) ->
    ?INFO_MSG("mod_roster_wire starting...", []),
    IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
    ejabberd_hooks:add(roster_get, Host,
      ?MODULE, get_user_roster, 50),
    ejabberd_hooks:add(roster_in_subscription, Host,
      ?MODULE, in_subscription, 50),
    ejabberd_hooks:add(roster_out_subscription, Host,
      ?MODULE, out_subscription, 50),
    ejabberd_hooks:add(roster_get_subscription_lists, Host,
      ?MODULE, get_subscription_lists, 50),
%%  ejabberd_hooks:add(roster_get_jid_info, Host,
%%    ?MODULE, get_jid_info, 50),
%%    ejabberd_hooks:add(remove_user, Host,
%%    ?MODULE, remove_user, 50),
    ejabberd_hooks:add(resend_subscription_requests_hook, Host,
      ?MODULE, get_in_pending_subscriptions, 50),
    gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER,
      ?MODULE, process_iq, IQDisc).

after the initial iq-set when adding a new contact, I am sending my presence
with type="subscribe" to the entity i want to subscribe to. In the logfiles
I see that the hook for out_subscription is called and everything seems
to be running fine (no exceptions or something like that). Then i see
this:

=INFO REPORT==== 2008-12-08 19:18:15 ===
D(<0.308.0>:ejabberd_router:301) : route
  from {jid,"user1","example.com",[],"user1","example.com",[]}
  to {jid,"user2","example.com",[],"user2","example.com",[]}
  packet {xmlelement,"presence",
                           [{"xml:lang","en"},
                            {"type","subscribe"},
                            {"to","user2 at example.com <mailto:user2 at example.com> "}],
                           [{xmlcdata,<<"\n">>},
                            {xmlelement,
                                "nick",
                                [{"xmlns","http://jabber.org/protocol/nick <http://jabber.org/protocol/nick> "}],
                                [{xmlcdata,<<"friend">>}]},
                            {xmlcdata,<<"\n">>}]}
 

=INFO REPORT==== 2008-12-08 19:18:15 ===
D(<0.308.0>:ejabberd_local:279) : local route
  from {jid,"user1","example.com",[],"user1","example.com",[]}
  to {jid,"user2","example.com",[],"user2","example.com",[]}
  packet {xmlelement,"presence",
                           [{"xml:lang","en"},{"type"|...},{...}],
                           [{xmlcdata|...},{...}|...]}
 

=INFO REPORT==== 2008-12-08 19:18:15 ===
D(<0.308.0>:ejabberd_sm:372) : session manager
  from {jid,"user1","example.com",[],"user1","example.com",[]}
  to {jid,"user2","example.com",[],"user2","example.com",[]}
  packet {xmlelement,"presence",
                           [{"xml:lang","en"},{"type"|...},{...}],
                           [{xmlcdata|...},{...}|...]}
 
But the presence packet does not reach the other user, nor is the in_subscription
hook being called. What am I doing wrong? Do I need to manually "relay" the
presence? Why doesn't the session manager actually call it, how to make the
hook being called?
 
thanks in advance,
stephan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20081208/36947818/attachment.htm>


More information about the ejabberd mailing list