This layer is an event driven high-level API with all features you could need for IRC programming.
Inheritance: Meebey.SmartIrc4net.IrcCommands
Exemple #1
0
        public static void get(string[] args, string Channel, string Nick, IrcClient irc)
        {
            DateTime time = DateTime.Now;
            string message = string.Empty;
            bool tellCheck = false;

            MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
            command.CommandText = "SELECT Nick_To,Nick_From,Message,Time FROM tell where Nick_To='" + Nick.ToLower() + "'";
            try { Program.GlobalVar.conn.Open(); }
            catch (Exception e) { Console.WriteLine(e.Message); }
            MySqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                if (reader["Nick_To"].ToString() == Nick.ToLower())
                {
                    tellCheck = true;
                    //Compose output
                    TimeSpan elapsed = time.Subtract(DateTime.Parse(reader["Time"].ToString()));
                    message = String.Format("({0:%d} days, {1:%h} hours, {2:%m} minutes) Sent from {3} -- {4}", elapsed, elapsed, elapsed, reader["Nick_From"].ToString(), reader["Message"].ToString());
                    //send output
                    irc.SendMessage(SendType.Message, Nick, message);

                    try { Program.GlobalVar.tellList.Remove(Nick); }
                    catch { }
                }
            }
            Program.GlobalVar.conn.Close();

            command.CommandText = "DELETE FROM tell WHERE Nick_To='" + Nick.ToLower() + "'";
            Program.GlobalVar.conn.Open();
            command.ExecuteNonQuery();
            Program.GlobalVar.conn.Close();

            if (tellCheck == false) { irc.SendMessage(SendType.Message, Nick, String.Format("I don't have any messages for you sir")); }
        }
Exemple #2
0
        public static void set(string[] args, string Channel, string Nick, IrcClient irc)
        {
            DateTime tellTime = DateTime.Now;
            string message = string.Empty;

            if (args.Length == 1 || args.Length == 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "tell <nick> <message>", Nick)); }
            else
            {
                foreach (string s in args)
                    message += s + " ";
                message = message.Substring(args[0].Length + args[1].Length + 2);
                message = message.TrimEnd(' ');

                MySqlCommand command = Program.GlobalVar.conn.CreateCommand();

                Program.GlobalVar.conn.Open();
                command.Connection = Program.GlobalVar.conn;
                command.CommandText = "INSERT into tell VALUES(@to,@from,@message,@time)";
                command.Prepare();

                command.Parameters.AddWithValue("@to", args[1].ToLower());
                command.Parameters.AddWithValue("@from", Nick);
                command.Parameters.AddWithValue("@message", message);
                command.Parameters.AddWithValue("@time", tellTime.ToString());

                command.ExecuteNonQuery();
                Program.GlobalVar.conn.Close();

                try { Program.GlobalVar.tellList.Add(args[1].ToLower()); }
                catch { }

                Console.WriteLine("{0} has left a message for {1}", Nick, args[1]);
                irc.SendMessage(SendType.Message, Channel, String.Format("I will pass that along sir"));
            }
        }
Exemple #3
0
 public static void command(string trigger, string Channel, string Nick, IrcClient irc)
 {
     //first make sure the trigger exists
     bool remCheck = false;
     bool global = false;
     bool lck = false;
     MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
     command.CommandText = "SELECT Trig,Channel,Nick,Time,lck FROM rem where Trig='" + trigger + "'";
     try { Program.GlobalVar.conn.Open(); }
     catch (Exception e) { Console.WriteLine(e.Message); }
     MySqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         if (reader["Trig"].ToString() == trigger && (reader["Channel"].ToString() == Channel.ToLower() || reader["channel"].ToString() == "global"))
         {
             remCheck = true;
             if (reader["Channel"].ToString() == "global")
                 global = true;
             if (Convert.ToInt32(reader["lck"]) == 1)
                 lck = true;
             irc.SendMessage(SendType.Message, Channel, String.Format("{0} was set by {1} at {2} (G={3}/L={4})", trigger, reader["Nick"].ToString(), reader["Time"].ToString(), global, lck));
             global = false;
             lck = false;
         }
     }
     Program.GlobalVar.conn.Close();
     //get info
     if (remCheck == false) { irc.SendMessage(SendType.Notice, Nick, String.Format("I don't have anything stored for {0} sir", trigger)); }
 }
