Skip to content

Commit

Permalink
Compare cloaked email addresses for attendees.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Jul 19, 2020
1 parent 35130e4 commit eb7d47a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/OutlookGoogleCalendarSync/Console/Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public void FormatEventChanges(StringBuilder sb) {
table.Append("<tr><th class='eventChanges'>Attribute</th><th class='eventChanges'>Change</th></tr>");
for (int l = 1; l < lines.Count(); l++) {
String newRow = "<tr>";
newRow += Regex.Replace(lines[l], @"^(\w+|\w+[\s/]\w+|Attendee (added|removed|.*?Status|.*?Optional Check)):\s*", "<td class='eventChanges'>$1</td><td>");
newRow += Regex.Replace(lines[l], @"^(\w+|\w+[\s/]\w+|Attendee (added|updated|removed|.*?Status|.*?Optional Check)):\s*", "<td class='eventChanges'>$1</td><td>");
newRow = newRow.Replace("=>", "→");
table.Append(newRow + "</td></tr>");
}
Expand Down
8 changes: 6 additions & 2 deletions src/OutlookGoogleCalendarSync/GoogleOgcs/EventAttendee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@ public EventAttendee(Google.Apis.Calendar.v3.Data.EventAttendee baseAttendee) {

public new String Email {
get { return decloakEmail(base.Email); }
set { base.Email = cloakEmail(value); }
set { base.Email = CloakEmail(value); }
}

private static String decloakEmail(String email) {
if (string.IsNullOrWhiteSpace(email)) return email;
if (email.EndsWith(EmailCloak)) return email.Substring(0, email.Length - EmailCloak.Length);
return email;
}
private static String cloakEmail(String email) {
public static String CloakEmail(String email) {
if (string.IsNullOrWhiteSpace(email)) return email;
String decloakedEmail = decloakEmail(email);
return (decloakedEmail + (Settings.Instance.CloakEmail ? EmailCloak : ""));
}

public Boolean IsCloaked() {
return (base.Email.EndsWith(EmailCloak));
}
}
}
5 changes: 5 additions & 0 deletions src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,11 @@ public Boolean CompareRecipientsToAttendees(AppointmentItem ai, Event ev, String
foundAttendee = true;
removeAttendee.Remove(attendee);

if (Settings.Instance.CloakEmail != ogcsAttendee.IsCloaked()) {
Sync.Engine.CompareAttribute("Attendee updated", Sync.Direction.OutlookToGoogle, attendee.Email, EventAttendee.CloakEmail(attendee.Email), sb, ref itemModified);
attendee.Email = EventAttendee.CloakEmail(attendee.Email);
}

//Optional attendee
bool oOptional = (recipient.Type == (int)OlMeetingRecipientType.olOptional);
bool gOptional = (attendee.Optional == null) ? false : (bool)attendee.Optional;
Expand Down

0 comments on commit eb7d47a

Please sign in to comment.