# pingweblogs, a Vellum plugin
# Simply drop into your Vellum plugins directory and your blog
# will automatically ping weblogs.com when you update

# Import appropriate modules
# Note that this requires XMLRPClib, which comes as standard with
#  Python 2.2, but must be added to your plugins directory for
#  earlier versions
import xmlrpclib,vellum.Blog,vellum.hooks

# Define the function to do the ping
def pingWeblogsCom(entry):
    # Get the blog's name and static URL
    blog = vellum.Blog.get(entry.blogid)
    svr = xmlrpclib.Server("http://rpc.weblogs.com/RPC2")
    resp = svr.weblogUpdates.ping(blog.title,blog.staticurl)

# And attach that function to a hook
vellum.hooks.register_hook("entry-rebuild-post",pingWeblogsCom)

__pluginname__ = "Ping weblogs.com"
__description__ = "Sends an XML-RPC ping to weblogs.com when your blog is updated"
