version 0.2.6
authorSomeDude <SomeDude@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw>
Mon, 31 Mar 2008 17:15:00 +0000 (19:15 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 31 Mar 2008 17:15:00 +0000 (19:15 +0200)
22 files changed:
include/board.h
include/datetime.h
include/freenet/boardlistrequester.h
include/freenet/messagerequester.h
include/global.h
readme.txt
src/board.cpp
src/boardlist.cpp
src/datetime.cpp
src/freenet/boardlistrequester.cpp
src/freenet/boardlistxml.cpp
src/freenet/freenetmasterthread.cpp
src/freenet/identityxml.cpp
src/freenet/messagerequester.cpp
src/freenet/messagexml.cpp
src/freenet/periodicdbmaintenance.cpp
src/global.cpp
src/http/pages/boardspage.cpp
src/http/pages/createidentitypage.cpp
src/http/pages/localidentitiespage.cpp
src/http/pages/peerdetailspage.cpp
src/http/pages/peertrustpage.cpp

index a5479d3..bdc5852 100644 (file)
@@ -13,19 +13,20 @@ public:
        Board();\r
        Board(const long boardid);\r
        Board(const std::string &boardname);\r
-       Board(const long boardid, const std::string &boardname, const std::string &boarddescription, const std::string datecreated, const long lowmessageid, const long highmessageid, const long messagecount, const bool savereceivedmessages);\r
+       Board(const long boardid, const std::string &boardname, const std::string &boarddescription, const std::string datecreated, const long lowmessageid, const long highmessageid, const long messagecount, const bool savereceivedmessages, const std::string &addedmethod);\r
 \r
        const bool Load(const long boardid);\r
        const bool Load(const std::string &boardname);\r
 \r
-       const long GetBoardID() const { return m_boardid; }\r
-       std::string GetBoardName() const { return m_boardname; }\r
-       std::string GetBoardDescription() const { return m_boarddescription; }\r
-       DateTime GetDateCreated() const { return m_datecreated; }\r
-       const long GetLowMessageID() const { return m_lowmessageid; }\r
-       const long GetHighMessageID() const { return m_highmessageid; }\r
-       const long GetMessageCount() const { return m_messagecount; }\r
-       const bool GetSaveReceivedMessages() const { return m_savereceivedmessages; }\r
+       const long GetBoardID() const                           { return m_boardid; }\r
+       std::string GetBoardName() const                        { return m_boardname; }\r
+       std::string GetBoardDescription() const         { return m_boarddescription; }\r
+       DateTime GetDateCreated() const                         { return m_datecreated; }\r
+       const long GetLowMessageID() const                      { return m_lowmessageid; }\r
+       const long GetHighMessageID() const                     { return m_highmessageid; }\r
+       const long GetMessageCount() const                      { return m_messagecount; }\r
+       const bool GetSaveReceivedMessages() const      { return m_savereceivedmessages; }\r
+       std::string GetAddedMethod() const                      { return m_addedmethod; }\r
 \r
 private:\r
        void SetDateFromString(const std::string &datestring);\r
@@ -38,6 +39,7 @@ private:
        long m_highmessageid;           // highest id of all message currently in this board\r
        long m_messagecount;            // number of messages in this board\r
        bool m_savereceivedmessages;\r
+       std::string m_addedmethod;\r
 };\r
 \r
 #endif // _board_\r
index c1f549f..cd6df2c 100644 (file)
@@ -67,25 +67,28 @@ public:
        DateTime &operator-=(const double &rhs);\r
        DateTime &operator-=(const DateTime &rhs);\r
        \r
-       const bool operator==(const DateTime &rhs) const { return m_timet==rhs.m_timet; }\r
+       const bool operator==(const DateTime &rhs) const { return *this==rhs.m_tm; }\r
        const bool operator==(const time_t &rhs) const { return m_timet==rhs; }\r
        const bool operator==(const struct tm &rhs) const;\r
        \r
-       const bool operator<(const DateTime &rhs) const { return (m_timet<rhs.m_timet); }\r
+       const bool operator<(const DateTime &rhs) const { return (*this<rhs.m_tm); }\r
        const bool operator<(const time_t &rhs) const { return (m_timet<rhs); }\r
+       const bool operator<(const struct tm &rhs) const;\r
        \r
-       const bool operator<=(const DateTime &rhs) const { return (*this<rhs || *this==rhs); }\r
+       const bool operator<=(const DateTime &rhs) const { return (*this<rhs.m_tm || *this==rhs.m_tm); }\r
        const bool operator<=(const time_t &rhs) const { return (m_timet<=rhs); }\r
+       const bool operator<=(const struct tm &rhs) const { return (*this<rhs || *this==rhs); }\r
        \r
-       const bool operator>(const DateTime &rhs) const { return (m_timet>rhs.m_timet); }\r
+       const bool operator>(const DateTime &rhs) const { return !(*this<=rhs.m_tm); }\r
        const bool operator>(const time_t &rhs) const { return (m_timet>rhs); }\r
        \r
-       const bool operator>=(const DateTime &rhs) const { return (*this>rhs || *this==rhs); }\r
+       const bool operator>=(const DateTime &rhs) const { return !(*this<rhs.m_tm); }\r
        const bool operator>=(const time_t &rhs) const { return (m_timet>=rhs); }\r
        \r
 private:\r
+       const time_t TimeGM(struct tm *gmtimein);\r
 \r
-       time_t m_timet;\r
+       time_t m_timet;         // don't use timet for any comparisons\r
        struct tm m_tm;\r
 };\r
 \r
index 580b4f8..a917e0a 100644 (file)
@@ -16,6 +16,8 @@ private:
        const bool HandleAllData(FCPMessage &message);\r
        const bool HandleGetFailed(FCPMessage &message);\r
 \r
+       std::string GetIdentityName(const long identityid);\r
+\r
        bool m_savemessagesfromnewboards;\r
 \r
 };\r
index fd453ee..31eb580 100644 (file)
@@ -16,7 +16,7 @@ private:
        const bool HandleAllData(FCPMessage &message);\r
        const bool HandleGetFailed(FCPMessage &message);\r
 \r
