view plugins/server/examplePlugin.py @ 82:2fa8bd6785a5 ornery-dev

TerminalWriter's colors are nice, but if no debug console is open it causes the software to look for one until a recursion error is created. Crash reports are sent to the debug console and a pop-up tells the user one has happened. Fix to chat window from SnowDog.
author sirebral
date Thu, 27 Aug 2009 00:51:22 -0500
parents 4385a7d0efd1
children
line wrap: on
line source

import os
import sys
from base_plugin import BasePluginClass

class Plugin(BasePluginClass):
    def __init__(self):
        BasePluginClass.__init__(self)

        self.Name = "examplePlugin"
        self.File = __file__
        self.Author = "Dj Gilcrease"
        self.Help = "Help"
        self.InputPriority = -1 # -1 = not used; 99 = priority doesn't matter
                                # Any other number is priority, lowest number
                                # executes first
        self.OutputPriority = -1# -1 = not used; 99 = priority doesn't matter
                                # Any other number is priority, lowest number
                                # executes first
        self.PollPriority = -1  # -1 = not used; 99 = priority doesn't matter
                                # Any other number is priority, lowest number
                                # executes first

    def start(self):
        #Do you DB connection here
        pass

    def stop(self):
        #Close your DB connection here
        pass

    def preParseIncoming(self, xml_dom, data):
        #Do something with the Data or Dom, and return it

        return xml_dom, data

    def postParseIncoming(self, data):
        #Do something with the Data before it gets sent to the room

        return data

    def preParseOutgoing(self):
        #Fetch messages from somewhere that need to be sent out

        return []