summaryrefslogtreecommitdiff
path: root/include/m_chat.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-01-27 19:48:42 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-01-27 19:48:42 +0300
commit899221e2d058f5afe30bb2ecdbf168c8ad3c15a6 (patch)
treeea2346678575a4fc5fdd9575b6a9174bd30c70dc /include/m_chat.h
parentc736d08681747a9453bd4c266f6dd54d8cbd79eb (diff)
Group chats: all old APIs with lookup by module+session removed
Diffstat (limited to 'include/m_chat.h')
-rw-r--r--include/m_chat.h77
1 files changed, 42 insertions, 35 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 4a58d625c5..096811cf3c 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -147,7 +147,7 @@ struct GCREGISTER
int iMaxText; // Max message length the protocol supports. Will limit the typing area input. 0 = no limit
};
-EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
+MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
/*
Step 2. -- CREATE a new SESSION --
@@ -167,7 +167,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
// support for adding more users etc. ex "MSN session".
-EXTERN_C MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession(
+MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession(
int iType, // Use one of the GCW_* flags above to set the type of session
const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register)
const wchar_t *ptszID, // The unique identifier for the session.
@@ -355,10 +355,11 @@ EXTERN_C MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession(
#define GCEF_NOTNOTIFY 0x0004
#define GCEF_UTF8 0x0008
+struct SESSION_INFO;
+
struct GCEVENT
{
- LPCSTR pszModule; // Name of the protocol (same as you registered with)
- MAllCStrings pszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above
+ SESSION_INFO *si; // session to deal with
int iType; // Use GC_EVENT_* as defined above. Only one event per service call.
MAllCStrings pszText; //
@@ -374,21 +375,23 @@ struct GCEVENT
uint32_t time; // Timestamp of the event
};
-EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT*);
+MIR_APP_DLL(int) Chat_Event(GCEVENT*);
-EXTERN_C MIR_APP_DLL(void*) Chat_GetUserInfo(const char *szModule, const wchar_t *wszId);
-EXTERN_C MIR_APP_DLL(int) Chat_SetUserInfo(const char *szModule, const wchar_t *wszId, void *pItemData);
+MIR_APP_DLL(void*) Chat_GetUserInfo(SESSION_INFO *si);
+MIR_APP_DLL(int) Chat_SetUserInfo(SESSION_INFO *si, void *pItemData);
-EXTERN_C MIR_APP_DLL(int) Chat_AddGroup(SESSION_INFO *si, const wchar_t *wszText);
-EXTERN_C MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName);
-EXTERN_C MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, const wchar_t *wszOldId, const wchar_t *wszNewId);
-EXTERN_C MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId, const wchar_t *wszText);
-EXTERN_C MIR_APP_DLL(int) Chat_SetStatusbarText(const char *szModule, const wchar_t *wszId, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_AddGroup(SESSION_INFO *si, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_ChangeSessionName(SESSION_INFO *si, const wchar_t *wszNewName);
+MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszOldId, const wchar_t *wszNewId);
+MIR_APP_DLL(int) Chat_ChangeUserId(SESSION_INFO *si, const wchar_t *wszOldId, const wchar_t *wszNewId);
+MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_SendUserMessage(SESSION_INFO *si, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_SetStatusbarText(SESSION_INFO *si, const wchar_t *wszText);
-EXTERN_C MIR_APP_DLL(wchar_t*) Chat_GetGroup(void);
-EXTERN_C MIR_APP_DLL(void) Chat_SetGroup(const wchar_t*);
+MIR_APP_DLL(wchar_t*) Chat_GetGroup(void);
+MIR_APP_DLL(void) Chat_SetGroup(const wchar_t*);
-EXTERN_C MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in);
+MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -397,8 +400,8 @@ EXTERN_C MIR_APP_DLL(wchar_t*) Chat_UnescapeTags(wchar_t *str_in);
#define GC_SSE_TABDELIMITED 0x0004 // use tabs as delimiters
#define GC_SSE_OFFLINE 0x0008 // displays a contact offline, otherwise away
-// if wszId == NULL, the status is applied to all windows of specified szModule
-EXTERN_C MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, int flags, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, int flags, const wchar_t *wszText);
+MIR_APP_DLL(int) Chat_SetStatusEx(SESSION_INFO *si, int flags, const wchar_t *wszText);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -412,22 +415,14 @@ EXTERN_C MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *
#define WINDOW_CLEARLOG 6 // clear the log of the room window
// if wszId == NULL, this message is broadcasted to all windows of specified szModule
-EXTERN_C MIR_APP_DLL(int) Chat_Control(const char *szModule, const wchar_t *wszId, int command);
-EXTERN_C MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *wszId, bool bRemoveContact = false);
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// This hook is fired when MS_GC_EVENT is called, with the same wParam and lParam as above.
-// It allows external plugins to intercept chat events and display then in other ways
+MIR_APP_DLL(int) Chat_Control(SESSION_INFO *si, int command);
-#define ME_GC_HOOK_EVENT "GChat/HookEvent"
-
-/*
- -- GETTING info about a SESSION or session data --
- Use this service to get information on different aspects of the sessions that are registered with Chat.
+MIR_APP_DLL(int) Chat_Terminate(const char *szModule, bool bRemoveContact = false);
+MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si, bool bRemoveContact = false);
- * Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci;
- * returns 0 on success or error code on failure
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Use this function to get information on different aspects of the sessions that are registered with Chat.
+// returns 0 on success or error code on failure
// Flags
#define GCF_BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get
@@ -440,10 +435,9 @@ EXTERN_C MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *ws
#define GCF_COUNT 0x0080 // iCount is valid
#define GCF_USERS 0x0100 // pszUsers is valid
-// The GC_INFO structure
struct GC_INFO
{
- uint32_t Flags; // use a combination of the above flags
+ uint32_t Flags; // use a combination of the GCF_* flags (look above)
int iItem; // session type (GCW_*)
int iType; // session type (GCW_*)
LPCSTR pszModule; // the module name as registered in MS_GC_REGISTER
@@ -456,9 +450,22 @@ struct GC_INFO
MCONTACT hContact; // hContact for the session (can be NULL)
};
-EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO*);
+MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *pInfo);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Finds a session by its module & unique id
+// returns a pointer to session or NULL on error
+
+MIR_APP_DLL(SESSION_INFO*) Chat_Find(const wchar_t *pszID, const char *pszModule);
//------------------------- HOOKS ------------------------
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// This hook is fired when MS_GC_EVENT is called, with the same wParam and lParam as above.
+// It allows external plugins to intercept chat events and display then in other ways
+
+#define ME_GC_HOOK_EVENT "GChat/HookEvent"
+
/*
-- user interaction --
Hook this to receive notifications about when user take actions in a chat room window.
@@ -541,7 +548,7 @@ typedef struct {
#define ME_GC_BUILDMENU "GChat/BuildMenu"
-EXTERN_C MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, HPLUGIN pPlugin);
+MIR_APP_DLL(void) Chat_AddMenuItems(HMENU hMenu, int nItems, const gc_item *Item, HPLUGIN pPlugin);
//////////////////////////////////////////////////////////////////////////
// Get Chat ToolTip Text for buddy