1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

APIv2 improvements

* prepare a table for messaging sending queue
* drop retrieveAllIdsWithStatus and related API call (unused and dropped from Android app devel version)
* reorganise api controller
This commit is contained in:
Loic Blot
2016-05-12 23:18:25 +02:00
parent d6818be568
commit 1b2a171b89
4 changed files with 91 additions and 80 deletions
-23
View File
@@ -58,29 +58,6 @@ class SmsMapper extends Mapper {
return $smsList;
}
public function getAllIdsWithStatus ($userId) {
$query = \OCP\DB::prepare('SELECT sms_id, sms_type, sms_mailbox FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ?');
$result = $query->execute(array($userId));
$smsList = array();
while($row = $result->fetchRow()) {
// This case may not arrive, but we test if the DB is consistent
if (!in_array($row["sms_mailbox"], SmsMapper::$mailboxNames)) {
continue;
}
$mbox = SmsMapper::$mailboxNames[$row["sms_mailbox"]];
if (!isset($smsList[$mbox])) {
$smsList[$mbox] = array();
}
if (!isset($smsList[$mbox][$row["sms_id"]])) {
$smsList[$mbox][$row["sms_id"]] = $row["sms_type"];
}
}
return $smsList;
}
public function getLastTimestamp ($userId) {
$query = \OCP\DB::prepare('SELECT max(sms_date) as mx FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ?');