Exemple #4
0
        //addquote <name> <message>
        public static void set(string[] args, string Channel, string Nick, IrcClient irc)
        {
            if (args.Length <= 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "addquote <nick> <message>", Nick)); }
            else
            {
                MySqlCommand command = Program.GlobalVar.conn.CreateCommand();

                //rebuild message
                string message = string.Empty;
                foreach (string s in args)
                    message += s + " ";
                message = message.Substring(args[0].Length + args[1].Length + 2);
                message = message.TrimEnd(' ');

                try
                {
                    Program.GlobalVar.conn.Open();
                    command.Connection = Program.GlobalVar.conn;
                    command.CommandText = "INSERT into quote VALUES(@nick,@message)";
                    command.Prepare();

                    command.Parameters.AddWithValue("@nick", args[1]);
                    command.Parameters.AddWithValue("@message", message);

                    command.ExecuteNonQuery();
                    Program.GlobalVar.conn.Close();

                    irc.SendMessage(SendType.Message, Channel, String.Format("I have added the quote sir, I hope it is very embarrassing"));
                }
                catch (Exception e) { Botler.Utilities.TextFormatting.ConsoleERROR(e.Message + "\n"); }
            }
        }
        public SparkleListenerIrc(string server, string folder_identifier, NotificationServerType type)
            : base(server, folder_identifier, type)
        {
            base.server = server;

            // Try to get a uniqueish nickname
            this.nick = SHA1 (DateTime.Now.ToString ("ffffff") + "sparkles");

            // Most irc servers don't allow nicknames starting
            // with a number, so prefix an alphabetic character
            this.nick = "s" + this.nick.Substring (0, 7);

            base.channels.Add ("#" + folder_identifier);

            this.client = new IrcClient () {
                PingTimeout  = 180,
                PingInterval = 90
            };

            this.client.OnConnected += delegate {
                base.is_connecting = false;
                OnConnected ();
            };

            this.client.OnDisconnected += delegate {
                OnDisconnected ();
            };

            this.client.OnChannelMessage += delegate (object o, IrcEventArgs args) {
                string message = args.Data.Message.Trim ();
                string folder_id = args.Data.Channel.Substring (1); // remove the starting hash
                OnRemoteChange (new SparkleAnnouncement (folder_id, message));
            };
        }
Exemple #6
0
 //https://developers.google.com/youtube/2.0/developers_guide_dotnet
 public static void command(string[] args, string Channel, string Nick, IrcClient irc)
 {
     if (args.Length == 1)
     {
         irc.SendMessage(SendType.Message, Channel, string.Format("{0}, Usage: $youtube [flag] <search term(s)>", Nick));
     }
     else
     {
         string strVideo = string.Empty;
         string flag = string.Empty;
         if (args[1].StartsWith("+"))
         {
             for (int i = 2; i < args.Length; i++)
             {
                 strVideo += args[i] + ' ';
             }
             strVideo = strVideo.TrimEnd();
             flag = args[1];
         }
         else
         {
             foreach (string ss in args)
                 strVideo += ss + ' ';
             strVideo = strVideo.Substring(args[0].Length + 1);
             strVideo = strVideo.TrimEnd(' ');
         }
         string videoOutput = YoutubeOutput(strVideo, flag);
         irc.SendMessage(SendType.Message, Channel, string.Format("{0}: {1}", Nick, videoOutput));
     }
 }
Exemple #7
0
        public static void getQuiet(string[] args, string Channel, string Nick, IrcClient irc)
        {
            if (args.Length > 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "getQuiet [#channel]", Nick)); }
            else
            {
                string quietChan = Channel;
                bool chanCheck = false;
                if (args.Length == 2) { quietChan = args[1]; }

                if (quietChan.StartsWith("#"))
                {
                    MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
                    command.CommandText = "SELECT Channel,Quiet FROM channels WHERE Channel='" + quietChan.ToLower() + "'";
                    try { Program.GlobalVar.conn.Open(); }
                    catch (Exception e) { Console.WriteLine(e.Message); }
                    MySqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader["Channel"].ToString() == quietChan.ToLower())
                        {
                            if (Convert.ToInt32(reader["Quiet"]) == 0) { irc.SendMessage(SendType.Notice, Nick, String.Format("{0} is currently set to Not Quiet", Channel)); }
                            else { irc.SendMessage(SendType.Notice, Nick, String.Format("{0} is currently set to Quiet", Channel)); }
                            chanCheck = true;
                        }
                    }
                    Program.GlobalVar.conn.Close();
                    if (chanCheck == false) { irc.SendMessage(SendType.Notice, Nick, String.Format("I don't have data on that channel sir")); }
                }
                else { irc.SendMessage(SendType.Message, Channel, String.Format("Please input a valid channel name sir")); }
            }
        }
