Skip to content

Commit

Permalink
[UI] modules.php : Modify the text to explain that Cypht supports JMA…
Browse files Browse the repository at this point in the history
…P (RFC8621) by default.
  • Loading branch information
Bienvenumoringa authored and =bienvenumoringa committed Oct 22, 2024
1 parent 8837a80 commit a3ef235
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions modules/nux/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ public function process() {
$smtp_servers = NULL;
$feed_servers = NULL;
$profiles = NULL;
$jmap_servers = NULL;

$modules = $this->config->get_modules();

if (data_source_available($modules, 'imap')) {
$imap_servers = count(Hm_IMAP_List::dump(false));
$imap_servers = Hm_IMAP_List::dump(false);
$jmap_servers = count(array_filter(Hm_IMAP_List::dump(false), function($v) { return array_key_exists('type', $v) && $v['type'] == 'jmap'; }));
}
if (data_source_available($modules, 'feeds')) {
$feed_servers = count(Hm_Feed_List::dump(false));
Expand All @@ -87,6 +89,7 @@ public function process() {

$this->out('nux_server_setup', array(
'imap' => $imap_servers,
'jmap' => $jmap_servers,
'feeds' => $feed_servers,
'smtp' => $smtp_servers,
'profiles' => $profiles
Expand Down Expand Up @@ -364,7 +367,7 @@ public function process()
continue;
}
}
}
}
if (! empty($server['smtp']['server'])) {
if (!$this->module_is_supported('smtp')) {
$errors[] = 'SMTP module is not enabled';
Expand Down Expand Up @@ -541,7 +544,7 @@ protected function output() {
class Hm_Output_nux_help extends Hm_Output_Module {
protected function output() {
return '<div class="nux_help mt-3 col-lg-6 col-md-12 col-sm-12"><div class="card"><div class="card-body"><div class="card_title"><h4>'.$this->trans('Help').'</h4></div>'.
$this->trans('Cypht is a webmail program. You can use it to access your E-mail accounts from any service that offers IMAP, or SMTP access - which most do.').' '.
$this->trans('Cypht is a webmail program. You can use it to access your E-mail accounts from any service that offers IMAP, or SMTP access - which most do. And Cypht also supports the newest protocol: JMAP (RFC8621).').' '.
'</div></div></div>';
}
}
Expand All @@ -563,6 +566,8 @@ protected function output() {
$res .= '<a class="mt-3 btn btn-light" href="?page=servers#quick_add_section"><i class="bi bi-person-plus me-3"></i>'.$this->trans('Add an E-mail Account').'</a>';
$res .= '</div><ul class="mt-4">';

$jmap_servers_count = count(array_filter($this->get('imap_servers', array()), function($v) { return array_key_exists('type', $v) && $v['type'] == 'jmap'; }));

foreach ($protos as $proto) {
$proto_dsp = $proto;
if ($proto == 'feeds') {
Expand Down Expand Up @@ -592,12 +597,12 @@ protected function output() {
$res .= sprintf(' <a href="?page=servers#%s_section">%s</a>', $proto, $this->trans('Add'));
}
else {
if ($server_data[$proto] > 1) {
$res .= sprintf($this->trans('You have %d %s sources'), $server_data[$proto], mb_strtoupper($proto_dsp));
}
else {
$res .= sprintf($this->trans('You have %d %s source'), $server_data[$proto], mb_strtoupper($proto_dsp));
}
$res .= sprintf(
$this->trans('You have %d %s%s'),
$server_data[$proto],
mb_strtoupper($proto_dsp),
($proto === 'imap' ? ' / JMAP ' . $server_data['jmap'] . ($server_data[$proto] > 1 ? ' sources' : ' source') : ($server_data[$proto] > 1 ? ' sources' : ' source'))
);
$res .= sprintf(' <a href="?page=servers#%s_section">%s</a>', $proto, $this->trans('Manage'));
}
$res .= '</li>';
Expand Down

0 comments on commit a3ef235

Please sign in to comment.