StringFunctions::Convert(idparts[4],index);\r
\r
// wait for all data to be received from connection\r
StringFunctions::Convert(idparts[4],index);\r
\r
// wait for all data to be received from connection\r
\r
// mark this index as received\r
st=m_db->Prepare("UPDATE tblMessageRequests SET Found='true' WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
\r
// mark this index as received\r
st=m_db->Prepare("UPDATE tblMessageRequests SET Found='true' WHERE IdentityID=? AND Day=? AND RequestIndex=?;");\r
{\r
std::vector<std::string> boards=xml.GetBoards();\r
std::map<long,std::string> replyto=xml.GetInReplyTo();\r
{\r
std::vector<std::string> boards=xml.GetBoards();\r
std::map<long,std::string> replyto=xml.GetInReplyTo();\r
st=m_db->Prepare("INSERT INTO tblMessage(IdentityID,FromName,MessageDate,MessageTime,Subject,MessageUUID,ReplyBoardID,Body,MessageIndex) VALUES(?,?,?,?,?,?,?,?,?);");\r
st.Bind(0,identityid);\r
st.Bind(1,GetIdentityName(identityid));\r
st=m_db->Prepare("INSERT INTO tblMessage(IdentityID,FromName,MessageDate,MessageTime,Subject,MessageUUID,ReplyBoardID,Body,MessageIndex) VALUES(?,?,?,?,?,?,?,?,?);");\r
st.Bind(0,identityid);\r
st.Bind(1,GetIdentityName(identityid));\r
- std::string tempval;\r
- Option::Instance()->Get("MaxMessageRequests",tempval);\r
- StringFunctions::Convert(tempval,m_maxrequests);\r
+ std::string tempval("");\r
+ m_maxrequests=0;\r
+ Option option(m_db);\r
+\r
+ option.GetInt("MaxMessageRequests",m_maxrequests);\r
- Option::Instance()->Get("MessageDownloadMaxDaysBackward",tempval);\r
- StringFunctions::Convert(tempval,m_maxdaysbackward);\r
+\r
+ m_maxdaysbackward=0;\r
+ option.GetInt("MessageDownloadMaxDaysBackward",m_maxdaysbackward);\r
- Option::Instance()->Get("MaxPeerMessagesPerDay",tempval);\r
- StringFunctions::Convert(tempval,m_maxpeermessages);\r
+\r
+ m_maxpeermessages=0;\r
+ option.GetInt("MaxPeerMessagesPerDay",m_maxpeermessages);\r
- Option::Instance()->Get("MaxBoardsPerMessage",tempval);\r
- StringFunctions::Convert(tempval,m_maxboardspermessage);\r
+\r
+ m_maxboardspermessage=0;\r
+ option.GetInt("MaxBoardsPerMessage",m_maxboardspermessage);\r
}\r
sql+="AND tblIdentity.Name <> '' ";\r
// sort by day descending - in case there is a bunch of messages on a day that keep timing out, we will eventually get to the next day and hopefully find messages there\r
}\r
sql+="AND tblIdentity.Name <> '' ";\r
// sort by day descending - in case there is a bunch of messages on a day that keep timing out, we will eventually get to the next day and hopefully find messages there\r
- sql+="ORDER BY tblMessageRequests.Day DESC ";\r
+ // secondary ascending sort on tries\r
+ // tertiary sort on request index (so we get low indexes first)\r
+ sql+="ORDER BY tblMessageRequests.Day DESC, tblMessageRequests.Tries ASC, tblMessageRequests.RequestIndex ASC ";\r
message["MaxSize"]="1000000"; // 1 MB\r
message["MaxRetries"]="-1"; // use ULPR since we are fairly sure message exists since the author says it does\r
\r
message["MaxSize"]="1000000"; // 1 MB\r
message["MaxRetries"]="-1"; // use ULPR since we are fairly sure message exists since the author says it does\r
\r