summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-14 11:13:37 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-14 11:13:37 +0000
commit721aea0764451e985d575236205808bbef298244 (patch)
tree3a1c566c364e5fc2fff86b87d494497e7de6f93d /plugins/Scriver
parent1784cdf49b8196219563795cf3b11b7c4c2a6746 (diff)
one more "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@409 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/chat/chat.h6
-rw-r--r--plugins/Scriver/chat/log.c21
-rw-r--r--plugins/Scriver/chat/manager.c15
-rw-r--r--plugins/Scriver/chat/message.c45
-rw-r--r--plugins/Scriver/chat/services.c76
-rw-r--r--plugins/Scriver/chat/tools.c101
-rw-r--r--plugins/Scriver/chat/window.c15
-rw-r--r--plugins/Scriver/globals.c9
-rw-r--r--plugins/Scriver/infobar.c8
-rw-r--r--plugins/Scriver/input.c4
-rw-r--r--plugins/Scriver/msgdialog.c58
-rw-r--r--plugins/Scriver/msglog.c61
-rw-r--r--plugins/Scriver/msgoptions.c66
-rw-r--r--plugins/Scriver/msgs.c17
-rw-r--r--plugins/Scriver/msgtimedout.c10
-rw-r--r--plugins/Scriver/msgwindow.c8
-rw-r--r--plugins/Scriver/multimon.h9
-rw-r--r--plugins/Scriver/resource.rc5
-rw-r--r--plugins/Scriver/sendqueue.c15
-rw-r--r--plugins/Scriver/utils.c51
20 files changed, 128 insertions, 472 deletions
diff --git a/plugins/Scriver/chat/chat.h b/plugins/Scriver/chat/chat.h
index 283adcdecd..1c11ad223a 100644
--- a/plugins/Scriver/chat/chat.h
+++ b/plugins/Scriver/chat/chat.h
@@ -191,10 +191,8 @@ typedef struct SESSION_INFO_TYPE
TCHAR* ptszStatusbarText;
TCHAR* ptszTopic;
- #if defined( _UNICODE )
- char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
- char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
- #endif
+ char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
+ char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
int iType;
int iFG;
diff --git a/plugins/Scriver/chat/log.c b/plugins/Scriver/chat/log.c
index 5887708957..7fcae3f870 100644
--- a/plugins/Scriver/chat/log.c
+++ b/plugins/Scriver/chat/log.c
@@ -208,11 +208,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
else if (*line > 0 && *line < 128) {
*d++ = (char) *line;
} else {
- #if defined( _UNICODE )
d += sprintf(d, "\\u%u ?", (WORD)*line);
- #else
- d += sprintf(d, "\\'%02x", (BYTE)*line);
- #endif
}
}
@@ -323,13 +319,12 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
if ( streamData->lin->ptszText ) {
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
- #if defined( _UNICODE )
if (streamData->si->windowData.codePage != CP_ACP) {
char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
- #endif
+
Log_AppendRTF( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
mir_free(ptszTemp);
}
@@ -416,13 +411,12 @@ static void AddEventToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAl
if ( streamData->lin->ptszText ) {
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
- #if defined( _UNICODE )
if (streamData->si->windowData.codePage != CP_ACP) {
char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
- #endif
+
Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
mir_free(ptszTemp);
}
@@ -567,9 +561,7 @@ static void LogEventIEView(LOGSTREAMDATA *streamData, TCHAR *ptszNick)
}
ied.dwData |= g_Settings.ShowTime ? IEEDD_GC_SHOW_TIME : 0;
ied.dwData |= IEEDD_GC_SHOW_ICON;
-#if defined( _UNICODE )
ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
ied.next = NULL;
/*
ied.color = event->color;
@@ -881,15 +873,6 @@ char * Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO* si)
int charset = 0;
BOOL forceCharset = FALSE;
-#if !defined ( _UNICODE )
- if (si->windowData.codePage != CP_ACP) {
- CHARSETINFO csi;
- if(TranslateCharsetInfo((DWORD*)si->windowData.codePage, &csi, TCI_SRCCODEPAGE)) {
- forceCharset = TRUE;
- charset = csi.ciCharset;
- }
- }
-#endif
// guesstimate amount of memory for the RTF header
bufferEnd = 0;
bufferAlloced = 4096;
diff --git a/plugins/Scriver/chat/manager.c b/plugins/Scriver/chat/manager.c
index 62542fd14a..74595f3bc0 100644
--- a/plugins/Scriver/chat/manager.c
+++ b/plugins/Scriver/chat/manager.c
@@ -136,11 +136,9 @@ int SM_RemoveSession( const TCHAR* pszID, const char* pszModule)
mir_free( pTemp->ptszStatusbarText );
mir_free( pTemp->ptszTopic );
mir_free( pTemp->pszHeader );
- #if defined( _UNICODE )
- mir_free( pTemp->pszID );
- mir_free( pTemp->pszName );
- #endif
-
+ mir_free( pTemp->pszID );
+ mir_free( pTemp->pszName );
+
// delete commands
tcmdlist_free(pTemp->windowData.cmdList);
mir_free(pTemp);
@@ -771,11 +769,8 @@ char* SM_GetUsers(SESSION_INFO* si)
if ( pLen + nameLen + 2 > alloced )
p = mir_realloc( p, alloced += 4096 );
- #if !defined( _UNICODE )
- lstrcpy( p + pLen, utemp->pszUID );
- #else
- WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
- #endif
+ WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
+
lstrcpyA( p + pLen + nameLen, " " );
utemp = utemp->next;
}
diff --git a/plugins/Scriver/chat/message.c b/plugins/Scriver/chat/message.c
index 2951cc3856..a6866941d2 100644
--- a/plugins/Scriver/chat/message.c
+++ b/plugins/Scriver/chat/message.c
@@ -86,9 +86,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
char InsertThis[50];
BOOL bJustRemovedRTF = TRUE;
BOOL bTextHasStarted = FALSE;
- #if defined(_UNICODE)
- TCHAR *ptszResult;
- #endif
+ TCHAR *ptszResult;
int iUcMode = 0;
if ( !pszText )
@@ -157,11 +155,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\xA2");
-#else
- strcpy(InsertThis, "\x95");
-#endif
}
else if ( !memcmp(p1, "\\b", 2 )) { //bold
bTextHasStarted = bJustRemovedRTF = TRUE;
@@ -202,61 +196,37 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x93");
-#else
- strcpy(InsertThis, "\x96");
-#endif
}
else if (!memcmp(p1, "\\emdash", 7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x94");
-#else
- strcpy(InsertThis, "\x97");
-#endif
}
else if (!memcmp(p1, "\\lquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x98");
-#else
- strcpy(InsertThis, "\x91");
-#endif
}
else if (!memcmp(p1, "\\rquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x99");
-#else
- strcpy(InsertThis, "\x92");
-#endif
}
else if (!memcmp(p1, "\\ldblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9c");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if (!memcmp(p1, "\\rdblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9d");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if ( p1[1] == '\\' || p1[1] == '{' || p1[1] == '}' ) { // escaped characters
bTextHasStarted = TRUE;
@@ -268,11 +238,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
iRemoveChars = 2;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xC2\xA0");
-#else
- strcpy(InsertThis, "\xA0");
-#endif
}
else if ( p1[1] == '\'' ) { // special character
char tmp[4], *p3 = tmp;
@@ -340,12 +306,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
}
mir_free(pIndex);
-
- #if !defined( _UNICODE )
- return pszText;
- #else
- mir_utf8decode(pszText, &ptszResult);
- return ptszResult;
- #endif
+ mir_utf8decode(pszText, &ptszResult);
+ return ptszResult;
}
diff --git a/plugins/Scriver/chat/services.c b/plugins/Scriver/chat/services.c
index 1104aa262b..22afdfd389 100644
--- a/plugins/Scriver/chat/services.c
+++ b/plugins/Scriver/chat/services.c
@@ -117,20 +117,11 @@ static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam)
if ( gci->Flags & TYPE ) gci->iType = si->iType;
if ( gci->Flags & COUNT ) gci->iCount = si->nUsersInNicklist;
if ( gci->Flags & USERS ) gci->pszUsers = SM_GetUsers(si);
-
- #if defined( _UNICODE )
- if ( si->dwFlags & GC_UNICODE ) {
- if ( gci->Flags & ID ) gci->pszID = si->ptszID;
- if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- }
- else {
- if ( gci->Flags & ID ) gci->pszID = ( TCHAR* )si->pszID;
- if ( gci->Flags & NAME ) gci->pszName = ( TCHAR* )si->pszName;
- }
- #else
+ if ( si->dwFlags & GC_UNICODE ) {
if ( gci->Flags & ID ) gci->pszID = si->ptszID;
if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- #endif
+ }
+
LeaveCriticalSection(&cs);
return 0;
@@ -171,11 +162,6 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
return GC_REGISTER_WRONGVER;
- #ifndef _UNICODE
- if (gcr->dwFlags & GC_UNICODE)
- return GC_REGISTER_NOUNICODE;
- #endif
-
EnterCriticalSection(&cs);
mi = MM_AddModule( gcr->pszModule );
@@ -243,12 +229,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
- #if defined( _UNICODE )
- if ( !( gcw->dwFlags & GC_UNICODE )) {
- si->pszID = mir_strdup( gcw->pszID );
- si->pszName = mir_strdup( gcw->pszName );
- }
- #endif
+
+ if ( !( gcw->dwFlags & GC_UNICODE )) {
+ si->pszID = mir_strdup( gcw->pszID );
+ si->pszName = mir_strdup( gcw->pszName );
+ }
+
if ( mi->bColor ) {
si->iFG = 4;
@@ -480,18 +466,16 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
EnterCriticalSection(&cs);
- #if defined( _UNICODE )
- if ( !( gce->dwFlags & GC_UNICODE )) {
- save_gce = *gce;
- save_gcd = *gce->pDest;
- gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
- gce->ptszUID = a2tf( gce->ptszUID, gce->dwFlags );
- gce->ptszNick = a2tf( gce->ptszNick, gce->dwFlags );
- gce->ptszStatus = a2tf( gce->ptszStatus, gce->dwFlags );
- gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
- gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
- }
- #endif
+ if ( !( gce->dwFlags & GC_UNICODE )) {
+ save_gce = *gce;
+ save_gcd = *gce->pDest;
+ gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
+ gce->ptszUID = a2tf( gce->ptszUID, gce->dwFlags );
+ gce->ptszNick = a2tf( gce->ptszNick, gce->dwFlags );
+ gce->ptszStatus = a2tf( gce->ptszStatus, gce->dwFlags );
+ gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
+ gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
+ }
// Do different things according to type of event
switch(gcd->iType) {
@@ -627,18 +611,16 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
LBL_Exit:
LeaveCriticalSection(&cs);
- #if defined( _UNICODE )
- if ( !( gce->dwFlags & GC_UNICODE )) {
- mir_free((void*)gce->ptszText );
- mir_free((void*)gce->ptszNick );
- mir_free((void*)gce->ptszUID );
- mir_free((void*)gce->ptszStatus );
- mir_free((void*)gce->ptszUserInfo );
- mir_free((void*)gce->pDest->ptszID );
- *gce = save_gce;
- *gce->pDest = save_gcd;
- }
- #endif
+ if ( !( gce->dwFlags & GC_UNICODE )) {
+ mir_free((void*)gce->ptszText );
+ mir_free((void*)gce->ptszNick );
+ mir_free((void*)gce->ptszUID );
+ mir_free((void*)gce->ptszStatus );
+ mir_free((void*)gce->ptszUserInfo );
+ mir_free((void*)gce->pDest->ptszID );
+ *gce = save_gce;
+ *gce->pDest = save_gcd;
+ }
return iRetVal;
}
diff --git a/plugins/Scriver/chat/tools.c b/plugins/Scriver/chat/tools.c
index 882d2b2c0a..d18115dfae 100644
--- a/plugins/Scriver/chat/tools.c
+++ b/plugins/Scriver/chat/tools.c
@@ -531,10 +531,8 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
if (hFile) {
TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
-#ifdef _UNICODE
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
-#endif
if ( gce->ptszNick ) {
if ( g_Settings.LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
@@ -652,9 +650,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
if (read > 0) {
hFile = _tfopen(tszFile, _T("wb"));
if (hFile) {
-#ifdef _UNICODE
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
-#endif
fwrite(pBufferTemp, 1, read, hFile);
fclose(hFile);
hFile = NULL;
@@ -766,9 +762,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex)
BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
- #if defined( _UNICODE )
- SESSION_INFO* si;
- #endif
+ SESSION_INFO* si;
GCHOOK* gch = (GCHOOK*)mir_alloc( sizeof( GCHOOK ));
GCDEST* gcd = (GCDEST*)mir_alloc( sizeof( GCDEST ));
@@ -776,23 +770,20 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
memset( gcd, 0, sizeof( GCDEST ));
replaceStrA( &gcd->pszModule, pszModule);
- #if defined( _UNICODE )
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd->pszID = t2a( pszID );
- gch->pszUID = t2a( pszUID );
- gch->pszText = t2a( pszText );
- }
- else {
- #endif
- replaceStr( &gcd->ptszID, pszID );
- replaceStr( &gch->ptszUID, pszUID);
- replaceStr( &gch->ptszText, pszText);
- #if defined( _UNICODE )
- }
- #endif
+ if (( si = SM_FindSession(pszID, pszModule)) == NULL )
+ return FALSE;
+
+ if ( !( si->dwFlags & GC_UNICODE )) {
+ gcd->pszID = t2a( pszID );
+ gch->pszUID = t2a( pszUID );
+ gch->pszText = t2a( pszText );
+ }
+ else {
+ replaceStr( &gcd->ptszID, pszID );
+ replaceStr( &gch->ptszUID, pszUID);
+ replaceStr( &gch->ptszText, pszText);
+ }
+
gcd->iType = iType;
gch->dwData = dwItem;
gch->pDest = gcd;
@@ -802,30 +793,24 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
{
- #if defined( _UNICODE )
- SESSION_INFO* si;
- #endif
+ SESSION_INFO* si;
GCHOOK gch = {0};
GCDEST gcd = {0};
gcd.pszModule = (char*)pszModule;
- #if defined( _UNICODE )
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd.pszID = t2a( pszID );
- gch.pszUID = t2a( pszUID );
- gch.pszText = t2a( pszText );
- }
- else {
- #endif
- gcd.ptszID = mir_tstrdup( pszID );
- gch.ptszUID = mir_tstrdup( pszUID );
- gch.ptszText = mir_tstrdup( pszText );
- #if defined( _UNICODE )
- }
- #endif
+ if (( si = SM_FindSession(pszID, pszModule)) == NULL )
+ return FALSE;
+
+ if ( !( si->dwFlags & GC_UNICODE )) {
+ gcd.pszID = t2a( pszID );
+ gch.pszUID = t2a( pszUID );
+ gch.pszText = t2a( pszText );
+ }
+ else {
+ gcd.ptszID = mir_tstrdup( pszID );
+ gch.ptszUID = mir_tstrdup( pszUID );
+ gch.ptszText = mir_tstrdup( pszText );
+ }
gcd.iType = iType;
gch.dwData = dwItem;
@@ -878,24 +863,20 @@ TCHAR* a2tf( const TCHAR* str, int flags )
if ( str == NULL )
return NULL;
- #if defined( _UNICODE )
- if ( flags & GC_UNICODE )
- return mir_tstrdup( str );
- else {
- int codepage = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
+ if ( flags & GC_UNICODE )
+ return mir_tstrdup( str );
+ else {
+ int codepage = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
- int cbLen = MultiByteToWideChar( codepage, 0, (char*)str, -1, 0, 0 );
- TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
- if ( result == NULL )
- return NULL;
+ int cbLen = MultiByteToWideChar( codepage, 0, (char*)str, -1, 0, 0 );
+ TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
+ if ( result == NULL )
+ return NULL;
- MultiByteToWideChar( codepage, 0, (char*)str, -1, result, cbLen );
- result[ cbLen ] = 0;
- return result;
- }
- #else
- return mir_strdup( str );
- #endif
+ MultiByteToWideChar( codepage, 0, (char*)str, -1, result, cbLen );
+ result[ cbLen ] = 0;
+ return result;
+ }
}
TCHAR* replaceStr( TCHAR** dest, const TCHAR* src )
diff --git a/plugins/Scriver/chat/window.c b/plugins/Scriver/chat/window.c
index 1a11b234f3..cc49d7172c 100644
--- a/plugins/Scriver/chat/window.c
+++ b/plugins/Scriver/chat/window.c
@@ -339,11 +339,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
end = HIWORD(lResult);
SendMessage(hwnd, EM_SETSEL, end, end);
- #if defined( _UNICODE )
- gt.codepage = 1200;
- #else
- gt.codepage = CP_ACP;
- #endif
+ gt.codepage = 1200;
iLen = GetRichTextLength(hwnd, gt.codepage, TRUE);
if (iLen >0) {
TCHAR *pszName = NULL;
@@ -1318,11 +1314,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
sid.cbSize = sizeof(sid);
sid.szModule = SRMMMOD;
sid.dwId = 0;
- #if defined( _UNICODE )
sid.flags = 0;
- #else
- sid.flags = MBF_DISABLED;
- #endif
+
ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid);
// SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)si);
}
@@ -1900,9 +1893,7 @@ LABEL_SHOWWINDOW:
DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, (LPARAM)NULL);
mir_free(pszRtf);
- #if defined( _UNICODE )
- mir_free(ptszText);
- #endif
+ mir_free(ptszText);
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
}
break;
diff --git a/plugins/Scriver/globals.c b/plugins/Scriver/globals.c
index ce44bda1f0..c1006bd8f7 100644
--- a/plugins/Scriver/globals.c
+++ b/plugins/Scriver/globals.c
@@ -280,12 +280,7 @@ void InitGlobals() {
ZeroMemory(g_dat, sizeof(struct GlobalMessageData));
g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
-#if !defined(_UNICODE)
- g_dat->hMenuANSIEncoding = CreatePopupMenu();
- AppendMenu(g_dat->hMenuANSIEncoding, MF_STRING, 500, TranslateT("Default codepage"));
- AppendMenuA(g_dat->hMenuANSIEncoding, MF_SEPARATOR, 0, 0);
- EnumSystemCodePagesA(LangAddCallback, CP_INSTALLED);
-#endif
+
HookEvent_Ex(ME_PROTO_ACK, ackevent);
ReloadGlobals();
g_dat->lastParent = NULL;
@@ -486,10 +481,8 @@ static int ackevent(WPARAM wParam, LPARAM lParam) {
dbei.szModule = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) item->hContact, 0);
dbei.timestamp = time(NULL);
dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
- #if defined( _UNICODE )
if ( !( item->flags & PREF_UTF ))
dbei.cbBlob *= sizeof(TCHAR) + 1;
- #endif
dbei.pBlob = (PBYTE) item->sendBuffer;
hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) item->hContact, (LPARAM) & dbei);
diff --git a/plugins/Scriver/infobar.c b/plugins/Scriver/infobar.c
index c98ef1dfe4..4387c4979a 100644
--- a/plugins/Scriver/infobar.c
+++ b/plugins/Scriver/infobar.c
@@ -83,12 +83,8 @@ void RefreshInfobar(InfobarWindowData* idat) {
else
mir_sntprintf(szText, 2047, _T("%s"), TranslateTS(szXStatusName));
st.flags = ST_DEFAULT;
-#ifdef _UNICODE
- st.codepage = 1200;
-#else
- st.codepage = CP_ACP;
-#endif
- SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
+ st.codepage = 1200;
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
if (hIcon) {
diff --git a/plugins/Scriver/input.c b/plugins/Scriver/input.c
index 20378d096a..8f61de3f8d 100644
--- a/plugins/Scriver/input.c
+++ b/plugins/Scriver/input.c
@@ -426,11 +426,7 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK *
hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
lstrcpy(GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
- #if defined( _UNICODE )
SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
CloseClipboard();
break;
}
diff --git a/plugins/Scriver/msgdialog.c b/plugins/Scriver/msgdialog.c
index 9dcafa4746..8f17470549 100644
--- a/plugins/Scriver/msgdialog.c
+++ b/plugins/Scriver/msgdialog.c
@@ -68,11 +68,7 @@ static TCHAR *GetIEViewSelection(struct MessageWindowData *dat) {
IEVIEWEVENT event;
ZeroMemory(&event, sizeof(event));
event.cbSize = sizeof(event);
-#ifdef _UNICODE
event.dwFlags = 0;
-#else
- event.dwFlags = IEEF_NO_UNICODE;
-#endif
event.codepage = dat->windowData.codePage;
event.hwnd = dat->windowData.hwndLog;
event.hContact = dat->windowData.hContact;
@@ -83,11 +79,7 @@ static TCHAR *GetIEViewSelection(struct MessageWindowData *dat) {
static TCHAR *GetQuotedTextW(TCHAR * text) {
int i, j, l, newLine, wasCR;
TCHAR *out;
-#ifdef _UNICODE
l = (int)wcslen(text);
-#else
- l = strlen(text);
-#endif
newLine = 1;
wasCR = 0;
for (i=j=0; i<l; i++) {
@@ -180,7 +172,6 @@ static BOOL IsUtfSendAvailable(HANDLE hContact)
return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF ) ? TRUE : FALSE;
}
-#if defined(_UNICODE)
int RTL_Detect(WCHAR *pszwText)
{
WORD *infoTypeC2;
@@ -204,7 +195,6 @@ int RTL_Detect(WCHAR *pszwText)
}
return 0;
}
-#endif
static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilename)
{
@@ -838,16 +828,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
WindowList_Add(g_dat->hMessageWindowList, hwndDlg, dat->windowData.hContact);
if (newData->szInitialText) {
- #if defined(_UNICODE)
if(newData->isWchar)
SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- #else
- SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- #endif
- } else if (g_dat->flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat->draftList, dat->windowData.hContact);
+ } else if (g_dat->flags & SMF_SAVEDRAFTS) {
+ TCmdList *draft = tcmdlist_get2(g_dat->draftList, dat->windowData.hContact);
if (draft != NULL) {
len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd, dat->windowData.codePage);
}
@@ -1174,20 +1160,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
mir_free(szOldStatus);
mir_free(szNewStatus);
- #if defined( _UNICODE )
+
{
int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, sizeof(blob), 0, 0);
memcpy( blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
}
- #else
- {
- int wLen = MultiByteToWideChar(CP_ACP, 0, buffer, -1, NULL, 0 );
- memcpy( blob, buffer, iLen+1 );
- MultiByteToWideChar(CP_ACP, 0, buffer, -1, (WCHAR*)&blob[iLen+1], wLen+1 );
- dbei.cbBlob = iLen+1 + sizeof(WCHAR)*wLen;
- }
- #endif
+
//iLen = strlen(buffer) + 1;
//MultiByteToWideChar(CP_ACP, 0, buffer, iLen, (LPWSTR) & buffer[iLen], iLen);
dbei.cbSize = sizeof(dbei);
@@ -1657,12 +1636,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
item->codepage = dat->windowData.codePage;
if ( IsUtfSendAvailable( dat->windowData.hContact )) {
char* szMsgUtf;
- #if defined( _UNICODE )
- szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] );
- item->flags &= ~PREF_UNICODE;
- #else
- szMsgUtf = mir_utf8encodecp(msi->sendBuffer, dat->windowData.codePage);
- #endif
+ szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] );
+ item->flags &= ~PREF_UNICODE;
if (!szMsgUtf) {
break;
}
@@ -1820,9 +1795,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
if (pf2.wEffects & PFE_RTLPARA)
msi.flags |= PREF_RTL;
- #if defined( _UNICODE )
bufSize += GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2;
- #endif
+
msi.sendBufferSize = bufSize;
msi.sendBuffer = (char *) mir_alloc(msi.sendBufferSize);
msi.flags |= PREF_TCHAR;
@@ -1831,13 +1805,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
gt.cb = ansiBufSize;
gt.codepage = dat->windowData.codePage;
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (LPARAM) msi.sendBuffer);
- #if defined( _UNICODE )
- gt.cb = bufSize - ansiBufSize;
- gt.codepage = 1200;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (LPARAM) &msi.sendBuffer[ansiBufSize]);
- if ( RTL_Detect((wchar_t *)&msi.sendBuffer[ansiBufSize] ))
- msi.flags |= PREF_RTL;
- #endif
+ gt.cb = bufSize - ansiBufSize;
+ gt.codepage = 1200;
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) &gt, (LPARAM) &msi.sendBuffer[ansiBufSize]);
+ if ( RTL_Detect((wchar_t *)&msi.sendBuffer[ansiBufSize] ))
+ msi.flags |= PREF_RTL;
+
if (msi.sendBuffer[0] == 0) {
mir_free (msi.sendBuffer);
break;
@@ -1923,11 +1896,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SETTEXTEX st;
TCHAR *buffer = NULL;
st.flags = ST_SELECTION;
-#ifdef _UNICODE
st.codepage = 1200;
-#else
- st.codepage = CP_ACP;
-#endif
+
if (dat->hDbEventLast==NULL) break;
if (dat->windowData.hwndLog != NULL) {
buffer = GetIEViewSelection(dat);
diff --git a/plugins/Scriver/msglog.c b/plugins/Scriver/msglog.c
index 5e5823eee0..ba264a14d4 100644
--- a/plugins/Scriver/msglog.c
+++ b/plugins/Scriver/msglog.c
@@ -28,9 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define LOGICON_MSG_OUT 1
#define LOGICON_MSG_NOTICE 2
-#if defined ( _UNICODE )
extern int RTL_Detect(WCHAR *pszwText);
-#endif
extern HINSTANCE g_hInst;
static int logPixelSY;
static PBYTE pLogIconBmpBits[3];
@@ -94,15 +92,13 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) {
ci.hContact = hContact;
ci.szProto = (char *)szProto;
ci.dwFlag = CNF_DISPLAY;
-#if defined ( _UNICODE )
if(IsUnicodeMIM()) {
ci.dwFlag |= CNF_UNICODE;
}
-#endif
+
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (ci.pszVal) {
-#if defined ( _UNICODE )
if(IsUnicodeMIM()) {
if (!_tcscmp((TCHAR *)ci.pszVal, TranslateW(_T("'(Unknown Contact)'")))) {
ci.dwFlag &= ~CNF_UNICODE;
@@ -115,9 +111,7 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) {
} else {
szName = a2t((char *)ci.pszVal);
}
-#else
- szName = mir_tstrdup((TCHAR *)ci.pszVal);
-#endif
+
miranda_sys_free(ci.pszVal);
if (szName != NULL) {
return szName;
@@ -127,16 +121,12 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) {
}
szBaseNick = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
if (szBaseNick != NULL) {
-#if defined ( _UNICODE )
int len;
len = (int)strlen(szBaseNick) + 1;
szName = (TCHAR *) mir_alloc(len * 2);
MultiByteToWideChar(CP_ACP, 0, szBaseNick, -1, szName, len);
szName[len - 1] = 0;
return szName;
-#else
- return mir_tstrdup(szBaseNick);
-#endif
}
return mir_tstrdup(TranslateT("Unknown Contact"));
}
@@ -203,9 +193,8 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE
}
event->eventType = event->custom ? EVENTTYPE_MESSAGE : dbei.eventType;
event->dwFlags = (dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0);
-#if defined( _UNICODE )
event->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
+
if ( dat->flags & SMF_RTL) {
event->dwFlags |= IEEDF_RTL;
}
@@ -218,7 +207,7 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE
} else {
event->pszNickT = GetNickname(hContact, dat->szProto);
}
-#if defined( _UNICODE )
+
if (event->eventType == EVENTTYPE_FILE) {
char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
char* descr = filename + lstrlenA( filename ) + 1;
@@ -234,18 +223,7 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE
event->dwFlags |= IEEDF_RTL;
}
}
-#else
- if (event->eventType == EVENTTYPE_FILE) {
- char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
- char* descr = filename + lstrlenA( filename ) + 1;
- event->pszTextT = mir_strdup(filename);
- if ( *descr != 0 ) {
- event->pszText2T = mir_strdup(descr);
- }
- } else {
- event->pszTextT = DbGetEventTextT( &dbei, dat->windowData.codePage );
- }
-#endif
+
mir_free(dbei.pBlob);
return event;
}
@@ -256,9 +234,7 @@ static EventData *GetTestEvent(DWORD flags)
memset(event, 0, sizeof(EventData));
event->eventType = EVENTTYPE_MESSAGE;
event->dwFlags = IEEDF_READ | flags;
-#if defined( _UNICODE )
event->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
event->time = time(NULL);
event->codePage = CP_ACP;
return event;
@@ -383,11 +359,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA
static int AppendTToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, TCHAR * line)
{
-#if defined ( _UNICODE )
return AppendUnicodeToBuffer(buffer, cbBufferEnd, cbBufferAlloced, line);
-#else
- return AppendAnsiToBuffer(buffer, cbBufferEnd, cbBufferAlloced, line);
-#endif
}
//mir_free() the return value
@@ -401,15 +373,6 @@ static char *CreateRTFHeader(struct MessageWindowData *dat, struct GlobalMessage
HDC hdc;
int charset = 0;
BOOL forceCharset = FALSE;
-#if !defined ( _UNICODE )
- if (dat->windowData.codePage != CP_ACP) {
- CHARSETINFO csi;
- if(TranslateCharsetInfo((DWORD*)dat->windowData.codePage, &csi, TCI_SRCCODEPAGE)) {
- forceCharset = TRUE;
- charset = csi.ciCharset;
- }
- }
-#endif
hdc = GetDC(NULL);
logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
@@ -764,15 +727,13 @@ static char *CreateRTFFromEvent(struct MessageWindowData *dat, EventData *event,
} else {
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(MSGFONTID_NOTICE));
}
-#if defined( _UNICODE )
+
if (event->dwFlags & IEEDF_UNICODE_NICK) {
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNickW);
} else {
AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNick);
}
-#else
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNick);
-#endif
+
showColon = 1;
if (event->eventType == EVENTTYPE_MESSAGE && gdat->flags & SMF_GROUPMESSAGES) {
if (gdat->flags & SMF_MARKFOLLOWUPS) {
@@ -1101,12 +1062,8 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
if (fAppend) {
GETTEXTLENGTHEX gtxl = {0};
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
-#if defined( _UNICODE )
- gtxl.codepage = 1200;
-#else
- gtxl.codepage = CP_ACP;
-#endif
- gtxl.codepage = 1200;
+ gtxl.codepage = 1200;
+ gtxl.codepage = 1200;
fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & sel);
diff --git a/plugins/Scriver/msgoptions.c b/plugins/Scriver/msgoptions.c
index d1bfb2dd64..80358590f4 100644
--- a/plugins/Scriver/msgoptions.c
+++ b/plugins/Scriver/msgoptions.c
@@ -135,76 +135,10 @@ int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam)
return 0;
}
-#if defined( _UNICODE )
static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
{
return DEFAULT_CHARSET;
}
-#else
-// get font charset according to current CP
-static BYTE MsgDlgGetCPDefaultCharset()
-{
- switch (GetACP()) {
- case 1250:
- return EASTEUROPE_CHARSET;
- case 1251:
- return RUSSIAN_CHARSET;
- case 1252:
- return ANSI_CHARSET;
- case 1253:
- return GREEK_CHARSET;
- case 1254:
- return TURKISH_CHARSET;
- case 1255:
- return HEBREW_CHARSET;
- case 1256:
- return ARABIC_CHARSET;
- case 1257:
- return BALTIC_CHARSET;
- case 1361:
- return JOHAB_CHARSET;
- case 874:
- return THAI_CHARSET;
- case 932:
- return SHIFTJIS_CHARSET;
- case 936:
- return GB2312_CHARSET;
- case 949:
- return HANGEUL_CHARSET;
- case 950:
- return CHINESEBIG5_CHARSET;
- default:
- return DEFAULT_CHARSET;
- }
-}
-
-static int CALLBACK EnumFontFamExProc(const LOGFONT *lpelfe, const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam)
-{
- *(int*)lParam = 1;
- return 0;
-}
-
-// get font charset according to current CP, if available for specified font
-static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
-{
- HDC hdc;
- LOGFONT lf = {0};
- int found = 0;
-
- _tcscpy(lf.lfFaceName, szFont);
- lf.lfCharSet = MsgDlgGetCPDefaultCharset();
-
- // check if the font supports specified charset
- hdc = GetDC(0);
- EnumFontFamiliesEx(hdc, &lf, &EnumFontFamExProc, (LPARAM)&found, 0);
- ReleaseDC(0, hdc);
-
- if (found)
- return lf.lfCharSet;
- else // no, give default
- return DEFAULT_CHARSET;
-}
-#endif
void RegisterFontServiceFonts() {
int i;
diff --git a/plugins/Scriver/msgs.c b/plugins/Scriver/msgs.c
index a3ce62f050..c0f63b6538 100644
--- a/plugins/Scriver/msgs.c
+++ b/plugins/Scriver/msgs.c
@@ -174,7 +174,6 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam)
return 0;
}
-#if defined(_UNICODE)
static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam)
{
HWND hwnd;
@@ -217,7 +216,6 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam)
}
return 0;
}
-#endif
static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam)
{
@@ -291,11 +289,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam)
tn.cbSize = sizeof(tn);
tn.tszInfoTitle = TranslateT("Typing Notification");
tn.tszInfo = szTip;
-#ifdef UNICODE
tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE;
-#else
- tn.dwInfoFlags = NIIF_INFO;
-#endif
tn.uTimeout = 1000 * 4;
CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & tn);
}
@@ -461,15 +455,6 @@ static void RegisterStatusIcons() {
sid.flags = MBF_HIDDEN;
sid.szTooltip = NULL;
AddStickyStatusIcon((WPARAM) 0, (LPARAM) &sid);
-
-#if !defined( _UNICODE )
- sid.dwId = 0;
- sid.hIcon = CopyIcon(GetCachedIcon("scriver_UNICODEOFF"));
- sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_UNICODEOFF"));
- sid.flags = 0;
- sid.szTooltip = NULL;
- AddStickyStatusIcon((WPARAM) 0, (LPARAM) &sid);
-#endif
}
void ChangeStatusIcons() {
@@ -626,9 +611,7 @@ int OnLoadModule(void) {
HookEvent_Ex(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGE, SendMessageCommand);
- #if defined(_UNICODE)
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
- #endif
CreateServiceFunction_Ex(MS_MSG_GETWINDOWAPI, GetWindowAPI);
CreateServiceFunction_Ex(MS_MSG_GETWINDOWCLASS, GetWindowClass);
CreateServiceFunction_Ex(MS_MSG_GETWINDOWDATA, GetWindowData);
diff --git a/plugins/Scriver/msgtimedout.c b/plugins/Scriver/msgtimedout.c
index c874068799..4a63acfa3a 100644
--- a/plugins/Scriver/msgtimedout.c
+++ b/plugins/Scriver/msgtimedout.c
@@ -46,14 +46,8 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (ewd->szText) {
SETTEXTEX st = {0};
st.flags = ST_DEFAULT;
- #ifdef _UNICODE
- st.codepage = 1200;
- #else
- st.codepage = CP_ACP;
- if (ewd->queueItem != NULL) {
- st.codepage = ewd->queueItem->codepage;
- }
- #endif
+ st.codepage = 1200;
+
SendDlgItemMessage(hwndDlg, IDC_MSGTEXT, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)ewd->szText);
}
if (ewd->szName) {
diff --git a/plugins/Scriver/msgwindow.c b/plugins/Scriver/msgwindow.c
index c4a40a299a..cbbd0a3037 100644
--- a/plugins/Scriver/msgwindow.c
+++ b/plugins/Scriver/msgwindow.c
@@ -1264,13 +1264,9 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar
rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
}
if (hTheme) {
-#ifdef _UNICODE
+
MyDrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect);
-#else
- wchar_t* text = mir_a2u(szLabel);
- MyDrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, text, -1, dwFormat, 0, &rect);
- mir_free(text);
-#endif
+
}
else
DrawText(lpDIS->hDC, szLabel, -1, &rect, dwFormat);
diff --git a/plugins/Scriver/multimon.h b/plugins/Scriver/multimon.h
index 95b81bbe2f..1ad717c554 100644
--- a/plugins/Scriver/multimon.h
+++ b/plugins/Scriver/multimon.h
@@ -143,14 +143,9 @@ typedef struct {
(*(FARPROC*)&g_pfnMonitorFromRect = GetProcAddress(hUser32,"MonitorFromRect")) &&
(*(FARPROC*)&g_pfnMonitorFromPoint = GetProcAddress(hUser32,"MonitorFromPoint")) &&
(*(FARPROC*)&g_pfnEnumDisplayMonitors = GetProcAddress(hUser32,"EnumDisplayMonitors")) &&
- #ifdef UNICODE
- (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoW")) &&
+ (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoW")) &&
(*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesW")) &&
- #else
- (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoA")) &&
- (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesA")) &&
- #endif
- (GetSystemMetrics(SM_CXVIRTUALSCREEN) >= GetSystemMetrics(SM_CXSCREEN)) &&
+ (GetSystemMetrics(SM_CXVIRTUALSCREEN) >= GetSystemMetrics(SM_CXSCREEN)) &&
(GetSystemMetrics(SM_CYVIRTUALSCREEN) >= GetSystemMetrics(SM_CYSCREEN)) )
{
fInitDone = TRUE;
diff --git a/plugins/Scriver/resource.rc b/plugins/Scriver/resource.rc
index 01a6592c36..aecb2e21bd 100644
--- a/plugins/Scriver/resource.rc
+++ b/plugins/Scriver/resource.rc
@@ -7,11 +7,8 @@
#include <windows.h>
#undef RICHEDIT_CLASS
-#if defined ( UNICODE )
+
#define RICHEDIT_CLASS "RichEdit20W"
-#else
-#define RICHEDIT_CLASS "RichEdit20A"
-#endif
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
diff --git a/plugins/Scriver/sendqueue.c b/plugins/Scriver/sendqueue.c
index 515ad64a65..33517507dc 100644
--- a/plugins/Scriver/sendqueue.c
+++ b/plugins/Scriver/sendqueue.c
@@ -28,7 +28,7 @@ static MessageSendQueueItem *global_sendQueue = NULL;
static CRITICAL_SECTION queueMutex;
static char *MsgServiceName(HANDLE hContact)
{
-#ifdef _UNICODE
+
char szServiceName[100];
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
@@ -37,28 +37,21 @@ static char *MsgServiceName(HANDLE hContact)
mir_snprintf(szServiceName, sizeof(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
if (ServiceExists(szServiceName))
return PSS_MESSAGE "W";
-#endif
+
return PSS_MESSAGE;
}
TCHAR * GetSendBufferMsg(MessageSendQueueItem *item) {
TCHAR *szMsg = NULL;
size_t len = strlen(item->sendBuffer);
-#if defined( _UNICODE )
+
if (item->flags & PREF_UTF) {
szMsg = mir_utf8decodeW(item->sendBuffer);
} else {
szMsg = (TCHAR *)mir_alloc(item->sendBufferSize - len - 1);
memcpy(szMsg, item->sendBuffer + len + 1, item->sendBufferSize - len - 1);
}
-#else
- if (item->flags & PREF_UTF) {
- szMsg = mir_utf8decodecp(mir_strdup(item->sendBuffer), item->codepage, NULL);
- } else {
- szMsg = (char *)mir_alloc(len + 1);
- memcpy(szMsg, item->sendBuffer, len + 1);
- }
-#endif
+
return szMsg;
}
diff --git a/plugins/Scriver/utils.c b/plugins/Scriver/utils.c
index c59a90739c..bad1314b40 100644
--- a/plugins/Scriver/utils.c
+++ b/plugins/Scriver/utils.c
@@ -82,16 +82,12 @@ int safe_wcslen(wchar_t *msg, int maxLen) {
TCHAR *a2tcp(const char *text, int cp) {
if ( text != NULL ) {
- #if defined ( _UNICODE )
int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
if ( result == NULL )
return NULL;
MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
return result;
- #else
- return mir_strdup(text);
- #endif
}
return NULL;
}
@@ -120,28 +116,15 @@ wchar_t* a2u( const char* src, int codepage ) {
TCHAR *a2t(const char *text) {
if ( text == NULL )
return NULL;
-
- #if defined ( _UNICODE )
return a2tcp(text, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ));
- #else
- return a2tcp(text, CP_ACP);
- #endif
}
char* t2a( const TCHAR* src ) {
- #if defined( _UNICODE )
- return u2a( src, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ) );
- #else
- return mir_strdup( src );
- #endif
+return u2a( src, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ) );
}
char* t2acp( const TCHAR* src, int codepage ) {
- #if defined( _UNICODE )
- return u2a( src, codepage );
- #else
- return mir_strdup( src );
- #endif
+ return u2a( src, codepage );
}
wchar_t *a2w(const char *src, int len) {
@@ -216,9 +199,7 @@ TCHAR *GetRichText(HWND hwnd, int codepage) {
GETTEXTEX gt = {0};
TCHAR *textBuffer = NULL;
int textBufferSize;
-#if defined( _UNICODE )
codepage = 1200;
-#endif
textBufferSize = GetRichTextLength(hwnd, codepage, TRUE);
if (textBufferSize > 0) {
textBufferSize += sizeof(TCHAR);
@@ -232,7 +213,6 @@ TCHAR *GetRichText(HWND hwnd, int codepage) {
}
char *GetRichTextEncoded(HWND hwnd, int codepage) {
-#if defined( _UNICODE )
TCHAR *textBuffer = GetRichText(hwnd, codepage);
char *textUtf = NULL;
if (textBuffer != NULL) {
@@ -240,26 +220,16 @@ char *GetRichTextEncoded(HWND hwnd, int codepage) {
mir_free(textBuffer);
}
return textUtf;
-#else
- return GetRichText(hwnd, codepage);
-#endif
}
int SetRichTextEncoded(HWND hwnd, const char *text, int codepage) {
TCHAR *textToSet;
SETTEXTEX st;
st.flags = ST_DEFAULT;
- #ifdef _UNICODE
- st.codepage = 1200;
- textToSet = mir_utf8decodeW(text);
- #else
- st.codepage = codepage;
- textToSet = (char *)text;
- #endif
+ st.codepage = 1200;
+ textToSet = mir_utf8decodeW(text);
SendMessage(hwnd, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)textToSet);
- #ifdef _UNICODE
- mir_free(textToSet);
- #endif
+ mir_free(textToSet);
return GetRichTextLength(hwnd, st.codepage, FALSE);
}
@@ -309,12 +279,7 @@ char* GetRichTextRTF(HWND hwnd)
ZeroMemory(&stream, sizeof(stream));
stream.pfnCallback = RichTextStreamCallback;
stream.dwCookie = (DWORD_PTR) &pszText; // pass pointer to pointer
-
- #if defined( _UNICODE )
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
- #else
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF;
- #endif
+ dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
SendMessage(hwnd, EM_STREAMOUT, dwFlags, (LPARAM) & stream);
return pszText; // pszText contains the text
}
@@ -400,11 +365,7 @@ TCHAR *GetRichEditSelection(HWND hwnd)
ZeroMemory(&stream, sizeof(stream));
stream.pfnCallback = StreamOutCallback;
stream.dwCookie = (DWORD_PTR) &msi;
-#if defined( _UNICODE )
dwFlags = SF_TEXT|SF_UNICODE|SFF_SELECTION;
-#else
- dwFlags = SF_TEXT|SFF_SELECTION;
-#endif
msi.sendBuffer = NULL;
msi.sendBufferSize = 0;
SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM) & stream);