summaryrefslogtreecommitdiff
path: root/plugins/Chat
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/Chat
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/Chat')
-rw-r--r--plugins/Chat/chat.h8
-rw-r--r--plugins/Chat/log.c6
-rw-r--r--plugins/Chat/manager.c22
-rw-r--r--plugins/Chat/message.c44
-rw-r--r--plugins/Chat/services.c40
-rw-r--r--plugins/Chat/tools.c24
-rw-r--r--plugins/Chat/window.c18
7 files changed, 33 insertions, 129 deletions
diff --git a/plugins/Chat/chat.h b/plugins/Chat/chat.h
index c9dd89463b..27e325fd7b 100644
--- a/plugins/Chat/chat.h
+++ b/plugins/Chat/chat.h
@@ -258,11 +258,9 @@ typedef struct SESSION_INFO_TYPE
TCHAR* ptszTopic;
// I hate m3x, Unicode, IRC, chats etc...
- #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;
int iBG;
diff --git a/plugins/Chat/log.c b/plugins/Chat/log.c
index a1b94a5108..665ab8939c 100644
--- a/plugins/Chat/log.c
+++ b/plugins/Chat/log.c
@@ -216,11 +216,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
else if (*line > 0 && *line < 128) {
*d++ = (char) *line;
}
- #if defined( _UNICODE )
- else d += sprintf(d, "\\u%u ?", (WORD)*line);
- #else
- else d += sprintf(d, "\\'%02x", (BYTE)*line);
- #endif
+ else d += sprintf(d, "\\u%u ?", (WORD)*line);
}
*cbBufferEnd = (int) (d - *buffer);
diff --git a/plugins/Chat/manager.c b/plugins/Chat/manager.c
index f9b9461dea..9968086245 100644
--- a/plugins/Chat/manager.c
+++ b/plugins/Chat/manager.c
@@ -145,11 +145,9 @@ int SM_RemoveSession( const TCHAR* pszID, const char* pszModule)
mir_free( pTemp->ptszName );
mir_free( pTemp->ptszStatusbarText );
mir_free( pTemp->ptszTopic );
- #if defined( _UNICODE )
- mir_free( pTemp->pszID );
- mir_free( pTemp->pszName );
- #endif
-
+ mir_free( pTemp->pszID );
+ mir_free( pTemp->pszName );
+
// delete commands
pCurComm = pTemp->lpCommands;
while (pCurComm != NULL)
@@ -787,11 +785,9 @@ BOOL SM_RemoveAll (void)
mir_free( m_WndList->ptszName );
mir_free( m_WndList->ptszStatusbarText );
mir_free( m_WndList->ptszTopic );
- #if defined( _UNICODE )
- mir_free( m_WndList->pszID );
- mir_free( m_WndList->pszName );
- #endif
-
+ mir_free( m_WndList->pszID );
+ mir_free( m_WndList->pszName );
+
while (m_WndList->lpCommands != NULL) {
COMMAND_INFO *pNext = m_WndList->lpCommands->next;
mir_free(m_WndList->lpCommands->lpCommand);
@@ -941,11 +937,7 @@ 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/Chat/message.c b/plugins/Chat/message.c
index ddf81d38bf..5d1de9379a 100644
--- a/plugins/Chat/message.c
+++ b/plugins/Chat/message.c
@@ -153,11 +153,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;
@@ -198,61 +194,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;
@@ -264,11 +236,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,11 +308,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
mir_free(pIndex);
- #if !defined( _UNICODE )
- return pszText;
- #else
- return mir_utf8decodeW(pszText);
- #endif
+ return mir_utf8decodeW(pszText);
}
static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
@@ -386,11 +350,7 @@ char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO* si)
stream.pfnCallback = Message_StreamCallback;
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);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_STREAMOUT, dwFlags, (LPARAM) & stream);
return pszText; // pszText contains the text
}
diff --git a/plugins/Chat/services.c b/plugins/Chat/services.c
index 37f7a2c71c..5687e9cb99 100644
--- a/plugins/Chat/services.c
+++ b/plugins/Chat/services.c
@@ -291,20 +291,15 @@ static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam)
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
-
+ }
+ else {
+ if ( gci->Flags & ID ) gci->pszID = ( TCHAR* )si->pszID;
+ if ( gci->Flags & NAME ) gci->pszName = ( TCHAR* )si->pszName;
+ }
+
LeaveCriticalSection(&cs);
return 0;
}
@@ -324,11 +319,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 );
@@ -405,13 +395,11 @@ 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;
si->bFGSet = TRUE;
@@ -627,7 +615,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
EnterCriticalSection(&cs);
-#ifdef _UNICODE
if ( !( gce->dwFlags & GC_UNICODE )) {
save_gce = *gce;
save_gcd = *gce->pDest;
@@ -638,7 +625,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
}
-#endif
// Do different things according to type of event
switch(gcd->iType) {
@@ -780,7 +766,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
LBL_Exit:
LeaveCriticalSection(&cs);
-#ifdef _UNICODE
if ( !( gce->dwFlags & GC_UNICODE )) {
mir_free((void*)gce->ptszText );
mir_free((void*)gce->ptszNick );
@@ -791,7 +776,6 @@ LBL_Exit:
*gce = save_gce;
*gce->pDest = save_gcd;
}
-#endif
return iRetVal;
}
diff --git a/plugins/Chat/tools.c b/plugins/Chat/tools.c
index 41ac446273..6609a388a0 100644
--- a/plugins/Chat/tools.c
+++ b/plugins/Chat/tools.c
@@ -786,7 +786,6 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
gcd->pszModule = mir_strdup( pszModule );
-#if defined( _UNICODE )
{
SESSION_INFO* si;
if (( si = SM_FindSession(pszID, pszModule)) == NULL )
@@ -803,11 +802,6 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
gch->ptszText = mir_tstrdup( pszText );
}
}
-#else
- gcd->pszID = mir_strdup( pszID );
- gch->pszUID = mir_strdup( pszUID );
- gch->pszText = mir_strdup( pszText );
-#endif
gcd->iType = iType;
gch->dwData = dwItem;
@@ -823,7 +817,6 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
gcd.pszModule = (char*)pszModule;
-#ifdef _UNICODE
{
SESSION_INFO* si;
if (( si = SM_FindSession(pszID, pszModule)) == NULL )
@@ -840,11 +833,6 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
gch.ptszText = mir_tstrdup( pszText );
}
}
-#else
- gcd.pszID = mir_strdup( pszID );
- gch.pszUID = mir_strdup( pszUID );
- gch.pszText = mir_strdup( pszText );
-#endif
gcd.iType = iType;
gch.dwData = dwItem;
@@ -909,14 +897,10 @@ TCHAR* a2tf( const TCHAR* str, int flags )
if ( str == NULL )
return NULL;
- #if defined( _UNICODE )
- if ( flags & GC_UNICODE )
- return mir_tstrdup( str );
- else
- return mir_a2u((char*)str);
- #else
- return mir_strdup( str );
- #endif
+ if ( flags & GC_UNICODE )
+ return mir_tstrdup( str );
+ else
+ return mir_a2u((char*)str);
}
TCHAR* replaceStr( TCHAR** dest, const TCHAR* src )
diff --git a/plugins/Chat/window.c b/plugins/Chat/window.c
index d6acde7f53..2021496563 100644
--- a/plugins/Chat/window.c
+++ b/plugins/Chat/window.c
@@ -401,12 +401,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
gt.cb = iLen+99;
gt.flags = GT_DEFAULT;
- #if defined( _UNICODE )
- gt.codepage = 1200;
- #else
- gt.codepage = CP_ACP;
- #endif
-
+ gt.codepage = 1200;
+
SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
while ( start >0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
start--;
@@ -2378,11 +2374,7 @@ LABEL_SHOWWINDOW:
hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
lstrcpy(( TCHAR* )GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
- #if defined( _UNICODE )
- SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
+ SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
break;
@@ -2490,9 +2482,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_MESSAGE));
}
break;