anchor.diff:                  items ->
                       exmpp_xml:foreach(fun(_, Item) -> process_pubsub_item(Item, State) end, Element);
                   delete ->
  -                    ?DEBUG("Delete notification"),
  -                    ?DEBUG(Element)
  -                    %% TODO - we get the pubsub node here which has
  -                    %% been deleted; look it up in the rsc table
  -                    %% (reverse lookup - custom pivot?) and delete
  +                    %% We get the pubsub node here which has been
  +                    %% deleted; look it up in the rsc table (reverse
  +                    %% lookup - custom pivot?) and delete
                       %% corresponding rsc.
  +
  +                    %% Construct XMPP URI from 'from' and 'node' elements in the received XML.
  +                    Node = exmpp_xml:get_attribute_as_list(Element, node, undefined),
  +                    From = exmpp_xml:get_attribute_as_list(Raw, from, undefined),
  +                    XmppUri = "xmpp:" ++ From ++ "?;node=" ++ Node,
  +                    %% Reverse lookup xmpp uri -> rsc id
  +                    case z_pivot_rsc:lookup_custom_pivot(?MODULE, sub_xmpp_uri, XmppUri, State#state.context) of
  +                        undefined ->
  +                            ?LOG("Got delete notification but no subscription found for '~p'", [XmppUri]);
  +                        RscId ->
  +                            ok = m_rsc:delete(RscId, State#state.context),
  +                            ?DEBUG("Got delete notification; removed subscription and item.")
  +                    end,
  +                    ok
               end
       end.
   
  
positive.code:                         undefined ->
                              {noreply, State};
                          _Node ->
                              ok = delete_notification(Id, true, State),
                              {noreply, State}
                      end
              end;
  
negative.code:     end.
  
  
  send_delete_notification(Id, RscIsDeleted, #state{jid=JID,session=Session,context=Context,pubsub_domain=Domain}) ->
      Node = get_pubsub_node(Id, Context),
      IQ = exmpp_client_pubsub:delete_node(Domain, Node),
      PacketId = binary_to_list(exmpp_session:send_packet(Session, exmpp_stanza:set_sender(IQ, JID))),
      receive
  