- Introduced MailRepository for mailbox ID retrieval. - Updated CalendarObjectCreatedListener to handle cookies. - Modified VCalendarHelpers to include MIME type extraction. - Enhanced TalkService with room token retrieval logic. - Updated ProviderController to integrate external API for sharing. - Refactored EmailBoxController to utilize MailRepository for mailbox ID.
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
namespace OCA\Calendar\Db;
|
|
|
|
use OCP\IDBConnection;
|
|
|
|
class MailRepository {
|
|
|
|
private IDbConnection $pdo;
|
|
|
|
public function __construct(IDbConnection $db) {
|
|
$this->pdo = $db;
|
|
}
|
|
|
|
private function execSQL($sql, $conditions){
|
|
$stmt = $this->pdo->prepare($sql);
|
|
$stmt->execute($conditions);
|
|
$data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
|
$stmt->closeCursor();
|
|
return json_encode($data);
|
|
}
|
|
|
|
private function execSQLNoData($sql, $conditions){
|
|
$stmt = $this->pdo->prepare($sql);
|
|
$stmt->execute($conditions);
|
|
$stmt->closeCursor();
|
|
}
|
|
|
|
private function execSQLNoJsonReturn($sql, $conditions){
|
|
$stmt = $this->pdo->prepare($sql);
|
|
$stmt->execute($conditions);
|
|
$data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
|
$stmt->closeCursor();
|
|
return $data;
|
|
}
|
|
|
|
public function getCurrentUserMailBoxId(string $currentUserId ) {
|
|
$sql = 'SELECT mail_mailbox.id as mail_box_id
|
|
FROM oc_mail_accounts as mail_account
|
|
LEFT JOIN oc_mail_mailboxes as mail_mailbox ON mail_account.id = mail_mailbox.account_id
|
|
WHERE mail_account.user_id = ?
|
|
AND mail_mailbox.name = ?';
|
|
|
|
$result = $this->execSQLNoJsonReturn($sql, [$currentUserId,"INBOX"]);
|
|
if(!empty($result)){
|
|
return $result[0]['mail_box_id'];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
|
|
|
|
}
|