Exemple #8
0
 public static void change(string[] args, string Channel, string Nick, IrcClient irc)
 {
     if (args.Length != 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "nick <new nick>", Nick)); }
     {
         irc.RfcNick(args[1]);
     }
 }
Exemple #9
0
        public static IrcClient getInstance()
        {
            if (instance == null)
                instance = new IrcClient();

            return instance;
        }
        public BackgroundWorkerThread(string perryver, string nick, int wait)
        {
            //this.mw = mw;
            this.perryver = perryver;
            this.ourNick = nick;
            this.waitTime = wait;

            Random r = new Random(DateTime.Now.Millisecond);
            string bleh = "";

            bleh = nick;
            if (bleh.Length > 6) bleh = bleh.Substring(0, 6);
            else if (bleh == "") bleh = "ps";

            ourNick = bleh + r.Next(9999).ToString();

            client = new IrcClient();
            client.Encoding = Encoding.UTF8;
            client.OnChannelMessage += new IrcEventHandler(client_OnChannelMessage);

            t = new Thread(new ThreadStart(ListenIRC));
            t.Priority = ThreadPriority.Lowest;
            t.IsBackground = true;
            t.Start();
        }
Exemple #11
0
        //blacklist <nick> <host>
        public static void set(string[] args, string Channel, string Nick, IrcClient irc)
        {
            if (args.Length != 3) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "blacklist <nick> <host>", Nick)); }
            else
            {
                MySqlCommand command = Program.GlobalVar.conn.CreateCommand();

                try
                {
                    Program.GlobalVar.conn.Open();
                    command.Connection = Program.GlobalVar.conn;
                    command.CommandText = "INSERT into blacklist VALUES(@nick,@host)";
                    command.Prepare();

                    command.Parameters.AddWithValue("@nick", args[1].ToLower());
                    command.Parameters.AddWithValue("@host", args[2]);

                    command.ExecuteNonQuery();
                    Program.GlobalVar.conn.Close();

                    irc.SendMessage(SendType.Message, Channel, String.Format("I have added {0}@{1} to the blacklist sir, we don't want naughty people using me", args[1].ToLower(), args[2]));
                    Console.WriteLine("{0} was added to the blacklist", args[1].ToLower());
                }
                catch (Exception e) { Botler.Utilities.TextFormatting.ConsoleERROR(e.Message + "\n"); }
            }
        }
Exemple #12
0
        public static void command(string[] args, string Channel, string Nick, IrcClient irc)
        {
            if (args.Length > 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "chanop [#channel]", Nick)); }
            else
            {
                string opChan = Channel;
                bool chanCheck = false;
                if (args.Length == 2) { opChan = args[1]; }

                if (opChan.StartsWith("#"))
                {
                    MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
                    command.CommandText = "SELECT Channel,ChanOP FROM channels WHERE Channel='" + opChan.ToLower() + "'";
                    try { Program.GlobalVar.conn.Open(); }
                    catch (Exception e) { Console.WriteLine(e.Message); }
                    MySqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader["Channel"].ToString() == opChan.ToLower())
                        {
                            irc.SendMessage(SendType.Message, Channel, String.Format("The Channel Operator for {0} is {1}", opChan, reader["ChanOP"].ToString()));
                            chanCheck = true;
                        }
                    }
                    Program.GlobalVar.conn.Close();
                    if (chanCheck == false) { irc.SendMessage(SendType.Message, Channel, String.Format("I don't have data for that channel sir")); }
                }
                else { irc.SendMessage(SendType.Message, Channel, String.Format("Please input a valid channel name sir")); }
            }
        }
