forked from I2P_Developers/i2p.i2p
* SusiMail:
- Different colors for new mail and spam
This commit is contained in:
@@ -69,6 +69,7 @@ class Mail {
|
||||
private ReadBuffer header, body;
|
||||
private MailPart part;
|
||||
String[] to, cc; // addresses only, enclosed by <>
|
||||
private boolean isNew, isSpam;
|
||||
|
||||
public String error;
|
||||
|
||||
@@ -141,6 +142,18 @@ class Mail {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public boolean isSpam() {
|
||||
return isSpam;
|
||||
}
|
||||
|
||||
public boolean isNew() {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public void setNew(boolean isNew) {
|
||||
this.isNew = isNew;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param address E-mail address to be validated
|
||||
@@ -332,6 +345,9 @@ class Mail {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
getRecipientsFromList( list, line.substring( 3 ).trim(), true );
|
||||
cc = list.toArray(new String[list.size()]);
|
||||
} else if(line.equals( "X-Spam-Flag: YES" )) {
|
||||
// TODO trust.spam.headers config
|
||||
isSpam = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -227,6 +227,8 @@ class MailCache {
|
||||
ReadBuffer rb = pr.buf;
|
||||
if (rb != null) {
|
||||
Mail mail = pr.mail;
|
||||
if (!mail.hasHeader())
|
||||
mail.setNew(true);
|
||||
if (pr.getHeaderOnly()) {
|
||||
mail.setHeader(rb);
|
||||
} else {
|
||||
|
@@ -1916,9 +1916,18 @@ public class WebMail extends HttpServlet
|
||||
for( Iterator<String> it = sessionObject.folder.currentPageIterator(); it != null && it.hasNext(); ) {
|
||||
String uidl = it.next();
|
||||
Mail mail = sessionObject.mailCache.getMail( uidl, MailCache.FETCH_HEADER );
|
||||
if (mail == null)
|
||||
if (mail == null) {
|
||||
i++;
|
||||
continue;
|
||||
String link = "<a href=\"" + myself + "?" + SHOW + "=" + i + "\">";
|
||||
}
|
||||
String type;
|
||||
if (mail.isSpam())
|
||||
type = "linkspam";
|
||||
else if (mail.isNew())
|
||||
type = "linknew";
|
||||
else
|
||||
type = "linkold";
|
||||
String link = "<a href=\"" + myself + "?" + SHOW + "=" + i + "\" class=\"" + type + "\">";
|
||||
|
||||
boolean idChecked = false;
|
||||
String checkId = sessionObject.pageChanged ? null : request.getParameter( "check" + i );
|
||||
@@ -2001,6 +2010,7 @@ public class WebMail extends HttpServlet
|
||||
":</td><td align=\"left\">" + mail.quotedDate + "</td></tr>\n" +
|
||||
"<tr><td colspan=\"2\" align=\"center\"><hr></td></tr>" );
|
||||
if( mail.hasPart()) {
|
||||
mail.setNew(false);
|
||||
showPart( out, mail.getPart(), 0, SHOW_HTML );
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user