Module: ModSpox
- Defined in:
- lib/mod_spox/Bot.rb,
lib/mod_spox/Timer.rb,
lib/mod_spox/Action.rb,
lib/mod_spox/Loader.rb,
lib/mod_spox/Logger.rb,
lib/mod_spox/Plugin.rb,
lib/mod_spox/Socket.rb,
lib/mod_spox/Helpers.rb,
lib/mod_spox/Sockets.rb,
lib/mod_spox/Version.rb,
lib/mod_spox/rfc2812.rb,
lib/mod_spox/Database.rb,
lib/mod_spox/Pipeline.rb,
lib/mod_spox/BotConfig.rb,
lib/mod_spox/BaseConfig.rb,
lib/mod_spox/Exceptions.rb,
lib/mod_spox/models/Auth.rb,
lib/mod_spox/models/Nick.rb,
lib/mod_spox/PluginHolder.rb,
lib/mod_spox/handlers/Who.rb,
lib/mod_spox/models/Group.rb,
lib/mod_spox/PluginManager.rb,
lib/mod_spox/PriorityQueue.rb,
lib/mod_spox/handlers/Join.rb,
lib/mod_spox/handlers/Kick.rb,
lib/mod_spox/handlers/Mode.rb,
lib/mod_spox/handlers/Motd.rb,
lib/mod_spox/handlers/Nick.rb,
lib/mod_spox/handlers/Part.rb,
lib/mod_spox/handlers/Ping.rb,
lib/mod_spox/handlers/Pong.rb,
lib/mod_spox/handlers/Quit.rb,
lib/mod_spox/models/Config.rb,
lib/mod_spox/models/Server.rb,
lib/mod_spox/MessageFactory.rb,
lib/mod_spox/handlers/Names.rb,
lib/mod_spox/handlers/Topic.rb,
lib/mod_spox/handlers/Whois.rb,
lib/mod_spox/models/Channel.rb,
lib/mod_spox/models/Setting.rb,
lib/mod_spox/models/Trigger.rb,
lib/mod_spox/handlers/Bounce.rb,
lib/mod_spox/handlers/Invite.rb,
lib/mod_spox/handlers/MyInfo.rb,
lib/mod_spox/handlers/Notice.rb,
lib/mod_spox/models/AuthMask.rb,
lib/mod_spox/models/NickMode.rb,
lib/mod_spox/handlers/BadNick.rb,
lib/mod_spox/handlers/Created.rb,
lib/mod_spox/handlers/Handler.rb,
lib/mod_spox/handlers/LuserMe.rb,
lib/mod_spox/handlers/LuserOp.rb,
lib/mod_spox/handlers/Privmsg.rb,
lib/mod_spox/handlers/Welcome.rb,
lib/mod_spox/models/Signature.rb,
lib/mod_spox/handlers/YourHost.rb,
lib/mod_spox/handlers/NickInUse.rb,
lib/mod_spox/ConfigurationWizard.rb,
lib/mod_spox/handlers/LuserClient.rb,
lib/mod_spox/handlers/LuserUnknown.rb,
lib/mod_spox/messages/incoming/Who.rb,
lib/mod_spox/messages/outgoing/Die.rb,
lib/mod_spox/messages/outgoing/Raw.rb,
lib/mod_spox/messages/outgoing/Who.rb,
lib/mod_spox/handlers/LuserChannels.rb,
lib/mod_spox/messages/incoming/Join.rb,
lib/mod_spox/messages/incoming/Kick.rb,
lib/mod_spox/messages/incoming/Mode.rb,
lib/mod_spox/messages/incoming/Motd.rb,
lib/mod_spox/messages/incoming/Nick.rb,
lib/mod_spox/messages/incoming/Part.rb,
lib/mod_spox/messages/incoming/Ping.rb,
lib/mod_spox/messages/incoming/Pong.rb,
lib/mod_spox/messages/incoming/Quit.rb,
lib/mod_spox/messages/outgoing/Away.rb,
lib/mod_spox/messages/outgoing/Info.rb,
lib/mod_spox/messages/outgoing/Ison.rb,
lib/mod_spox/messages/outgoing/Join.rb,
lib/mod_spox/messages/outgoing/Kick.rb,
lib/mod_spox/messages/outgoing/Kill.rb,
lib/mod_spox/messages/outgoing/List.rb,
lib/mod_spox/messages/outgoing/Motd.rb,
lib/mod_spox/messages/outgoing/Nick.rb,
lib/mod_spox/messages/outgoing/Oper.rb,
lib/mod_spox/messages/outgoing/Part.rb,
lib/mod_spox/messages/outgoing/Pass.rb,
lib/mod_spox/messages/outgoing/Ping.rb,
lib/mod_spox/messages/outgoing/Pong.rb,
lib/mod_spox/messages/outgoing/Quit.rb,
lib/mod_spox/messages/outgoing/Time.rb,
lib/mod_spox/messages/outgoing/User.rb,
lib/mod_spox/messages/incoming/Names.rb,
lib/mod_spox/messages/incoming/Topic.rb,
lib/mod_spox/messages/incoming/Whois.rb,
lib/mod_spox/messages/outgoing/Admin.rb,
lib/mod_spox/messages/outgoing/Links.rb,
lib/mod_spox/messages/outgoing/Names.rb,
lib/mod_spox/messages/outgoing/Squit.rb,
lib/mod_spox/messages/outgoing/Stats.rb,
lib/mod_spox/messages/outgoing/Topic.rb,
lib/mod_spox/messages/outgoing/Trace.rb,
lib/mod_spox/messages/outgoing/Users.rb,
lib/mod_spox/messages/outgoing/Whois.rb,
lib/mod_spox/messages/incoming/Bounce.rb,
lib/mod_spox/messages/incoming/Invite.rb,
lib/mod_spox/messages/incoming/MyInfo.rb,
lib/mod_spox/messages/incoming/Notice.rb,
lib/mod_spox/messages/outgoing/Invite.rb,
lib/mod_spox/messages/outgoing/Lusers.rb,
lib/mod_spox/messages/outgoing/Notice.rb,
lib/mod_spox/messages/outgoing/Rehash.rb,
lib/mod_spox/messages/outgoing/Simple.rb,
lib/mod_spox/messages/outgoing/Squery.rb,
lib/mod_spox/messages/outgoing/Summon.rb,
lib/mod_spox/messages/outgoing/Unaway.rb,
lib/mod_spox/messages/outgoing/WhoWas.rb,
lib/mod_spox/messages/incoming/BadNick.rb,
lib/mod_spox/messages/incoming/Created.rb,
lib/mod_spox/messages/incoming/LuserMe.rb,
lib/mod_spox/messages/incoming/LuserOp.rb,
lib/mod_spox/messages/incoming/Message.rb,
lib/mod_spox/messages/incoming/Privmsg.rb,
lib/mod_spox/messages/incoming/Welcome.rb,
lib/mod_spox/messages/internal/HaltBot.rb,
lib/mod_spox/messages/internal/Request.rb,
lib/mod_spox/messages/outgoing/Connect.rb,
lib/mod_spox/messages/outgoing/Privmsg.rb,
lib/mod_spox/messages/outgoing/Restart.rb,
lib/mod_spox/messages/outgoing/Version.rb,
lib/mod_spox/messages/incoming/YourHost.rb,
lib/mod_spox/messages/internal/Response.rb,
lib/mod_spox/messages/internal/Shutdown.rb,
lib/mod_spox/messages/internal/TimerAdd.rb,
lib/mod_spox/messages/outgoing/ServList.rb,
lib/mod_spox/messages/outgoing/UserHost.rb,
lib/mod_spox/messages/outgoing/UserMode.rb,
lib/mod_spox/messages/incoming/NickInUse.rb,
lib/mod_spox/messages/incoming/TopicInfo.rb,
lib/mod_spox/messages/internal/Connected.rb,
lib/mod_spox/messages/internal/DCCSocket.rb,
lib/mod_spox/messages/internal/Reconnect.rb,
lib/mod_spox/messages/internal/ChangeNick.rb,
lib/mod_spox/messages/internal/DCCRequest.rb,
lib/mod_spox/messages/internal/TimerClear.rb,
lib/mod_spox/messages/incoming/LuserClient.rb,
lib/mod_spox/messages/internal/DCCListener.rb,
lib/mod_spox/messages/internal/NickRequest.rb,
lib/mod_spox/messages/internal/QueueSocket.rb,
lib/mod_spox/messages/internal/TimerRemove.rb,
lib/mod_spox/messages/outgoing/ChannelMode.rb,
lib/mod_spox/migrations/004_mode_index_fix.rb,
lib/mod_spox/messages/incoming/LuserUnknown.rb,
lib/mod_spox/messages/internal/Disconnected.rb,
lib/mod_spox/messages/internal/NickResponse.rb,
lib/mod_spox/messages/internal/PluginReload.rb,
lib/mod_spox/messages/internal/PluginsReady.rb,
lib/mod_spox/migrations/002_persistent_sigs.rb,
lib/mod_spox/messages/incoming/LuserChannels.rb,
lib/mod_spox/messages/internal/Disconnecting.rb,
lib/mod_spox/messages/internal/PluginRequest.rb,
lib/mod_spox/messages/internal/StatusRequest.rb,
lib/mod_spox/messages/internal/TimerResponse.rb,
lib/mod_spox/messages/internal/UnqueueSocket.rb,
lib/mod_spox/migrations/003_auth_restructure.rb,
lib/mod_spox/migrations/005_nick_mode_nopark.rb,
lib/mod_spox/messages/internal/BotInitialized.rb,
lib/mod_spox/messages/internal/PluginResponse.rb,
lib/mod_spox/messages/internal/StatusResponse.rb,
lib/mod_spox/messages/internal/TriggersUpdate.rb,
lib/mod_spox/migrations/001_initialize_models.rb,
lib/mod_spox/messages/internal/ConnectionFailed.rb,
lib/mod_spox/messages/internal/SignaturesUpdate.rb,
lib/mod_spox/messages/internal/PluginLoadRequest.rb,
lib/mod_spox/messages/internal/PluginLoadResponse.rb,
lib/mod_spox/messages/internal/EstablishConnection.rb,
lib/mod_spox/messages/internal/PluginModuleRequest.rb,
lib/mod_spox/messages/internal/PluginUnloadRequest.rb,
lib/mod_spox/messages/internal/PluginModuleResponse.rb,
lib/mod_spox/messages/internal/PluginUnloadResponse.rb
Defined Under Namespace
Modules: Exceptions, Handlers, Helpers, Messages, Migrations, Models Classes: Action, BaseConfig, Bot, BotConfig, ConfigurationWizard, Database, Logger, MessageFactory, Pipeline, Plugin, PluginHolder, PluginManager, PriorityQueue, Socket, Sockets, Timer
Constant Summary collapse
- RPL_WELCOME =
client server messages#
'001'
- RPL_YOURHOST =
'002'
- RPL_CREATED =
'003'
- RPL_MYINFO =
'004'
- RPL_BOUNCE =
'005'
- RPL_USERHOST =
response replies#
'302'
- RPL_ISON =
'303'
- RPL_AWAY =
'301'
- RPL_UNAWAY =
'305'
- RPL_NOWAWAY =
'306'
- RPL_WHOISIDENTIFIED =
'307'
- RPL_WHOISUSER =
'311'
- RPL_WHOISSERVER =
'312'
- RPL_WHOISOPERATOR =
'313'
- RPL_WHOISIDLE =
'317'
- RPL_ENDOFWHOIS =
'318'
- RPL_WHOISCHANNELS =
'319'
- RPL_WHOWASUSER =
'314'
- RPL_ENDOFWHOWAS =
'369'
- RPL_LISTSTART =
'321'
- RPL_LIST =
'322'
- RPL_LISTEND =
'323'
- RPL_UNIQOPIS =
'325'
- RPL_CHANNELMODEIS =
'324'
- RPL_NOTOPIC =
'331'
- RPL_TOPIC =
'332'
- RPL_TOPICINFO =
'333'
- RPL_INVITING =
'341'
- RPL_SUMMONING =
'342'
- RPL_INVITELIST =
'346'
- RPL_ENDOFINVITELIST =
'347'
- RPL_EXCEPTLIST =
'348'
- RPL_ENDOFEXCEPTLIST =
'349'
- RPL_VERSION =
'351'
- RPL_WHOREPLY =
'352'
- RPL_ENDOFWHO =
'315'
- RPL_NAMREPLY =
'353'
- RPL_ENDOFNAMES =
'366'
- RPL_LINKS =
'364'
- RPL_ENDOFLINKS =
'365'
- RPL_BANLIST =
'367'
- RPL_ENDOFBANLIST =
'368'
- RPL_INFO =
'371'
- RPL_ENDOFINFO =
'374'
- RPL_MOTDSTART =
'375'
- RPL_MOTD =
'372'
- RPL_ENDOFMOTD =
'376'
- RPL_YOUREOPER =
'381'
- RPL_REHASHING =
'382'
- RPL_YOURESERVICE =
'383'
- RPL_TIME =
'391'
- RPL_USERSSTART =
'392'
- RPL_USERS =
'393'
- RPL_ENDOFUSERS =
'394'
- RPL_NOUSERS =
'395'
- RPL_TRACELINK =
'200'
- RPL_TRACECONNECTING =
'201'
- RPL_TRACEHANDSHAKE =
'202'
- RPL_TRACEUNKNOWN =
'203'
- RPL_TRACEOPERATOR =
'204'
- RPL_TRACEUSER =
'205'
- RPL_TRACESERVER =
'206'
- RPL_TRACESERVICE =
'207'
- RPL_TRACENEWTYPE =
'208'
- RPL_TRACECLASS =
'209'
- RPL_TRACERECONNECT =
'210'
- RPL_TRACELOG =
'261'
- RPL_TRACEEND =
'262'
- RPL_STATSLINKINFO =
'211'
- RPL_STATSCOMMANDS =
'212'
- RPL_ENDOFSTATS =
'219'
- RPL_STATSUPTIME =
'242'
- RPL_STATSOLINE =
'243'
- RPL_UMODEIS =
'221'
- RPL_SERVLIST =
'234'
- RPL_SERVLISTEND =
'235'
- RPL_LUSERCLIENT =
'251'
- RPL_LUSEROP =
'252'
- RPL_LUSERUNKNOWN =
'253'
- RPL_LUSERCHANNELS =
'254'
- RPL_LUSERME =
'255'
- RPL_ADMINME =
'256'
- RPL_ADMINLOC1 =
'257'
- RPL_ADMINLOC2 =
'258'
- RPL_ADMINEMAIL =
'259'
- RPL_TRYAGAIN =
'263'
- ERR_NOSUCHNICK =
error messages#
'401'
- ERR_NOSUCHSERVER =
'402'
- ERR_NOSUCHCHANNEL =
'403'
- ERR_CANNOTSENDTOCHAN =
'404'
- ERR_TOOMANYCHANNELS =
'405'
- ERR_WASNOSUCHNICK =
'406'
- ERR_TOOMANYTARGETS =
'407'
- ERR_NOSUCHSERVICE =
'408'
- ERR_NOORIGIN =
'409'
- ERR_NORECIPIENT =
'411'
- ERR_NOTEXTTOSEND =
'412'
- ERR_NOTOPLEVEL =
'413'
- ERR_WILDTOPLEVEL =
'413'
- ERR_BADMASK =
'415'
- ERR_UNKNOWNCOMMAND =
'421'
- ERR_NOMOTD =
'422'
- ERR_NOADMININFO =
'423'
- ERR_FILEERROR =
'424'
- ERR_NONICKNAMEGIVEN =
'431'
- ERR_ERRONEOUSNICKNAME =
'432'
- ERR_NICKNAMEINUSE =
'433'
- ERR_NICKCOLLISION =
'436'
- ERR_UNAVAILRESOURCE =
'437'
- ERR_USERNOTINCHANNEL =
'441'
- ERR_NOTONCHANNEL =
'442'
- ERR_USERONCHANNEL =
'443'
- ERR_NOLOGIN =
'444'
- ERR_SUMMONDISABLED =
'445'
- ERR_USERDISABLED =
'446'
- ERR_NOTREGISTERED =
'451'
- ERR_NEEDMOREPARAMS =
'461'
- ERR_ALREADYREGISTERED =
'462'
- ERR_NOPERMFORHOST =
'463'
- ERR_PASSWDMISMATCH =
'464'
- ERR_YOUREBANNEDCREEP =
'465'
- ERR_YOUWILLBEBANNED =
'466'
- ERR_KEYSET =
'467'
- ERR_CHANNELISFULL =
'471'
- ERR_UNKNOWNMODE =
'472'
- ERR_INVITEONLYCHAN =
'473'
- ERR_BANNEDFROMCHAN =
'474'
- ERR_BADCHANNELKEY =
'475'
- ERR_BADCHANMASK =
'476'
- ERR_NOCHANMODES =
'477'
- ERR_BANLISTFULL =
'478'
- ERR_NOPRIVILEGES =
'481'
- ERR_CHANOPRIVSNEEDED =
'482'
- ERR_CANTKILLSERVER =
'483'
- ERR_RESTRICTED =
'484'
- ERR_UNIQOPPRIVSNEEDED =
'485'
- ERR_NOOPERHOST =
'491'
- ERR_UMODEUNKNOWNFLAG =
'501'
- ERR_USERSDONTMATCH =
'502'
- RPL_SERVICEINFO =
extras#
'231'
- RPL_ENDOFSERVICES =
'232'
- RPL_SERVICE =
'233'
- RPL_NONE =
'300'
- RPL_WHOISCHANOP =
'316'
- RPL_KILLDONE =
'361'
- RPL_CLOSING =
'362'
- RPL_CLOSEEND =
'363'
- RPL_INFOSTART =
'373'
- RPL_MYPORTIS =
'384'
- RPL_STATSCLINE =
'213'
- RPL_STATSNLINE =
'214'
- RPL_STATSILINE =
'215'
- RPL_STATSKLINE =
'216'
- RPL_STATSQLINE =
'217'
- RPL_STATSYLINE =
'218'
- RPL_STATSVLINE =
'240'
- RPL_STATSLLINE =
'241'
- RPL_STATSHLINE =
'244'
- RPL_STATSSLINE =
'244'
- RPL_STATSPING =
'246'
- RPL_STATSBLINE =
'247'
- RPL_STATSDLINE =
'250'
- ERR_NOSERVICEHOST =
'492'
Class Attribute Summary collapse
-
.botcodename ⇒ Object
readonly
Returns the value of attribute botcodename.
-
.botversion ⇒ Object
readonly
Returns the value of attribute botversion.
-
.daemon_bot ⇒ Object
Returns the value of attribute daemon_bot.
-
.jdbc ⇒ Object
Returns the value of attribute jdbc.
-
.loglevel ⇒ Object
Returns the value of attribute loglevel.
-
.logto ⇒ Object
Returns the value of attribute logto.
-
.mod_spox_path ⇒ Object
Returns the value of attribute mod_spox_path.
-
.verbosity ⇒ Object
Returns the value of attribute verbosity.
Class Method Summary collapse
-
.check_upgrade ⇒ Object
check if the bot has been upgraded.
-
.initialize_bot(db = nil) ⇒ Object
Loads all files needed by the bot.
-
.setup_adapter(db = nil) ⇒ Object
Setup the DataMapper adapter.
Class Attribute Details
.botcodename ⇒ Object (readonly)
Returns the value of attribute botcodename.
11 12 13 |
# File 'lib/mod_spox/Version.rb', line 11 def botcodename @botcodename end |
.botversion ⇒ Object (readonly)
Returns the value of attribute botversion.
11 12 13 |
# File 'lib/mod_spox/Version.rb', line 11 def botversion @botversion end |
.daemon_bot ⇒ Object
Returns the value of attribute daemon_bot.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def daemon_bot @daemon_bot end |
.jdbc ⇒ Object
Returns the value of attribute jdbc.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def jdbc @jdbc end |
.loglevel ⇒ Object
Returns the value of attribute loglevel.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def loglevel @loglevel end |
.logto ⇒ Object
Returns the value of attribute logto.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def logto @logto end |
.mod_spox_path ⇒ Object
Returns the value of attribute mod_spox_path.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def mod_spox_path @mod_spox_path end |
.verbosity ⇒ Object
Returns the value of attribute verbosity.
12 13 14 |
# File 'lib/mod_spox/Version.rb', line 12 def verbosity @verbosity end |
Class Method Details
.check_upgrade ⇒ Object
check if the bot has been upgraded
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/mod_spox/Loader.rb', line 48 def self.check_upgrade Sequel::Migrator.apply(Database.db, BotConfig[:libpath] + '/migrations') config = BaseConfig.new(BotConfig[:userconfigpath]) config[:plugin_upgrade] = 'no' begin config[:plugin_upgrade] = 'yes' if config[:last_version] != ModSpox.botversion rescue Exceptions::UnknownKey => boom config[:plugin_upgrade] = 'yes' end config[:last_version] = ModSpox.botversion end |
.initialize_bot(db = nil) ⇒ Object
Loads all files needed by the bot
10 11 12 13 |
# File 'lib/mod_spox/Loader.rb', line 10 def self.initialize_bot(db=nil) setup_adapter(db) check_upgrade end |
.setup_adapter(db = nil) ⇒ Object
Setup the DataMapper adapter
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mod_spox/Loader.rb', line 16 def self.setup_adapter(db=nil) memcache = false config = BaseConfig.new(BotConfig[:userconfigpath]) if(config[:memcache] == 'on') begin require 'memcache' memcache = true Database.cache = MemCache.new('localhost:11211', :namespace => 'modspox') rescue Object => boom puts "FAILED TO LOAD MEMCACHE SUPPORT: #{boom}" # do nothing # end end unless(db.nil?) Database.db = db else case config[:db_adapter] when 'mysql' Database.db = Sequel.mysql(config[:db_database], :user => config[:db_username], :password => config[:db_password], :host => config[:db_host], :max_connections => 20) Database.type = :mysql when 'pgsql' Database.db = Sequel.connect("#{ModSpox.jdbc ? 'jdbc:' : ''}postgres://#{config[:db_username]}:#{config[:db_password]}@#{config[:db_host]}/#{config[:db_database]}") Database.type = :pgsql when 'sqlite' Database.db = Sequel.sqlite("#{BotConfig[:userpath]}/mod_spox.db", :pool_timeout => 20, :timeout => 5000) Database.type = :sqlite end end end |