Exemple #13
0
        public Ralph(String _channel,String _token,String _name)
        {
            
            this._token = "oauth:"+_token;
            this._channel = _channel;
            this._name = "AneleBot";

            _client = new IrcClient()
            {
                Encoding = Encoding.UTF8,
                ActiveChannelSyncing = true,
                SendDelay = 5000,
                AutoRejoin = true,
                AutoRejoinOnKick = true,
                AutoReconnect = true,
                AutoRelogin = true,
                AutoRetry = true,
                AutoRetryLimit = 0
            };
            _client.OnChannelMessage+=onMessage;
            _client.OnRawMessage += logMessage;
            _handler = new RHandler(this);

            DumberLogger.Log("Ralph: ralph got created");
        }
Exemple #14
0
        public RelayConsole(RadegastInstance instance)
            : base(instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(RelayConsole_Disposed);
            textPrinter = new RichTextBoxPrinter(rtbChatText);

            irc = new IrcClient();
            irc.SendDelay = 200;
            irc.AutoReconnect = true;
            irc.CtcpVersion = Properties.Resources.RadegastTitle;
            irc.Encoding = Encoding.UTF8;

            TC.OnTabAdded += new TabsConsole.TabCallback(TC_OnTabAdded);
            TC.OnTabRemoved += new TabsConsole.TabCallback(TC_OnTabRemoved);
            irc.OnError += new ErrorEventHandler(irc_OnError);
            irc.OnRawMessage += new IrcEventHandler(irc_OnRawMessage);
            irc.OnChannelMessage += new IrcEventHandler(irc_OnChannelMessage);
            irc.OnConnected += new EventHandler(irc_OnConnected);
            irc.OnDisconnected += new EventHandler(irc_OnDisconnected);

            client.Self.IM += new EventHandler<InstantMessageEventArgs>(Self_IM);

            RefreshGroups();
        }
Exemple #15
0
        public void Connect()
        {
            IrcClient = new IrcClient();
            IrcClient.OnConnected += OnConnected;
            IrcClient.OnConnecting += OnConnecting;
            IrcClient.OnDisconnected += OnDisconnected;
            //IrcClient.OnReadLine += OnReadLine;
            IrcClient.OnPing += OnPing;
            IrcClient.OnRawMessage += OnRawMessage;

            IrcClient.AutoRetry = Convert.ToBoolean(Connection.auto_retry);
            IrcClient.AutoRetryDelay = Convert.ToInt32(Connection.auto_retry_delay);
            IrcClient.AutoReconnect = Convert.ToBoolean(Connection.auto_reconnect);
            IrcClient.AutoRelogin = Convert.ToBoolean(Connection.auto_relogin);
            IrcClient.AutoRejoin = Convert.ToBoolean(Connection.auto_rejoin);
            IrcClient.AutoRejoinOnKick = Convert.ToBoolean(Connection.auto_rejoin_on_kick);
            IrcClient.AutoNickHandling = Convert.ToBoolean(Connection.auto_nick_handling);

            try
            {
                IrcClient.Connect(Connection.hostname, Convert.ToInt32(Connection.port));
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to connect: " + e.Message);
            }
        }
        public ClientInterface(IrcLoginCreds loginCreds, List<IrcComponent> auxComponents)
        {
            KillClient = false;
            Client = new IrcClient();
            Client.SendDelay = 200;
            Client.ActiveChannelSyncing = true;
            //Client.AutoRetry = true;
            _loginCreds = loginCreds;
            Client.CtcpVersion = "Pikatwo - Interactive chatbot with lifelike texture by zalzane.";

            _authenticator = new Authenticator();

            _components = auxComponents;
            _components.Add(_authenticator);
            _components.Add(new Reconnector());

            foreach (var component in _components){
                component.IrcInterface = this;
            }

            Client.OnChannelMessage += HandleCommands;
            Client.OnQueryMessage += HandleCommands;
            Client.OnRawMessage += ClientOnOnRawMessage;

            _debugWriter = new StreamWriter("debugOut.txt", true);
            _rawWriter = new StreamWriter("rawOut.txt", true);
        }
