aboutsummaryrefslogtreecommitdiffstats
path: root/include/message.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2011-12-06 19:15:42 -0800
committerfriendica <info@friendica.com>2011-12-06 19:15:42 -0800
commit7eba8adbf7ce1656b9c85f02b21fe46303b219e7 (patch)
treeb9f197666b827add55798b48c07aef8034642d86 /include/message.php
parent0c24784f5e92e0c8269f255e962312574871f2f0 (diff)
downloadvolse-hubzilla-7eba8adbf7ce1656b9c85f02b21fe46303b219e7.tar.gz
volse-hubzilla-7eba8adbf7ce1656b9c85f02b21fe46303b219e7.tar.bz2
volse-hubzilla-7eba8adbf7ce1656b9c85f02b21fe46303b219e7.zip
pm replies
Diffstat (limited to 'include/message.php')
-rw-r--r--include/message.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/message.php b/include/message.php
index 58789d688..7ad80ae9c 100644
--- a/include/message.php
+++ b/include/message.php
@@ -5,6 +5,7 @@
function send_message($recipient=0, $body='', $subject='', $replyto=''){
+
$a = get_app();
if(! $recipient) return -1;
@@ -28,22 +29,21 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
$uri = 'urn:X-dfrn:' . $a->get_baseurl() . ':' . local_user() . ':' . $hash ;
$convid = 0;
+ $reply = false;
// look for any existing conversation structure
if(strlen($replyto)) {
- $r = q("select convid from mail where uid = %d and uri = '%s' limit 1",
+ $reply = true;
+ $r = q("select convid from mail where uid = %d and ( uri = '%s' or `parent-uri` = '%s' ) limit 1",
intval(local_user()),
+ dbesc($replyto),
dbesc($replyto)
);
if(count($r))
$convid = $r[0]['convid'];
}
- if(! strlen($replyto))
- $replyto = $uri;
-
-
if(! $convid) {
// create a new conversation
@@ -81,9 +81,14 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
return -4;
}
+ if(! strlen($replyto)) {
+ $replyto = $uri;
+ }
+
+
$r = q("INSERT INTO `mail` ( `uid`, `guid`, `convid`, `from-name`, `from-photo`, `from-url`,
- `contact-id`, `title`, `body`, `seen`, `replied`, `uri`, `parent-uri`, `created`)
- VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s', '%s', '%s' )",
+ `contact-id`, `title`, `body`, `seen`, `reply`, `replied`, `uri`, `parent-uri`, `created`)
+ VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, %d, '%s', '%s', '%s' )",
intval(local_user()),
dbesc(get_guid()),
intval($convid),
@@ -94,11 +99,14 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
dbesc($subject),
dbesc($body),
1,
+ intval($reply),
0,
dbesc($uri),
dbesc($replyto),
datetime_convert()
);
+
+
$r = q("SELECT * FROM `mail` WHERE `uri` = '%s' and `uid` = %d LIMIT 1",
dbesc($uri),
intval(local_user())