anchor.diff:  -include("jlib.hrl").
   -include("ejabberd_http.hrl").
   
  --define(LANG,         "en").
  --define(WAIT,         "60").
  --define(HOLD,         "1").
  --define(WINDOW,       "5").
  --define(CONTENT,      "text/xml; charset=utf-8").
  --define(VER,          "1.6").
  --define(XMPP_VERSION, "1.0").
  +-define(LANG, "en").
  +-define(WAIT, "60").
  +-define(HOLD, "1").
  +-define(VER,  "1.6").
   
   -record(binding, {jid, sid, rid}).
   
  
positive.code:     RidSessionRequest = RidResourceBind   + 1,
      RidNext           = RidSessionRequest + 1,
      
      {xmlelement, "body", Attrs1, _ } = process_request("<body rid='"++integer_to_list(RidSessionCreate)++"' xmlns='http://jabber.org/protocol/httpbind' to='"++Server++"' xml:lang='"++Lang++"' wait='"++Wait++"' hold='"++Hold++"' window='"++Window++"' content='"++Content++"' ver='"++Ver++"' xmpp:version='"++XMPPVersion++"' xmlns:xmpp='urn:xmpp:xbosh'/>", IP),
      {value, {_, Sid}}    = lists:keysearch("sid",    1, Attrs1),
      {value, {_, AuthID}} = lists:keysearch("authid", 1, Attrs1),
      Auth = base64:encode_to_string(AuthID++[0]++User++[0]++Password),
  
negative.code: bind(SJID, Password, IP, Data) ->
      #jid{user = User, server = Server, resource = Resource} = jlib:string_to_jid(SJID),
      
      Lang        = default_value( lang, Data, ?LANG ),
      Wait        = default_value( wait, Data, ?WAIT ),
      Hold        = default_value( hold, Data, ?HOLD ),
      Ver         = default_value( ver,  Data, ?VER  ),
      
      RidSessionCreate  = list_to_integer(randoms:get_string()),
      RidAuth           = RidSessionCreate  + 1,
  