Improved user command parsing

This commit is contained in:
Sarang Bharadwaj 2012-06-04 17:37:39 +05:30
parent b62ef77146
commit 81a71207d5
2 changed files with 6 additions and 4 deletions

View file

@ -5,9 +5,9 @@ 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";

View file

@ -102,8 +102,10 @@ void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std:
{
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);