anchor.diff:           code_change/3]).
   
   %% BOSH XML elements
  --export([session_creation_body/2, session_creation_body/5,
  +-export([session_creation_body/2, session_creation_body/6,
            session_termination_body/2,
            empty_body/2, empty_body/3]).
   
  
positive.code:                 sid = nil,
                  rid = nil,
                  requests = 0,
                  keepalive = true}).
  
  %%%===================================================================
  %%% API
  
negative.code:                compress = false,
                 rcv_pid = self()}.
  
  wrap_elem(#xmlstreamstart{attrs = Attrs},
            #state{rid = Rid, sid = Sid, wait = Wait}) ->
      Version = proplists:get_value(<<"version">>, Attrs, <<"1.0">>),
      Lang = proplists:get_value(<<"xml:lang">>, Attrs, <<"en">>),
      To = proplists:get_value(<<"to">>, Attrs, <<"localhost">>),
      session_creation_body(Wait, Version, Lang, Rid, To, Sid);
  wrap_elem(["</", <<"stream:stream">>, ">"], #state{sid=Sid, rid=Rid}) ->
      session_termination_body(Rid, Sid);
  wrap_elem(Element, #state{sid = Sid, rid=Rid}) ->
  