Exemple #17
0
        public static void sendAll(string[] args, string Channel, string Nick, IrcClient irc)
        {
            if (args.Length == 1) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "broadcast <message>", Nick)); }
            else
            {
                string msg = string.Empty;
                foreach (string s in args)
                    msg += s + " ";
                msg = msg.Substring(args[0].Length + args[1].Length + 2);
                msg.TrimEnd(' ');

                //white text on red background
                if (args[1] == "emergency")
                {
                    msg = Utilities.TextFormatting.Bold(((char)3 + "0,4" + msg + (char)3 + "0,4"));
                }
                //will add more later

                MySqlCommand command = Program.GlobalVar.conn.CreateCommand();
                command.CommandText = "SELECT Channel FROM channels";
                try { Program.GlobalVar.conn.Open(); }
                catch (Exception e) { Console.WriteLine(e.Message); }
                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    irc.SendMessage(SendType.Message, reader["Channel"].ToString(), msg);
                }
                Program.GlobalVar.conn.Close();
            }
        }
Exemple #18
0
 public static void exit(string Channel, string nick, IrcClient irc)
 {
     irc.SendMessage(SendType.Message, Channel, String.Format("Goodbye cruel world..."));
     Program.GlobalVar.active = false;
     irc.Disconnect();
     Program.Exit();
 }
        public SparkleListener(string server, string channel, string nick)
        {
            Server  = server;
            Channel = channel;
            Nick    = nick;

            if (!Nick.Equals (""))
                Nick = nick.Replace ("@", "_at_").Replace (".", "_dot_");
            else
                Nick = "anonymous";

            // Keep the nick short
            if (Nick.Length > 9)
                Nick = Nick.Substring (0, 9);

            // TODO: Remove these hardcoded values
            Channel = "#sparkletest";
            Server  = "irc.gnome.org";

            Client = new IrcClient () {
                PingTimeout          = 120,
                SocketSendTimeout    = 120,
                SocketReceiveTimeout = 120,
                AutoRetry            = true,
                AutoReconnect        = true,
                AutoRejoin           = true
            };
        }
Exemple #20
0
 public static void ident(string[] args, string Channel, string Nick, IrcClient irc)
 {
     if (args.Length != 2) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "ident <password>", Nick)); }
     {
         irc.SendMessage(SendType.Message, "NickServ", String.Format("identify {0}", args[1]));
     }
 }
Exemple #21
0
 //todo
 //1. search by index - DONE
 //2. add - DONE
 //3. random - DONE
 //4. multiline display - DONE
 //5. search by text - DONE
 //6. delete - DONE
 //7. help - DONE
 //8. popularity - DONE
 //9. multiline submission
 //10. browse by text (random quote with search term in it) - DONE
 //11. multiple person deletion - DONE
 public Quote(IrcClient irc)
 {
     _irc = irc;
     _store = new QuoteStore(_storeFileName);
     _quotes = _store.Load();
     _rng = new Random((int)DateTime.Now.Ticks);
     _last20QuoteIds = new List<int>();
 }
Exemple #22
0
 public ClientModule(string name)
 {
     this.name = name;
     this.enabled = true;
     this.client = Client.getInstance();
     this.globalStorage = GlobalStorage.getInstance();
     this.log = Log.getInstance();
 }
Exemple #23
0
        /// <summary>
        /// Creates and sets up an IrcClient instance and connects to a server according to "server"
        /// </summary>
        public void Connect(ServerDescriptor server)
        {
            if (server == null)
                throw new ArgumentNullException("server");

            IrcClient irc = new IrcClient();

            // Settings
            irc.AutoReconnect = true;
            irc.Encoding = System.Text.Encoding.UTF8;
            irc.SendDelay = config.GetInt("send-delay", 200);
            irc.ActiveChannelSyncing = config.GetBoolean("use-active-channel-syncing", false);
            irc.UseSsl = server.UseSsl;

            // Bind event handlers
            irc.OnChannelMessage += OnChannelMessage;
            irc.OnQueryMessage += OnQueryMessage;
            irc.OnQueryNotice += OnQueryNotice;
            irc.OnDisconnected += OnDisconnected;

            // Create scrollback buffer
            scrollback[server.Host] = new C5.CircularQueue<string>(1000);

            try
            {
                log.Info("Connecting to server " + server.Host);
                irc.Connect(server.Host, server.Port);
            }
            catch (ConnectionException e)
            {
                log.Error("Could not connect to server " + irc.Address, e);
                Exit();
            }

            try
            {
                irc.Login(server.Nick,
                    config.GetString("realname", "slave"),
                    0,
                    config.GetString("username", "slave")
                );

                foreach (string channel in server.Channels)
                    irc.RfcJoin(channel);

                ircs[irc.Address] = irc;
            }
            catch (ConnectionException e)
            {
                log.Error("Connection error", e);
                Exit();
            }
            catch (Exception e)
            {
                Exit();
            }
        }
