 
     view = @getOptions().view
     channelPaneInstance = view.addChannelTab name
+    channelPaneInstance.on "KDObjectWillBeDestroyed", =>
+      delete @channels[name]
+
     channelName = "client-#{name}"
 
     channel = new Channel 


  messageReceived: (message) ->
    @messages.push message
    @view.newMessage message

class ChatView extends KDView

    @channels[name] = channel

  parseMessageForChannels: (message) ->
    topicExp = /#([\w-]+)/g
    while match = topicExp.exec message
      channelName = match[1]
      channel = @joinChannel channelName
