 attach_connection = (opt) ->
 
   connection = create_connection_obj()
-  connection_options.jid = Strophe.getBareJidFromJid connection_options.jid
+  #connection_options.jid = Strophe.getBareJidFromJid connection_options.jid
   connection.attach connection_options.jid
     , connection_options.sid
     , connection_options.rid


# Loads the connection data from local storage.
restoreData = ->
  if localStorage?
    for k in [ "jid", "sid", "rid", "host", "port", "path" ]
      j = key2cache k
      connection_options[k] = localStorage[j]  if localStorage[j]

hasConnectionData = ->
  opt = connection_options

key2cache   = (k) -> "#{CACHE_PREFIX}#{k}"

saveData = ->
  if sessionStorage?
    for k in ["jid", "sid", "rid"] when connection[k]?
      sessionStorage[key2cache k] = connection[k]

    for k in ["host", "port", "path"] when connection_options[k]?
      sessionStorage[key2cache k] = connection_options[k]

clearData = -> sessionStorage?.clear()

onConnected = ->

