2024-02-08 07:46:16 +08:00
|
|
|
|
Also see https://github.com/the-djmaze/snappymail/tree/master/plugins/example
|
|
|
|
|
|
2021-07-16 22:24:07 +08:00
|
|
|
|
PHP
|
2021-10-25 15:52:04 +08:00
|
|
|
|
```php
|
2021-04-14 20:30:42 +08:00
|
|
|
|
class Plugin extends \RainLoop\Plugins\AbstractPlugin
|
2021-10-25 15:52:04 +08:00
|
|
|
|
{
|
2022-02-10 23:09:45 +08:00
|
|
|
|
public function __construct();
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** Returns static::NAME */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function Name(): string;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** Returns /README file contents or static::DESCRIPTION */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function Description(): string;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** When $bLangs is boolean it sets the value, else returns current value */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function UseLangs(?bool $bLangs = null): bool;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** When true the result is empty string, else the error message */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function Supported(): string;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** Initialize settings */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function Init(): void;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
2022-11-12 00:22:49 +08:00
|
|
|
|
public function FilterAppDataPluginSection(bool $bAdmin, bool $bAuth, array &$aConfig): void;
|
2022-11-11 21:32:24 +08:00
|
|
|
|
|
|
|
|
|
/** Returns array of all plugin Property options for use in Admin -> Extensions -> Plugin cog wheel */
|
2022-11-12 00:22:49 +08:00
|
|
|
|
protected function configMapping(): array;
|
|
|
|
|
|
|
|
|
|
/** With this function you hook to an event
|
|
|
|
|
* $sHookName see chapter "Hooks" below for available names
|
|
|
|
|
* $sFunctionName the name of a function in this class
|
|
|
|
|
*/
|
|
|
|
|
final protected function addHook(string $sHookName, string $sFunctionName): self;
|
|
|
|
|
|
|
|
|
|
final protected function addCss(string $sFile, bool $bAdminScope = false): self;
|
|
|
|
|
|
|
|
|
|
final protected function addJs(string $sFile, bool $bAdminScope = false): self;
|
|
|
|
|
|
|
|
|
|
final protected function addTemplate(string $sFile, bool $bAdminScope = false): self;
|
|
|
|
|
|
|
|
|
|
final protected function addJsonHook(string $sActionName, string $sFunctionName): self;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* You may register your own service actions.
|
|
|
|
|
* Url is like /?{actionname}/etc.
|
|
|
|
|
* Predefined actions of \RainLoop\ServiceActions that can't be registered are:
|
|
|
|
|
* - admin
|
|
|
|
|
* - AdminAppData
|
|
|
|
|
* - AppData
|
|
|
|
|
* - Append
|
|
|
|
|
* - Backup
|
|
|
|
|
* - BadBrowser
|
|
|
|
|
* - CspReport
|
|
|
|
|
* - Css
|
|
|
|
|
* - Json
|
|
|
|
|
* - Lang
|
|
|
|
|
* - Mailto
|
|
|
|
|
* - NoCookie
|
|
|
|
|
* - NoScript
|
|
|
|
|
* - Ping
|
|
|
|
|
* - Plugins
|
|
|
|
|
* - ProxyExternal
|
|
|
|
|
* - Raw
|
|
|
|
|
* - Sso
|
|
|
|
|
* - Upload
|
|
|
|
|
* - UploadBackground
|
|
|
|
|
* - UploadContacts
|
|
|
|
|
*/
|
|
|
|
|
final protected function addPartHook(string $sActionName, string $sFunctionName): self
|
|
|
|
|
|
|
|
|
|
final public function Config(): \RainLoop\Config\Plugin;
|
|
|
|
|
final public function Manager(): \RainLoop\Plugins\Manager;
|
|
|
|
|
final public function Path(): string;
|
|
|
|
|
final public function ConfigMap(bool $flatten = false): array;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns result of Actions->DefaultResponse($sFunctionName, $mData) or json_encode($mData)
|
|
|
|
|
*/
|
|
|
|
|
final protected function jsonResponse(string $sFunctionName, $mData): mixed;
|
|
|
|
|
|
|
|
|
|
final public function jsonParam(string $sKey, $mDefault = null): mixed;
|
|
|
|
|
|
|
|
|
|
final public function getUserSettings(): array;
|
|
|
|
|
|
|
|
|
|
final public function saveUserSettings(array $aSettings): bool;
|
2021-10-25 15:52:04 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
2022-02-07 22:20:39 +08:00
|
|
|
|
JavaScript
|
|
|
|
|
```javascript
|
|
|
|
|
class PluginPopupView extends rl.pluginPopupView
|
|
|
|
|
{
|
2022-02-26 17:33:11 +08:00
|
|
|
|
// Happens when DOM is created
|
|
|
|
|
onBuild(dom) {}
|
|
|
|
|
|
|
|
|
|
// Happens before showModal()
|
2022-03-11 17:26:25 +08:00
|
|
|
|
beforeShow(...params) {}
|
2022-02-26 17:33:11 +08:00
|
|
|
|
// Happens after showModal()
|
|
|
|
|
onShow(...params) {}
|
|
|
|
|
// Happens after showModal() animation transitionend
|
|
|
|
|
afterShow() {}
|
|
|
|
|
|
|
|
|
|
// Happens when user hits Escape or Close key
|
2022-03-04 16:21:24 +08:00
|
|
|
|
// return false to prevent closing, use close() manually
|
2022-02-26 17:33:11 +08:00
|
|
|
|
onClose() {}
|
|
|
|
|
// Happens before animation transitionend
|
|
|
|
|
onHide() {}
|
|
|
|
|
// Happens after animation transitionend
|
|
|
|
|
afterHide() {}
|
2022-02-07 22:20:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PluginPopupView.showModal();
|
|
|
|
|
```
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
# Hooks
|
|
|
|
|
|
2021-10-25 15:52:04 +08:00
|
|
|
|
```php
|
2021-04-14 20:30:42 +08:00
|
|
|
|
$Plugin->addHook('hook.name', 'functionName');
|
2021-10-25 15:52:04 +08:00
|
|
|
|
```
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
## Login
|
|
|
|
|
|
|
|
|
|
### login.credentials.step-1
|
|
|
|
|
params:
|
|
|
|
|
string &$sEmail
|
|
|
|
|
|
|
|
|
|
### login.credentials.step-2
|
|
|
|
|
params:
|
|
|
|
|
string &$sEmail
|
|
|
|
|
string &$sPassword
|
|
|
|
|
|
|
|
|
|
### login.credentials
|
|
|
|
|
params:
|
|
|
|
|
string &$sEmail
|
2024-04-17 07:09:07 +08:00
|
|
|
|
string &$sImapUser
|
2021-04-14 20:30:42 +08:00
|
|
|
|
string &$sPassword
|
2024-04-17 07:09:07 +08:00
|
|
|
|
string &$sSmtpUser
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### login.success
|
|
|
|
|
params:
|
2022-11-30 18:59:54 +08:00
|
|
|
|
\RainLoop\Model\MainAccount $oAccount
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
## IMAP
|
|
|
|
|
|
|
|
|
|
### imap.before-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2021-10-22 18:45:14 +08:00
|
|
|
|
\MailSo\Imap\ImapClient $oImapClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Imap\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### imap.after-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2021-10-22 18:45:14 +08:00
|
|
|
|
\MailSo\Imap\ImapClient $oImapClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Imap\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### imap.before-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2021-10-22 18:45:14 +08:00
|
|
|
|
\MailSo\Imap\ImapClient $oImapClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Imap\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### imap.after-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2021-10-22 18:45:14 +08:00
|
|
|
|
\MailSo\Imap\ImapClient $oImapClient
|
2021-04-14 20:30:42 +08:00
|
|
|
|
bool $bSuccess
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Imap\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
2024-01-22 20:25:04 +08:00
|
|
|
|
### imap.message-headers
|
|
|
|
|
params:
|
|
|
|
|
array &$aHeaders
|
|
|
|
|
|
|
|
|
|
Allows you to fetch more MIME headers for messages.
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
## Sieve
|
|
|
|
|
|
|
|
|
|
### sieve.before-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2022-11-11 22:50:15 +08:00
|
|
|
|
\MailSo\Sieve\SieveClient $oSieveClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Sieve\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### sieve.after-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2022-11-11 22:50:15 +08:00
|
|
|
|
\MailSo\Sieve\SieveClient $oSieveClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Sieve\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### sieve.before-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2022-11-11 22:50:15 +08:00
|
|
|
|
\MailSo\Sieve\SieveClient $oSieveClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Sieve\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### sieve.after-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
2022-11-11 22:50:15 +08:00
|
|
|
|
\MailSo\Sieve\SieveClient $oSieveClient
|
2021-10-22 18:45:14 +08:00
|
|
|
|
bool $bSuccess
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Sieve\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
## SMTP
|
|
|
|
|
|
|
|
|
|
### smtp.before-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Smtp\SmtpClient $oSmtpClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Smtp\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### smtp.after-connect
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Smtp\SmtpClient $oSmtpClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Smtp\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### smtp.before-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Smtp\SmtpClient $oSmtpClient
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Smtp\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### smtp.after-login
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Smtp\SmtpClient $oSmtpClient
|
|
|
|
|
bool $bSuccess
|
2022-11-11 21:32:24 +08:00
|
|
|
|
\MailSo\Smtp\Settings $oSettings
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
2022-12-08 16:08:41 +08:00
|
|
|
|
## Json service actions
|
|
|
|
|
Called by RainLoop\ServiceActions::ServiceJson()
|
2022-12-08 16:37:39 +08:00
|
|
|
|
{actionname} is one of the RainLoop\Actions::Do{ActionName}(),
|
|
|
|
|
or an extension action as "Plugin{ActionName}" added with Plugin::addJsonHook()
|
|
|
|
|
and called in JavaScript using rl.pluginRemoteRequest().
|
2022-12-08 16:08:41 +08:00
|
|
|
|
|
|
|
|
|
### json.before-{actionname}
|
|
|
|
|
params: none
|
|
|
|
|
|
|
|
|
|
### json.after-{actionname}
|
|
|
|
|
params:
|
|
|
|
|
array &$aResponse
|
|
|
|
|
|
|
|
|
|
### json.action-post-call
|
|
|
|
|
Obsolete, use json.after-{actionname}
|
|
|
|
|
|
|
|
|
|
### json.action-pre-call
|
|
|
|
|
Obsolete, use json.before-{actionname}
|
|
|
|
|
|
|
|
|
|
### filter.json-response
|
|
|
|
|
Obsolete, use json.after-{actionname}
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
## Others
|
|
|
|
|
|
|
|
|
|
### filter.account
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
|
|
|
|
|
### filter.action-params
|
|
|
|
|
params:
|
|
|
|
|
string $sMethodName
|
|
|
|
|
array &$aCurrentActionParams
|
|
|
|
|
|
|
|
|
|
### filter.app-data
|
|
|
|
|
params:
|
|
|
|
|
bool $bAdmin
|
|
|
|
|
array &$aAppData
|
|
|
|
|
|
|
|
|
|
### filter.application-config
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Config\Application $oConfig
|
|
|
|
|
|
|
|
|
|
### filter.build-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens before send/save message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.build-read-receipt-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
|
|
|
|
|
### filter.domain
|
|
|
|
|
params:
|
2022-11-01 00:10:04 +08:00
|
|
|
|
\RainLoop\Model\Domain $oDomain
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### filter.fabrica
|
|
|
|
|
params:
|
|
|
|
|
string $sName
|
|
|
|
|
mixed &$mResult
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
|
|
|
|
|
### filter.http-paths
|
|
|
|
|
params:
|
|
|
|
|
array &$aPaths
|
|
|
|
|
|
2023-12-08 08:28:08 +08:00
|
|
|
|
### filter.language
|
|
|
|
|
params:
|
|
|
|
|
string &$sLanguage
|
|
|
|
|
bool $bAdmin
|
|
|
|
|
|
|
|
|
|
Allows you to set a different language
|
|
|
|
|
|
2021-07-16 22:24:07 +08:00
|
|
|
|
### filter.message-html
|
2021-10-25 15:52:04 +08:00
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
string &$sTextConverted
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens before send/save message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.message-plain
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
string &$sTextConverted
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens before send/save message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.message-rcpt
|
2022-11-28 21:07:26 +08:00
|
|
|
|
Called by DoSendMessage and DoSendReadReceiptMessage
|
2021-04-14 20:30:42 +08:00
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\EmailCollection $oRcpt
|
|
|
|
|
|
|
|
|
|
### filter.read-receipt-message-plain
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
string &$sText
|
|
|
|
|
|
|
|
|
|
### filter.result-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens when reading message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.save-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens before save message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.send-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Happens before send message
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### filter.send-message-stream
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
resource &$rMessageStream
|
|
|
|
|
int &$iMessageStreamSize
|
|
|
|
|
|
|
|
|
|
### filter.send-read-receipt-message
|
|
|
|
|
params:
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
|
|
|
|
|
### filter.smtp-from
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
string &$sFrom
|
|
|
|
|
|
|
|
|
|
### filter.smtp-hidden-rcpt
|
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
\MailSo\Mime\Message $oMessage
|
|
|
|
|
array &$aHiddenRcpt
|
|
|
|
|
|
|
|
|
|
### filter.smtp-message-stream
|
2022-11-28 21:07:26 +08:00
|
|
|
|
Called by DoSendMessage and DoSendReadReceiptMessage
|
2021-04-14 20:30:42 +08:00
|
|
|
|
params:
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
resource &$rMessageStream
|
|
|
|
|
int &$iMessageStreamSize
|
|
|
|
|
|
|
|
|
|
### filter.upload-response
|
|
|
|
|
params:
|
2022-12-08 16:08:41 +08:00
|
|
|
|
array &$aResponse
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
2021-07-16 22:27:19 +08:00
|
|
|
|
### json.attachments
|
|
|
|
|
params:
|
|
|
|
|
\SnappyMail\AttachmentsAction $oData
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### json.suggestions-input-parameters
|
|
|
|
|
params:
|
|
|
|
|
string &$sQuery
|
|
|
|
|
int &$iLimit
|
|
|
|
|
\RainLoop\Model\Account $oAccount
|
|
|
|
|
|
2022-02-14 18:08:53 +08:00
|
|
|
|
### main.content-security-policy
|
|
|
|
|
params:
|
|
|
|
|
\SnappyMail\HTTP\CSP $oCSP
|
|
|
|
|
|
2022-03-21 21:46:53 +08:00
|
|
|
|
Allows you to edit the policy, like:
|
|
|
|
|
`$oCSP->script[] = "'strict-dynamic'";`
|
|
|
|
|
|
2021-04-14 20:30:42 +08:00
|
|
|
|
### main.default-response
|
2022-12-23 02:40:11 +08:00
|
|
|
|
Obsolete, use json.after-{actionname}
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### main.default-response-data
|
2022-12-23 02:40:11 +08:00
|
|
|
|
Obsolete, use json.after-{actionname}
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### main.default-response-error-data
|
2022-12-23 02:40:11 +08:00
|
|
|
|
Obsolete, use json.after-{actionname}
|
2021-04-14 20:30:42 +08:00
|
|
|
|
|
|
|
|
|
### main.fabrica
|
|
|
|
|
params:
|
|
|
|
|
string $sName
|
|
|
|
|
mixed &$mResult
|
|
|
|
|
|
2021-07-23 22:21:06 +08:00
|
|
|
|
# JavaScript Events
|
|
|
|
|
|
|
|
|
|
## mailbox
|
2022-04-21 04:08:44 +08:00
|
|
|
|
### mailbox.inbox-unread-count
|
2021-07-23 22:21:06 +08:00
|
|
|
|
### mailbox.message-list.selector.go-up
|
|
|
|
|
### mailbox.message-list.selector.go-down
|
2023-11-27 08:51:23 +08:00
|
|
|
|
|
2021-07-23 22:21:06 +08:00
|
|
|
|
### mailbox.message.show
|
2023-11-27 08:51:23 +08:00
|
|
|
|
Use to show a specific message.
|
|
|
|
|
``` JavaScript
|
|
|
|
|
dispatchEvent(
|
|
|
|
|
new CustomEvent(
|
|
|
|
|
'mailbox.message.show',
|
|
|
|
|
{
|
|
|
|
|
detail: {
|
|
|
|
|
folder: 'INBOX',
|
|
|
|
|
uid: 1
|
|
|
|
|
},
|
|
|
|
|
cancelable: false
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
```
|
|
|
|
|
|
2021-07-23 22:21:06 +08:00
|
|
|
|
## audio
|
|
|
|
|
### audio.start
|
|
|
|
|
### audio.stop
|
|
|
|
|
### audio.api.stop
|
|
|
|
|
## Misc
|
|
|
|
|
### rl-layout
|
2023-11-27 08:51:23 +08:00
|
|
|
|
event.detail value is one of:
|
|
|
|
|
0. NoPreview
|
|
|
|
|
1. SidePreview
|
|
|
|
|
2. BottomPreview
|
2022-10-12 20:06:11 +08:00
|
|
|
|
|
|
|
|
|
### rl-view-model.create
|
|
|
|
|
event.detail = the ViewModel class
|
2024-03-20 07:45:11 +08:00
|
|
|
|
Happens immediately after the ViewModel constructor.
|
|
|
|
|
See accessible properties as https://github.com/the-djmaze/snappymail/blob/master/dev/Knoin/AbstractViews.js
|
2022-10-12 20:06:11 +08:00
|
|
|
|
|
2021-07-23 22:21:06 +08:00
|
|
|
|
### rl-view-model
|
|
|
|
|
event.detail = the ViewModel class
|
2022-10-12 20:06:11 +08:00
|
|
|
|
Happens after the full build (vm.onBuild()) and contains viewModelDom
|
2022-04-21 04:08:44 +08:00
|
|
|
|
|
|
|
|
|
### sm-admin-login
|
|
|
|
|
event.detail = FormData
|
2022-04-29 19:07:49 +08:00
|
|
|
|
cancelable using preventDefault()
|
2022-04-21 04:08:44 +08:00
|
|
|
|
### sm-admin-login-response
|
|
|
|
|
event.detail = { error: int, data: {JSON response} }
|
|
|
|
|
### sm-user-login
|
|
|
|
|
event.detail = FormData
|
2022-04-29 19:07:49 +08:00
|
|
|
|
cancelable using preventDefault()
|
2022-04-21 04:08:44 +08:00
|
|
|
|
### sm-user-login-response
|
|
|
|
|
event.detail = { error: int, data: {JSON response} }
|
2022-04-29 19:07:49 +08:00
|
|
|
|
|
|
|
|
|
### sm-show-screen
|
|
|
|
|
event.detail = 'screenname'
|
|
|
|
|
cancelable using preventDefault()
|
2023-01-20 03:09:52 +08:00
|
|
|
|
|
2023-07-03 17:05:11 +08:00
|
|
|
|
### squire-toolbar
|
|
|
|
|
event.detail = { squire: SquireUI, actions: object }
|
|
|
|
|
`actions` is the toolbar structure.
|
|
|
|
|
```javascript
|
|
|
|
|
block-of-buttons: {
|
|
|
|
|
button-name: {
|
|
|
|
|
select: ['selectbox options'],
|
|
|
|
|
html: 'button text',
|
|
|
|
|
cmd: () => `command to execute`,
|
|
|
|
|
key: 'keyboard shortcut',
|
|
|
|
|
matches: 'HTML elements that match'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
See [SquireUI.js](https://github.com/the-djmaze/snappymail/blob/master/dev/External/SquireUI.js)
|
|
|
|
|
for all default toolbar actions.
|
2023-01-20 03:09:52 +08:00
|
|
|
|
|
|
|
|
|
# JavaScript `rl` object
|
|
|
|
|
|
|
|
|
|
## rl.Enums.StorageResultType
|
|
|
|
|
### rl.Enums.StorageResultType.Abort
|
|
|
|
|
### rl.Enums.StorageResultType.Error
|
|
|
|
|
### rl.Enums.StorageResultType.Success
|
|
|
|
|
|
|
|
|
|
## rl.Utils.htmlToPlain(html)
|
|
|
|
|
Converts HTML to text
|
|
|
|
|
|
|
|
|
|
## rl.Utils.plainToHtml(plain)
|
|
|
|
|
Converts text to HTML
|
|
|
|
|
|
|
|
|
|
## rl.addSettingsViewModel(SettingsViewModelClass, template, labelName, route)
|
2023-01-26 17:41:55 +08:00
|
|
|
|
Examples in
|
|
|
|
|
* ./change-password/js/ChangePasswordUserSettings.js
|
|
|
|
|
* ./example/js/ExampleUserSettings.js
|
|
|
|
|
* ./kolab/js/settings.js
|
|
|
|
|
* ./two-factor-auth/js/TwoFactorAuthSettings.js
|
2023-01-20 03:09:52 +08:00
|
|
|
|
|
|
|
|
|
## rl.addSettingsViewModelForAdmin(SettingsViewModelClass, template, labelName, route)
|
2023-01-26 17:41:55 +08:00
|
|
|
|
Examples in
|
|
|
|
|
* ./example/js/ExampleAdminSettings.js:34: rl.addSettingsViewModelForAdmin(ExampleAdminSettings, 'ExampleAdminSettingsTab',
|
2023-01-20 03:09:52 +08:00
|
|
|
|
|
|
|
|
|
## rl.adminArea()
|
2023-01-26 17:41:55 +08:00
|
|
|
|
Returns true or false when in '?admin' area
|
2023-01-20 03:09:52 +08:00
|
|
|
|
|
|
|
|
|
## rl.app.Remote.abort(action)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.get(action, url)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.getPublicKey(fCallback)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.post(action, fTrigger, params, timeOut)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.request(action, fCallback, params, iTimeout, sGetAdd)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.setTrigger(trigger, value)
|
|
|
|
|
|
|
|
|
|
## rl.app.Remote.streamPerLine(fCallback, sGetAdd, postData)
|
|
|
|
|
|
|
|
|
|
## rl.app.folderList
|
|
|
|
|
A knockout observable array of all folders/mailboxes
|
|
|
|
|
|
|
|
|
|
## rl.fetch(resource, init, postData)
|
|
|
|
|
|
|
|
|
|
## rl.fetchJSON(resource, init, postData)
|
|
|
|
|
|
|
|
|
|
## rl.i18n(key, valueList, defaulValue)
|
|
|
|
|
|
|
|
|
|
## rl.loadScript(src)
|
|
|
|
|
|
|
|
|
|
## rl.logoutReload(url)
|
|
|
|
|
|
|
|
|
|
## rl.pluginPopupView
|
|
|
|
|
class AbstractViewPopup
|
|
|
|
|
|
|
|
|
|
## rl.pluginRemoteRequest(callback, action, parameters, timeout)
|
|
|
|
|
|
|
|
|
|
## rl.pluginSettingsGet(pluginSection, name)
|
|
|
|
|
|
|
|
|
|
## rl.registerWYSIWYG(name, construct)
|
|
|
|
|
|
|
|
|
|
## rl.route.root()
|
|
|
|
|
|
|
|
|
|
## rl.route.reload()
|
|
|
|
|
|
|
|
|
|
## rl.route.off()
|
|
|
|
|
|
|
|
|
|
## rl.setTitle(title)
|
|
|
|
|
|
|
|
|
|
## rl.settings.get(name)
|
|
|
|
|
|
|
|
|
|
## rl.settings.set(name, value)
|
|
|
|
|
|
|
|
|
|
## rl.settings.app(name)
|