[ejabberd] pubsub - remove_user does not call unsubscribe_node

Cai, Juliet Z juliet.z.cai at intel.com
Fri Dec 10 00:37:25 MSK 2010


Hi All,

I am trying to debug this issue on my server and found what might be a bug in node_hometree_odbc.erl. Could someone help confirm that?


remove_user(User, Server) ->

    LUser = jlib:nodeprep(User),

    LServer = jlib:nameprep(Server),

    Entity = jlib:make_jid(LUser, LServer, ""),

    Host = host(LServer),

    HomeTreeBase = string_to_node("/home/"++LServer++"/"++LUser),

    spawn(fun() ->

      lists:foreach(fun(PType) ->

          {result, Subscriptions} = node_action(Host, PType, get_entity_subscriptions, [Host, Entity]),

          lists:foreach(fun

            ({#pubsub_node{id = NodeId}, _, _, JID}) -> node_action(Host, PType, unsubscribe_node, [NodeId, Entity, JID, all])

              %%% I think there is an extra '_,' before JID, once I removed one underscore, the code seems be running again. %%%

          end, Subscriptions),

          {result, Affiliations} = node_action(Host, PType, get_entity_affiliations, [Host, Entity]),

          lists:foreach(fun

            ({#pubsub_node{nodeid = {H, N}, parents = []}, owner}) -> delete_node(H, N, Entity);

            ({#pubsub_node{nodeid = {H, N}, type = "hometree"}, owner}) when N == HomeTreeBase -> delete_node(H, N, Entity);

            ({#pubsub_node{id = NodeId}, publisher}) -> node_action(Host, PType, set_affiliation, [NodeId, Entity, none]);

            (_) -> ok

          end, Affiliations)

      end, plugins(Host))

    end).


Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20101209/a0f37458/attachment.html>


More information about the ejabberd mailing list