view libpurple/plugins/mono/MPlugin.cs @ 15876:80ee585fb53c

SF Patch #1686400 from Eoin Coffey ("ecoffey") ecoffey described the changes: 1) Small tweaks to the loader to bring it up to speed with new mono versions and API wrapper changes that grim had made. (was in original patch, just forgot about it :-P) 2) .NET Plugins are now required to define an Id as part of their info. 3) Modified gaim_probe_plugin to check for existence of info->id and to make sure it's not empty; Prints an error, stores an error in the plugin and sets plugin->unloadable = TRUE.
author Richard Laager <rlaager@wiktel.com>
date Sat, 24 Mar 2007 06:24:59 +0000
parents 7ae72b7c02b1
children
line wrap: on
line source

using Purple;

public class MPlugin : Plugin
{
	private static PluginInfo info = new PluginInfo("mono-mplugin", "C# Plugin", "0.1", "Test C# Plugin", "Longer Description", "Eoin Coffey", "urled");

	public MPlugin()
		: base(info)
	{
	}

	public void HandleSig(object[] args)
	{
		Buddy buddy = (Buddy)args[0];
		Status old_status = (Status)args[1];
		Status status = (Status)args[2];
		
		Debug.debug(Debug.INFO, "mplug", "buddy " + buddy.Name + " went from " + old_status.Id + " to " + status.Id + "\n");
	}
	
	public override void Load()
	{
		Debug.debug(Debug.INFO, "mplug", "loading...\n");
		
		/*Signal.connect(BuddyList.GetHandle(), this, "buddy-away", new Signal.Handler(HandleSig));*/
		BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig));
	}
	
	public override void Unload()
	{
		Debug.debug(Debug.INFO, "mplug", "unloading...\n");
	}
	
	public override void Destroy()
	{
		Debug.debug(Debug.INFO, "mplug", "destroying...\n");
	}
}