mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-22 07:14:21 +00:00
See ChangeLog
Monotone-Parent: 728de9d1f91919c2ef87a31aa2d11b9b1a3a9835 Monotone-Revision: e5e46473685093f9076981f90edbe581992247e7 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-08-27T20:35:10
This commit is contained in:
1 parent
4d71ec17f6
commit
da6b5696a0
15 files changed
+368
-133
No files matched your search
@@ -33,10 +33,31 @@
|
||||
#import "SOGoAptMailNotification.h"
|
||||
|
||||
@interface SOGoAptMailUpdate : SOGoAptMailNotification
|
||||
{
|
||||
NSMutableDictionary *changes;
|
||||
NSString *currentItem;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SOGoAptMailUpdate
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
changes = [[NSMutableDictionary alloc] init];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(currentItem);
|
||||
RELEASE(changes);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) valueForProperty: (NSString *) property
|
||||
withDateFormatter: (SOGoDateFormatter *) dateFormatter
|
||||
{
|
||||
@@ -64,7 +85,10 @@
|
||||
if ([valueType isEqualToString: @"date"])
|
||||
{
|
||||
[value setTimeZone: viewTZ];
|
||||
value = [dateFormatter formattedDateAndTime: value];
|
||||
if ([apt isAllDay])
|
||||
value = [dateFormatter formattedDate: value];
|
||||
else
|
||||
value = [dateFormatter formattedDateAndTime: value];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -75,15 +99,13 @@
|
||||
|
||||
- (void) _setupBodyContentWithFormatter: (SOGoDateFormatter *) dateFormatter
|
||||
{
|
||||
NSArray *updatedProperties;
|
||||
NSMutableString *bodyContent;
|
||||
NSString *property, *label, *value;
|
||||
NSArray *updatedProperties;
|
||||
int count, max;
|
||||
|
||||
updatedProperties = [[iCalEventChanges changesFromEvent: previousApt
|
||||
toEvent: apt]
|
||||
updatedProperties];
|
||||
bodyContent = [NSMutableString new];
|
||||
max = [updatedProperties count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
@@ -96,27 +118,40 @@
|
||||
label = [self labelForKey: [NSString stringWithFormat: @"%@_label",
|
||||
property]
|
||||
inContext: context];
|
||||
[bodyContent appendFormat: @" %@ %@\n", label, value];
|
||||
[changes setObject: value forKey: label];
|
||||
}
|
||||
}
|
||||
[values setObject: bodyContent forKey: @"_bodyContent"];
|
||||
[bodyContent release];
|
||||
}
|
||||
|
||||
- (void) _setupBodyValuesWithFormatter: (SOGoDateFormatter *) dateFormatter
|
||||
- (NSArray *) allChangesList
|
||||
{
|
||||
return [changes allKeys];
|
||||
}
|
||||
|
||||
- (void) setCurrentItem: (NSString *) theItem
|
||||
{
|
||||
ASSIGN(currentItem, theItem);
|
||||
}
|
||||
|
||||
- (NSString *) currentItem
|
||||
{
|
||||
return currentItem;
|
||||
}
|
||||
|
||||
- (NSString *) valueForCurrentItem
|
||||
{
|
||||
return [changes objectForKey: currentItem];
|
||||
}
|
||||
|
||||
- (NSString *) bodyStartText
|
||||
{
|
||||
NSString *bodyText;
|
||||
|
||||
bodyText = [self labelForKey: @"The following parameters have changed"
|
||||
@" in the \"%{Summary}\" meeting:"
|
||||
inContext: context];
|
||||
[values setObject: [values keysWithFormat: bodyText]
|
||||
forKey: @"_bodyStart"];
|
||||
[self _setupBodyContentWithFormatter: dateFormatter];
|
||||
[values setObject: [self labelForKey: @"Please accept"
|
||||
@" or decline those changes."
|
||||
inContext: context]
|
||||
forKey: @"_bodyEnd"];
|
||||
|
||||
return [values keysWithFormat: bodyText];
|
||||
}
|
||||
|
||||
- (void) setupValues
|
||||
@@ -136,7 +171,7 @@
|
||||
[values setObject: [dateFormatter formattedTime: date]
|
||||
forKey: @"OldStartTime"];
|
||||
|
||||
[self _setupBodyValuesWithFormatter: dateFormatter];
|
||||
[self _setupBodyContentWithFormatter: dateFormatter];
|
||||
}
|
||||
|
||||
- (NSString *) getSubject
|
||||
@@ -162,11 +197,14 @@
|
||||
|
||||
- (NSString *) getBody
|
||||
{
|
||||
NSString *body;
|
||||
|
||||
if (!values)
|
||||
[self setupValues];
|
||||
|
||||
return [values keysWithFormat:
|
||||
@"%{_bodyStart}\n%{_bodyContent}\n%{_bodyEnd}\n"];
|
||||
body = [[self generateResponse] contentAsString];
|
||||
|
||||
return [body stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user