GetMessage() public static method

Called when someone post a message to server
public static GetMessage ( string channel, string nick, string host, string message ) : bool
channel string Channel
nick string Nick
host string Host
message string Message
return bool
Example #1
0
        protected override void __evt_PRIVMSG(NetworkPRIVMSGEventArgs args)
        {
            if (Configuration.IgnoredHostmasks.Contains(args.SourceInfo.Host))
            {
                // messages from this user are ignored
                return;
            }

            if (args.ChannelName == null)
            {
                // private message
                // store which instance this message was from so that we can send it using same instance
                lock (Instance.TargetBuffer)
                {
                    if (!Instance.TargetBuffer.ContainsKey(args.SourceInfo.Nick))
                    {
                        Instance.TargetBuffer.Add(args.SourceInfo.Nick, this.instance);
                    }
                    else
                    {
                        Instance.TargetBuffer[args.SourceInfo.Nick] = this.instance;
                    }
                }
                string modules = "";
                bool   respond = !Commands.Trusted(args.Message, args.SourceInfo.Nick, args.SourceInfo.Host);
                if (!respond)
                {
                    modules += "@trusted ";
                }
                foreach (Module module in ExtensionHandler.ExtensionList)
                {
                    if (module.IsWorking)
                    {
                        try
                        {
                            if (module.Hook_OnPrivateFromUser(args.Message, args.SourceInfo))
                            {
                                respond  = false;
                                modules += module.Name + " ";
                            }
                        }
                        catch (Exception fail)
                        {
                            Core.HandleException(fail);
                        }
                    }
                }
                if (respond)
                {
                    IRC.DeliverMessage("Hi, I am a robot, this command was not understood." +
                                       " Please bear in mind that every message you send" +
                                       " to me will be logged for debugging purposes. See" +
                                       " documentation for the bot at http://meta.wikimedia.org/wiki" +
                                       "/wm-bot for explanation of the bot's commands.", args.SourceInfo,
                                       libirc.Defs.Priority.Low);
                    Syslog.Log("Ignoring private message: (" + args.SourceInfo.Nick + ") " + args.Message, false);
                }
                else
                {
                    modules = Core.Trim(modules);
                    Syslog.Log("Private message: (handled by " + modules + " from " + args.SourceInfo.Nick + ") " +
                               args.Message, false);
                }
            }
            else
            {
                if (args.ChannelName == Configuration.System.DebugChan && this.instance != Instance.PrimaryInstance)
                {
                    return;
                }
                if (args.IsAct)
                {
                    Core.GetAction(args.Message, args.ChannelName, args.SourceInfo.Host, args.SourceInfo.Nick);
                    return;
                }
                Core.GetMessage(args.ChannelName, args.SourceInfo.Nick, args.SourceInfo.Host, args.Message);
            }
        }