aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorSebastian Egbers <sebastian@egbers.info>2012-06-22 14:54:31 +0200
committerSebastian Egbers <sebastian@egbers.info>2012-06-22 14:54:31 +0200
commitcd25c3b5dd61755791dcde8dfd09e0032bcfb197 (patch)
tree1e53032687b0937a0fa4d18c1240f80c747de7b9 /include/api.php
parentc14270ac648391660c989d9b5d28fd2d1070c4db (diff)
downloadvolse-hubzilla-cd25c3b5dd61755791dcde8dfd09e0032bcfb197.tar.gz
volse-hubzilla-cd25c3b5dd61755791dcde8dfd09e0032bcfb197.tar.bz2
volse-hubzilla-cd25c3b5dd61755791dcde8dfd09e0032bcfb197.zip
added replyto and subject to direct messages.
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/include/api.php b/include/api.php
index 730e1fa2f..ac9c2cc84 100644
--- a/include/api.php
+++ b/include/api.php
@@ -1507,21 +1507,32 @@
if (local_user()===false) return false;
if (!x($_POST, "text") || !x($_POST,"screen_name")) return;
-
+
$sender = api_get_user($a);
$r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
intval(local_user()),
dbesc($_POST['screen_name']));
+ require_once("include/message.php");
+
$recipient = api_get_user($a, $r[0]['id']);
-
+ $replyto = '';
+ if (x($_REQUEST,'replyto')) {
+ $r = q('SELECT `uri` FROM `mail` WHERE `uid`=%d AND `id`=%d',
+ intval(local_user()),
+ intval($_REQUEST['replyto']));
+ $replyto = $r[0]['uri'];
+ }
+
+ if (x($_REQUEST,'title')) {
+ $sub = $_REQUEST['title'];
+ }
+ else {
+ $sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
+ }
+ $id = send_message($recipient['id'], $_POST['text'], $sub, $replyto);
- require_once("include/message.php");
- $sub = ( (strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
- $id = send_message($recipient['id'], $_POST['text'], $sub);
-
-
if ($id>-1) {
$r = q("SELECT * FROM `mail` WHERE id=%d", intval($id));
$item = $r[0];