app/assets/javascripts/backbone/models/contact.js.coffee
ff94bdbf
 class Xmpp.Models.Contact extends Xmpp.Models.Model
   namespace: 'app.roster'
 
   defaults:
52ef7688
     jid: ''
     name: ''
     status: 'offline'
     message: ''
ff94bdbf
 
   initialize: ->
b27f285a
     _.bindAll(this)
ff94bdbf
 
52ef7688
     if ! @get('name')
       @set(name: @get('jid'))
 
 
ff94bdbf
 class Xmpp.Collections.ContactsCollection extends Backbone.Collection
   model: Xmpp.Models.Contact
b27f285a
 
   initialize: ->
     _.bindAll(this)
     @counter = 0
     @friendsList = new Xmpp.Views.Contacts.ListView(collection: this, attributes: {title: 'chat.roster.friends', id: 'js-inactive-friends'})
 #    @activeList  = new Xmpp.Views.Contacts.ListView(collection: this, attributes: {title: 'chat.roster.chat-group', id: 'js-active-friends'})
 
     @on("add", @appendContact)
 
   appendContact: (contact) ->
     @counter++
52ef7688
     @friendsList.appendContact(contact)
 
   updateStatus: (response) ->
     @get(response.jid).set(message: response.status.message, status: response.status.status)
 
   udpateVcard: (response) ->
     @get(response.jid).set(name: response.vcard.name)