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

Add a new call to get the current message count for a user

This commit is contained in:
Loic Blot
2016-07-21 23:31:52 +02:00
parent 55ca445ff7
commit 78eae0600c
3 changed files with 25 additions and 2 deletions
+11
View File
@@ -134,6 +134,17 @@ class SmsMapper extends Mapper {
return $messageList;
}
public function getMessageCount ($userId) {
$query = \OCP\DB::prepare('SELECT count(*) AS count FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ?');
$result = $query->execute(array($userId));
if ($row = $result->fetchRow()) {
return $row["count"];
}
return 0;
}
public function getMessages ($userId, $start, $limit) {
$messageList = array();