From 7057588689d25144fc5e5930d95451bf0791b3ab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 17 Sep 2016 08:15:59 +0000 Subject: crutch for window creation git-svn-id: http://svn.miranda-ng.org/main/trunk@17306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/chat_svc.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 0e390c90e4..c5acd9abb6 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -119,6 +119,9 @@ static int SmileyOptionsChanged(WPARAM, LPARAM) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// retrieveing chat info + EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci) { if (!gci || !gci->pszModule) @@ -144,6 +147,9 @@ EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// registers protocol as chat provider + MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr) { if (gcr == NULL) @@ -181,6 +187,9 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// starts new chat session + EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw) { if (gcw == NULL) @@ -254,6 +263,26 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// +// handles chat event + +struct ShowChatParam +{ + ShowChatParam(SESSION_INFO *_si, int _command, int _bShow) : + si(_si), command(_command), bShow(_bShow) + {} + + SESSION_INFO *si; + int command, bShow; +}; + +static void __stdcall stubShowRoom(void *param) +{ + ShowChatParam *p = (ShowChatParam*)param; + chatApi.ShowRoom(p->si, p->command, p->bShow); + delete p; +} + static void SetInitDone(SESSION_INFO *si) { if (si->bInitDone) @@ -276,7 +305,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) SetInitDone(si); chatApi.SetActiveSession(si->ptszID, si->pszModule); if (si->hWnd) - chatApi.ShowRoom(si, wp, FALSE); + CallFunctionAsync(stubShowRoom, new ShowChatParam(si, wp, FALSE)); } return 0; @@ -287,7 +316,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) { SetInitDone(si); if (wp != SESSION_INITDONE || db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) == 0) - chatApi.ShowRoom(si, wp, TRUE); + CallFunctionAsync(stubShowRoom, new ShowChatParam(si, wp, TRUE)); return 0; } break; -- cgit v1.2.3