summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-13 21:29:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-13 21:29:05 +0300
commit1ba1e51fc6fa7e30b0a627a141348f515ffaba76 (patch)
treef73f73f96662e545d0c995d41b22ed5f2908a2a2 /include
parent1724ed49a870a75f7608a8badc2a897ca471203d (diff)
chat api:
- GC_SHAREDUSERS flag added to share the same array of users for all group chats; - USERINFO.next removed; - MODULEINFO.arUsers & SESSION_INFO.arUsers introduced to maintain user lists; - MM_AddModule removed; - memory allocation model changed for MODULEINFO & SESSION_INFO - MM_CreateModule & SM_CreateSession members are added to g_chatApi
Diffstat (limited to 'include')
-rw-r--r--include/m_chat.h1
-rw-r--r--include/m_chat_int.h69
2 files changed, 42 insertions, 28 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 978e1e1860..d6d2e398ae 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -133,6 +133,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_ACKMSG 0x0020 // the protocol must acknowlege messages sent
#define GC_TYPNOTIF 0x0040 // enable typing notifications.
#define GC_CHANMGR 0x0080 // enable the 'channel settings' button
+#define GC_SHAREDUSERS 0x0100 // array of users is the same for all group chats
// Error messages
#define GC_ERROR 1 // An internal error occurred.
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 4e69c9f4e4..154edc854e 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_CHAT_INT_H__
#define M_CHAT_INT_H__ 1
-#pragma warning(disable:4512)
+#pragma warning(disable:4512 4275)
#include <time.h>
@@ -83,17 +83,31 @@ struct LOGSTREAMDATA;
class CChatRoomDlg;
-struct GCModuleInfoBase
+struct USERINFO : public MZeroedObject, public MNonCopyable
{
+ wchar_t* pszNick;
+ wchar_t* pszUID;
+ WORD Status;
+ int iStatusEx;
+ WORD ContactStatus;
+};
+
+struct MIR_APP_EXPORT GCModuleInfoBase : public MZeroedObject, public MNonCopyable
+{
+ GCModuleInfoBase();
+ ~GCModuleInfoBase();
+
char *pszModule;
wchar_t *ptszModDispName;
char *pszHeader;
bool bBold, bItalics, bUnderline;
bool bColor, bBkgColor;
- bool bChanMgr, bAckMsg;
+ bool bChanMgr, bAckMsg, bSharedUsers;
int iMaxText;
+
+ OBJLIST<USERINFO> arUsers; // for shared list of users
};
struct COMMANDINFO
@@ -131,18 +145,11 @@ struct STATUSINFO
STATUSINFO *next;
};
-struct USERINFO
+struct MIR_APP_EXPORT GCSessionInfoBase : public MZeroedObject, public MNonCopyable
{
- wchar_t* pszNick;
- wchar_t* pszUID;
- WORD Status;
- int iStatusEx;
- WORD ContactStatus;
- USERINFO *next;
-};
+ GCSessionInfoBase();
+ ~GCSessionInfoBase();
-struct GCSessionInfoBase
-{
MCONTACT hContact;
bool bInitDone;
@@ -156,7 +163,6 @@ struct GCSessionInfoBase
wchar_t* ptszTopic;
int iType;
- int nUsersInNicklist;
int iEventCount;
int iStatusCount;
@@ -171,10 +177,19 @@ struct GCSessionInfoBase
CChatRoomDlg *pDlg;
COMMANDINFO *lpCommands, *lpCurrentCommand;
LOGINFO *pLog, *pLogEnd;
- USERINFO *pUsers, *pMe;
+ USERINFO *pMe;
STATUSINFO *pStatuses;
+ MODULEINFO *pMI;
+
+ OBJLIST<USERINFO> arUsers;
wchar_t pszLogFileName[MAX_PATH];
+
+ __forceinline OBJLIST<USERINFO>& getUserList()
+ {
+ GCModuleInfoBase *mi = (GCModuleInfoBase*)pMI;
+ return (mi->bSharedUsers) ? mi->arUsers : arUsers;
+ }
};
struct GCLogStreamDataBase
@@ -260,6 +275,7 @@ struct CHAT_MANAGER
void (*SetActiveSession)(SESSION_INFO *si);
SESSION_INFO* (*GetActiveSession)(void);
+ SESSION_INFO* (*SM_CreateSession)(void);
SESSION_INFO* (*SM_FindSession)(const wchar_t *pszID, const char *pszModule);
HICON (*SM_GetStatusIcon)(SESSION_INFO *si, USERINFO * ui);
BOOL (*SM_PostMessage)(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -272,7 +288,7 @@ struct CHAT_MANAGER
USERINFO* (*SM_GetUserFromIndex)(const wchar_t *pszID, const char *pszModule, int index);
void (*SM_InvalidateLogDirectories)(void);
- MODULEINFO* (*MM_AddModule)(const char *pszModule);
+ MODULEINFO* (*MM_CreateModule)(void);
MODULEINFO* (*MM_FindModule)(const char *pszModule);
void (*MM_FontsChanged)(void);
void (*MM_IconsChanged)(void);
@@ -282,18 +298,15 @@ struct CHAT_MANAGER
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);
+ int (*UM_CompareItem)(const USERINFO *u1, const USERINFO *u2);
+ USERINFO* (*UM_AddUser)(STATUSINFO *pStatusList, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus);
+ USERINFO* (*UM_FindUser)(SESSION_INFO *si, const wchar_t *pszUID);
+ USERINFO* (*UM_FindUserFromIndex)(SESSION_INFO *si, int index);
+ USERINFO* (*UM_GiveStatus)(SESSION_INFO *si, const wchar_t *pszUID, WORD status);
+ USERINFO* (*UM_SetContactStatus)(SESSION_INFO *si, const wchar_t *pszUID, WORD status);
+ USERINFO* (*UM_TakeStatus)(SESSION_INFO *si, const wchar_t *pszUID, WORD status);
+ wchar_t* (*UM_FindUserAutoComplete)(SESSION_INFO *si, const wchar_t* pszOriginal, const wchar_t* pszCurrent);
+ BOOL (*UM_RemoveUser)(SESSION_INFO *si, const wchar_t *pszUID);
LOGINFO* (*LM_AddEvent)(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd);
BOOL (*LM_TrimLog)(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd, int iCount);