Changeset - 7166b462847f
[Not reviewed]
0 1 0
Sarang Bharadwaj - 13 years ago 2012-07-02 12:48:29
sarang.bh@gmail.com
Chatroom mode
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -44,50 +44,50 @@ TwitterPlugin::TwitterPlugin(Config *config, Swift::SimpleEventLoop *loop, Stora
 
		LOG4CXX_INFO(logger, "Using default single contact mode!");
 
	} else twitterMode = (mode)CONFIG_INT(config, "twitter.mode");
 

	
 

	
 
	adminLegacyName = "twitter-account"; 
 
	adminNickName = ""; 
 
	adminAlias = "twitter";
 
	if(twitterMode == CHATROOM) adminNickName = "twitter";
 

	
 
	consumerKey = CONFIG_STRING(config, "twitter.consumer_key");
 
	consumerSecret = CONFIG_STRING(config, "twitter.consumer_secret");
 
	OAUTH_KEY = "oauth_key";
 
	OAUTH_SECRET = "oauth_secret";
 

	
 
	m_factories = new Swift::BoostNetworkFactories(loop);
 
	m_conn = m_factories->getConnectionFactory()->createConnection();
 
	m_conn->onDataRead.connect(boost::bind(&TwitterPlugin::_handleDataRead, this, _1));
 
	m_conn->connect(Swift::HostAddressPort(Swift::HostAddress(host), port));
 

	
 
	tp = new ThreadPool(loop_, 10);
 
		
 
	tweet_timer = m_factories->getTimerFactory()->createTimer(60000);
 
	message_timer = m_factories->getTimerFactory()->createTimer(60000);
 

	
 
	//tweet_timer->onTick.connect(boost::bind(&TwitterPlugin::pollForTweets, this));
 
	//message_timer->onTick.connect(boost::bind(&TwitterPlugin::pollForDirectMessages, this));
 
	tweet_timer->onTick.connect(boost::bind(&TwitterPlugin::pollForTweets, this));
 
	message_timer->onTick.connect(boost::bind(&TwitterPlugin::pollForDirectMessages, this));
 

	
 
	tweet_timer->start();
 
	message_timer->start();
 
	
 
	LOG4CXX_INFO(logger, "Starting the plugin.");
 
}
 

	
 
TwitterPlugin::~TwitterPlugin() 
 
{
 
	delete storagebackend;
 
	std::map<std::string, twitCurl*>::iterator it;
 
	for(it = sessions.begin() ; it != sessions.end() ; it++) delete it->second;
 
	delete tp;
 
}
 

	
 
// Send data to NetworkPlugin server
 
void TwitterPlugin::sendData(const std::string &string) 
 
{
 
	m_conn->write(Swift::createSafeByteArray(string));
 
}
 

	
 
// Receive date from the NetworkPlugin server and invoke the appropirate payload handler (implement in the NetworkPlugin class)
 
void TwitterPlugin::_handleDataRead(boost::shared_ptr<Swift::SafeByteArray> data) 
 
{
0 comments (0 inline, 0 general)