- st.ResultInt(1,messagetrust);\r
- st.ResultInt(2,trustlisttrust);\r
- xml.AddTrust(publickey,messagetrust,trustlisttrust);\r
+ if(st.ResultNull(1)==false)\r
+ {\r
+ st.ResultInt(1,messagetrust);\r
+ }\r
+ else\r
+ {\r
+ messagetrust=-1;\r
+ }\r
+ if(st.ResultNull(2)==false)\r
+ {\r
+ st.ResultInt(2,trustlisttrust);\r
+ }\r
+ else\r
+ {\r
+ trustlisttrust=-1;\r
+ }\r
+ st.ResultText(3,messagetrustcomment);\r
+ st.ResultText(4,trustlisttrustcomment);\r
+ identityid=-1;\r
+ st.ResultInt(5,identityid);\r
+ dateadded="";\r
+ st.ResultText(6,dateadded);\r
+\r
+ add=false;\r
+\r
+ // add the identity to the trust list if they have posted a message in the last 30 days\r
+ countst.Bind(0,identityid);\r
+ countst.Bind(1,Poco::DateTimeFormatter::format(dateminus30,"%Y-%m-%d"));\r
+ countst.Step();\r
+ if(countst.RowReturned())\r
+ {\r
+ count=0;\r
+ countst.ResultInt(0,count);\r
+ if(count>0)\r
+ {\r
+ add=true;\r
+ }\r
+ }\r
+ countst.Reset();\r
+\r
+ // no messages in last 30 days - add the identity if we learned about them less than 5 days ago\r
+ if(add==false && dateadded!="")\r
+ {\r
+ int tzdiff=0;\r
+ if(Poco::DateTimeParser::tryParse(dateadded,tempdate,tzdiff)==false)\r
+ {\r
+ tempdate=Poco::Timestamp();\r
+ m_log->fatal("TrustListInserter::StartInsert could not parse date "+dateadded);\r
+ }\r
+ if(tempdate>=(now-Poco::Timespan(5,0,0,0,0)))\r
+ {\r
+ add=true;\r
+ }\r
+ }\r
+\r
+ if(add==true)\r
+ {\r
+ xml.AddTrust(publickey,messagetrust,trustlisttrust,messagetrustcomment,trustlisttrustcomment);\r
+ }\r
+\r