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

Link App with SmsController

This commit is contained in:
Loic Blot
2014-09-30 05:49:27 +00:00
parent 42df9cc510
commit 860b4a3fb5
3 changed files with 8 additions and 56 deletions
+4 -2
View File
@@ -20,12 +20,14 @@ use \OCA\OcSms\Db\SmsMapper;
class SmsController extends Controller {
private $app;
private $userId;
private $smsMapper;
private $errorMsg;
public function __construct ($appName, IRequest $request, $userId, SmsMapper $mapper){
public function __construct ($appName, IRequest $request, $userId, SmsMapper $mapper, Application $app){
parent::__construct($appName, $request);
$this->app = $app;
$this->userId = $userId;
$this->smsMapper = $mapper;
}
@@ -80,7 +82,7 @@ class SmsController extends Controller {
public function getConversation ($phoneNumber, $lastDate = 0) {
$messages = $this->smsMapper->getAllMessagesForPhoneNumber($this->userId, $phoneNumber, $lastDate);
// @ TODO: filter correctly
return new JSONResponse(array("conversation" => $messages));
return new JSONResponse(array("conversation" => $messages, $contacts => $this->app->getContacts()));
}
/**