// 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 . // // 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 , // 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; i0) { // 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);