X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fforumviewthreadpage.cpp;h=e4447d4aaa73c807c12e11dcc5a13ee114f89948;hp=a680bfe5eed8a52303db16785441e5e2ff6b87b7;hb=4e96d123460d6363cf7274e36bd9357768eb86ad;hpb=e662ea47fba8715474851ceebacba400984ee433 diff --git a/src/http/pages/forumviewthreadpage.cpp b/src/http/pages/forumviewthreadpage.cpp index a680bfe..e4447d4 100644 --- a/src/http/pages/forumviewthreadpage.cpp +++ b/src/http/pages/forumviewthreadpage.cpp @@ -8,32 +8,11 @@ const std::string ForumViewThreadPage::FixBody(const std::string &body) { - static std::string whitespace=" \t\r\n"; std::string output=body; output=StringFunctions::Replace(output,"\r\n","\n"); UnicodeFormatter::LineWrap(output,80,"",output); - /* - // put \n after 80 contiguous characters in the body - std::string::size_type prevpos=0; - std::string::size_type pos=output.find_first_of(whitespace); - while(pos!=std::string::npos) - { - while(pos-prevpos>80) - { - output.insert(prevpos+80,"\n"); - prevpos+=81; // 81 because of the extra newline we just inserted - } - prevpos=pos; - pos=output.find_first_of(whitespace,pos+1); - } - while(output.size()-prevpos>80) // check the last line of the message (no whitespace after it) - { - output.insert(prevpos+80,"\n"); - prevpos+=81; - } - */ output=StringFunctions::Replace(output,"<","<"); output=StringFunctions::Replace(output,">",">"); @@ -73,9 +52,18 @@ const std::string ForumViewThreadPage::GeneratePage(const std::string &method, c firstunreadst.ResultText(0,firstunreadidstr); } - SQLite3DB::Statement updateread=m_db->Prepare("UPDATE tblMessage SET Read=1 WHERE tblMessage.MessageID IN (SELECT MessageID FROM tblThreadPost WHERE ThreadID=?);"); - updateread.Bind(0,threadidstr); - updateread.Step(); + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="markunread") + { + SQLite3DB::Statement updateread=m_db->Prepare("UPDATE tblMessage SET Read=0 WHERE tblMessage.MessageID IN (SELECT MessageID FROM tblThreadPost WHERE ThreadID=?);"); + updateread.Bind(0,threadidstr); + updateread.Step(); + } + else + { + SQLite3DB::Statement updateread=m_db->Prepare("UPDATE tblMessage SET Read=1 WHERE tblMessage.MessageID IN (SELECT MessageID FROM tblThreadPost WHERE ThreadID=?);"); + updateread.Bind(0,threadidstr); + updateread.Step(); + } SQLite3DB::Statement trustst=m_db->Prepare("SELECT LocalMessageTrust, LocalTrustListTrust, PeerMessageTrust, PeerTrustListTrust, Name FROM tblIdentity WHERE IdentityID=?;"); @@ -97,6 +85,9 @@ const std::string ForumViewThreadPage::GeneratePage(const std::string &method, c content+="First Unread Message"; content+=""; } + content+=""; + content+="Mark Unread"; + content+=""; content+=""; content+="\r\n";