mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Implement Android APIv2 get/phones/smsnumber call
This commit is contained in:
parent
152fbaef0f
commit
0fcaad6d31
@ -27,5 +27,5 @@ $application->registerRoutes($this, array('routes' => array(
|
||||
array('name' => 'api#retrieve_all_ids', 'url' => '/get/smsidlist', 'verb' => 'GET'), // Android APIv1
|
||||
array('name' => 'api#retrieve_all_ids_with_status', 'url' => '/get/smsidstate', 'verb' => 'GET'), // Android APIv1
|
||||
array('name' => 'api#retrieve_last_timestamp', 'url' => '/get/lastmsgtime', 'verb' => 'GET'), // Android APIv1
|
||||
array('name' => 'api#get_phones_sms_number', 'url' => 'get/phones/smsnumber', 'verb' => 'GET'), // Android APIv2
|
||||
array('name' => 'api#get_all_stored_phone_numbers', 'url' => 'get/phones/smsnumber', 'verb' => 'GET'), // Android APIv2
|
||||
)));
|
||||
|
@ -82,9 +82,12 @@ class ApiController extends Controller {
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* This function is used by API v2
|
||||
* Phone will get this list to generate a ListView
|
||||
*/
|
||||
public function getPhonesSmsNumber () {
|
||||
$phoneList = array();
|
||||
public function getAllStoredPhoneNumbers () {
|
||||
$phoneList = $this->smsMapper->getAllPhoneNumbers($this->userId);
|
||||
return new JSONResponse(array("phoneList" => $phoneList));
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class SmsController extends Controller {
|
||||
$mboxes = array(
|
||||
'PNLConversations' => array(
|
||||
'label' => 'Conversations',
|
||||
'phoneNumbers' => $this->smsMapper->getAllPeersPhoneNumbers($this->userId),
|
||||
'phoneNumbers' => $this->smsMapper->getAllPhoneNumbers($this->userId),
|
||||
'url' => $this->urlGenerator->linkToRoute('ocsms.sms.index', ['feed' => 'conversations'])
|
||||
),
|
||||
'PNLDrafts' => array(
|
||||
|
@ -93,7 +93,7 @@ class SmsMapper extends Mapper {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getAllPeersPhoneNumbers ($userId) {
|
||||
public function getAllPhoneNumbers ($userId) {
|
||||
$query = \OCP\DB::prepare('SELECT sms_address FROM ' .
|
||||
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)');
|
||||
$result = $query->execute(array($userId, 0, 1));
|
||||
@ -109,8 +109,8 @@ class SmsMapper extends Mapper {
|
||||
}
|
||||
|
||||
/*
|
||||
get all possible SMS_adresses for a given formated phonenumber
|
||||
*/
|
||||
* get all possible SMS_adresses for a given formated phonenumber
|
||||
*/
|
||||
public function getAllPhoneNumbersForFPN ($userId, $phoneNumber, $country) {
|
||||
$query = \OCP\DB::prepare('SELECT sms_address FROM ' .
|
||||
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)');
|
||||
|
Loading…
x
Reference in New Issue
Block a user