diff options
author | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
commit | cddcd7483a7c472598af098e759e5d309024f606 (patch) | |
tree | b0a227d6e087c41958cc84d27bc323353248aae5 /plugins/Spamotron/src | |
parent | 1039b2829a264280493ba0fa979214fe024dc70c (diff) |
DWORD -> uint32_t
Diffstat (limited to 'plugins/Spamotron/src')
-rw-r--r-- | plugins/Spamotron/src/bayes.cpp | 12 | ||||
-rw-r--r-- | plugins/Spamotron/src/spamotron.cpp | 28 | ||||
-rw-r--r-- | plugins/Spamotron/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/Spamotron/src/utils.cpp | 8 |
4 files changed, 26 insertions, 26 deletions
diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index b9a9fe376b..d4d7d26d5f 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -220,7 +220,7 @@ double get_msg_score(wchar_t *msg) return tmp1 / (tmp1 + tmp2);
}
-void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message)
+void queue_message(MCONTACT hContact, uint32_t msgtime, wchar_t *message)
{
char *tmp;
sqlite3_stmt *stmt;
@@ -235,7 +235,7 @@ void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message) OpenBayes();
sqlite3_prepare_v2(bayesdb, "INSERT INTO queue VALUES(?,?,?)", -1, &stmt, nullptr);
- sqlite3_bind_int(stmt, 1, (DWORD)hContact);
+ sqlite3_bind_int(stmt, 1, (uint32_t)hContact);
sqlite3_bind_int(stmt, 2, msgtime);
tmp = mir_u2a(message);
sqlite3_bind_text(stmt, 3, tmp, (int)mir_strlen(tmp), nullptr);
@@ -255,7 +255,7 @@ void bayes_approve_contact(MCONTACT hContact) return;
sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE contact=?", -1, &stmt, nullptr);
- sqlite3_bind_int(stmt, 1, (DWORD)hContact);
+ sqlite3_bind_int(stmt, 1, (uint32_t)hContact);
while (sqlite3_step(stmt) == SQLITE_ROW)
{
d = 1;
@@ -267,7 +267,7 @@ void bayes_approve_contact(MCONTACT hContact) sqlite3_finalize(stmt);
if (d) {
sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE contact=?", -1, &stmt, nullptr);
- sqlite3_bind_int(stmt, 1, (DWORD)hContact);
+ sqlite3_bind_int(stmt, 1, (uint32_t)hContact);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
@@ -287,7 +287,7 @@ void dequeue_messages() sqlite3_prepare_v2(bayesdb, "SELECT message FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, g_plugin.getDword("BayesWaitApprove", defaultBayesWaitApprove)*86400);
- sqlite3_bind_int(stmt, 2, (DWORD)t);
+ sqlite3_bind_int(stmt, 2, (uint32_t)t);
while (sqlite3_step(stmt) == SQLITE_ROW) {
d = 1;
message = (char*)sqlite3_column_text(stmt, 0);
@@ -299,7 +299,7 @@ void dequeue_messages() if (d) {
sqlite3_prepare_v2(bayesdb, "DELETE FROM queue WHERE msgtime + ? < ?", -1, &stmt, nullptr);
sqlite3_bind_int(stmt, 1, g_plugin.getDword("BayesWaitApprove", defaultBayesWaitApprove)*86400);
- sqlite3_bind_int(stmt, 2, (DWORD)t);
+ sqlite3_bind_int(stmt, 2, (uint32_t)t);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index f22e25b595..0841a06bef 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -42,7 +42,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) // get hContact from DBEVENTINFO as icq_proto.c doesn't pass hContact the usual way for some reason.
if (dbei->eventType == EVENTTYPE_AUTHREQUEST)
- hContact = (MCONTACT)*(PDWORD(dbei->pBlob+sizeof(DWORD)));
+ hContact = (MCONTACT)*(PDWORD(dbei->pBlob+sizeof(uint32_t)));
// get maximum length of the message a protocol supports
maxmsglen = CallProtoService(dbei->szModule, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, hContact);
@@ -109,7 +109,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) msgblob = (char *)dbei->pBlob;
}
else if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
- msgblob = (char *)(dbei->pBlob + sizeof(DWORD) + sizeof(DWORD));
+ msgblob = (char *)(dbei->pBlob + sizeof(uint32_t) + sizeof(uint32_t));
for(a = 4; a > 0; a--)
msgblob += mir_strlen(msgblob)+1;
}
@@ -228,13 +228,13 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) char* szAuthEventModule;
if (db_get(hContact, MODULENAME, "AuthEvent", &_dbv) == 0) {
DBEVENTINFO dbei2 = {};
- dbei2.cbBlob = *(DWORD *)_dbv.pbVal;
+ dbei2.cbBlob = *(uint32_t *)_dbv.pbVal;
dbei2.eventType = EVENTTYPE_AUTHREQUEST;
_getCOptS(AuthEventModule, 100, hContact, "AuthEventModule", L"ICQ");
szAuthEventModule = mir_u2a(AuthEventModule);
dbei2.szModule = szAuthEventModule;
dbei2.timestamp = dbei->timestamp;
- dbei2.pBlob = _dbv.pbVal + sizeof(DWORD);
+ dbei2.pBlob = _dbv.pbVal + sizeof(uint32_t);
db_event_add(hContact, &dbei2);
g_plugin.delSetting(hContact, "AuthEvent");
@@ -426,11 +426,11 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (g_plugin.getByte("KeepBlockedMsg", defaultKeepBlockedMsg)) {
if (dbei->eventType == EVENTTYPE_AUTHREQUEST) {
// Save the request to database so that it can be automatically submitted on user approval
- uint8_t *eventdata = (uint8_t*)malloc(sizeof(DWORD) + dbei->cbBlob);
+ uint8_t *eventdata = (uint8_t*)malloc(sizeof(uint32_t) + dbei->cbBlob);
if (eventdata != nullptr && dbei->cbBlob > 0) {
- memcpy(eventdata, &dbei->cbBlob, sizeof(DWORD));
- memcpy(eventdata + sizeof(DWORD), dbei->pBlob, dbei->cbBlob);
- db_set_blob(hContact, MODULENAME, "AuthEvent", eventdata, sizeof(DWORD) + dbei->cbBlob);
+ memcpy(eventdata, &dbei->cbBlob, sizeof(uint32_t));
+ memcpy(eventdata + sizeof(uint32_t), dbei->pBlob, dbei->cbBlob);
+ db_set_blob(hContact, MODULENAME, "AuthEvent", eventdata, sizeof(uint32_t) + dbei->cbBlob);
g_plugin.setString(hContact, "AuthEventModule", dbei->szModule);
g_plugin.setByte(hContact, "AuthEventPending", TRUE);
free(eventdata);
@@ -439,7 +439,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) else {
if (g_plugin.getByte("MarkMsgUnreadOnApproval", defaultMarkMsgUnreadOnApproval)) {
DBVARIANT _dbv;
- DWORD dbei_size = 3 * sizeof(DWORD) + sizeof(uint16_t) + dbei->cbBlob + (DWORD)mir_strlen(dbei->szModule) + 1;
+ uint32_t dbei_size = 3 * sizeof(uint32_t) + sizeof(uint16_t) + dbei->cbBlob + (uint32_t)mir_strlen(dbei->szModule) + 1;
uint8_t *eventdata = (uint8_t*)malloc(dbei_size);
uint8_t *pos = eventdata;
if (eventdata != nullptr && dbei->cbBlob > 0) {
@@ -451,11 +451,11 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) db_free(&_dbv);
}
memcpy(pos, &dbei->eventType, sizeof(uint16_t));
- memcpy(pos + sizeof(uint16_t), &dbei->flags, sizeof(DWORD));
- memcpy(pos + sizeof(uint16_t) + sizeof(DWORD), &dbei->timestamp, sizeof(DWORD));
- memcpy(pos + sizeof(uint16_t) + sizeof(DWORD) * 2, dbei->szModule, mir_strlen(dbei->szModule) + 1);
- memcpy(pos + sizeof(uint16_t) + sizeof(DWORD) * 2 + mir_strlen(dbei->szModule) + 1, &dbei->cbBlob, sizeof(DWORD));
- memcpy(pos + sizeof(uint16_t) + sizeof(DWORD) * 3 + mir_strlen(dbei->szModule) + 1, dbei->pBlob, dbei->cbBlob);
+ memcpy(pos + sizeof(uint16_t), &dbei->flags, sizeof(uint32_t));
+ memcpy(pos + sizeof(uint16_t) + sizeof(uint32_t), &dbei->timestamp, sizeof(uint32_t));
+ memcpy(pos + sizeof(uint16_t) + sizeof(uint32_t) * 2, dbei->szModule, mir_strlen(dbei->szModule) + 1);
+ memcpy(pos + sizeof(uint16_t) + sizeof(uint32_t) * 2 + mir_strlen(dbei->szModule) + 1, &dbei->cbBlob, sizeof(uint32_t));
+ memcpy(pos + sizeof(uint16_t) + sizeof(uint32_t) * 3 + mir_strlen(dbei->szModule) + 1, dbei->pBlob, dbei->cbBlob);
db_set_blob(hContact, MODULENAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size);
free(eventdata);
}
diff --git a/plugins/Spamotron/src/stdafx.h b/plugins/Spamotron/src/stdafx.h index 98a18700c7..d51269ee37 100644 --- a/plugins/Spamotron/src/stdafx.h +++ b/plugins/Spamotron/src/stdafx.h @@ -91,7 +91,7 @@ BOOL _isregex(wchar_t* strSearch); BOOL _isvalidregex(wchar_t* strSearch);
BOOL _regmatch(wchar_t* str, wchar_t* strSearch);
BOOL Contains(wchar_t* dst, wchar_t* src);
-BOOL isOneDay(DWORD timestamp1, DWORD timestamp2);
+BOOL isOneDay(uint32_t timestamp1, uint32_t timestamp2);
void MarkUnread(MCONTACT hContact);
int ShowPopup(MCONTACT hContact, uint8_t popupType, wchar_t *line1, wchar_t *line2);
@@ -132,7 +132,7 @@ void learn_spam(wchar_t *msg); int get_token_count(int type);
int get_msg_count(int type);
double get_msg_score(wchar_t *msg);
-void queue_message(MCONTACT hContact, DWORD msgtime, wchar_t *message);
+void queue_message(MCONTACT hContact, uint32_t msgtime, wchar_t *message);
void bayes_approve_contact(MCONTACT hContact);
void dequeue_messages();
diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 506dfec548..c829b5f101 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -299,7 +299,7 @@ err_out: return ret; } -BOOL isOneDay(DWORD timestamp1, DWORD timestamp2) +BOOL isOneDay(uint32_t timestamp1, uint32_t timestamp2) { time_t t1, t2; int at1[3], at2[3]; @@ -490,14 +490,14 @@ void MarkUnread(MCONTACT hContact) while (pos - _dbv.pbVal < _dbv.cpbVal) { DBEVENTINFO dbei = {}; memcpy(&dbei.eventType, pos, sizeof(uint16_t)); pos += sizeof(uint16_t); - memcpy(&dbei.flags, pos, sizeof(DWORD)); pos += sizeof(DWORD); - memcpy(&dbei.timestamp, pos, sizeof(DWORD)); pos += sizeof(DWORD); + memcpy(&dbei.flags, pos, sizeof(uint32_t)); pos += sizeof(uint32_t); + memcpy(&dbei.timestamp, pos, sizeof(uint32_t)); pos += sizeof(uint32_t); dbei.szModule = (char*)malloc(mir_strlen((const char*)pos)+1); mir_strcpy((char*)dbei.szModule, (const char*)pos); pos += mir_strlen((const char*)pos)+1; - memcpy(&dbei.cbBlob, pos, sizeof(DWORD)); pos += sizeof(DWORD); + memcpy(&dbei.cbBlob, pos, sizeof(uint32_t)); pos += sizeof(uint32_t); dbei.pBlob = (uint8_t*)malloc(dbei.cbBlob); memcpy(dbei.pBlob, pos, dbei.cbBlob); pos += dbei.cbBlob; |