more mail stuff
- todo: alot, but mainly track new/read and get local working
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html`;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ minisrv v${minisrv_config.version}${(minisrv_config.config.git_commit) ? ' git-'
|
||||
<li><a href="client:relog">client:relog (direct)</a></li>
|
||||
<li><a href="wtv-flashrom:/willie" selected>Ultra Willies</a> ~ <a href="wtv-tricks:/tricks">Tricks</a></li>
|
||||
<li><a href="wtv-setup:/setup">Setup (Including BG Music)</a></li>
|
||||
<li><a href="${ssid_sessions[socket.ssid].mailstore.mailstoreExists() ? 'wtv-mail:/listmail' : 'wtv-mail:/DiplomaMail'}">Mail (not ready)</a>
|
||||
<li><a href="${ssid_sessions[socket.ssid].mailstore.checkMailIntroSeen() ? 'wtv-mail:/listmail' : 'wtv-mail:/DiplomaMail'}">Mail (not ready)</a>
|
||||
`;
|
||||
if (ssid_sessions[socket.ssid].hasCap("client-can-do-chat")) {
|
||||
data += "<li><a href=\"wtv-chat:/home\">IRC Chat Test</a></li>\n"
|
||||
|
||||
@@ -54,8 +54,7 @@ Welcome to Mail
|
||||
<td>
|
||||
<td valign=top>
|
||||
In Mail, you can exchange typed messages—called
|
||||
<i>e-mail</i>—with anyone in the world who has an e-mail
|
||||
address. This is your e-mail address:
|
||||
<i>m-mail</i>—with anyone who is on ${minisrv_config.config.service_name}, as well as anyone using other compatible MiniSrvs around the world. This is your m-mail address:
|
||||
<blockquote>
|
||||
<b>${ssid_sessions[socket.ssid].getSessionData("subscriber_username")}@${minisrv_config.config.service_name}</b>
|
||||
</blockquote>
|
||||
@@ -79,10 +78,10 @@ choose this link:
|
||||
</table>
|
||||
<tr>
|
||||
<td valign=top height=55 align=right>
|
||||
<form>
|
||||
<form method="POST" action="wtv-mail:/listmail">
|
||||
<input type="hidden" name="intro_seen" value="true">
|
||||
<font color=ffcf69><shadow>
|
||||
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
|
||||
action="wtv-mail:/listmail"
|
||||
<input type=submit usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"
|
||||
value="Begin"
|
||||
width='110'
|
||||
selected>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 98 B |
@@ -8,57 +8,66 @@ function mail_end_error(msg) {
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
// check if mailstore exists (returns null if guest)
|
||||
mailstore_exists = ssid_sessions[socket.ssid].mailstore.mailstoreExists();
|
||||
var intro_seen = ssid_sessions[socket.ssid].mailstore.checkMailIntroSeen();
|
||||
if (!intro_seen && !request_headers.query.intro_seen) {
|
||||
// user is trying to bypass the intro screen
|
||||
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail";
|
||||
} else {
|
||||
if (!intro_seen && request_headers.query.intro_seen) {
|
||||
// User has come from intro
|
||||
ssid_sessions[socket.ssid].mailstore.setMailIntroSeen(true);
|
||||
}
|
||||
// check if mailstore exists (returns null if guest)
|
||||
mailstore_exists = ssid_sessions[socket.ssid].mailstore.mailstoreExists();
|
||||
|
||||
// create mailstore if it doesnt exist (also returns null if guest)
|
||||
if (!mailstore_exists) mailstore_exists = ssid_sessions[socket.ssid].mailstore.createMailstore();
|
||||
// create mailstore if it doesnt exist (also returns null if guest)
|
||||
if (!mailstore_exists) mailstore_exists = ssid_sessions[socket.ssid].mailstore.createMailstore();
|
||||
|
||||
if (mailstore_exists) {
|
||||
// mailstore exists and user is not guest
|
||||
if (mailstore_exists) {
|
||||
// mailstore exists and user is not guest
|
||||
|
||||
var default_limit = (minisrv_config.services[service_name].messages_per_page) ? minisrv_config.services[service_name].messages_per_page : 25; // user config or 25
|
||||
var mailbox = (request_headers.query.mailbox) ? parseInt(request_headers.query.mailbox) : 0;
|
||||
var limit = (request_headers.query.limit) ? parseInt(request_headers.query.limit) : default_limit;
|
||||
var reverse_sort = (request_headers.query.reverse_sort) ? true : false;
|
||||
var page = (request_headers.query.page) ? parseInt(request_headers.query.page) : 0;
|
||||
var default_limit = (minisrv_config.services[service_name].messages_per_page) ? minisrv_config.services[service_name].messages_per_page : 25; // user config or 25
|
||||
var mailbox = (request_headers.query.mailbox) ? parseInt(request_headers.query.mailbox) : 0;
|
||||
var limit = (request_headers.query.limit) ? parseInt(request_headers.query.limit) : default_limit;
|
||||
var reverse_sort = (request_headers.query.reverse_sort) ? true : false;
|
||||
var page = (request_headers.query.page) ? parseInt(request_headers.query.page) : 0;
|
||||
|
||||
// get mailbox name
|
||||
var mailbox_name = ssid_sessions[socket.ssid].mailstore.getMailboxById(parseInt(mailbox));
|
||||
// get mailbox name
|
||||
var mailbox_name = ssid_sessions[socket.ssid].mailstore.getMailboxById(parseInt(mailbox));
|
||||
|
||||
// if false or null, then mailbox is invalid
|
||||
if (!mailbox_name) {
|
||||
mail_end_error("Invalid Mailbox ID");
|
||||
} else {
|
||||
// mailboxid is ok
|
||||
if (!ssid_sessions[socket.ssid].mailstore.mailboxExists(mailbox)) {
|
||||
// mailbox does not yet exist, create it
|
||||
var mailbox_exists = ssid_sessions[socket.ssid].mailstore.createMailbox(mailbox);
|
||||
if (!mailbox_exists) {
|
||||
// failed to create mailbox for some reason
|
||||
mail_end_error();
|
||||
} else {
|
||||
if (mailbox === 0) {
|
||||
// Just created Inbox for the first time, so create the welcome message
|
||||
ssid_sessions[socket.ssid].mailstore.createWelcomeMessage();
|
||||
// if false or null, then mailbox is invalid
|
||||
if (!mailbox_name) {
|
||||
mail_end_error("Invalid Mailbox ID");
|
||||
} else {
|
||||
// mailboxid is ok
|
||||
if (!ssid_sessions[socket.ssid].mailstore.mailboxExists(mailbox)) {
|
||||
// mailbox does not yet exist, create it
|
||||
var mailbox_exists = ssid_sessions[socket.ssid].mailstore.createMailbox(mailbox);
|
||||
if (!mailbox_exists) {
|
||||
// failed to create mailbox for some reason
|
||||
mail_end_error();
|
||||
} else {
|
||||
if (mailbox === 0) {
|
||||
// Just created Inbox for the first time, so create the welcome message
|
||||
ssid_sessions[socket.ssid].mailstore.createWelcomeMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var message_list = ssid_sessions[socket.ssid].mailstore.listMessages(mailbox, limit, reverse_sort, (page * limit))
|
||||
var total_message_count = ssid_sessions[socket.ssid].mailstore.countMessages(mailbox);
|
||||
var username = ssid_sessions[socket.ssid].getSessionData("subscriber_username");
|
||||
var notImplementedAlert = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "This feature is not available.",
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:donothing",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
var message_list = ssid_sessions[socket.ssid].mailstore.listMessages(mailbox, limit, reverse_sort, (page * limit))
|
||||
var total_message_count = ssid_sessions[socket.ssid].mailstore.countMessages(mailbox);
|
||||
var username = ssid_sessions[socket.ssid].getSessionData("subscriber_username");
|
||||
var notImplementedAlert = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "This feature is not available.",
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:donothing",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
headers = `200 OK
|
||||
headers = `200 OK
|
||||
Content-type: text/html`;
|
||||
|
||||
data = `<sendpanel action="wtv-mail:/sendmail"
|
||||
data = `<sendpanel action="wtv-mail:/sendmail"
|
||||
message="Write a new e-mail message"
|
||||
label="Write">
|
||||
<savepanel
|
||||
@@ -94,7 +103,7 @@ label="View saved e-mail messages">
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="${notImplementedAlert}"
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/sendmail"
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
@@ -107,7 +116,7 @@ label="View saved e-mail messages">
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/folders"
|
||||
<table cellspacing=0 cellpadding=0 href="${notImplementedAlert}"
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
@@ -178,33 +187,23 @@ label="View saved e-mail messages">
|
||||
<td height=80>
|
||||
<img src="wtv-mail:/content/images/Mail.gif" width=87 height=45>
|
||||
`;
|
||||
var icon_image = null;
|
||||
switch (mailbox_name) {
|
||||
case "Inbox":
|
||||
switch (total_message_count) {
|
||||
case 0:
|
||||
icon_image = "OpenMailbox0.gif";
|
||||
break;
|
||||
case 1:
|
||||
icon_image = "OpenMailbox1.gif";
|
||||
break;
|
||||
default:
|
||||
icon_image = "OpenMailbox2.gif";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "Sent":
|
||||
icon_image = "MailboxSent.gif";
|
||||
break;
|
||||
case "Trash":
|
||||
icon_image = "MailboxDiscard.gif";
|
||||
break;
|
||||
default:
|
||||
icon_image = "MailboxStorage.gif";
|
||||
break;
|
||||
}
|
||||
var icon_image = null;
|
||||
switch (mailbox_name) {
|
||||
case "Inbox":
|
||||
icon_image = ssid_sessions[socket.ssid].mailstore.getMailboxIcon();
|
||||
break;
|
||||
case "Sent":
|
||||
icon_image = "MailboxSent.gif";
|
||||
break;
|
||||
case "Trash":
|
||||
icon_image = "MailboxDiscard.gif";
|
||||
break;
|
||||
default:
|
||||
icon_image = "MailboxStorage.gif";
|
||||
break;
|
||||
}
|
||||
|
||||
data += `
|
||||
data += `
|
||||
<img src="wtv-mail:/content/images/${icon_image}" width=74 height=45 >
|
||||
<td width=250 align=left><font sizerange=small>
|
||||
</table>
|
||||
@@ -243,9 +242,9 @@ label="View saved e-mail messages">
|
||||
<spacer type=horizontal size=13>
|
||||
<td bgcolor=#171726 width="438" valign="top">
|
||||
<spacer type=vertical size=13><br>`;
|
||||
if (message_list) {
|
||||
if (message_list) {
|
||||
|
||||
data += `
|
||||
data += `
|
||||
<font sizerange=medium> ${total_message_count} e-mail message${(total_message_count != 1) ? 's' : ''} for
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<TR><TD maxlines="1">
|
||||
@@ -266,10 +265,10 @@ ${username}@${minisrv_config.config.service_name}
|
||||
<spacer type=vertical size=1>
|
||||
<hr width=422 align=left>
|
||||
`;
|
||||
Object.keys(message_list).forEach(function (k) {
|
||||
var message = message_list[k];
|
||||
console.log(message);
|
||||
data += `<spacer type=vertical size=5>
|
||||
Object.keys(message_list).forEach(function (k) {
|
||||
var message = message_list[k];
|
||||
console.log(message);
|
||||
data += `<spacer type=vertical size=5>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td href="readmail?message_id=${message.id}#next" id="id${message.id}" selected>
|
||||
@@ -289,25 +288,25 @@ ${(message.subject) ? message.subject : "(No Subject)"}
|
||||
<td abswidth=47 maxlines=1>
|
||||
<font color=#7A9FCC>
|
||||
`;
|
||||
var message_date = new Date(message.date * 1000);
|
||||
data += (message_date.getMonth() + 1) + "/" + message_date.getDate() + "\n";
|
||||
data += `
|
||||
var message_date = new Date(message.date * 1000);
|
||||
data += (message_date.getMonth() + 1) + "/" + message_date.getDate() + "\n";
|
||||
data += `
|
||||
</font>
|
||||
</table>
|
||||
<tr>
|
||||
<td height=5>`;
|
||||
});
|
||||
} else {
|
||||
data += `
|
||||
});
|
||||
} else {
|
||||
data += `
|
||||
<font sizerange=medium> No ${(mailbox_name == "Inbox") ? `new e-mail messages for<table cellspacing=0 cellpadding=0 border=0>
|
||||
<TR><TD maxlines="1">
|
||||
${username}@${minisrv_config.config.service_name}
|
||||
</TD></TR>
|
||||
</TABLE>` : 'e-mail messages in mailbox '+mailbox_name}
|
||||
</TABLE>` : 'e-mail messages in mailbox ' + mailbox_name}
|
||||
</font><br>
|
||||
`;
|
||||
}
|
||||
data += `
|
||||
}
|
||||
data += `
|
||||
<spacer type=vertical size=6>
|
||||
</table>
|
||||
</body>
|
||||
@@ -315,7 +314,8 @@ data += `
|
||||
`;
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
mail_end_error("Access Denied");
|
||||
}
|
||||
} else {
|
||||
mail_end_error("Access Denied");
|
||||
}
|
||||
273
zefie_wtvp_minisrv/ServiceVault/wtv-mail/readmail.js
Normal file
273
zefie_wtvp_minisrv/ServiceVault/wtv-mail/readmail.js
Normal file
@@ -0,0 +1,273 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var mailstore_exists = false;
|
||||
|
||||
function mail_end_error(msg) {
|
||||
var errpage = doErrorPage("400", msg);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
var intro_seen = ssid_sessions[socket.ssid].mailstore.checkMailIntroSeen();
|
||||
if (!intro_seen && !request_headers.query.intro_seen) {
|
||||
// user is trying to bypass the intro screen
|
||||
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail";
|
||||
} else {
|
||||
if (!request_headers.query.message_id) {
|
||||
mail_end_error("Message ID Required");
|
||||
} else {
|
||||
var messageid = request_headers.query.message_id;
|
||||
var message = ssid_sessions[socket.ssid].mailstore.getMessageByID(messageid);
|
||||
if (!message) {
|
||||
mail_end_error("Invalid Message ID");
|
||||
} else {
|
||||
var notImplementedAlert = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "This feature is not available.",
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:donothing",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html`;
|
||||
|
||||
data = `<wtvnoscript>
|
||||
<sendpanel
|
||||
action = "wtv-mail:/sendmail?message_forward_id=14&mailbox_name=inbox"
|
||||
message = "Forward this message to someone else."
|
||||
label = "Forward">
|
||||
<savepanel
|
||||
action = "client:showsplash?image=wtv-mail:/ROMCache/OpenMailbox3.gif&message=Saving%20to%20storage&showpage=true&action=wtv-mail:/readmail%3Fmailbox_name%3Dinbox%26message_move%3Dmbox%26message_id%3D14%26selected%3Dsave"
|
||||
message = "Save this message with your stored mail."
|
||||
label = "Save"
|
||||
xnocancel>
|
||||
<HTML>
|
||||
<head>
|
||||
<title>
|
||||
${message.subject}
|
||||
</title>
|
||||
</head>
|
||||
<body
|
||||
bgcolor="#171726"
|
||||
text="#82A9D9"
|
||||
link="#BDA73A" vlink="#62B362" vspace=0 hspace=0>
|
||||
<sidebar width=109>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=420 bgcolor=#262E3D valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=7 colspan=3>
|
||||
<spacer type=vertical size=7>
|
||||
<tr>
|
||||
<td width=7>
|
||||
<spacer type=horizontal size=7>
|
||||
<td width=87 href="wtv-home:/home">
|
||||
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
<td width=10>
|
||||
<spacer type=horizontal size=10>
|
||||
</table>
|
||||
<spacer type=vertical size=6>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/listmail?mailbox=0#id${messageid}"
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Mail list</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#596C75 href="${notImplementedAlert}">Previous</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 id=next href="${notImplementedAlert}" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Next</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:showsplash?image=wtv-mail:/content/images/OpenMailbox3.gif&message=Discarding%20Message&showpage=true&action=wtv-mail%3A%2Freadmail%3Fmessage_delete%3Dtrue%26message_id%3D${messageid}%26mailbox_name%3DInbox%26selected%3Ddelete"
|
||||
xnocancel
|
||||
id=delete
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Discard</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:showsplash?image=wtv-mail:/content/images/OpenMailbox3.gif&message=Saving%20Message&showpage=true&action=wtv-mail:/readmail%3Fmessage_move%3DSaved%26mailbox_name%3DInbox%26message_id%3D${messageid}%26selected%3Dsave"
|
||||
xnocancel
|
||||
id=save
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Save</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/sendmail?message_reply_id=${messageid}&mailbox_name=Inbox&selected=body&reply_all=false"
|
||||
xnocancel
|
||||
id=save
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Reply</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/sendmail?message_forward_id=${messageid}&mailbox_name=Inbox"
|
||||
xnocancel
|
||||
id=save
|
||||
>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Forward</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr>
|
||||
<td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
</table>
|
||||
<td width=5 bgcolor=#5B6C81>
|
||||
</table>
|
||||
</sidebar>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=451 colspan=2 align=center bgcolor=#5B6C81>
|
||||
<spacer type=vertical size=13>
|
||||
<tr>
|
||||
<td height=8 bgcolor=#171726 colspan=2>
|
||||
<img src="wtv-mail:/content/images/CornerTop.gif" width=8 height=8>
|
||||
<tr>
|
||||
<td bgcolor=#171726 width=451 valign=top>
|
||||
<table cellspacing=0 cellpadding=0 width=451>
|
||||
<tr>
|
||||
<td bgcolor=#171726 width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
<td height=9>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<table cellspacing=0 cellpadding=0 bgcolor=#2C323D>
|
||||
<tr>
|
||||
<td width=451 absheight=25>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=13 absheight=25>
|
||||
<spacer type=horizontal size=13>
|
||||
<td width=370 maxlines=1>
|
||||
<font sizerange=medium color=#D6D6D6><blackface>
|
||||
E-mail message
|
||||
</blackface></font>
|
||||
<td width=21>
|
||||
<!--
|
||||
<img src="wtv-mail:/content/images/widget.gif" width=16 height=16 noprint>
|
||||
<td width=36>
|
||||
<spacer type=vertical size=1><br>
|
||||
<a href="wtv-guide:/help?topic=Mail&subtopic=Index&appName=Mail" ><img src="wtv-mail:/content/images/mail_help_image.gif" width=35 height=17 noprint></a>
|
||||
-->
|
||||
<td width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
</table>
|
||||
</table>
|
||||
</table>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=13 rowspan=2>
|
||||
<td height=15>
|
||||
<spacer type=vertical size=15>
|
||||
<td width=13 rowspan=2>
|
||||
<tr>
|
||||
<td abswidth=425>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
From:
|
||||
<td width=10>
|
||||
<td>`;
|
||||
if (message.from_name != message.from_addr) {
|
||||
data += `${html_entities.encode(message.from_addr)}<a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${escape(escape(message.from_name))}%3C%2Fblackface%3E%20to%20your%20Address%20book,%20choose%20%3Cb%3EAdd%3C%2Fb%3E.&buttonlabel2=Cancel&buttonaction2=client:donothing&buttonlabel1=Add&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${escape(escape(message.from_name))}%26address%3D${escape(escape(message.from_addr))}%26new_address%3Dtrue">(${html_entities.encode(message.from_name)})</a>`;
|
||||
} else {
|
||||
data += `${html_entities.encode(message.from_addr)}`;
|
||||
}
|
||||
|
||||
data += `<tr>
|
||||
<td valign=top>
|
||||
Date:
|
||||
<td>
|
||||
<td>
|
||||
${strftime("%a, %b %e, %Y, %I:%M %P",new Date(message.date * 1000))} (UTC)
|
||||
<tr>
|
||||
<td valign=top>
|
||||
To:
|
||||
<td>
|
||||
<td>
|
||||
${html_entities.encode(message.to_addr)} ${(html_entities.encode(message.to_name)) ? '(' + html_entities.encode(message.to_name) + ')' : ''}
|
||||
<tr>
|
||||
<td nowrap valign=top>
|
||||
Subject: <td>
|
||||
<td>
|
||||
${html_entities.encode(message.subject)}
|
||||
<tr>
|
||||
<td height=10>
|
||||
<spacer type=vertical size=10>
|
||||
</table>
|
||||
<input type=hidden name=message_safe value=true>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=425>
|
||||
<p>
|
||||
${html_entities.encode(message.body).replace("\n", "<br>")}
|
||||
${(message.signature) ? '<embed src="wtv-mail:/get-signature?message_id=${messageid}>' : ''}
|
||||
<p>
|
||||
<p>
|
||||
</table>
|
||||
</table>
|
||||
</body>
|
||||
</HTML>
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
338
zefie_wtvp_minisrv/ServiceVault/wtv-mail/sendmail.js
Normal file
338
zefie_wtvp_minisrv/ServiceVault/wtv-mail/sendmail.js
Normal file
@@ -0,0 +1,338 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var intro_seen = ssid_sessions[socket.ssid].mailstore.checkMailIntroSeen();
|
||||
if (!intro_seen && !request_headers.query.intro_seen) {
|
||||
// user is trying to bypass the intro screen
|
||||
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail";
|
||||
} else {
|
||||
|
||||
var doClientError = function (msg) {
|
||||
var clientErrorMsg = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': msg,
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:donothing",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
headers = "300 OK\nwtv-visit: " + clientErrorMsg;
|
||||
}
|
||||
|
||||
var username = ssid_sessions[socket.ssid].getSessionData("subscriber_username");
|
||||
var userdisplayname = html_entities.encode(ssid_sessions[socket.ssid].getSessionData("subscriber_name"));
|
||||
var address = username + "@" + minisrv_config.config.service_name
|
||||
var notImplementedAlert = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "This feature is not available.",
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:donothing",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
|
||||
headers = `200 OK
|
||||
Content-type text/html`;
|
||||
|
||||
data = `<display poweroffalert >
|
||||
<sendpanel
|
||||
action="javascript:Submit()"
|
||||
message="Send this message now"
|
||||
label="Send message">
|
||||
<savepanel message="Messages that you are writing cannot be saved. Send it to yourself if you would like a copy.">
|
||||
<HTML>
|
||||
<head>
|
||||
<script language=javascript>
|
||||
function Submit() { if (document.sendform.message_to.value == "") { location = "client:showalert?message=Your%20message%20could%20not%20be%20sent.%3Cp%3E%0AYou%20must%20specify%20an%20addressee%20in%20the%20%3Cblackface%3ETo%3A%3C%2Fblackface%3E%20area.%0A&buttonLabel1=Continue%0A&buttonAction1=client%3Adonothing&buttonLabel2=";
|
||||
} else { location = "client:showsplash?message=Sending%20Message&animation=file://ROM/Animations/mail.ani&action=client:submitform%3Fname%3Dsendform%26submitname%3Dsendoff%26submitvalue%3DSend";
|
||||
}
|
||||
}
|
||||
function ErasingMedia(victim) { var myURL;
|
||||
myURL = "client:submitform?name=sendform&submitvalue=false" + "&submitname=" + victim;
|
||||
if (victim == "gabbing") { document.forms.sendform.elements.message_voicemail_data.disabled = true;
|
||||
}
|
||||
if (victim == "snapping") { document.forms.sendform.elements.message_snapshot_data.disabled = true;
|
||||
}
|
||||
location = myURL;
|
||||
location.reload(); }
|
||||
function Signing(desiredState) { var myURL;
|
||||
myURL="client:submitform?name=sendform&submitvalue=false"+"&submitname=togglesign";
|
||||
location = myURL;
|
||||
location.reload();
|
||||
}
|
||||
function DoneSnapping() { location = "client:submitform?name=sendform&submitname=snapping&submitvalue=true";
|
||||
location.reload(); }
|
||||
function DoneGabbing() { var myURL;
|
||||
myURL = "client:submitform?name=sendform&submitname=gabbing&submitvalue=cache%3Avoicemail.wav";
|
||||
location = "client:submitform?name=sendform&submitname=gabbing&submitvalue=true";
|
||||
location.reload(); }
|
||||
</script>
|
||||
<title>
|
||||
Write an e-mail message
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#171726" text="#82A9D9" link="#BDA73A" vlink="#62B362" vspace=0 hspace=0>
|
||||
<form action="wtv-mail:/sendmail#focus" method="post" name=sendform >
|
||||
<input type=hidden name=skey value="Kx0uv4a00C4">
|
||||
<input type=hidden name="wtv-saved-message-id" value="writemessage-outbox">
|
||||
<input type=hidden name="message_reply_all_cc" value="">
|
||||
<input type=hidden name="saveoff" value="true" autosubmit="onleave">
|
||||
<sidebar width=109>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=420 bgcolor=#262E3D valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=7 colspan=3>
|
||||
<spacer type=vertical size=7>
|
||||
<tr>
|
||||
<td width=7>
|
||||
<spacer type=horizontal size=7>
|
||||
<td width=87 href="wtv-home:/home">
|
||||
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
<td width=10>
|
||||
<spacer type=horizontal size=10>
|
||||
</table>
|
||||
<spacer type=vertical size=6>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-mail:/listmail" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Mail list</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:openaddresspanel" id=addressbook>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Address</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:videocapture?notify=javascript%3ADoneSnapping()&device=video&width=100%25&height=100%25&name=cache%3Asnapshot.jpg&donebuttonlabel=Add%20to%20Message&open" id=addressbook>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Photo</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:soundcapture?notify=javascript%3ADoneGabbing()&device=audio&rate=8000&name=cache%3Avoicemail.wav&donebuttonlabel=Add%20to%20Message&open" id=addressbook>
|
||||
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Recording</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:showalert?sound=none&message=Are%20you%20sure%20you%20want%20to%20erase%20this%20entire%20message%3F&buttonlabel2=Don't%20Erase&buttonaction2=client:donothing&buttonlabel1=Erase&buttonaction1=wtv-mail:/sendmail%3Fclear%3Dtrue%26wtv-saved-message-id%3Dwritemessage-outbox" id=addressbook>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E6CD4A>Erase</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#4A525A height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valgn=middle>
|
||||
</table>
|
||||
</sidebar>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=451 colspan=2 align=center bgcolor=#5B6C81>
|
||||
<spacer type=vertical size=13>
|
||||
<tr>
|
||||
<td height=8 bgcolor=#171726 colspan=2>
|
||||
<img src="wtv-mail:/content/images/CornerTop.gif" width=8 height=8>
|
||||
<tr>
|
||||
<td bgcolor=#171726 width=451 valign=top>
|
||||
<table cellspacing=0 cellpadding=0 width=451>
|
||||
<tr>
|
||||
<td bgcolor=#171726 width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
<td height=80>
|
||||
<img src="wtv-mail:/content/images/Mail.gif" width=87 height=45>
|
||||
<img src="wtv-mail:/content/images/${ssid_sessions[socket.ssid].mailstore.getMailboxIcon()}" width=74 height=45 transparency=60>
|
||||
<td width=250 align=left><font sizerange=small>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<table cellspacing=0 cellpadding=0 bgcolor=#2C323D>
|
||||
<tr>
|
||||
<td width=451 absheight=25>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=13 absheight=25>
|
||||
<spacer type=horizontal size=13>
|
||||
<td width=370 maxlines=1>
|
||||
<font sizerange=medium color=#D6D6D6><blackface>
|
||||
Write an e-mail message
|
||||
</blackface></font>
|
||||
<!--
|
||||
<td width=21>
|
||||
<img src="wtv-mail:/content/images/widget.gif" width=16 height=16 noprint>
|
||||
<td width=36>
|
||||
<spacer type=vertical size=1><br>
|
||||
<a href="wtv-guide:/help?topic=Mail&subtopic=Index&appName=Mail" ><img src="wtv-mail:/content/images/mail_help_image.gif" width=35 height=17 noprint></a> -->
|
||||
<td width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
</table>
|
||||
</table>
|
||||
</table>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td bgcolor=#171726 width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
<td bgcolor=#171726 width=438 valign=top>
|
||||
<spacer type=vertical size=5><br>
|
||||
<table cellspacing=0 cellpadding=0 bgcolor="#1F2033">
|
||||
<tr>
|
||||
<td absheight=2 colspan=5 bgcolor=#495360>
|
||||
<tr>
|
||||
<td abswidth=2 bgcolor=#495360>
|
||||
<td absheight=13 colspan=3>
|
||||
<td abswidth=2 bgcolor=#000000>
|
||||
<tr>
|
||||
<td abswidth=2 bgcolor=#495360>
|
||||
<td abswidth=13>
|
||||
<td abswidth=385>
|
||||
<table cellspacing=0 cellpadding=0> <tr>
|
||||
<td width=80 valign=top align=right>
|
||||
<font color=#82A9D9>From: </font>
|
||||
<td width=305 valign=top>
|
||||
<font color=#82A9D9><table cellspacing=0 cellpadding=0 border=0>
|
||||
<TR><TD maxlines="1">
|
||||
${address}
|
||||
</TD></TR>
|
||||
</TABLE></font>
|
||||
<font color=#82A9D9>(${userdisplayname})</font>
|
||||
<tr>
|
||||
<td height=13 valign=middle colspan=2>
|
||||
<img src="wtv-mail:/content/images/sendmail_panel_dots.gif" width=385 height=2>
|
||||
<tr>
|
||||
<td width=80 valign=top align=right>
|
||||
<a href="client:openaddresspanel">To:</a>
|
||||
<td width=305 valign=top>
|
||||
<textarea
|
||||
bgcolor="#1F2033"
|
||||
cursor=#BDA73A
|
||||
nosoftbreaks
|
||||
borderimage="file://ROM/Borders/textfield.alt1.bif"
|
||||
nohardbreaks
|
||||
selected
|
||||
font=proportional
|
||||
text=#82A9D9
|
||||
name="message_to"
|
||||
border=0
|
||||
width=305 rows=1
|
||||
growable
|
||||
autoactivate
|
||||
addresses
|
||||
autoascii
|
||||
nohighlight
|
||||
></textarea>
|
||||
<tr>
|
||||
<td height=13 valign=middle colspan=2>
|
||||
<img src="wtv-mail:/content/images/sendmail_panel_dots.gif" width=385 height=2>
|
||||
<tr>
|
||||
<td abswidth=83 valign=top align=right>
|
||||
<font color=#82A9D9>Subject: </font>
|
||||
<td width=305 valign=top>
|
||||
<textarea
|
||||
bgcolor="#1F2033"
|
||||
cursor=#BDA73A
|
||||
nosoftbreaks
|
||||
borderimage="file://ROM/Borders/textfield.alt1.bif"
|
||||
nohardbreaks
|
||||
text=#82A9D9
|
||||
name="message_subject" font=proportional
|
||||
border=0
|
||||
width=305 rows=1
|
||||
growable
|
||||
autoactivate
|
||||
maxlength=70
|
||||
nohighlight
|
||||
autohiragana
|
||||
></textarea>
|
||||
<tr>
|
||||
<td height=13 valign=middle colspan=2>
|
||||
<img src="wtv-mail:/content/images/sendmail_panel_dots.gif" width=385 height=2>
|
||||
<tr>
|
||||
<td width=305 colspan=2>
|
||||
<textarea nosoftbreaks
|
||||
bgcolor="#1F2033"
|
||||
text=#82A9D9
|
||||
cursor=#BDA73A
|
||||
name="message_body" font=proportional
|
||||
border=0
|
||||
rows=4
|
||||
width=386
|
||||
nohighlight
|
||||
autoactivate
|
||||
autohiragana
|
||||
growable
|
||||
nextdown="Send"></textarea>
|
||||
</table>
|
||||
<body bgcolor=#1F2033
|
||||
text=#82A9D9
|
||||
link=#BDA73A
|
||||
vlink=#62B362
|
||||
vspace=0
|
||||
hspace=0>`;
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("subscriber_signature") || ssid_sessions[socket.ssid].getSessionData("subscriber_signature") == "") {
|
||||
data += `<input type=hidden name="no_signature" value="true"> <td abswidth=13>`;
|
||||
} else {
|
||||
data += `<input type=checkbox name="no_signature"> <td abswidth=13> Disable Signature`;
|
||||
}
|
||||
data += `
|
||||
<td abswidth=2 bgcolor=#000000>
|
||||
<tr>
|
||||
<td abswidth=2 bgcolor=#495360>
|
||||
<td absheight=13 colspan=3>
|
||||
<td abswidth=2 bgcolor=#000000>
|
||||
<tr>
|
||||
<td absheight=2 colspan=5 bgcolor=#000000>
|
||||
</table>
|
||||
<tr>
|
||||
<td width=13 bgcolor=#171726>
|
||||
<td width=438 bgcolor=#171726>
|
||||
<spacer type=vertical size=5><br>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=305 valign=top>
|
||||
<td align=right valign=top width=110> <FONT COLOR="#E7CE4A"><SHADOW>
|
||||
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" action="javascript:Submit()"
|
||||
value="Send"
|
||||
name="Send"
|
||||
id="Send"
|
||||
xnocancel
|
||||
width=103
|
||||
USESTYLE NOARGS>
|
||||
</SHADOW></FONT>
|
||||
</table>
|
||||
<spacer type=vertical size=5>
|
||||
</form>
|
||||
</table>
|
||||
</body>
|
||||
</HTML>
|
||||
`;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVBGMusic = require("./WTVBGMusic.js");
|
||||
var wtvbgm = new WTVBGMusic(minisrv_config, ssid_sessions[socket.ssid])
|
||||
var music_obj = wtvbgm.getMusicObj();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var settings_obj = ssid_sessions[socket.ssid].getSessionData("wtv-setup");
|
||||
if (settings_obj === null) settings_obj = {};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var music_obj = {};
|
||||
ssid_sessions[socket.ssid].setSessionData("wtv-bgmusic", music_obj);
|
||||
ssid_sessions[socket.ssid].saveSessionData();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query && ssid_sessions[socket.ssid]) {
|
||||
var settings_obj = ssid_sessions[socket.ssid].getSessionData("wtv-setup");
|
||||
if (settings_obj === null) settings_obj = {};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query && ssid_sessions[socket.ssid]) {
|
||||
|
||||
if (request_headers.request_url.indexOf('?') >= 0) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query && ssid_sessions[socket.ssid]) {
|
||||
ssid_sessions[socket.ssid].setSessionData("subscriber_signature", (request_headers.query.mail_signature) ? request_headers.query.mail_signature : "");
|
||||
ssid_sessions[socket.ssid].saveSessionData();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query) {
|
||||
if (request_headers.query.shade) {
|
||||
headers = `300 OK
|
||||
|
||||
Reference in New Issue
Block a user