bool QXmppVersionManager::handleStanza(const QDomElement &element) { if (element.tagName() == "iq" && QXmppVersionIq::isVersionIq(element)) { QXmppVersionIq versionIq; versionIq.parse(element); if(versionIq.type() == QXmppIq::Get) { // respond to query QXmppVersionIq responseIq; responseIq.setType(QXmppIq::Result); responseIq.setId(versionIq.id()); responseIq.setTo(versionIq.from()); responseIq.setName(clientName()); responseIq.setVersion(clientVersion()); responseIq.setOs(clientOs()); client()->sendPacket(responseIq); } emit versionReceived(versionIq); return true; } return false; }
QValueList<Mirror> Sites::siteList() { KURL url; url.setProtocol( "http" ); url.setHost( "freedb.freedb.org" ); url.setPort( 80 ); url.setPath( "/~cddb/cddb.cgi" ); url.setQuery( QString::null ); QString hello = QString("%1 %2 %3 %4") .arg(user_, localHostName_, clientName(), clientVersion()); url.addQueryItem( "cmd", "sites" ); url.addQueryItem( "hello", hello ); url.addQueryItem( "proto", "5" ); QValueList<Mirror> result; QString tmpFile; if( KIO::NetAccess::download( url, tmpFile, 0 ) ) { result = readFile( tmpFile ); KIO::NetAccess::removeTempFile( tmpFile ); } return result; }
void CDDBPLookup::sendHandshake() { QString handshake = QString::fromLatin1( "cddb hello %1 %2 %3 %4" ) .arg( user_ ) .arg( localHostName_ ) .arg( clientName() ) .arg( clientVersion() ); writeLine( handshake ); }
void HTTPLookup::makeURL( const QString & cmd ) { QString hello = QString::fromLatin1("%1 %2 %3 %4") .arg(user_, localHostName_, clientName(), clientVersion()); // The whole query has to constructed each time as the // CDDB CGI script expects the parameters in strict order QUrlQuery query; query.addQueryItem( QLatin1String( "cmd" ), cmd ); query.addQueryItem( QLatin1String( "hello" ), hello ); query.addQueryItem( QLatin1String( "proto" ), QLatin1String( "6" ) ); cgiURL_.setQuery( query ); }
void NSISUpdater::showDialog(const UpdateInfo &info) { // if the version tag is set, there is a newer version. QDialog *msgBox = new QDialog; msgBox->setAttribute(Qt::WA_DeleteOnClose); QIcon infoIcon = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0); int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0); msgBox->setWindowIcon(infoIcon); QVBoxLayout *layout = new QVBoxLayout(msgBox); QHBoxLayout *hlayout = new QHBoxLayout; layout->addLayout(hlayout); msgBox->setWindowTitle(tr("New Version Available")); QLabel *ico = new QLabel; ico->setFixedSize(iconSize, iconSize); ico->setPixmap(infoIcon.pixmap(iconSize)); QLabel *lbl = new QLabel; QString txt = tr("<p>A new version of the %1 Client is available.</p>" "<p><b>%2</b> is available for download. The installed version is %3.</p>") .arg(Utility::escape(Theme::instance()->appNameGUI()), Utility::escape(info.versionString()), Utility::escape(clientVersion())); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); lbl->setWordWrap(true); hlayout->addWidget(ico); hlayout->addWidget(lbl); QDialogButtonBox *bb = new QDialogButtonBox; bb->setWindowFlags(bb->windowFlags() & ~Qt::WindowContextHelpButtonHint); QPushButton *skip = bb->addButton(tr("Skip this version"), QDialogButtonBox::ResetRole); QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); connect(skip, &QAbstractButton::clicked, msgBox, &QDialog::reject); connect(reject, &QAbstractButton::clicked, msgBox, &QDialog::reject); connect(getupdate, &QAbstractButton::clicked, msgBox, &QDialog::accept); connect(skip, &QAbstractButton::clicked, this, &NSISUpdater::slotSetSeenVersion); connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl())); layout->addWidget(bb); msgBox->open(); }
void FingerprintQueryRequest::start() { time_t now; time( &now ); QString time = QString::number( now ); //QString time = QString::number( 1186743888 ); // Concatenate pw hash with time QString auth = passwordMd5() + time; QString authLower = passwordMd5Lower() + time; // Hash the concatenated string to create auth code QString authMd5 = UnicornUtils::md5Digest( auth.toUtf8() ); QString authMd5Lower = UnicornUtils::md5Digest( authLower.toUtf8() ); QString baseUrl = "http://www.last.fm/fingerprint/query/"; QString url = baseUrl + "?artist=" + QUrl::toPercentEncoding( m_track.artist() ) + "&album=" + QUrl::toPercentEncoding( m_track.album() ) + "&track=" + QUrl::toPercentEncoding( m_track.track() ) + "&duration=" + QString::number( m_track.duration() ) + "&mbid=" + QUrl::toPercentEncoding( m_track.mbId() ) + "&filename=" + QUrl::toPercentEncoding( QFileInfo( m_track.path() ).completeBaseName() ) + "&tracknum=" + QString::number( m_track.trackNr() ) + "&username="******"&sha256=" + sha256() + "&time=" + time + "&auth=" + authMd5 + "&authlower=" + authMd5Lower + "&fpversion=" + QUrl::toPercentEncoding( fpVersion() ) + "&fulldump=false" + "&clientversion=" + clientVersion(); #ifndef QT_NO_DEBUG // This causes the fp to not be written to the database. Use // during debugging only. //url += "&noupdate=true"; #endif // TODO: add //genre //samplerate qDebug() << url; QHttpRequestHeader header( "POST", url, 1, 1 ); setHost( "www.last.fm", 80 ); header.setValue( "Host", "www.last.fm" ); header.setValue( "Content-Type", "multipart/form-data; boundary=----------------------------8e61d618ca16" ); header.setValue( "Accept", "*/*" ); QByteArray bytes; bytes.append( "------------------------------8e61d618ca16\r\n" ); bytes.append( "Content-Disposition: " ); bytes.append( "form-data; name=\"fpdata\"" ); bytes.append( "\r\n\r\n" ); bytes.append( data() ); bytes.append( "\r\n"); bytes.append( "------------------------------8e61d618ca16--\r\n"); int contentLength = bytes.length(); header.setContentLength(contentLength); post( header, bytes ); }