def markEdited(self, item, attrs): attrs.difference_update(_IGNORE_EDIT_ATTRIBUTES) if not attrs or reminders.isDead(getattr(item, 'proxiedItem', item)): return me = item.getCurrentMeEmailAddress() who = None # We will mark this message as "edited by" this user. if stamping.has_stamp(item, mail.MailStamp): # For Mail items, we want to update the From: address of the master # to match something in the user's list of addresses (Bug 8534). # We actually want to bypass all proxying here, and apply the # CC/From header changes to the master item. mailItem = getattr(item, 'proxiedItem', item) message = mail.MailStamp(getattr(mailItem, 'inheritFrom', mailItem)) if stamping.has_stamp(message, mail.MailStamp): meAddresses = mail.getCurrentMeEmailAddresses(item.itsView) sender = message.getSender() if sender in meAddresses: # Already addressed by this user; don't need to do # anything more here. who = sender else: # Try to find a matching recipient; any field will do # (so far as arguments to getRecipients() go, we've already # preferentially excluded the sender, but should still check # originators & bcc). Also, if we're just now marking the item # as edited for the first time, make sure the (old) sender's in # the CC list. addSenderToCC = (sender is not None) and \ (items.Modification.edited not in item.modifiedFlags) for recipient in message.getRecipients(): if who is None and recipient in meAddresses: who = recipient if addSenderToCC and sender is recipient: addSenderToCC = False if who is None: # No match in for loop; use the current "me" address who = me if addSenderToCC: message.ccAddress.append(sender) # Update the from address message.fromAddress = who if who is None: who = item.getMyModifiedByAddress() item.changeEditState(who=who)
def appendChange(self, desc, op, attr, *args): super(RecurrenceProxy, self).appendChange(desc, op, attr, *args) item = self.proxiedItem if (not stamping.has_stamp(item, EventStamp) or EventStamp(item).rruleset is None): super(RecurrenceProxy, self).makeChanges() elif self.changing is not None: self.makeChanges()
def makeChange(self, item, change): # easy for set, not too bad for stamp addition, del is maybe # tricky, and add/remove require duplicating reflists event = EventStamp(item) changeType = change[1] if changeType == 'set': attr = change[2] self._updateEdited( item for item in event.modifications if not item.hasModifiedAttribute(attr) ) event.changeAll(attr, change[3]) return attr elif changeType == 'addStamp': self._updateEdited( item for item in event.modifications if not stamping.has_stamp(item, change[2]) ) event.addStampToAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType == 'removeStamp': self._updateEdited( item for item in event.modifications if stamping.has_stamp(item, change[2]) ) event.removeStampFromAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType in ('add', 'remove', 'append'): attr = change[0].descriptor.name self._updateEdited( item for item in event.modifications if not item.hasModifiedAttribute(attr) ) masterItem = event.getMaster().itsItem attrName, newValue = _multiChange(masterItem, change) with EventStamp(masterItem).noRecurrenceChanges(): setattr(masterItem, attrName, newValue) return attrName elif (changeType == 'delete' and change[0].descriptor.name == EventStamp.rruleset.name): event.removeRecurrence() return EventStamp.rruleset.name else: assert False
def makeChange(self, item, change): # easy for set, not too bad for stamp addition, del is maybe # tricky, and add/remove require duplicating reflists event = EventStamp(item) changeType = change[1] if changeType == 'set': attr = change[2] self._updateEdited(item for item in event.modifications if not item.hasModifiedAttribute(attr)) event.changeAll(attr, change[3]) return attr elif changeType == 'addStamp': self._updateEdited(item for item in event.modifications if not stamping.has_stamp(item, change[2])) event.addStampToAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType == 'removeStamp': self._updateEdited(item for item in event.modifications if stamping.has_stamp(item, change[2])) event.removeStampFromAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType in ('add', 'remove', 'append'): attr = change[0].descriptor.name self._updateEdited(item for item in event.modifications if not item.hasModifiedAttribute(attr)) masterItem = event.getMaster().itsItem attrName, newValue = _multiChange(masterItem, change) with EventStamp(masterItem).noRecurrenceChanges(): setattr(masterItem, attrName, newValue) return attrName elif (changeType == 'delete' and change[0].descriptor.name == EventStamp.rruleset.name): event.removeRecurrence() return EventStamp.rruleset.name else: assert False