Ejemplo n.º 1
0
/*++
* @method: twitCurl::friendshipShow
*
* @description: method to show all friends
*
* @input: userInfo - user id or screen name of a user of whom friends need to be shown
*         isUserId - true if userInfo contains a user id instead of screen name
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::friendshipShow( std::string& userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_FRIENDSHIPSSHOW_URL;
        if( userInfo.length() )
        {
            /* Append username to the URL */
            if( isUserId )
            {
                buildUrl.append( twitCurlDefaults::TWITCURL_TARGETUSERID.c_str() );
            }
            else
            {
                buildUrl.append( twitCurlDefaults::TWITCURL_TARGETSCREENNAME.c_str() );
            }
            buildUrl.append( userInfo.c_str() );
        }

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 2
0
/*++
* @method: twitCurl::oAuthRequestToken
*
* @description: method to get a request token key and secret. this token
*               will be used to get authorize user and get PIN from twitter
*
* @input: authorizeUrl is an output parameter. this method will set the url
*         in this string. user should visit this link and get PIN from that page.
*
* @output: true if everything went sucessfully, otherwise false
*
*--*/
bool twitCurl::oAuthRequestToken( std::string& authorizeUrl /* out */ )
{
    bool retVal = false;

    authorizeUrl.assign( "" );

    if( isCurlInit() )
    {
        /* Get OAuth header for request token */
        std::string oAuthHeader( "" );
        if( m_oAuth.getOAuthHeader( eOAuthHttpGet, oAuthTwitterApiUrls::OAUTHLIB_TWITTER_REQUEST_TOKEN_URL, std::string( "" ), oAuthHeader ) )
        {
            if( performGet( oAuthTwitterApiUrls::OAUTHLIB_TWITTER_REQUEST_TOKEN_URL, oAuthHeader ) )
            {
                /* Tell OAuth object to save access token and secret from web response */
                std::string twitterResp( "" );
                getLastWebResponse( twitterResp );
                m_oAuth.extractOAuthTokenKeySecret( twitterResp );

                /* Get access token and secret from OAuth object */
                std::string oAuthTokenKey( "" );
                m_oAuth.getOAuthTokenKey( oAuthTokenKey );

                /* Build authorize url so that user can visit in browser and get PIN */
                authorizeUrl.assign( oAuthTwitterApiUrls::OAUTHLIB_TWITTER_AUTHORIZE_URL.c_str() );
                authorizeUrl.append( oAuthTokenKey.c_str() );

                retVal = true;
            }
        }
    }
    return retVal;
}
Ejemplo n.º 3
0
/*++
* @method: twitCurl::mentionsGet
*
* @description: method to get mentions
*
* @input: none
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::mentionsGet()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_MENTIONS_URL );
    }
    return retVal;
}
Ejemplo n.º 4
0
/*++
* @method: twitCurl::savedSearchGet
*
* @description: gets authenticated user's saved search queries.
*
* @input: none
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::savedSearchGet( )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_SAVEDSEARCHGET_URL );
    }
    return retVal;
}
Ejemplo n.º 5
0
/*++
* @method: twitCurl::accountRateLimitGet
*
* @description: method to get API rate limit of current user
*
* @input: none
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::accountRateLimitGet()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_ACCOUNTRATELIMIT_URL );
    }
    return retVal;
}
Ejemplo n.º 6
0
/*++
* @method: twitCurl::favoriteGet
*
* @description: method to get favorite users' statuses
*
* @input: none
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::favoriteGet()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_FAVORITESGET_URL );
    }
    return retVal;
}
Ejemplo n.º 7
0
/*++
* @method: twitCurl::timelineFriendsGet
*
* @description: method to get friends 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::timelineFriendsGet()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_FRIENDS_TIMELINE_URL );
    }
    return retVal;
}
Ejemplo n.º 8
0
/*++
* @method: twitCurl::directMessageGetSent
*
* @description: method to get sent direct messages
*
* @input: none
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::directMessageGetSent()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_DIRECTMESSAGESSENT_URL );
    }
    return retVal;
}
Ejemplo n.º 9
0
/*++
* @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()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_FEATURED_USERS_URL );
    }
    return retVal;
}
Ejemplo n.º 10
0
/*++
* @method: twitCurl::timelinePublicGet
*
* @description: method to get public 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::timelinePublicGet()
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Perform GET */
        retVal = performGet( twitterDefaults::TWITCURL_PUBLIC_TIMELINE_URL );
    }
    return retVal;
}
Ejemplo n.º 11
0
GaduRosterService::GaduRosterService(GaduListHelper *gaduListHelper, const QVector<Contact> &contacts, Protocol *protocol) :
		RosterService{contacts, protocol},
		m_stateMachine{new GaduRosterStateMachine{this, protocol}},
		m_gaduListHelper{gaduListHelper}
{
	connect(this, SIGNAL(contactAdded(Contact)), this, SLOT(rosterChanged()));
	connect(this, SIGNAL(contactRemoved(Contact)), this, SLOT(rosterChanged()));
	connect(this, SIGNAL(contactUpdatedLocally(Contact)), this, SLOT(rosterChanged()));

	connect(m_stateMachine, SIGNAL(performGet()), SLOT(importContactList()));
	connect(m_stateMachine, SIGNAL(performPut()), SLOT(exportContactList()));
}
Ejemplo n.º 12
0
/*++
* @method: twitCurl::followersIdsGet
*
* @description: method to show IDs of all followers of a twitter user
*
* @input: userInfo - user id or screen name of a user
*         isUserId - true if userInfo contains a user id instead of screen name
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::followersIdsGet( std::string& userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_FOLLOWERSIDS_URL, userInfo, isUserId );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 13
0
/*++
* @method: twitCurl::friendsGet
*
* @description: method to get a user's friends
*
* @input: userInfo - screen name or user id in string format,
*         isUserId - true if userInfo contains an id
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::friendsGet( std::string userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Set URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_SHOWFRIENDS_URL, userInfo, isUserId );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 14
0
/*++
* @method: twitCurl::timelineUserGet
*
* @description: method to get mentions
*
* @input: userInfo - screen name or user id in string format,
*         isUserId - true if userInfo contains an id
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::timelineUserGet( std::string userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_USERTIMELINE_URL, userInfo, isUserId );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 15
0
/*++
* @method: twitCurl::savedSearchShow
*
* @description: method to retrieve the data for a saved search owned by the authenticating user 
*               specified by the given id.
*
* @input: searchId - id in string format of the search to be displayed
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::savedSearchShow( std::string& searchId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_SAVEDSEARCHSHOW_URL;
        buildUrl.append( searchId.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 16
0
/*++
* @method: twitCurl::statusShowById
*
* @description: method to get a status message by its id
*
* @input: statusId - a number in std::string format
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::statusShowById( std::string& statusId )
{
    bool retVal = false;
    if( isCurlInit() && statusId.length() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_STATUSSHOW_URL;
        buildUrl.append( statusId.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 17
0
/*++
* @method: twitCurl::search
*
* @description: method to return tweets that match a specified query.
*
* @input: query - search query in string format
*
* @output: true if GET is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::search( std::string& query )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_SEARCH_URL;
        buildUrl.append( twitCurlDefaults::TWITCURL_SEARCHQUERYSTRING.c_str() );        
        buildUrl.append( query.c_str() );

        /* Perform GET */
        retVal = performGet( buildUrl );
    }
    return retVal;
}
Ejemplo n.º 18
0
/*++
* @method: twitCurl::oAuthAccessToken
*
* @description: method to exchange request token with access token
*
* @input: none
*
* @output: true if everything went sucessfully, otherwise false
*
*--*/
bool twitCurl::oAuthAccessToken()
{
    bool retVal = false;
    
    if( isCurlInit() )
    {
        /* Get OAuth header for access token */
        std::string oAuthHeader( "" );
        if( m_oAuth.getOAuthHeader( eOAuthHttpGet, oAuthTwitterApiUrls::OAUTHLIB_TWITTER_ACCESS_TOKEN_URL, std::string( "" ), oAuthHeader, true ) )
        {
            if( performGet( oAuthTwitterApiUrls::OAUTHLIB_TWITTER_ACCESS_TOKEN_URL, oAuthHeader ) )
            {
                /* Tell OAuth object to save access token and secret from web response */
                std::string twitterResp( "" );
                getLastWebResponse( twitterResp );
                m_oAuth.extractOAuthTokenKeySecret( twitterResp );

                retVal = true;
            }
        }
    }
    return retVal;
}