Example #1
0
func readConfiguration(configfilename string) (c common.Config, err error) {
	Log("Reading configuraton")
	cfg, err := common.ReadConfigFrom(configfilename)
	if err != nil {
		return nil, err
	}
	return cfg, nil
}
Example #2
0
// init must be called first on a non-initialized irc
// client. It will connect with SSL to a given irc server using a given
// username, join a channel and wait for messages
func init() {
	var err error
	config, err = common.ReadConfigFrom(configurationFilename)
	if err != nil {
		panic(err)
	}

	// IRC INIT
	Log("Create irc client")
	ircClient = irc.SimpleClient(config.Get("ajaxchat", "user"))
	ircClient.EnableStateTracking()
	ircClient.SSL = true

	ircClient.AddHandler(irc.CONNECTED, func(conn *irc.Conn, line *irc.Line) { conn.Join(ircChannel) })
	ircClient.AddHandler(irc.DISCONNECTED, func(conn *irc.Conn, line *irc.Line) { Connect() })
	ircClient.AddHandler("privmsg", func(conn *irc.Conn, line *irc.Line) { FromIrcMessage <- createMessageFromIrc(line) })
}
Example #3
0
//Init for Tumblr pkg
func init() {
	var err error
	config, err = common.ReadConfigFrom(configurationFilename)
	if err != nil {
		panic(err)
	}

	Log("Create tumblr client")

	appKey := config.Get("tumblr", "app_key")
	appSecret := config.Get("tumblr", "app_secret")
	oauthToken := config.Get("tumblr", "oauth_token")
	oauthTokenSecret := config.Get("tumblr", "oauth_token_secret")
	callbackURL := config.Get("tumblr", "url")

	client = gotumblr.NewTumblrRestClient(appKey, appSecret, oauthToken, oauthTokenSecret, callbackURL, "http://api.tumblr.com")
}
Example #4
0
func init() {
	var err error
	config, err = common.ReadConfigFrom(configurationFilename)
	if err != nil {
		panic(err)
	}

	twitterTag = config.Get("twitter", "twitter_tag")

	Log("Create twitter client")

	appKey := config.Get("twitter", "app_key")
	appSecret := config.Get("twitter", "app_secret")
	oauthToken := config.Get("twitter", "oauth_token")
	oauthTokenSecret := config.Get("twitter", "oauth_token_secret")

	anaconda.SetConsumerKey(appKey)
	anaconda.SetConsumerSecret(appSecret)

	api = anaconda.NewTwitterApi(oauthToken, oauthTokenSecret)
}