dont cache key

This commit is contained in:
Patrick von Reth 2015-01-22 14:54:12 +01:00
parent 6e0ac042d0
commit 3044dbff33
2 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,11 @@ Toasty::~Toasty()
void Toasty::slotNotify(Notification notification) void Toasty::slotNotify(Notification notification)
{ {
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(m_key)); QString key = value("DeviceID").toString();
if (key.isEmpty()) {
return;
}
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(key));
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType); QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QHttpPart title; QHttpPart title;
title.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"title\"")); title.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"title\""));
@ -65,9 +69,7 @@ bool Toasty::initialize(SnoreCore *snore)
{ {
if (SnoreSecondaryBackend::initialize(snore)) { if (SnoreSecondaryBackend::initialize(snore)) {
setDefaultValue("DeviceID", "", "The ID provided for your device by Toasty"); setDefaultValue("DeviceID", "", "The ID provided for your device by Toasty");
m_key = value("DeviceID").toString(); return true;
snoreDebug(SNORE_DEBUG) << m_key << !m_key.isEmpty();
return !m_key.isEmpty();
} }
return false; return false;
} }

View File

@ -20,7 +20,6 @@ public slots:
virtual void slotNotify(Snore::Notification notification) override; virtual void slotNotify(Snore::Notification notification) override;
private: private:
QString m_key;
QNetworkAccessManager m_manager; QNetworkAccessManager m_manager;
}; };