diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-21 16:11:58 +0000 |
commit | 48266e479d1fcf5153b29c612866845990fccad8 (patch) | |
tree | c8cbc908cd3c5f08731e5e8d7eaac6b568007d09 /plugins/Boltun | |
parent | ebdb556f152734035846f120eb8112f88ef91281 (diff) |
war against atavisms continues
- everything that goes to PSS_MESSAGE should be sent as utf8 string;
- thus PREF_UNICODE & PREF_UTF support discontinued, these constants are removed;
- support for PREF_UNICODE & PREF_UTF in protocols also removed;
- PREF_UNICODE used in file transfers (PROTOFILERECVT) replaced with PRFF_UNICODE / PRFF_TCHAR
git-svn-id: http://svn.miranda-ng.org/main/trunk@13734 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Boltun')
-rw-r--r-- | plugins/Boltun/src/actionQueue.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index f9d2166001..18554974be 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -83,31 +83,21 @@ static bool NotifyTyping(MCONTACT hContact) static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info)
{
- DBEVENTINFO ldbei;
- size_t size = info->Answer.length() + 1;
- size_t bufsize = size;
- char* msg;
-
- bufsize *= sizeof(TCHAR) + 1;
- msg = new char[bufsize];
-
- if (!WideCharToMultiByte(CP_ACP, 0, info->Answer.c_str(), -1, msg, (int)size, NULL, NULL))
- memset(msg, '-', (size - 1)); //In case of fault return "----" in ANSI part
- memcpy(msg + size, info->Answer.c_str(), size * 2);
-
- CallContactService(hContact, PSS_MESSAGE, PREF_TCHAR, (LPARAM)msg);
-
- memset(&ldbei, 0, sizeof(ldbei));
- ldbei.cbSize = sizeof(ldbei);
- //FIXME: Error may happen
- ldbei.cbBlob = (int)bufsize;
- ldbei.pBlob = (PBYTE)(void*)msg;
- ldbei.eventType = EVENTTYPE_MESSAGE;
- ldbei.flags = DBEF_SENT;
- ldbei.szModule = BOLTUN_NAME;
- ldbei.timestamp = (DWORD)time(NULL);
-
- db_event_add(hContact, &ldbei);
+ ptrA msg(mir_utf8encodeT(info->Answer.c_str()));
+ size_t bufsize = mir_strlen(msg);
+
+ CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)msg);
+
+ DBEVENTINFO dbei = { 0 };
+ dbei.cbSize = sizeof(dbei);
+ dbei.cbBlob = (int)bufsize;
+ dbei.pBlob = (PBYTE)(char*)msg;
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.flags = DBEF_SENT;
+ dbei.szModule = BOLTUN_NAME;
+ dbei.timestamp = (DWORD)time(NULL);
+
+ db_event_add(hContact, &dbei);
bot->AnswerGiven(hContact, *info);
delete info;
|