You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title describes, the read program utilizes the absolute array index for reading emails, instead of utilized the localised array created by the "mail" program.
This means that if I have set up mails for several users on the same server, they will get the following output from mail.
User 1:
[0]: "wtf"
[1]: "Please call me"
User 2:
[0]: "What are you doing saturday night?"
Assuming those are the only emails in the mailserver.json file, and in the order specified, it will work for User 1 to type either read 0 or read 1 and get the corresponding message, but whenever User 2 tries to write read 0, it gets an error message, and only by typing read 2 (as it is the third mail in the json) the user gets the mail.
The text was updated successfully, but these errors were encountered:
Actually managed to fix it myself. I created a filter array in the read function.
I added const messageList = mailList.filter( (mail) => mail.to.includes( userDatabase.userId ) ); to the read function in kernel.js, and changed mailAtIndex to reference the messageList instead of mailList
As the title describes, the read program utilizes the absolute array index for reading emails, instead of utilized the localised array created by the "mail" program.
This means that if I have set up mails for several users on the same server, they will get the following output from mail.
User 1:
[0]: "wtf"
[1]: "Please call me"
User 2:
[0]: "What are you doing saturday night?"
Assuming those are the only emails in the mailserver.json file, and in the order specified, it will work for User 1 to type either read 0 or read 1 and get the corresponding message, but whenever User 2 tries to write read 0, it gets an error message, and only by typing read 2 (as it is the third mail in the json) the user gets the mail.
The text was updated successfully, but these errors were encountered: