version 0.0.4
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Sat, 19 Jan 2008 16:30:00 +0000 (17:30 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 19 Jan 2008 16:30:00 +0000 (17:30 +0100)
17 files changed:
admin/identitytrust.php [new file with mode: 0644]
admin/linkbar.php
include/db/sqlite3db/sqlite3statement.h
include/identitytestglobal.h
src/db/sqlite3statement.cpp
src/freenet/freenetmasterthread.cpp
src/freenet/identityinserter.cpp
src/freenet/identityintroductioninserter.cpp
src/freenet/identityintroductionrequester.cpp
src/freenet/identityrequester.cpp
src/freenet/introductionpuzzleinserter.cpp
src/freenet/introductionpuzzlerequester.cpp
src/freenet/trustlistinserter.cpp
src/freenet/trustlistrequester.cpp
src/freenet/trustlistxml.cpp
src/freenet/unkeyedidcreator.cpp
src/identitytestglobal.cpp

diff --git a/admin/identitytrust.php b/admin/identitytrust.php
new file mode 100644 (file)
index 0000000..51803f0
--- /dev/null
@@ -0,0 +1,44 @@
+<?php\r
+\r
+       include_once('config.php');\r
+       include_once('linkbar.php');\r
+       \r
+function content()\r
+{\r
+       \r
+       global $dblocation;\r
+       \r
+       $db=new PDO('sqlite:'.$dblocation);\r
+       $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;");\r
+       $st->execute();\r
+       ?>\r
+       <h2>Identity Trust</h2>\r
+       <table>\r
+               <tr>\r
+                       <th>Peer</th>\r
+                       <th>Local Message Trust</th>\r
+                       <th>Peer Message Trust</th>\r
+                       <th>Local Trust List Trust</th>\r
+                       <th>Peer Trust List Trust</th>\r
+               </tr>\r
+               <?php\r
+               while($record=$st->fetch())\r
+               {\r
+               ?>\r
+               <tr>\r
+                       <td><?php print($record[1]) ?></td>\r
+                       <td><?php print($record[2]) ?></td>\r
+                       <td><?php print($record[3]) ?></td>\r
+                       <td><?php print($record[4]) ?></td>\r
+                       <td><?php print($record[5]) ?></td>\r
+               </tr>\r
+               <?php   \r
+               }\r
+               ?>\r
+       </table>\r
+       <?php\r
+}\r
+       \r
+       include_once('template.php');\r
+\r
+?>
\ No newline at end of file
index 6f39f5e..3308497 100644 (file)
@@ -12,6 +12,7 @@ function linkbar()
                        <li><a href="introduce.php">Introduce Identity</a></li>\r
                        <li><a href="introductionstatus.php">Introduction Status</a></li>\r
                        <li><a href="addpeeridentity.php">Manually Add Peer</a></li>\r
+                       <li><a href="identitytrust.php">Identity Trust</a></li>\r
                </ul>\r
                </div>\r
 <?php\r
index 835d359..6294c8e 100644 (file)
@@ -14,7 +14,7 @@ class Statement
 public:\r
        Statement();\r
        Statement(sqlite3_stmt *statement);\r
-       Statement(Statement &rhs);\r
+       Statement(const Statement &rhs);\r
        virtual ~Statement();\r
 \r
        virtual const int ParameterCount() { return m_parametercount; }\r
@@ -36,6 +36,7 @@ public:
 \r
        virtual const bool Bind(const int column);\r
        virtual const bool Bind(const int column, const int value);\r
+       virtual const bool Bind(const int column, const long value)                     { return Bind(column,static_cast<int>(value)); }\r
        virtual const bool Bind(const int column, const double value);\r
        virtual const bool Bind(const int column, const std::string &value);\r
        virtual const bool Bind(const int column, const void *data, const int length);\r
index b15d875..17f6278 100644 (file)
@@ -4,7 +4,7 @@
 #include <vector>\r
 #include <zthread/Thread.h>\r
 \r
-#define FMS_VERSION    "0.0.3"\r
+#define FMS_VERSION    "0.0.4"\r
 \r
 // opens database and creates tables and initial inserts if necessary\r
 void SetupDB();\r
index edb2f60..39c699f 100644 (file)
@@ -30,7 +30,7 @@ Statement::Statement(sqlite3_stmt *statement)
        }\r
 }\r
 \r
-Statement::Statement(Statement &rhs)\r
+Statement::Statement(const Statement &rhs)\r
 {\r
        m_statement=NULL;\r
        m_parametercount=0;\r
index 7a593fc..bef4930 100644 (file)
@@ -62,7 +62,7 @@ const bool FreenetMasterThread::FCPConnect()
                m_receivednodehello=false;\r
        }\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" trying to connect to node "+m_fcphost);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect trying to connect to node "+m_fcphost);\r
 \r
        if(m_fcp.Connect(m_fcphost.c_str(),m_fcpport)==true)\r
        {\r
@@ -71,7 +71,7 @@ const bool FreenetMasterThread::FCPConnect()
                // send ClientHello message to node\r
                m_fcp.SendMessage("ClientHello",2,"Name",clientname.c_str(),"ExpectedVersion","2.0");\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" connected to node");\r
+               m_log->WriteLog(LogFile::LOGLEVEL_INFO,"FreenetMasterThread::FCPConnect connected to node");\r
 \r
                return true;\r
        }\r
@@ -113,7 +113,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message)
                        {\r
                                info+="\t\t\t\t"+(*mi).first+"="+(*mi).second+"\r\n";\r
                        }\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" received unhandled "+message.GetName()+" message.  Message content :\r\n"+info);\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::HandleMessage received unhandled "+message.GetName()+" message.  Message content :\r\n"+info);\r
 \r
                        // if unhandled message was alldata - we must retrieve the data\r
                        if(message.GetName()=="AllData")\r
@@ -138,7 +138,7 @@ const bool FreenetMasterThread::HandleMessage(FCPMessage &message)
        }\r
        else\r
        {\r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" received "+message.GetName()+" message before NodeHello");\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::HandleMessage received "+message.GetName()+" message before NodeHello");\r
        }\r
 \r
        return false;\r
@@ -174,7 +174,7 @@ void FreenetMasterThread::run()
                        if(FCPConnect()==false)\r
                        {\r
 \r
-                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" could not connect to node.  Waiting 60 seconds.");\r
+                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run could not connect to node.  Waiting 60 seconds.");\r
 \r
                                // wait 60 seconds - will then try to connect again\r
                                try\r
index 4fac82f..571546a 100644 (file)
@@ -82,14 +82,14 @@ const bool IdentityInserter::HandleMessage(FCPMessage &message)
                {\r
                        m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false', LastInsertedIdentity='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";");\r
                        m_db->Execute("INSERT INTO tblLocalIdentityInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");");\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted Identity xml");\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage inserted Identity xml");\r
                        return true;\r
                }\r
 \r
                if(message.GetName()=="PutFailed")\r
                {\r
                        m_db->Execute("UPDATE tblLocalIdentity SET InsertingIdentity='false' WHERE LocalIdentityID="+idparts[1]+";");\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting identity xml.  Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityInserter::HandleMessage failure inserting Identity xml.  Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
                        \r
                        // if code 9 (collision), then insert index into inserted table\r
                        if(message["Code"]=="9")\r
index dce7b78..aff048b 100644 (file)
@@ -61,7 +61,7 @@ const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message)
                        if(message["Fatal"]=="true" || message["Code"]=="9")\r
                        {\r
                                m_db->Execute("DELETE FROM tblIdentityIntroductionInserts WHERE UUID='"+idparts[3]+"';");\r
-                               m_log->WriteLog(LogFile::LOGLEVEL_WARNING,__FUNCTION__" received fatal error trying to insert IdentityIntroduction "+idparts[3]);\r
+                               m_log->WriteLog(LogFile::LOGLEVEL_WARNING,"IdentityIntroductionInserter::HandleMessage received fatal error trying to insert IdentityIntroduction "+idparts[3]);\r
                        }\r
                        m_inserting=false;\r
                        return true;\r
@@ -71,7 +71,7 @@ const bool IdentityIntroductionInserter::HandleMessage(FCPMessage &message)
                {\r
                        m_db->Execute("UPDATE tblIdentityIntroductionInserts SET Inserted='true' WHERE UUID='"+idparts[3]+"';");\r
                        m_inserting=false;\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" successfully inserted IdentityIntroduction "+idparts[3]);\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_INFO,"IdentityIntroductionInserter::HandleMessage successfully inserted IdentityIntroduction "+idparts[3]);\r
                        return true;\r
                }\r
 \r
@@ -150,7 +150,7 @@ void IdentityIntroductionInserter::StartInsert(const long localidentityid, const
        }\r
        else\r
        {\r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" could not find a public key for identity.  It is probably a new identity that doesn't have a key yet.");\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionInserter::StartInsert could not find a public key for identity.  It is probably a new identity that doesn't have a key yet.");\r
        }\r
 \r
 }
\ No newline at end of file
index a474c9c..9fee644 100644 (file)
@@ -91,10 +91,10 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message)
                }\r
                else\r
                {\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" parsed public SSK key was not valid.");\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData parsed public SSK key was not valid.");\r
                }\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IdentityIntroduction XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData parsed IdentityIntroduction XML file : "+message["Identifier"]);\r
        }\r
        else\r
        {\r
@@ -104,7 +104,7 @@ const bool IdentityIntroductionRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();          \r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IdentityIntroduction XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityIntroductionRequester::HandleAllData error parsing IdentityIntroduction XML file : "+message["Identifier"]);\r
        }\r
 \r
        // remove UUID from request list\r
@@ -127,7 +127,7 @@ const bool IdentityIntroductionRequester::HandleGetFailed(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" Fatal GetFailed for "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityIntroductionRequester::HandleAllData Fatal GetFailed for "+message["Identifier"]);\r
        }\r
 \r
        // remove UUID from request list\r
@@ -279,7 +279,6 @@ void IdentityIntroductionRequester::StartRequest(const std::string &UUID)
        st.Bind(0,UUID);\r
        st.Step();\r
 \r
-       //TODO finish\r
        if(st.RowReturned())\r
        {\r
                st.ResultText(0,day);\r
index 229cc7b..9dc58e1 100644 (file)
@@ -104,7 +104,7 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed Identity XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IdentityRequester::HandleAllData parsed Identity XML file : "+message["Identifier"]);\r
        }\r
        else\r
        {\r
@@ -116,7 +116,7 @@ const bool IdentityRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing Identity XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleAllData error parsing Identity XML file : "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
@@ -149,7 +149,7 @@ const bool IdentityRequester::HandleGetFailed(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IdentityRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
index ea78ace..a4b6617 100644 (file)
@@ -118,7 +118,7 @@ const bool IntroductionPuzzleInserter::HandlePutFailed(FCPMessage &message)
                m_db->Execute("UPDATE tblIntroductionPuzzleInserts SET Day='"+idparts[5]+"', InsertIndex="+idparts[2]+", FoundSolution='true' WHERE UUID='"+idparts[3]+"';");\r
        }\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failed to insert puzzle "+idparts[3]);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutFailed failed to insert puzzle "+idparts[3]);\r
 \r
        return true;\r
 }\r
@@ -149,7 +149,7 @@ const bool IntroductionPuzzleInserter::HandlePutSuccessful(FCPMessage &message)
        st.Step();\r
        st.Finalize();\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted puzzle "+idparts[3]);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::HandlePutSuccessful inserted puzzle "+idparts[3]);\r
 \r
        return true;\r
 }\r
@@ -240,6 +240,6 @@ void IntroductionPuzzleInserter::StartInsert(const long localidentityid)
        m_db->Execute("UPDATE tblLocalIdentity SET InsertingPuzzle='true' WHERE LocalIdentityID="+idstring+";");\r
        m_db->Execute("INSERT INTO tblIntroductionPuzzleInserts(UUID,Type,MimeType,LocalIdentityID,PuzzleData,PuzzleSolution) VALUES('"+xml.GetUUID()+"','captcha','image/bmp',"+idstring+",'"+encodedpuzzle+"','"+solutionstring+"');");\r
 \r
-       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" started insert for id "+idstring);\r
+       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleInserter::StartInsert started insert for id "+idstring);\r
 \r
 }\r
index 70a2e8e..c42e4cb 100644 (file)
@@ -76,7 +76,7 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed IntroductionPuzzle XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"IntroductionPuzzleRequester::HandleAllData parsed IntroductionPuzzle XML file : "+message["Identifier"]);\r
        }\r
        else\r
        {\r
@@ -88,7 +88,7 @@ const bool IntroductionPuzzleRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing IntroductionPuzzle XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleAllData error parsing IntroductionPuzzle XML file : "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
@@ -121,7 +121,7 @@ const bool IntroductionPuzzleRequester::HandleGetFailed(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"IntroductionPuzzleRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
index c5cc7df..ca689ee 100644 (file)
@@ -68,14 +68,14 @@ const bool TrustListInserter::HandleMessage(FCPMessage &message)
                {\r
                        m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false', LastInsertedTrustList='"+now.Format("%Y-%m-%d %H:%M:%S")+"' WHERE LocalIdentityID="+idparts[1]+";");\r
                        m_db->Execute("INSERT INTO tblTrustListInserts(LocalIdentityID,Day,InsertIndex) VALUES("+idparts[1]+",'"+idparts[4]+"',"+idparts[2]+");");\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" inserted TrustList xml");\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage inserted TrustList xml");\r
                        return true;\r
                }\r
 \r
                if(message.GetName()=="PutFailed")\r
                {\r
                        m_db->Execute("UPDATE tblLocalIdentity SET InsertingTrustList='false' WHERE LocalIdentityID="+idparts[1]+";");\r
-                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" failure inserting TrustList xml.  Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListInserter::HandleMessage failure inserting TrustList xml.  Code="+message["Code"]+" Description="+message["CodeDescription"]);\r
                        \r
                        // if code 9 (collision), then insert index into inserted table\r
                        if(message["Code"]=="9")\r
index 5b13a6d..f14fc5b 100644 (file)
@@ -112,7 +112,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,__FUNCTION__" parsed TrustList XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"TrustListRequester::HandleAllData parsed TrustList XML file : "+message["Identifier"]);\r
        }\r
        else\r
        {\r
@@ -124,7 +124,7 @@ const bool TrustListRequester::HandleAllData(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" error parsing TrustList XML file : "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleAllData error parsing TrustList XML file : "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
@@ -157,7 +157,7 @@ const bool TrustListRequester::HandleGetFailed(FCPMessage &message)
                st.Step();\r
                st.Finalize();\r
 \r
-               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__" fatal error requesting "+message["Identifier"]);\r
+               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListRequester::HandleGetFailed fatal error requesting "+message["Identifier"]);\r
        }\r
 \r
        // remove this identityid from request list\r
