Changeset - 922168855bdf
[Not reviewed]
0 3 0
Sarang Bharadwaj - 13 years ago 2012-07-02 19:17:32
sarang.bh@gmail.com
Added response messages like "Status update successful"
3 files changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
backends/twitter/Requests/OAuthFlow.cpp
Show inline comments
 
@@ -3,16 +3,16 @@ DEFINE_LOGGER(logger, "OAuthFlow")
 
void OAuthFlow::run()
 
{
 
	success = twitObj->oAuthRequestToken( authUrl );
 
}
 

	
 
void OAuthFlow::finalize()
 
{
 
	if (!success) {
 
		LOG4CXX_ERROR(logger, "Error creating twitter authorization url!");
 
		np->handleLogoutRequest(user, username);
 
	} else {
 
		np->handleMessage(user, "twitter-account", std::string("Please visit the following link and authorize this application: ") + authUrl);
 
		np->handleMessage(user, "twitter-account", std::string("Please reply with the PIN provided by twitter. Prefix the pin with 'pin:'. Ex. 'pin: 1234'"));
 
		np->handleMessage(user, "twitter-account", std::string("Please reply with the PIN provided by twitter. Prefix the pin with '#pin'. Ex. '#pin 1234'"));
 
		np->OAuthFlowComplete(user, twitObj);
 
	}	
 
}
backends/twitter/Requests/StatusUpdateRequest.cpp
Show inline comments
 
@@ -11,20 +11,17 @@ void StatusUpdateRequest::run()
 
		LOG4CXX_INFO(logger, user << "StatusUpdateRequest response " << replyMsg );
 
	}
 
}
 

	
 
void StatusUpdateRequest::finalize()
 
{
 
	if(!success) {
 
		twitObj->getLastCurlError( replyMsg );
 
		LOG4CXX_ERROR(logger, user << ": CurlError - " << replyMsg );
 
		callBack(user, replyMsg);
 
	} else {
 
		std::string error = getErrorMessage(replyMsg);
 
		if(error.length()) {
 
			LOG4CXX_ERROR(logger, user << ": " << error);
 
			callBack(user, error);
 
		}
 
		if(error.length()) LOG4CXX_ERROR(logger, user << ": " << error)
 
		else LOG4CXX_INFO(logger, "Updated status for " << user << ": " << data);
 
		callBack(user, error);
 
	}
 
	return;
 
}
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -397,24 +397,26 @@ std::string TwitterPlugin::getMostRecentDMID(const std::string user)
 
{
 
	boost::mutex::scoped_lock lock(userlock);	
 
	std::string ID = "";
 
	if(onlineUsers.count(user)) ID = mostRecentDirectMessageID[user];
 
	return ID;
 
}
 

	
 
/************************************** Twitter response functions **********************************/
 
void TwitterPlugin::statusUpdateResponse(std::string &user, std::string &errMsg)
 
{
 
	if(errMsg.length()) {
 
		handleMessage(user, adminLegacyName, errMsg, adminNickName);
 
	} else {
 
		handleMessage(user, adminLegacyName, "Status Update successful", adminNickName);
 
	}
 
}
 

	
 
void TwitterPlugin::helpMessageResponse(std::string &user, std::string &msg)
 
{
 
	handleMessage(user, adminLegacyName, msg, adminNickName);
 
}
 

	
 
void TwitterPlugin::populateRoster(std::string &user, std::vector<User> &friends, std::string &errMsg) 
 
{
 
	if(errMsg.length() == 0) 
 
	{
 
@@ -505,36 +507,39 @@ void TwitterPlugin::directMessageResponse(std::string &user, std::vector<DirectM
 
}
 

	
 
void TwitterPlugin::createFriendResponse(std::string &user, std::string &frnd, std::string &errMsg)
 
{
 
	if(errMsg.length()) {
 
		handleMessage(user, adminLegacyName, errMsg, adminNickName);
 
		return;
 
	}
 

	
 
	if(twitterMode == SINGLECONTACT) {
 
		handleMessage(user, adminLegacyName, std::string("You are now following ") + frnd, adminNickName);
 
	} else if(twitterMode == MULTIPLECONTACT) {
 
		handleMessage(user, adminLegacyName, std::string("You are now following ") + frnd, adminNickName);
 
		handleBuddyChanged(user, frnd, frnd, std::vector<std::string>(), pbnetwork::STATUS_ONLINE);
 
	}
 
}
 

	
 
void TwitterPlugin::deleteFriendResponse(std::string &user, std::string &frnd, std::string &errMsg)
 
{
 
	if(errMsg.length()) {
 
		handleMessage(user, adminLegacyName, errMsg, adminNickName);
 
		return;
 
	} if(twitterMode == SINGLECONTACT) {
 
		handleMessage(user, adminLegacyName, std::string("You are not following ") + frnd + " anymore", adminNickName);
 
	} else if(twitterMode == MULTIPLECONTACT) {
 
		handleMessage(user, adminLegacyName, std::string("You are not following ") + frnd + " anymore", adminNickName);
 
		handleBuddyRemoved(user, frnd);
 
	}
 
}
 

	
 

	
 
void TwitterPlugin::RetweetResponse(std::string &user, std::string &errMsg)
 
{
 
	if(errMsg.length()) {
 
		handleMessage(user, adminLegacyName, errMsg, adminNickName);
 
		return;
 
	} else {
 
		handleMessage(user, adminLegacyName, "Retweet successful", adminNickName);
 
	}
 
}
0 comments (0 inline, 0 general)