1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 16:06:15 +00:00
This commit is contained in:
Loic Blot 2015-05-23 16:29:17 +00:00
commit 0e41221703
6 changed files with 13 additions and 9 deletions

View File

@ -117,13 +117,13 @@
<name>key</name>
<type>text</type>
<notnull>true</notnull>
<length>25555</length>
<length>255</length>
</field>
<field>
<name>value</name>
<type>text</type>
<notnull>false</notnull>
<length>25555</length>
<length>10240</length>
</field>
</declaration>
</table>

View File

@ -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/numberlist', 'verb' => 'GET'), // Android APIv2
)));

View File

@ -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));
}

View File

@ -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(

View File

@ -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,7 +109,7 @@ 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 ' .

View File

@ -19,6 +19,7 @@ class CountryCodes {
"Andorra" => "+376",
"Armenia" => "+374",
"Austria" => "+43",
"Australia" => "+61",
"Belarus" => "+375",
"Belgium" => "+32",
"Bosnia and Herzegovina" => "+387",