src/snac/server/ServerExecutor.php
/**
     * Send Message
     *
     * Sends a message given on input to a user, then emails them to notify them
     * of the message.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACInputException
     * @return string[] The response to send to the client
     */
Send Message
Sends a message given on input to a user, then emails them to notify them
of the message.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACInputException
@return string[] The response to send to the client
Send Message Sends a message given on input to a user then emails them to notify them of the message . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACInputException @return string [] The response to send to the client
public function sendMessage(&$input) {
        if (!isset($input["message"])) {
            throw new \snac\exceptions\SNACInputException("No message given to send", 400);
        }
        $response = array();
        $message = new \snac\data\Message($input["message"]);
        if ($message->getFromUser() === null || $message->getFromUser()->getUserID() !== $this->user->getUserID()) {
            throw new \snac\exceptions\SNACPermissionException("User does not have permission to send messages as another user.", 403);
        }
        $toUser = $this->uStore->readUser($message->getToUser());
        if ($toUser === false) {
            throw new \snac\exceptions\SNACUserException("Recipient User does not exist.", 400);
        }
        $message->setToUser($toUser);
        $this->uStore->writeMessage($message);
        $this->mailer->sendUserMessage($message);
        $response["result"] = "success";
        return $response;
    }
public function sendMessage ( & $ input ) { if ( ! isset ( $ input [ " message " ] ) ) { throw new \ snac \ exceptions \ SNACInputException ( " No message given to send " , 400 ) ; } $ response = array ( ) ; $ message = new \ snac \ data \ Message ( $ input [ " message " ] ) ; if ( $ message -> getFromUser ( ) === null || $ message -> getFromUser ( ) -> getUserID ( ) !== $ this -> user -> getUserID ( ) ) { throw new \ snac \ exceptions \ SNACPermissionException ( " User does not have permission to send messages as another user. " , 403 ) ; } $ toUser = $ this -> uStore -> readUser ( $ message -> getToUser ( ) ) ; if ( $ toUser === false ) { throw new \ snac \ exceptions \ SNACUserException ( " Recipient User does not exist. " , 400 ) ; } $ message -> setToUser ( $ toUser ) ; $ this -> uStore -> writeMessage ( $ message ) ; $ this -> mailer -> sendUserMessage ( $ message ) ; $ response [ " result " ] = " success " ; return $ response ; }
Send Message
 Sends a message given on input to a user, then emails them to notify them
 of the message.
Send Message Sends a message given on input to a user then emails them to notify them of the message .
// Send the message // Email the message, if needed