func init() { fmt.Println("Initializing command parsers...") app.AddFlags([]app.CliFlag{ app.CliFlag{&activateCommands, "commands", "alias,auth,join,part,send", "Comma-separated list of commands (alias,auth,exec,join,part,send) you want to enable"}, }) go func() { for { msg := <-msgsystem.CommandsIn if len(strings.TrimSpace(msg.Msg)) == 0 { fmt.Println("Received empty message. Discarding!") continue } fmt.Println("Commands:", msg.To, msg.Msg) go func() { for _, c := range commands { if !IsCommandEnabled((*c).Name()) { continue } fmt.Println("Handing out to:", (*c).Name(), (*c).Parse(msg)) } }() } }() }
func init() { fmt.Println("Initializing auth subsystem...") app.AddFlags([]app.CliFlag{ app.CliFlag{&password, "authpassword", "", "Password required to authenticate"}, }) }
func init() { w := WebSubSystem{} app.AddFlags([]app.CliFlag{ app.CliFlag{&w.addr, "webaddr", "0.0.0.0:12346", "net.Listen spec, to listen for json-api calls"}, }) msgsystem.RegisterSubSystem(&w) }
func init() { cat := CatSubSystem{} app.AddFlags([]app.CliFlag{ app.CliFlag{&cat.catbind, "catbind", ":12345", "net.Listen spec, to listen for IRCCat msgs"}, app.CliFlag{&cat.catfam, "catfamily", "tcp4", "net.Listen address family for IRCCat msgs"}, }) msgsystem.RegisterSubSystem(&cat) }
func init() { jabber := JabberSubSystem{} app.AddFlags([]app.CliFlag{ app.CliFlag{&jabber.server, "jabberhost", "localhost:443", "Hostname of Jabber server, eg: talk.google.com:443"}, app.CliFlag{&jabber.username, "jabberuser", "ircflu", "Username to authenticate with Jabber server"}, app.CliFlag{&jabber.password, "jabberpassword", "", "Password to use to connect to Jabber server"}, app.CliFlag{&jabber.notls, "jabbernotls", false, "If you don't want to connect with TLS"}, }) msgsystem.RegisterSubSystem(&jabber) }
func init() { irc := IrcSubSystem{} app.AddFlags([]app.CliFlag{ app.CliFlag{&irc.irchost, "irchost", "", "Hostname of IRC server, eg: irc.example.org:6667"}, app.CliFlag{&irc.ircnick, "ircnick", "ircflu", "Nickname to use for IRC"}, app.CliFlag{&irc.ircpassword, "ircpassword", "", "Password to use to connect to IRC server"}, app.CliFlag{&irc.ircchannel, "ircchannel", "#ircflutest", "Which channel to join"}, app.CliFlag{&irc.ircssl, "ircssl", false, "Use SSL for IRC connection"}, }) msgsystem.RegisterSubSystem(&irc) }