-       const long GetBoardID(const std::string &boardname);\r
+       const long GetBoardID(const std::string &boardname, const std::string &identityname);\r
        const bool SaveToBoard(const std::string &boardname);\r
        const std::string GetIdentityName(const long identityid);\r
 \r
index f2b227b..8b781f9 100644 (file)
@@ -4,7 +4,7 @@
 #include <vector>\r
 #include "pthreadwrapper/thread.h"\r
 \r
-#define FMS_VERSION    "0.2.5"\r
+#define FMS_VERSION    "0.2.6"\r
 \r
 // opens database and creates tables and initial inserts if necessary\r
 void SetupDB();\r
@@ -13,6 +13,7 @@ void ConvertDB0101To0103();
 void ConvertDB0103To0104();\r
 void ConvertDB0104To0105();\r
 void ConvertDB0105To0106();\r
+void ConvertDB0106To0107();\r
 // inserts default options into the database\r
 void SetupDefaultOptions();\r
 // opens logfile and sets it up\r
index e853ecb..593a99f 100644 (file)
@@ -13,13 +13,13 @@ to the cmake command.
 UPGRADING\r
 ---------\r
 It is always a good idea to make copies of your current FMS installation before\r
-continuing.  First shut down FMS and then replace the binary and template.htm\r
-with those from the new version.  You may keep the same database unless\r
-otherwise noted.\r
+continuing.  First shut down FMS and then replace the binary and templates with\r
+those from the new version.  You may keep the same database unless otherwise\r
+noted.\r
 \r
 INSTALLATION\r
 ------------\r
-Place the binary and template.htm in a directory of your choice.  On the first\r
+Place the binary and any templates in a directory of your choice.  On the first\r
 run, a database file will also be created in this directory.  Make sure the\r
 user that runs FMS has read/write access to this directory.\r
 \r
@@ -85,8 +85,8 @@ web interface.
 \r
 A note on NULL trust:  If you neither trust or distrust an identity, they will\r
 have NULL trust (no trust at all).  You will download messages and trust lists\r
-from identities with NULL peer trust as long as the local trust level is above\r
-your configured minimum.  You will also download messages from identities with\r
-NULL local message trust (the peer message trust must be NULL or > your\r
+from identities with NULL peer trust as long as the local trust level is at or\r
+above your configured minimum.  You will also download messages from identities\r
+with NULL local message trust (the peer message trust must be NULL or >= your\r
 configured minimum as well), but you will not download trust lists from\r
 identities with NULL local trust list trust.\r
index 99350f5..7ccac3b 100644 (file)
@@ -15,6 +15,7 @@ Board::Board()
        m_highmessageid=0;\r
        m_messagecount=0;\r
        m_savereceivedmessages=true;\r
+       m_addedmethod="";\r
 }\r
 \r
 Board::Board(const long boardid)\r
@@ -27,7 +28,7 @@ Board::Board(const std::string &boardname)
        Load(boardname);\r
 }\r
 \r
-Board::Board(const long boardid, const std::string &boardname, const std::string &boarddescription, const std::string datecreated, const long lowmessageid, const long highmessageid, const long messagecount, const bool savereceivedmessages)\r
+Board::Board(const long boardid, const std::string &boardname, const std::string &boarddescription, const std::string datecreated, const long lowmessageid, const long highmessageid, const long messagecount, const bool savereceivedmessages, const std::string &addedmethod)\r
 {\r
        m_boardid=boardid;\r
        m_boardname=boardname;\r
@@ -36,6 +37,7 @@ Board::Board(const long boardid, const std::string &boardname, const std::string
        m_highmessageid=highmessageid;\r
        m_messagecount=messagecount;\r
        m_savereceivedmessages=savereceivedmessages;\r
+       m_addedmethod=addedmethod;\r
 \r
        SetDateFromString(datecreated);\r
 \r
@@ -52,8 +54,9 @@ const bool Board::Load(const long boardid)
        m_lowmessageid=0;\r
        m_highmessageid=0;\r
        m_messagecount=0;\r
+       m_addedmethod="";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardID=?;");\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardID=?;");\r
        st.Bind(0,boardid);\r
        st.Step();\r
 \r
@@ -88,6 +91,7 @@ const bool Board::Load(const long boardid)
                {\r
                        m_savereceivedmessages=false;\r
                }\r
+               st.ResultText(7,m_addedmethod);\r
 \r
                return true;\r
        }\r
@@ -124,8 +128,9 @@ const bool Board::Load(const std::string &boardname)                // same as loading form bo
        m_highmessageid=0;\r
        m_messagecount=0;\r
        int tempint=-1;\r
+       m_addedmethod="";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, tblBoard.BoardID FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardName=?;");\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, tblBoard.BoardID, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID WHERE tblBoard.BoardName=?;");\r
        st.Bind(0,boardname);\r
        st.Step();\r
 \r
@@ -161,6 +166,7 @@ const bool Board::Load(const std::string &boardname)                // same as loading form bo
                {\r
                        m_savereceivedmessages=false;\r
                }\r
+               st.ResultText(8,m_addedmethod);\r
 \r
                return true;\r
        }\r
index cd6e071..931e096 100644 (file)
@@ -17,8 +17,9 @@ void BoardList::Load()
        int highmessageid=0;\r
        int lowmessageid=0;\r
        int messagecount=0;\r
+       std::string addedmethod="";\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT tblBoard.BoardID, BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID ORDER BY BoardName COLLATE NOCASE;");\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT tblBoard.BoardID, BoardName, BoardDescription, DateAdded, HighMessageID, LowMessageID, MessageCount, SaveReceivedMessages, AddedMethod FROM tblBoard LEFT JOIN vwBoardStats ON tblBoard.BoardID=vwBoardStats.BoardID ORDER BY BoardName COLLATE NOCASE;");\r
        st.Step();\r
        \r
        while(st.RowReturned())\r
@@ -31,6 +32,7 @@ void BoardList::Load()
                st.ResultInt(5,lowmessageid);\r
                st.ResultInt(6,messagecount);\r
                st.ResultText(7,savereceivedstr);\r
+               st.ResultText(8,addedmethod);\r
 \r
                if(savereceivedstr=="true")\r
                {\r
@@ -41,7 +43,7 @@ void BoardList::Load()
                        savereceived=false;\r
                }\r
 \r
-               push_back(Board(boardid,boardname,boarddescription,dateadded,lowmessageid,highmessageid,messagecount,savereceived));\r
+               push_back(Board(boardid,boardname,boarddescription,dateadded,lowmessageid,highmessageid,messagecount,savereceived,addedmethod));\r
                st.Step();\r
        }\r
 }\r
index f2d85e9..404cb31 100644 (file)
@@ -187,6 +187,11 @@ const bool DateTime::operator==(const struct tm &rhs) const
        return (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min==rhs.tm_min && m_tm.tm_sec==rhs.tm_sec) ? true : false;\r
 }\r
 \r
+const bool DateTime::operator<(const struct tm &rhs) const\r
+{\r
+       return (m_tm.tm_year<rhs.tm_year || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon<rhs.tm_mon) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday<rhs.tm_mday) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour<rhs.tm_hour) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min<rhs.tm_min) || (m_tm.tm_year==rhs.tm_year && m_tm.tm_mon==rhs.tm_mon && m_tm.tm_mday==rhs.tm_mday && m_tm.tm_hour==rhs.tm_hour && m_tm.tm_min==rhs.tm_min && m_tm.tm_sec==rhs.tm_sec));\r
+}\r
+\r
 void DateTime::Set(const int year, const int month, const int day, const int hour, const int minute, const int second)\r
 {\r
        m_tm.tm_year=year-1900;\r
@@ -410,3 +415,27 @@ void DateTime::SetToLocalTime()
        m_tm=*localtime(&m_timet);\r
        Normalize();\r
 }\r
+\r
+const time_t DateTime::TimeGM(struct tm *gmtimein)\r
+{\r
+       //This looks good but I don't think will work when TZ isn't set (Windows)\r
+       //http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/timegm.3.html\r
+       \r
+       //This should work\r
+       //http://lists2.ais.fraunhofer.de/pipermail/emx/1999-September/000874.html\r
+\r
+       struct tm ttm;\r
+       time_t t, t2;\r
+\r
+       ttm = *gmtimein;       /* make a local copy to fiddle with */\r
+       ttm.tm_isdst = 0;      /* treat it as standard time */\r
+\r
+       t2 = t = mktime(&ttm); /* calculate the time as a local time */\r
+\r
+       ttm = *gmtime(&t2);    /* now calculate the difference between */\r
+       ttm.tm_isdst = 0;      /* gm and local time */\r
+       t2 = mktime(&ttm);\r
+\r
+       t += t - t2;          /* and adjust our answer by that difference */\r
+       return t;\r
+}\r
index 099242d..9fbc6b2 100644 (file)
@@ -15,6 +15,36 @@ BoardListRequester::BoardListRequester(FCPv2 *fcp):IIndexRequester<long>(fcp)
        Initialize();\r
 }\r
 \r
+std::string BoardListRequester::GetIdentityName(const long identityid)\r
+{\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey FROM tblIdentity WHERE IdentityID=?;");\r
+       st.Bind(0,identityid);\r
+       st.Step();\r
+       if(st.RowReturned())\r
+       {\r
+               std::vector<std::string> keyparts;\r
+               std::string key;\r
+               std::string name;\r
+               st.ResultText(0,name);\r
+               st.ResultText(1,key);\r
+               \r
+               StringFunctions::SplitMultiple(key,"@,",keyparts);\r
+               \r
+               if(keyparts.size()>1)\r
+               {\r
+                       return name+"@"+keyparts[1];\r
+               }\r
+               else\r
+               {\r
+                       return name+"@invalidpublickey";\r
+               }\r
+       }\r
+       else\r
+       {\r
+               return "";\r
+       }\r
+}\r
+\r
 const bool BoardListRequester::HandleAllData(FCPMessage &message)\r
 {      \r
        DateTime now;\r
@@ -25,6 +55,7 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message)
        BoardListXML xml;\r
        long identityid;\r
        long index;\r
+       std::string identityname="";\r
 \r
        now.SetToGMTime();\r
        StringFunctions::Split(message["Identifier"],"|",idparts);\r
@@ -32,6 +63,8 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message)
        StringFunctions::Convert(idparts[1],identityid);\r
        StringFunctions::Convert(idparts[2],index);\r
 \r
+       identityname=GetIdentityName(identityid);\r
+\r
        // wait for all data to be received from connection\r
        while(m_fcp->Connected() && m_fcp->ReceiveBufferSize()<datalength)\r
        {\r
@@ -53,7 +86,7 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message)
        {\r
 \r
                SQLite3DB::Statement brd=m_db->Prepare("SELECT BoardID,BoardName,BoardDescription FROM tblBoard WHERE BoardName=?;");\r
-               SQLite3DB::Statement ins=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,SaveReceivedMessages) VALUES(?,?,?,?);");\r
+               SQLite3DB::Statement ins=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,SaveReceivedMessages,AddedMethod) VALUES(?,?,?,?,?);");\r
                SQLite3DB::Statement upd=m_db->Prepare("UPDATE tblBoard SET BoardDescription=? WHERE BoardID=?;");\r
                for(long i=0; i<xml.GetCount(); i++)\r
                {\r
@@ -89,6 +122,7 @@ const bool BoardListRequester::HandleAllData(FCPMessage &message)
                                {\r
                                        ins.Bind(3,"false");\r
                                }\r
+                               ins.Bind(4,"Board List of "+identityname);\r
                                ins.Step();\r
                                ins.Reset();\r
                        }\r
index b88cb73..117d25a 100644 (file)
@@ -15,6 +15,10 @@ void BoardListXML::AddBoard(const std::string &name, const std::string &descript
        {\r
                std::string lowername=name;\r
                StringFunctions::LowerCase(lowername,lowername);\r
+               if(lowername.size()>40)\r
+               {\r
+                       lowername.erase(40);\r
+               }\r
                m_boards.push_back(board(lowername,description));\r
        }\r
 }\r
