Changeset - 81a71207d534
[Not reviewed]
0 2 0
Sarang Bharadwaj - 13 years ago 2012-06-04 14:07:39
sarang.bh@gmail.com
Improved user command parsing
2 files changed with 6 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/twitter/Requests/HelpMessageRequest.cpp
Show inline comments
 
@@ -2,15 +2,15 @@
 
DEFINE_LOGGER(logger, "HelpMessageRequest")
 
void HelpMessageRequest::run() 
 
{
 
	std::string helpMsg = "";
 
	helpMsg = helpMsg
 
			+ "\n******************************HELP************************************\n"
 
			+ "#status:<your status> ==> Update your status\n"
 
			+ "#status <your status> ==> Update your status\n"
 
			+ "#timeline             ==> Retrieve your timeline\n"
 
			+ "@<username>:<message> ==> Send a directed message to the user <username>\n"
 
			+ "@<username> <message> ==> Send a directed message to the user <username>\n"
 
			+ "#help                 ==> Print this help message\n"
 
			+ "************************************************************************\n";
 

	
 
	np->handleMessage(user, "twitter-account", helpMsg);
 
}
 

	
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -99,14 +99,16 @@ void TwitterPlugin::handleLogoutRequest(const std::string &user, const std::stri
 

	
 

	
 
void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &xhtml) 
 
{
 
	
 
	if(legacyName == "twitter-account") {
 
		std::string cmd = message.substr(0, message.find(':'));
 
		std::string data = message.substr(message.find(':') + 1);
 

	
 
		std::string cmd = "", data = "";
 
		std::istringstream in(message.c_str());
 
		in >> cmd >> data;
 
		
 
		handleMessage(user, "twitter-account", cmd + " " + data);
 

	
 
		if(cmd == "#pin") tp->runAsThread(new PINExchangeProcess(np, sessions[user], user, data));
 
		else if(cmd == "#help") tp->runAsThread(new HelpMessageRequest(np, user));
 
		else if(cmd[0] == '@') {
0 comments (0 inline, 0 general)