public function countMessagesForPhoneNumber($userId, $phoneNumber, $country)
{
$cnt = 0;
$phlst = $this->getAllPhoneNumbersForFPN($userId, $phoneNumber, $country);
$query = \OCP\DB::prepare('SELECT count(*) as ct FROM ' . '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_address = ? ' . 'AND sms_mailbox IN (?,?)');
foreach ($phlst as $pn => $val) {
$result = $query->execute(array($userId, $pn, 0, 1));
if ($row = $result->fetchRow()) {
$cnt += $row["ct"];
}
}
return $cnt;
}