mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-23 15:33:43 +00:00
Fixes and optimzations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@21054 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f2d2a684ab
commit
c923bad765
13 changed files with 238 additions and 97 deletions
33
ChangeLog
33
ChangeLog
|
@ -1,3 +1,36 @@
|
|||
2005-04-05 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb.framework/GSWActiveImage.m:
|
||||
o avoid string formatting
|
||||
* GSWeb.framework/GSWImageButton.m:
|
||||
o avoid string formatting
|
||||
* GSWeb.framework/GSWForm.m:
|
||||
o avoid string formatting
|
||||
o fix https bug in -_appendCGIActionToResponse:inContext:
|
||||
* GSWeb.framework/GSWGenericContainer.m:
|
||||
o avoid string formatting
|
||||
* GSWeb.framework/GSWHTMLDynamicElement.m:
|
||||
o avoid string formatting
|
||||
o IMPs optimizations
|
||||
* GSWeb.framework/GSWMailDelivery.m:
|
||||
o avoid string formatting
|
||||
* GSWeb.framework/GSWComponent.h:
|
||||
o added -logString:
|
||||
* GSWeb.framework/GSWComponent.m:
|
||||
o added -logString:
|
||||
o implemented -logWithFormat:
|
||||
o implemented -logWithFormat:arguments:
|
||||
o implemented +logWithFormat:
|
||||
* GSWeb.framework/GSWDefaultAdaptor.m:
|
||||
o removed -logWithFormat: and +logWithFormat:
|
||||
o added -workerThreadCount and -setWorkerThreadCount:
|
||||
o replaced -statusLogWithFormat: calls by -statusLogString: calls
|
||||
* GSWeb.framework/GSWDefaultAdaptor.h:
|
||||
o removed -logWithFormat: and +logWithFormat:
|
||||
* GSWeb.framework/GSWDefaultAdaptorThread.m:
|
||||
o replaced -statusLogWithFormat: calls by -statusLogString: calls
|
||||
* GSWeb.framework/GSWMultiKeyDictionary.m:
|
||||
o better logs
|
||||
|
||||
2005-04-05 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb.framework/GSWContext.m:
|
||||
o add contextAndElementID caching and optimizations
|
||||
|
|
|
@ -253,10 +253,8 @@ RCS_ID("$Id$")
|
|||
if (wasFormSubmitted)
|
||||
{
|
||||
NSString* nameInContext=[self nameInContext:aContext];
|
||||
NSString* formValueX=[request formValueForKey:[NSString stringWithFormat:@"%@.x",
|
||||
nameInContext]];
|
||||
NSString* formValueY=[request formValueForKey:[NSString stringWithFormat:@"%@.y",
|
||||
nameInContext]];
|
||||
NSString* formValueX=[request formValueForKey:[nameInContext stringByAppendingString:@".x"]];
|
||||
NSString* formValueY=[request formValueForKey:[nameInContext stringByAppendingString:@".y"]];
|
||||
NSDebugMLLog(@"gswdync",@"formValueX=%@",formValueX);
|
||||
NSDebugMLLog(@"gswdync",@"formValueY=%@",formValueY);
|
||||
if (formValueX && formValueY)
|
||||
|
|
|
@ -214,6 +214,7 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
keyPath:(id)_keyPath;
|
||||
-(void)_debugWithString:(NSString*)string;
|
||||
-(void)debugWithFormat:(NSString*)format,...;
|
||||
-(void)logString:(NSString*)aString;
|
||||
-(void)logWithFormat:(NSString*)format,...;
|
||||
-(void)logWithFormat:(NSString*)format
|
||||
arguments:(va_list)argList;
|
||||
|
|
|
@ -219,21 +219,35 @@ RCS_ID("$Id$")
|
|||
return aFrameworkName;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// logString:
|
||||
|
||||
-(void)logString:(NSString*)aString
|
||||
{
|
||||
[[self application] logString:aString];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// logWithFormat:
|
||||
|
||||
-(void)logWithFormat:(NSString*)format,...
|
||||
-(void)logWithFormat:(NSString*)aFormat,...
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
va_list ap;
|
||||
va_start(ap,aFormat);
|
||||
[self logWithFormat:aFormat
|
||||
arguments:ap];
|
||||
va_end(ap);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// logWithFormat:arguments:
|
||||
|
||||
-(void)logWithFormat:(NSString*)format
|
||||
-(void)logWithFormat:(NSString*)aFormat
|
||||
arguments:(va_list)arguments
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
NSString* string=[NSString stringWithFormat:aFormat
|
||||
arguments:arguments];
|
||||
[self logString:string];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1571,28 +1585,44 @@ associationsKeys:(NSArray*)associationsKeys
|
|||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)debugWithFormat:(NSString*)format,...
|
||||
-(void)debugWithFormat:(NSString*)aFormat,...
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)logWithFormat:(NSString*)format,...
|
||||
-(void)logWithFormat:(NSString*)aFormat,...
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
va_list ap;
|
||||
va_start(ap,aFormat);
|
||||
[self logWithFormat:aFormat
|
||||
arguments:ap];
|
||||
va_end(ap);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)logWithFormat:(NSString*)format
|
||||
arguments:(va_list)argList
|
||||
-(void)logWithFormat:(NSString*)aFormat
|
||||
arguments:(va_list)arguments
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
NSString* string=[NSString stringWithFormat:aFormat
|
||||
arguments:arguments];
|
||||
[self logString:string];
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(void)logWithFormat:(NSString*)format,...
|
||||
+(void)logWithFormat:(NSString*)aFormat,...
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
va_list ap;
|
||||
va_start(ap,aFormat);
|
||||
[[GSWApplication application] logWithFormat:aFormat
|
||||
arguments:ap];
|
||||
va_end(ap);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)logString:(NSString*)aString
|
||||
{
|
||||
[[self application] logString:aString];
|
||||
};
|
||||
|
||||
@end
|
||||
|
|
|
@ -55,9 +55,6 @@ GSWEB_EXPORT int iBlock;
|
|||
-(void)registerForEvents;
|
||||
-(void)unregisterForEvents;
|
||||
|
||||
-(void)logWithFormat:(NSString*)format,...;
|
||||
+(void)logWithFormat:(NSString*)format,...;
|
||||
|
||||
-(void)runOnce;
|
||||
-(BOOL)doesBusyRunOnce;
|
||||
-(BOOL)dispatchesRequestsConcurrently;
|
||||
|
|
|
@ -155,18 +155,6 @@ int allow_severity = LOG_INFO;
|
|||
DESTROY(_fileHandle);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)logWithFormat:(NSString*)format,...
|
||||
{
|
||||
LOGObjectFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
+(void)logWithFormat:(NSString*)format,...
|
||||
{
|
||||
LOGClassFnNotImplemented(); //TODOFN
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)runOnce
|
||||
{
|
||||
|
@ -201,6 +189,36 @@ int allow_severity = LOG_INFO;
|
|||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(id)workerThreadCount
|
||||
{
|
||||
return GSWIntNumber(_workerThreadCount);
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setWorkerThreadCount:(id)workerThreadCount
|
||||
{
|
||||
if ([self tryLock])
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
_workerThreadCount=[workerThreadCount intValue];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
LOGException(@"%@ (%@)",
|
||||
localException,
|
||||
[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
[self unlock];
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO
|
||||
};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(void)setWorkerThreadCountMin:(id)workerThreadCount
|
||||
{
|
||||
|
@ -457,7 +475,7 @@ int allow_severity = LOG_INFO;
|
|||
}
|
||||
else
|
||||
{
|
||||
[GSWApplication statusLogWithFormat:@"Set Thread to wait"];
|
||||
[GSWApplication statusLogString:@"Set Thread to wait"];
|
||||
NSDebugLockMLLog(@"info",
|
||||
@"Set Thread to wait %p",
|
||||
(void*)newThread);
|
||||
|
@ -654,7 +672,7 @@ int allow_severity = LOG_INFO;
|
|||
#ifndef NDEBUG
|
||||
pool=[NSAutoreleasePool new];
|
||||
GSWLogMemCF("New NSAutoreleasePool: %p",pool);
|
||||
[GSWApplication statusLogWithFormat:@"Lauch waiting Thread"];
|
||||
[GSWApplication statusLogString:@"Lauch waiting Thread"];
|
||||
NSDebugLockMLLog(@"info",
|
||||
@"Lauch waiting Thread %p",
|
||||
(void*)thread);
|
||||
|
|
|
@ -137,7 +137,7 @@ static NSData* lineFeedData=nil;
|
|||
_pool=[NSAutoreleasePool new];
|
||||
GSWLogMemCF("New NSAutoreleasePool: %p",_pool);
|
||||
#ifdef GSWDEBUG_DEEP
|
||||
[GSWApplication logWithFormat:@"pool allocated!"];
|
||||
[GSWApplication logString:@"pool allocated!"];
|
||||
#endif
|
||||
|
||||
_runTS=GSWTime_now();
|
||||
|
@ -146,7 +146,7 @@ static NSData* lineFeedData=nil;
|
|||
_sendResponseTS=GSWTime_zero();
|
||||
|
||||
#ifdef GSWDEBUG_DEEP
|
||||
[GSWApplication statusLogWithFormat:@"Thread run START"];
|
||||
[GSWApplication statusLogString:@"Thread run START"];
|
||||
#endif
|
||||
if (_isMultiThread)
|
||||
{
|
||||
|
@ -256,11 +256,11 @@ static NSData* lineFeedData=nil;
|
|||
_application);
|
||||
LOGObjectFnStop();
|
||||
#ifdef DEBUG
|
||||
[GSWApplication statusLogWithFormat:@"threadWillExit START"];
|
||||
[GSWApplication statusLogString:@"threadWillExit START"];
|
||||
#endif
|
||||
[_application threadWillExit];
|
||||
#ifdef DEBUG
|
||||
[GSWApplication statusLogWithFormat:@"threadWillExit STOP"];
|
||||
[GSWApplication statusLogString:@"threadWillExit STOP"];
|
||||
#endif
|
||||
if (_isMultiThread)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ static NSData* lineFeedData=nil;
|
|||
else
|
||||
[self threadExited];
|
||||
#ifdef DEBUG
|
||||
[GSWApplication statusLogWithFormat:@"run STOP"];
|
||||
[GSWApplication statusLogString:@"run STOP"];
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -785,7 +785,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
localException,[localException reason]);
|
||||
NSDebugMLog(@"EXCEPTION GSWDefaultAdaptorThread: sendResponse Exception:%@ (%@)",
|
||||
localException,[localException reason]);
|
||||
[GSWApplication statusLogWithFormat:@"\nException while sending response\n"];
|
||||
[GSWApplication statusLogString:@"\nException while sending response\n"];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
|
||||
|
@ -813,7 +813,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
NS_DURING
|
||||
{
|
||||
[aStream writeData:responseData];
|
||||
[GSWApplication statusLogWithFormat:@"\nResponse Sent\n"];
|
||||
[GSWApplication statusLogString:@"\nResponse Sent\n"];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ withAdditionalHeaderLines:(NSArray*)addHeaders
|
|||
localException,[localException reason]);
|
||||
NSDebugMLog(@"EXCEPTION GSWDefaultAdaptorThread: sendResponse Exception:%@ (%@)",
|
||||
localException,[localException reason]);
|
||||
[GSWApplication statusLogWithFormat:@"\nException while sending response\n"];
|
||||
[GSWApplication statusLogString:@"\nException while sending response\n"];
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
NSDebugDeepMLLog0(@"info",@"Response content Written");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** GSWForm.m - <title>GSWeb: Class GSWForm</title>
|
||||
|
||||
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Jan 1999
|
||||
|
@ -564,8 +564,13 @@ static Class standardClass = Nil;
|
|||
id fragment=[_fragmentIdentifier valueInComponent:component];
|
||||
NSDebugMLLog(@"gswdync",@"fragment=%@",fragment);
|
||||
if (fragment)
|
||||
actionValue=[NSString stringWithFormat:@"%@#%@",
|
||||
actionValue,fragment];
|
||||
{
|
||||
if (actionValue)
|
||||
actionValue=[NSStringWithObject(actionValue) stringByAppendingString:@"#"];
|
||||
else
|
||||
actionValue=@"#";
|
||||
actionValue=[actionValue stringByAppendingString:NSStringWithObject(fragment)];
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"actionValue=%@",actionValue);
|
||||
//TODO emit a warning !
|
||||
|
@ -612,8 +617,7 @@ static Class standardClass = Nil;
|
|||
NSDebugMLLog(@"gswdync",@"actionString=%@",actionString);
|
||||
|
||||
anUrl=(NSString*)[aContext directActionURLForActionNamed:actionString
|
||||
queryDictionary:nil
|
||||
isSecure:NO];
|
||||
queryDictionary:nil];
|
||||
NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl);
|
||||
|
||||
if (_fragmentIdentifier)
|
||||
|
@ -621,8 +625,13 @@ static Class standardClass = Nil;
|
|||
id fragment=[_fragmentIdentifier valueInComponent:GSWContext_component(aContext)];
|
||||
NSDebugMLLog(@"gswdync",@"fragment=%@",fragment);
|
||||
if (fragment)
|
||||
anUrl=[NSString stringWithFormat:@"%@#%@",
|
||||
anUrl,fragment];
|
||||
{
|
||||
if (anUrl)
|
||||
anUrl=[NSStringWithObject(anUrl) stringByAppendingString:@"#"];
|
||||
else
|
||||
anUrl=@"#";
|
||||
anUrl=[anUrl stringByAppendingString:NSStringWithObject(fragment)];
|
||||
};
|
||||
};
|
||||
NSDebugMLLog(@"gswdync",@"anUrl=%@",anUrl);
|
||||
|
||||
|
|
|
@ -131,12 +131,14 @@ RCS_ID("$Id$")
|
|||
assocEnumer = [_associations keyEnumerator];
|
||||
while ((currentAssocKey = [assocEnumer nextObject]))
|
||||
{
|
||||
theValue = [[_associations objectForKey:currentAssocKey]
|
||||
valueInComponent:component];
|
||||
theValue = NSStringWithObject([[_associations objectForKey:currentAssocKey]
|
||||
valueInComponent:component]);
|
||||
|
||||
GSWResponse_appendContentString(aResponse,
|
||||
([NSString stringWithFormat:@" %@=\"%@\"",
|
||||
currentAssocKey,theValue]));
|
||||
GSWResponse_appendContentCharacter(aResponse,' ');
|
||||
GSWResponse_appendContentString(aResponse,currentAssocKey);
|
||||
GSWResponse_appendContentAsciiString(aResponse,@"=\"");
|
||||
GSWResponse_appendContentString(aResponse,theValue);
|
||||
GSWResponse_appendContentCharacter(aResponse,'"');
|
||||
}
|
||||
|
||||
GSWResponse_appendContentCharacter(aResponse,'>');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** GSWHTMLDynamicElement.m - <title>GSWeb: Class GSWHTMLDynamicElement</title>
|
||||
|
||||
Copyright (C) 1999-2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Feb 1999
|
||||
|
@ -35,6 +35,7 @@
|
|||
RCS_ID("$Id$")
|
||||
|
||||
#include "GSWeb.h"
|
||||
#include "GSWPrivate.h"
|
||||
|
||||
static SEL objectAtIndexSEL = NULL;
|
||||
|
||||
|
@ -808,29 +809,39 @@ attributeAssociations:(NSDictionary*)attributeAssociations
|
|||
{
|
||||
//OK
|
||||
GSWComponent* component=nil;
|
||||
id tmpDirectActionString=nil;
|
||||
NSMutableString* tmpDirectActionString=nil;
|
||||
id directActionNameValue=nil;
|
||||
id actionClassValue=nil;
|
||||
IMP das_appendStringIMP=NULL;
|
||||
|
||||
LOGObjectFnStart();
|
||||
|
||||
component=GSWContext_component(aContext);
|
||||
if (directActionName)
|
||||
directActionNameValue=[directActionName valueInComponent:component];
|
||||
directActionNameValue=NSStringWithObject([directActionName valueInComponent:component]);
|
||||
if (actionClass)
|
||||
actionClassValue=[actionClass valueInComponent:component];
|
||||
actionClassValue=NSStringWithObject([actionClass valueInComponent:component]);
|
||||
|
||||
if (actionClassValue)
|
||||
{
|
||||
tmpDirectActionString=(NSMutableString*)
|
||||
[NSMutableString stringWithString:actionClassValue];
|
||||
if (directActionNameValue)
|
||||
tmpDirectActionString=[NSString stringWithFormat:@"%@/%@",
|
||||
actionClassValue,
|
||||
directActionNameValue];
|
||||
else
|
||||
tmpDirectActionString=actionClassValue;
|
||||
{
|
||||
// append /directActionNameValue
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
@"/");
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
directActionNameValue);
|
||||
};
|
||||
}
|
||||
else if (directActionNameValue)
|
||||
tmpDirectActionString=directActionNameValue;
|
||||
{
|
||||
tmpDirectActionString=(NSMutableString*)
|
||||
[NSMutableString stringWithString:directActionNameValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGSeriousError(@"No actionClass (for %@) and no directActionName (for %@)",
|
||||
|
@ -898,6 +909,7 @@ attributeAssociations:(NSDictionary*)attributeAssociations
|
|||
NSArray* keys = nil;
|
||||
unsigned int count = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
|
||||
// We sort keys so URL are always the same for same parameters
|
||||
keys=[[finalDictionary allKeys]sortedArrayUsingSelector:@selector(compare:)];
|
||||
|
@ -910,9 +922,19 @@ attributeAssociations:(NSDictionary*)attributeAssociations
|
|||
id value = [finalDictionary valueForKey:key];
|
||||
NSDebugMLLog(@"gswdync",@"key=%@",key);
|
||||
NSDebugMLLog(@"gswdync",@"value=%@",value);
|
||||
tmpDirectActionString=[tmpDirectActionString stringByAppendingFormat:@"/%@=%@",
|
||||
key,
|
||||
value];
|
||||
// append /key=value
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
@"/");
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
NSStringWithObject(key));
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
@"=");
|
||||
GSWeb_appendStringWithImpPtr(tmpDirectActionString,
|
||||
&das_appendStringIMP,
|
||||
NSStringWithObject(value));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1031,20 +1053,13 @@ in GSWHyperlink, it was
|
|||
GSWComponent* component=GSWContext_component(aContext);
|
||||
cidObject=[cidStore valueInComponent:component];
|
||||
NSDebugMLog(@"cidObject=%@",cidObject);
|
||||
/* if (!cidObject)
|
||||
{
|
||||
cidObject=(NSMutableDictionary*)[NSMutableDictionary dictionary];
|
||||
[_cidStore setValue:cidObject
|
||||
inComponent:component];
|
||||
};
|
||||
*/
|
||||
|
||||
if (cidObject)
|
||||
{
|
||||
if (![cidObject valueForKey:cidKeyValue])
|
||||
[cidObject takeValue:cidElement
|
||||
forKey:cidKeyValue];
|
||||
newURL=[NSString stringWithFormat:@"cid:%@",
|
||||
cidKeyValue];
|
||||
newURL=[@"cid:" stringByAppendingString:NSStringWithObject(cidKeyValue)];
|
||||
};
|
||||
NSDebugMLog(@"newURL=%@",newURL);
|
||||
};
|
||||
|
|
|
@ -432,10 +432,8 @@ RCS_ID("$Id$")
|
|||
if (wasFormSubmitted)
|
||||
{
|
||||
NSString* nameInContext=[self nameInContext:aContext];
|
||||
NSString* formValueX=[request formValueForKey:[NSString stringWithFormat:@"%@.x",
|
||||
nameInContext]];
|
||||
NSString* formValueY=[request formValueForKey:[NSString stringWithFormat:@"%@.y",
|
||||
nameInContext]];
|
||||
NSString* formValueX=[request formValueForKey:[nameInContext stringByAppendingString:@".x"]];
|
||||
NSString* formValueY=[request formValueForKey:[nameInContext stringByAppendingString:@".y"]];
|
||||
NSDebugMLLog(@"gswdync",@"formValueX=%@",formValueX);
|
||||
NSDebugMLLog(@"gswdync",@"formValueY=%@",formValueY);
|
||||
if (formValueX && formValueY)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** GSWMailDelivery.m - <title>GSWeb: Class GSWMailDelivery</title>
|
||||
|
||||
Copyright (C) 1999-2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
Date: Feb 1999
|
||||
|
@ -113,7 +113,7 @@ static GSWMailDelivery *sharedInstance;
|
|||
plainText:(NSString*)plainTextMessage
|
||||
send:(BOOL)sendNow
|
||||
{
|
||||
NSString* messageString=nil;
|
||||
NSMutableString* messageString=nil;
|
||||
NSMutableString* toString=nil;
|
||||
int i=0;
|
||||
int count=0;
|
||||
|
@ -133,12 +133,26 @@ static GSWMailDelivery *sharedInstance;
|
|||
for(i=0;i<count;i++)
|
||||
{
|
||||
if (!toString)
|
||||
toString=(NSMutableString*)[NSMutableString stringWithFormat:@"%@",[to objectAtIndex:i]];
|
||||
toString=(NSMutableString*)[NSMutableString stringWithString:NSStringWithObject([to objectAtIndex:i])];
|
||||
else
|
||||
[toString appendFormat:@", %@",[to objectAtIndex:i]];
|
||||
{
|
||||
[toString appendString:@", "];
|
||||
[toString appendString:NSStringWithObject([to objectAtIndex:i])];
|
||||
};
|
||||
};
|
||||
NSDebugMLog(@"toString=%@",toString);
|
||||
messageString=[NSString stringWithFormat:@"From: %@\nTo: %@\n",sender,toString];
|
||||
messageString=(NSMutableString*)[NSMutableString string];
|
||||
|
||||
// From:
|
||||
[messageString appendString:@"From: "];
|
||||
[messageString appendString:NSStringWithObject(sender)];
|
||||
[messageString appendString:@"\n"];
|
||||
|
||||
// To:
|
||||
[messageString appendString:@"To: "];
|
||||
[messageString appendString:toString];
|
||||
[messageString appendString:@"\n"];
|
||||
|
||||
NSDebugMLog(@"messageString=%@",messageString);
|
||||
count=[cc count];
|
||||
if (count)
|
||||
|
@ -147,12 +161,19 @@ static GSWMailDelivery *sharedInstance;
|
|||
for(i=0;i<count;i++)
|
||||
{
|
||||
if (!ccString)
|
||||
ccString=(NSMutableString*)[NSMutableString stringWithFormat:@"%@",[cc objectAtIndex:i]];
|
||||
ccString=(NSMutableString*)[NSMutableString stringWithString:NSStringWithObject([cc objectAtIndex:i])];
|
||||
else
|
||||
[ccString appendFormat:@", %@",[cc objectAtIndex:i]];
|
||||
{
|
||||
[ccString appendString:@", "];
|
||||
[ccString appendString:NSStringWithObject([cc objectAtIndex:i])];
|
||||
};
|
||||
};
|
||||
NSDebugMLog(@"ccString=%@",ccString);
|
||||
messageString=[messageString stringByAppendingFormat:@"Cc: %@\n",ccString];
|
||||
|
||||
// cc:
|
||||
[messageString appendString:@"Cc: "];
|
||||
[messageString appendString:ccString];
|
||||
[messageString appendString:@"\n"];
|
||||
NSDebugMLog(@"messageString=%@",messageString);
|
||||
};
|
||||
count=[bcc count];
|
||||
|
@ -162,16 +183,31 @@ static GSWMailDelivery *sharedInstance;
|
|||
for(i=0;i<count;i++)
|
||||
{
|
||||
if (!bccString)
|
||||
bccString=(NSMutableString*)[NSMutableString stringWithFormat:@"%@",[bcc objectAtIndex:i]];
|
||||
bccString=(NSMutableString*)[NSMutableString stringWithString:NSStringWithObject([bcc objectAtIndex:i])];
|
||||
else
|
||||
[bccString appendFormat:@", %@",[bcc objectAtIndex:i]];
|
||||
{
|
||||
[bccString appendString:@", "];
|
||||
[bccString appendString:NSStringWithObject([bcc objectAtIndex:i])];
|
||||
};
|
||||
};
|
||||
NSDebugMLog(@"bccString=%@",bccString);
|
||||
messageString=[messageString stringByAppendingFormat:@"Bcc: %@\n",bccString];
|
||||
|
||||
// Bcc:
|
||||
[messageString appendString:@"Bcc: "];
|
||||
[messageString appendString:bccString];
|
||||
[messageString appendString:@"\n"];
|
||||
NSDebugMLog(@"messageString=%@",messageString);
|
||||
};
|
||||
messageString=[messageString stringByAppendingFormat:@"Subject: %@\n\n%@",subject,plainTextMessage];
|
||||
|
||||
//Subject
|
||||
[messageString appendString:@"Subject: "];
|
||||
[messageString appendString:NSStringWithObject(subject)];
|
||||
[messageString appendString:@"\n\n"];
|
||||
|
||||
// plainTextMessage
|
||||
[messageString appendString:NSStringWithObject(plainTextMessage)];
|
||||
NSDebugMLog(@"messageString=%@",messageString);
|
||||
|
||||
if (sendNow)
|
||||
[self sendEmail:messageString];
|
||||
LOGObjectFnStop();
|
||||
|
@ -264,7 +300,7 @@ static GSWMailDelivery *sharedInstance;
|
|||
NSDebugMLog(@"sendmailPath=%@",sendmailPath);
|
||||
// -i When reading a message from standard input, don't treat a line with only a . character as the end of input.
|
||||
// -t Extract recipients from message headers. This requires that no recipients be specified on the command line.
|
||||
sendmailCommand=[NSString stringWithFormat:@"%@ -i -t",sendmailPath];
|
||||
sendmailCommand=[sendmailPath stringByAppendingString:@" -i -t"];
|
||||
NSDebugMLog(@"sendmailCommand=%@",sendmailCommand);
|
||||
sendmailFile=popen([sendmailCommand lossyCString],"w");
|
||||
if (sendmailFile)
|
||||
|
|
|
@ -1112,12 +1112,13 @@ static void GSWMapBaseInitWithZoneAndCapacity(GSWMapBase base,
|
|||
if (keysCount==0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add empty keys array to dictionary"];
|
||||
format: @"Tried to add empty keys array to multi-keys dictionary. Object: %@",
|
||||
object];
|
||||
}
|
||||
else if (object == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add nil value to dictionary"];
|
||||
format: @"Tried to add nil value to multi-keys dictionary"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1151,17 +1152,20 @@ static void GSWMapBaseInitWithZoneAndCapacity(GSWMapBase base,
|
|||
if (count==0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add object to dictionary with no key"];
|
||||
format: @"Tried to add object to multi-keys dictionary with no key. Object: %@",
|
||||
object];
|
||||
}
|
||||
else if (*keys == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add nil key to dictionary"];
|
||||
format: @"Tried to add nil key to multi-keys dictionary. Object: %@",
|
||||
object];
|
||||
}
|
||||
else if (object == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add nil value to dictionary"];
|
||||
format: @"Tried to add nil value to multi-keys dictionary. First key: %@",
|
||||
*keys];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue