Commit 228b7cce authored by Tobias Hunger's avatar Tobias Hunger

CPaster: Update pasting to pastebin.ca

* New API

Change-Id: I944a0fe52396ee1b3197b4bddc1744188eb40e90
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent abed438c
......@@ -77,18 +77,36 @@ void PasteBinDotCaProtocol::fetch(const QString &id)
m_fetchId = id;
}
static QByteArray toTypeId(Protocol::ContentType ct)
{
if (ct == Protocol::C)
return QByteArray(1, '3');
if (ct == Protocol::Cpp)
return QByteArray(1, '4');
if (ct == Protocol::JavaScript)
return QByteArray("27");
if (ct == Protocol::Diff)
return QByteArray( "34");
if (ct == Protocol::Xml)
return QByteArray("15");
return QByteArray(1, '1');
}
void PasteBinDotCaProtocol::paste(const QString &text,
ContentType /* ct */,
ContentType ct,
const QString &username,
const QString & /* comment */,
const QString &description)
{
QTC_ASSERT(!m_pasteReply, return)
QByteArray data = "content=";
QTC_ASSERT(!m_pasteReply, return);
QByteArray data = "api=+xKvWG+1UFXkr2Kn3Td4AnpYtCIjA4qt&";
data += "content=";
data += QUrl::toPercentEncoding(fixNewLines(text));
data += "&type=";
data += toTypeId(ct);
data += "&description=";
data += QUrl::toPercentEncoding(description);
data += "&type=1&expiry=1%20day&name=";
data += "expiry=1%20day&name=";
data += QUrl::toPercentEncoding(username);
// fire request
const QString link = QLatin1String(urlC) + QLatin1String("quiet-paste.php");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment