mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-19 01:51:03 +00:00
Report sent and failed emails as part of server status
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@37038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8b45d10ad8
commit
1b3b490941
2 changed files with 10 additions and 3 deletions
|
@ -324,6 +324,8 @@
|
||||||
NSString *eHost; /** Host with SMTP MTA */
|
NSString *eHost; /** Host with SMTP MTA */
|
||||||
NSString *ePort; /** Port of SMTP MTA */
|
NSString *ePort; /** Port of SMTP MTA */
|
||||||
GSMimeSMTPClient *smtp; /** Client connection to MTA */
|
GSMimeSMTPClient *smtp; /** Client connection to MTA */
|
||||||
|
NSUInteger sentEmail;
|
||||||
|
NSUInteger failEmail;
|
||||||
BOOL debug; /** Debug enabled in config */
|
BOOL debug; /** Debug enabled in config */
|
||||||
BOOL supersede; /** If a clear should replace original */
|
BOOL supersede; /** If a clear should replace original */
|
||||||
BOOL eThreaded; /** alarm reminder emails threaded */
|
BOOL eThreaded; /** alarm reminder emails threaded */
|
||||||
|
|
11
EcAlerter.m
11
EcAlerter.m
|
@ -190,11 +190,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
|
|
||||||
- (void) smtpClient: (GSMimeSMTPClient*)client mimeFailed: (GSMimeDocument*)doc
|
- (void) smtpClient: (GSMimeSMTPClient*)client mimeFailed: (GSMimeDocument*)doc
|
||||||
{
|
{
|
||||||
|
failEmail++;
|
||||||
NSLog(@"Message failed: %@", doc);
|
NSLog(@"Message failed: %@", doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) smtpClient: (GSMimeSMTPClient*)client mimeSent: (GSMimeDocument*)doc
|
- (void) smtpClient: (GSMimeSMTPClient*)client mimeSent: (GSMimeDocument*)doc
|
||||||
{
|
{
|
||||||
|
sentEmail++;
|
||||||
if (YES == debug)
|
if (YES == debug)
|
||||||
{
|
{
|
||||||
NSLog(@"Message sent: %@", doc);
|
NSLog(@"Message sent: %@", doc);
|
||||||
|
@ -203,6 +205,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
|
|
||||||
- (void) smtpClient: (GSMimeSMTPClient*)client mimeUnsent: (GSMimeDocument*)doc
|
- (void) smtpClient: (GSMimeSMTPClient*)client mimeUnsent: (GSMimeDocument*)doc
|
||||||
{
|
{
|
||||||
|
failEmail++;
|
||||||
NSLog(@"Message dropped on SMTP client shutdown: %@", doc);
|
NSLog(@"Message dropped on SMTP client shutdown: %@", doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,9 +366,11 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
- (NSString*) description
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat: @"%@ -\nConfigured with %u rules\n"
|
return [NSString stringWithFormat: @"%@ -\nConfigured with %u rules\n"
|
||||||
@"With SMTP %@:%@ as %@\nPending Email:%@\nPending SMS:%@",
|
@"With SMTP %@:%@ as %@\n"
|
||||||
|
@"Email sent: %"PRIuPTR", fail: %"PRIuPTR", pending:%@\n"
|
||||||
|
@"SMS pending:%@",
|
||||||
[super description], (unsigned)[rules count], eHost, ePort,
|
[super description], (unsigned)[rules count], eHost, ePort,
|
||||||
eFrom, email, sms];
|
eFrom, sentEmail, failEmail, email, sms];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) flushEmailForAddress: (NSString*)address
|
- (void) flushEmailForAddress: (NSString*)address
|
||||||
|
@ -429,7 +434,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
|
|
||||||
- (void) flushSms
|
- (void) flushSms
|
||||||
{
|
{
|
||||||
return;
|
[sms removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) applyRules: (NSArray*)rulesArray
|
- (void) applyRules: (NSArray*)rulesArray
|
||||||
|
|
Loading…
Reference in a new issue