#include <SOGo/SOGoUser.h>
#include <SOGo/SoObjects/Appointments/SOGoAppointmentFolder.h>
#include <SOGo/SoObjects/Appointments/SOGoAppointmentObject.h>
+#include <SOGo/SoObjects/Mailer/SOGoMailObject.h>
#include <NGiCal/NGiCal.h>
+#include <NGImap4/NGImap4EnvelopeAddress.h>
#include "common.h"
@implementation UIxMailPartICalViewer
return @"[todo: no organizer set, use 'from']";
}
+/* replies */
+
+- (NGImap4EnvelopeAddress *)replySenderAddress {
+ /*
+ The iMIP reply is the sender of the mail, the 'attendees' are NOT set to
+ the actual attendees. BUT the attendee field contains the reply-status!
+ */
+ id tmp;
+
+ tmp = [[self clientObject] fromEnvelopeAddresses];
+ if ([tmp count] == 0) return nil;
+ return [tmp objectAtIndex:0];
+}
+
+- (NSString *)replySenderEMail {
+ return [[self replySenderAddress] email];
+}
+- (NSString *)replySenderBaseEMail {
+ return [[self replySenderAddress] baseEMail];
+}
+
+- (iCalPerson *)inReplyAttendee {
+ NSArray *attendees;
+
+ attendees = [[self inEvent] attendees];
+ if ([attendees count] == 0)
+ return nil;
+ if ([attendees count] > 1)
+ [self warnWithFormat:@"More than one attendee in REPLY: %@", attendees];
+
+ return [attendees objectAtIndex:0];
+}
+- (iCalPerson *)storedReplyAttendee {
+ iCalEvent *e;
+ iCalPerson *p;
+
+ if ((e = [self storedEvent]) == nil)
+ return nil;
+ if ((p = [e findParticipantWithEmail:[self replySenderBaseEMail]]))
+ return p;
+ if ((p = [e findParticipantWithEmail:[self replySenderEMail]]))
+ return p;
+ return nil;
+}
+- (BOOL)isReplySenderAnAttendee {
+ return [[self storedReplyAttendee] isNotNull];
+}
+
/* action URLs */
- (id)acceptLink {
<!-- sent to organizer to update the status of the participant -->
<p>
iMIP 'REPLY' requests are not yet supported by SOGo.
+ <br />
+ From: <!-- TODO: support for 'root' objects? -->
+ <var:string value="replySenderEMail" />
+ <br />
+ Status Update:
+ <var:string value="inReplyAttendee.partStat" />,
+ <var:if condition="isReplySenderAnAttendee">
+ was:
+ <var:string value="storedReplyAttendee.partStat" />.
+ </var:if>
+ <var:if condition="isReplySenderAnAttendee" const:negate="1">
+ <b>the sender is not registered as an attendee!</b>
+ </var:if>
</p>
</var:if>
<tr>
<td><var:string label:value="Organizer"/>:</td>
<td>
- <a var:href="inEvent.organizer.email"
+ <a var:href="authorativeEvent.organizer.email"
><var:string value="organizerDisplayName" /></a>
</td>
</tr>
<tr>
<td valign="top"><var:string label:value="Attendees"/>:</td>
<td>
- <var:foreach list="inEvent.participants" item="attendee">
+ <var:foreach list="authorativeEvent.participants" item="attendee">
<a var:href="attendee.email"
><var:string value="attendee.cnForDisplay" /></a>
(<var:string value="attendee.partStat" />)
<tr> <!-- description in iCal -->
<td valign="top"><var:string label:value="Comment"/>:</td>
<td>
- <var:string value="inEvent.comment" const:insertBR="1" />
+ <var:string value="authorativeEvent.comment" const:insertBR="1" />
</td>
</tr>
</table>