1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-08 00:16:24 +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> <name>key</name>
<type>text</type> <type>text</type>
<notnull>true</notnull> <notnull>true</notnull>
<length>25555</length> <length>255</length>
</field> </field>
<field> <field>
<name>value</name> <name>value</name>
<type>text</type> <type>text</type>
<notnull>false</notnull> <notnull>false</notnull>
<length>25555</length> <length>10240</length>
</field> </field>
</declaration> </declaration>
</table> </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', '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_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#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 * @NoAdminRequired
* @NoCSRFRequired * @NoCSRFRequired
*
* This function is used by API v2
* Phone will get this list to generate a ListView
*/ */
public function getPhonesSmsNumber () { public function getAllStoredPhoneNumbers () {
$phoneList = array(); $phoneList = $this->smsMapper->getAllPhoneNumbers($this->userId);
return new JSONResponse(array("phoneList" => $phoneList)); return new JSONResponse(array("phoneList" => $phoneList));
} }

View File

@ -54,7 +54,7 @@ class SmsController extends Controller {
$mboxes = array( $mboxes = array(
'PNLConversations' => array( 'PNLConversations' => array(
'label' => 'Conversations', 'label' => 'Conversations',
'phoneNumbers' => $this->smsMapper->getAllPeersPhoneNumbers($this->userId), 'phoneNumbers' => $this->smsMapper->getAllPhoneNumbers($this->userId),
'url' => $this->urlGenerator->linkToRoute('ocsms.sms.index', ['feed' => 'conversations']) 'url' => $this->urlGenerator->linkToRoute('ocsms.sms.index', ['feed' => 'conversations'])
), ),
'PNLDrafts' => array( 'PNLDrafts' => array(

View File

@ -93,7 +93,7 @@ class SmsMapper extends Mapper {
return 0; return 0;
} }
public function getAllPeersPhoneNumbers ($userId) { public function getAllPhoneNumbers ($userId) {
$query = \OCP\DB::prepare('SELECT sms_address FROM ' . $query = \OCP\DB::prepare('SELECT sms_address FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)'); '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)');
$result = $query->execute(array($userId, 0, 1)); $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) { public function getAllPhoneNumbersForFPN ($userId, $phoneNumber, $country) {
$query = \OCP\DB::prepare('SELECT sms_address FROM ' . $query = \OCP\DB::prepare('SELECT sms_address FROM ' .
'*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)'); '*PREFIX*ocsms_smsdatas WHERE user_id = ? AND sms_mailbox IN (?,?)');

View File

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