anchor.diff:  %%%===================================================================
   
   %% Stream is started we need authenticated.
  -parse_xml([#xmlel{name= <<"stream:features">>, children=[#xmlel{name= <<"starttls">>}|_]}],
  -	  #state{name=Name, pass=Pass}=State) ->
  +parse_xml([#xmlel{name= <<"stream:features">>, children=[#xmlel{name= <<"starttls">>}|_]}], State) ->
       lager:info("State ~p", [State]),
  -    AuthPlain = xml_packet(auth, 'PLAIN', {Name, Pass}),
  +    AuthPlain = xml_packet(auth, 'PLAIN', State),
       gen_server:cast(self(), {send, AuthPlain});
   
   %% Second stream is started we need bind it.
  -parse_xml([#xmlel{name= <<"stream:features">>}], _) ->
  +parse_xml([#xmlel{name= <<"stream:features">>}], State) ->
       lager:info("Second stream started!!"),
  -    XmlBind = xml_packet(bind, 121324567),
  +    XmlBind = xml_packet(bind, State),
       gen_server:cast(self(), {send, XmlBind});
   
  -parse_xml([#xmlel{name= <<"success">>}], #state{name=Name, server=Server}) ->
  -    XmlPacket = xml_packet(stream, {Name, Server}),
  +parse_xml([#xmlel{name= <<"success">>}], State) ->
  +    XmlPacket = xml_packet(stream, State),
       %% lager:info("New stream ~p", [XmlPacket]),
       gen_server:cast(self(), {new_stream, XmlPacket});
   
   %% Session is started, we start rooms' workers.
   parse_xml([#xmlel{name= <<"iq">>, attrs=[{<<"type">>, <<"result">>}|_]}]=Xml,
  -	  #state{rooms=Rooms, name=Name, server=Server}) ->
  +	  #state{rooms=Rooms}=State) ->
       lager:info("New sessions started, we are starting rooms ~p!!!", [Rooms]),
       %% Start ping scheduler
  -    ping_scheduler(Name, Server),
  -    [ begin
  -	  Pid ! {get_data, Xml}
  -      end || {_Room, Pid} <- Rooms ];
  +    ping_scheduler(State),
  +    [ Pid ! {get_data, Xml} || {_Room, Pid} <- Rooms ];
   
       
   parse_xml([#xmlel{name= <<"iq">>, attrs=[{<<"from">>, AServer}|_]}],
  -	  #state{name = Name, server=Server, tref = TRef}) when AServer =:= Server ->
  +	  #state{server=Server, tref=TRef}=State) when AServer =:= Server ->
       lager:info("We got ping from ~p server!!", [Server]),
       %% First we cancel error TRef
       {ok, cancel} = timer:cancel(TRef),
       %% Start ping scheduler again
  -    ping_scheduler(Name, Server);
  -
  -parse_xml([#xmlel{name= <<"iq">>}], _) ->
  -    XmlPacket = xml_packet(session, 123456576),
  +    ping_scheduler(State);
  +
  +parse_xml([#xmlel{name= <<"iq">>}], State) ->
  +    XmlPacket = xml_packet(session, State),
       gen_server:cast(self(), {send, XmlPacket});
   
   parse_xml([#xmlel{name= <<"message">>}=Data]=Xml, #state{rooms=Rooms}=_State) ->
  
positive.code: handle_info({tcp, _Socket, Data}, #state{xml_stream=undefined}=State) ->
      {ok, Parser0} = exml_stream:new_parser(),
      {ok, Parser1, Xml} = exml_stream:parse(Parser0, Data),
      %% lager:info("Xml ~p", [Xml]),
      parse_xml(Xml, State),
      {noreply, State#state{xml_stream = Parser1}};
  
  
negative.code:     {noreply, NewState :: #state{}} |
      {noreply, NewState :: #state{}, timeout() | hibernate} |
      {stop, Reason :: term(), NewState :: #state{}}).
  handle_cast(connect, #state{server=Server}=State) ->
      {ok, Socket} = gen_tcp:connect(binary_to_list(Server), 5222, [binary,
  								  {keepalive, true},
  								  {active, true},
  								  {packet, 0},
  								  {reuseaddr, true}]),
      ok = gen_tcp:controlling_process(Socket, self()),
      Message = xml_packet(stream, State),
      gen_server:cast(self(), {send, Message}),
      gen_server:cast(self(), start_rooms), %% Start rooms.
      {noreply, State#state{socket = Socket}};
  