Class: DiasporaFederation::ReceiveController

Inherits:
ApplicationController show all
Defined in:
app/controllers/diaspora_federation/receive_controller.rb

Overview

This controller processes receiving messages.

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_locale

Instance Method Details

#privateObject

Receives private messages for a user

POST /receive/users/:guid


25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/diaspora_federation/receive_controller.rb', line 25

def private
  legacy = request.content_type != "application/json"

  data = data_for_private_message(legacy)
  logger.debug data

  success = DiasporaFederation.callbacks.trigger(:queue_private_receive, params[:guid], data, legacy)

  head success ? :accepted : :not_found
end

#publicObject

Receives public messages

POST /receive/public


11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/diaspora_federation/receive_controller.rb', line 11

def public
  legacy = request.content_type != "application/magic-envelope+xml"

  data = data_for_public_message(legacy)
  logger.debug data

  DiasporaFederation.callbacks.trigger(:queue_public_receive, data, legacy)

  head :accepted
end