--// hubtopic.lua --// A script for Aquila. Min version: 0.1.9; Commands: !topic, !showtopic (!/+) --// Szabolcs Molnar, 2006; rev 003/20060908 hubtopic = {} hubtopic.isitset = false hubtopic.topic = "" function hubtopic.deleteTopic(nick) local hubname = GetConfig("hubname") RawToAll("$HubName " .. hubname .. "|") ChatToAll("", nick .. " has deleted the topic") hubtopic.topic = "" hubtopic.isitset = false return 1 end function hubtopic.setTopic(nick, topic) local hubname = GetConfig("hubname") RawToAll("$HubName " .. hubname .. " - " .. topic .. "|") ChatToAll("", nick .. " has changed topic to: " .. topic) hubtopic.isitset = true hubtopic.topic = topic return 1 end function hubtopic.sendTopic(nick) if hubtopic.isitset then local hubname = GetConfig("hubname") RawToNick(nick, "$HubName " .. hubname .. " - " .. hubtopic.topic .. "|") end return 1 end function hubtopic.getTopic() if hubtopic.isitset then return "Current topic is: " .. hubtopic.topic else return "No topic set." end end function hubtopic.announce(nick, allCases, sendToAll) local ret = "" if hubtopic.isitset then local topic = hubtopic.topic if not sendToAll then ChatToNick("", nick, "Current topic is: " .. topic) else ChatToAll("", "Current topic is: " .. topic) end elseif allCases then if not sendToAll then ChatToNick("", nick, "No topic set.") else ChatToAll("", "No topic set.") end end return 1 end function EventLogin(nick, myinfo) hubtopic.sendTopic(nick) hubtopic.announce(nick) end function topic(nick, parameters) if (not parameters[1]) then hubtopic.deleteTopic(nick) else hubtopic.setTopic(nick, parameters[1]) end return "OK" end function showtopic(nick) return hubtopic.getTopic() end RegCommand("topic", "key", "Set up or deletes hub topic") RegCommand("showtopic", "chat", "Shows hub topic")