+ function handle($args)
+ {
+ Action::handle($args);
+
+ if ($this->user && ($this->user->id == $this->message->from_profile ||
+ $this->user->id == $this->message->to_profile)) {
+ $this->showPage();
+ } else {
+ $this->clientError(_('Only the sender and recipient ' .
+ 'may read this message.'), 403);
+ return;
+ }
+ }
+
+ function title()
+ {
+ if ($this->user->id == $this->message->from_profile) {
+ $to = $this->message->getTo();
+ return sprintf(_("Message to %1\$s on %2\$s"),
+ $to->nickname,
+ common_exact_date($this->message->created));
+ } else if ($this->user->id == $this->message->to_profile) {
+ $from = $this->message->getFrom();
+ return sprintf(_("Message from %1\$s on %2\$s"),
+ $from->nickname,
+ common_exact_date($this->message->created));
+ }
+ }
+
+ function getMessages()
+ {
+ $message = new Message();
+ $message->id = $this->message->id;
+ $message->find();
+ return $message;
+ }
+
+ function getMessageProfile()
+ {
+ if ($this->user->id == $this->message->from_profile) {
+ return $this->message->getTo();
+ } else if ($this->user->id == $this->message->to_profile) {
+ return $this->message->getFrom();
+ } else {
+ // This shouldn't happen
+ return null;
+ }
+ }
+
+ /**
+ * Don't show local navigation
+ *
+ * @return void
+ */