2000-08-26 Mirko Viviani <mirko.viviani@rccr.cremona.it>

* GSWMailDelivery.m/.h: rewritten sendEmail: with execlp() to avoid
	  email content manipulation.
	* GSWDisplayGroup.m: fixed a cursor bug.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@7247 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Mirko Viviani 2000-08-26 16:10:22 +00:00
parent 77cbf60540
commit 581b2612b0
4 changed files with 47 additions and 19 deletions

View file

@ -1,3 +1,9 @@
2000-08-26 Mirko Viviani <mirko.viviani@rccr.cremona.it>
* GSWMailDelivery.m/.h: rewritten sendEmail: with execlp() to avoid
email content manipulation.
* GSWDisplayGroup.m: fixed a cursor bug.
2000-08-14 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWApplication.m: added "exit" in terminate

View file

@ -1678,7 +1678,7 @@ static char rcsId[] = "$Id$";
- (void)setCurrentBatchIndex:(unsigned)index_
{
unsigned batchCount, num;
unsigned batchCount, num, count;
int i;
if(!index_)
@ -1690,8 +1690,10 @@ static char rcsId[] = "$Id$";
if(index_ > batchCount)
index_ = 1;
count = [allObjects count];
if(!numberOfObjectsPerBatch)
num = [allObjects count];
num = count;
else
num = numberOfObjectsPerBatch;
@ -1699,7 +1701,7 @@ static char rcsId[] = "$Id$";
return;
for( i = (index_-1) * num;
i < index_ * num;
(i < index_ * num) && (i < index_ * count);
i++)
[displayedObjects addObject:[allObjects objectAtIndex:i]];

View file

@ -30,7 +30,6 @@
//====================================================================
@interface GSWMailDelivery : NSObject
{
NSString *sender;
};
+(GSWMailDelivery*)sharedInstance;

View file

@ -41,11 +41,6 @@ static GSWMailDelivery *sharedInstance;
return sharedInstance;
};
- (void)dealloc
{
DESTROY(sender);
}
-(NSString*)composeEmailFrom:(NSString*)sender_
to:(NSArray*)to_
cc:(NSArray*)cc_
@ -92,6 +87,7 @@ static GSWMailDelivery *sharedInstance;
NSMutableString* _to=nil;
int i=0;
int _count=0;
_count=[to_ count];
NSDebugMLog(@"sender_=%@",sender_);
NSDebugMLog(@"to_=%@",to_);
@ -100,7 +96,7 @@ static GSWMailDelivery *sharedInstance;
NSDebugMLog(@"subject_=%@",subject_);
NSDebugMLog(@"plainTextMessage_=%@",plainTextMessage_);
NSDebugMLog(@"sendNow_=%d",(int)sendNow_);
ASSIGN(sender, sender_);
for(i=0;i<_count;i++)
{
if (!_to)
@ -161,17 +157,42 @@ static GSWMailDelivery *sharedInstance;
return nil;
};
-(void)sendEmail:(NSString*)emailString_
-(void)sendEmail:(NSString *)emailString_
{
NSString* _command=nil;
NSString* _emailString=nil;
LOGObjectFnNotImplemented(); //TODOFN
int files[2];
pid_t pid;
NSDebugMLog(@"emailString_=%@",emailString_);
_emailString=[emailString_ stringByReplacingString:@"&"
withString:@"\\&"];
NSDebugMLog(@"_emailString=%@",_emailString);
_command=[NSString stringWithFormat:@"echo \"%@\" | /usr/sbin/sendmail \"%@\"",_emailString, sender];
system([_command cString]);
if(pipe(files))
[NSException raise:NSInternalInconsistencyException format:@"%@ -- %@ 0x%x: cannot create pipe", NSStringFromSelector(_cmd), NSStringFromClass([self class]), self];
switch(pid = fork())
{
case 0:
close(0);
dup(files[0]);
close(files[0]);
close(files[1]);
execlp("sendmail", "sendmail", "-i", "-t", NULL);
break;
case -1:
close(files[0]);
close(files[1]);
[NSException raise:NSInternalInconsistencyException format:@"%@ -- %@ 0x%x: cannot fork process", NSStringFromSelector(_cmd), NSStringFromClass([self class]), self];
break;
default:
write(files[1], [emailString_ cString], strlen([emailString_ cString]));
close(files[0]);
close(files[1]);
waitpid(pid, NULL, 0);
break;
}
};
-(void)_invokeGSWSendMailAt:(id)at_