diff options
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r-- | protocols/IcqOscarJ/UI/userinfotab.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/changeinfo/dlgproc.cpp | 19 | ||||
-rw-r--r-- | protocols/IcqOscarJ/fam_01service.cpp | 6 | ||||
-rw-r--r-- | protocols/IcqOscarJ/i18n.h | 20 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_popups.cpp | 3 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_uploadui.cpp | 16 | ||||
-rw-r--r-- | protocols/IcqOscarJ/init.cpp | 9 | ||||
-rw-r--r-- | protocols/IcqOscarJ/log.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/utilities.cpp | 51 |
10 files changed, 19 insertions, 119 deletions
diff --git a/protocols/IcqOscarJ/UI/userinfotab.cpp b/protocols/IcqOscarJ/UI/userinfotab.cpp index 36f90347ca..788dd2ca31 100644 --- a/protocols/IcqOscarJ/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/UI/userinfotab.cpp @@ -266,11 +266,7 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetValue(ppro, hwndDlg, IDC_PORT, hContact, (char*)DBVT_WORD, (char*)ppro->wListenPort, SVS_ZEROISUNSPEC);
SetValue(ppro, hwndDlg, IDC_VERSION, hContact, (char*)DBVT_WORD, (char*)ICQ_VERSION, SVS_ICQVERSION);
-#if defined( _UNICODE )
SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, MirandaVersionToString(str, TRUE, ICQ_PLUG_VERSION, MIRANDA_VERSION), SVS_ZEROISUNSPEC);
-#else
- SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, MirandaVersionToString(str, FALSE, ICQ_PLUG_VERSION, MIRANDA_VERSION), SVS_ZEROISUNSPEC);
-#endif
SetDlgItemTextUtf(hwndDlg, IDC_SUPTIME, ICQTranslateUtfStatic(LPGEN("Member since:"), str, MAX_PATH));
SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "MemberTS", SVS_TIMESTAMP);
SetValue(ppro, hwndDlg, IDC_STATUS, hContact, (char*)DBVT_WORD, (char*)ppro->m_iStatus, SVS_STATUSID);
diff --git a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp index 127521eafc..a78fc64016 100644 --- a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp @@ -41,19 +41,12 @@ static int DrawTextUtf(HDC hDC, char *text, LPRECT lpRect, UINT uFormat, LPSIZE {
int res;
- #if defined( _UNICODE )
- WCHAR *tmp = make_unicode_string(text);
- res = DrawTextW(hDC, tmp, -1, lpRect, uFormat);
- if (lpSize)
- GetTextExtentPoint32W(hDC, tmp, strlennull(tmp), lpSize);
- SAFE_FREE((void**)&tmp);
- #else
- // caution, here we change text's contents
- utf8_decode_static(text, (char*)text, strlennull(text) + 1);
- res = DrawTextA(hDC, (char*)text, -1, lpRect, uFormat);
- if (lpSize)
- GetTextExtentPoint32A(hDC, (char*)text, strlennull(text), lpSize);
- #endif
+ WCHAR *tmp = make_unicode_string(text);
+ res = DrawTextW(hDC, tmp, -1, lpRect, uFormat);
+ if (lpSize)
+ GetTextExtentPoint32W(hDC, tmp, strlennull(tmp), lpSize);
+ SAFE_FREE((void**)&tmp);
+
return res;
}
diff --git a/protocols/IcqOscarJ/fam_01service.cpp b/protocols/IcqOscarJ/fam_01service.cpp index 1d46fad6c1..e12474d375 100644 --- a/protocols/IcqOscarJ/fam_01service.cpp +++ b/protocols/IcqOscarJ/fam_01service.cpp @@ -845,11 +845,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) packDWord(&packet, dwDirectCookie); // DC Cookie
packDWord(&packet, WEBFRONTPORT); // Web front port
packDWord(&packet, CLIENTFEATURES); // Client features
-#if defined( _UNICODE )
- packDWord(&packet, 0x7fffffff); // Abused timestamp
-#else
- packDWord(&packet, 0xffffffff); // Abused timestamp
-#endif
+ packDWord(&packet, 0x7fffffff); // Abused timestamp
packDWord(&packet, ICQ_PLUG_VERSION); // Abused timestamp
if (ServiceExists("SecureIM/IsContactSecured"))
packDWord(&packet, 0x5AFEC0DE); // SecureIM Abuse
diff --git a/protocols/IcqOscarJ/i18n.h b/protocols/IcqOscarJ/i18n.h index d1e1f48af9..2721779ec9 100644 --- a/protocols/IcqOscarJ/i18n.h +++ b/protocols/IcqOscarJ/i18n.h @@ -65,21 +65,11 @@ int __stdcall utf8_decode(const char *from, char **to); int __stdcall utf8_decode_codepage(const char *from, char **to, WORD wCp);
int __stdcall utf8_decode_static(const char *from, char *to, int to_size);
-#ifdef _UNICODE
- #define tchar_to_utf8 make_utf8_string
- #define utf8_to_tchar_static make_unicode_string_static
- #define utf8_to_tchar make_unicode_string
- #define ansi_to_tchar ansi_to_unicode
- #define tchar_to_ansi unicode_to_ansi
-#else
- __inline char* utf8_decode_func(const char *utf8) { char *ansi = NULL; utf8_decode(utf8, &ansi); return ansi; };
-
- #define tchar_to_utf8 ansi_to_utf8
- #define utf8_to_tchar_static utf8_decode_static
- #define utf8_to_tchar utf8_decode_func
- #define ansi_to_tchar null_strdup
- #define tchar_to_ansi null_strdup
-#endif
+#define tchar_to_utf8 make_utf8_string
+#define utf8_to_tchar_static make_unicode_string_static
+#define utf8_to_tchar make_unicode_string
+#define ansi_to_tchar ansi_to_unicode
+#define tchar_to_ansi unicode_to_ansi
void InitI18N(void);
diff --git a/protocols/IcqOscarJ/icq_popups.cpp b/protocols/IcqOscarJ/icq_popups.cpp index 3bc1382ef2..c593dd6367 100644 --- a/protocols/IcqOscarJ/icq_popups.cpp +++ b/protocols/IcqOscarJ/icq_popups.cpp @@ -235,7 +235,6 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz strcat(szSetting, "Timeout");
ppd.iSeconds = getSettingDword(NULL, szSetting, ppd.iSeconds);
-#if defined( _UNICODE )
// call unicode popup module - only on unicode OS otherwise it will not work properly :(
// due to Popup Plug bug in ADDPOPUPW implementation
if ( ServiceExists( MS_POPUP_ADDPOPUPW ))
@@ -254,7 +253,7 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppdw, 0);
}
else
-#endif
+
{
char str[MAX_PATH];
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp index b87f21180a..685c3142a5 100644 --- a/protocols/IcqOscarJ/icq_proto.cpp +++ b/protocols/IcqOscarJ/icq_proto.cpp @@ -940,9 +940,7 @@ HANDLE __cdecl CIcqProto::SearchBasic( const PROTOCHAR *pszSearch ) { // we remove spaces and slashes
if ((pszSearch[i]!=0x20) && (pszSearch[i]!='-'))
{
-#ifdef _UNICODE
if (pszSearch[i] >= 0x80) continue;
-#endif
pszUIN[j] = pszSearch[i];
j++;
}
diff --git a/protocols/IcqOscarJ/icq_uploadui.cpp b/protocols/IcqOscarJ/icq_uploadui.cpp index 1de6ebf08e..6073de6b10 100644 --- a/protocols/IcqOscarJ/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/icq_uploadui.cpp @@ -156,19 +156,9 @@ static void DeleteLastUploadLogLine(HWND hwndDlg) static void GetLastUploadLogLine(HWND hwndDlg, char *szBuf, size_t cbBuf)
{
- #if defined( _UNICODE )
- WCHAR str[MAX_PATH];
- SendDlgItemMessageW(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
- make_utf8_string_static(str, szBuf, cbBuf);
- #else
- char str[MAX_PATH];
- char *ustr = NULL;
-
- SendDlgItemMessageA(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
- utf8_encode(str, &ustr);
- strcpy((char*)szBuf, (char*)ustr);
- SAFE_FREE((void**)&ustr);
- #endif
+ WCHAR str[MAX_PATH];
+ SendDlgItemMessageW(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
+ make_utf8_string_static(str, szBuf, cbBuf);
}
static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
diff --git a/protocols/IcqOscarJ/init.cpp b/protocols/IcqOscarJ/init.cpp index c9413ab977..ada5e55a93 100644 --- a/protocols/IcqOscarJ/init.cpp +++ b/protocols/IcqOscarJ/init.cpp @@ -136,7 +136,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) }
// Check if _UNICODE matches Miranda's _UNICODE
-#if defined( _UNICODE )
if (strstrnull(szVer, "unicode") == NULL)
{
char szMsg[MAX_PATH], szCaption[100];
@@ -145,14 +144,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) ICQTranslateUtfStatic("ICQ Plugin", szCaption, 100), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
return 1; // Failure
}
-#else
- if (strstrnull(szVer, "unicode") != NULL)
- {
- MessageBox(NULL, Translate("You cannot use Ansi version of ICQ Protocol plug-in with Unicode version of Miranda IM."), Translate("ICQ Plugin"),
- MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
- return 1; // Failure
- }
-#endif
}
srand(time(NULL));
diff --git a/protocols/IcqOscarJ/log.cpp b/protocols/IcqOscarJ/log.cpp index c6ff958f70..cb8f923b36 100644 --- a/protocols/IcqOscarJ/log.cpp +++ b/protocols/IcqOscarJ/log.cpp @@ -136,11 +136,9 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, SIZEOF(err), NULL))
{
-#if defined( _UNICODE )
- pszErrorMsg = make_utf8_string(err);
-#else
- utf8_encode(err, &pszErrorMsg);
-#endif
+
+ pszErrorMsg = make_utf8_string(err);
+
bNeedFree = TRUE;
}
break;
diff --git a/protocols/IcqOscarJ/utilities.cpp b/protocols/IcqOscarJ/utilities.cpp index c9124a0aa1..d80457d11b 100644 --- a/protocols/IcqOscarJ/utilities.cpp +++ b/protocols/IcqOscarJ/utilities.cpp @@ -1964,7 +1964,6 @@ const char* ExtractFileName(const char *fullname) char* FileNameToUtf(const TCHAR *filename)
{
-#if defined( _UNICODE )
// reasonable only on NT systems
HINSTANCE hKernel = GetModuleHandle(_T("KERNEL32"));
DWORD (CALLBACK *RealGetLongPathName)(LPCWSTR, LPWSTR, DWORD);
@@ -1981,9 +1980,6 @@ char* FileNameToUtf(const TCHAR *filename) return make_utf8_string(usFileName);
}
return make_utf8_string(filename);
-#else
- return ansi_to_utf8(filename);
-#endif
}
@@ -2059,41 +2055,16 @@ int OpenFileUtf(const char *filename, int oflag, int pmode) WCHAR *GetWindowTextUcs(HWND hWnd)
{
WCHAR *utext;
-
-#if defined( _UNICODE )
int nLen = GetWindowTextLengthW(hWnd);
-
utext = (WCHAR*)SAFE_MALLOC((nLen+2)*sizeof(WCHAR));
GetWindowTextW(hWnd, utext, nLen + 1);
-#else
- char *text;
- int wchars, nLen = GetWindowTextLengthA(hWnd);
-
- text = (char*)_alloca(nLen+2);
- GetWindowTextA(hWnd, text, nLen + 1);
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text,
- strlennull(text), NULL, 0);
-
- utext = (WCHAR*)SAFE_MALLOC((wchars + 1)*sizeof(WCHAR));
-
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text,
- strlennull(text), utext, wchars);
-#endif
return utext;
}
void SetWindowTextUcs(HWND hWnd, WCHAR *text)
{
-#if defined( _UNICODE )
SetWindowTextW(hWnd, text);
-#else
- char *tmp = (char*)SAFE_MALLOC(strlennull(text) + 1);
- WideCharToMultiByte(CP_ACP, 0, text, -1, tmp, strlennull(text)+1, NULL, NULL);
- SetWindowTextA(hWnd, tmp);
- SAFE_FREE((void**)&tmp);
-#endif
}
@@ -2135,19 +2106,9 @@ static int ControlAddStringUtf(HWND ctrl, DWORD msg, const char *szString) char str[MAX_PATH];
char *szItem = ICQTranslateUtfStatic(szString, str, MAX_PATH);
int item = -1;
-
-#if defined( _UNICODE )
WCHAR *wItem = make_unicode_string(szItem);
item = SendMessage(ctrl, msg, 0, (LPARAM)wItem);
SAFE_FREE((void**)&wItem);
-#else
- int size = strlennull(szItem) + 2;
- char *aItem = (char*)_alloca(size);
-
- if (utf8_decode_static(szItem, aItem, size))
- item = SendMessage(ctrl, msg, 0, (LPARAM)aItem);
-#endif
-
return item;
}
@@ -2169,23 +2130,11 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy int res;
char str[1024];
char cap[MAX_PATH];
-
-#if defined( _UNICODE )
WCHAR *text = make_unicode_string(ICQTranslateUtfStatic(szText, str, 1024));
WCHAR *caption = make_unicode_string(ICQTranslateUtfStatic(szCaption, cap, MAX_PATH));
res = MessageBoxW(hWnd, text, caption, uType);
SAFE_FREE((void**)&caption);
SAFE_FREE((void**)&text);
-#else
- int size = strlennull(szText) + 2, size2 = strlennull(szCaption) + 2;
- char *text = (char*)_alloca(size);
- char *caption = (char*)_alloca(size2);
-
- utf8_decode_static(ICQTranslateUtfStatic(szText, str, 1024), text, size);
- utf8_decode_static(ICQTranslateUtfStatic(szCaption, cap, MAX_PATH), caption, size2);
- res = MessageBoxA(hWnd, text, caption, uType);
-#endif
-
return res;
}
|