summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-19 11:25:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-19 11:25:57 +0000
commit8fbb710f69be547c9a1fb45346bbd01db9d23bee (patch)
treeb49bf9e58c0aa7fdfd49bce0170062454bee4d9e /src
parentf76565d65450fe2f60913b93938c9a770e8caf4b (diff)
Chat_AddGroup - even less structures
git-svn-id: http://svn.miranda-ng.org/main/trunk@17316 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat_svc.cpp31
-rw-r--r--src/mir_app/src/chat_tools.cpp1
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
4 files changed, 20 insertions, 14 deletions
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index a5850be128..2e675131e8 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -192,17 +192,17 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
if (gcw == NULL)
return GC_NEWSESSION_ERROR;
- mir_cslock lck(csChat);
+ mir_cslockfull lck(csChat);
MODULEINFO *mi = chatApi.MM_FindModule(gcw->pszModule);
if (mi == NULL)
return GC_NEWSESSION_ERROR;
-
// try to restart a session first
SESSION_INFO *si = chatApi.SM_FindSession(gcw->ptszID, gcw->pszModule);
if (si != NULL) {
chatApi.UM_RemoveAll(&si->pUsers);
chatApi.TM_RemoveAll(&si->pStatuses);
+ lck.unlock();
si->iStatusCount = 0;
si->nUsersInNicklist = 0;
@@ -217,6 +217,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
if ((si = chatApi.SM_AddSession(gcw->ptszID, gcw->pszModule)) == NULL)
return GC_NEWSESSION_ERROR;
+ lck.unlock();
si->pItemData = gcw->pItemData;
if (gcw->iType != GCW_SERVER)
si->wStatus = ID_STATUS_ONLINE;
@@ -410,9 +411,6 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
{
- BOOL bIsHighlighted = FALSE;
- BOOL bRemoveFlag = FALSE;
-
if (gce == NULL)
return GC_EVENT_ERROR;
@@ -426,16 +424,11 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
if (NotifyEventHooks(hHookEvent, 0, LPARAM(gce)))
return 1;
+ BOOL bIsHighlighted = FALSE;
+ BOOL bRemoveFlag = FALSE;
+
// Do different things according to type of event
switch (gcd->iType) {
- case GC_EVENT_ADDGROUP:
- {
- STATUSINFO *si = chatApi.SM_AddStatus(gcd->ptszID, gcd->pszModule, gce->ptszStatus);
- if (si && gce->dwItemData)
- si->hIcon = CopyIcon((HICON)gce->dwItemData);
- }
- return 0;
-
case GC_EVENT_SETCONTACTSTATUS:
return chatApi.SM_SetContactStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
@@ -546,6 +539,18 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
/////////////////////////////////////////////////////////////////////////////////////////
// chat control functions
+MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const wchar_t *wszText, HICON hIcon)
+{
+ if (wszText == NULL)
+ return GC_EVENT_ERROR;
+
+ mir_cslock lck(csChat);
+ STATUSINFO *si = chatApi.SM_AddStatus(wszId, szModule, wszText);
+ if (si && hIcon)
+ si->hIcon = CopyIcon(hIcon);
+ return 0;
+}
+
MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName)
{
if (wszNewName == NULL)
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index eb262e1eed..ec3ab03934 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -658,7 +658,6 @@ BOOL IsEventSupported(int eventType)
case GC_EVENT_ACTION:
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- case GC_EVENT_ADDGROUP:
case GC_EVENT_SETCONTACTSTATUS:
return TRUE;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index a72414500f..ae46f64976 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -308,3 +308,4 @@ Chat_SetStatusbarText @308
Chat_SendUserMessage @309
Chat_SetStatusEx @310
Chat_Terminate @311
+Chat_AddGroup @312
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e3d58e4aa3..6914577fc2 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -308,3 +308,4 @@ Chat_SetStatusbarText @308
Chat_SendUserMessage @309
Chat_SetStatusEx @310
Chat_Terminate @311
+Chat_AddGroup @312