Add message-id header to appointment notification

Fixes #2535
pull/17/head
Francis Lachapelle 2014-02-07 10:51:42 -05:00
parent 3363b253ac
commit eee5beb698
5 changed files with 25 additions and 18 deletions

1
NEWS
View File

@ -28,6 +28,7 @@ Enhancements
- improved confirmation dialog box when deleting events and tasks
- moved the DN cache to SOGoCache - avoiding sogod restarts after RDN operations
- don't use the HTML editor with Internet Explorer 7
- add message-id header to appointment notifications (#2535)
Bug fixes
- don't load 'background' attribute (#2437)

View File

@ -24,6 +24,7 @@
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
@ -62,6 +63,7 @@
#import <SOGo/SOGoWebDAVAclManager.h>
#import <SOGo/WORequest+SOGo.h>
#import <Appointments/SOGoAppointmentFolder.h>
#import <Mailer/NSString+Mail.h>
#import "SOGoAptMailICalReply.h"
#import "SOGoAptMailNotification.h"
@ -832,6 +834,7 @@
mailDate = [[NSCalendarDate date] rfc822DateString];
[headerMap setObject: mailDate forKey: @"date"];
[headerMap setObject: subject forKey: @"subject"];
[headerMap setObject: [NSString generateMessageID] forKey: @"message-id"];
if ([msgType length] > 0)
[headerMap setObject: msgType forKey: @"x-sogo-message-type"];
msg = [NGMimeMessage messageWithHeader: headerMap];
@ -861,8 +864,7 @@
sendMimePart: msg
toRecipients: [NSArray arrayWithObject: email]
sender: shortSenderEmail
withAuthenticator: [self
authenticatorInContext: context]
withAuthenticator: [self authenticatorInContext: context]
inContext: context];
}
}
@ -916,6 +918,7 @@
[headerMap setObject: mailDate forKey: @"date"];
[headerMap setObject: [[p getSubject] asQPSubjectString: @"UTF-8"]
forKey: @"subject"];
[headerMap setObject: [NSString generateMessageID] forKey: @"message-id"];
[headerMap setObject: @"1.0" forKey: @"MIME-Version"];
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
[headerMap setObject: @"calendar:invitation-reply" forKey: @"x-sogo-message-type"];
@ -1038,6 +1041,7 @@
mailDate = [[NSCalendarDate date] rfc822DateString];
[headerMap setObject: mailDate forKey: @"date"];
[headerMap setObject: [page getSubject] forKey: @"subject"];
[headerMap setObject: [NSString generateMessageID] forKey: @"message-id"];
[headerMap setObject: @"1.0" forKey: @"MIME-Version"];
[headerMap setObject: @"text/html; charset=utf-8"
forKey: @"content-type"];

View File

@ -1,6 +1,6 @@
/* NSString+Mail.h - this file is part of SOGo
*
* Copyright (C) 2007-2013 Inverse inc.
* Copyright (C) 2007-2014 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@
@interface NSString (SOGoExtension)
+ (NSString *) generateMessageID;
- (NSString *) htmlToText;
- (NSString *) htmlByExtractingImages: (NSMutableArray *) theImages;
- (NSString *) stringByConvertingCRLNToHTML;

View File

@ -20,8 +20,9 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSException.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSValue.h>
#import <SaxObjC/SaxAttributes.h>
@ -516,6 +517,19 @@
@implementation NSString (SOGoExtension)
+ (NSString *) generateMessageID
{
NSMutableString *messageID;
NSString *pGUID;
messageID = [NSMutableString string];
[messageID appendFormat: @"<%@", [SOGoObject globallyUniqueObjectId]];
pGUID = [[NSProcessInfo processInfo] globallyUniqueString];
[messageID appendFormat: @"@%u>", [pGUID hash]];
return [messageID lowercaseString];
}
- (NSString *) htmlToText
{
_SOGoHTMLContentHandler *handler;

View File

@ -256,19 +256,6 @@ static NSString *userAgent = nil;
/* contents */
- (NSString *) _generateMessageID
{
NSMutableString *messageID;
NSString *pGUID;
messageID = [NSMutableString string];
[messageID appendFormat: @"<%@", [self globallyUniqueObjectId]];
pGUID = [[NSProcessInfo processInfo] globallyUniqueString];
[messageID appendFormat: @"@%u>", [pGUID hash]];
return [messageID lowercaseString];
}
- (void) setHeaders: (NSDictionary *) newHeaders
{
id headerValue;
@ -288,7 +275,7 @@ static NSString *userAgent = nil;
messageID = [headers objectForKey: @"message-id"];
if (!messageID)
{
messageID = [self _generateMessageID];
messageID = [NSString generateMessageID];
[headers setObject: messageID forKey: @"message-id"];
}