anchor.diff:  %%%===================================================================
   %%% Helpers
   %%%===================================================================
  -send0(#transport{socket = {Host, Port, Path}}, Elem0, State) ->
  +send(#transport{socket = {Host, Port, Path}} = Transport, Body,
  +     #state{requests = Requests} = State) ->
       Headers = [{"Content-Type", "text/xml; charset=utf-8"}],
  -    Elem = wrap_elem(Elem0, State),
       Self = self(),
       AsyncReq = fun() ->
           {ok, Reply} =
               lhttpc:request(Host, Port, false, Path, 'POST',
  -                Headers, exml:to_iolist(Elem), infinity, []),
  -        Self ! {http_reply, Reply}
  -    end,
  -    spawn_link(AsyncReq),
  -    State#state{rid=State#state.rid+1}.
  +                Headers, exml:to_iolist(Body), infinity, []),
  +        Self ! {http_reply, Reply, Transport}
  +    end,
  +    proc_lib:spawn_link(AsyncReq),
  +    State#state{rid = State#state.rid+1,
  +                requests = Requests + 1}.
  +
  +send0(Transport, Elem, State) ->
  +    send(Transport, wrap_elem(Elem, State), State).
   
   handle_data(Data, #state{owner = Owner} = State) ->
       {ok, Body} = exml:parse(Data),
  
positive.code:                 children = [#xmlelement{name = <<"presence">>,
                                     attrs = [{<<"type">>, <<"unavailable">>},
                                              {<<"xmlns">>, <<"jabber:client">>}]}]};
  wrap_elem(Element, #state{sid = Sid, rid=Rid}) ->
      #xmlelement{name = <<"body">>,
              attrs = common_attrs(Rid, Sid),
              children = [Element]}.
  
  common_attrs(Rid) ->
      [{<<"rid">>, pack_rid(Rid)},
  
negative.code:     {noreply, State#state{parser = NewParser}}.
  
  %% Handle async HTTP request replies.
  handle_info({http_reply, {_StatusAndReason, _Hdrs, Body}, Transport}, S) ->
      NS = handle_data(Body, S#state{requests = S#state.requests - 1}),
      NNS = case NS#state.requests == 0 of
          true ->
              send(Transport, empty_body(NS), NS);
          false ->
              NS
      end,
      {noreply, NNS};
  handle_info(_, State) ->
      {noreply, State}.
  
  