   presence: (presence) ->
     from = presence.from.split('/')[0]
     return if from == @session.bareJid()
-    this.eachContact from, (node) ->
-      status = presence.status || 'Available'
-      $('.status-msg', node).text status
+    if !presence.type || presence.offline
+      status =
+        if presence.status       then presence.status
+        else if presence.offline then 'Offline'
+        else if presence.away    then 'Away'
+        else 'Available'
+      this.eachContact from, (node) ->
+        $('.status-msg', node).text status
 
     if presence.type == 'subscribe'
       node = $("""


    $('#search-roster-text').keyup  => this.filterRoster()
    $('#search-roster-text').change => this.filterRoster()
    $('#search-roster').click =>
      this.toggleForm '#search-roster-form', => this.filterRoster()


      name: $('#edit-contact-name').val()
      groups: []
    @session.updateContact contact
    this.eachContact @currentContact, (node) ->
      node.attr 'data-name', contact.name || ''
    false

  toggleForm: (form, fn) ->