@@ -100,6 +104,10 @@ const bool BoardListXML::ParseXML(const std::string &xml)
                        {\r
                                name=txt->ValueStr();\r
                                StringFunctions::LowerCase(name,name);\r
+                               if(name.size()>40)\r
+                               {\r
+                                       name.erase(40);\r
+                               }\r
                        }\r
                        txt=hnd2.FirstChild("Description").FirstChild().ToText();\r
                        if(txt)\r
index 4ca447e..4e7b570 100644 (file)
@@ -20,7 +20,6 @@
 #include "../../include/freenet/boardlistrequester.h"\r
 #include "../../include/freenet/siteinserter.h"\r
 \r
-//#include <zthread/Thread.h>\r
 #include "../../include/pthreadwrapper/thread.h"\r
 \r
 #ifdef XMEM\r
@@ -171,10 +170,14 @@ void FreenetMasterThread::Run()
 {\r
 \r
        DateTime lastreceivedmessage;\r
+       DateTime lastconnected;\r
        DateTime now;\r
        FCPMessage message;\r
        bool done=false;\r
 \r
+       lastconnected.SetToGMTime();\r
+       lastconnected.Add(0,-1);\r
+\r
        m_log->WriteLog(LogFile::LOGLEVEL_DEBUG,"FreenetMasterThread::run thread started.");\r
 \r
        Setup();\r
@@ -183,30 +186,29 @@ void FreenetMasterThread::Run()
        {\r
                if(m_fcp.Connected()==false)\r
                {\r
-                       if(FCPConnect()==false)\r
+                       // wait at least 1 minute since last successful connect\r
+                       now.SetToGMTime();\r
+                       if(lastconnected<=(now-(1.0/1440.0)))\r
                        {\r
+                               if(FCPConnect()==false)\r
+                               {\r
 \r
-                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::run 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
-                               /*\r
-                               try\r
-                               {\r
-                                       ZThread::Thread::sleep(60000);\r
-                               }\r
-                               catch(...)\r
-                               {\r
-                                       done=true;\r
+                                       for(int i=0; i<60 && !IsCancelled(); i++)\r
+                                       {\r
+                                               Sleep(1000);\r
+                                       }\r
                                }\r
-                               */\r
-                               for(int i=0; i<60 && !IsCancelled(); i++)\r
+                               else\r
                                {\r
-                                       Sleep(1000);\r
+                                       lastreceivedmessage.SetToGMTime();\r
+                                       lastconnected.SetToGMTime();\r
                                }\r
                        }\r
                        else\r
                        {\r
-                               lastreceivedmessage.SetToGMTime();\r
+                               Sleep(1000);\r
                        }\r
                }\r
                // fcp is connected\r
@@ -241,8 +243,12 @@ void FreenetMasterThread::Run()
                                m_fcp.Disconnect();\r
                        }\r
 \r
+                       if(m_fcp.Connected()==false)\r
+                       {\r
+                               m_log->WriteLog(LogFile::LOGLEVEL_ERROR,"FreenetMasterThread::Run Disconnected from Freenet node.");\r
+                       }\r
+\r
                }\r
-//     }while(!ZThread::Thread::interrupted() && done==false);\r
        }while(!IsCancelled() && done==false);\r
 \r
        m_fcp.Disconnect();\r
index f4e8c54..e3905a9 100644 (file)
@@ -59,6 +59,11 @@ const bool IdentityXML::ParseXML(const std::string &xml)
                        m_name=txt->ValueStr();\r
                }\r
 \r
+               if(m_name.size()>40)\r
+               {\r
+                       m_name.erase(40);\r
+               }\r
+\r
                m_singleuse=XMLGetBooleanElement(hnd.FirstChild("Identity").ToElement(),"SingleUse");\r
 \r
                m_publishtrustlist=XMLGetBooleanElement(hnd.FirstChild("Identity").ToElement(),"PublishTrustList");\r
index e298271..5b6d271 100644 (file)
@@ -17,7 +17,7 @@ MessageRequester::MessageRequester(FCPv2 *fcp):IIndexRequester<std::string>(fcp)
        Initialize();\r
 }\r
 \r
