   func joinChannel() {
     if channel.status == .Joined {
       loadMessages()
-      channel.delegate = self
       return
     }
 

    textInputbarHidden = true

    channel.joinWithCompletion { result in
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
        self.loadMessages()
        dispatch_async(dispatch_get_main_queue(), {
          self.channel.delegate = self
          UIApplication.sharedApplication().networkActivityIndicatorVisible = false
          self.setTextInputbarHidden(false, animated: true)
        })
      })
    }
  }

  func ipMessagingClient(client: TwilioIPMessagingClient!, channel: TWMChannel!, memberLeft member: TWMMember!) {
    addMessages([StatusMessage(member:member, status:.Left)])
  }

  func ipMessagingClient(client: TwilioIPMessagingClient!, channelHistoryLoaded channel: TWMChannel!) {
    loadMessages()
    tableView.reloadData()
  }

  func ipMessagingClient(client: TwilioIPMessagingClient!, channelDeleted channel: TWMChannel!) {
    dispatch_async(dispatch_get_main_queue(), {
      if channel == self.channel {
        self.revealViewController().rearViewController
          .performSegueWithIdentifier(MainChatViewController.TWCOpenGeneralChannelSegue, sender: nil)
      }
    })
  }
}
