packages feed

infinity-0.3: Plugins/Test.hs

module Test where
import API

plugin :: InfinityPlugin
plugin = InfinityPlugin {
  name     =   "Test",
  commands = [("put","put value to disk"),
              ("get","get value from disk")],
  action = test
}

test :: PLUGIN
test user chan cmd av = do
  case cmd of
    "put" -> do putState "hello" ("test")
                retJust "done..."
    "get" -> do x <- getState "hello" :: PLUG (Maybe String)
                case x of
                  Nothing -> retJust "No state..."
                  Just y  -> retJust $ show y