* SusiMail:

- Don't force reconnection on folder view (ticket #1253)
   - Only show logout button on folder view
   - Switch subject and date headers on message view
   - Button theme tweaks
   - Debug logging
   - Fix NPE when RELEASE=false
   - Synch tweaks
   - hellip
   - Footer tweak
This commit is contained in:
zzz
2014-04-18 16:43:07 +00:00
parent 493788f4f8
commit 029198c213
4 changed files with 53 additions and 33 deletions

View File

@@ -203,7 +203,7 @@ public class Mail {
formattedSender = getAddress( sender );
shortSender = formattedSender.trim();
if( shortSender.length() > 40 ) {
shortSender = shortSender.substring( 0, 37 ).trim() + "...";
shortSender = shortSender.substring( 0, 37 ).trim() + "…";
}
shortSender = html.encode( shortSender );
}
@@ -226,7 +226,7 @@ public class Mail {
formattedSubject = subject;
shortSubject = formattedSubject;
if( formattedSubject.length() > 60 )
shortSubject = formattedSubject.substring( 0, 57 ).trim() + "...";
shortSubject = formattedSubject.substring( 0, 57 ).trim() + "…";
shortSubject = html.encode( shortSubject );
}
else if( line.toLowerCase(Locale.US).startsWith( "reply-to:" ) ) {

View File

@@ -37,19 +37,18 @@ public class MailCache {
private final POP3MailBox mailbox;
private final Hashtable<String, Mail> mails;
private final Object synchronizer;
MailCache( POP3MailBox mailbox ) {
this.mailbox = mailbox;
mails = new Hashtable<String, Mail>();
synchronizer = new Object();
}
/**
* Fetch any needed data from pop3 server.
*
* @param uidl message id to get
* @param headerOnly fetch only header lines?
* @return An e-mail
* @return An e-mail or null
*/
public Mail getMail( String uidl, boolean headerOnly ) {
@@ -59,10 +58,8 @@ public class MailCache {
/*
* synchronize update to hashtable
*/
synchronized( synchronizer ) {
synchronized(mails) {
mail = mails.get( uidl );
if( mail == null ) {
newMail = new Mail();
mails.put( uidl, newMail );

View File

@@ -47,6 +47,7 @@ import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Locale;
@@ -635,11 +636,13 @@ public class WebMail extends HttpServlet
sessionObject.folder.addSorter( SORT_SIZE, new SizeSorter( sessionObject.mailCache ) );
sessionObject.folder.setSortingDirection( Folder.DOWN );
sessionObject.reallyDelete = false;
Debug.debug(Debug.DEBUG, "CONNECTED, YAY");
}
else {
sessionObject.error += sessionObject.mailbox.lastError();
sessionObject.mailbox.close();
sessionObject.mailbox = null;
Debug.debug(Debug.DEBUG, "NOT CONNECTED, BOO");
}
}
}
@@ -653,6 +656,7 @@ public class WebMail extends HttpServlet
private static void processLogout( SessionObject sessionObject, RequestWrapper request )
{
if( buttonPressed( request, LOGOUT ) ) {
Debug.debug(Debug.DEBUG, "REMOVING SESSION");
HttpSession session = request.getSession();
session.removeAttribute( "sessionObject" );
session.invalidate();
@@ -1181,6 +1185,10 @@ public class WebMail extends HttpServlet
if( sessionObject == null ) {
sessionObject = new SessionObject();
httpSession.setAttribute( "sessionObject", sessionObject );
Debug.debug(Debug.DEBUG, "NEW session " + httpSession.getId() + " state = " + sessionObject.state);
} else {
Debug.debug(Debug.DEBUG, "Existing session " + httpSession.getId() + " state = " + sessionObject.state +
" created " + new Date(httpSession.getCreationTime()));
}
return sessionObject;
}
@@ -1267,7 +1275,18 @@ public class WebMail extends HttpServlet
sessionObject.imgPath = sessionObject.themePath + "images/";
sessionObject.isMobile = isMobile;
int oldState = sessionObject.state;
processStateChangeButtons( sessionObject, request );
int newState = sessionObject.state;
if (oldState != newState)
Debug.debug(Debug.DEBUG, "STATE CHANGE from " + oldState + " to " + newState);
if (oldState == STATE_AUTH && newState != STATE_AUTH) {
// this isn't working in web.xml, so try setting it here
int oldIdle = httpSession.getMaxInactiveInterval();
httpSession.setMaxInactiveInterval(60*60*24); // seconds
int newIdle = httpSession.getMaxInactiveInterval();
Debug.debug(Debug.DEBUG, "Changed idle from " + oldIdle + " to " + newIdle);
}
if( sessionObject.state != STATE_AUTH )
processGenericButtons( sessionObject, request );
@@ -1315,9 +1334,12 @@ public class WebMail extends HttpServlet
*/
if( sessionObject.state == STATE_AUTH )
subtitle = _("Login");
else if( sessionObject.state == STATE_LIST )
subtitle = ngettext("1 Message", "{0} Messages", sessionObject.mailbox.getNumMails());
else if( sessionObject.state == STATE_SHOW )
else if( sessionObject.state == STATE_LIST ) {
// mailbox.getNumMails() forces a connection, don't use it
// Not only does it slow things down, but a failure causes all our messages to "vanish"
//subtitle = ngettext("1 Message", "{0} Messages", sessionObject.mailbox.getNumMails());
subtitle = ngettext("1 Message", "{0} Messages", sessionObject.folder.getSize());
} else if( sessionObject.state == STATE_SHOW )
subtitle = _("Show Message");
response.setContentType( "text/html" );
@@ -1359,7 +1381,8 @@ public class WebMail extends HttpServlet
else if( sessionObject.state == STATE_NEW )
showCompose( out, sessionObject, request );
out.println( "</form><div id=\"footer\"><hr><p class=\"footer\">susimail v0." + version +" " + ( RELEASE ? "release" : "development" ) + " &copy; 2004-2005 <a href=\"mailto:susi23@mail.i2p\">susi</a></div></div></body>\n</html>");
//out.println( "</form><div id=\"footer\"><hr><p class=\"footer\">susimail v0." + version +" " + ( RELEASE ? "release" : "development" ) + " &copy; 2004-2005 <a href=\"mailto:susi23@mail.i2p\">susi</a></div></div></body>\n</html>");
out.println( "</form><div id=\"footer\"><hr><p class=\"footer\">susimail &copy; 2004-2005 susi</div></div></body>\n</html>");
out.flush();
}
}
@@ -1582,9 +1605,9 @@ public class WebMail extends HttpServlet
out.println( button( SEND, _("Send") ) +
button( CANCEL, _("Cancel") ) + spacer +
(sessionObject.attachments != null && (!sessionObject.attachments.isEmpty()) ? button( DELETE_ATTACHMENT, _("Delete Attachment") ) : button2( DELETE_ATTACHMENT, _("Delete Attachment") ) ) + spacer);
if (Config.hasConfigFile())
out.println(button( RELOAD, _("Reload Config") ) + spacer);
out.println(button( LOGOUT, _("Logout") ) );
//if (Config.hasConfigFile())
// out.println(button( RELOAD, _("Reload Config") ) + spacer);
//out.println(button( LOGOUT, _("Logout") ) );
String from = request.getParameter( NEW_FROM );
String fixed = Config.getProperty( CONFIG_SENDER_FIXED, "true" );
@@ -1749,7 +1772,7 @@ public class WebMail extends HttpServlet
mail.part = new MailPart();
mail.part.parse( mail.body );
}
if( !RELEASE ) {
if(!RELEASE && mail != null && mail.body != null) {
out.println( "<!--" );
// FIXME encoding, escaping --, etc... but disabled.
out.println( quoteHTML( new String( mail.body.content, mail.body.offset, mail.body.length ) ) );
@@ -1763,18 +1786,18 @@ public class WebMail extends HttpServlet
( sessionObject.folder.isFirstElement( sessionObject.showUIDL ) ? button2( PREV, _("Previous") ) : button( PREV, _("Previous") ) ) +
( sessionObject.folder.isLastElement( sessionObject.showUIDL ) ? button2( NEXT, _("Next") ) : button( NEXT, _("Next") ) ) + spacer +
button( LIST, _("Back to Folder") ) + spacer);
if (Config.hasConfigFile())
out.println(button( RELOAD, _("Reload Config") ) + spacer);
out.println(button( LOGOUT, _("Logout") ) );
//if (Config.hasConfigFile())
// out.println(button( RELOAD, _("Reload Config") ) + spacer);
//out.println(button( LOGOUT, _("Logout") ) );
if( mail != null ) {
out.println( "<table cellspacing=\"0\" cellpadding=\"5\">\n" +
"<tr><td colspan=\"2\" align=\"center\"><hr></td></tr>\n" +
"<tr class=\"mailhead\"><td align=\"right\" valign=\"top\">" + _("From:") +
"</td><td align=\"left\">" + quoteHTML( mail.sender ) + "</td></tr>\n" +
"<tr class=\"mailhead\"><td align=\"right\" valign=\"top\">" + _("Date:") +
"</td><td align=\"left\">" + mail.quotedDate + "</td></tr>\n" +
"<tr class=\"mailhead\"><td align=\"right\" valign=\"top\">" + _("Subject:") +
"</td><td align=\"left\">" + quoteHTML( mail.formattedSubject ) + "</td></tr>\n" +
"<tr class=\"mailhead\"><td align=\"right\" valign=\"top\">" + _("Date:") +
"</td><td align=\"left\">" + mail.quotedDate + "</td></tr>\n" +
"<tr><td colspan=\"2\" align=\"center\"><hr></td></tr>" );
if( mail.body != null ) {
showPart( out, mail.part, 0, SHOW_HTML );

View File

@@ -164,60 +164,60 @@ form {
input.cancel, input.clearselection, input.logout {
background: #ddf url('/themes/console/images/cancel.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.delete, input.delete_attachment, input.really_delete {
background: #ddf url('/themes/console/images/delete.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.download, input.lastpage {
background: #ddf url('/themes/console/images/arrow_down.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.firstpage, input.list {
background: #ddf url('/themes/console/images/arrow_up.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
background: #ddf url('/themes/console/images/arrow_up.png') no-repeat 1px center;
padding: 2px 3px 2px 19px;
min-height: 22px;
}
input.forward, input.login, input.nextpage, input.send, input.next {
background: #ddf url('/themes/console/images/arrow_right.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.invertselection, input.reload, input.refresh {
background: #ddf url('/themes/console/images/arrow_refresh.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.markall, input.show {
background: #ddf url('/themes/console/images/tick.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.new, input.reply, input.replyall {
background: #ddf url('/themes/console/images/email.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
background: #ddf url('/themes/console/images/email.png') no-repeat 0px center;
padding: 2px 3px 2px 36px;
min-height: 22px;
}
input.prevpage, input.prev {
background: #ddf url('/themes/console/images/arrow_left.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}
input.send, input.setpagesize {
background: #ddf url('/themes/console/images/accept.png') no-repeat 4px center;
padding: 2px 3px 2px 21px;
padding: 2px 3px 2px 24px;
min-height: 22px;
}