version 0.3.32
[fms.git] / src / message.cpp
index 0445e29..5bebb5d 100644 (file)
        #include <xmem.h>\r
 #endif\r
 \r
-Message::Message()\r
+Message::Message(SQLite3DB::DB *db):IDatabase(db)\r
 {\r
        Initialize();\r
 }\r
 \r
-Message::Message(const long messageid)\r
+Message::Message(SQLite3DB::DB *db, const long messageid):IDatabase(db)\r
 {\r
        Load(messageid);\r
 }\r
@@ -157,7 +157,7 @@ const std::string Message::GetNNTPHeaders() const
 {\r
        std::string rval("");\r
 \r
-       rval+="From: "+m_fromname+"\r\n";\r
+       rval+="From: "+SanitizeFromName(m_fromname)+"\r\n";\r
        rval+="Newsgroups: ";\r
        for(std::vector<std::string>::const_iterator i=m_boards.begin(); i!=m_boards.end(); i++)\r
        {\r
@@ -400,9 +400,11 @@ void Message::Initialize()
        m_inreplyto.clear();\r
        m_fileattachments.clear();\r
        m_changemessagetrustonreply=0;\r
-       Option::Instance()->Get("ChangeMessageTrustOnReply",tempval);\r
+       Option option(m_db);\r
+\r
+       option.Get("ChangeMessageTrustOnReply",tempval);\r
        StringFunctions::Convert(tempval,m_changemessagetrustonreply);\r
-       Option::Instance()->Get("AddNewPostFromIdentities",tempval);\r
+       option.Get("AddNewPostFromIdentities",tempval);\r
        if(tempval=="true")\r
        {\r
                m_addnewpostfromidentities=true;\r
@@ -412,10 +414,10 @@ void Message::Initialize()
                m_addnewpostfromidentities=false;\r
        }\r
        tempval="50";\r
-       Option::Instance()->Get("MinLocalMessageTrust",tempval);\r
+       option.Get("MinLocalMessageTrust",tempval);\r
        StringFunctions::Convert(tempval,m_minlocalmessagetrust);\r
        tempval="51";\r
-       Option::Instance()->Get("MinLocalTrustListTrust",tempval);\r
+       option.Get("MinLocalTrustListTrust",tempval);\r
        StringFunctions::Convert(tempval,m_minlocaltrustlisttrust);\r
 }\r
 \r
@@ -825,6 +827,11 @@ const bool Message::ParseNNTPMessage(const std::string &nntpmessage)
        return true;\r
 }\r
 \r
+const std::string Message::SanitizeFromName(const std::string &fromname) const\r
+{\r
+       return StringFunctions::Replace(fromname,",","_");\r
+}\r
+\r
 const bool Message::StartFreenetInsert()\r
 {\r
 \r