All pastes #765350 Raw Edit

Something

public text v1 · immutable
·published 2007-11-07 23:11 UTC
rendered paste body
// BitchSlapCommand.cs created with MonoDevelop
// User: damien at 13:49 28/09/2007
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;
using System.Data;
using System.Collections.Generic;
using Roboter.Common;

namespace Roboter.Plugins.Base
{
	public class OpCommand : ICommand
	{
		public OpCommand()
		{
			string sql = "CREATE TABLE IF NOT EXISTS opCommand (id integer primary key autoincrement, opUser varchar(60), opHost varchar(60))";
			Database.ExecuteNonQuery(sql);
		}
		
		public string Command
		{
			get { return "op"; }
		}
		
		public string Name
		{
			get { return "Op"; }
		}
		
		public bool Watcher
		{
			get { return false; }
		}
		
		public void Process(string line)
		{
			string nick = Helper.GetNick(line);
			string user = Helper.GetUser(line);
			string host = Helper.GetHost(line);
			
			DataTable dataTable = Database.GetDataTable("SELECT * FROM opCommand");
			foreach (DataRow row in dataTable.Rows)
			{
				string opUser = (string)row["opUser"];
				string opHost = (string)row["opHost"];
				if (opUser == user && opHost == host)
					continue;
									
				IrcClient.PrivateMessage("/op" + nick);
				Database.ExecuteNonQuery(sql);
			}
		}
		
		public void ProcessWatch(string line)
		{
			
		}
		
		public string GetHelp()
		{
            IrcClient.PrivateMessage("op - use this command to op yourself or another in the channel access list");
            IrcClient.PrivateMessage("syntax: !op [NICK]");
			return string.Empty;
		}
	}
}