summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_app/src/chat_svc.cpp33
1 files 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;