Exemplo n.º 1
0
        private void UnnotifyUser(string message, libirc.UserInfo invoker, libirc.Target target_)
        {
            string parameter = message.Substring(message.IndexOf(" ") + 1).Trim().ToLower();

            if (String.IsNullOrEmpty(parameter))
            {
                IRC.DeliverMessage("This command requires exactly 1 parameter", target_.TargetName);
                return;
            }
            if (parameter.Contains(" "))
            {
                IRC.DeliverMessage("That's not a valid nickname (spaces present)", target_.TargetName);
                return;
            }
            foreach (Notification n in Notification.NotificationList)
            {
                if (n.Source_Name == invoker.Nick && n.Target.ToLower() == parameter)
                {
                    string original_nick = n.Target;
                    Notification.NotificationList.Remove(n);
                    IRC.DeliverMessage("You notification about " + original_nick + " was removed!", target_.TargetName);
                    return;
                }
            }
        }
Exemplo n.º 2
0
        private void NotifyUser(string message, libirc.UserInfo invoker, libirc.Target target_)
        {
            string parameter = message.Substring(message.IndexOf(" ") + 1).Trim();

            if (String.IsNullOrEmpty(parameter) != true)
            {
                string nick = parameter;
                string text = null;
                if (nick.Contains(" "))
                {
                    text = parameter.Substring(parameter.IndexOf(" ") + 1);
                    nick = nick.Substring(0, nick.IndexOf(" "));
                }
                if (nick.Contains("@"))
                {
                    IRC.DeliverMessage("I doubt that anyone could have such a nick '" + nick + "'", target_.TargetName);
                    return;
                }
                if (Notification.Contains(nick, invoker.Nick))
                {
                    IRC.DeliverMessage("You've already asked me to watch this user", target_.TargetName);
                    return;
                }
                foreach (Channel item in Configuration.ChannelList)
                {
                    if (item.ContainsUser(nick))
                    {
                        IRC.DeliverMessage("This user is now online in " + item.Name + ". I'll let you know when they show some activity (talk, etc.)", target_.TargetName);
                        lock (Notification.NotificationList)
                        {
                            Notification.NotificationList.Add(new Notification(nick, invoker.Nick, invoker.Host, text));
                        }
                        return;
                    }
                }
                lock (Notification.NotificationList)
                {
                    Notification.NotificationList.Add(new Notification(nick, invoker.Nick, invoker.Host, text));
                }
                if (text == null)
                {
                    IRC.DeliverMessage("I will let you know when I see " + nick + " around here", target_.TargetName);
                }
                else
                {
                    IRC.DeliverMessage("I will let you know when I see " + nick + " and I will deliver that message to them", target_.TargetName);
                }
            }
        }