Twitter: better help
This commit is contained in:
parent
6f9fbae090
commit
57a728834d
4 changed files with 14 additions and 6 deletions
|
@ -3,16 +3,21 @@ DEFINE_LOGGER(logger, "HelpMessageRequest")
|
|||
void HelpMessageRequest::run()
|
||||
{
|
||||
helpMsg = helpMsg
|
||||
+ "\n******************************HELP************************************\n"
|
||||
+ "#status <your status> ==> Update your status\n"
|
||||
+ "You will receive tweets of people you follow from this contact."
|
||||
+ "Following commands can be used to manage your Twitter account:"
|
||||
+ "#timeline [username] ==> Retrieve <username>'s timeline; Default - own timeline\n"
|
||||
+ "#status <your status> ==> Update your status\n"
|
||||
+ "@<username> <message> ==> Send a directed message to the user <username>\n"
|
||||
+ "#retweet <unique_tweet_id> ==> Retweet the tweet having id <unique_tweet_id> \n"
|
||||
+ "#follow <username> ==> Follow user <username>\n"
|
||||
+ "#unfollow <username> ==> Stop Following user <username>\n"
|
||||
+ "#mode [012] ==> Switch mode to 0(single), 1(multiple) or 2(chatroom)\n"
|
||||
+ "#mode [01] ==> Switch mode to 0(single), 1(multiple). See below\n"
|
||||
+ "#help ==> Print this help message\n"
|
||||
+ "************************************************************************\n";
|
||||
+ "************************************************************************\n"
|
||||
+ "There are 3 ways how to use the gateway:\n"
|
||||
+ "Mode 0 - There is twitter.com contact in your roster and all Twitter messages are forwaded using this contact.\n"
|
||||
+ "Mode 1 - Same as Mode 0, but the people you follow are displayed in your roster. You will receive/send directed messages using those contacts.\n"
|
||||
+ "Joining the #twitter@" + jid + " room - You can join mentioned room and see people you follow there as well as the tweets they post. Private messages in that room are mapped to Twitter direct messages.";
|
||||
}
|
||||
|
||||
void HelpMessageRequest::finalize()
|
||||
|
|
|
@ -14,13 +14,15 @@ using namespace Transport;
|
|||
class HelpMessageRequest : public Thread
|
||||
{
|
||||
std::string user;
|
||||
std::string jid;
|
||||
std::string helpMsg;
|
||||
boost::function<void (std::string &, std::string &)> callBack;
|
||||
|
||||
public:
|
||||
HelpMessageRequest(const std::string &_user, boost::function<void (std::string &, std::string &)> cb) {
|
||||
HelpMessageRequest(const std::string &_user, const std::string &jid, boost::function<void (std::string &, std::string &)> cb) {
|
||||
user = _user;
|
||||
callBack = cb;
|
||||
this->jid = jid;
|
||||
}
|
||||
|
||||
void run();
|
||||
|
|
|
@ -39,6 +39,7 @@ void PINExchangeProcess::finalize()
|
|||
}
|
||||
np->pinExchangeComplete(user, OAuthAccessTokenKey, OAuthAccessTokenSecret);
|
||||
np->handleMessage(user, "twitter.com", "PIN is OK. You are now authorized.");
|
||||
np->handleMessage(user, "twitter.com", "Send '#help' (without the quotes) to see how to use this transport.");
|
||||
LOG4CXX_INFO(logger, user << ": Sent PIN " << data << " and obtained Access Token");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ void TwitterPlugin::handleMessageSendRequest(const std::string &user, const std:
|
|||
if(cmd == "#pin")
|
||||
tp->runAsThread(new PINExchangeProcess(np, userdb[user].sessions, user, data));
|
||||
else if(cmd == "#help")
|
||||
tp->runAsThread(new HelpMessageRequest(user, boost::bind(&TwitterPlugin::helpMessageResponse, this, _1, _2)));
|
||||
tp->runAsThread(new HelpMessageRequest(user, CONFIG_STRING(config, "service.jid"), boost::bind(&TwitterPlugin::helpMessageResponse, this, _1, _2)));
|
||||
else if(cmd[0] == '@') {
|
||||
std::string username = cmd.substr(1);
|
||||
tp->runAsThread(new DirectMessageRequest(userdb[user].sessions, user, username, data,
|
||||
|
|
Loading…
Add table
Reference in a new issue