Esempio n. 1
0
  void Student::loadIdentity(Session& session, AsyncCallback callback) {
    session.get("/users/self/logins",
      [&, callback](bool success, HTTP::Response const &response) -> void {
        ResourceParser parser;
        std::vector<Student::Login*> logins;
        Student::Login* login;

        if (!success) {
          callback(false);
          return;
        }

        logins = parser.parseResources<Student::Login>(response.body);
        login = logins.front();

        if (login) {
          mId = login->userId();
          setUuidPrefix(Utility::stringify(mId));
          buildUrl();
        }

        std::for_each(logins.begin(), logins.end(), [](Student::Login* login) {
          delete login;
        });

        logins.clear();

        buildUrl();

        callback(true);
      });
  }
Esempio n. 2
0
static QString checkHaveArtist(const QSet<QString> &mpdArtists, const QString &artist)
{
    if (mpdArtists.contains(artist)) {
        return QLatin1String("<a href=\"")+buildUrl(artist)+QLatin1String("\">")+artist+QLatin1String("</a>");
    } else {
        // Check for AC/DC -> AC-DC
        QString mod=artist;
        mod=mod.replace("/", "-");
        if (mod!=artist && mpdArtists.contains(mod)) {
            return QLatin1String("<a href=\"")+buildUrl(mod)+QLatin1String("\">")+artist+QLatin1String("</a>");
        }
    }
    return QString();
}
Esempio n. 3
0
 QuizSubmission::QuizSubmission(ID id, Quiz const *quiz)
 : Resource(id),
   mQuiz(quiz)
 {
   reset();
   buildUrl();
 }
Esempio n. 4
0
SeleniumServerHub::SeleniumServerHub(QString host, int port) :
    QObject()
{ 
    m_result = "";

    buildUrl(host, port);
}
Esempio n. 5
0
void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase, 
												   std::string const & channel,
												   std::string const & version,
												   std::string const & platform,
												   std::string const & platform_version,
												   unsigned char       uniqueid[MD5HEX_STR_SIZE],
												   bool                willing_to_test)
{
	if (!mInProgress)
	{
		mInProgress = true;

		mUrlBase     	 = urlBase;
		mChannel     	 = channel;
		mVersion     	 = version;
		mPlatform        = platform;
		mPlatformVersion = platform_version;
		memcpy(mUniqueId, uniqueid, MD5HEX_STR_SIZE);
		mWillingToTest   = willing_to_test;
	
		mProtocol = sProtocolVersion;

		std::string checkUrl = buildUrl(urlBase, channel, version, platform, platform_version, uniqueid, willing_to_test);
		LL_INFOS("UpdaterService") << "checking for updates at " << checkUrl << LL_ENDL;
	
		mHttpClient.get(checkUrl, this);
	}
	else
	{
		LL_WARNS("UpdaterService") << "attempting to restart a check when one is in progress; ignored" << LL_ENDL;
	}
}
Esempio n. 6
0
void Pastebin::submitPaste(const QString& pasteContent, const QString& pasteTitle, const QString& format, const QString& expiration, const PasteListing::Visibility visibility) {
    qDebug() << "submitPaste()";

    QNetworkRequest request(buildUrl("http://pastebin.com/api/api_post.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, URLENCODED_CONTENT_TYPE);

    QUrl params;
    params.addQueryItem("api_dev_key", PASTEBIN_DEV_KEY);
    params.addQueryItem("api_user_key", apiKey());
    params.addQueryItem("api_option", "paste");
    params.addQueryItem("api_paste_code", pasteContent);
    params.addQueryItem("api_paste_private", QString("%1").arg(static_cast<int>(visibility)));
    if(!pasteTitle.isEmpty()) {
        params.addQueryItem("api_paste_name", pasteTitle);
    }
    if(!expiration.isEmpty()) {
        params.addQueryItem("api_paste_expire_date", expiration);
    }
    if(!format.isEmpty()) {
        params.addQueryItem("api_paste_format", format);
    }

    QNetworkReply *reply = accessManager_.post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(onSubmitPasteFinished()));
}
Esempio n. 7
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;
}
Esempio n. 8
0
void Pastebin::requestTrending() {
    QNetworkRequest request(buildUrl("http://pastebin.com/api/api_post.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, URLENCODED_CONTENT_TYPE);

    QUrl params;
    params.addQueryItem("api_dev_key", PASTEBIN_DEV_KEY);
    params.addQueryItem("api_option", "trends");

    QNetworkReply *reply = accessManager_.post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(onTrendingFinished()));
}
Esempio n. 9
0
void Pastebin::login(const QString& username, const QString& password) {
    QNetworkRequest request(buildUrl("http://pastebin.com/api/api_login.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, URLENCODED_CONTENT_TYPE);

    QUrl params;
    params.addQueryItem("api_dev_key", PASTEBIN_DEV_KEY);
    params.addQueryItem("api_user_name", username.toUtf8());
    params.addQueryItem("api_user_password", password.toUtf8());

    QNetworkReply *reply = accessManager_.post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(onLoginFinished()));
}
Esempio n. 10
0
int main(int argc, char* argv[]) {
    QCoreApplication a(argc, argv);

    buildUrl();
    getColors();

    RestClient client;
    Runner r;
    TestRunner* runner = getColorsAsync(client);
    QObject::connect(runner, SIGNAL(done()), &r, SLOT(run()));

    return a.exec();
}
Esempio n. 11
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;
}
Esempio n. 12
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;
}
Esempio n. 13
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;
}
Esempio n. 14
0
/*++
* @method: twitCurl::friendshipDestroy
*
* @description: method to delete a twitter user from friend list (unfollow a 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 DELETE is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::friendshipDestroy( std::string& userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() && userInfo.length() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_FRIENDSHIPSDESTROY_URL, userInfo, isUserId );

        /* Perform DELETE */
        retVal = performDelete( buildUrl );        
    }
    return retVal;
}
Esempio n. 15
0
  void QuizSubmission::deserialize(JSONValue& root) {
    mId = root.get("id", 0).asUInt();
    mSubmissionId = root.get("submission_id", 0).asUInt();
    mUserId = root.get("user_id", 0).asUInt();
    mAttempt = root.get("attempt", 0).asUInt();
    mStartedAt = root.get("started_at", "").asString();
    mFinishedAt = root.get("finished_at", "").asString();
    mEndAt = root.get("end_at", "").asString();
    mValidationToken = root.get("validation_token", "").asString();
    mWorkflowState = root.get("workflow_state", "").asString();
    mScore = root.get("score", "").asDouble();
    mKeptScore = root.get("kept_score", "").asDouble();

    buildUrl();
  }
