summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-21 16:11:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-21 16:11:58 +0000
commit48266e479d1fcf5153b29c612866845990fccad8 (patch)
treec8cbc908cd3c5f08731e5e8d7eaac6b568007d09 /plugins/Popup
parentebdb556f152734035846f120eb8112f88ef91281 (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/Popup')
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp49
1 files changed, 9 insertions, 40 deletions
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index acd1430802..574115edcf 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -830,32 +830,15 @@ struct ReplyEditData
WNDPROC oldWndProc;
};
-BOOL IsUtfSendAvailable(MCONTACT hContact)
-{
- char* szProto = GetContactProto(hContact);
- if (szProto == NULL) return FALSE;
- // check for MetaContact and get szProto from subcontact
- if (!mir_strcmp(szProto, META_PROTO)) {
- MCONTACT hSubContact = db_mc_getDefault(hContact);
- if (!hSubContact)
- return FALSE;
- szProto = GetContactProto(hSubContact);
- }
- return(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE;
-}
-
-void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/)
+void AddMessageToDB(MCONTACT hContact, char *msg)
{
DBEVENTINFO dbei = { 0 };
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT | ((flag&PREF_UTF) == PREF_UTF ? DBEF_UTF : 0);
+ dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(hContact);
dbei.timestamp = time(NULL);
- if (!((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE)
- dbei.cbBlob = ((int)mir_tstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR);
- else
- dbei.cbBlob = (int)mir_strlen(msg) + 1;
+ dbei.cbBlob = (int)mir_strlen(msg) + 1;
dbei.pBlob = (PBYTE)msg;
db_event_add(hContact, &dbei);
}
@@ -869,33 +852,19 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_KEYDOWN:
switch (wParam) {
case VK_RETURN:
- {
- char *buf = NULL;
- int flag = 0;
TCHAR msg[2048];
-
GetWindowText(hwnd, msg, SIZEOF(msg));
-
if (wcslen(msg) == 0) {
DestroyWindow(hwnd);
return 0;
}
- // we have unicode message, check if it is possible and reasonable to send it as unicode
- if (IsUtfSendAvailable(dat->hContact)) {
- buf = mir_utf8encodeT(msg);
- flag = PREF_UTF;
- }
- else {
- buf = mir_t2a(msg);
- flag = 0;
- }
- CallContactService(dat->hContact, PSS_MESSAGE, flag, (LPARAM)buf);
- AddMessageToDB(dat->hContact, buf, flag);
- mir_free(buf);
- }
- DestroyWindow(hwnd);
- return 0;
+ {
+ ptrA buf(mir_utf8encodeT(msg));
+ CallContactService(dat->hContact, PSS_MESSAGE, 0, (LPARAM)buf);
+ AddMessageToDB(dat->hContact, buf);
+ }
+ // fall through
case VK_ESCAPE:
DestroyWindow(hwnd);