Skip to content

Commit

Permalink
Merge pull request #800 from josaphatim/fixed-nux-issues-and-add-post…
Browse files Browse the repository at this point in the history
…ale-migadu-sieve

Fixed adding one server multiple times [Only nux module]
  • Loading branch information
kroky authored Oct 23, 2023
2 parents 5ba93a5 + be6706c commit ff7a3d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/imap/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ public function process() {
$this->session->record_unsaved('IMAP server added');
}
else {
Hm_Msgs::add(sprintf('ERRCound not add server: %s', $errstr));
Hm_Msgs::add(sprintf('ERRCould not add server: %s', $errstr));
}
}
}
Expand Down
14 changes: 13 additions & 1 deletion modules/nux/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public function process() {
$servers = Hm_IMAP_List::dump(false, true);
$ids = array_keys($servers);
$new_id = array_pop($ids);
if (in_server_list('Hm_IMAP_List', $new_id, $form['nux_email'])) {
Hm_IMAP_List::del($new_id);
Hm_Msgs::add('ERRThis IMAP server and username are already configured');
return;
}
$imap = Hm_IMAP_List::connect($new_id, false);
if ($imap && $imap->get_state() == 'authenticated') {
if (isset($details['smtp'])) {
Expand All @@ -197,7 +202,14 @@ public function process() {
));
$this->session->record_unsaved('SMTP server added');
$smtp_servers = Hm_SMTP_List::dump(false, true);
$this->user_config->set('smtp_servers', $smtp_servers);
$ids = array_keys($servers);
$new_smtp_id = array_pop($ids);
if (in_server_list('Hm_SMTP_List', $new_smtp_id, $form['nux_email'])) {
Hm_SMTP_List::del($new_smtp_id);
Hm_Msgs::add('ERRThis SMTP server and username are already configured');
} else {
$this->user_config->set('smtp_servers', $smtp_servers);
}
}
$this->user_config->set('imap_servers', $servers);
Hm_IMAP_List::clean_up();
Expand Down

0 comments on commit ff7a3d8

Please sign in to comment.