ecto
desktop blogging
endo
total aggregation
1001
flickr accessory

Welcome

Mon, 2006-04-24

How to write a plugin

endo's subscription handling can be extended using plugins. You can create plugins that configure a subscription, provide a feed, and/or parse a feed. endo comes pre-packaged with three plugins that handle subscriptions for del.icio.us, Flickr, and Technorati and one that runs user-defined scripts. To create your own plugin, you will need to know Objective-C and Apple's Cocoa Framework.

Plugins are packages with the "endoplug" extension and the following directory stucture:

plugin directory structure

An "endoplug" package must have an "Info.plist" at the root level, with keys as in the following example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>CreatorName</key>
  <string>Adriaan Tijsseling</string>
  <key>CreatorEmail</key>
  <string>endo@dot.com</string>
  <key>CreatorWebsite</key>
  <string>http://blog.kung-foo.tv</string>
  <key>ComponentWebsite</key>
  <string>http://infinite-sushi.com/endo</string>
  <key>ComponentComments</key>
  <string>This plugin creates subscriptions for Technorati tags and cosmos.</string>
  <key>ComponentCopyright</key>
  <string>http://creativecommons.org/licenses/by-nc-nd/2.5/</string>
  <key>ComponentVersion</key>
  <string>1.0</string>
</dict>
</plist>

You can download the XCode project for a sample plugin. This sample illustrates the plugin protocol by showing how to get a feed from the World of Warcraft home page. This page has no feed, so we use our plugin to extract from the HTML contents. It's just for demo purposes. The code is heavily commented and should be transparent. To adapt this code to your own plugin, please make sure to rename ALL occurrences of "PluginSample", in particular the class and plugin name. This includes occurrences in the Target and Build settings. The plugin's name is defined in the build settings for the active target and is referred to in most places by $(PRODUCT_NAME). You also must conform to the plugin protocol defined in the PluginInterface.h file.

If you have questions about the code, feel free to ask in the comments. Based on user input I can probably write a more elaborated documentation. For now, please play around with the sample code.

Technorati Tags: , , ,