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

Add two new API calls: getApiVersion and getAllIdsWithStatus

This commit is contained in:
Loic Blot
2014-10-09 10:02:22 +00:00
parent 8afe38e132
commit a933c53fb8
3 changed files with 39 additions and 1 deletions
+20 -1
View File
@@ -34,7 +34,7 @@ class SmsMapper extends Mapper {
public function getAllIds ($userId) {
$query = \OCP\DB::prepare('SELECT sms_id, sms_mailbox FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ?');
'*PREFIX*ocsms_smsdatas WHERE user_id = ?');
$result = $query->execute(array($userId));
$smsList = array();
@@ -51,6 +51,25 @@ 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()) {
$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 getAllPeersPhoneNumbers ($userId) {
$query = \OCP\DB::prepare('SELECT sms_address FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)');