Follow project coding style. Issue #2192.

This commit is contained in:
buinsky 2014-12-07 23:33:36 +03:00
parent 513f71e000
commit dbc5ffee75

View file

@ -47,13 +47,11 @@ HttpResponse AbstractRequestHandler::run()
{
response_ = HttpResponse();
if (isBanned())
{
if (isBanned()) {
status(403, "Forbidden");
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."), CONTENT_TYPE_TXT);
}
else
{
else {
processRequest();
}
@ -105,8 +103,7 @@ void AbstractRequestHandler::printFile(const QString& path)
QByteArray data;
QString type;
if (!app_->readFile(path, data, type))
{
if (!app_->readFile(path, data, type)) {
status(404, "Not Found");
return;
}
@ -121,8 +118,7 @@ void AbstractRequestHandler::sessionInitialize()
void AbstractRequestHandler::sessionStart()
{
if (app_->sessionStart(this))
{
if (app_->sessionStart(this)) {
QNetworkCookie cookie(C_SID.toUtf8(), session_->id.toUtf8());
cookie.setPath("/");
header(HEADER_SET_COOKIE, cookie.toRawForm());
@ -131,18 +127,15 @@ void AbstractRequestHandler::sessionStart()
void AbstractRequestHandler::sessionEnd()
{
if (sessionActive())
{
if (sessionActive()) {
QNetworkCookie cookie(C_SID.toUtf8(), session_->id.toUtf8());
cookie.setPath("/");
cookie.setExpirationDate(QDateTime::currentDateTime());
if (app_->sessionEnd(this))
{
header(HEADER_SET_COOKIE, cookie.toRawForm());
}
}
}
bool AbstractRequestHandler::isBanned() const
{
@ -168,8 +161,7 @@ QString AbstractRequestHandler::saveTmpFile(const QByteArray &data)
{
QTemporaryFile tmpfile(QDir::temp().absoluteFilePath("qBT-XXXXXX.torrent"));
tmpfile.setAutoRemove(false);
if (tmpfile.open())
{
if (tmpfile.open()) {
tmpfile.write(data);
tmpfile.close();
return tmpfile.fileName();