-const long MessageRequester::GetBoardID(const std::string &boardname)\r
+const long MessageRequester::GetBoardID(const std::string &boardname, const std::string &identityname)\r
 {\r
        std::string lowerboard=boardname;\r
        StringFunctions::LowerCase(lowerboard,lowerboard);\r
@@ -35,7 +35,7 @@ const long MessageRequester::GetBoardID(const std::string &boardname)
        {\r
                DateTime now;\r
                now.SetToGMTime();\r
-               st=m_db->Prepare("INSERT INTO tblBoard(BoardName,DateAdded,SaveReceivedMessages) VALUES(?,?,?);");\r
+               st=m_db->Prepare("INSERT INTO tblBoard(BoardName,DateAdded,SaveReceivedMessages,AddedMethod) VALUES(?,?,?,?);");\r
                st.Bind(0,boardname);\r
                st.Bind(1,now.Format("%Y-%m-%d %H:%M:%S"));\r
                if(m_savemessagesfromnewboards)\r
@@ -46,6 +46,7 @@ const long MessageRequester::GetBoardID(const std::string &boardname)
                {\r
                        st.Bind(2,"false");\r
                }\r
+               st.Bind(3,"Message from "+identityname);\r
                st.Step(true);\r
                return st.GetLastInsertRowID();\r
        }       \r
@@ -212,7 +213,7 @@ const bool MessageRequester::HandleAllData(FCPMessage &message)
                        st.Bind(3,xml.GetTime());\r
                        st.Bind(4,xml.GetSubject());\r
                        st.Bind(5,xml.GetMessageID());\r
-                       st.Bind(6,GetBoardID(xml.GetReplyBoard()));\r
+                       st.Bind(6,GetBoardID(xml.GetReplyBoard(),GetIdentityName(identityid)));\r
                        st.Bind(7,xml.GetBody());\r
                        st.Bind(8,index);\r
                        inserted=st.Step(true);\r
@@ -227,7 +228,7 @@ const bool MessageRequester::HandleAllData(FCPMessage &message)
                                        if(SaveToBoard((*i)))\r
                                        {\r
                                                st.Bind(0,messageid);\r
-                                               st.Bind(1,GetBoardID((*i)));\r
+                                               st.Bind(1,GetBoardID((*i),GetIdentityName(identityid)));\r
                                                st.Step();\r
                                                st.Reset();\r
                                        }\r
index 8f5006e..ec5946e 100644 (file)
@@ -104,6 +104,10 @@ const bool MessageXML::ParseXML(const std::string &xml)
                {\r
                        m_replyboard=txt->ValueStr();\r
                        StringFunctions::LowerCase(m_replyboard,m_replyboard);\r
+                       if(m_replyboard.size()>40)\r
+                       {\r
+                               m_replyboard.erase(40);\r
+                       }\r
                }\r
                txt=hnd.FirstChild("Message").FirstChild("Body").FirstChild().ToText();\r
                if(txt)\r
@@ -118,6 +122,10 @@ const bool MessageXML::ParseXML(const std::string &xml)
                        {\r
                                std::string boardname=node2->FirstChild()->ValueStr();\r
                                StringFunctions::LowerCase(boardname,boardname);\r
+                               if(boardname.size()>40)\r
+                               {\r
+                                       boardname.erase(40);\r
+                               }\r
                                m_boards.push_back(boardname);\r
                        }\r
                        node2=node2->NextSibling("Board");\r
index 2ac1e07..84e7e94 100644 (file)
@@ -155,6 +155,12 @@ void PeriodicDBMaintenance::Do1DayMaintenance()
        date.Add(0,0,0,-2);\r
        m_db->Execute("DELETE FROM tblIdentityRequests WHERE Day<'"+date.Format("%Y-%m-%d")+"';");\r
 \r
+       // delete old board list inserts/requests - we don't need them anymore\r
+       date.SetToGMTime();\r
+       date.Add(0,0,0,-2);\r
+       m_db->Execute("DELETE FROM tblBoardListInserts WHERE Day<'"+date.Format("%Y-%m-%d")+"';");\r
+       m_db->Execute("DELETE FROM tblBoardListRequests WHERE Day<'"+date.Format("%Y-%m-%d")+"';");\r
+\r
        // delete old local identity inserts - we don't need them anymore\r
        date.SetToGMTime();\r
        date.Add(0,0,0,-2);\r
index 035cdc3..aa87b99 100644 (file)
@@ -73,13 +73,19 @@ void SetupDB()
                        major=1;\r
                        minor=6;\r
                }\r
+               if(major==1 && minor==6)\r
+               {\r
+                       ConvertDB0106To0107();\r
+                       major=1;\r
+                       minor=7;\r
+               }\r
        }\r
        else\r
        {\r
-               db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,6);");\r
+               db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,7);");\r
        }\r
 \r
-       db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;");\r
+       db->Execute("UPDATE tblDBVersion SET Major=1, Minor=7;");\r
 \r
        db->Execute("CREATE TABLE IF NOT EXISTS tblOption(\\r
                                Option                          TEXT UNIQUE,\\r
@@ -156,7 +162,8 @@ void SetupDB()
                                PeerTrustListTrust              INTEGER CHECK(PeerTrustListTrust BETWEEN 0 AND 100) DEFAULT NULL,\\r
                                AddedMethod                             TEXT,\\r
                                MessageTrustComment             TEXT,\\r
-                               TrustListTrustComment   TEXT\\r
+                               TrustListTrustComment   TEXT,\\r
+                               Hidden                                  BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false'\\r
                                );");\r
 \r
        db->Execute("CREATE TABLE IF NOT EXISTS tblIdentityRequests(\\r
@@ -202,13 +209,14 @@ void SetupDB()
                                BoardName                               TEXT UNIQUE,\\r
                                BoardDescription                TEXT,\\r
                                DateAdded                               DATETIME,\\r
-                               SaveReceivedMessages    BOOL CHECK(SaveReceivedMessages IN('true','false')) DEFAULT 'true'\\r
+                               SaveReceivedMessages    BOOL CHECK(SaveReceivedMessages IN('true','false')) DEFAULT 'true',\\r
+                               AddedMethod                             TEXT\\r
                                );");\r
 \r
-       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('fms','Freenet Message System','2007-12-01 12:00:00');");\r
-       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('freenet','Discussion about Freenet','2007-12-01 12:00:00');");\r
-       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('public','Public discussion','2007-12-01 12:00:00');");\r
-       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES('test','Test board','2007-12-01 12:00:00');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('fms','Freenet Message System','2007-12-01 12:00:00','Initial Board');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('freenet','Discussion about Freenet','2007-12-01 12:00:00','Initialt Board');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('public','Public discussion','2007-12-01 12:00:00','Initial Board');");\r
+       db->Execute("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES('test','Test board','2007-12-01 12:00:00','Initial Board');");\r
 \r
        db->Execute("CREATE TABLE IF NOT EXISTS tblMessage(\\r
                                MessageID                       INTEGER PRIMARY KEY,\\r
@@ -231,11 +239,14 @@ void SetupDB()
                                ReplyOrder                      INTEGER\\r
                                );");\r
 \r
+       db->Execute("CREATE INDEX IF NOT EXISTS idxMessageReplyTo_MessageID ON tblMessageReplyTo (MessageID);");\r
+\r
        db->Execute("CREATE TABLE IF NOT EXISTS tblMessageBoard(\\r
                                MessageID                       INTEGER,\\r
                                BoardID                         INTEGER\\r
                                );");\r
 \r
+       db->Execute("CREATE INDEX IF NOT EXISTS idxMessageBoard_MessageID ON tblMessageBoard (MessageID);");\r
        db->Execute("CREATE INDEX IF NOT EXISTS idxMessageBoard_BoardID ON tblMessageBoard (BoardID);");\r
 \r
        db->Execute("CREATE TABLE IF NOT EXISTS tblMessageListRequests(\\r
@@ -403,11 +414,11 @@ void SetupDB()
 \r
        date.SetToGMTime();\r
        // insert SomeDude's public key\r
-       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,LocalTrustListTrust) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"',50);");\r
+       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,LocalTrustListTrust,AddedMethod) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"',50,'Initial Identity');");\r
        // insert Shadow Panther's public key\r
