summaryrefslogtreecommitdiffstats
path: root/wallace
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-02 10:01:21 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-02 10:01:21 -0500
commit3cc3391170e54fb3e4bf477562bc2ef4bf8885c3 (patch)
tree4a182e5b16dbab0c4b37202813fc718bf7fdcafd /wallace
parentdaaa39a33e05934462b42d650873a4453c6fd5ca (diff)
downloadpykolab-3cc3391170e54fb3e4bf477562bc2ef4bf8885c3.tar.gz
Store invitations to single occurrences with the same UID in one object (#4726)
Diffstat (limited to 'wallace')
-rw-r--r--wallace/module_invitationpolicy.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index 405f743..fca2128 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -440,6 +440,7 @@ def process_itip_request(itip_event, policy, recipient_email, sender_email, rece
log.debug(_("Auto-updating %s %r on iTip REQUEST (no re-scheduling)") % (existing.type, existing.uid), level=8)
save_object = True
+ rsvp = False
# retain task status and percent-complete properties from my old copy
if is_task:
@@ -473,10 +474,13 @@ def process_itip_request(itip_event, policy, recipient_email, sender_email, rece
if save_object:
targetfolder = None
+ # delete old version from IMAP
if existing:
- # delete old version from IMAP
targetfolder = existing._imap_folder
delete_object(existing)
+ elif master and hasattr(master, '_imap_folder'):
+ targetfolder = master._imap_folder
+ delete_object(master)
if not nonpart or existing:
# save new copy from iTip
@@ -814,12 +818,17 @@ def find_existing_object(uid, type, recurrence_id, user_rec, lock=False):
event = event_from_message(message_from_string(data[0][1]))
# find instance in a recurring series
- if recurrence_id and event.is_recurring():
+ if recurrence_id and (event.is_recurring() or event.has_exceptions() or event.get_recurrence_id()):
master = event
event = master.get_instance(recurrence_id)
setattr(master, '_imap_folder', folder)
setattr(master, '_msguid', msguid)
+ # return master, even if instance is not found
+ if not event and master.uid == uid:
+ log.debug("Instance not found, returning master" % (), level=8)
+ return (event, master)
+ """
# compare recurrence-id and skip to next message if not matching
elif recurrence_id and not event.is_recurring() and not xmlutils.dates_equal(recurrence_id, event.get_recurrence_id()):
log.debug(_("Recurrence-ID not matching on message %s, skipping: %r != %r") % (
@@ -828,10 +837,11 @@ def find_existing_object(uid, type, recurrence_id, user_rec, lock=False):
event = None
master = None
continue
-
- setattr(event, '_imap_folder', folder)
- setattr(event, '_lock_key', lock_key)
- setattr(event, '_msguid', msguid)
+ """
+ if event is not None:
+ setattr(event, '_imap_folder', folder)
+ setattr(event, '_lock_key', lock_key)
+ setattr(event, '_msguid', msguid)
except Exception, e:
log.error(_("Failed to parse %s from message %s/%s: %s") % (type, folder, num, traceback.format_exc()))