void
TwitterConfigWidget::postGotTomahawkDirectMessageReply( const QTweetDMStatus& status )
{
    if ( status.id() == 0 )
        QMessageBox::critical( this, tr("Tweetin' Error"), tr("There was an error posting your direct message -- sorry!") );
    else
        QMessageBox::information( this, tr("Tweeted!"), tr("Your message has been posted!") );
}
Beispiel #2
0
void MainWindow::directMessageNewFinished(const QTweetDMStatus& directMessage)
{
    QTweetDirectMessageNew *dm = qobject_cast<QTweetDirectMessageNew*>(sender());
    if (dm) {
        qDebug() << "Direct Message sent, id: " << directMessage.id();
        dm->deleteLater();
    }
}
Beispiel #3
0
QTweetDMStatus QTweetConvert::jsonObjectToDirectMessage(const QJsonObject &jsonObject)
{
    QTweetDMStatus directMessage;

    directMessage.setCreatedAt(jsonObject.value("created_at").toString());
    directMessage.setSenderScreenName(jsonObject.value("sender_screen_name").toString());

    QJsonObject jsonObjectUser = jsonObject.value("sender").toObject();
    QTweetUser sender = jsonObjectToUser(jsonObjectUser);
    directMessage.setSender(sender);

    directMessage.setText(jsonObject.value("text").toString());
    directMessage.setRecipientScreenName(jsonObject["recipient_screen_name"].toString());
    directMessage.setId(static_cast<qint64>(jsonObject["id"].toDouble()));

    QJsonObject jsonObjectRecipient = jsonObject["recipient"].toObject();
    QTweetUser recipient = jsonObjectToUser(jsonObjectRecipient);
    directMessage.setRecipient(recipient);

    directMessage.setRecipientId(static_cast<qint64>(jsonObject["recipient_id"].toDouble()));
    directMessage.setSenderId(static_cast<qint64>(jsonObject["sender_id"].toDouble()));

    return directMessage;
}