Changeset - f1c11320c7d7
[Not reviewed]
0 3 0
Sarang Bharadwaj - 13 years ago 2012-05-29 16:08:29
sarang.bh@gmail.com
User timeline
3 files changed with 21 insertions and 1 deletions:
0 comments (0 inline, 0 general)
backends/twitter/libtwitcurl/twitcurl.cpp
Show inline comments
 
@@ -415,24 +415,42 @@ bool twitCurl::statusDestroyById( std::string& statusId )
 
*
 
* @output: true if GET is success, otherwise false. This does not check http
 
*          response by twitter. Use getLastWebResponse() for that.
 
*
 
*--*/
 
bool twitCurl::timelinePublicGet()
 
{
 
    /* Perform GET */
 
    return performGet( twitterDefaults::TWITCURL_PUBLIC_TIMELINE_URL +
 
                       twitCurlDefaults::TWITCURL_EXTENSIONFORMATS[m_eApiFormatType] );
 
}
 
 
/*++
 
* @method: twitCurl::timelineHomeGet
 
*
 
* @description: method to get home timeline
 
*
 
* @input: none
 
*
 
* @output: true if GET is success, otherwise false. This does not check http
 
*          response by twitter. Use getLastWebResponse() for that.
 
*
 
*--*/
 
bool twitCurl::timelineHomeGet()
 
{
 
    /* Perform GET */
 
    return performGet( twitterDefaults::TWITCURL_HOME_TIMELINE_URL +
 
                       twitCurlDefaults::TWITCURL_EXTENSIONFORMATS[m_eApiFormatType] );
 
}
 
 
/*++
 
* @method: twitCurl::featuredUsersGet
 
*
 
* @description: method to get featured users
 
*
 
* @input: none
 
*
 
* @output: true if GET is success, otherwise false. This does not check http
 
*          response by twitter. Use getLastWebResponse() for that.
 
*
 
*--*/
 
bool twitCurl::featuredUsersGet()
backends/twitter/libtwitcurl/twitcurl.h
Show inline comments
 
@@ -137,24 +137,25 @@ public:
 
    /* Twitter API type */
 
    void setTwitterApiType( twitCurlTypes::eTwitCurlApiFormatType eType );
 
 
    /* Twitter search APIs */
 
    bool search( std::string& searchQuery /* in */ );
 
 
    /* Twitter status APIs */
 
    bool statusUpdate( std::string& newStatus /* in */ );
 
    bool statusShowById( std::string& statusId /* in */ );
 
    bool statusDestroyById( std::string& statusId /* in */ );
 
 
    /* Twitter timeline APIs */
 
    bool timelineHomeGet();
 
    bool timelinePublicGet();
 
    bool timelineFriendsGet();
 
    bool timelineUserGet( bool trimUser /* in */, bool includeRetweets /* in */, unsigned int tweetCount /* in */, std::string userInfo = "" /* in */, bool isUserId = false /* in */ );
 
    bool featuredUsersGet();
 
    bool mentionsGet( std::string sinceId = "" /* in */ );
 
 
    /* Twitter user APIs */
 
    bool userGet( std::string& userInfo /* in */, bool isUserId = false /* in */ );
 
    bool friendsGet( std::string userInfo = "" /* in */, bool isUserId = false /* in */ );
 
    bool followersGet( std::string userInfo = "" /* in */, bool isUserId = false /* in */ );
 
 
    /* Twitter direct message APIs */
backends/twitter/main.cpp
Show inline comments
 
@@ -3,24 +3,25 @@
 
#include "transport/logging.h"
 
#include "transport/sqlite3backend.h"
 
#include "transport/mysqlbackend.h"
 
#include "transport/pqxxbackend.h"
 
#include "transport/storagebackend.h"
 
#include "Swiften/Swiften.h"
 
#include "unistd.h"
 
#include "signal.h"
 
#include "sys/wait.h"
 
#include "sys/signal.h"
 
#include <boost/algorithm/string.hpp>
 
#include "twitcurl.h"
 
#include "Swiften/Parser/StringTreeParser.h"
 

	
 
#include <iostream>
 
#include <sstream>
 
#include <map>
 
#include <vector>
 
#include <cstdio>
 
#include "userdb.h"
 

	
 
using namespace boost::filesystem;
 
using namespace boost::program_options;
 
using namespace Transport;
 

	
 
@@ -219,25 +220,25 @@ class TwitterPlugin : public NetworkPlugin {
 
					}
 
					
 
					LOG4CXX_INFO(logger, "Updated status for " << user << ": " << data);
 
				}
 

	
 
				if(cmd == "#timeline") {
 
					if(connectionState[user] != CONNECTED) {
 
						LOG4CXX_ERROR(logger, "Trying to update status for " << user << " when not connected!");
 
						return;
 
					}
 
					
 
					std::string replyMsg; 
 
					if( sessions[user]->timelinePublicGet() ) {
 
					if( sessions[user]->timelinePublicGet()/*(false, false, 20, sessions[user]->getTwitterUsername(), true)*/ ) {
 
						sessions[user]->getLastWebResponse( replyMsg );
 
						LOG4CXX_INFO(logger, "twitCurl::timeline web response: " << replyMsg );
 
						handleMessage(user, "twitter-account", replyMsg);
 
					} else {
 
						sessions[user]->getLastCurlError( replyMsg );
 
						LOG4CXX_INFO(logger, "twitCurl::timeline error: " << replyMsg );
 
					}
 

	
 
				}
 
			}
 
		}
 

	
0 comments (0 inline, 0 general)