Esempio n. 16
0
/*++
* @method: twitCurl::savedSearchDestroy
*
* @description: method to destroy a saved search for the authenticated user. The search specified 
*               by id must be owned by the authenticating user.
*
* @input: searchId - search id of item to be deleted
*
* @output: true if DELETE is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::savedSearchDestroy( std::string& searchId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_SAVEDSEARCHDESTROY_URL;
        buildUrl.append( searchId.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform DELETE */
        retVal = performDelete( buildUrl );
    }
    return retVal;
}
Esempio n. 17
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;
}
Esempio n. 18
0
/*++
* @method: twitCurl::directMessageDestroyById
*
* @description: method to delete direct messages by its id
*
* @input: dMsgId - id of direct message in string format
*
* @output: true if DELETE is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::directMessageDestroyById( std::string& dMsgId )
{
    bool retVal = false;
    if( isCurlInit() && dMsgId.length() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_DIRECTMESSAGEDESTROY_URL;
        buildUrl.append( dMsgId.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform DELETE */
        retVal = performDelete( buildUrl );
    }
    return retVal;
}
Esempio n. 19
0
void LaconicaSearch::requestSearchResults(const SearchInfo &searchInfo,
                                          const ChoqokId& sinceStatusId,
                                          uint count, uint page)
{
    kDebug();
    KUrl url = buildUrl( searchInfo, sinceStatusId, count, page );
    kDebug()<<url;
    KIO::StoredTransferJob *job = KIO::storedGet( url, KIO::Reload, KIO::HideProgressInfo );
    if( !job ) {
        kError() << "Cannot create an http GET request!";
        return;
    }
    mSearchJobs[job] = searchInfo;
    connect( job, SIGNAL( result( KJob* ) ), this, SLOT( searchResultsReturned( KJob* ) ) );
    job->start();
}
Esempio n. 20
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;
}
Esempio n. 21
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;
}
Esempio n. 22
0
/*++
* @method: twitCurl::favoriteDestroy
*
* @description: method to delete a favorited the status
*
* @input: statusId - id in string format of the favorite status to be deleted
*
* @output: true if DELETE is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::favoriteDestroy( std::string& statusId )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_FAVORITEDESTROY_URL;
        buildUrl.append( statusId.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform DELETE */
        retVal = performDelete( buildUrl );
    }
    return retVal;
}
Esempio n. 23
0
/*++
* @method: twitCurl::blockDestroy
*
* @description: method to unblock a user
*
* @input: userInfo - user id or screen name
*
* @output: true if DELETE is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::blockDestroy( std::string& userInfo )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_BLOCKSDESTROY_URL;
        buildUrl.append( userInfo.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Perform DELETE */
        retVal = performDelete( buildUrl );
    }
    return retVal;
}
Esempio n. 24
0
void Pastebin::requestDeletePaste(const QString& pasteKey)
{
    qDebug().nospace() << "requestDeletePaste(" << pasteKey << ")";

    QNetworkRequest request(buildUrl("http://pastebin.com/api/api_post.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, URLENCODED_CONTENT_TYPE);
    request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), pasteKey);

    QUrl params;
    params.addQueryItem("api_dev_key", PASTEBIN_DEV_KEY);
    params.addQueryItem("api_user_key", apiKey());
    params.addQueryItem("api_paste_key", pasteKey);
    params.addQueryItem("api_option", "delete");

    QNetworkReply *reply = accessManager_.post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(onDeletePasteFinished()));
}
Esempio n. 25
0
void SOSClient::sendResultTemplate(const char* offeringID, Sensor* s)
{
    HttpChunkedRequest postReq(this->client);
    postReq.connect(server, port);
    postReq.startPost(server, path, "text/xml; charset=utf-8");

    XMLWriter w(&postReq);//&Serial);
    w.tagStart("InsertResultTemplate");
    w.tagField("service", "SOS");
    w.tagField("version", "2.0.0");
    w.tagEnd(true, false);
    w.tagOpen("proposedTemplate");

    w.tagStart("ResultTemplate");
#ifndef OSH_NOXMLNS
    char nsUri[40];
    buildUrl(OGC_NS_PREFIX, SWE_NS, nsUri);
    w.tagField(w.buildTagName(XMLNS_PREFIX, SWE_PREFIX), nsUri);
#endif
    w.tagEnd(true, false);

    w.writeNode("offering", offeringID);

    w.tagOpen("resultStructure");
    s->writeOutput(w);
    w.tagClose();

    w.tagOpen("resultEncoding");
    w.tagStart("TextEncoding");
    w.tagField("tokenSeparator", ",");
    w.tagField("blockSeparator", "&#x0D;");
    w.tagEnd(true, true);
    w.tagClose();

    w.tagClose();
    w.tagClose();
    w.tagClose();

    postReq.end();

    String templateID = readResponseTag("acceptedTemplate");
    s->setStreamID(templateID);
    Serial.print("Template ID is ");
    Serial.println(templateID);
}
Esempio n. 26
0
void MoviesMainForm::prepareTheatreInfo(uint_t theatreRow)
{
    assert(NULL != theatres);
    theatreRow *= 2;
    assert(theatreRow < theatres->getItemsCount());
    
    const char_t* theatreName = theatres->getItemText(theatreRow, theatreNameIndex);
    const char_t* theatreAddress = theatres->getItemText(theatreRow, theatreAddressIndex);

    DefinitionModel* model = new_nt DefinitionModel();
    if (NULL == model)
    {
        application().alert(notEnoughMemoryAlert);
        return;
    }
    Definition::Elements_t& elems = model->elements;
    TextElement* text;
    elems.push_back(text=new TextElement(theatreName));
    text->setStyle(StyleGetStaticStyle(styleNamePageTitle));
    if (0 != tstrlen(theatreAddress))
    {
        elems.push_back(new LineBreakElement());
        elems.push_back(text=new TextElement(theatreAddress));
    }
    elems.push_back(new LineBreakElement());
    const uint_t moviesRow = theatreRow + 1;
    const uint_t moviesCount = theatres->getItemElementsCount(moviesRow)/2;
    for (uint_t i = 0; i<moviesCount; ++i)
    {   
        const char_t* movieTitle = theatres->getItemText(moviesRow, i*2);
        const char_t* movieHours = theatres->getItemText(moviesRow, i*2+1);
        BulletElement* bull;
        elems.push_back(bull = new BulletElement());
        bull->setStyle(StyleGetStaticStyle(styleNameHeader));
        elems.push_back(text=new TextElement(movieTitle));
        text->setParent(bull);
        text->setStyle(StyleGetStaticStyle(styleNameHeader));
        text->setHyperlink(buildUrl(urlSchemaMovie, movieTitle), hyperlinkUrl);
        elems.push_back(new LineBreakElement());
        elems.push_back(text=new TextElement(movieHours));
        text->setParent(bull);
    }
    infoRenderer_.setModel(model, Definition::ownModel);
}
Esempio n. 27
0
/*++
* @method: twitCurl::savedSearchCreate
*
* @description: creates a saved search for the authenticated user
*
* @input: query - the query of the search the user would like to save
*
* @output: true if POST is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::savedSearchCreate( std::string& query )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_SAVEDSEARCHCREATE_URL;

        /* Send some dummy data in POST */
        std::string queryStr;
        queryStr = twitCurlDefaults::TWITCURL_QUERYSTRING;
        queryStr.append( query );

        /* Perform POST */
        retVal = performPost( buildUrl, queryStr );
    }
    return retVal;
}
Esempio n. 28
0
/*++
* @method: twitCurl::directMessageSend
*
* @description: method to send direct message to a user
*
* @input: userInfo - screen name or user id of a user to whom message needs to be sent,
*         dMsg - message
*         isUserId - true if userInfo contains target user's id
*
* @output: true if POST is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::directMessageSend( std::string& userInfo, std::string& dMsg, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() && userInfo.length() && dMsg.length() )
    {
        /* Prepare new direct message */
        std::string newDm( "" );
        newDm = twitCurlDefaults::TWITCURL_TEXTSTRING;
        newDm.append( dMsg.c_str() );

        /* Prepare URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_DIRECTMESSAGENEW_URL, userInfo, isUserId );

        /* Perform POST */
        retVal = performPost( buildUrl, newDm );        
    }
    return retVal;
}
Esempio n. 29
0
/*++
* @method: twitCurl::friendshipCreate
*
* @description: method to add a twitter user as friend (follow a 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 POST is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::friendshipCreate( std::string& userInfo, bool isUserId )
{
    bool retVal = false;
    if( isCurlInit() && userInfo.length() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        utilMakeUrlForUser( buildUrl, twitterDefaults::TWITCURL_FRIENDSHIPSCREATE_URL, userInfo, isUserId );

        /* Send some dummy data in POST */
        std::string dummyData( "" );
        dummyData = twitCurlDefaults::TWITCURL_TEXTSTRING;
        dummyData.append( "dummy" );

        /* Perform POST */
        retVal = performPost( buildUrl, dummyData );        
    }
    return retVal;
}
Esempio n. 30
0
/*++
* @method: twitCurl::blockCreate
*
* @description: method to block a user
*
* @input: userInfo - user id or screen name
*
* @output: true if POST is success, otherwise false. This does not check http
*          response by twitter. Use getLastWebResponse() for that.
*
*--*/
bool twitCurl::blockCreate( std::string& userInfo )
{
    bool retVal = false;
    if( isCurlInit() )
    {
        /* Prepare URL */
        std::string buildUrl( "" );
        buildUrl = twitterDefaults::TWITCURL_BLOCKSCREATE_URL;
        buildUrl.append( userInfo.c_str() );
        buildUrl.append( twitCurlDefaults::TWITCURL_EXTENSIONFORMAT.c_str() );

        /* Send some dummy data in POST */
        std::string dummyData( "" );
        dummyData = twitCurlDefaults::TWITCURL_TEXTSTRING;
        dummyData.append( "dummy" );

        /* Perform POST */
        retVal = performPost( buildUrl, dummyData );
    }
    return retVal;
}