-       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@~mimyB1kmH4f7Cgsd2wM2Qv2NxrZHRMM6IY8~7EWRVQ,fxTKkR0TYhgMYb-vEGAv55sMOxCGD2xhE4ZxWHxdPz4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');");\r
+       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@~mimyB1kmH4f7Cgsd2wM2Qv2NxrZHRMM6IY8~7EWRVQ,fxTKkR0TYhgMYb-vEGAv55sMOxCGD2xhE4ZxWHxdPz4,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
        // insert garfield's public key\r
-       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@T8l1IEGU4-PoASFzgc2GYhIgRzUvZsKdoQWeuLHuTmM,QLxAPfkGis8l5NafNpSCdbxzXhBlu9WL8svcqJw9Mpo,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');");\r
+       db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded,AddedMethod) VALUES('SSK@T8l1IEGU4-PoASFzgc2GYhIgRzUvZsKdoQWeuLHuTmM,QLxAPfkGis8l5NafNpSCdbxzXhBlu9WL8svcqJw9Mpo,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"','Initial Identity');");\r
 \r
        // TODO remove sometime after 0.1.17\r
        FixCapitalBoardNames();\r
@@ -508,6 +519,16 @@ void ConvertDB0105To0106()
        db->Execute("UPDATE tblDBVersion SET Major=1, Minor=6;");\r
 }\r
 \r
+void ConvertDB0106To0107()\r
+{\r
+       // add AddedMethod to tblBoard\r
+       SQLite3DB::DB *db=SQLite3DB::DB::Instance();\r
+       db->Execute("ALTER TABLE tblBoard ADD COLUMN AddedMethod TEXT;");\r
+       db->Execute("ALTER TABLE tblIdentity ADD COLUMN Hidden BOOL CHECK(Hidden IN('true','false')) DEFAULT 'false';");\r
+       db->Execute("UPDATE tblIdentity SET Hidden='false' WHERE Hidden IS NULL;");\r
+       db->Execute("UPDATE tblDBVersion SET Major=1, Minor=7;");\r
+}\r
+\r
 void SetupDefaultOptions()\r
 {\r
        // OptionValue should always be inserted as a string, even if the option really isn't a string - just to keep the field data type consistent\r
@@ -777,7 +798,7 @@ void FixCapitalBoardNames()
 \r
        SQLite3DB::Statement st=db->Prepare("SELECT BoardID,BoardName FROM tblBoard WHERE BoardID NOT IN (SELECT BoardID FROM tblAdministrationBoard);");\r
        SQLite3DB::Statement st2=db->Prepare("SELECT BoardID FROM tblBoard WHERE BoardName=?;");\r
-       SQLite3DB::Statement del=db->Prepare("DELTE FROM tblBoard WHERE BoardID=?;");\r
+       SQLite3DB::Statement del=db->Prepare("DELETE FROM tblBoard WHERE BoardID=?;");\r
        SQLite3DB::Statement upd=db->Prepare("UPDATE tblBoard SET BoardName=? WHERE BoardID=?;");\r
        SQLite3DB::Statement upd2=db->Prepare("UPDATE tblMessage SET ReplyBoardID=? WHERE ReplyBoardID=?;");\r
        SQLite3DB::Statement upd3=db->Prepare("UPDATE tblMessageBoard SET BoardID=? WHERE BoardID=?;");\r
index dce33b8..4adab89 100644 (file)
@@ -55,10 +55,11 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
                        StringFunctions::LowerCase(boardname,boardname);\r
                        boarddescription=(*queryvars.find("boarddescription")).second;\r
 \r
-                       SQLite3DB::Statement addst=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded) VALUES(?,?,?);");\r
+                       SQLite3DB::Statement addst=m_db->Prepare("INSERT INTO tblBoard(BoardName,BoardDescription,DateAdded,AddedMethod) VALUES(?,?,?,?);");\r
                        addst.Bind(0,boardname);\r
                        addst.Bind(1,boarddescription);\r
                        addst.Bind(2,now.Format("%Y-%m-%d %H:%M:%S"));\r
+                       addst.Bind(3,"Added manually");\r
                        addst.Step();\r
                }\r
                if((*queryvars.find("formaction")).second=="remove0messages")\r
@@ -152,7 +153,7 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
        st.Finalize();\r
 \r
 \r
