Exemplo n.º 1
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.");
            }
        }
Exemplo n.º 2
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.º 3
0
        public static string HandleNotificationsCommand(object conversation, IList <string> arguments)
        {
            MsnConversation msnConversation = conversation as MsnConversation;

            if (_msnThread != null &&
                msnConversation != null)
            {
                return(_msnThread.InternalHandleNotificationsCommand(msnConversation, arguments));
            }
            return(String.Empty);
        }
Exemplo n.º 4
0
        private MsnConversation AddConversation(Contact contact)
        {
            MsnConversation msnConversation = new MsnConversation(_messenger, _imCommands, contact);

            if (_msnConversations.ContainsKey(msnConversation.Contact.Guid))
            {
                RemoveConversation(msnConversation.Contact.Guid);
            }
            _msnConversations.Add(msnConversation.Contact.Guid, msnConversation);

            return(msnConversation);
        }
Exemplo n.º 5
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)
                {
                    Proxies.ConfigurationService.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, _notificationContactFilter.ToString()).Wait();
                }
                return _notificationContactFilter.ContainsAddress(contactMail) ? "Notifications are off." : "Notifications are on.";
            }
        }
Exemplo n.º 6
0
        private void BroadcastMessage(Contact contact, IMBotMessage message)
        {
            MsnConversation conversation = _msnConversations.EnsureConversation(contact);

            conversation.SendTextMessage(message.ToMsnMessage());
        }
Exemplo n.º 7
0
        private void MessageManager_TextMessageReceived(object sender, TextMessageArrivedEventArgs e)
        {
            MsnConversation conversation = _msnConversations.EnsureConversation(e.Sender);

            conversation.HandleIncomingMessage(e.TextMessage);
        }
        private MsnConversation AddConversation(Contact contact)
        {
            MsnConversation msnConversation = new MsnConversation(_messenger, _imCommands, contact);

            if (_msnConversations.ContainsKey(msnConversation.Contact.Guid))
            {
                RemoveConversation(msnConversation.Contact.Guid);
            }
            _msnConversations.Add(msnConversation.Contact.Guid, msnConversation);

            return msnConversation;
        }
Exemplo n.º 9
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)
                {
                    using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                    {
                        configurationAgent.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAlertFilterList, _alertContactFilter.ToString());
                    }
                }
                return _alertContactFilter.ContainsAddress(contactMail) ? "Alerts are off." : "Alerts are on.";
            }
        }