Hidding attachment implemented

This commit is contained in:
2024-11-12 13:16:38 +05:30
parent 9cf823b469
commit 4a68f7f2f5
3 changed files with 24 additions and 14 deletions

12
pom.xml
View File

@@ -103,33 +103,33 @@
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId> <artifactId>javafx-controls</artifactId>
<version>23</version> <!-- Adjust this version based on your setup --> <version>23.0.1</version> <!-- Adjust this version based on your setup -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId> <artifactId>javafx-fxml</artifactId>
<version>23</version> <version>23.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId> <artifactId>javafx-graphics</artifactId>
<version>23</version> <version>23.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId> <artifactId>javafx-media</artifactId>
<version>23</version> <version>23.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId> <artifactId>javafx-swing</artifactId>
<version>23</version> <version>23.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId> <artifactId>javafx-web</artifactId>
<version>23</version> <version>23.0.1</version>
</dependency> </dependency>
<!-- JavaMail Dependency --> <!-- JavaMail Dependency -->

View File

@@ -77,8 +77,12 @@ public class MessageRendererService extends Service<Object>{
// Check if it is an attachment // Check if it is an attachment
String disposition = bodyPart.getDisposition(); String disposition = bodyPart.getDisposition();
if (disposition != null && disposition.equalsIgnoreCase(Part.ATTACHMENT) ) { if (disposition != null && disposition.equalsIgnoreCase(Part.ATTACHMENT) ) {
if( emailMessage.getIsAuthenticated()) {
MimeBodyPart mbp = (MimeBodyPart) bodyPart; MimeBodyPart mbp = (MimeBodyPart) bodyPart;
if (!emailMessage.isAttachmentLoaded())emailMessage.addAttachment(mbp); if (!emailMessage.isAttachmentLoaded())emailMessage.addAttachment(mbp);
}
} else if (isSimpleType(contentType)) { } else if (isSimpleType(contentType)) {
if( emailMessage.getIsAuthenticated() ) { if( emailMessage.getIsAuthenticated() ) {
@@ -89,16 +93,18 @@ public class MessageRendererService extends Service<Object>{
} }
} else if (isMultipartType(contentType)){ } else if (isMultipartType(contentType)){
Multipart multipart2 = (Multipart) bodyPart.getContent(); Multipart multipart2 = (Multipart) bodyPart.getContent();
loadMultipart(multipart2,stringBuffer); loadMultipart(multipart2,stringBuffer);
// } else if (!isTextPlain(contentType)) { // } else if (!isTextPlain(contentType)) {
} }
} }
} }
private boolean isTextPlain(String contentType) { // private boolean isTextPlain(String contentType) {
return contentType.contains("TEXT/PLAIN"); // return contentType.contains("TEXT/PLAIN");
} // }
private boolean isSimpleType(String contentType) { private boolean isSimpleType(String contentType) {
if(contentType.contains("TEXT/HTML") || if(contentType.contains("TEXT/HTML") ||

View File

@@ -277,9 +277,13 @@ public class MainWindowController extends BaseController implements Initializabl
sKey = SecretCodeDAO.getSecretCode(fromEmailId); sKey = SecretCodeDAO.getSecretCode(fromEmailId);
} catch (SQLException e) { } catch (SQLException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
if( sKey == null || sKey.isEmpty() ) {
showAlert("Missing Secret Key","Register Secret Key for "+fromEmailId);
}
String emlHash = generateEmlHash(emailMessage.getMessage(),StringToSecretKey.stringToSecretKey(sKey)); String emlHash = generateEmlHash(emailMessage.getMessage(),StringToSecretKey.stringToSecretKey(sKey));
// String emlHash = Integer.toString(emailMessage.getMessage().hashCode()); // String emlHash = Integer.toString(emailMessage.getMessage().hashCode());
@@ -705,9 +709,9 @@ public class MainWindowController extends BaseController implements Initializabl
else return false; else return false;
} }
private boolean isTextPlain(String contentType) { // private boolean isTextPlain(String contentType) {
return contentType.contains("TEXT/PLAIN"); // return contentType.contains("TEXT/PLAIN");
} // }
private boolean isSimpleType(String contentType) { private boolean isSimpleType(String contentType) {
if(contentType.contains("TEXT/HTML") || if(contentType.contains("TEXT/HTML") ||