Exemplo n.º 1
0
        private string InternalHandleNotificationsCommand(MsnConversation msnConversation, IList <string> arguments)
        {
            string contactMail = msnConversation.Contact.Account;

            lock (_notificationsLock)
            {
                EnsureNotificationContactFilter();

                bool   settingChanged = false;
                string onOff          = arguments.Count > 0 ? arguments[0].Trim() : String.Empty;
                if (onOff == "off")
                {
                    settingChanged = _notificationContactFilter.AddAddress(contactMail);
                }
                else if (onOff == "on")
                {
                    settingChanged = _notificationContactFilter.RemoveAddress(contactMail);
                }
                if (settingChanged)
                {
                    using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                    {
                        configurationAgent.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, _notificationContactFilter.ToString());
                    }
                }
                return(_notificationContactFilter.ContainsAddress(contactMail) ? "Notifications are off." : "Notifications are on.");
            }
        }
Exemplo n.º 2
0
        private string InternalHandleAlertsCommand(MsnConversation msnConversation, IList <string> arguments)
        {
            string contactMail = msnConversation.Contact.Account;

            lock (_alertsLock)
            {
                EnsureAlertContactFilter();

                bool   settingChanged = false;
                string onOff          = arguments.Count > 0 ? arguments[0].Trim() : String.Empty;
                if (onOff == "off")
                {
                    settingChanged = _alertContactFilter.AddAddress(contactMail);
                }
                else if (onOff == "on")
                {
                    settingChanged = _alertContactFilter.RemoveAddress(contactMail);
                }
                if (settingChanged)
                {
                    Proxies.ConfigurationService.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAlertFilterList, _alertContactFilter.ToString()).Wait();
                }
                return(_alertContactFilter.ContainsAddress(contactMail) ? "Alerts are off." : "Alerts are on.");
            }
        }