*** empty log message ***

This commit is contained in:
Eric J. Bowersox
2002-02-11 03:34:15 +00:00
commit d80b3252a3
16 changed files with 1175 additions and 0 deletions

88
samples/mailgate.js Normal file
View File

@@ -0,0 +1,88 @@
// The contents of this file are subject to the Mozilla Public License Version 1.1
// (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
// WARRANTY OF ANY KIND, either express or implied. See the License for the specific
// language governing rights and limitations under the License.
//
// The Original Code is the Venice Web Communities System - Generic Mail Gateway.
//
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
// for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
// Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.org.apache.xmlrpc);
importPackage(Packages.com.silverwrist.mailgate);
// get the message to be posted
message = bsf.lookupBean("message");
// create an XML-RPC connection to a Venice server
rpc = lib.connectXMLRPC(lib.getConfigParam("url"),false);
// create a session
parms = lib.createVector();
sessionid = lib.castString(rpc.execute("venice:session.create",parms));
// log into the session
parms.add(sessionid);
parms.add(lib.getConfigParam("username"));
parms.add(lib.getConfigParam("password"));
rpc.execute("venice:session.login",parms);
// create the message text
text = "[From: " + message.sender + "]\r\n\r\n" + message.text;
// post the initial message!
parms.clear();
parms.add(sessionid);
parms.add(lib.getConfigParam("community"));
parms.add(lib.getConfigParam("conference"));
my_topic = lib.castInteger(lib.getConfigParam("topic"));
parms.add(my_topic);
parms.add(message.subject);
parms.add(lib.castString(text));
ndx = lib.castInteger(rpc.execute("venice:conferencing.topic.postMessage",parms));
if (message.hasAttachments())
{ // there are attachments - attach them to this message, and to other messages if necessary
for (i=0; i<message.attachmentCount; i++)
{ // post each attachment in turn
if (i>0)
{ // post a new message to attach the next attachment to
new_text = "[From: " + message.sender + "]\r\n\r\n[Attachments continued]";
parms.clear();
parms.add(sessionid);
parms.add(lib.getConfigParam("community"));
parms.add(lib.getConfigParam("conference"));
parms.add(my_topic);
parms.add(message.subject);
parms.add(lib.castString(new_text));
ndx = lib.castInteger(rpc.execute("venice:conferencing.topic.postMessage",parms));
} // end if
// get the attachment and add it
att = message.getAttachment(i);
parms.clear();
parms.add(sessionid);
parms.add(lib.getConfigParam("community"));
parms.add(lib.getConfigParam("conference"));
parms.add(my_topic);
parms.add(ndx);
parms.add(att.type);
parms.add(att.fileName);
parms.add(att.data);
rpc.execute("venice:conferencing.message.attach",parms);
} // end for
} // end if
// destroy the session to finish the operation
parms.clear();
parms.add(sessionid);
rpc.execute("venice:session.destroy",parms);

View File

@@ -0,0 +1,34 @@
# The contents of this file are subject to the Mozilla Public License Version 1.1
# (the "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
#
# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
# language governing rights and limitations under the License.
#
# The Original Code is the Venice Web Communities System - Generic Mail Gateway.
#
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
# Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
#
# Contributor(s):
# The script to be run by the gateway for each received message.
mailgate.script=mailgate.js
# Temporary directory for script engines.
mailgate.script.tmpdir=/tmp
# Configuration parameters
mailgate.script.config.url=http://delenn/venice/RPC2
mailgate.script.config.username=TestUser
mailgate.script.config.password=Fishmasters
mailgate.script.config.community=Piazza
mailgate.script.config.conference=General
mailgate.script.config.topic=1
# Properties used by the mail session object.
mail.transport.protocol=smtp
mail.smtp.host=localhost

3
samples/mailgate.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec java -cp "mailgate.jar:bsf.jar:js.jar:jacl.jar:tcljava.jar:xmlrpc.jar" \
com.silverwrist.mailgate.Main mailgate.properties