summaryrefslogtreecommitdiff
path: root/plugins/BuddyPounce/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
commite2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch)
treeba79bdcede96f80039f8b88d2791f198b9ec2981 /plugins/BuddyPounce/src
parentf8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff)
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyPounce/src')
-rw-r--r--plugins/BuddyPounce/src/main.cpp63
1 files changed, 31 insertions, 32 deletions
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp
index b7fe00b559..f5890628fa 100644
--- a/plugins/BuddyPounce/src/main.cpp
+++ b/plugins/BuddyPounce/src/main.cpp
@@ -59,38 +59,38 @@ int MsgAck(WPARAM, LPARAM lParam)
{
ACKDATA *ack=(ACKDATA*)lParam;
- if (ack && ack->cbSize==sizeof(ACKDATA)
- && ack->type==ACKTYPE_MESSAGE
- && ack->hProcess==(HANDLE)WindowList_Find(hWindowList,ack->hContact)) {
- if (db_get_b(NULL, modname, "ShowDeliveryMessages", 1))
- CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS);
- if (ack->result == ACKRESULT_SUCCESS) {
- // wrtie it to the DB
- DBEVENTINFO dbei = { 0 };
- DBVARIANT dbv;
- int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
- if ( !db_get_ts(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
- ptrA pszUtf( mir_utf8encodeT(dbv.ptszVal));
- dbei.cbSize = sizeof(dbei);
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_UTF | DBEF_SENT;
- dbei.szModule = (char*)ack->szModule;
- dbei.timestamp = time(NULL);
- dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
- dbei.pBlob = (PBYTE)(char*)pszUtf;
- db_event_add(ack->hContact, &dbei);
- }
- // check to reuse
- if (reuse > 1)
- db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
- else {
- db_set_b(ack->hContact,modname, "Reuse", 0);
- db_set_ws(ack->hContact, modname, "PounceMsg", _T(""));
+ if (ack && ack->cbSize == sizeof(ACKDATA) && ack->type == ACKTYPE_MESSAGE) {
+ if (ack->hProcess == (HANDLE)WindowList_Find(hWindowList,ack->hContact)) {
+ if (db_get_b(NULL, modname, "ShowDeliveryMessages", 1))
+ CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS);
+ if (ack->result == ACKRESULT_SUCCESS) {
+ // wrtie it to the DB
+ DBEVENTINFO dbei = { 0 };
+ DBVARIANT dbv;
+ int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
+ if (!db_get_ts(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
+ T2Utf pszUtf(dbv.ptszVal);
+ dbei.cbSize = sizeof(dbei);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.flags = DBEF_UTF | DBEF_SENT;
+ dbei.szModule = (char*)ack->szModule;
+ dbei.timestamp = time(NULL);
+ dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
+ dbei.pBlob = (PBYTE)(char*)pszUtf;
+ db_event_add(ack->hContact, &dbei);
+ }
+ // check to reuse
+ if (reuse > 1)
+ db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
+ else {
+ db_set_b(ack->hContact,modname, "Reuse", 0);
+ db_set_ws(ack->hContact, modname, "PounceMsg", _T(""));
+ }
}
+ WindowList_Remove(hWindowList,(HWND)ack->hProcess);
}
- WindowList_Remove(hWindowList,(HWND)ack->hProcess);
- }
- return 0;
+ }
+ return 0;
}
int BuddyPounceOptInit(WPARAM wParam, LPARAM)
@@ -145,8 +145,7 @@ int CheckDate(MCONTACT hContact)
void SendPounce(TCHAR *text, MCONTACT hContact)
{
- ptrA pszUtf(mir_utf8encodeT(text));
- if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)pszUtf))
+ if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, 0, T2Utf(text)))
WindowList_Add(hWindowList, (HWND)hSendId, hContact);
}