2001-06-18 08:57:33 +00:00
/ * *
* check if email - adress is syntactically correct
* /
2003-08-02 11:25:37 +00:00
function evalEmail ( address ) {
2001-06-18 08:57:33 +00:00
var m = new Mail ( ) ;
m . addTo ( address ) ;
2003-08-02 11:25:37 +00:00
if ( m . status != 0 )
throw new Exception ( "emailInvalid" ) ;
return address ;
2001-09-07 13:13:39 +00:00
}
2001-10-02 10:55:33 +00:00
/ * *
* function checks if url is correct
* if not it assumes that http is the protocol
* /
function evalURL ( url ) {
2003-10-06 09:44:36 +00:00
if ( ! url || url . contains ( "://" ) || url . contains ( "mailto:" ) )
return url ;
if ( url . contains ( "@" ) )
return "mailto:" + url ;
else
return "http://" + url ;
2001-10-07 19:27:48 +00:00
}
/ * *
* function checks if user has permanent cookies
* storing username and password
* /
function autoLogin ( ) {
2002-06-02 15:41:43 +00:00
if ( session . user )
2001-10-07 19:27:48 +00:00
return ;
var name = req . data . avUsr ;
var pw = req . data . avPw ;
if ( ! name || ! pw )
return ;
2002-06-02 15:41:43 +00:00
var u = root . users . get ( name ) ;
2001-10-07 19:27:48 +00:00
if ( ! u )
return ;
2003-08-02 11:25:37 +00:00
if ( ( u . password + req . data . http _remotehost ) . md5 ( ) != pw )
2001-10-07 19:27:48 +00:00
return ;
2003-08-02 11:25:37 +00:00
else if ( session . login ( name , u . password ) ) {
u . lastVisit = new Date ( ) ;
res . message = getMessage ( "confirm.welcome" , [ res . handlers . site ? res . handlers . site . title : root . getSysTitle ( ) , session . user . name ] ) ;
2001-10-07 19:27:48 +00:00
}
2003-08-02 11:25:37 +00:00
return ;
2001-10-21 12:02:20 +00:00
}
/ * *
2001-11-03 09:16:59 +00:00
* function checks if the name of the requested object has a slash in it
2002-06-26 16:56:08 +00:00
* if true , it tries to fetch the appropriate parent - object ( either site or root )
2001-11-03 09:16:59 +00:00
* and to fetch the object with the requested name in the specified collection
* @ param String Name of the object to retrieve
* @ param String Name of the pool to search in
* @ return Obj Object with two properties : one containing the parent - object of the pool ,
* the other containing the object itself ;
* If parent or object is null , the function returns null .
2001-10-21 12:02:20 +00:00
* /
2003-08-02 11:25:37 +00:00
function getPoolObj ( objName , pool ) {
2001-11-03 09:16:59 +00:00
var p = new Object ( ) ;
2003-08-02 11:25:37 +00:00
if ( objName . contains ( "/" ) ) {
2001-11-03 09:16:59 +00:00
var objPath = objName . split ( "/" ) ;
p . parent = ( ! objPath [ 0 ] || objPath [ 0 ] == "root" ) ? root : root . get ( objPath [ 0 ] ) ;
p . objName = objPath [ 1 ] ;
2001-10-21 12:02:20 +00:00
} else {
2002-12-02 16:32:15 +00:00
p . parent = res . handlers . site ;
2001-11-03 09:16:59 +00:00
p . objName = objName ;
2001-10-21 12:02:20 +00:00
}
2001-11-03 09:16:59 +00:00
if ( ! p . parent )
2001-10-21 12:02:20 +00:00
return null ;
2001-11-03 09:16:59 +00:00
p . obj = p . parent [ pool ] . get ( p . objName ) ;
if ( ! p . obj )
2001-10-21 12:02:20 +00:00
return null ;
2001-11-03 09:16:59 +00:00
return ( p ) ;
2001-10-30 13:00:47 +00:00
}
2001-12-19 16:22:34 +00:00
/ * *
* This is a simple logger that creates a DB entry for
2002-12-01 19:26:40 +00:00
* each request that contains an HTTP referrer .
* due to performance - reasons this is not written directly
* into database but instead written to app . data . accessLog ( = Vector )
* and written to database by the scheduler once a minute
2001-12-19 16:22:34 +00:00
* /
function logAccess ( ) {
2002-07-08 14:01:13 +00:00
if ( req . data . http _referer ) {
2002-12-02 16:32:15 +00:00
var site = res . handlers . site ? res . handlers . site : root ;
2002-07-08 14:01:13 +00:00
var referrer = req . data . http _referer ;
2002-04-25 13:43:45 +00:00
2002-06-26 16:56:08 +00:00
// no logging at all if the referrer comes from the same site
2002-04-26 13:05:10 +00:00
// or is not a http-request
2003-08-02 11:25:37 +00:00
if ( ! referrer . contains ( "http" ) )
2002-04-26 13:05:10 +00:00
return ;
2002-07-08 14:01:13 +00:00
var siteHref = site . href ( ) . toLowerCase ( ) ;
2003-08-02 11:25:37 +00:00
if ( referrer . toLowerCase ( ) . contains ( siteHref . substring ( 0 , siteHref . length - 1 ) ) )
2002-04-26 13:05:10 +00:00
return ;
2002-12-01 19:26:40 +00:00
var logObj = new Object ( ) ;
logObj . storyID = path . story ? path . story . _id : null ;
logObj . siteID = site . _id ;
logObj . referrer = referrer ;
logObj . remoteHost = req . data . http _remotehost ;
logObj . browser = req . data . http _browser ;
// log to app.data.accessLog
app . data . accessLog . add ( logObj ) ;
2002-07-08 14:01:13 +00:00
}
2002-12-01 19:26:40 +00:00
return ;
2001-12-19 16:22:34 +00:00
}
/ * *
2002-06-26 16:56:08 +00:00
* to register updates of a site at weblogs . com
2001-12-19 16:22:34 +00:00
* ( and probably other services , soon ) , this
* function can be called via the scheduler .
* /
2002-06-26 16:56:08 +00:00
function pingUpdatedSites ( ) {
2002-04-29 13:48:48 +00:00
var c = getDBConnection ( "antville" ) ;
2002-06-12 17:19:47 +00:00
var dbError = c . getLastError ( ) ;
if ( dbError ) {
2002-08-21 14:20:14 +00:00
app . log ( "Error establishing DB connection: " + dbError ) ;
2002-04-29 13:48:48 +00:00
return ;
}
2002-04-29 11:01:23 +00:00
2002-12-01 19:26:40 +00:00
var query = "select SITE_ALIAS from AV_SITE where SITE_ISONLINE = 1 and SITE_ENABLEPING = 1 and (SITE_LASTUPDATE > SITE_LASTPING or SITE_LASTPING is null)" ;
2002-04-29 13:48:48 +00:00
var rows = c . executeRetrieval ( query ) ;
2002-06-12 17:19:47 +00:00
var dbError = c . getLastError ( ) ;
if ( dbError ) {
2002-08-21 14:20:14 +00:00
app . log ( "Error executing SQL query: " + dbError ) ;
2002-04-29 13:48:48 +00:00
return ;
}
2002-04-29 11:01:23 +00:00
2002-04-29 13:48:48 +00:00
while ( rows . next ( ) ) {
2002-12-01 19:26:40 +00:00
var site = root . get ( rows . getColumnItem ( "SITE_ALIAS" ) ) ;
app . log ( "Notifying weblogs.com for updated site '" + site . alias + "' (id " + site . _id + ")" ) ;
2002-08-21 14:20:14 +00:00
site . ping ( ) ;
2002-04-29 13:48:48 +00:00
}
2002-04-29 11:01:23 +00:00
2002-04-29 13:48:48 +00:00
rows . release ( ) ;
return ;
2001-12-19 16:22:34 +00:00
}
2002-01-22 20:11:14 +00:00
2002-04-29 11:01:23 +00:00
2002-05-27 18:50:48 +00:00
/ * *
2002-06-26 16:56:08 +00:00
* function formats a date to a string . It checks if a site object is
2002-05-27 18:50:48 +00:00
* in the request path and if so uses its locale and timezone .
*
2002-12-01 19:26:40 +00:00
* @ param Object Date to be formatted
* @ param String The format string
* @ return String The date formatted as string
2002-05-27 18:50:48 +00:00
* /
2003-08-02 11:25:37 +00:00
function formatTimestamp ( ts , dformat ) {
var fmt ;
switch ( dformat ) {
case "short" :
fmt = res . handlers . site ?
res . handlers . site . preferences . getProperty ( "shortdateformat" ) :
root . shortdateformat ;
break ;
case "long" :
fmt = res . handlers . site ?
res . handlers . site . preferences . getProperty ( "longdateformat" ) :
root . longdateformat ;
break ;
default :
fmt = dformat ;
}
// if we still have no format pattern use a default one
if ( ! fmt )
var fmt = "yyyy-MM-dd HH:mm" ;
var handler = res . handlers . site ? res . handlers . site : root ;
try {
return ts . format ( fmt , handler . getLocale ( ) , handler . getTimeZone ( ) ) ;
} catch ( err ) {
return "[invalid format pattern]" ;
2002-05-27 18:50:48 +00:00
}
}
2002-04-29 11:01:23 +00:00
2002-01-22 20:11:14 +00:00
/ * *
2002-06-26 16:56:08 +00:00
* scheduler performing auto - disposal of inactive sites
* and auto - blocking of private sites
2002-03-27 11:08:30 +00:00
* /
function scheduler ( ) {
2002-06-26 16:56:08 +00:00
// call autocleanup
root . manage . autoCleanUp ( ) ;
// notify updated sites
pingUpdatedSites ( ) ;
2003-03-09 18:40:10 +00:00
// countUsers();
2002-12-01 19:26:40 +00:00
// write the log-entries in app.data.accessLog into DB
writeAccessLog ( ) ;
2002-12-08 13:47:34 +00:00
// store a timestamp in app.data indicating when last update
// of accessLog was finished
app . data . lastAccessLogUpdate = new Date ( ) ;
2002-12-01 19:26:40 +00:00
// store the readLog in app.data.readLog into DB
writeReadLog ( ) ;
2003-01-14 10:44:23 +00:00
return ( 30000 ) ;
2002-04-08 11:53:31 +00:00
}
2002-06-02 15:41:43 +00:00
2002-06-03 16:59:03 +00:00
/ * *
2003-08-02 11:25:37 +00:00
* constructor function for Message objects
* @ param String Name of the message
* @ param Obj String or Array of strings passed to message - skin
* @ param Obj Result Object ( optional )
2002-06-03 16:59:03 +00:00
* /
2003-08-02 11:25:37 +00:00
function Message ( name , value , obj ) {
this . name = name ;
this . value = value ;
this . obj = obj ;
this . toString = function ( ) {
return getMessage ( "confirm." + this . name , this . value ) ;
}
}
2002-06-03 16:59:03 +00:00
2003-08-02 11:25:37 +00:00
/ * *
* constructor function for Exception objects
* @ param String Name of the message
* @ param Obj String or Array of strings passed to message - skin
* /
function Exception ( name , value ) {
this . name = name ;
this . value = value ;
this . toString = function ( ) {
return getMessage ( "error." + this . name , this . value ) ;
}
2002-06-03 16:59:03 +00:00
}
2002-06-12 17:19:47 +00:00
/ * *
2003-08-02 11:25:37 +00:00
* constructor function for MailException objects
* @ param String Name of the message
2002-06-12 17:19:47 +00:00
* /
2003-08-02 11:25:37 +00:00
function MailException ( name ) {
this . name = name ;
this . toString = function ( ) {
return getMessage ( "error." + this . name ) ;
}
}
2002-06-12 17:19:47 +00:00
2003-09-07 21:03:12 +00:00
/ * *
* constructor function for DenyException objects
* @ param String Name of the message
* /
function DenyException ( name ) {
this . name = name ;
this . toString = function ( ) {
return getMessage ( "deny." + this . name ) ;
}
}
2003-08-02 11:25:37 +00:00
/ * *
* function retrieves a message from the message file
* of the appropriate language
* /
function getMessage ( property , value ) {
2002-06-12 17:19:47 +00:00
// create array containing languages to search for message
var languages = new Array ( ) ;
2003-08-02 11:25:37 +00:00
if ( res . handlers . site )
languages [ 0 ] = res . handlers . site . getLocale ( ) . getLanguage ( ) ;
2002-06-26 16:56:08 +00:00
languages [ languages . length ] = ( root . getLocale ( ) ) . getLanguage ( ) ;
// the last language to search for messages is always english
2003-08-02 11:25:37 +00:00
if ( "en" != languages [ languages . length - 1 ] )
languages [ languages . length ] = "en" ;
2002-06-12 17:19:47 +00:00
// loop over languages and try to find the message
for ( var i in languages ) {
var lang = app . data [ languages [ i ] ] ;
2003-08-02 11:25:37 +00:00
if ( lang && lang . getProperty ( property ) ) {
var source = lang . getProperty ( property ) ;
2002-06-12 17:19:47 +00:00
var param = new Object ( ) ;
2003-08-02 11:25:37 +00:00
// check if value passed is a string or an array
if ( value ) {
if ( value instanceof Array ) {
for ( var i in value )
param [ "value" + ( parseInt ( i , 10 ) + 1 ) ] = value [ i ] ;
} else
param . value1 = value ;
2002-06-12 17:19:47 +00:00
}
2003-08-02 11:25:37 +00:00
return ( renderSkinAsString ( createSkin ( source ) , param ) ) ;
2002-06-12 17:19:47 +00:00
}
}
// still no message found, so return
2003-08-02 11:25:37 +00:00
return "[couldn't find message!]" ;
2002-06-12 17:19:47 +00:00
}
/ * *
2003-08-02 11:25:37 +00:00
* function gets a MimePart passed as argument and
* constructs an object - alias based on the name of the uploaded file
* @ param Obj MimePart - Object
* @ param Obj Destination collection
2002-06-12 17:19:47 +00:00
* /
2003-08-02 11:25:37 +00:00
function buildAliasFromFile ( uploadFile , collection ) {
var rawName = uploadFile . getName ( ) . split ( "/" ) ;
var filename = rawName [ rawName . length - 1 ] ;
if ( filename . lastIndexOf ( "." ) > - 1 )
filename = filename . substring ( 0 , filename . lastIndexOf ( "." ) ) ;
return ( buildAlias ( filename , collection ) ) ;
2002-07-08 14:01:13 +00:00
}
2002-07-19 09:05:54 +00:00
/ * *
2003-08-02 11:25:37 +00:00
* function gets a String passed as argument and
* constructs an object - alias which is unique in
* a collection
* @ param String proposed alias for object
* @ param Obj Destination collection
2002-07-19 09:05:54 +00:00
* @ return String determined name
* /
2003-08-02 11:25:37 +00:00
function buildAlias ( alias , collection ) {
2002-07-19 09:05:54 +00:00
// clean name from any invalid characters
2003-08-02 11:25:37 +00:00
var newAlias = alias . toLowerCase ( ) . toFileName ( ) ;
if ( collection && collection . get ( newAlias ) ) {
// alias is already existing in collection, so we append a number
var nr = 1 ;
while ( collection . get ( newAlias + nr . toString ( ) ) )
nr ++ ;
return ( newAlias + nr . toString ( ) ) ;
} else
return ( newAlias ) ;
2002-08-09 11:48:03 +00:00
}
/ * *
* function loads messages on startup
* /
function onStart ( ) {
2003-03-07 19:27:48 +00:00
// load application messages and modules
2003-08-02 11:25:37 +00:00
var dir = FileLib . get ( app . dir ) ;
2002-08-09 11:48:03 +00:00
var arr = dir . list ( ) ;
for ( var i in arr ) {
2003-03-07 19:27:48 +00:00
var fname = arr [ i ] ;
2003-08-02 11:25:37 +00:00
if ( fname . startsWith ( "messages." ) ) {
var name = fname . substring ( fname . indexOf ( "." ) + 1 , fname . length ) ;
var msgFile = FileLib . get ( dir , fname ) ;
2002-08-09 11:48:03 +00:00
app . data [ name ] = new Packages . helma . util . SystemProperties ( msgFile . getAbsolutePath ( ) ) ;
app . log ( "loaded application messages (language: " + name + ")" ) ;
}
}
2002-08-19 16:42:33 +00:00
// load macro help file
2003-08-02 11:25:37 +00:00
var macroHelpFile = FileLib . get ( dir , "macro.help" ) ;
2002-08-19 16:42:33 +00:00
app . data . macros = new Packages . helma . util . SystemProperties ( macroHelpFile . getAbsolutePath ( ) ) ;
//eval(macroHelpFile.readAll());
app . log ( "loaded macro help file" ) ;
2002-12-01 19:26:40 +00:00
// creating the vector for referrer-logging
2003-02-06 14:16:46 +00:00
app . data . accessLog = new java . util . Vector ( ) ;
2002-12-01 19:26:40 +00:00
// creating the hashtable for storyread-counting
2003-02-06 14:16:46 +00:00
app . data . readLog = new java . util . Hashtable ( ) ;
2002-08-09 11:48:03 +00:00
return ;
}
2002-08-14 09:22:49 +00:00
2002-08-14 17:33:47 +00:00
/ * *
* This function parses a string for < img > tags and turns them
* into < a > tags .
* /
function fixRssText ( str ) {
2003-07-08 14:53:57 +00:00
var re = new RegExp ( "<img src\\s*=\\s*\"?([^\\s\"]+)?\"?[^>]*?(alt\\s*=\\s*\"?([^\"]+)?\"?[^>]*?)?>" , "gi" ) ;
2002-08-14 17:33:47 +00:00
str = str . replace ( re , "[<a href=\"$1\" title=\"$3\">Image</a>]" ) ;
2003-07-08 14:53:57 +00:00
return str ;
2002-08-14 17:33:47 +00:00
}
2002-08-23 15:46:58 +00:00
/ * *
* function counting active users and anonymous sessions
* ( thought to be called by the scheduler )
* /
function countUsers ( ) {
2002-12-01 19:26:40 +00:00
app . data . activeUsers = new Array ( ) ;
2002-08-23 15:46:58 +00:00
var l = app . getActiveUsers ( ) ;
for ( var i in l )
app . data . activeUsers [ app . data . activeUsers . length ] = l [ i ] ;
l = app . getSessions ( ) ;
app . data . sessions = 0 ;
for ( var i in l ) {
if ( ! l [ i ] . user )
app . data . sessions ++ ;
}
app . data . activeUsers . sort ( ) ;
}
2002-12-01 19:26:40 +00:00
/ * *
* function swaps app . data . accessLog , loops over the objects
* contained in Vector and inserts records for every log - entry
* in AV _ACCESSLOG
* /
function writeAccessLog ( ) {
if ( app . data . accessLog . size ( ) == 0 )
return ;
// first of all swap app.data.accessLog
var size = app . data . accessLog . size ( ) ;
var log = app . data . accessLog ;
2003-02-06 14:16:46 +00:00
app . data . accessLog = new java . util . Vector ( size ) ;
2002-12-01 19:26:40 +00:00
// open database-connection
var c = getDBConnection ( "antville" ) ;
var dbError = c . getLastError ( ) ;
if ( dbError ) {
app . log ( "Error establishing DB connection: " + dbError ) ;
return ;
}
// loop over log-vector
var query ;
for ( var i = 0 ; i < log . size ( ) ; i ++ ) {
var logObj = log . get ( i ) ;
query = "insert into AV_ACCESSLOG (ACCESSLOG_F_SITE,ACCESSLOG_F_TEXT," +
"ACCESSLOG_REFERRER,ACCESSLOG_IP,ACCESSLOG_BROWSER) values (" +
logObj . siteID + "," + logObj . storyID + ",'" + logObj . referrer + "','" + logObj . remoteHost +
"','" + logObj . browser + "')" ;
c . executeCommand ( query ) ;
if ( dbError ) {
app . log ( "Error executing SQL query: " + dbError ) ;
return ;
}
}
app . log ( "wrote " + i + " referrers into database" ) ;
return ;
}
/ * *
* function swaps app . data . readLog , loops over the logObjects
* contained in the Hashtable and updates the read - counter
* of all stories
* /
function writeReadLog ( ) {
if ( app . data . readLog . size ( ) == 0 )
return ;
// first of all swap app.data.readLog
var size = app . data . readLog . size ( ) ;
var log = app . data . readLog ;
2003-02-06 14:16:46 +00:00
app . data . readLog = new java . util . Hashtable ( size ) ;
2002-12-01 19:26:40 +00:00
// loop over Hashtable
var reads = log . elements ( ) ;
while ( reads . hasMoreElements ( ) ) {
var el = reads . nextElement ( ) ;
2003-02-06 14:16:46 +00:00
var story = root . storiesByID . get ( String ( el . story ) ) ;
2002-12-01 19:26:40 +00:00
if ( ! story )
continue ;
story . reads = el . reads ;
}
app . log ( "updated read-counter of " + log . size ( ) + " stories in database" ) ;
return ;
}
/ * *
* rescue story / comment by copying all necessary properties to
* session . data . rescuedText . this will be copied back to
* req . data by restoreRescuedText ( ) after successful login
* @ param Object req . data
* /
function rescueText ( param ) {
session . data . rescuedText = new Object ( ) ;
for ( var i in param ) {
2003-08-02 11:25:37 +00:00
if ( i . startsWith ( "content_" ) )
2002-12-01 19:26:40 +00:00
session . data . rescuedText [ i ] = param [ i ] ;
}
session . data . rescuedText . discussions = param . discussions ;
session . data . rescuedText . topic = param . topic ;
session . data . rescuedText . discussions _array = param . discussions _array ;
session . data . rescuedText . topicidx = param . topicidx ;
session . data . rescuedText . online = param . online ;
session . data . rescuedText . editableby = param . editableby ;
session . data . rescuedText . createtime = param . createtime ;
return ;
}
/ * *
* restore rescued Text in session . data by copying
* all properties back to req . data
* /
function restoreRescuedText ( ) {
// copy story-parameters back to req.data
for ( var i in session . data . rescuedText )
req . data [ i ] = session . data . rescuedText [ i ] ;
session . data . rescuedText = null ;
return ;
2003-02-06 14:16:46 +00:00
}
2003-02-11 16:59:12 +00:00
2003-08-02 11:25:37 +00:00
/ * *
* function returns the level of the membership in cleartext
* according to passed level
* /
function getRole ( lvl ) {
switch ( parseInt ( lvl , 10 ) ) {
case CONTRIBUTOR :
return "Contributor" ;
break ;
case CONTENTMANAGER :
return "Content Manager" ;
break ;
case ADMIN :
return "Administrator" ;
break ;
default :
return "Subscriber" ;
}
}
2003-02-11 16:59:12 +00:00
/ * *
2003-08-02 11:25:37 +00:00
* extract content properties from the object containing
* the submitted form values ( req . data )
* @ param Obj Parameter object ( usually req . data )
* @ param Obj HopObject containing any already existing content
* @ return Obj JS object containing the following properties :
* . value : HopObject ( ) containing extracted content
* . exists : Boolean true in case content was found
* . isMajorUpdate : Boolean true in case one content property
* differs for more than 50 characters
2003-02-11 16:59:12 +00:00
* /
2003-08-02 11:25:37 +00:00
function extractContent ( param , origContent ) {
var result = { isMajorUpdate : false , exists : false , value : new HopObject ( ) } ;
for ( var i in param ) {
if ( i . startsWith ( "content_" ) ) {
var partName = i . substring ( 8 ) ;
var newContentPart = param [ i ] . trim ( ) ;
// check if there's a difference between old and
// new text of more than 50 characters:
if ( ! result . isMajorUpdate && origContent ) {
var len1 = origContent [ partName ] ? origContent [ partName ] . length : 0 ;
var len2 = newContentPart . length ;
result . isMajorUpdate = Math . abs ( len1 - len2 ) >= 50 ;
}
result . value [ partName ] = newContentPart ;
if ( newContentPart )
result . exists = true ;
}
}
return result ;
}
2003-02-11 16:59:12 +00:00
2003-08-02 11:25:37 +00:00
/ * *
* general mail - sending function
* @ param String sending email address
* @ param Obj String or Array of Strings containing recipient email addresses
* @ param String subject line
* @ param String Body to use in email
* @ return Obj Message object
* /
function sendMail ( from , to , subject , body ) {
if ( ! from || ! to || ! body )
throw new MailException ( "mailMissingParameters" ) ;
var mail = new Mail ( ) ;
mail . setFrom ( from ? from : root . sys _email ) ;
if ( to && to instanceof Array ) {
for ( var i in to )
mail . addTo ( to [ i ] ) ;
} else
mail . addTo ( to ) ;
mail . setSubject ( subject ) ;
mail . setText ( body ) ;
switch ( mail . status ) {
case 10 :
throw new MailException ( "mailSubjectMissing" ) ;
break ;
case 11 :
throw new MailException ( "mailTextMissing" ) ;
break ;
case 12 :
throw new MailException ( "mailPartMissing" ) ;
break ;
case 20 :
throw new MailException ( "mailToInvalid" ) ;
break ;
case 21 :
throw new MailException ( "mailCCInvalid" ) ;
break ;
case 22 :
throw new MailException ( "mailCCInvalid" ) ;
break ;
case 30 :
throw new MailException ( "mailSend" ) ;
break ;
}
// finally send the mail
mail . send ( ) ;
if ( mail . status != 0 )
throw new MailException ( "mailSend" ) ;
return new Message ( "mailSend" ) ;
2003-02-11 16:59:12 +00:00
}