diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-20 14:25:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-20 14:25:52 +0000 |
commit | a346491026d5df1ffe0d41e4881613a47ca6ca47 (patch) | |
tree | ffd505fe0680db47ea51549ec3565e23f56e34a1 /plugins/Popup/src | |
parent | 2ffa7047ec0475856481b9e813eecb99b268d2d0 (diff) |
end of the city legend that PSS_MESSAGEW ever existed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r-- | plugins/Popup/src/popup_wnd2.cpp | 152 |
1 files changed, 58 insertions, 94 deletions
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 7a7782602e..6f2ae05cdd 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -943,17 +943,6 @@ struct ReplyEditData WNDPROC oldWndProc;
};
-bool IsMsgServiceNameW(HANDLE hContact)
-{
- char szServiceName[100];
- char *szProto = GetContactProto(hContact);
- if (szProto == NULL)
- return false;
-
- mir_snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
- return ServiceExists(szServiceName) != 0;
-}
-
BOOL IsUtfSendAvailable(HANDLE hContact)
{
char* szProto = GetContactProto(hContact);
@@ -988,101 +977,76 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM ReplyEditData *dat = (ReplyEditData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
WNDPROC oldWndProc = dat ? dat->oldWndProc : NULL;
- switch (message)
- {
-/*
- case WM_ERASEBKGND:
- {
- HDC hdc = (HDC)wParam;
- RECT rc; GetClientRect(hwnd, &rc);
- FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
- DrawText(hdc, "Quick Reply", -1, &rc, DT_BOTTOM|DT_RIGHT|DT_SINGLELINE);
- return TRUE;
- }
-*/
- case WM_KEYDOWN:
- {
- switch (wParam)
+ switch (message) {
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_RETURN:
{
- case VK_RETURN:
- {
- char *buf = NULL;
- int flag = 0;
- bool bSendW = IsMsgServiceNameW(dat->hContact);
- //if (g_popup.isMirUnicode)
- if (IsWindowUnicode(hwnd))
- {
- WCHAR msg[2048];
- LPWSTR bufW = NULL;
+ char *buf = NULL;
+ int flag = 0;
+ if (IsWindowUnicode(hwnd)) {
+ WCHAR msg[2048];
+ LPWSTR bufW = NULL;
- SendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)msg);
+ SendMessageW(hwnd, WM_GETTEXT, SIZEOF(msg), (LPARAM)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_utf8encodeW(msg);
- flag = PREF_UTF;
- }
- else if (bSendW){
- bufW = mir_wstrdup(msg) /*mir_tstrdup(msg)*/;
- buf = (char*)bufW;
- flag = PREF_UNICODE /*PREF_TCHAR*/;
- }
- else {
- buf = mir_u2a(msg);
- flag = 0;
- }
+ 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_utf8encodeW(msg);
+ flag = PREF_UTF;
}
else {
- char msg[2048];
- GetWindowTextA(hwnd, msg, SIZEOF(msg));
- if (strlen(msg)==0){
- DestroyWindow(hwnd);
- return 0;
- }
- // we have message, check if it is possible and reasonable to send it as unicode
- if ( IsUtfSendAvailable( dat->hContact )) {
- buf = mir_utf8encode(msg);
- flag = PREF_UTF;
- }
- else {
- buf = mir_strdup(msg) /*mir_tstrdup(msg)*/;
- flag = 0 /*PREF_TCHAR*/;
- }
+ buf = mir_u2a(msg);
+ flag = 0;
}
-
- CallContactService(dat->hContact, bSendW ? (PSS_MESSAGE"W"):PSS_MESSAGE, flag, (LPARAM)buf);
- AddMessageToDB(dat->hContact, buf, flag);
- mir_free(buf);
-
- DestroyWindow(hwnd);
- return 0;
}
- case VK_ESCAPE:
- {
- DestroyWindow(hwnd);
- return 0;
+ else {
+ char msg[2048];
+ GetWindowTextA(hwnd, msg, SIZEOF(msg));
+ if (strlen(msg)==0){
+ DestroyWindow(hwnd);
+ return 0;
+ }
+ // we have message, check if it is possible and reasonable to send it as unicode
+ if ( IsUtfSendAvailable( dat->hContact )) {
+ buf = mir_utf8encode(msg);
+ flag = PREF_UTF;
+ }
+ else {
+ buf = mir_strdup(msg) /*mir_tstrdup(msg)*/;
+ flag = 0 /*PREF_TCHAR*/;
+ }
}
+
+ CallContactService(dat->hContact, PSS_MESSAGE, flag, (LPARAM)buf);
+ AddMessageToDB(dat->hContact, buf, flag);
+ mir_free(buf);
}
- break;
+ DestroyWindow(hwnd);
+ return 0;
+
+ case VK_ESCAPE:
+ DestroyWindow(hwnd);
+ return 0;
}
+ break;
- case WM_ACTIVATE:
- if (wParam == WA_INACTIVE)
- DestroyWindow(hwnd);
- break;
+ case WM_ACTIVATE:
+ if (wParam == WA_INACTIVE)
+ DestroyWindow(hwnd);
+ break;
- case WM_DESTROY:
- PopupThreadUnlock();
- if (!(PopUpOptions.actions&ACT_DEF_KEEPWND))
- PUDeletePopUp(dat->hwndPopup);
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)dat->oldWndProc);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- mir_free(dat);
+ case WM_DESTROY:
+ PopupThreadUnlock();
+ if (!(PopUpOptions.actions&ACT_DEF_KEEPWND))
+ PUDeletePopUp(dat->hwndPopup);
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)dat->oldWndProc);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
+ mir_free(dat);
}
if (oldWndProc)
|