-       sql="SELECT BoardID,BoardName,BoardDescription,SaveReceivedMessages FROM tblBoard WHERE BoardID NOT IN (SELECT BoardID FROM tblAdministrationBoard)";\r
+       sql="SELECT BoardID,BoardName,BoardDescription,SaveReceivedMessages,AddedMethod FROM tblBoard WHERE BoardID NOT IN (SELECT BoardID FROM tblAdministrationBoard)";\r
        if(boardsearch!="")\r
        {\r
                sql+=" AND (BoardName LIKE '%' || ? || '%' OR BoardDescription LIKE '%' || ? || '%')";\r
@@ -186,9 +187,9 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
        content+="<td><form name=\"frmaddboard\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"addboard\"><input type=\"text\" name=\"boardname\"></td><td><input type=\"text\" name=\"boarddescription\" size=\"40\" maxlength=\"50\"></td><td><input type=\"submit\" value=\"Add Board\"></form></td>";\r
        content+="</tr>";\r
 \r
-       content+="<tr><td colspan=\"3\"><hr><form name=\"frmboards\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"update\"></td></tr>";\r
+       content+="<tr><td colspan=\"4\"><hr><form name=\"frmboards\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"update\"></td></tr>";\r
        content+="<tr>";\r
-       content+="<th>Name</th><th>Description</th><th>Save Received Messages *</th>";\r
+       content+="<th>Name</th><th>Description</th><th>Save Received Messages *</th><th>Added Method</th>";\r
        content+="</tr>";       \r
        while(st.RowReturned() && rownum<rowsperpage)\r
        {\r
@@ -197,11 +198,13 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
                std::string boardname="";\r
                std::string boarddescription="";\r
                std::string savereceivedmessages="";\r
+               std::string addedmethod="";\r
 \r
                st.ResultText(0,boardidstr);\r
                st.ResultText(1,boardname);\r
                st.ResultText(2,boarddescription);\r
                st.ResultText(3,savereceivedmessages);\r
+               st.ResultText(4,addedmethod);\r
 \r
                StringFunctions::Convert(rownum,rownumstr);\r
 \r
@@ -219,6 +222,7 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
                }\r
                content+=">";\r
                content+="</td>";\r
+               content+="<td class=\"smaller\">"+SanitizeOutput(addedmethod)+"</td>";\r
                content+="</tr>\r\n";\r
                st.Step();\r
                rownum++;\r
@@ -238,7 +242,7 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
                }\r
                if(startrow+rowsperpage<boardcount)\r
                {\r
-                       while(cols<2)\r
+                       while(cols<3)\r
                        {\r
                                content+="<td></td>";\r
                                cols++;\r
@@ -249,7 +253,7 @@ const std::string BoardsPage::GeneratePage(const std::string &method, const std:
        }\r
 \r
        content+="<tr>";\r
-       content+="<td colspan=\"3\"><center><input type=\"submit\" value=\"Update\"></center></form></td>";\r
+       content+="<td colspan=\"4\"><center><input type=\"submit\" value=\"Update\"></center></form></td>";\r
        content+="</tr>";\r
        content+="</table>";\r
        content+="<p class=\"paragraph\">";\r
index 8d67e07..f993a39 100644 (file)
@@ -12,7 +12,7 @@ const std::string CreateIdentityPage::GeneratePage(const std::string &method, co
 \r
        if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="create")\r
        {\r
-               SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublishTrustList,DateCreated) VALUES(?,'true',?);");\r
+               SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tblLocalIdentity(Name,PublishTrustList,DateCreated) VALUES(?,'false',?);");\r
                std::string name="";\r
                DateTime date;\r
                date.SetToGMTime();\r
index f84362e..c0b6105 100644 (file)
@@ -210,6 +210,8 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
        SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID,tblLocalIdentity.Name,tblLocalIdentity.PublicKey,tbLLocalIdentity.PublishTrustList,tblLocalIdentity.SingleUse,tblLocalIdentity.PublishBoardList,tblIdentity.IdentityID,tblLocalIdentity.PublishFreesite FROM tblLocalIdentity LEFT JOIN tblIdentity ON tblLocalIdentity.PublicKey=tblIdentity.PublicKey ORDER BY tblLocalIdentity.Name;");\r
        st.Step();\r
 \r
+       SQLite3DB::Statement trustst=m_db->Prepare("SELECT COUNT(*) FROM tblPeerTrust LEFT JOIN tblIdentity ON tblPeerTrust.TargetIdentityID=tblIdentity.IdentityID WHERE tblIdentity.PublicKey=? GROUP BY tblPeerTrust.TargetIdentityID;");\r
+\r
        count=0;\r
        while(st.RowReturned())\r
        {\r
@@ -243,6 +245,22 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                content+="<td>"+CreateTrueFalseDropDown("publishtrustlist["+countstr+"]",publishtrustlist)+"</td>";\r
                content+="<td>"+CreateTrueFalseDropDown("publishboardlist["+countstr+"]",publishboardlist)+"</td>";\r
                content+="<td>"+CreateTrueFalseDropDown("publishfreesite["+countstr+"]",publishfreesite)+"</td>";\r
+               \r
+               trustst.Bind(0,publickey);\r
+               trustst.Step();\r
+               if(trustst.RowReturned())\r
+               {\r
+                       std::string numlists="";\r
+                       trustst.ResultText(0,numlists);\r
+                       content+="<td>Yes ("+numlists+")</td>";\r
+               }\r
+               else\r
+               {\r
+                       content+="<td>No</td>";\r
+               }\r
+               trustst.Reset();\r
+\r
+/*\r
                if(st.ResultNull(6))\r
                {\r
                        content+="<td>No</td>";\r
@@ -251,6 +269,8 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
                {\r
                        content+="<td>Yes</td>";\r
                }\r
+*/\r
+\r
                content+="<td><input type=\"submit\" value=\"Update\"></form></td>";\r
                content+="<td><form name=\"frmdel\""+countstr+"\" method=\"POST\"><input type=\"hidden\" name=\"formaction\" value=\"delete\"><input type=\"hidden\" name=\"chkidentityid["+countstr+"]\" value=\""+id+"\"><input type=\"submit\" value=\"Delete\"></form></td>";\r
                content+="</tr>";\r
@@ -260,7 +280,7 @@ const std::string LocalIdentitiesPage::GeneratePage(const std::string &method, c
 \r
 //     content+="<tr><td colspan=\"5\"><center><input type=\"submit\" value=\"Update Selected\"> <input type=\"submit\" value=\"Delete Selected\" onClick=\"if(confirm('Delete Selected Identities?')){frmlocalidentity.formaction.value='delete';}else{return false;}\"></td></tr>";\r
        content+="</table>";\r
-       content+="<p class=\"paragraph\">* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.</p>";\r
+       content+="<p class=\"paragraph\">* An identity is considered successfully announced when you have downloaded a trust list from someone that contains the identity.  The number in parenthesis is how many trust lists that identity appears in.</p>";\r
        content+="<p class=\"paragraph\">Single Use Identities will automatically be deleted 7 days after creation.</p>";\r
 \r
        return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content);\r
index fc522b0..6d05231 100644 (file)
@@ -21,6 +21,7 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const
        std::string addedmethod="";\r
        std::string usk="";\r
        std::string fcphost="";\r
+       std::string hidden="";\r
 \r
        if(queryvars.find("identityid")!=queryvars.end() && (*queryvars.find("identityid")).second!="")\r
        {\r
@@ -35,9 +36,23 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const
                del.Step();\r
        }\r
 \r
+       if(identityid!=0 && queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="hide")\r
+       {\r
+               SQLite3DB::Statement del=m_db->Prepare("UPDATE tblIdentity SET Hidden='true' WHERE IdentityID=?;");\r
+               del.Bind(0,identityid);\r
+               del.Step();\r
+       }\r
+       \r
+       if(identityid!=0 && queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="show")\r
+       {\r
+               SQLite3DB::Statement del=m_db->Prepare("UPDATE tblIdentity SET Hidden='false' WHERE IdentityID=?;");\r
+               del.Bind(0,identityid);\r
+               del.Step();\r
+       }\r
+\r
        Option::Instance()->Get("FCPHost",fcphost);\r
 \r
-       SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey,DateAdded,LastSeen,AddedMethod FROM tblIdentity WHERE IdentityID=?;");\r
+       SQLite3DB::Statement st=m_db->Prepare("SELECT Name,PublicKey,DateAdded,LastSeen,AddedMethod,Hidden FROM tblIdentity WHERE IdentityID=?;");\r
        st.Bind(0,identityid);\r
        st.Step();\r
 \r
@@ -49,12 +64,13 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const
                st.ResultText(2,dateadded);\r
                st.ResultText(3,lastseen);\r
                st.ResultText(4,addedmethod);\r
+               st.ResultText(5,hidden);\r
 \r
                usk=publickey;\r
                if(usk.find("SSK@")==0)\r
                {\r
                        usk.erase(0,3);\r
-                       usk="USK"+usk+"/fms/0/";\r
+                       usk="USK"+usk+"fms/0/";\r
                }\r
 \r
                content+="<tr><td>Name</td><td>"+SanitizeOutput(name)+"</td></tr>";\r
@@ -63,6 +79,22 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const
                content+="<tr><td>Date Added</td><td>"+dateadded+"</td></tr>";\r
                content+="<tr><td>Last Seen</td><td>"+lastseen+"</td></tr>";\r
                content+="<tr><td>Added Method</td><td class=\"smaller\">"+SanitizeOutput(addedmethod)+"</td></tr>";\r
+               content+="<tr><td>Hidden in Main Peer Trust Page</td>";\r
+               content+="<td>"+hidden;\r
+               content+="&nbsp;<form name=\"frmhidden\" method=\"POST\">";\r
+               content+="<input type=\"hidden\" name=\"identityid\" value=\""+identityidstr+"\">";\r
+               if(hidden=="false")\r
+               {\r
+                       content+="<input type=\"hidden\" name=\"formaction\" value=\"hide\">";\r
+                       content+="<input type=\"submit\" value=\"Hide\">";\r
+               }\r
+               else\r
+               {\r
+                       content+="<input type=\"hidden\" name=\"formaction\" value=\"show\">";\r
+                       content+="<input type=\"submit\" value=\"Show\">";\r
+               }\r
+               content+="</form>";\r
+               content+="</td></tr>";\r
        }\r
 \r
        // get message count posted by this identity\r
@@ -132,6 +164,7 @@ const std::string PeerDetailsPage::GeneratePage(const std::string &method, const
        st.Bind(0,identityid);\r
        st.Step();\r
 \r
+       content+="<tr><th colspan=\"5\"><hr></th></tr>";\r
        content+="<tr><th colspan=\"5\">";\r
        content+="Trust of this identity from other identities";\r
        content+="</th></tr>";\r
index ea01cc4..9429ede 100644 (file)
@@ -165,7 +165,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s
        }\r
 \r
        content+="<h2>Peer Trust</h2>";\r
-       content+="Message Trust is how much you trust the identity to post good messages. Trust List Trust is how much weight you want the trust list of that identity to have when calculating the total. The local trust levels are set by you, and the peer trust levels are calculated by a weighted average using other identities' trust lists.";\r
+       content+="Message Trust is how much you trust the identity to post good messages. Trust List Trust is how much weight you want the trust list of that identity to have when calculating the total. The local trust levels are set by you, and the peer trust levels are calculated by a weighted average using other identities' trust lists.  Trust is recalculated once an hour from received trust lists.";\r
        content+="<div style=\"text-align:center;\">";\r
        content+="<form name=\"frmsearch\" method=\"POST\" action=\"peertrust.htm\">";\r
        content+="<input type=\"text\" name=\"namesearch\" value=\""+SanitizeOutput(namesearch)+"\">";\r
@@ -194,7 +194,11 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s
        sql="SELECT COUNT(*) FROM tblIdentity";\r
        if(namesearch!="")\r
        {\r
-               sql+=" WHERE Name LIKE '%' || ? || '%'";\r
+               sql+=" WHERE Name LIKE '%' || ? || '%' AND tblIdentity.Hidden='false'";\r
+       }\r
+       else\r
+       {\r
+               sql+=" WHERE tblIdentity.Hidden='false'";       \r
        }\r
        sql+=";";\r
        SQLite3DB::Statement st=m_db->Prepare(sql);\r
@@ -209,7 +213,11 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s
        sql="SELECT tblIdentity.IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust,PublicKey,MessageTrustComment,TrustListTrustComment,COUNT(MessageID) AS 'MessageCount' FROM tblIdentity LEFT JOIN tblMessage ON tblIdentity.IdentityID=tblMessage.IdentityID";\r
        if(namesearch!="")\r
        {\r
-               sql+=" WHERE Name LIKE  '%' || ? || '%'";\r
+               sql+=" WHERE (Name LIKE  '%' || ? || '%' OR PublicKey LIKE '%' || ? || '%') AND tblIdentity.Hidden='false'";\r
+       }\r
+       else\r
+       {\r
+               sql+=" WHERE tblIdentity.Hidden='false'";       \r
        }\r
        sql+=" GROUP BY tblIdentity.IdentityID";\r
        sql+=" ORDER BY";\r
@@ -230,6 +238,7 @@ const std::string PeerTrustPage::GeneratePage(const std::string &method, const s
        if(namesearch!="")\r
        {\r
                st.Bind(0,namesearch);\r
+               st.Bind(1,namesearch);\r
        }\r
        st.Step();\r
 \r