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

@@ -0,0 +1,77 @@
<import resource="/Company Home/Data Dictionary/Scripts/command-utils.js">
function processCommand()
{
var isEmailed = document.hasAspect("emailserver:emailed");
logger.log("Command Processor: isEmailed=" + isEmailed);
if (isEmailed)
{
// Delete email attachments
var attachments = document.assocs["attachments"];
if (attachments != null)
{
for (var i = 0; i < attachments.length; i++)
{
attachments[i].remove();
}
}
var command = document.properties["cm:title"];
logger.log("Command Processor: command=" + command);
var parts = new Array();
var str = command;
var i = 0;
while (true)
{
var index = str.indexOf("-");
if (index == -1)
{
parts[i] = str;
break;
}
parts[i] = str.substring(0, index);
str = str.substr(index + 1);
i++;
}
// do-<commandName>-<arg1>-...-<argN>
if (parts.length < 3 || parts[0].toLowerCase() != "do")
{
var message = "Unknown command: " + command;
logger.log(message);
createEmail(message, message, message, false);
return;
}
var commandName = parts[1].toLowerCase();
var commandFolder = space.childByNamePath(commandName);
logger.log("Found '" + commandName + "' command folder: '" + commandFolder + "'");
if (commandFolder == null)
{
var message = "Command Processor: wrong command=" + command;
createEmail(message, message, message, false);
logger.log(message);
return;
}
document.move(commandFolder);
}
}
processCommand();