mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 07:17:12 +00:00
Monotone-Parent: 8af16d6a8834b3a737ae5b5b69c3f222bd5671dd
Monotone-Revision: affe7d2d4111c2a72ec7f3cb14b36af674fcc41c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-18T15:08:41 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
33600bbcd0
commit
aae5e42b94
3 files changed
+78
-10
No files matched your search
@@ -35,11 +35,13 @@
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
NSString *calContent;
|
||||
BOOL isNew;
|
||||
}
|
||||
|
||||
- (NSString *) componentTag;
|
||||
- (iCalCalendar *) calendar;
|
||||
- (iCalRepeatableEntityObject *) component;
|
||||
- (iCalCalendar *) calendar: (BOOL) create;
|
||||
- (iCalRepeatableEntityObject *) component: (BOOL) create;
|
||||
- (BOOL) isNew;
|
||||
|
||||
- (NSException *) primarySaveContentString: (NSString *) _iCalString;
|
||||
- (NSException *) primaryDelete;
|
||||
@@ -53,6 +55,10 @@
|
||||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||
toAttendees: (NSArray *) _attendees;
|
||||
|
||||
- (BOOL) isOrganizer: (NSString *) email
|
||||
orOwner: (NSString *) login;
|
||||
- (BOOL) isParticipant: (NSString *) email;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* SOGOCALENDARCOMPONENT_H */
|
||||
@@ -69,6 +69,7 @@ static BOOL sendEMailNotifications = NO;
|
||||
{
|
||||
calendar = nil;
|
||||
calContent = nil;
|
||||
isNew = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -158,30 +159,49 @@ static BOOL sendEMailNotifications = NO;
|
||||
return result;
|
||||
}
|
||||
|
||||
- (iCalCalendar *) calendar
|
||||
- (iCalCalendar *) calendar: (BOOL) create
|
||||
{
|
||||
NSString *iCalString;
|
||||
NSString *iCalString, *componentTag;
|
||||
CardGroup *newComponent;
|
||||
|
||||
if (!calendar)
|
||||
{
|
||||
iCalString = [self contentAsString];
|
||||
if (iCalString)
|
||||
if ([iCalString length] > 0)
|
||||
calendar = [iCalCalendar parseSingleFromSource: iCalString];
|
||||
else
|
||||
{
|
||||
calendar = [iCalCalendar parseSingleFromSource: iCalString];
|
||||
[calendar retain];
|
||||
if (create)
|
||||
{
|
||||
calendar = [iCalCalendar groupWithTag: @"vcalendar"];
|
||||
[calendar setVersion: @"2.0"];
|
||||
[calendar setProdID: @"-//Inverse groupe conseil//SOGo 0.9//EN"];
|
||||
componentTag = [[self componentTag] uppercaseString];
|
||||
newComponent = [[calendar classForTag: componentTag]
|
||||
groupWithTag: componentTag];
|
||||
[calendar addChild: newComponent];
|
||||
isNew = YES;
|
||||
}
|
||||
}
|
||||
if (calendar)
|
||||
[calendar retain];
|
||||
}
|
||||
|
||||
return calendar;
|
||||
}
|
||||
|
||||
- (iCalRepeatableEntityObject *) component
|
||||
- (iCalRepeatableEntityObject *) component: (BOOL) create
|
||||
{
|
||||
return (iCalRepeatableEntityObject *)
|
||||
[[self calendar]
|
||||
[[self calendar: create]
|
||||
firstChildWithTag: [self componentTag]];
|
||||
}
|
||||
|
||||
- (BOOL) isNew
|
||||
{
|
||||
return isNew;
|
||||
}
|
||||
|
||||
/* raw saving */
|
||||
|
||||
- (NSException *) primarySaveContentString: (NSString *) _iCalString
|
||||
@@ -376,7 +396,7 @@ static BOOL sendEMailNotifications = NO;
|
||||
um = [AgenorUserManager sharedUserManager];
|
||||
email = [um getEmailForUID: login];
|
||||
|
||||
component = [self component];
|
||||
component = [self component: NO];
|
||||
if (component)
|
||||
{
|
||||
if ([component isOrganizer: email])
|
||||
@@ -397,4 +417,36 @@ static BOOL sendEMailNotifications = NO;
|
||||
return sogoRoles;
|
||||
}
|
||||
|
||||
- (BOOL) isOrganizer: (NSString *) email
|
||||
orOwner: (NSString *) login
|
||||
{
|
||||
BOOL isOrganizerOrOwner;
|
||||
iCalRepeatableEntityObject *component;
|
||||
|
||||
component = [self component: NO];
|
||||
if (component)
|
||||
isOrganizerOrOwner
|
||||
= ([component isOrganizer: email]
|
||||
|| [[container ownerInContext: nil] isEqualToString: login]);
|
||||
else
|
||||
isOrganizerOrOwner
|
||||
= [[container ownerInContext: nil] isEqualToString: login];
|
||||
|
||||
return isOrganizerOrOwner;
|
||||
}
|
||||
|
||||
- (BOOL) isParticipant: (NSString *) email
|
||||
{
|
||||
BOOL isParticipant;
|
||||
iCalRepeatableEntityObject *component;
|
||||
|
||||
component = [self component: NO];
|
||||
if (component)
|
||||
isParticipant = [component isParticipant: email];
|
||||
else
|
||||
isParticipant = NO;
|
||||
|
||||
return isParticipant;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user