Exemple #24
0
 /// <summary>
 /// Creates a new instance of Irc client and
 /// sets up the default values
 /// </summary>
 public Irc()
 {
     m_Commands = new List<Command>();
     m_IrcClient = new IrcClient();
     m_IrcClient.UseSsl = false;
     m_IrcClient.ActiveChannelSyncing = true;
     m_IrcClient.OnError += OnError;
     m_IrcClient.OnRawMessage += OnMessage;
 }
Exemple #25
0
 public static void ghost(string[] args, string Channel, string Nick, IrcClient irc)
 {
     if (args.Length != 1) { irc.SendMessage(SendType.Message, Channel, String.Format("({0}) Usage: " + Program.GlobalVar.bot_comm_char + "ghost", Nick)); }
     else
     {
         irc.SendMessage(SendType.Message, "NickServ", String.Format("ghost {0}, {1}", Program.GlobalVar.bot_nick, Program.GlobalVar.bot_ident));
         irc.SendMessage(SendType.Message, Channel, String.Format("The imposter has been killed sir"));
     }
 }
Exemple #26
0
 public main()
 {
     InitializeComponent();
     _ircClient = new IrcClient();
     _ircClient.OnError += new ErrorEventHandler(OnError);
     _ircClient.OnRawMessage += new IrcEventHandler(OnRawMessage);
     _ircClient.OnQueryMessage += new IrcEventHandler(OnQueryMessage);
     _ircClient.OnConnected += new  EventHandler(OnConnected);
     _ircClient.OnDisconnected += new EventHandler(OnDisconnected);
 }
        public static void Stop()
        {
            if (_irc == null)
            {
                throw new MethodAccessException("This method can only be called after \"Connect()\" and called once. Unless \"Connect()\" is called.");
            }

            _irc.Disconnect();
            _irc = null;
        }
 public ALFAIRCBot()
 {
     Client = new IrcClient();
     Rng = new Random();
     DatabaseSynchronizationThread = new Thread(DatabaseSynchronizationThreadRoutine);
     Client.OnChannelMessage += new IrcEventHandler(Client_OnChannelMessage);
     Client.OnErrorMessage += new IrcEventHandler(Client_OnErrorMessage);
     Client.OnError += new Meebey.SmartIrc4net.ErrorEventHandler(Client_OnError);
     Client.OnRawMessage += new IrcEventHandler(Client_OnRawMessage);
     CreateIngameIrcCommands();
 }
Exemple #29
0
 public static void command(string[] args, string Channel, string Nick, IrcClient irc)
 {
     if (args.Length != 2)
     {
         irc.SendMessage(SendType.Message, Channel, string.Format("{0}, Usage: $brainfuck <brainfuck program text>", Nick));
     }
     else
     {
         string output = bfOutput(args[1]);
         irc.SendMessage(SendType.Message, Channel, string.Format("{0}, {1}", Nick, output));
     }
 }
Exemple #30
0
 public Pluggis(string admin, string nick, string user, string server, int port, List<string> channels)
 {
     this.admin = admin;
     this.nick = nick;
     this.user = user;
     this.server = server;
     this.port = port;
     this.channels = channels;
     irc = new IrcClient();
     isConnected = false;
     Run();
 }
Exemple #31
0
        protected override void Connect()
        {
            _ircClient = new SIRC4N.IrcClient();
            _ircClient.OnRawMessage     += _ircClient_OnRawMessage;
            _ircClient.OnRegistered     += _ircClient_OnRegistered;
            _ircClient.OnChannelMessage += _ircClient_OnPrivmsg;
            _ircClient.OnQueryMessage   += _ircClient_OnPrivmsg;
            _ircClient.OnQueryNotice    += _ircClient_OnQueryNotice;

            _ircClient.Connect(_host, _port);
            _ircClient.Login(_nickname, _nickname);

            _listenThread = new Thread(_ircClient.Listen);
            _listenThread.Start();

            _ircClient.OnDisconnected += HandleDisconnect;
        }
 public override void MakeInfo()
 {
     Description = "connects to IRC. Usage: irc channel nick server";
     Category    = CommandCategory.Other;
     ircClient   = new IrcClient();
 }