[Kita-svn] [2494] add PostData class

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 7月 29日 (水) 22:53:03 JST


Revision: 2494
          http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2494
Author:   nogu
Date:     2009-07-29 22:53:03 +0900 (Wed, 29 Jul 2009)

Log Message:
-----------
add PostData class

Modified Paths:
--------------
    kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt

Added Paths:
-----------
    kita/branches/KITA-KDE4/kita/src/libkita/postdata.cpp
    kita/branches/KITA-KDE4/kita/src/libkita/postdata.h

Modified: kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt	2009-07-29 12:20:02 UTC (rev 2493)
+++ kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt	2009-07-29 13:53:03 UTC (rev 2494)
@@ -19,6 +19,7 @@
     k2ch.cpp
     jbbs.cpp
     machibbs.cpp
+    postdata.cpp
     thread.cpp
     thread.h
     threadinfo.cpp

Added: kita/branches/KITA-KDE4/kita/src/libkita/postdata.cpp
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/postdata.cpp	                        (rev 0)
+++ kita/branches/KITA-KDE4/kita/src/libkita/postdata.cpp	2009-07-29 13:53:03 UTC (rev 2494)
@@ -0,0 +1,66 @@
+/***************************************************************************
+ *   Copyright (C) 2006 by Kita Developers                                 *
+ *   ikemo****@users*****                                            *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ ***************************************************************************/
+#include "postdata.h"
+
+#include "account.h"
+#include "datmanager.h"
+
+using namespace Kita;
+
+PostData::PostData(const KUrl& datUrl, const QString& name, const QString& mail,
+        const QString& body, const QString& boardId)
+{
+    m_datUrl = datUrl;
+    m_name = name;
+    m_mail = mail;
+    m_body = body;
+    m_boardId = boardId;
+    m_threadId = DatManager::threadID(m_datUrl);
+    m_serverTime = DatManager::getServerTime(m_datUrl);
+    /* login */
+    if (DatManager::is2chThread(m_datUrl) && Account::isLogged()) {
+        m_sessionId = KUrl::toPercentEncoding(Account::getSessionID());
+    } 
+}
+
+const QString& PostData::name() const
+{
+    return m_name;
+}
+
+const QString& PostData::mail() const
+{
+    return m_mail;
+}
+
+const QString& PostData::body() const
+{
+    return m_body;
+}
+
+const QString& PostData::boardId() const
+{
+    return m_boardId;
+}
+
+const QString& PostData::threadId() const
+{
+    return m_threadId;
+}
+
+int PostData::serverTime() const
+{
+    return m_serverTime;
+}
+
+const QString& PostData::sessionId() const
+{
+    return m_sessionId;
+}

Added: kita/branches/KITA-KDE4/kita/src/libkita/postdata.h
===================================================================
--- kita/branches/KITA-KDE4/kita/src/libkita/postdata.h	                        (rev 0)
+++ kita/branches/KITA-KDE4/kita/src/libkita/postdata.h	2009-07-29 13:53:03 UTC (rev 2494)
@@ -0,0 +1,43 @@
+/***************************************************************************
+ *   Copyright (C) 2006 by Kita Developers                                 *
+ *   ikemo****@users*****                                            *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ ***************************************************************************/
+#ifndef POSTDATA_H
+#define POSTDATA_H
+
+#include <QtCore/QString>
+
+#include <kurl.h>
+
+namespace Kita {
+    class KDE_EXPORT PostData {
+        public:
+            PostData(const KUrl& datUrl, const QString& name,
+                    const QString& mail, const QString& body,
+                    const QString& boardId);
+
+            const QString& name() const;
+            const QString& mail() const;
+            const QString& body() const;
+            const QString& boardId() const;
+            const QString& threadId() const;
+            int serverTime() const;
+            const QString& sessionId() const;
+        private:
+            KUrl m_datUrl;
+            QString m_name;
+            QString m_mail;
+            QString m_body;
+            QString m_boardId;
+            QString m_threadId;
+            int m_serverTime;
+            QString m_sessionId;
+    };
+}
+
+#endif




Kita-svn メーリングリストの案内
Back to archive index