std::string sql;\r
DateTime now;\r
DateTime previous;\r
+ bool startedinsert=false;\r
\r
now.SetToGMTime();\r
previous.SetToGMTime();\r
st.Bind(1,(now-(1.0/48.0)).Format("%Y-%m-%d %H:%M:%S"));\r
st.Step();\r
\r
- if(st.RowReturned())\r
+ while(st.RowReturned() && startedinsert==false)\r
{\r
int localidentityid;\r
st.ResultInt(0,localidentityid);\r
- StartInsert(localidentityid);\r
+ startedinsert=StartInsert(localidentityid);\r
+ st.Step();\r
}\r
}\r
\r
StringFunctions::Convert(tempval,m_daysbackward);\r
}\r
\r
-void MessageListInserter::StartInsert(const long &localidentityid)\r
+const bool MessageListInserter::StartInsert(const long &localidentityid)\r
{\r
FCPMessage message;\r
DateTime date;\r
\r
// actually insert message\r
xmlstr=mlxml.GetXML();\r
- StringFunctions::Convert(xmlstr.size(),xmlsizestr);\r
\r
- message.SetName("ClientPut");\r
- message["URI"]=privatekey+m_messagebase+"|"+now.Format("%Y-%m-%d")+"|MessageList|"+indexstr+".xml";\r
- message["Identifier"]=m_fcpuniquename+"|"+localidentityidstr+"|"+indexstr+"|"+message["URI"];\r
- message["UploadFrom"]="direct";\r
- message["DataLength"]=xmlsizestr;\r
- m_fcp->SendMessage(message);\r
- m_fcp->SendRaw(xmlstr.c_str(),xmlstr.size());\r
+ // only insert if the last message this identity inserted is different than this message\r
+ if(m_lastinsertedxml[localidentityid]!=xmlstr)\r
+ {\r
+ StringFunctions::Convert(xmlstr.size(),xmlsizestr);\r
+\r
+ message.SetName("ClientPut");\r
+ message["URI"]=privatekey+m_messagebase+"|"+now.Format("%Y-%m-%d")+"|MessageList|"+indexstr+".xml";\r
+ message["Identifier"]=m_fcpuniquename+"|"+localidentityidstr+"|"+indexstr+"|"+message["URI"];\r
+ message["UploadFrom"]="direct";\r
+ message["DataLength"]=xmlsizestr;\r
+ m_fcp->SendMessage(message);\r
+ m_fcp->SendRaw(xmlstr.c_str(),xmlstr.size());\r
+\r
+ m_inserting.push_back(localidentityid);\r
\r
- m_inserting.push_back(localidentityid);\r
+ m_lastinsertedxml[localidentityid]=xmlstr;\r
+ return true;\r
+ }\r
+ else\r
+ {\r
+ return false;\r
+ }\r
\r
}\r