 
       triggerPush = true
 
-    buffer.onDidChange (event) ->
+    buffer.onDidChange (event) =>
       return unless triggerPush
       deletion = !(event.newText is "\n") and (event.newText.length is 0)
-      pairingChannel.trigger 'client-change', {deletion: deletion, event: event}
+      @pairingChannel.trigger 'client-change', {deletion: deletion, event: event}
+
+  shareCurrentFile: (buffer)->
+    currentFile = buffer.getText()
+    @pairingChannel.trigger 'client-share-file', currentFile


    buffer = atom.workspace.getActiveEditor().buffer

    pusher = new Pusher @app_key,
      authTransport: 'client'
      clientAuth:
        key: @app_key
        secret: @app_secret

    pairingChannel = pusher.subscribe("private-session-#{@sessionId}")

    pairingChannel.bind 'client-change', (data) ->

      newRange = Range.fromObject(data.event.newRange)
      oldRange = Range.fromObject(data.event.oldRange)

        invitePanel.hide()

  sendHipChatMessageTo: (mentionName) ->
    hc_client = new HipChat(@hc_key)

    @sessionId = "#{@app_key}-#{@app_secret}-#{randomstring.generate(11)}"

    params =
      room: @room_id
      from: 'PusherPair'
      message: "Hello there #{mentionName}. Somebody really really wants to pair with you. Go onto Atom, and if you've installed the PusherPair plugin, hit 'Join a pairing session', and enter this string: #{@sessionId}"
      message_format: 'text'

    hc_client.postMessage params, (data) =>
      alertView = new AlertView "#{mentionName} has been sent an invitation. Hold tight!"
      atom.workspace.addModalPanel(item: alertView, visible: true)
      @members = 1
      @startPairing()


