diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-03-05 03:23:39 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-03-05 03:23:39 +0200 |
commit | 804d94ea46fb34a7e0ad6823382985be5a0048ce (patch) | |
tree | 9fe28781c56483a2e087f954b422dc1de9b9f266 /stopspam.cpp | |
parent | ca0c393161bf5ee7578f1a88a7f3ec8e44118f4b (diff) |
better way to store calculated answer
Diffstat (limited to 'stopspam.cpp')
-rwxr-xr-x | stopspam.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/stopspam.cpp b/stopspam.cpp index d39e84e..f75c9da 100755 --- a/stopspam.cpp +++ b/stopspam.cpp @@ -133,7 +133,6 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // if message contains right answer... BYTE msg = 1; - static int math_answer = 0; if(gbInvisDisable) { if(CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) @@ -147,7 +146,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) if(boost::algorithm::all(message, boost::is_digit())) { int msg = _ttoi(message.c_str()); - if(msg) + int main_answer = DBGetContactSettingDword(hContact, pluginName, "MathAnswer", 0); + if(msg && main_answer) answered = (msg == math_answer); } } @@ -175,6 +175,8 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // unhide contact DBDeleteContactSetting(hContact, "CList", "Hidden"); + DBDeleteContactSetting(hContact, pluginName, "MathAnswer"); + // mark contact as Answered DBWriteContactSettingByte(hContact, pluginName, "Answered", 1); @@ -256,6 +258,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) actions.push_back(gbQuestion[p1]); ++p1; } + int math_answer = 0; math_answer = args.front(); args.pop_front(); while(!args.empty()) @@ -294,6 +297,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) else break; } + DBWriteContactSettingDword(hContact, pluginName, "MathAnswer", math_answer); q += variables_parse(tmp_question, hContact); } else |