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:
Gavin Cornwell
2009-05-12 13:41:08 +00:00
parent 1a5d0fa8e6
commit 3cc38f4289
49 changed files with 6250 additions and 111 deletions

View File

@@ -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;
}
}