-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Henri Lampela - henri.lampela@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-#include <QStringList>
-#include "cookiehandler.h"
-
-CookieHandler::CookieHandler()
-{
- qDebug() << __PRETTY_FUNCTION__;
-}
-
-CookieHandler::~CookieHandler()
-{
- qDebug() << __PRETTY_FUNCTION__;
-}
-
-QString CookieHandler::formCookie(const QString &apiKeyValue, QString expiresValue,
- QString userValue, QString sessionKeyValue,
- QString sessionSecretValue, const QString &signatureValue,
- const QString &localeValue)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QString cookie;
- QString apiKey;
- QString user;
- QString expires;
- QString sessionKey;
- QString sessionSecret;
- QString locale;
- QString variable;
- QString signature = EQUAL_MARK;
- QStringList variableList;
-
- signature.append(signatureValue);
- apiKey.append(apiKeyValue);
- apiKey.append(UNDERLINE_MARK);
-
- user.append(USER);
- user.append(EQUAL_MARK);
- expires.append(EXPIRES);
- expires.append(EQUAL_MARK);
- sessionKey.append(SESSION_KEY);
- sessionKey.append(EQUAL_MARK);
- sessionSecret.append(SESSION_SECRET);
- sessionSecret.append(EQUAL_MARK);
- locale.append(LOCALE);
- locale.append(EQUAL_MARK);
- locale.append(localeValue);
-
- variableList.append(expires.append(expiresValue.append(BREAK_MARK)));
- variableList.append(sessionKey.append(sessionKeyValue.append(BREAK_MARK)));
- variableList.append(user.append(userValue).append(BREAK_MARK));
- variableList.append(sessionSecret.append(sessionSecretValue.append(BREAK_MARK)));
-
- cookie.append(BREAK_MARK);
-
- foreach(variable, variableList) {
- cookie.append(apiKey);
- cookie.append(variable);
- }
- apiKey.remove(UNDERLINE_MARK);
- cookie.append(apiKey);
- cookie.append(signature);
- cookie.append(BREAK_MARK);
- cookie.append(locale);
-
- qDebug() << cookie;
-
- return cookie;
-}