summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_core.libbin305910 -> 306136 bytes
-rw-r--r--bin10/lib/mir_core64.libbin306758 -> 306964 bytes
-rw-r--r--bin12/lib/mir_core.libbin305910 -> 306136 bytes
-rw-r--r--bin12/lib/mir_core64.libbin306758 -> 306964 bytes
-rw-r--r--bin14/lib/mir_core.libbin305910 -> 306136 bytes
-rw-r--r--bin14/lib/mir_core64.libbin306758 -> 306964 bytes
-rw-r--r--include/m_chat_int.h47
-rw-r--r--include/m_core.h1
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp2
-rw-r--r--src/mir_app/src/chat_clist.cpp2
-rw-r--r--src/mir_app/src/chat_manager.cpp30
-rw-r--r--src/mir_app/src/chat_svc.cpp50
-rw-r--r--src/mir_app/src/clcfiledrop.cpp2
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/modules.cpp31
16 files changed, 107 insertions, 60 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 51d64a242a..dfef9ea249 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index d1038987e6..faa30a740e 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 51d64a242a..dfef9ea249 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index d1038987e6..faa30a740e 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/bin14/lib/mir_core.lib b/bin14/lib/mir_core.lib
index 51d64a242a..dfef9ea249 100644
--- a/bin14/lib/mir_core.lib
+++ b/bin14/lib/mir_core.lib
Binary files differ
diff --git a/bin14/lib/mir_core64.lib b/bin14/lib/mir_core64.lib
index d1038987e6..faa30a740e 100644
--- a/bin14/lib/mir_core64.lib
+++ b/bin14/lib/mir_core64.lib
Binary files differ
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 0bae166750..afeb345a81 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -318,7 +318,6 @@ struct CHAT_MANAGER
BOOL (*SM_SetStatusEx)(const wchar_t *pszID, const char *pszModule, const wchar_t* pszText, int flags);
BOOL (*SM_SendUserMessage)(const wchar_t *pszID, const char *pszModule, const wchar_t* pszText);
STATUSINFO* (*SM_AddStatus)(const wchar_t *pszID, const char *pszModule, const wchar_t *pszStatus);
- BOOL (*SM_AddEventToAllMatchingUID)(GCEVENT *gce);
BOOL (*SM_AddEvent)(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, BOOL bIsHighlighted);
LRESULT (*SM_SendMessage)(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL (*SM_PostMessage)(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -344,28 +343,28 @@ struct CHAT_MANAGER
void (*MM_IconsChanged)(void);
BOOL (*MM_RemoveAll)(void);
- STATUSINFO* (*TM_AddStatus)(STATUSINFO** ppStatusList, const wchar_t *pszStatus, int* iCount);
- STATUSINFO* (*TM_FindStatus)(STATUSINFO* pStatusList, const wchar_t *pszStatus);
- WORD (*TM_StringToWord)(STATUSINFO* pStatusList, const wchar_t *pszStatus);
- wchar_t* (*TM_WordToString)(STATUSINFO* pStatusList, WORD Status);
+ STATUSINFO* (*TM_AddStatus)(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int* iCount);
+ STATUSINFO* (*TM_FindStatus)(STATUSINFO *pStatusList, const wchar_t *pszStatus);
+ WORD (*TM_StringToWord)(STATUSINFO *pStatusList, const wchar_t *pszStatus);
+ wchar_t* (*TM_WordToString)(STATUSINFO *pStatusList, WORD Status);
BOOL (*TM_RemoveAll)(STATUSINFO** pStatusList);
- BOOL (*UM_SetStatusEx)(USERINFO* pUserList, const wchar_t* pszText, int onlyMe);
- USERINFO* (*UM_AddUser)(STATUSINFO* pStatusList, USERINFO** pUserList, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus);
- USERINFO* (*UM_SortUser)(USERINFO** ppUserList, const wchar_t *pszUID);
- USERINFO* (*UM_FindUser)(USERINFO* pUserList, const wchar_t *pszUID);
- USERINFO* (*UM_FindUserFromIndex)(USERINFO* pUserList, int index);
- USERINFO* (*UM_GiveStatus)(USERINFO* pUserList, const wchar_t *pszUID, WORD status);
- USERINFO* (*UM_SetContactStatus)(USERINFO* pUserList, const wchar_t *pszUID, WORD status);
- USERINFO* (*UM_TakeStatus)(USERINFO* pUserList, const wchar_t *pszUID, WORD status);
- wchar_t* (*UM_FindUserAutoComplete)(USERINFO* pUserList, const wchar_t* pszOriginal, const wchar_t* pszCurrent);
- BOOL (*UM_RemoveUser)(USERINFO** pUserList, const wchar_t *pszUID);
- BOOL (*UM_RemoveAll)(USERINFO** ppUserList);
- int (*UM_CompareItem)(USERINFO * u1, const wchar_t *pszNick, WORD wStatus);
-
- LOGINFO* (*LM_AddEvent)(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd);
- BOOL (*LM_TrimLog)(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd, int iCount);
- BOOL (*LM_RemoveAll)(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd);
+ BOOL (*UM_SetStatusEx)(USERINFO *pUserList, const wchar_t* pszText, int onlyMe);
+ USERINFO* (*UM_AddUser)(STATUSINFO *pStatusList, USERINFO **pUserList, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus);
+ USERINFO* (*UM_SortUser)(USERINFO **ppUserList, const wchar_t *pszUID);
+ USERINFO* (*UM_FindUser)(USERINFO *pUserList, const wchar_t *pszUID);
+ USERINFO* (*UM_FindUserFromIndex)(USERINFO *pUserList, int index);
+ USERINFO* (*UM_GiveStatus)(USERINFO *pUserList, const wchar_t *pszUID, WORD status);
+ USERINFO* (*UM_SetContactStatus)(USERINFO *pUserList, const wchar_t *pszUID, WORD status);
+ USERINFO* (*UM_TakeStatus)(USERINFO *pUserList, const wchar_t *pszUID, WORD status);
+ wchar_t* (*UM_FindUserAutoComplete)(USERINFO *pUserList, const wchar_t* pszOriginal, const wchar_t* pszCurrent);
+ BOOL (*UM_RemoveUser)(USERINFO **pUserList, const wchar_t *pszUID);
+ BOOL (*UM_RemoveAll)(USERINFO **ppUserList);
+ int (*UM_CompareItem)(USERINFO *u1, const wchar_t *pszNick, WORD wStatus);
+
+ LOGINFO* (*LM_AddEvent)(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd);
+ BOOL (*LM_TrimLog)(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd, int iCount);
+ BOOL (*LM_RemoveAll)(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd);
MCONTACT (*AddRoom)(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType);
BOOL (*SetOffline)(MCONTACT hContact, BOOL bHide);
@@ -376,7 +375,7 @@ struct CHAT_MANAGER
char* (*Log_CreateRTF)(LOGSTREAMDATA *streamData);
char* (*Log_CreateRtfHeader)(MODULEINFO *mi);
void (*LoadMsgDlgFont)(int i, LOGFONT *lf, COLORREF *color);
- wchar_t* (*MakeTimeStamp)(wchar_t *pszStamp, time_t time);
+ wchar_t* (*MakeTimeStamp)(wchar_t *pszStamp, time_t time);
BOOL (*DoEventHook)(const wchar_t *pszID, const char *pszModule, int iType, const wchar_t *pszUID, const wchar_t* pszText, INT_PTR dwItem);
BOOL (*DoEventHookAsync)(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const wchar_t* pszUID, const wchar_t* pszText, INT_PTR dwItem);
@@ -386,12 +385,12 @@ struct CHAT_MANAGER
BOOL (*DoPopup)(SESSION_INFO *si, GCEVENT *gce);
int (*ShowPopup)(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, wchar_t* pszRoomName, COLORREF crBkg, const wchar_t* fmt, ...);
BOOL (*LogToFile)(SESSION_INFO *si, GCEVENT *gce);
- wchar_t* (*GetChatLogsFilename)(SESSION_INFO *si, time_t tTime);
+ wchar_t* (*GetChatLogsFilename)(SESSION_INFO *si, time_t tTime);
int (*GetColorIndex)(const char *pszModule, COLORREF cr);
char* (*Log_SetStyle)(int style);
BOOL (*IsHighlighted)(SESSION_INFO *si, GCEVENT *pszText);
- wchar_t* (*RemoveFormatting)(const wchar_t *pszText);
+ wchar_t* (*RemoveFormatting)(const wchar_t *pszText);
void (*ReloadSettings)(void);
void (*ColorChooser)(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser);
diff --git a/include/m_core.h b/include/m_core.h
index 5557623e5a..6b40065b2f 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -118,6 +118,7 @@ MIR_CORE_DLL(int) ServiceExists(const char *name);
MIR_CORE_DLL(INT_PTR) CallService(const char *name, WPARAM wParam = 0, LPARAM lParam = 0);
MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam = 0, LPARAM lParam = 0);
+MIR_CORE_DLL(INT_PTR) CallFunctionSync(INT_PTR(__stdcall *func)(void *), void *arg);
MIR_CORE_DLL(int) CallFunctionAsync(void (__stdcall *func)(void *), void *arg);
MIR_CORE_DLL(void) KillModuleServices(HINSTANCE hInst);
MIR_CORE_DLL(void) KillObjectServices(void* pObject);
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index abedaddfdf..55d6578512 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -135,7 +135,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
return PUAddPopupT(&pd);
}
-BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce)
+BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
int iEvent = gce->pDest->iType;
if (si == NULL || !(iEvent & si->iLogPopupFlags))
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index b6fdad1875..679e24e880 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -210,7 +210,7 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t*
cle.hDbEvent = hEvent;
cle.flags = type | CLEF_TCHAR;
cle.hIcon = hIcon;
- cle.pszService = "GChat/DblClickEvent" ;
+ cle.pszService = "GChat/DblClickEvent";
cle.ptszTooltip = TranslateW(szBuf);
if (!ServiceExists(cle.pszService))
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 635478ce8f..9758431011 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -123,8 +123,6 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re
while (pTemp != NULL) {
// match
if ((!pszID && pTemp->iType != GCW_SERVER || !mir_wstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
- void *pItemData = pTemp->pItemData;
-
if (chatApi.OnRemoveSession)
chatApi.OnRemoveSession(pTemp);
DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)pTemp->pItemData);
@@ -142,7 +140,7 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re
SM_FreeSession(pTemp);
if (pszID)
- return (int)pItemData;
+ return 1;
if (pLast)
pTemp = pLast->next;
@@ -224,31 +222,6 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
return chatApi.hIcons[ICON_STATUS0];
}
-static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
-{
- int bManyFix = 0;
-
- for (SESSION_INFO *p = chatApi.wndList; p != NULL; p = p->next) {
- if (!p->bInitDone || mir_strcmpi(p->pszModule, gce->pDest->pszModule))
- continue;
-
- if (!chatApi.UM_FindUser(p->pUsers, gce->ptszUID))
- continue;
-
- if (chatApi.OnEventBroadcast)
- chatApi.OnEventBroadcast(p, gce);
-
- if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- chatApi.DoSoundsFlashPopupTrayStuff(p, gce, FALSE, bManyFix);
-
- bManyFix++;
- if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
- chatApi.LogToFile(p, gce);
- }
-
- return 0;
-}
-
static BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, BOOL bIsHighlighted)
{
SESSION_INFO *p = SM_FindSession(pszID, pszModule);
@@ -1244,7 +1217,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
chatApi.SM_SetStatusEx = SM_SetStatusEx;
chatApi.SM_SendUserMessage = SM_SendUserMessage;
chatApi.SM_AddStatus = SM_AddStatus;
- chatApi.SM_AddEventToAllMatchingUID = SM_AddEventToAllMatchingUID;
chatApi.SM_AddEvent = SM_AddEvent;
chatApi.SM_SendMessage = SM_SendMessage;
chatApi.SM_PostMessage = SM_PostMessage;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 2320292da5..c6b1e486ec 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -353,6 +353,19 @@ MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *wszId, bool
/////////////////////////////////////////////////////////////////////////////////////////
// handles chat event
+struct DoFlashParam
+{
+ SESSION_INFO *si;
+ GCEVENT *gce;
+ int i1, i2;
+};
+
+static INT_PTR __stdcall stubFlash(void *param)
+{
+ DoFlashParam *p = (DoFlashParam*)param;
+ return chatApi.DoSoundsFlashPopupTrayStuff(p->si, p->gce, p->i1, p->i2);
+}
+
static void AddUser(GCEVENT *gce)
{
SESSION_INFO *si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
@@ -372,6 +385,33 @@ static void AddUser(GCEVENT *gce)
chatApi.OnNewUser(si, ui);
}
+static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
+{
+ int bManyFix = 0;
+
+ for (SESSION_INFO *p = chatApi.wndList; p != NULL; p = p->next) {
+ if (!p->bInitDone || mir_strcmpi(p->pszModule, gce->pDest->pszModule))
+ continue;
+
+ if (!chatApi.UM_FindUser(p->pUsers, gce->ptszUID))
+ continue;
+
+ if (chatApi.OnEventBroadcast)
+ chatApi.OnEventBroadcast(p, gce);
+
+ if (!(gce->dwFlags & GCEF_NOTNOTIFY)) {
+ DoFlashParam param = { p, gce, FALSE, bManyFix };
+ CallFunctionSync(stubFlash, &param);
+ }
+
+ bManyFix++;
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
+ chatApi.LogToFile(p, gce);
+ }
+
+ return 0;
+}
+
EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
{
BOOL bIsHighlighted = FALSE;
@@ -471,7 +511,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
}
else {
// Send the event to all windows with a user pszUID. Used for broadcasting QUIT etc
- chatApi.SM_AddEventToAllMatchingUID(gce);
+ AddEventToAllMatchingUID(gce);
if (!bRemoveFlag)
return 0;
}
@@ -480,7 +520,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
if (pWnd) {
SESSION_INFO *si = chatApi.SM_FindSession(pWnd, pMod);
- // fix for IRC's old stuyle mode notifications. Should not affect any other protocol
+ // fix for IRC's old style mode notifications. Should not affect any other protocol
if ((gcd->iType == GC_EVENT_ADDSTATUS || gcd->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
return 0;
@@ -491,8 +531,10 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
int isOk = chatApi.SM_AddEvent(pWnd, pMod, gce, bIsHighlighted);
if (chatApi.OnAddLog)
chatApi.OnAddLog(si, isOk);
- if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- chatApi.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if (!(gce->dwFlags & GCEF_NOTNOTIFY)) {
+ DoFlashParam param = { si, gce, bIsHighlighted, 0 };
+ CallFunctionSync(stubFlash, &param);
+ }
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
chatApi.LogToFile(si, gce);
}
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp
index 77ece42958..294a65e1a4 100644
--- a/src/mir_app/src/clcfiledrop.cpp
+++ b/src/mir_app/src/clcfiledrop.cpp
@@ -108,7 +108,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec
return S_OK;
}
cli.pfnTrayIconPauseAutoHide(0, 0);
- ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
+ ClcData *dat = (ClcData*)GetWindowLongPtr(hwndCurrentDrag, 0);
shortPt.x = pt.x;
shortPt.y = pt.y;
ScreenToClient(hwndCurrentDrag, &shortPt);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index a9bdba9103..435036b9b4 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1010,3 +1010,4 @@ db_delete_module @1161
?SetMaxLength@CCtrlEdit@@QAEXI@Z @1167 NONAME
?SetRange@CCtrlSpin@@QAEXFF@Z @1168 NONAME
db_get_current @1169
+CallFunctionSync @1170
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index c7279247af..f08ff49cdf 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1010,3 +1010,4 @@ db_delete_module @1161
?SetMaxLength@CCtrlEdit@@QEAAXI@Z @1167 NONAME
?SetRange@CCtrlSpin@@QEAAXFF@Z @1168 NONAME
db_get_current @1169
+CallFunctionSync @1170
diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp
index 7fd0cfc45a..a462d456f4 100644
--- a/src/mir_core/src/modules.cpp
+++ b/src/mir_core/src/modules.cpp
@@ -571,6 +571,8 @@ MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam, LPARAM lP
return item.result;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_CORE_DLL(int) CallFunctionAsync(void(__stdcall *func)(void *), void *arg)
{
if (GetCurrentThreadId() == mainThreadId)
@@ -580,6 +582,35 @@ MIR_CORE_DLL(int) CallFunctionAsync(void(__stdcall *func)(void *), void *arg)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct TSyncCallParam
+{
+ INT_PTR (__stdcall *func)(void *);
+ void *arg;
+ HANDLE hDoneEvent;
+ INT_PTR result;
+};
+
+static void CALLBACK CallFuncToMainAPCFunc(ULONG_PTR dwParam)
+{
+ TSyncCallParam *item = (TSyncCallParam*)dwParam;
+ item->result = (*item->func)(item->arg);
+ SetEvent(item->hDoneEvent);
+}
+
+MIR_CORE_DLL(INT_PTR) CallFunctionSync(INT_PTR (__stdcall *func)(void *), void *arg)
+{
+ if (GetCurrentThreadId() == mainThreadId)
+ return func(arg);
+
+ TSyncCallParam param = { func, arg, getThreadEvent() };
+ QueueMainThread(CallFuncToMainAPCFunc, &param, param.hDoneEvent);
+ return param.result;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_CORE_DLL(void) KillModuleServices(HINSTANCE hInst)
{
mir_cslock lck(csServices);