Dynamic Command Plugins
April 12th, 2009
I finished a major feature of OrtzIRC recently, so I thought I would write a bit about how it works.
First of all, a big thanks to Max for being the grease when my gears wouldn’t turn, so to speak.
And for talking me into doing commands this way instead of mine, which would not have worked out as well.
One of the goals with OrtzIRC is extensibility. OrtzIRC will have many categories of plugins which you write with your favorite .NET language, compile, and place in the plugins folder, much like Paint.NET. (Unlike Paint.NET, OrtzIRC will stay open source. wink wink) The first plugin category is commands.
Here’s what the “say” command looks like:
{
using OrtzIRC.Common;
using OrtzIRC.PluginFramework;
/// <summary>
/// Parts a channel
/// </summary>
[Plugin]
public class Say : ICommand
{
/// <summary>
/// Sends a message to the current channel
/// </summary>
/// <param name="channel"></param>
/// <param name="message"></param>
public void Execute(Channel channel, string message)
{
channel.Say(message);
}
}
}
Like with most IRC clients, “say” is the only command called automatically (when you type into the command box without specifying a command).
Commands must follow these rules to work properly:
- The class must implement the ICommand interface. At the moment this interface just lets the plugin loader know that it’s a command.
- The class must also have the Plugin attribute. Plugin takes an optional string parameter to specify the name of the plugin (in this case the name of the command you type to execute the command, ie “/say”) otherwise the plugin’s name is the name of the class.
- The command class must have at least one public Execute method. This method is what OrtzIRC calls when you type in a command.
- The type of the first parameter in each of the Execute methods must be one of the following:
- Channel
- Server
- PrivateMessageSession
This parameter represents the context in which the command was executed, in other words, the window. (A channel window, PM window…)
- The type of each of the remaining parameters must be either string or ChannelInfo. The ChannelInfo object is simply to let the command know that the user specified a channel name, ie “#luahelp”.
- If you want autocomplete support the Execute methods must each have proper XML docs. (This has not yet been implemented, I will discuss it in more detail when it is)
If these rules are not followed, the command will either not be loaded or not called when the user attempts to execute it. When a user types in a command, the plugin system looks through the commands it has loaded and looks for one that meets all these requirements and whose parameters match the parameters given by the user.
This command system is much more dynamic and easier on the programmer than other systems I have seen, which usually require the programmer to manage arguments manually and add a lot of redundant code.
Questions, comments, suggestions welcome.
OrtzIRC Progress
April 8th, 2009
‘Bout time for a quick update!
OrtzIRC’s first (major) feature is in; Drop-In Commands. I’ll post more detail in the future but basically you write some commands in C#, compile it, plop it in the plugins directory, and restart OrtzIRC. The command code is dynamically called when you enter an IRC command. I haven’t decided on scripting support but it’s not out of the question.
Just a few more core functionality features to put in like server settings and favorite channels and I’ll be ready to call it “alpha” and get ahold of some testers!
I’ll try to twitter about progress with OrtzIRC more. Also, I’d use hashtags if hashtags.org worked…
4 Free Installers
February 5th, 2009
Via a wiki answer on StackOverflow:
- Very powerful and flexible.
- Can produce MSI packages (Microsoft deployment format of choice)
- Almost no documentation
- Very steep learning curve.
- XML-based.
- Recommended for very complex installators.
- Cannot produce MSI packages.
- Based on INI files (less powerful but very low learning curve)
- Possible to inject Pascal procedures for extra flexibility.
- Probably the best choice for 90% of programs.
- Cannot produce MSI packages.
- Fully scripted, very powerful but at cost of high learning curve.
- Recommened if WiX is too much and InnoSetup not enough.
- Basic version is free.
- Can produce MSI packages.
- Very good user-interface, almost no learning curve to get things done.
- XML-based (but schema is not very user-friendly, doesn’t really matter as you would use GUI editor anyway)
- The best option if you have only basic installer requirements and don’t have time to learn something new.
New Host
January 5th, 2009
I took advantage of the deal Dreamhost was offering. 2 years unlimited bandwidth, unlimited space for $20!!
So no more downtime! (yay!)
You’ll probably get tons of 404’s so please have patience while I transfer everything.
OrtzIRC Update
December 30th, 2008
Time for another update.
Last time I posted about OrtzIRC, I mentioned I was looking at using System.AddIn as the framework for OrtzIRC’s plugins. (I’ll just call it MAF for Managed AddIn Framework, what it used to be called) Well the biggest problem with MAF is that it’s so freaking complicated. After I finally sat down for a while and read up on it, it just seemed to get more and more complex. And even more so when I started asking “well, how would I do this?”. For instance, everything that crosses the isolation boundary needs a contract. Events, collections (you have to use IListContract), everything. So for OrtzIRC this meant every single event (something like two dozen) needed to be redefined as contracts. (Or wrapped, or whatever) Another problem is that nobody uses it. I’ve only found two projects on CodePlex that use it and virtually no blog posts about it. I’ll admit, I never completely understood it all, but I’m pretty sure it would’ve been a LOT of work. Our own way may also be a lot of work, but at least it’s our own way.
Which is what I really wanted to discuss today…
As a quick side note, I did discover the Managed Extensibility Framework, being developed by Microsoft, presumably for future inclusion in the .NET framework. It looks really nice. Much simpler than MAF. And more popular too, at least on Stack Overflow. It’s a really young project though, and although they’re making it rather clear that MEF is here to stay, I think I’ll wait until CTP to give it serious consideration.
So Max and I had a disagreement about how to do the command plugins but that has been resolved (he won lol). So I’ll just point you to his two posts he wrote about it rather than re-explain it.
Onward and upward!
Making HTML Purifier Work With CodeIgniter
December 30th, 2008
There’s a post here about getting it to work, but it’s old. Since then, the include statements for HTML Purifier were moved to their own file. In a normal script you would include the HTMLPurifier.includes.php file, but this isn’t in line with how CodeIgniter loads libraries, so it requires some hacking to get working.
- Download HTML Purifier and put the contents of the library folder into your codeigniter /system/application/libraries folder.
- Open HTMLPurifier.includes.php and change
require ‘HTMLPurifier.php’;
to
//require ‘HTMLPurifier.php’;
- Open HTMLPurifier.php and add this just under <?php
require_once(‘HTMLPurifier.includes.php’);
And that’s all! Load with
OpenDNS
December 13th, 2008
I’m not sure how many people couldn’t access my site the past week or two, or if I was the only one for that matter. But apparently Time Warner’s DNS servers have been screwed up leaving a lot of people without Internet access, here (NC) as well as on the other side of the country. So once I figured that out, I switched my router to OpenDNS, reset the NIC on my server, and I could access my site. (Previously, my personal computer was the only one using OpenDNS, so of course I didn’t notice any outages.)
I guess I don’t completely understand DNS because it was my understanding that it only mattered what DNS the client was using not the server. Well at least it works now. For me anyway.
Edit: I guess the jokes on me, it’s still happening.
Edit2, 12-24: Looks like it’s fixed for me. My ISP’s status page is only showing problems for Raleigh.
Edit3, 12-30: It’s on and off apparently. Wish there was something I could do about it.
Clean Up HotAir.com
December 4th, 2008

If you read Hot Air like I do then, like me, you might be annoyed by the giant blogroll on the side.
I made this userscript to clean up the formatting.
You’ll need Firefox and either the Stylish or Greasemonkey extensions.
Enjoy!
Web 2.0
November 30th, 2008

Some real helpful info there…
OrtzIRC Update
November 23rd, 2008
Just wanted to make a quick note about the progress of OrtzIRC.
It’s been pretty slow lately. I really want to get commands in before I do anything else, just to get it in a semi-usable state. So this means taking a step back and trying to work out how to do plugins.
We were kind of at a loss at first (I was anyway) but then I found out that .NET 3.5 had this new system for adding plugins to your apps System.AddIn. So far this looks really nice, and I’ll be implementing it soon unless Max has any objections. The only issue I can see so far is that I don’t know how this will jibe with possibly adding scripting later on.
You can get updates more often by following me on Twitter.
