From 9b46b39da15ced89c4703ccf4ba82d81f447020f Mon Sep 17 00:00:00 2001 From: zefie Date: Sat, 29 Oct 2022 10:45:28 -0400 Subject: [PATCH] WTVMail fixes --- zefie_wtvp_minisrv/includes/WTVMail.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zefie_wtvp_minisrv/includes/WTVMail.js b/zefie_wtvp_minisrv/includes/WTVMail.js index 2b17fb40..faebcfe4 100644 --- a/zefie_wtvp_minisrv/includes/WTVMail.js +++ b/zefie_wtvp_minisrv/includes/WTVMail.js @@ -96,7 +96,7 @@ class WTVMail { } mailboxExists(mailboxid) { - if (mailboxid > this.mailboxes.length) return null; + if (mailboxid >= this.mailboxes.length) return null; var mailbox_dir = null; if (this.mailstoreExists()) { var mailbox_name = this.getMailboxById(mailboxid); @@ -182,7 +182,7 @@ class WTVMail { } try { if (this.fs.existsSync(message_file_out)) { - console.log(" * ERROR: Message with this UUID (" + messageid + ") already exists (should never happen). Message lost."); + console.error(" * ERROR: Message with this UUID (" + messageid + ") already exists (should never happen). Message lost."); return false; } @@ -389,7 +389,7 @@ class WTVMail { var temp_session_data_file = self.fs.readFileSync(search_dir + self.path.sep + file, 'Utf8'); var temp_session_data = JSON.parse(temp_session_data_file); if (temp_session_data.subscriber_username.toLowerCase() == username.toLowerCase()) { - return_val = search_dir.replace(this.minisrv_config.config.SessionStore + self.path.sep, '').replace("user", '').split(self.path.sep); + return_val = search_dir.replace(this.minisrv_config.config.SessionStore + self.path.sep + "accounts" + self.path.sep, '').replace("user", '').split(self.path.sep); return_val.push(temp_session_data.subscriber_name); } } catch (e) { @@ -437,7 +437,7 @@ class WTVMail { // check if the destination user's Inbox exists yet if (!dest_user_mailstore.mailboxExists(0)) { // mailbox does not yet exist, create it - var mailbox_exists = dest_user_mailstore.createMailbox(mailbox); + var mailbox_exists = dest_user_mailstore.createMailbox(0); // Just created Inbox for the first time, so create the welcome message if (mailbox_exists) dest_user_mailstore.createWelcomeMessage(); }