diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-10-15 16:02:37 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-10-15 16:02:37 -0700 |
commit | 7517c76ae48ddad741fe61c41dd6dcc09421d160 (patch) | |
tree | e4030f6419432e8644a4897a38703559a4ba1889 | |
parent | bf5a1f662a4f00e8376613fa387c843d539c7433 (diff) | |
parent | e26f771cbe5717f9db9c5dde897f1f6e79b3a932 (diff) | |
download | volse-hubzilla-7517c76ae48ddad741fe61c41dd6dcc09421d160.tar.gz volse-hubzilla-7517c76ae48ddad741fe61c41dd6dcc09421d160.tar.bz2 volse-hubzilla-7517c76ae48ddad741fe61c41dd6dcc09421d160.zip |
Merge https://github.com/redmatrix/redmatrix into pending_merge
Conflicts:
install/update.php
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/message.php | 31 | ||||
-rw-r--r-- | install/update.php | 7 | ||||
-rw-r--r-- | mod/mail.php | 5 | ||||
-rw-r--r-- | version.inc | 2 |
5 files changed, 39 insertions, 8 deletions
@@ -50,7 +50,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1156 ); +define ( 'DB_UPDATE_VERSION', 1157 ); /** * @brief Constant with a HTML line break. diff --git a/include/message.php b/include/message.php index 4b0236db8..87975ef6a 100644 --- a/include/message.php +++ b/include/message.php @@ -49,6 +49,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' // look for any existing conversation structure + $conv_guid = ''; if(strlen($replyto)) { $r = q("select convid from mail where channel_id = %d and ( mid = '%s' or parent_mid = '%s' ) limit 1", @@ -56,8 +57,9 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' dbesc($replyto), dbesc($replyto) ); - if($r) + if($r) { $convid = $r[0]['convid']; + } } if(! $convid) { @@ -89,12 +91,15 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' dbesc($handles) ); + $r = q("select * from conv where guid = '%s' and uid = %d limit 1", dbesc($conv_guid), intval(local_channel()) ); - if($r) + if($r) { $convid = $r[0]['id']; + $retconv = $r[0]; + } } if(! $convid) { @@ -102,6 +107,16 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' return $ret; } + if(! $conv_guid) { + $r = q("select * from conv where id = %d and uid = %d limit 1", + intval($convid), + intval(local_channel()) + ); + if($r) { + $conv_guid = $r[0]['guid']; + $retconv = $r[0]; + } + } // generate a unique message_id @@ -197,8 +212,11 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' dbesc($mid), intval($channel['channel_id']) ); - if($r) + if($r) { $post_id = $r[0]['id']; + $retmail = $r; + $retmail['conv_guid'] = $conv_guid; + } else { $ret['message'] = t('Stored post could not be verified.'); return $ret; @@ -242,6 +260,10 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' $ret['success'] = true; $ret['message_item'] = intval($post_id); + if($retconv) + $ret['conv'] = $retconv; + if($retmail) + $ret['mail'] = $retmail; return $ret; } @@ -369,11 +391,12 @@ function private_messages_drop($channel_id, $messageitem_id, $drop_conversation if($drop_conversation) { // find the parent_id - $p = q("SELECT parent_mid FROM mail WHERE id = %d AND channel_id = %d LIMIT 1", + $p = q("SELECT parent_mid, convid FROM mail WHERE id = %d AND channel_id = %d LIMIT 1", intval($messageitem_id), intval($channel_id) ); if($p) { + $r = q("DELETE FROM mail WHERE parent_mid = '%s' AND channel_id = %d ", dbesc($p[0]['parent_mid']), intval($channel_id) diff --git a/install/update.php b/install/update.php index ace5239b5..e120f91d2 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1156 ); +define( 'UPDATE_VERSION' , 1157 ); /** * @@ -1885,3 +1885,8 @@ function update_r1155() { return UPDATE_FAILED; } + +function update_r1156() { + return UPDATE_SUCCESS; +} + diff --git a/mod/mail.php b/mod/mail.php index 23d1f5224..2fbd96fdb 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -97,7 +97,10 @@ function mail_post(&$a) { $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires); - if(! $ret['success']) { + if($ret['success']) { + build_sync_packet(0,array('conv' => array($ret['conv']),'mail' => array(encode_mail($ret['mail'],true)))); + } + else { notice($ret['message']); } diff --git a/version.inc b/version.inc index b94d740a1..f103ff89c 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-10-14.1185 +2015-10-15.1186 |