mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Initial cut of IMAP support (disabled by default, to enable move imap sample files into extension folder)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14279 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -153,7 +153,7 @@ public class SubethaEmailMessage implements EmailMessage
|
||||
|
||||
try
|
||||
{
|
||||
subject = mimeMessage.getSubject();
|
||||
subject = encodeSubject(mimeMessage.getSubject());
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
@@ -373,7 +373,8 @@ public class SubethaEmailMessage implements EmailMessage
|
||||
|
||||
for (EmailMessagePart attachment : attachments)
|
||||
{
|
||||
if (attachment instanceof SubethaEmailMessagePart) {
|
||||
if (attachment instanceof SubethaEmailMessagePart)
|
||||
{
|
||||
((SubethaEmailMessagePart) attachment).setRmiRegistry(rmiRegistryHost, rmiRegistryPort);
|
||||
}
|
||||
}
|
||||
@@ -410,4 +411,24 @@ public class SubethaEmailMessage implements EmailMessage
|
||||
return attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces characters \/*|:"<>? on their hex values. Subject field is used as name of the content, so we need to replace characters that are forbidden in content names.
|
||||
*
|
||||
* @param subject String representing subject
|
||||
* @return Encoded string
|
||||
*/
|
||||
static private String encodeSubject(String subject)
|
||||
{
|
||||
String result = subject.trim();
|
||||
String[][] s = new String[][] { { "\\", "%5c" }, { "/", "%2f" }, { "*", "%2a" }, { "|", "%7c" }, { ":", "%3a" }, { "\"", "%22" }, { "<", "%3c" }, { ">", "%3e" },
|
||||
{ "?", "%3f" } };
|
||||
|
||||
for (int i = 0; i < s.length; i++)
|
||||
{
|
||||
result = result.replace(s[i][0], s[i][1]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user