From 2df6ff2420f7b55b24f6566d20419b7eeed8ac89 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 30 Oct 2013 21:19:14 -0200 Subject: [PATCH] persist spammsg to send and generate status --- src/twister.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/twister.cpp b/src/twister.cpp index 2305372a..810a3846 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -111,6 +111,12 @@ int saveGlobalData(std::string const& filename) globalDict["receivedSpamMsg"] = m_receivedSpamMsgStr; globalDict["receivedSpamUser"] = m_receivedSpamUserStr; globalDict["lastSpamTime"] = m_lastSpamTime; + globalDict["sendSpamMsg"] = strSpamMessage; + globalDict["sendSpamUser"] = strSpamUser; + globalDict["generate"] = GetBoolArg("-gen", false); + int genproclimit = GetArg("-genproclimit", -1); + if( genproclimit > 0 ) + globalDict["genproclimit"] = genproclimit; std::vector buf; bencode(std::back_inserter(buf), globalDict); @@ -131,6 +137,20 @@ int loadGlobalData(std::string const& filename) m_receivedSpamMsgStr = userDict.dict_find_string_value("receivedSpamMsg"); m_receivedSpamUserStr = userDict.dict_find_string_value("receivedSpamUser"); m_lastSpamTime = userDict.dict_find_int_value("lastSpamTime"); + string sendSpamMsg = userDict.dict_find_string_value("sendSpamMsg"); + if( sendSpamMsg.size() ) strSpamMessage = sendSpamMsg; + string sendSpamUser = userDict.dict_find_string_value("sendSpamUser"); + if( sendSpamUser.size() ) strSpamUser = sendSpamUser; + bool generate = userDict.dict_find_int_value("generate"); + int genproclimit = userDict.dict_find_int_value("genproclimit"); + + if( generate ) { + Array params; + params.push_back( generate ); + if( genproclimit > 0 ) + params.push_back( genproclimit ); + setgenerate(params, false); + } return 0; }