public void DisableOof() { ExTraceGlobals.UserOptionsCallTracer.TraceDebug((long)this.GetHashCode(), "OptionsEventHandler.DisableOof"); UserOofSettings userOofSettings = UserOofSettings.GetUserOofSettings(base.UserContext.MailboxSession); userOofSettings.OofState = OofState.Disabled; userOofSettings.Save(base.UserContext.MailboxSession); }
protected override void InternalSave(ConfigurableObject instance) { MailboxAutoReplyConfiguration mailboxAutoReplyConfiguration = (MailboxAutoReplyConfiguration)instance; UserOofSettings userOofSettings = UserOofSettings.GetUserOofSettings(base.MailboxSession); if (userOofSettings == null) { userOofSettings = UserOofSettings.CreateDefault(); } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.AutoReplyState)) { userOofSettings.OofState = mailboxAutoReplyConfiguration.AutoReplyState; } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.ExternalAudience)) { userOofSettings.ExternalAudience = mailboxAutoReplyConfiguration.ExternalAudience; } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.ExternalMessage)) { userOofSettings.ExternalReply.Message = mailboxAutoReplyConfiguration.ExternalMessage; userOofSettings.ExternalReply.LanguageTag = Thread.CurrentThread.CurrentCulture.Name; } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.InternalMessage)) { userOofSettings.InternalReply.Message = mailboxAutoReplyConfiguration.InternalMessage; userOofSettings.InternalReply.LanguageTag = Thread.CurrentThread.CurrentCulture.Name; } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.StartTime)) { userOofSettings.Duration.StartTime = mailboxAutoReplyConfiguration.StartTime.ToUniversalTime(); } if (mailboxAutoReplyConfiguration.IsModified(MailboxAutoReplyConfigurationSchema.EndTime)) { userOofSettings.Duration.EndTime = mailboxAutoReplyConfiguration.EndTime.ToUniversalTime(); } try { userOofSettings.Save(base.MailboxSession); } catch (ObjectExistedException) { userOofSettings.Save(base.MailboxSession); } }
// Token: 0x06001BCB RID: 7115 RVA: 0x0006B1A4 File Offset: 0x000693A4 protected override bool InternalExecute() { MailboxSession mailboxIdentityMailboxSession = base.CallContext.SessionCache.GetMailboxIdentityMailboxSession(); UserOofSettings userOofSettings = UserOofSettings.GetUserOofSettings(mailboxIdentityMailboxSession); userOofSettings.OofState = (this.userOofSettings.IsOofOn ? OofState.Enabled : OofState.Disabled); userOofSettings.ExternalAudience = this.userOofSettings.ExternalAudience; userOofSettings.InternalReply.Message = UserOofSettingsType.ConvertTextToHtml(this.userOofSettings.InternalReply); userOofSettings.ExternalReply.Message = UserOofSettingsType.ConvertTextToHtml(this.userOofSettings.ExternalReply); userOofSettings.Save(mailboxIdentityMailboxSession); return true; }
// Token: 0x06000D76 RID: 3446 RVA: 0x0004A270 File Offset: 0x00048470 private void ProcessSet(XmlNode setNode) { using (Command.CurrentCommand.Context.Tracker.Start(TimeId.OOFSettingsProcessSet)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing Oof - Set"); UserOofSettings userOofSettings = UserOofSettings.GetUserOofSettings(this.mailboxSession); bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; foreach (object obj in setNode.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; if (this.status != SettingsBase.ErrorCode.Success) { break; } string localName; if ((localName = xmlNode.LocalName) != null) { if (localName == "OofState") { string innerText = xmlNode.InnerText; string a; if ((a = innerText) != null) { if (a == "0") { userOofSettings.OofState = OofState.Disabled; continue; } if (a == "1") { userOofSettings.OofState = OofState.Enabled; continue; } if (a == "2") { userOofSettings.OofState = OofState.Scheduled; continue; } } this.status = SettingsBase.ErrorCode.ProtocolError; continue; } if (localName == "StartTime") { string innerText2 = xmlNode.InnerText; if (userOofSettings.Duration == null) { userOofSettings.Duration = new Duration((DateTime)ExDateTime.UtcNow, (DateTime)ExDateTime.UtcNow); } userOofSettings.Duration.StartTime = this.DecodeDateTime(innerText2); flag = true; continue; } if (localName == "EndTime") { string innerText3 = xmlNode.InnerText; if (userOofSettings.Duration == null) { userOofSettings.Duration = new Duration((DateTime)ExDateTime.UtcNow, (DateTime)ExDateTime.UtcNow); } userOofSettings.Duration.EndTime = this.DecodeDateTime(innerText3); flag2 = true; continue; } if (localName == "OofMessage") { OofSetting.OofMessage oofMessage; oofMessage.Enabled = false; oofMessage.ReplyMessage = null; oofMessage.BodyType = null; oofMessage.AppliesToInternal = false; oofMessage.AppliesToExternalKnown = false; oofMessage.AppliesToExternalUnknown = false; foreach (object obj2 in xmlNode.ChildNodes) { XmlNode xmlNode2 = (XmlNode)obj2; if (this.status != SettingsBase.ErrorCode.Success) { break; } string localName2; switch (localName2 = xmlNode2.LocalName) { case "AppliesToInternal": if (flag3) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } flag3 = true; oofMessage.AppliesToInternal = true; continue; case "AppliesToExternalKnown": if (flag4) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } oofMessage.AppliesToExternalKnown = true; continue; case "AppliesToExternalUnknown": if (flag6) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } oofMessage.AppliesToExternalUnknown = true; continue; case "Enabled": if (xmlNode2.InnerText.Equals("1", StringComparison.OrdinalIgnoreCase)) { oofMessage.Enabled = true; continue; } continue; case "ReplyMessage": oofMessage.ReplyMessage = xmlNode2.InnerText; continue; case "BodyType": oofMessage.BodyType = xmlNode2.InnerText; continue; } this.status = SettingsBase.ErrorCode.ProtocolError; } if (this.status != SettingsBase.ErrorCode.Success) { continue; } if (oofMessage.ReplyMessage != null) { if (oofMessage.BodyType == null) { this.status = SettingsBase.ErrorCode.ProtocolError; continue; } if (oofMessage.BodyType.Equals("TEXT", StringComparison.OrdinalIgnoreCase)) { oofMessage.ReplyMessage = OofSetting.InternalTextToHtml(oofMessage.ReplyMessage); oofMessage.BodyType = "HTML"; } if (!oofMessage.BodyType.Equals("HTML", StringComparison.OrdinalIgnoreCase)) { this.status = SettingsBase.ErrorCode.InvalidArguments; continue; } } if (oofMessage.AppliesToInternal) { if (oofMessage.Enabled) { userOofSettings.InternalReply.Message = oofMessage.ReplyMessage; } else { userOofSettings.InternalReply.Message = string.Empty; } } if (oofMessage.AppliesToExternalKnown && oofMessage.AppliesToExternalUnknown) { if (flag4 || flag6) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } if (oofMessage.Enabled) { userOofSettings.ExternalReply.Message = oofMessage.ReplyMessage; userOofSettings.ExternalAudience = ExternalAudience.All; flag5 = true; flag7 = true; flag4 = true; flag6 = true; continue; } userOofSettings.ExternalReply.Message = string.Empty; userOofSettings.ExternalAudience = ExternalAudience.None; flag4 = true; flag6 = true; continue; } else if (oofMessage.AppliesToExternalKnown) { if (oofMessage.Enabled) { if (flag6) { if (!string.Equals(oofMessage.ReplyMessage, userOofSettings.ExternalReply.Message, StringComparison.Ordinal)) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } userOofSettings.ExternalAudience = ExternalAudience.All; } else { userOofSettings.ExternalReply.Message = oofMessage.ReplyMessage; userOofSettings.ExternalAudience = ExternalAudience.Known; } flag5 = true; flag4 = true; continue; } if (flag6 && flag7) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } userOofSettings.ExternalAudience = ExternalAudience.None; flag4 = true; continue; } else { if (!oofMessage.AppliesToExternalUnknown) { continue; } if (oofMessage.Enabled) { if (flag4) { if (!string.Equals(oofMessage.ReplyMessage, userOofSettings.ExternalReply.Message, StringComparison.Ordinal)) { this.status = SettingsBase.ErrorCode.ConflictingArguments; continue; } userOofSettings.ExternalAudience = ExternalAudience.All; } else { userOofSettings.ExternalReply.Message = oofMessage.ReplyMessage; userOofSettings.ExternalAudience = ExternalAudience.All; } flag7 = true; flag6 = true; continue; } if (flag4 && flag5) { userOofSettings.ExternalAudience = ExternalAudience.Known; } else { userOofSettings.ExternalAudience = ExternalAudience.None; } flag6 = true; continue; } } } this.status = SettingsBase.ErrorCode.ProtocolError; } if (this.status == SettingsBase.ErrorCode.Success && (flag ^ flag2)) { this.status = SettingsBase.ErrorCode.ProtocolError; } if (this.status == SettingsBase.ErrorCode.Success && userOofSettings.OofState == OofState.Scheduled && (userOofSettings.Duration == null || userOofSettings.Duration.EndTime <= userOofSettings.Duration.StartTime || userOofSettings.Duration.EndTime <= DateTime.UtcNow)) { this.status = SettingsBase.ErrorCode.ConflictingArguments; } if (this.status == SettingsBase.ErrorCode.Success) { userOofSettings.Save(this.mailboxSession); AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Done processing Oof - Set."); } } }