+
+ function get_last(&$user, $target_nickname, $from) {
+ $target = User::staticGet('nickname', $target_nickname);
+ if (!$target) {
+ $this->from_site($from,_('No such user.'));
+ return;
+ }
+
+ $notice = $target->getCurrentNotice();
+ if (!$notice) {
+ $this->from_site($from, "User has no last notice");
+ return;
+ }
+
+ $notice_content = $notice->content;
+ $this->from_site($from, $target_nickname . ": " . $notice_content);
+
+
+
+ }
+
+
+ function add_direct(&$user, $body, $to, $from) {
+
+ $other = User::staticGet('nickname', $to);
+
+ $this->log(LOG_INFO, 'Direct message to' . $to);
+ $len = mb_strlen($body);
+ if ($len == 0) {
+ $this->from_site($from, _('No content!'));
+ return;
+ } else if ($len > 140) {
+ $this->from_site($from, 'Message too long - maximum is 140 characters, you sent ' . $len);
+ return;
+ } else if (!$other) {
+ $this->from_site($from,_('No such user.'));
+ return;
+ } else if (!$user->mutuallySubscribed($other)) {
+ $this->from_site($from, _('You can\'t send a message to this user.'));
+ return;
+ } else if ($user->id == $other->id) {
+ $this->from_site($from, _('Don\'t send a message to yourself; just say it to yourself quietly instead.'));
+ return;
+ }
+ $this->from_site($from, "Direct message to " . $to . " sent");
+ $message = Message::saveNew($user->id, $other->id, $body, 'xmpp');
+
+ # XXX : Need to notify the other person
+ }