Ejemplo n.º 1
0
        static public void PrivmsgAction(Message message)
        {
            if (message.ParamsArray[1] == ContextCollection.Server.Client.Nickname) // Private message
            {
                var ctx = ContextCollection.GetByName(message.Nick);

                if (ctx != null)
                {
                    ctx.WriteMessage(message.Nick, message.Text);
                }
                else
                {
                    IrcQuery query = new IrcQuery(message.Nick);

                    ContextCollection.Add(query, true);
                    query.WriteMessage(message.Nick, message.Text);
                }
            }
            else // Channel
            {
                var ctx = ContextCollection.GetByName(message.ParamsArray[1]);

                if (ctx != null)
                {
                    ctx.WriteMessage(message.Nick, message.Text);
                }
            }
        }
Ejemplo n.º 2
0
        static public void QueryCommand(string _params)
        {
            Match m = Regex.Match(_params.Trim(), @"^([A-Za-z0-9_\-\[\]\\^{}|`]+)$");

            if (m.Groups[1] == null || m.Groups[1].Value.Length == 0)
            {
                ContextCollection.Current.WriteLine("Usage: /query [<nickname>]");
                return;
            }

            var ctx = ContextCollection.GetByName(m.Groups[1].Value);

            if (ctx == null)
            {
                IrcQuery query = new IrcQuery(m.Groups[1].Value);
                ContextCollection.Add(query);
            }
            else
            {
                ContextCollection.Current = ctx;
                Program.MainWindow.UpdateContext();
            }
        }