diff --git a/backends/twitter/Requests/OAuthFlow.cpp b/backends/twitter/Requests/OAuthFlow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b77437dc5f39b358d7141bfa12459fac5d129db --- /dev/null +++ b/backends/twitter/Requests/OAuthFlow.cpp @@ -0,0 +1,19 @@ +#include "OAuthFlow.h" +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->handleMessage(user, "twitter-account", "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->OAuthFlowComplete(user, twitObj); + } +}