index 1b36aa3..0d0df5c 100644 (file)
@@ -134,7 +134,7 @@ const bool TrustListXML::ParseXML(const std::string &xml)
                        }\r
                        else\r
                        {\r
-                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,__FUNCTION__," malformed Trust in TrustList.xml");\r
+                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"TrustListXML::ParseXML malformed Trust in TrustList.xml");\r
                        }\r
                        \r
                        node=node->NextSibling("Trust");\r
index df46469..6facf86 100644 (file)
@@ -75,7 +75,7 @@ const bool UnkeyedIDCreator::HandleMessage(FCPMessage &message)
                                SaveKeys(id,message["RequestURI"],message["InsertURI"]);\r
                        }\r
 \r
-                       m_log->WriteLog(LogFile::LOGLEVEL_INFO,__FUNCTION__" received keypair");\r
+                       m_log->WriteLog(LogFile::LOGLEVEL_INFO,"UnkeyedIDCreator::HandleMessage received keypair");\r
 \r
                        m_waiting=false;\r
 \r
index 4b40288..985cb3f 100644 (file)
@@ -126,6 +126,45 @@ void SetupDB()
                                TrustListTrust          INTEGER CHECK(TrustListTrust BETWEEN 0 AND 100)\\r
                                );");\r
 \r
+       db->Execute("CREATE TABLE IF NOT EXISTS tblBoard(\\r
+                               BoardID                         INTEGER PRIMARY KEY,\\r
+                               BoardName                       TEXT UNIQUE,\\r
+                               BoardDescription        TEXT,\\r
+                               DateAdded                       DATETIME\\r
+                               );");\r
+\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('fms','Freenet Message System','2007-12-01');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('freenet','Discussion about Freenet','2007-12-01');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('public','Public discussion','2007-12-01');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('test','Test board','2007-12-01');");\r
+\r
+       db->Execute("CREATE TABLE IF NOT EXISTS tblMessage(\\r
+                               MessageID                       INTEGER PRIMARY KEY,\\r
+                               MessageDate                     DATE,\\r
+                               MessageTime                     TIME,\\r
+                               Subject                         TEXT,\\r
+                               MessageUUID                     TEXT UNIQUE,\\r
+                               ReplyBoardID            INTEGER,\\r
+                               Body                            TEXT\\r
+                               );");\r
+\r
+       db->Execute("CREATE TABLE IF NOT EXISTS tblMessageReplyTo(\\r
+                               MessageID                       INTEGER,\\r
+                               ReplyToMessageID        INTEGER,\\r
+                               Order                           INTEGER\\r
+                               );");\r
+       \r
+       db->Execute("CREATE TABLE IF NOT EXISTS tblMessageBoard(\\r
+                               MessageID                       INTEGER,\\r
+                               BoardID                         INTEGER\\r
+                               );");\r
+\r
+       // low / high / message count for each board\r
+       db->Execute("CREATE VIEW IF NOT EXISTS vwBoardStats AS \\r
+                               SELECT tblBoard.BoardID AS 'BoardID', IFNULL(MIN(MessageID),0) AS 'LowMessageID', IFNULL(MAX(MessageID),0) AS 'HighMessageID', COUNT(MessageID) AS 'MessageCount' \\r
+                               FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID \\r
+                               GROUP BY tblBoard.BoardID;");\r
+\r
        // calculates peer trust\r
        db->Execute("CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \\r
                                SELECT TargetIdentityID, \\r