public function composeAction(Player $me, Request $request) { if (!$me->hasPermission(Permission::SEND_PRIVATE_MSG)) { throw new ForbiddenException("You are not allowed to send messages"); } $creator = new ConversationFormCreator($me); $form = $creator->create()->handleRequest($request); if ($form->isSubmitted()) { if ($form->isValid()) { $subject = $form->get('Subject')->getData(); $content = $form->get('Message')->getData(); $recipients = $form->get('Recipients')->getData(); $conversation_to = Conversation::createConversation($subject, $me->getId(), $recipients); $message = $conversation_to->sendMessage($me, $content); $event = new NewMessageEvent($message, true); $this->dispatch(Events::MESSAGE_NEW, $event); if ($this->isJson()) { return new JsonResponse(array('success' => true, 'message' => 'Your message was sent successfully', 'id' => $conversation_to->getId())); } else { return new RedirectResponse($conversation_to->getUrl()); } } elseif ($this->isJson()) { throw new BadRequestException($this->getErrorMessage($form)); } } else { // Load the list of recipients from the URL if ($request->query->has('recipients')) { $form->get('Recipients')->setData($this->decompose($request->query->get('recipients'), array('Player', 'Team'))); } } return array("form" => $form->createView()); }
$conversation->sendMessage($autoreport, "This conversation is full of many of my messages"); $conversation->sendMessage($autoreport, "This conversation is full of a large amount of my messages"); $conversation->sendMessage($autoreport, "This conversation has messages by AutoReport"); $conversation->sendMessage($autoreport, "This conversation contains messages by AutoReport"); $conversation->sendMessage($autoreport, "This conversation includes messages by AutoReport"); $conversation->sendMessage($autoreport, "This is a test message by AutoReport"); $conversation->sendMessage($autoreport, "This is another test message by AutoReport"); $conversation->sendMessage($autoreport, "This is yet another test message by AutoReport"); $conversation->sendMessage($autoreport, "This test complements the list of test messages by AutoReport"); $conversation->sendMessage($autoreport, "This test message contains various characters: ↛ ħĽřƒƕƜƷǟʤϠℋℕℹ⅖Ⅲ"); $event = new ConversationAbandonEvent($conversation, $brad); ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON); $conversation->sendMessage($autoreport, "This is a message"); $conversation->sendMessage($autoreport, "This is another message"); $conversation->sendMessage($autoreport, "This is yet another message"); $conversation = Conversation::createConversation("Test", $alezakos->getId(), array($olfm, $reptitles, $fflood, $fradis, $lweak, $gsepar, $constitution)); $conversation->sendMessage($allejo, "then I can type at 12,000 wpm?"); $conversation->sendMessage($blast, "like:"); $event = new ConversationAbandonEvent($conversation, $brad); ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON); $event = new ConversationAbandonEvent($conversation, $mdskpr); ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON); $conversation->sendMessage($allejo, "tea?"); $event = new ConversationJoinEvent($conversation, array($brad, $mdskpr, $lweak)); ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_JOIN); $event = new ConversationRenameEvent($conversation, "test", "Test", $alezakos); ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_RENAME); $conversation->sendMessage($allejo, "what would have some."); $conversation->sendMessage($snake, "hahaha I'm sure I've used a url shorten urls book I'm not sure it would be used it"); $conversation->sendMessage($blast, "so I assume you're the correlative still always_ goes down history\"'s for anything"); $conversation->sendMessage($kierra, "I had a page. No addon, plugin to windows it...");
/** * @When :sender sends :recipient a message about :content */ public function sendsAMessageAbout($sender, $recipient, $content) { $sender = Player::getFromUsername($sender); if ($recipient === 'me') { $recipient = $this->me; } else { $recipient = Player::getFromUsername($recipient); } $participants = array($sender, $recipient); $conversation = Conversation::createConversation("Subject", $sender->getId(), $participants); $message = $conversation->sendMessage($sender, $content); // Empty message so that the results are not skewed by showing the // contents of the message in the sidebar $conversation->sendMessage($sender, '--'); }