diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-08 19:39:48 +0000 |
commit | 05cd7934d4bdb097e112efdda356946868f3f5d6 (patch) | |
tree | 0fa678b494af8b994abf7319298a1af06fc9218a /plugins | |
parent | 50a2ba5bf6827b8f010288021c1797c11bd1531e (diff) |
- end of ANSI support in chats;
- manual crit section control removed from chat engine;
- bunch of memory-related clutches either removed or replaced with smart pointers
git-svn-id: http://svn.miranda-ng.org/main/trunk@7549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 5 | ||||
-rw-r--r-- | plugins/PasteIt/src/PasteIt.cpp | 56 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/chat.h | 52 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/manager.cpp | 42 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/services.cpp | 168 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/tools.cpp | 137 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 12 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/chat.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/chatprototypes.h | 54 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/manager.cpp | 48 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/services.cpp | 329 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/tools.cpp | 134 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 5 | ||||
-rw-r--r-- | plugins/Utils.pas/mirutils.pas | 2 |
14 files changed, 355 insertions, 691 deletions
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index d586923033..48f861b2c9 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -856,7 +856,7 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) if(pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0)
{
- GCDEST gcd = {0};
+ GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE };
DBVARIANT dbv;
if (!db_get_ts((HANDLE)hContact, szProto, "Nick", &dbv))
@@ -866,11 +866,8 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) tstring strID = tstring(gcd.ptszID) + _T(" - ") + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str()));
gcd.ptszID = (LPTSTR)strID.c_str();
- gcd.pszModule = szProto;
- gcd.iType = GC_EVENT_SENDMESSAGE;
GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GC_TCHAR;
gce.ptszStatus = _T("");
gce.ptszText = (LPTSTR)strAscii.c_str();
gce.time = time(NULL);
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 40510ee3b1..d69a97f987 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -142,41 +142,11 @@ void PasteIt(HANDLE hContact, int mode) // PSS_MESSAGE is not compatible with chat rooms
// there are no simple method to send text to all users
// in chat room.
- // First I check if protocol is unicode or ascii.
- BOOL isUnicodePlugin = TRUE;
- PROTOACCOUNT* protoAc = ProtoGetAccount(szProto);
- if(protoAc != NULL)
- {
- // protoAc->ppro is abstract class, that contains
- // methods implemented in protocol ddl`s segment.
- // Method address in vptr table must be converted
- // to hInstance of protocol dll.
- PROTO_INTERFACE* protoInt = protoAc->ppro;
- MEMORY_BASIC_INFORMATION mb;
- INT_PTR *vptr = *(INT_PTR**)&protoAc->ppro;
- INT_PTR *vtable = (INT_PTR *)*vptr;
- if(VirtualQuery((void*)vtable[0], &mb, sizeof(MEMORY_BASIC_INFORMATION)))
- {
- typedef PLUGININFOEX * (__cdecl * Miranda_Plugin_InfoEx) ( DWORD mirandaVersion );
- HINSTANCE hInst = (HINSTANCE)mb.AllocationBase;
- // Now I can get PLUGININFOEX from protocol
- Miranda_Plugin_InfoEx infoEx = (Miranda_Plugin_InfoEx) GetProcAddress(hInst, "MirandaPluginInfoEx");
- PLUGININFOEX* pi = NULL;
- if(infoEx != NULL)
- pi = infoEx(gMirandaVersion);
-
- // If PLUGININFOEX flags contains UNICODE_AWARE,
- // this mean that protocol is unicode.
- if(pi != NULL && pi->cbSize == sizeof(PLUGININFOEX))
- isUnicodePlugin = pi->flags & UNICODE_AWARE;
- }
- }
-
// Next step is to get all protocol sessions and find
// one with correct hContact
GC_INFO gci = {0};
- GCDEST gcd = {0};
- GCEVENT gce = {0};
+ GCDEST gcd = { szProto, NULL, GC_EVENT_SENDMESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto);
for (int i = 0; i < cnt ; i++ )
{
@@ -189,29 +159,13 @@ void PasteIt(HANDLE hContact, int mode) // In this place session was finded, gci.pszID contains
// session ID, but it is in unicode or ascii format,
// depends on protocol wersion
- gcd.pszModule = szProto;
- gcd.iType = GC_EVENT_SENDMESSAGE;
gcd.ptszID = gci.pszID;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
gce.bIsMe = TRUE;
- gce.dwFlags = isUnicodePlugin ? (GCEF_ADDTOLOG | GC_UNICODE) : GCEF_ADDTOLOG;
- wchar_t* s = NULL;
- if(isUnicodePlugin)
- {
- // If session ID is in unicode, text must be too in unicode
- s = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
- gce.ptszText = s;
- }
- else
- {
- // If session ID is in ascii, text must be too in ascii
- gce.pszText = pasteToWeb->szFileLink;
- }
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
gce.time = time(NULL);
CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce);
- if(s != NULL)
- mir_free(s);
+ mir_free((void*)gce.ptszText);
break;
}
}
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index e88221baae..0532333508 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -334,37 +334,37 @@ int Chat_IconsChanged(WPARAM wParam,LPARAM lParam); void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
//manager.c
-void SetActiveSession(const TCHAR* pszID, const char* pszModule);
+void SetActiveSession(const TCHAR *pszID, const char* pszModule);
void SetActiveSessionEx(SESSION_INFO *si);
SESSION_INFO* GetActiveSession(void);
-SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule);
-int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeContact);
-SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule);
+SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char* pszModule);
+int SM_RemoveSession(const TCHAR *pszID, const char* pszModule, BOOL removeContact);
+SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char* pszModule);
HWND SM_FindWindowByContact(HANDLE hContact);
USERINFO* SM_AddUser(SESSION_INFO *si, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus);
-BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID);
-BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce);
-BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
-BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule);
+BOOL SM_ChangeUID(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID);
+BOOL SM_ChangeNick(const TCHAR *pszID, const char* pszModule, GCEVENT *gce);
+BOOL SM_RemoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID);
+BOOL SM_SetOffline(const TCHAR *pszID, const char* pszModule);
HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui);
-BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus);
-BOOL SM_SetStatusEx(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText, int flags );
-BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText);
-STATUSINFO* SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszStatus);
-BOOL SM_AddEventToAllMatchingUID(GCEVENT * gce);
-BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT * gce, BOOL bIsHighlighted);
-LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL SM_PostMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
+BOOL SM_SetStatus(const TCHAR *pszID, const char* pszModule, int wStatus);
+BOOL SM_SetStatusEx(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText, int flags );
+BOOL SM_SendUserMessage(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText);
+STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszStatus);
+BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce);
+BOOL SM_AddEvent(const TCHAR *pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted);
+LRESULT SM_SendMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
+BOOL SM_PostMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL SM_BroadcastMessage(const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAsync);
BOOL SM_RemoveAll (void);
-BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
-BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, WORD pszStatus);
-BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
-BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
+BOOL SM_GiveStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
+BOOL SM_SetContactStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, WORD pszStatus);
+BOOL SM_TakeStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
+BOOL SM_MoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID);
int SM_GetCount(const char* pszModule);
SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem);
char* SM_GetUsers(SESSION_INFO *si);
-USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index);
+USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char* pszModule, int index);
char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO * ui);
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent);
MODULEINFO* MM_AddModule(const char* pszModule);
@@ -373,7 +373,7 @@ void MM_FixColors(); void MM_FontsChanged(void);
void MM_IconsChanged(void);
BOOL MM_RemoveAll (void);
-BOOL TabM_AddTab(const TCHAR* pszID, const char* pszModule);
+BOOL TabM_AddTab(const TCHAR *pszID, const char* pszModule);
BOOL TabM_RemoveAll (void);
STATUSINFO* TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int* iCount);
STATUSINFO* TM_FindStatus(STATUSINFO* pStatusList, const TCHAR* pszStatus);
@@ -412,15 +412,15 @@ int WCCmp(TCHAR* wild, TCHAR*string); //tools.c
TCHAR* RemoveFormatting(const TCHAR* pszText);
-BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighlight, int bManyFix);
+BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
int GetColorIndex(const char* pszModule, COLORREF cr);
void CheckColorsInModule(const char* pszModule);
TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ;
BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
-BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
@@ -429,7 +429,5 @@ TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO *si); //////////////////////////////////////////////////////////////////////////////////
-TCHAR* a2tf(const TCHAR *str, int flags);
-
#define DEFLOGFILENAME _T("%miranda_logpath%\\%proto%\\%userid%.log")
#endif
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 02c6854f88..cf98e7412d 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -30,7 +30,7 @@ SESSION_INFO* m_WndList = 0; TABLIST * g_TabList = 0;
MODULEINFO *m_ModList = 0;
-void SetActiveSession(const TCHAR* pszID, const char* pszModule)
+void SetActiveSession(const TCHAR *pszID, const char* pszModule)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if ( si )
@@ -60,7 +60,7 @@ SESSION_INFO* GetActiveSession( void ) // Keeps track of all sessions and its windows
//---------------------------------------------------
-SESSION_INFO* SM_AddSession( const TCHAR* pszID, const char* pszModule)
+SESSION_INFO* SM_AddSession( const TCHAR *pszID, const char* pszModule)
{
if ( !pszID || !pszModule )
return NULL;
@@ -84,7 +84,7 @@ SESSION_INFO* SM_AddSession( const TCHAR* pszID, const char* pszModule) return NULL;
}
-int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeContact)
+int SM_RemoveSession(const TCHAR *pszID, const char* pszModule, BOOL removeContact)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -154,7 +154,7 @@ int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeConta return FALSE;
}
-SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule)
+SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char* pszModule)
{
SESSION_INFO *pTemp = m_WndList;
@@ -183,7 +183,7 @@ HWND SM_FindWindowByContact(HANDLE hContact) return NULL;
}
-BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule)
+BOOL SM_SetOffline(const TCHAR *pszID, const char* pszModule)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -208,7 +208,7 @@ BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule) return TRUE;
}
-BOOL SM_SetStatusEx( const TCHAR* pszID, const char* pszModule, const TCHAR* pszText, int flags )
+BOOL SM_SetStatusEx( const TCHAR *pszID, const char* pszModule, const TCHAR* pszText, int flags )
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -282,7 +282,7 @@ HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui) return GetCachedIcon("chat_status0");
}
-BOOL SM_AddEventToAllMatchingUID(GCEVENT * gce)
+BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
int bManyFix = 0;
@@ -311,7 +311,7 @@ BOOL SM_AddEventToAllMatchingUID(GCEVENT * gce) return 0;
}
-BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT * gce, BOOL bIsHighlighted)
+BOOL SM_AddEvent(const TCHAR *pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -353,7 +353,7 @@ USERINFO * SM_AddUser( SESSION_INFO * si, const TCHAR* pszUID, const TCHAR* pszN return p;
}
-BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID)
+BOOL SM_MoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID)
{
SESSION_INFO *pTemp = m_WndList;
@@ -371,7 +371,7 @@ BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID) return FALSE;
}
-BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID)
+BOOL SM_RemoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -401,7 +401,7 @@ BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return 0;
}
-USERINFO * SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index)
+USERINFO * SM_GetUserFromIndex(const TCHAR *pszID, const char* pszModule, int index)
{
SESSION_INFO *pTemp = m_WndList;
@@ -418,7 +418,7 @@ USERINFO * SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int in }
-STATUSINFO * SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszStatus)
+STATUSINFO * SM_AddStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszStatus)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -439,7 +439,7 @@ STATUSINFO * SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR return 0;
}
-BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
+BOOL SM_GiveStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -463,7 +463,7 @@ BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return FALSE;
}
-BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, WORD wStatus)
+BOOL SM_SetContactStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, WORD wStatus)
{
SESSION_INFO* pTemp = m_WndList, *pLast = NULL;
@@ -487,7 +487,7 @@ BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* return FALSE;
}
-BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
+BOOL SM_TakeStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -510,7 +510,7 @@ BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return FALSE;
}
-LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT SM_SendMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -530,7 +530,7 @@ LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPAR return 0;
}
-BOOL SM_PostMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+BOOL SM_PostMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -573,7 +573,7 @@ BOOL SM_BroadcastMessage(const char* pszModule, UINT msg, WPARAM wParam, LPARAM return TRUE;
}
-BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus)
+BOOL SM_SetStatus(const TCHAR *pszID, const char* pszModule, int wStatus)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -602,7 +602,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) return TRUE;
}
-BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText)
+BOOL SM_SendUserMessage(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -623,7 +623,7 @@ BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* }
-BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID)
+BOOL SM_ChangeUID(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -646,7 +646,7 @@ BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID }
-BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce)
+BOOL SM_ChangeNick(const TCHAR *pszID, const char* pszModule, GCEVENT *gce)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index cf6b644971..7bdc353d4b 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -26,22 +26,6 @@ HANDLE hBuildMenuEvent ; HANDLE g_hHookContactDblClick, g_hHookPrebuildMenu;
CRITICAL_SECTION cs;
-#ifdef _WIN64
-
-#define SIZEOF_STRUCT_GCREGISTER_V1 40
-#define SIZEOF_STRUCT_GCWINDOW_V1 48
-#define SIZEOF_STRUCT_GCEVENT_V1 76
-#define SIZEOF_STRUCT_GCEVENT_V2 80
-
-#else
-
-#define SIZEOF_STRUCT_GCREGISTER_V1 28
-#define SIZEOF_STRUCT_GCWINDOW_V1 32
-#define SIZEOF_STRUCT_GCEVENT_V1 44
-#define SIZEOF_STRUCT_GCEVENT_V2 48
-
-#endif
-
int Chat_SmileyOptionsChanged(WPARAM wParam,LPARAM lParam)
{
SM_BroadcastMessage(NULL, GC_REDRAWLOG, 0, 1, FALSE);
@@ -107,10 +91,8 @@ 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 (si->dwFlags & GC_UNICODE) {
- if (gci->Flags & ID) gci->pszID = si->ptszID;
- if (gci->Flags & NAME) gci->pszName = si->ptszName;
- }
+ if (gci->Flags & ID) gci->pszID = si->ptszID;
+ if (gci->Flags & NAME) gci->pszName = si->ptszName;
return 0;
}
@@ -140,24 +122,24 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) if (gcr == NULL)
return GC_REGISTER_ERROR;
- if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
+ if (gcr->cbSize != sizeof(GCREGISTER))
return GC_REGISTER_WRONGVER;
mir_cslock lock(cs);
- MODULEINFO *mi = MM_AddModule( gcr->pszModule );
+ MODULEINFO *mi = MM_AddModule(gcr->pszModule);
if (mi == NULL)
return GC_REGISTER_ERROR;
- mi->ptszModDispName = a2tf( gcr->ptszModuleDispName, gcr->dwFlags );
- mi->bBold = gcr->dwFlags&GC_BOLD;
- mi->bUnderline = gcr->dwFlags&GC_UNDERLINE ;
- mi->bItalics = gcr->dwFlags&GC_ITALICS ;
- mi->bColor = gcr->dwFlags&GC_COLOR ;
- mi->bBkgColor = gcr->dwFlags&GC_BKGCOLOR ;
- mi->bFontSize = gcr->dwFlags&GC_FONTSIZE;
- mi->bAckMsg = gcr->dwFlags&GC_ACKMSG ;
- mi->bChanMgr = gcr->dwFlags&GC_CHANMGR ;
- mi->bSingleFormat = gcr->dwFlags&GC_SINGLEFORMAT;
+ mi->ptszModDispName = mir_tstrdup(gcr->ptszDispName);
+ mi->bBold = gcr->dwFlags & GC_BOLD;
+ mi->bUnderline = gcr->dwFlags & GC_UNDERLINE ;
+ mi->bItalics = gcr->dwFlags & GC_ITALICS ;
+ mi->bColor = gcr->dwFlags & GC_COLOR ;
+ mi->bBkgColor = gcr->dwFlags & GC_BKGCOLOR ;
+ mi->bFontSize = gcr->dwFlags & GC_FONTSIZE;
+ mi->bAckMsg = gcr->dwFlags & GC_ACKMSG ;
+ mi->bChanMgr = gcr->dwFlags & GC_CHANMGR ;
+ mi->bSingleFormat = gcr->dwFlags & GC_SINGLEFORMAT;
mi->iMaxText= gcr->iMaxText;
mi->nColorCount = gcr->nColors;
if ( gcr->nColors > 0) {
@@ -176,18 +158,15 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) if (gcw == NULL)
return GC_NEWSESSION_ERROR;
- if (gcw->cbSize != SIZEOF_STRUCT_GCWINDOW_V1)
+ if (gcw->cbSize != sizeof(GCSESSION))
return GC_NEWSESSION_WRONGVER;
mir_cslock lock(cs);
-
MODULEINFO *mi = MM_FindModule(gcw->pszModule);
if (mi == NULL)
return GC_NEWSESSION_ERROR;
- TCHAR *ptszID = a2tf( gcw->ptszID, gcw->dwFlags );
- SESSION_INFO *si = SM_AddSession( ptszID, gcw->pszModule);
-
+ SESSION_INFO *si = SM_AddSession(gcw->ptszID, gcw->pszModule);
if (mi->hOfflineIcon == NULL)
LoadModuleIcons(mi);
@@ -200,19 +179,14 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->wStatus = ID_STATUS_ONLINE;
si->iType = gcw->iType;
si->dwFlags = gcw->dwFlags;
- si->ptszName = a2tf( gcw->ptszName, gcw->dwFlags );
- si->ptszStatusbarText = a2tf( gcw->ptszStatusbarText, gcw->dwFlags );
+ si->ptszName = mir_tstrdup(gcw->ptszName);
+ si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
si->iSplitterX = g_Settings.iSplitterX;
si->iSplitterY = g_Settings.iSplitterY;
si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
- 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;
@@ -225,10 +199,10 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) mir_sntprintf(szTemp, SIZEOF(szTemp), LPGENT("Server: %s"), si->ptszName);
else
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
- si->windowData.hContact = CList_AddRoom( gcw->pszModule, ptszID, szTemp, si->iType);
- si->windowData.codePage = db_get_w(si->windowData.hContact, si->pszModule, "CodePage", (WORD) CP_ACP);
+ si->windowData.hContact = CList_AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
+ si->windowData.codePage = db_get_w(si->windowData.hContact, si->pszModule, "CodePage", (WORD)CP_ACP);
si->pszHeader = Log_CreateRtfHeader(mi, si);
- db_set_s(si->windowData.hContact, si->pszModule , "Topic", "");
+ db_set_s(si->windowData.hContact, si->pszModule, "Topic", "");
db_unset(si->windowData.hContact, "CList", "StatusMsg");
if (si->ptszStatusbarText)
db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
@@ -236,7 +210,7 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) db_set_s(si->windowData.hContact, si->pszModule, "StatusBar", "");
}
else {
- SESSION_INFO *si2 = SM_FindSession( ptszID, gcw->pszModule );
+ SESSION_INFO *si2 = SM_FindSession(gcw->ptszID, gcw->pszModule);
if (si2) {
UM_RemoveAll(&si2->pUsers);
TM_RemoveAll(&si2->pStatuses);
@@ -249,7 +223,6 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) }
}
- mir_free( ptszID );
return 0;
}
@@ -301,11 +274,11 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp) }
SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
}
- else if (gce->pDest->iType == GC_EVENT_CHUID && gce->pszText)
+ else if (gce->pDest->iType == GC_EVENT_CHUID && gce->ptszText)
{
SM_ChangeUID( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
}
- else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->pszText)
+ else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->ptszText)
{
if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
replaceStrT(si->ptszName, gce->ptszText);
@@ -340,7 +313,7 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp) {
SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_ACKMESSAGE, 0, 0);
}
- else if (gce->pDest->iType == GC_EVENT_SENDMESSAGE && gce->pszText)
+ else if (gce->pDest->iType == GC_EVENT_SENDMESSAGE && gce->ptszText)
{
SM_SendUserMessage( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText);
}
@@ -353,7 +326,7 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp) return 0;
}
-static void AddUser(GCEVENT * gce)
+static void AddUser(GCEVENT *gce)
{
SESSION_INFO *si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule);
if (si == NULL) return;
@@ -392,14 +365,12 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
{
- GCEVENT *gce = (GCEVENT*)lParam, save_gce;
- GCDEST save_gcd;
+ GCEVENT *gce = (GCEVENT*)lParam;
SESSION_INFO *si;
TCHAR* pWnd = NULL;
char* pMod = NULL;
BOOL bIsHighlighted = FALSE;
BOOL bRemoveFlag = FALSE;
- int iRetVal = GC_EVENT_ERROR;
if (gce == NULL)
return GC_EVENT_ERROR;
@@ -408,24 +379,13 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (gcd == NULL)
return GC_EVENT_ERROR;
- if (gce->cbSize != SIZEOF_STRUCT_GCEVENT_V1 && gce->cbSize != SIZEOF_STRUCT_GCEVENT_V2)
+ if (gce->cbSize != sizeof(GCEVENT))
return GC_EVENT_WRONGVER;
- if ( !IsEventSupported(gcd->iType))
+ if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
- EnterCriticalSection(&cs);
-
- 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);
- }
+ mir_cslock lck(cs);
// Do different things according to type of event
switch(gcd->iType) {
@@ -435,8 +395,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (si && gce->dwItemData)
si->hIcon = CopyIcon((HICON)gce->dwItemData);
}
- iRetVal = 0;
- goto LBL_Exit;
+ return 0;
case GC_EVENT_CHUID:
case GC_EVENT_CHANGESESSIONAME:
@@ -447,19 +406,17 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_ACK:
case GC_EVENT_SENDMESSAGE :
case GC_EVENT_SETSTATUSEX :
- iRetVal = DoControl(gce, wParam);
- goto LBL_Exit;
+ return DoControl(gce, wParam);
case GC_EVENT_SETCONTACTSTATUS:
- iRetVal = SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
- goto LBL_Exit;
+ return SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
case GC_EVENT_TOPIC:
if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- if (gce->pszText) {
+ if (gce->ptszText) {
replaceStrT(si->ptszTopic, gce->ptszText);
db_set_ts(si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting(si->ptszTopic));
- if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 ))
+ if (db_get_b(NULL, "Chat", "TopicOnClist", 0))
db_set_ts(si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting(si->ptszTopic));
}
}
@@ -475,7 +432,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
- if (!gce->bIsMe && gce->pDest->ptszID && gce->pszText) {
+ if (!gce->bIsMe && gce->pDest->ptszID && gce->ptszText) {
if (si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule))
if ( IsHighlighted(si, gce->ptszText))
bIsHighlighted = TRUE;
@@ -508,18 +465,13 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) pWnd = si->ptszID;
pMod = si->pszModule;
}
- else {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ else return 0;
}
else {
// Send the event to all windows with a user pszUID. Used for broadcasting QUIT etc
SM_AddEventToAllMatchingUID(gce);
- if (!bRemoveFlag) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (!bRemoveFlag)
+ return 0;
}
// add to log
@@ -527,15 +479,11 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) si = SM_FindSession(pWnd, pMod);
// fix for IRC's old stuyle mode notifications. Should not affect any other protocol
- if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG)) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
+ return 0;
- if (gce && gce->pDest->iType == GC_EVENT_JOIN && gce->time == 0) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (gce && gce->pDest->iType == GC_EVENT_JOIN && gce->time == 0)
+ return 0;
if (si && (si->bInitDone || gce->pDest->iType == GC_EVENT_TOPIC || (gce->pDest->iType == GC_EVENT_JOIN && gce->bIsMe))) {
if (SM_AddEvent(pWnd, pMod, gce, bIsHighlighted) && si->hWnd)
@@ -549,40 +497,22 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) LogToFile(si, gce);
}
- if (!bRemoveFlag) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (!bRemoveFlag)
+ return 0;
}
if (bRemoveFlag)
- iRetVal = ( SM_RemoveUser( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID ) == 0 ) ? 1 : 0;
-
-LBL_Exit:
- LeaveCriticalSection(&cs);
-
- 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 SM_RemoveUser( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID ) == 0;
- return iRetVal;
+ return GC_EVENT_ERROR;
}
static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam)
{
- GCPTRS * gp = (GCPTRS *) lParam;
-
- EnterCriticalSection(&cs);
+ GCPTRS *gp = (GCPTRS*)lParam;
+ mir_cslock lck(cs);
gp->pfnAddEvent = Service_AddEvent;
- LeaveCriticalSection(&cs);
return 0;
}
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 90f9f447ad..7fe38bb5e5 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -143,7 +143,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszP return PUAddPopupT(&pd);
}
-static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce)
+static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
int iEvent = gce->pDest->iType;
@@ -169,10 +169,10 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce) CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_quit"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s has disconnected"), gce->ptszNick);
break;
case GC_EVENT_NICK:
- CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_nick"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->pszText);
+ CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_nick"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
- CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_kick"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->pszStatus, gce->ptszNick, si->ptszName);
+ CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_kick"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_NOTICE:
CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_notice"), "chaticon", CLEF_ONLYAFEW, TranslateT("Notice from %s"), gce->ptszNick);
@@ -184,10 +184,10 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce) CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_info"), "chaticon", CLEF_ONLYAFEW, TranslateT("Information in %s"), si->ptszName);
break;
case GC_EVENT_ADDSTATUS:
- CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_addstatus"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s enables \'%s\' status for %s in %s"), gce->pszText, gce->pszStatus, gce->ptszNick, si->ptszName);
+ CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_addstatus"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s enables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_REMOVESTATUS:
- CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_removestatus"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s disables \'%s\' status for %s in %s"), gce->pszText, gce->pszStatus, gce->ptszNick, si->ptszName);
+ CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_removestatus"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s disables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
}
}
@@ -195,7 +195,7 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce) return TRUE;
}
-static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce)
+static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
int iEvent = gce->pDest->iType;
@@ -217,13 +217,13 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce) ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_join"), si->pszModule, si->ptszName, aFonts[3].color, TranslateT("%s has joined"), gce->ptszNick);
break;
case GC_EVENT_PART:
- if (!gce->pszText)
+ if (!gce->ptszText)
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_part"), si->pszModule, si->ptszName, aFonts[4].color, TranslateT("%s has left"), gce->ptszNick);
else
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_part"), si->pszModule, si->ptszName, aFonts[4].color, TranslateT("%s has left (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
- if (!gce->pszText)
+ if (!gce->ptszText)
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_quit"), si->pszModule, si->ptszName, aFonts[5].color, TranslateT("%s has disconnected"), gce->ptszNick);
else
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_quit"), si->pszModule, si->ptszName, aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
@@ -232,10 +232,10 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce) ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_nick"), si->pszModule, si->ptszName, aFonts[7].color, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
- if (!gce->pszText)
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_kick"), si->pszModule, si->ptszName, aFonts[6].color, TranslateT("%s kicked %s"), (char*)gce->pszStatus, gce->ptszNick);
+ if (!gce->ptszText)
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_kick"), si->pszModule, si->ptszName, aFonts[6].color, TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_kick"), si->pszModule, si->ptszName, aFonts[6].color, TranslateT("%s kicked %s (%s)"), (char*)gce->pszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_kick"), si->pszModule, si->ptszName, aFonts[6].color, TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_notice"), si->pszModule, si->ptszName, aFonts[8].color, TranslateT("Notice from %s: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
@@ -250,10 +250,10 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce) ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_info"), si->pszModule, si->ptszName, aFonts[12].color, _T("%s"), RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ADDSTATUS:
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_addstatus"), si->pszModule, si->ptszName, aFonts[13].color, TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, (char*)gce->pszStatus, gce->ptszNick);
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_addstatus"), si->pszModule, si->ptszName, aFonts[13].color, TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_removestatus"), si->pszModule, si->ptszName, aFonts[14].color, TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, (char*)gce->pszStatus, gce->ptszNick);
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_removestatus"), si->pszModule, si->ptszName, aFonts[14].color, TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
}
@@ -261,7 +261,7 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce) return TRUE;
}
-BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighlight, int bManyFix)
+BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix)
{
if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
@@ -484,7 +484,7 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText) return FALSE;
}
-BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
+BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
{
TCHAR szBuffer[4096];
TCHAR szLine[4096];
@@ -524,8 +524,8 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce) }
else lstrcpyn(szTemp2, gce->ptszNick, 511);
- if (gce->pszUserInfo)
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, gce->pszUserInfo);
+ if (gce->ptszUserInfo)
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, gce->ptszUserInfo);
else
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), szTemp2);
pszNick = szTemp;
@@ -543,21 +543,21 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce) break;
case GC_EVENT_JOIN:
p = '>';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has joined"), (char*)pszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has joined"), pszNick);
break;
case GC_EVENT_PART:
p = '<';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left"), (char*)pszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left"), pszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left (%s)"), (char*)pszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left (%s)"), pszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
p = '<';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected"), (char*)pszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected"), pszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), (char*)pszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), pszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
p = '^';
@@ -565,10 +565,10 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce) break;
case GC_EVENT_KICK:
p = '~';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s"), (char*)gce->pszStatus, gce->ptszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s (%s)"), (char*)gce->pszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
p = 'o';
@@ -576,7 +576,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce) break;
case GC_EVENT_TOPIC:
p = '#';
- if (!gce->pszNick)
+ if (!gce->ptszNick)
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The topic is \'%s\'"), RemoveFormatting(gce->ptszText));
else
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The topic is \'%s\' (set by %s)"), RemoveFormatting(gce->ptszText), gce->ptszNick);
@@ -587,11 +587,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce) break;
case GC_EVENT_ADDSTATUS:
p = '+';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, (char*)gce->pszStatus, gce->ptszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
p = '-';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, (char*)gce->pszStatus, gce->ptszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
if (p)
@@ -701,8 +701,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
for (int i = 0; i < gcmi.nItems; i++) {
- TCHAR *ptszDescr = a2tf(gcmi.Item[i].pszDesc, si->dwFlags);
- TCHAR *ptszText = TranslateTS(ptszDescr);
+ TCHAR *ptszText = TranslateTS(gcmi.Item[i].pszDesc);
DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0;
if (gcmi.Item[i].uType == MENU_NEWPOPUP) {
@@ -725,8 +724,6 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s AppendMenu(*hMenu, dwState | MF_STRING, gcmi.Item[i].dwID, ptszText);
else if (gcmi.Item[i].uType == MENU_CHECK)
AppendMenu(*hMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText);
-
- mir_free(ptszDescr);
}
return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
}
@@ -744,70 +741,46 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) }
}
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
- GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
- GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
-
- replaceStr(gcd->pszModule, pszModule);
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
return FALSE;
- if (!(si->dwFlags & GC_UNICODE)) {
- gcd->ptszID = (LPTSTR)mir_t2a(pszID);
- gch->pszUID = mir_t2a(pszUID);
- gch->pszText = mir_t2a(pszText);
- }
- else {
- replaceStrT(gcd->ptszID, pszID);
- replaceStrT(gch->ptszUID, pszUID);
- replaceStrT(gch->ptszText, pszText);
- }
-
+ GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
+ replaceStr(gcd->pszModule, pszModule);
+ replaceStrT(gcd->ptszID, pszID);
gcd->iType = iType;
+
+ GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
+ replaceStrT(gch->ptszUID, pszUID);
+ replaceStrT(gch->ptszText, pszText);
gch->dwData = dwItem;
gch->pDest = gcd;
PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
return TRUE;
}
-BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
{
- GCHOOK gch = { 0 };
- GCDEST gcd = { 0 };
-
- gcd.pszModule = (char*)pszModule;
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
return FALSE;
- if (!(si->dwFlags & GC_UNICODE)) {
- gcd.ptszID = (LPTSTR)mir_t2a(pszID);
- gch.pszUID = mir_t2a(pszUID);
- gch.pszText = mir_t2a(pszText);
- }
- else {
- gcd.ptszID = mir_tstrdup(pszID);
- gch.ptszUID = mir_tstrdup(pszUID);
- gch.ptszText = mir_tstrdup(pszText);
- }
-
- gcd.iType = iType;
+ GCDEST gcd = { (char*)pszModule, (LPTSTR)pszID, iType };
+ GCHOOK gch = { 0 };
+ gch.ptszUID = (LPTSTR)pszUID;
+ gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
gch.pDest = &gcd;
NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
-
- mir_free(gcd.ptszID);
- mir_free(gch.ptszUID);
- mir_free(gch.ptszText);
return TRUE;
}
BOOL IsEventSupported(int eventType)
{
+ // Supported events
switch (eventType) {
- // Supported events
case GC_EVENT_JOIN:
case GC_EVENT_PART:
case GC_EVENT_QUIT:
@@ -838,26 +811,6 @@ BOOL IsEventSupported(int eventType) return FALSE;
}
-TCHAR* a2tf(const TCHAR* str, int flags)
-{
- if (str == NULL)
- return NULL;
-
- if (flags & GC_UNICODE)
- return mir_tstrdup(str);
-
- 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;
-
- MultiByteToWideChar(codepage, 0, (char*)str, -1, result, cbLen);
- result[cbLen] = 0;
- return result;
-}
-
TCHAR* GetChatLogsFilename(HANDLE hContact, time_t tTime)
{
REPLACEVARSARRAY rva[11];
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 8661fa0776..90f7700622 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -148,16 +148,10 @@ void CSend::svcSendChat() { gci.Flags = BYINDEX | HCONTACT | ID; CallService(MS_GC_GETINFO, 0, (LPARAM) &gci); if (gci.hContact == m_hContact) { - GCDEST gcd = {0}; - gcd.pszModule = m_pszProto; - gcd.iType = GC_EVENT_SENDMESSAGE; - gcd.ptszID = gci.pszID; - - GCEVENT gce = {0}; - gce.cbSize = sizeof(GCEVENT); - gce.pDest = &gcd; + GCDEST gcd = { m_pszProto, gci.pszID, GC_EVENT_SENDMESSAGE }; + GCEVENT gce = { sizeof(gce), &gcd }; gce.bIsMe = TRUE; - gce.dwFlags = GC_TCHAR|GCEF_ADDTOLOG; + gce.dwFlags = GCEF_ADDTOLOG; gce.ptszText = m_szEventMsgT; gce.time = time(NULL); diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 5f93dd1d64..2bba66c842 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -308,8 +308,6 @@ struct COLORCHOOSER #include "chatprototypes.h"
#include "chat_resource.h"
-TCHAR* a2tf(const TCHAR* str, int flags, DWORD cp = 0);
-
extern char *szChatIconString;
#define DEFLOGFILENAME _T("%miranda_logpath%\\%proto%\\%userid%.log")
diff --git a/plugins/TabSRMM/src/chat/chatprototypes.h b/plugins/TabSRMM/src/chat/chatprototypes.h index e709e40fc5..ace57346bf 100644 --- a/plugins/TabSRMM/src/chat/chatprototypes.h +++ b/plugins/TabSRMM/src/chat/chatprototypes.h @@ -68,43 +68,43 @@ INT_PTR Service_GetCount(WPARAM wParam,LPARAM lParam); HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup);
//manager.c
-void SetActiveSession(const TCHAR* pszID, const char* pszModule);
+void SetActiveSession(const TCHAR *pszID, const char* pszModule);
void SetActiveSessionEx(SESSION_INFO *si);
SESSION_INFO* GetActiveSession(void);
-SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule);
-int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, bool removeContact);
+SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char* pszModule);
+int SM_RemoveSession(const TCHAR *pszID, const char* pszModule, bool removeContact);
void SM_RemoveContainer(TContainerData *pData);
-SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule);
-USERINFO* SM_AddUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus);
+SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char* pszModule);
+USERINFO* SM_AddUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus);
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent);
-BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID);
-BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT *gce);
-BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
-BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule);
+BOOL SM_ChangeUID(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID);
+BOOL SM_ChangeNick(const TCHAR *pszID, const char* pszModule, GCEVENT *gce);
+BOOL SM_RemoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID);
+BOOL SM_SetOffline(const TCHAR *pszID, const char* pszModule);
HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO* ui, char* szIndicator);
-BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus);
-BOOL SM_SetStatusEx(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText, int flags );
-BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText);
-STATUSINFO* SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszStatus);
+BOOL SM_SetStatus(const TCHAR *pszID, const char* pszModule, int wStatus);
+BOOL SM_SetStatusEx(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText, int flags );
+BOOL SM_SendUserMessage(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText);
+STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszStatus);
BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce, BOOL bisHighLight = FALSE);
-BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted);
-LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
-BOOL SM_PostMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
+BOOL SM_AddEvent(const TCHAR *pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted);
+LRESULT SM_SendMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
+BOOL SM_PostMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL SM_BroadcastMessage(const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAsync);
BOOL SM_RemoveAll (void);
-BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
-BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, WORD pszStatus);
-BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
-BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
-void SM_AddCommand(const TCHAR* pszID, const char* pszModule, const char* lpNewCommand);
-char* SM_GetPrevCommand(const TCHAR* pszID, const char* pszModule);
-char* SM_GetNextCommand(const TCHAR* pszID, const char* pszModule);
+BOOL SM_GiveStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
+BOOL SM_SetContactStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, WORD pszStatus);
+BOOL SM_TakeStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus);
+BOOL SM_MoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID);
+void SM_AddCommand(const TCHAR *pszID, const char* pszModule, const char* lpNewCommand);
+char* SM_GetPrevCommand(const TCHAR *pszID, const char* pszModule);
+char* SM_GetNextCommand(const TCHAR *pszID, const char* pszModule);
int SM_GetCount(const char* pszModule);
SESSION_INFO* SM_FindSessionByHWND(HWND h);
SESSION_INFO* SM_FindSessionByHCONTACT(HANDLE h);
SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem);
char* SM_GetUsers(SESSION_INFO *si);
-USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index);
+USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char* pszModule, int index);
BOOL SM_ReconfigureFilters();
BOOL SM_InvalidateLogDirectories();
MODULEINFO* MM_AddModule(const char* pszModule);
@@ -113,7 +113,7 @@ void MM_FixColors(); void MM_FontsChanged(void);
void MM_IconsChanged(void);
BOOL MM_RemoveAll (void);
-BOOL TabM_AddTab(const TCHAR* pszID, const char* pszModule);
+BOOL TabM_AddTab(const TCHAR *pszID, const char* pszModule);
BOOL TabM_RemoveAll (void);
STATUSINFO* TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int* iCount);
STATUSINFO* TM_FindStatus(STATUSINFO* pStatusList, const TCHAR* pszStatus);
@@ -160,8 +160,8 @@ int GetRichTextLength(HWND hwnd); BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
-BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
void Chat_SetFilters(SESSION_INFO *si);
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 1b78cfcc8b..928a821a2d 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static SESSION_INFO *s_WndList = NULL;
static MODULEINFO *s_ModList = NULL;
-void SetActiveSession(const TCHAR* pszID, const char* pszModule)
+void SetActiveSession(const TCHAR *pszID, const char* pszModule)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si)
@@ -59,7 +59,7 @@ SESSION_INFO* GetActiveSession(void) // Keeps track of all sessions and its windows
//---------------------------------------------------
-SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule)
+SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char* pszModule)
{
if (!pszID || !pszModule)
return NULL;
@@ -89,7 +89,7 @@ SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule) return node;
}
-int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, bool removeContact)
+int SM_RemoveSession(const TCHAR *pszID, const char* pszModule, bool removeContact)
{
if (!pszModule)
return FALSE;
@@ -165,7 +165,7 @@ void SM_RemoveContainer(TContainerData *pContainer) si->pContainer = NULL;
}
-SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule)
+SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char* pszModule)
{
if (!pszID || !pszModule)
return NULL;
@@ -177,7 +177,7 @@ SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule) return NULL;
}
-BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule)
+BOOL SM_SetOffline(const TCHAR *pszID, const char* pszModule)
{
if (!pszModule)
return FALSE;
@@ -197,7 +197,7 @@ BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule) return TRUE;
}
-BOOL SM_SetStatusEx(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText, int flags)
+BOOL SM_SetStatusEx(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText, int flags)
{
if (!pszModule)
return FALSE;
@@ -284,7 +284,7 @@ BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce, BOOL bIsHighLight) return 0;
}
-BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted)
+BOOL SM_AddEvent(const TCHAR *pszID, const char* pszModule, GCEVENT *gce, BOOL bIsHighlighted)
{
if (!pszID || !pszModule)
return TRUE;
@@ -317,7 +317,7 @@ BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT *gce, BOOL b return TRUE;
}
-USERINFO* SM_AddUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus)
+USERINFO* SM_AddUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus)
{
if (!pszID || !pszModule)
return NULL;
@@ -332,7 +332,7 @@ USERINFO* SM_AddUser(const TCHAR* pszID, const char* pszModule, const TCHAR* psz return 0;
}
-BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID)
+BOOL SM_MoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID)
{
if (!pszID || !pszModule || !pszUID)
return FALSE;
@@ -345,7 +345,7 @@ BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID) return TRUE;
}
-BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID)
+BOOL SM_RemoveUser(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID)
{
if (!pszModule || !pszUID)
return FALSE;
@@ -370,7 +370,7 @@ BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return 0;
}
-USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index)
+USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char* pszModule, int index)
{
if (!pszModule)
return NULL;
@@ -382,7 +382,7 @@ USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int ind return UM_FindUserFromIndex(si->pUsers, index);
}
-STATUSINFO* SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszStatus)
+STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszStatus)
{
if (!pszID || !pszModule)
return NULL;
@@ -397,7 +397,7 @@ STATUSINFO* SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* return ti;
}
-BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
+BOOL SM_GiveStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
{
if (!pszID || !pszModule)
return FALSE;
@@ -415,7 +415,7 @@ BOOL SM_GiveStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return TRUE;
}
-BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, WORD wStatus)
+BOOL SM_SetContactStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, WORD wStatus)
{
if (!pszID || !pszModule)
return FALSE;
@@ -433,7 +433,7 @@ BOOL SM_SetContactStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* return TRUE;
}
-BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
+BOOL SM_TakeStatus(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszStatus)
{
if (!pszID || !pszModule)
return FALSE;
@@ -451,7 +451,7 @@ BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUI return TRUE;
}
-LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT SM_SendMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
for (SESSION_INFO *si = s_WndList; si && pszModule; si = si->next) {
if ((!pszID || !lstrcmpi(si->ptszID, pszID)) && !lstrcmpiA(si->pszModule, pszModule)) {
@@ -468,7 +468,7 @@ LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPAR return 0;
}
-BOOL SM_PostMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+BOOL SM_PostMessage(const TCHAR *pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (!pszID || !pszModule)
return 0;
@@ -514,7 +514,7 @@ BOOL SM_InvalidateLogDirectories() return TRUE;
}
-BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus)
+BOOL SM_SetStatus(const TCHAR *pszID, const char* pszModule, int wStatus)
{
if (!pszModule)
return FALSE;
@@ -538,7 +538,7 @@ BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus) return TRUE;
}
-BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText)
+BOOL SM_SendUserMessage(const TCHAR *pszID, const char* pszModule, const TCHAR* pszText)
{
if (!pszModule || !pszText)
return FALSE;
@@ -555,7 +555,7 @@ BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* return TRUE;
}
-BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID)
+BOOL SM_ChangeUID(const TCHAR *pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID)
{
if (!pszModule)
return FALSE;
@@ -574,7 +574,7 @@ BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID return TRUE;
}
-BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT *gce)
+BOOL SM_ChangeNick(const TCHAR *pszID, const char* pszModule, GCEVENT *gce)
{
if (!pszModule)
return FALSE;
@@ -640,7 +640,7 @@ BOOL SM_RemoveAll(void) return TRUE;
}
-void SM_AddCommand(const TCHAR* pszID, const char* pszModule, const char* lpNewCommand)
+void SM_AddCommand(const TCHAR *pszID, const char* pszModule, const char* lpNewCommand)
{
for (SESSION_INFO *si = s_WndList; si; si = si->next) {
if (lstrcmpi(si->ptszID, pszID) == 0 && lstrcmpiA(si->pszModule, pszModule) == 0) { // match
@@ -677,7 +677,7 @@ void SM_AddCommand(const TCHAR* pszID, const char* pszModule, const char* lpNewC }
}
-char* SM_GetPrevCommand(const TCHAR* pszID, const char* pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
+char* SM_GetPrevCommand(const TCHAR *pszID, const char* pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -696,7 +696,7 @@ char* SM_GetPrevCommand(const TCHAR* pszID, const char* pszModule) // get previo return pPrevCmd ? pPrevCmd->lpCommand : NULL;
}
-char* SM_GetNextCommand(const TCHAR* pszID, const char* pszModule) // get next command. returns NULL if next command does not exist. current command becomes NULL (a prev command after this one will get you the last command)
+char* SM_GetNextCommand(const TCHAR *pszID, const char* pszModule) // get next command. returns NULL if next command does not exist. current command becomes NULL (a prev command after this one will get you the last command)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 7eba873a60..41c9c9d5be 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -85,101 +85,76 @@ int Chat_IconsChanged(WPARAM wParam, LPARAM lParam) INT_PTR Service_GetCount(WPARAM wParam, LPARAM lParam)
{
- int i;
-
if (!lParam)
return -1;
- EnterCriticalSection(&cs);
-
- i = SM_GetCount((char *)lParam);
-
- LeaveCriticalSection(&cs);
- return i;
+ mir_cslock lck(cs);
+ return SM_GetCount((char *)lParam);
}
INT_PTR Service_GetInfo(WPARAM wParam, LPARAM lParam)
{
- GC_INFO * gci = (GC_INFO *) lParam;
- SESSION_INFO *si = NULL;
-
+ GC_INFO *gci = (GC_INFO *) lParam;
if (!gci || !gci->pszModule)
return 1;
- EnterCriticalSection(&cs);
-
- if (gci->Flags&BYINDEX)
+ mir_cslock lck(cs);
+ SESSION_INFO *si;
+ if (gci->Flags & BYINDEX)
si = SM_FindSessionByIndex(gci->pszModule, gci->iItem);
else
si = SM_FindSession(gci->pszID, gci->pszModule);
+ if (si == NULL)
+ return 1;
- if (si) {
- if (gci->Flags & DATA) gci->dwItemData = si->dwItemData;
- if (gci->Flags & HCONTACT) gci->hContact = si->hContact;
- 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 (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;
- }
- LeaveCriticalSection(&cs);
- return 0;
- }
+ if (gci->Flags & DATA) gci->dwItemData = si->dwItemData;
+ if (gci->Flags & HCONTACT) gci->hContact = si->hContact;
+ 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);
- LeaveCriticalSection(&cs);
- return 1;
+ if (gci->Flags & ID) gci->pszID = si->ptszID;
+ if (gci->Flags & NAME) gci->pszName = si->ptszName;
+ return 0;
}
INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
{
GCREGISTER *gcr = (GCREGISTER *)lParam;
- MODULEINFO * mi = NULL;
if (gcr == NULL)
return GC_REGISTER_ERROR;
if (gcr->cbSize != sizeof(GCREGISTER))
return GC_REGISTER_WRONGVER;
- EnterCriticalSection(&cs);
-
- mi = MM_AddModule(gcr->pszModule);
- if (mi) {
- mi->ptszModDispName = a2tf( gcr->ptszModuleDispName, gcr->dwFlags);
- mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
- mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
- mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
- mi->bColor = (gcr->dwFlags & GC_COLOR) != 0;
- mi->bBkgColor = (gcr->dwFlags & GC_BKGCOLOR) != 0;
- mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
- mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0 ;
- mi->iMaxText = gcr->iMaxText;
- mi->nColorCount = gcr->nColors;
- if (gcr->nColors > 0) {
- mi->crColors = (COLORREF *)mir_alloc(sizeof(COLORREF) * gcr->nColors);
- memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF) * gcr->nColors);
- }
- mi->pszHeader = 0;
-
- CheckColorsInModule((char*)gcr->pszModule);
- CList_SetAllOffline(TRUE, gcr->pszModule);
+ mir_cslock lck(cs);
+ MODULEINFO *mi = MM_AddModule(gcr->pszModule);
+ if (mi == NULL)
+ return GC_REGISTER_ERROR;
- LeaveCriticalSection(&cs);
- return 0;
+ mi->ptszModDispName = mir_tstrdup(gcr->ptszDispName);
+ mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
+ mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
+ mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
+ mi->bColor = (gcr->dwFlags & GC_COLOR) != 0;
+ mi->bBkgColor = (gcr->dwFlags & GC_BKGCOLOR) != 0;
+ mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
+ mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0;
+ mi->iMaxText = gcr->iMaxText;
+ mi->nColorCount = gcr->nColors;
+ if (gcr->nColors > 0) {
+ mi->crColors = (COLORREF *)mir_alloc(sizeof(COLORREF)* gcr->nColors);
+ memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF)* gcr->nColors);
}
+ mi->pszHeader = 0;
- LeaveCriticalSection(&cs);
- return GC_REGISTER_ERROR;
+ CheckColorsInModule((char*)gcr->pszModule);
+ CList_SetAllOffline(TRUE, gcr->pszModule);
+ return 0;
}
INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
{
- MODULEINFO *mi;
GCSESSION *gcw = (GCSESSION *)lParam;
if (gcw == NULL)
return GC_NEWSESSION_ERROR;
@@ -187,77 +162,66 @@ INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) if (gcw->cbSize != sizeof(GCSESSION))
return GC_NEWSESSION_WRONGVER;
- EnterCriticalSection(&cs);
-
- if ((mi = MM_FindModule(gcw->pszModule)) != NULL) {
- TCHAR* ptszID = a2tf(gcw->ptszID, gcw->dwFlags);
- SESSION_INFO *si = SM_AddSession(ptszID, gcw->pszModule);
-
- // create a new session and set the defaults
- if (si != NULL) {
- TCHAR szTemp[256];
-
- si->dwItemData = gcw->dwItemData;
- if (gcw->iType != GCW_SERVER)
- si->wStatus = ID_STATUS_ONLINE;
- si->iType = gcw->iType;
- si->dwFlags = gcw->dwFlags;
- si->ptszName = a2tf(gcw->ptszName, gcw->dwFlags);
- si->ptszStatusbarText = a2tf(gcw->ptszStatusbarText, gcw->dwFlags);
- si->iSplitterX = g_Settings.iSplitterX;
- si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)) != 0;
- si->bNicklistEnabled = M.GetByte("Chat", "ShowNicklist", 1) != 0;
- 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;
- }
- if (mi->bBkgColor) {
- si->iBG = 2;
- si->bBGSet = TRUE;
- }
- if (si->iType == GCW_SERVER)
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("Server: %s"), si->ptszName);
- else
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
- si->hContact = CList_AddRoom(gcw->pszModule, ptszID, szTemp, si->iType);
- db_set_s(si->hContact, si->pszModule , "Topic", "");
- db_unset(si->hContact, "CList", "StatusMsg");
- if (si->ptszStatusbarText)
- db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
- else
- db_set_s(si->hContact, si->pszModule, "StatusBar", "");
- if (si->hContact)
- Chat_SetFilters(si);
+ mir_cslock lck(cs);
+ MODULEINFO *mi = MM_FindModule(gcw->pszModule);
+ if (mi == NULL)
+ return GC_NEWSESSION_ERROR;
+
+ // create a new session and set the defaults
+ SESSION_INFO *si = SM_AddSession(gcw->ptszID, gcw->pszModule);
+ if (si != NULL) {
+ TCHAR szTemp[256];
+
+ si->dwItemData = gcw->dwItemData;
+ if (gcw->iType != GCW_SERVER)
+ si->wStatus = ID_STATUS_ONLINE;
+ si->iType = gcw->iType;
+ si->dwFlags = gcw->dwFlags;
+ si->ptszName = mir_tstrdup(gcw->ptszName);
+ si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
+ si->iSplitterX = g_Settings.iSplitterX;
+ si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)) != 0;
+ si->bNicklistEnabled = M.GetByte("Chat", "ShowNicklist", 1) != 0;
+
+ if (mi->bColor) {
+ si->iFG = 4;
+ si->bFGSet = TRUE;
}
- else {
- SESSION_INFO* si2 = SM_FindSession(ptszID, gcw->pszModule);
- if (si2) {
-
- UM_RemoveAll(&si2->pUsers);
- TM_RemoveAll(&si2->pStatuses);
-
- si2->iStatusCount = 0;
- si2->nUsersInNicklist = 0;
-
- if (si2->hContact)
- Chat_SetFilters(si2);
- if (si2->hWnd)
- RedrawWindow(GetDlgItem(si2->hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
- }
+ if (mi->bBkgColor) {
+ si->iBG = 2;
+ si->bBGSet = TRUE;
+ }
+ if (si->iType == GCW_SERVER)
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("Server: %s"), si->ptszName);
+ else
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
+ si->hContact = CList_AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
+ db_set_s(si->hContact, si->pszModule , "Topic", "");
+ db_unset(si->hContact, "CList", "StatusMsg");
+ if (si->ptszStatusbarText)
+ db_set_ts(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
+ else
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
+ if (si->hContact)
+ Chat_SetFilters(si);
+ }
+ else {
+ SESSION_INFO* si2 = SM_FindSession(gcw->ptszID, gcw->pszModule);
+ if (si2) {
+ UM_RemoveAll(&si2->pUsers);
+ TM_RemoveAll(&si2->pStatuses);
+
+ si2->iStatusCount = 0;
+ si2->nUsersInNicklist = 0;
+
+ if (si2->hContact)
+ Chat_SetFilters(si2);
+ if (si2->hWnd)
+ RedrawWindow(GetDlgItem(si2->hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
}
-
- LeaveCriticalSection(&cs);
- mir_free(ptszID);
- return 0;
}
- LeaveCriticalSection(&cs);
- return GC_NEWSESSION_ERROR;
+ return 0;
}
static int DoControl(GCEVENT *gce, WPARAM wp)
@@ -314,12 +278,12 @@ static int DoControl(GCEVENT *gce, WPARAM wp) break;
case GC_EVENT_CHUID:
- if (gce->pszText)
+ if (gce->ptszText)
SM_ChangeUID(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_CHANGESESSIONAME:
- if (gce->pszText) {
+ if (gce->ptszText) {
si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
replaceStrT(si->ptszName, gce->ptszText);
@@ -361,7 +325,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) break;
case GC_EVENT_SENDMESSAGE:
- if (gce->pszText)
+ if (gce->ptszText)
SM_SendUserMessage(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText);
break;
@@ -576,29 +540,12 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
- int iRetVal = GC_EVENT_ERROR;
LPCSTR pMod = NULL;
LPCTSTR pWnd = NULL;
- GCDEST save_gcd;
- GCEVENT save_gce;
SESSION_INFO *si = NULL;
- bool bIsHighlighted = false, bRemoveFlag = false, bFreeText = false;
-
- if (!(gce->dwFlags & GC_UNICODE)) {
- save_gce = *gce;
- save_gcd = *gce->pDest;
- gce->ptszUID = a2tf(gce->ptszUID, gce->dwFlags);
- gce->ptszNick = a2tf(gce->ptszNick, gce->dwFlags);
- gce->ptszStatus = a2tf(gce->ptszStatus, gce->dwFlags);
- gce->pDest->ptszID = a2tf(gce->pDest->ptszID, gce->dwFlags);
- if (gcd->iType != GC_EVENT_MESSAGE && gcd->iType != GC_EVENT_ACTION) {
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
- bFreeText = true;
- }
- gce->ptszUserInfo = a2tf(gce->ptszUserInfo, gce->dwFlags);
- }
+ bool bIsHighlighted = false, bRemoveFlag = false;
- EnterCriticalSection(&cs);
+ mir_cslock lck(cs);
// Do different things according to type of event
switch (gcd->iType) {
@@ -608,8 +555,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (si && gce->dwItemData)
si->hIcon = CopyIcon((HICON)gce->dwItemData);
}
- iRetVal = 0;
- goto LBL_Exit;
+ return 0;
case GC_EVENT_CHUID:
case GC_EVENT_CHANGESESSIONAME:
@@ -620,17 +566,15 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_ACK:
case GC_EVENT_SENDMESSAGE :
case GC_EVENT_SETSTATUSEX :
- iRetVal = DoControl(gce, wParam);
- goto LBL_Exit;
+ return DoControl(gce, wParam);
case GC_EVENT_SETCONTACTSTATUS:
- iRetVal = SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
- goto LBL_Exit;
+ return SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
case GC_EVENT_TOPIC:
si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
- if (gce->pszText) {
+ if (gce->ptszText) {
replaceStrT(si->ptszTopic, RemoveFormatting(gce->ptszText));
db_set_ts(si->hContact, si->pszModule , "Topic", /*RemoveFormatting*/(si->ptszTopic));
if (M.GetByte("Chat", "TopicOnClist", 1))
@@ -656,14 +600,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (!(gce->dwFlags & GC_UNICODE)) {
- bFreeText = TRUE;
- if (si)
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags, M.GetDword(si->hContact, "ANSIcodepage", 0));
- else
- gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
- }
- if (!gce->bIsMe && gce->pDest->ptszID && gce->pszText && si)
+ if (!gce->bIsMe && gce->pDest->ptszID && gce->ptszText && si)
bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME) != 0;
break;
@@ -699,18 +636,13 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) pWnd = si->ptszID;
pMod = si->pszModule;
}
- else {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ else return 0;
}
else {
// Send the event to all windows with a user pszUID. Used for broadcasting QUIT etc
SM_AddEventToAllMatchingUID(gce, bIsHighlighted);
- if (!bRemoveFlag) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (!bRemoveFlag)
+ return 0;
}
// add to log
@@ -719,63 +651,40 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) si = SM_FindSession(pWnd, pMod);
// fix for IRC's old stuyle mode notifications. Should not affect any other protocol
- if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG)) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
+ return 0;
- if (gce && gce->pDest->iType == GC_EVENT_JOIN && gce->time == 0) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (gce && gce->pDest->iType == GC_EVENT_JOIN && gce->time == 0)
+ return 0;
if (si && (si->bInitDone || gce->pDest->iType == GC_EVENT_TOPIC || (gce->pDest->iType == GC_EVENT_JOIN && gce->bIsMe))) {
- if (SM_AddEvent(pWnd, pMod, gce, bIsHighlighted) && si->hWnd) {
+ if (SM_AddEvent(pWnd, pMod, gce, bIsHighlighted) && si->hWnd)
SendMessage(si->hWnd, GC_ADDLOG, 0, 0);
- }
- else if (si->hWnd) {
+ else if (si->hWnd)
SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
- }
+
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings.bLoggingEnabled)
LogToFile(si, gce);
}
- if (!bRemoveFlag) {
- iRetVal = 0;
- goto LBL_Exit;
- }
+ if (!bRemoveFlag)
+ return 0;
}
if (bRemoveFlag)
- iRetVal = (SM_RemoveUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID) == 0) ? 1 : 0;
-
-LBL_Exit:
- LeaveCriticalSection(&cs);
-
- if (!(gce->dwFlags & GC_UNICODE)) {
- if (bFreeText)
- 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;
+ return (SM_RemoveUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID) == 0) ? 1 : 0;
+
+ return GC_EVENT_ERROR;
}
static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam)
{
GCPTRS * gp = (GCPTRS *) lParam;
- EnterCriticalSection(&cs);
-
+ mir_cslock lck(cs);
gp->pfnAddEvent = Service_AddEvent;
- LeaveCriticalSection(&cs);
return 0;
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index bc1e8bd2d1..b22c898352 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -262,11 +262,11 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_NICK:
CList_AddEvent(si->hContact, hIcons[ICON_NICK], szChatIconString, CLEF_ONLYAFEW,
- TranslateT("%s is now known as %s"), gce->ptszNick, gce->pszText);
+ TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
CList_AddEvent(si->hContact, hIcons[ICON_KICK], szChatIconString, CLEF_ONLYAFEW,
- TranslateT("%s kicked %s from %s"), gce->pszStatus, gce->ptszNick, si->ptszName);
+ TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_NOTICE:
CList_AddEvent(si->hContact, hIcons[ICON_NOTICE], szChatIconString, CLEF_ONLYAFEW,
@@ -282,11 +282,11 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_ADDSTATUS:
CList_AddEvent(si->hContact, hIcons[ICON_ADDSTATUS], szChatIconString, CLEF_ONLYAFEW,
- TranslateT("%s enables \'%s\' status for %s in %s"), gce->pszText, gce->pszStatus, gce->ptszNick, si->ptszName);
+ TranslateT("%s enables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_REMOVESTATUS:
CList_AddEvent(si->hContact, hIcons[ICON_REMSTATUS], szChatIconString, CLEF_ONLYAFEW,
- TranslateT("%s disables \'%s\' status for %s in %s"), gce->pszText, gce->pszStatus, gce->ptszNick, si->ptszName);
+ TranslateT("%s disables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
}
}
@@ -368,7 +368,7 @@ passed: TranslateT("%s has joined"), gce->ptszNick);
break;
case GC_EVENT_PART:
- if (!gce->pszText)
+ if (!gce->ptszText)
ShowPopup(si->hContact, si, hIcons[ICON_PART], si->pszModule, si->ptszName, clr ? clr : aFonts[4].color,
TranslateT("%s has left"), gce->ptszNick);
else
@@ -376,7 +376,7 @@ passed: TranslateT("%s has left (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
- if (!gce->pszText)
+ if (!gce->ptszText)
ShowPopup(si->hContact, si, hIcons[ICON_QUIT], si->pszModule, si->ptszName, clr ? clr : aFonts[5].color,
TranslateT("%s has disconnected"), gce->ptszNick);
else
@@ -388,12 +388,12 @@ passed: TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
- if (!gce->pszText)
+ if (!gce->ptszText)
ShowPopup(si->hContact, si, hIcons[ICON_KICK], si->pszModule, si->ptszName, clr ? clr : aFonts[6].color,
- TranslateT("%s kicked %s"), (char *)gce->pszStatus, gce->ptszNick);
+ TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
ShowPopup(si->hContact, si, hIcons[ICON_KICK], si->pszModule, si->ptszName, clr ? clr : aFonts[6].color,
- TranslateT("%s kicked %s (%s)"), (char *)gce->pszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
+ TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
ShowPopup(si->hContact, si, hIcons[ICON_NOTICE], si->pszModule, si->ptszName, clr ? clr : aFonts[8].color,
@@ -412,11 +412,11 @@ passed: break;
case GC_EVENT_ADDSTATUS:
ShowPopup(si->hContact, si, hIcons[ICON_ADDSTATUS], si->pszModule, si->ptszName, clr ? clr : aFonts[13].color,
- TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, (char *)gce->pszStatus, gce->ptszNick);
+ TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
ShowPopup(si->hContact, si, hIcons[ICON_REMSTATUS], si->pszModule, si->ptszName, clr ? clr : aFonts[14].color,
- TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, (char *)gce->pszStatus, gce->ptszNick);
+ TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
}
@@ -782,8 +782,8 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) }
else lstrcpyn(szTemp2, gce->ptszNick, 511);
- if (gce->pszUserInfo)
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, gce->pszUserInfo);
+ if (gce->ptszUserInfo)
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, gce->ptszUserInfo);
else
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), szTemp2);
pszNick = szTemp;
@@ -802,21 +802,21 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_JOIN:
p = '>';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has joined"), (char *)pszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has joined"), pszNick);
break;
case GC_EVENT_PART:
p = '<';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left"), (char *)pszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left"), pszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left (%s)"), (char *)pszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left (%s)"), pszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_QUIT:
p = '<';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected"), (char *)pszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected"), pszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), (char *)pszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), pszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
p = '^';
@@ -824,10 +824,10 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_KICK:
p = '~';
- if (!gce->pszText)
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s"), (char *)gce->pszStatus, gce->ptszNick);
+ if (!gce->ptszText)
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s"), gce->ptszStatus, gce->ptszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s (%s)"), (char *)gce->pszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s kicked %s (%s)"), gce->ptszStatus, gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NOTICE:
p = 'o';
@@ -835,7 +835,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_TOPIC:
p = '#';
- if (!gce->pszNick)
+ if (!gce->ptszNick)
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The topic is \'%s\'"), RemoveFormatting(gce->ptszText));
else
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("The topic is \'%s\' (set by %s)"), RemoveFormatting(gce->ptszText), gce->ptszNick);
@@ -846,11 +846,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) break;
case GC_EVENT_ADDSTATUS:
p = '+';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, (char *)gce->pszStatus, gce->ptszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s enables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
case GC_EVENT_REMOVESTATUS:
p = '-';
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, (char *)gce->pszStatus, gce->ptszNick);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s disables \'%s\' status for %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick);
break;
}
@@ -962,8 +962,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
for (int i=0; i < gcmi.nItems; i++) {
- TCHAR *ptszDescr = a2tf(gcmi.Item[i].pszDesc, si->dwFlags);
- TCHAR *ptszText = TranslateTS(ptszDescr);
+ TCHAR *ptszText = TranslateTS(gcmi.Item[i].pszDesc);
DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0;
if (gcmi.Item[i].uType == MENU_NEWPOPUP) {
@@ -986,8 +985,6 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO AppendMenu(*hMenu, dwState | MF_STRING, gcmi.Item[i].dwID, ptszText);
else if (gcmi.Item[i].uType == MENU_CHECK)
AppendMenu(*hMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText);
-
- mir_free(ptszDescr);
}
#if !defined(__DELAYED_FOR_3_1)
@@ -998,19 +995,6 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO InsertMenu(*hMenu, pos, MF_BYPOSITION, (UINT_PTR)20021, TranslateT("Edit Highlight List..."));
}
#endif
- if (iIndex == 1 && si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
- AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
- InsertMenu(PluginConfig.g_hMenuEncoding, 1, MF_BYPOSITION | MF_STRING, (UINT_PTR)CP_UTF8, TranslateT("UTF-8"));
- int pos = GetMenuItemCount(*hMenu);
- InsertMenu(*hMenu, pos, MF_BYPOSITION | MF_POPUP, (UINT_PTR) PluginConfig.g_hMenuEncoding, TranslateT("Character Encoding"));
- for (int i=0; i < GetMenuItemCount(PluginConfig.g_hMenuEncoding); i++)
- CheckMenuItem(PluginConfig.g_hMenuEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
- if (codepage == CP_ACP)
- CheckMenuItem(PluginConfig.g_hMenuEncoding, 0, MF_BYPOSITION | MF_CHECKED);
- else
- CheckMenuItem(PluginConfig.g_hMenuEncoding, codepage, MF_BYCOMMAND | MF_CHECKED);
-
- }
return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
}
@@ -1026,7 +1010,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)
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -1035,18 +1019,9 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
replaceStr(gcd->pszModule, pszModule);
-
- if (!(si->dwFlags & GC_UNICODE)) {
- DWORD dwCP = M.GetDword(si->hContact, "ANSIcodepage", 0);
- gcd->ptszID = (LPTSTR)mir_t2a(pszID);
- gch->pszUID = mir_t2a(pszUID);
- gch->pszText = mir_t2a_cp(pszText, dwCP);
- }
- else {
- replaceStrT(gcd->ptszID, pszID);
- replaceStrT(gch->ptszUID, pszUID);
- replaceStrT(gch->ptszText, pszText);
- }
+ replaceStrT(gcd->ptszID, pszID);
+ replaceStrT(gch->ptszUID, pszUID);
+ replaceStrT(gch->ptszText, pszText);
gcd->iType = iType;
gch->dwData = dwItem;
gch->pDest = gcd;
@@ -1054,35 +1029,19 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int return TRUE;
}
-BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHook(const TCHAR *pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
return FALSE;
GCHOOK gch = {0};
- GCDEST gcd = {0};
- gcd.pszModule = (char*)pszModule;
-
- if (!(si->dwFlags & GC_UNICODE)) {
- DWORD dwCP = M.GetDword(si->hContact, "ANSIcodepage", 0);
- gcd.ptszID = (LPTSTR)mir_t2a(pszID);
- gch.pszUID = mir_t2a(pszUID);
- gch.pszText = mir_t2a_cp(pszText, dwCP);
- }
- else {
- gcd.ptszID = mir_tstrdup(pszID);
- gch.ptszUID = mir_tstrdup(pszUID);
- gch.ptszText = mir_tstrdup(pszText);
- }
- gcd.iType = iType;
+ GCDEST gcd = { (char*)pszModule, (LPTSTR)pszID, iType };
+ gch.ptszUID = (LPTSTR)pszUID;
+ gch.ptszText = (LPTSTR)pszText;
gch.dwData = dwItem;
gch.pDest = &gcd;
NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
-
- mir_free(gcd.ptszID);
- mir_free(gch.ptszUID);
- mir_free(gch.ptszText);
return TRUE;
}
@@ -1120,29 +1079,6 @@ BOOL IsEventSupported(int eventType) return FALSE;
}
-TCHAR* a2tf(const TCHAR* str, int flags, DWORD cp)
-{
- if (str == NULL)
- return NULL;
-
- if (flags & GC_UNICODE)
- return mir_tstrdup(str);
-
- if (cp == CP_UTF8)
- return mir_utf8decodeW((char*)str);
-
- if (cp == 0)
- cp = PluginConfig.m_LangPackCP;
- int cbLen = MultiByteToWideChar(cp, 0, (char*)str, -1, 0, 0);
- TCHAR *result = (TCHAR*)mir_alloc(sizeof(TCHAR) * (cbLen + 1));
- if (result == NULL)
- return NULL;
-
- MultiByteToWideChar(cp, 0, (char*)str, -1, result, cbLen);
- result[cbLen] = 0;
- return result;
-}
-
/*
* set all filters and notification config for a session
* uses per channel mask + filterbits, default config as backup
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 5cd0acf84e..61b1dcd604 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2722,11 +2722,6 @@ LABEL_SHOWWINDOW: break;
}
- if (si->iType != GCW_SERVER && !(si->dwFlags & GC_UNICODE)) {
- int pos = GetMenuItemCount(hMenu);
- RemoveMenu(hMenu, pos - 1, MF_BYPOSITION);
- RemoveMenu(PluginConfig.g_hMenuEncoding, 1, MF_BYPOSITION);
- }
DestroyGCMenu(&hMenu, 5);
}
}
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index e5a08ced1d..120a827b17 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -599,7 +599,7 @@ begin gce.pDest :=@gcd;
gce.bIsMe :=true;
gce.szText.w:=pszText;
- gce.dwFlags :=GCEF_ADDTOLOG+GC_UNICODE;
+ gce.dwFlags :=GCEF_ADDTOLOG;
gce.time :=GetCurrentTime;
CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
|