       body: messageBody
       meta: {createdAt: new Date().toISOString()}
 
-    chatItem.channel = fromChannel.name if fromChannel
-
-    channelMQName = "client-#{toChannel.name}"
+    chatItem.channel = fromChannel if fromChannel?.match(TOPICREGEX)
+
+    channelMQName = "client-#{toChannel}"
     @broadcaster.emit channelMQName, JSON.stringify(chatItem)
-    chatItem.author = "me"
-    toChannel.messageReceived chatItem
+    return unless @channels[toChannel]
+    #chatItem.author = "me"
+    @channels[toChannel].messageReceived chatItem
+
+  fetchAutoCompleteForMentionField:(inputValue,blacklist,callback)->
+    bongo.api.JAccount.byRelevance inputValue,{blacklist},(err,accounts)->
+      callback accounts
 
 class Channel extends KDEventEmitter
   constructor: (options = {}, data) ->

    "<p>{{#(name)}} - {{#(status)}} </p>"

class ChatInputForm extends KDFormView
  viewAppended: ->
    @addSubView @input = new KDInputView
      placeholder: "Click here to reply"
      name: "chatInput"
      cssClass: "fl"

      if status is "bind"
        channel.addOnlineUser presence
      else if status is "unbind"
        channel.removeOfflineUser presence

    channel.view.registerListener
      KDEventTypes  : "AutoCompleteNeedsMemberData"
      listener      : @
      callback      : (pubInst,event)=>
        {callback,inputValue,blacklist} = event
        @fetchAutoCompleteForMentionField inputValue,blacklist,callback 

    # When the channel's view receives chat input, parse the body
    # and broadcast it to corresponding channels.
    channel.view.on "ChatMessageSent", (messageBody) =>
      @parseMessage messageBody, name
      @broadcastOwnMessage messageBody, name 
      # Also broadcast to public channel
      if name isnt PUBLIC
        @broadcastOwnMessage messageBody, PUBLIC, name

    # Delegates to the channel to handle received message
    @broadcaster.on channelName, (msg) ->
