Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ocsms.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-06-26 00:59:59 +0300
committerLoic Blot <loic.blot@unix-experience.fr>2015-06-26 01:00:09 +0300
commit13d5e9ff268c2fb4aee04cc1a382ec26152500ae (patch)
treeca3f302c9f4a1cccaa5bca0bf387ccde19122f6d /db
parent1263af850bad86355601541a4385435fa1c51eb9 (diff)
Fix messages/conversation removal sync with contact list and also add atomic delete for messages
Diffstat (limited to 'db')
-rw-r--r--db/smsmapper.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/db/smsmapper.php b/db/smsmapper.php
index f41c1de..094d47a 100644
--- a/db/smsmapper.php
+++ b/db/smsmapper.php
@@ -181,6 +181,18 @@ class SmsMapper extends Mapper {
\OCP\DB::commit();
}
+ /*
+ * WARN: messageId is sms_date here
+ */
+ public function removeMessage ($userId, $phoneNumber, $messageId) {
+ \OCP\DB::beginTransaction();
+ $query = \OCP\DB::prepare('DELETE FROM ' .
+ '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_address = ? ' .
+ 'AND sms_date = ?');
+ $query->execute(array($userId, $phoneNumber, $messageId));
+ \OCP\DB::commit();
+ }
+
public function getLastMessageTimestampForAllPhonesNumbers ($userId, $order = true) {
$sql = 'SELECT sms_address,MAX(sms_date) as mx FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?) ' .