From 6941b13721285765d6b8df94c1c87d4f78b8be68 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Jan 2014 15:51:52 +0000 Subject: chat structures slightly cleaned (no changes so far) git-svn-id: http://svn.miranda-ng.org/main/trunk@7547 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_chat.h | 258 ++++++++++++++++++++++++++----------------------------- 1 file changed, 122 insertions(+), 136 deletions(-) (limited to 'include/m_chat.h') diff --git a/include/m_chat.h b/include/m_chat.h index 14c74d2385..3affd8c811 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -133,14 +133,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define GC_COLOR 0x0008 //enable the 'foreground color' button #define GC_BKGCOLOR 0x0010 //enable the 'background color' button #define GC_ACKMSG 0x0020 //the protocol must acknowlege messages sent -#define GC_TYPNOTIF 0x0040 //NOT SUPPORTED YET! Enable typing notifications. +#define GC_TYPNOTIF 0x0040 //enable typing notifications. #define GC_CHANMGR 0x0080 //enable the 'channel settings' button -#define GC_SINGLEFORMAT 0x0100 //the protocol supports only 1 formatting per message -#define GC_FONTSIZE 0x0200 //enable font size selection +#define GC_SINGLEFORMAT 0x0100 //the protocol supports only 1 formatting per message +#define GC_FONTSIZE 0x0200 //enable font size selection -#define GC_UNICODE 0x01000 //NOT SUPPORTED YET! Enable unicode (if chat supports it), - //Pass UNICODE instead of ASCII. Note that - //registration will fail if the unicode version of chat is not installed +#define GC_UNICODE 0x01000 //enable unicode (if chat supports it), + //Pass UNICODE instead of ASCII. #if defined( _UNICODE ) #define GC_TCHAR GC_UNICODE #else @@ -148,26 +147,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif // Error messages -#define GC_REGISTER_WRONGVER 1 //You appear to be using the wrong version of this API. Registration failed. -#define GC_REGISTER_ERROR 2 //An internal error occurred. Registration failed. -#define GC_REGISTER_NOUNICODE 3 //MS_GC_REGISTER returns this error if the Unicode version of chat - //is not installed and GC_UNICODE is set. Registration failed +#define GC_REGISTER_WRONGVER 1 // You appear to be using the wrong version of this API. Registration failed. +#define GC_REGISTER_ERROR 2 // An internal error occurred. Registration failed. +#define GC_REGISTER_NOUNICODE 3 // MS_GC_REGISTER returns this error if the Unicode version of chat + // is not installed and GC_UNICODE is set. Registration failed // GCREGISTER struct typedef struct { - int cbSize; //Set to sizeof(GCREGISTER); - DWORD dwFlags; //Use GC_* flags above to indicate features supported - const char* pszModule; //This MUST be the protocol name as registered with Miranda IM + int cbSize; // Set to sizeof(GCREGISTER); + DWORD dwFlags; // Use GC_* flags above to indicate features supported + LPCSTR pszModule; // This MUST be the protocol name as registered with Miranda IM union { - const char* pszModuleDispName; //This is the protocol's real name as it will be displayed to the user - const TCHAR* ptszModuleDispName; // used if GC_TCHAR flag is passed + LPCSTR pszModuleDispName; //This is the protocol's real name as it will be displayed to the user + LPCTSTR ptszModuleDispName; // used if GC_TCHAR flag is passed }; - int iMaxText; //Max message length the protocol supports. Will limit the typing area input. 0 = no limit - int nColors; //Number of colors in the colorchooser menu for the color buttons. Max = 100 - COLORREF* pColors; //pointer to the first item in a static COLORREF array containing the colors - //that should be showed in the colorchooser menu. - //ie: COLORREF crCols[nColors]; - // pColors = &crCols[0]; + int iMaxText; // Max message length the protocol supports. Will limit the typing area input. 0 = no limit + int nColors; // Number of colors in the colorchooser menu for the color buttons. Max = 100 + COLORREF* pColors; // pointer to the first item in a static COLORREF array containing the colors + // that should be showed in the colorchooser menu. + // ie: COLORREF crCols[nColors]; + // pColors = &crCols[0]; } GCREGISTER; @@ -187,47 +186,42 @@ typedef struct { // Session type -#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels". - // A hContact will be added for the session -#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window" - // A hContact will be added for the session, but it will default to being hidden (on the CList) -#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". - +#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels". + // A hContact will be added for the session +#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window" + // A hContact will be added for the session, but it will default to being hidden (on the CList) +#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". // Error messages -#define GC_NEWSESSION_WRONGVER 1 //You appear to be using the wrong version of this API. -#define GC_NEWSESSION_ERROR 2 //An internal error occurred. +#define GC_NEWSESSION_WRONGVER 1 // You appear to be using the wrong version of this API. +#define GC_NEWSESSION_ERROR 2 // An internal error occurred. -// GCREGISTER structure +// GCSESSION structure typedef struct { - int cbSize; //Set to sizeof(GCSESSION); - 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) + int cbSize; // Set to sizeof(GCSESSION); + int iType; // Use one of the GCW_* flags above to set the type of session + LPCSTR pszModule; // The name of the protocol owning the session (the same as pszModule when you register) union { - const char* pszName; //The name of the session as it will be displayed to the user - const TCHAR* ptszName; + LPCSTR pszName; // The name of the session as it will be displayed to the user + LPCTSTR ptszName; }; union { - const char* pszID; //The unique identifier for the session. - const TCHAR* ptszID; + LPCSTR pszID; // The unique identifier for the session. + LPCTSTR ptszID; }; union { - const char* pszStatusbarText; //Optional text to set in the statusbar of the chat room window, or NULL. - const TCHAR* ptszStatusbarText; + LPCSTR pszStatusbarText; // Optional text to set in the statusbar of the chat room window, or NULL. + LPCTSTR ptszStatusbarText; }; - DWORD dwFlags; - DWORD dwItemData; //Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event - } GCSESSION; + DWORD dwFlags; + DWORD dwItemData; // Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event + } + GCSESSION; #define MS_GC_NEWSESSION "GChat/NewChat" - - - - - /* Step 3 -- SEND an EVENT -- @@ -465,46 +459,43 @@ typedef struct { // The GCDEST structure. It is passed to Chat inside GCEVENT. typedef struct { - char* pszModule; //Name of the protocol (same as you registered with) - union { - char* pszID; //Unique identifier of the session, or NULL to broadcast to all sessions as specified above - TCHAR* ptszID; - }; - int iType; //Use GC_EVENT_* as defined above. Only one event per service call. -} GCDEST; - + LPSTR pszModule; // Name of the protocol (same as you registered with) + LPTSTR ptszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above + int iType; // Use GC_EVENT_* as defined above. Only one event per service call. +} + GCDEST; // The GCEVENT structure typedef struct { - int cbSize; // Set to sizeof(GCEVENT); - GCDEST* pDest; // pointer to a GCDEST structure which specifies the session to receive the event + int cbSize; // Set to sizeof(GCEVENT); + GCDEST *pDest; // pointer to a GCDEST structure which specifies the session to receive the event union { const char *pszText; // usage depends on type of event, max 2048 characters const TCHAR *ptszText; }; union { - const char* pszNick; // usage depends on type of event - const TCHAR* ptszNick; + LPCSTR pszNick; // usage depends on type of event + LPCTSTR ptszNick; }; union { - const char* pszUID; // usage depends on type of event, Do NOT use spaces for unique user identifiers. - const TCHAR* ptszUID; + LPCSTR pszUID; // usage depends on type of event, Do NOT use spaces for unique user identifiers. + LPCTSTR ptszUID; }; union { - const char* pszStatus; // usage depends on type of event - const TCHAR* ptszStatus; + LPCSTR pszStatus; // usage depends on type of event + LPCTSTR ptszStatus; }; union { - const char* pszUserInfo; // Additional user information that is displayed after the nickname. - const TCHAR* ptszUserInfo; + LPCSTR pszUserInfo; // Additional user information that is displayed after the nickname. + LPCTSTR ptszUserInfo; }; - // IRC use it to display a hostmask for JOIN, PART (and more) events. - BOOL bIsMe; // Is this event from the Miranda user? - DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY, GC_UNICODE + // IRC use it to display a hostmask for JOIN, PART (and more) events. + BOOL bIsMe; // Is this event from the Miranda user? + DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY, GC_UNICODE - // FALSE any other time than when initializing the window (before sending SESSION_INITDONE) - DWORD_PTR dwItemData; // User specified data. - DWORD time; // Timestamp of the event + // FALSE any other time than when initializing the window (before sending SESSION_INITDONE) + DWORD_PTR dwItemData; // User specified data. + DWORD time; // Timestamp of the event } GCEVENT; @@ -524,7 +515,6 @@ typedef struct { Use this service to get information on different aspects of the sessions that are registered with Chat. * Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(char *) pszModule); - * returns -1 on failure and the sessioncount on success */ @@ -532,39 +522,37 @@ typedef struct { /* -- 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. * Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci; - * returns 0 on success or error code on failure */ // Flags -#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get -#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no -#define HCONTACT 0x0004 // hContact is valid -#define DATA 0x0008 // wItemData is valid -#define ID 0x0010 // pszID is valid. -#define NAME 0x0020 // pszName is valid -#define TYPE 0x0040 // iType is valid -#define COUNT 0x0080 // iCount is valid -#define USERS 0x0100 // pszUsers is valid +#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get +#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no +#define HCONTACT 0x0004 // hContact is valid +#define DATA 0x0008 // wItemData is valid +#define ID 0x0010 // pszID is valid. +#define NAME 0x0020 // pszName is valid +#define TYPE 0x0040 // iType is valid +#define COUNT 0x0080 // iCount is valid +#define USERS 0x0100 // pszUsers is valid // The GC_INFO structure typedef struct { - DWORD Flags; // use a combination of the above flags - int iItem; // session type (GCW_*) - int iType; // session type (GCW_*) - char* pszModule; // the module name as registered in MS_GC_REGISTER - TCHAR* pszID; // unique ID of the session - TCHAR* pszName; // display name of the session - DWORD_PTR dwItemData; // user specified data. - int iCount; // count of users in the nicklist - char* pszUsers; // space separated string containing the UID's of the users in the user list. - // NOTE. Use Mirandas mmi_free() on the returned string. - HANDLE hContact; // hContact for the session (can be NULL) + DWORD Flags; // use a combination of the above flags + int iItem; // session type (GCW_*) + int iType; // session type (GCW_*) + LPSTR pszModule; // the module name as registered in MS_GC_REGISTER + LPTSTR pszID; // unique ID of the session + TCHAR* pszName; // display name of the session + DWORD_PTR dwItemData; // user specified data. + int iCount; // count of users in the nicklist + char* pszUsers; // space separated string containing the UID's of the users in the user list. + // NOTE. Use Mirandas mmi_free() on the returned string. + HANDLE hContact; // hContact for the session (can be NULL) } GC_INFO; @@ -582,27 +570,28 @@ typedef struct { * Returning nonzero from your hook will stop other hooks from being called. */ -#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text. -#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room -#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU -#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU -#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing -#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid -#define GC_USER_LEAVE 8 // user requests to leave the session -#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol - // should take action, but MSN may want to terminate the session here) -#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory. + +#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text. +#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room +#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU +#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU +#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing +#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid +#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory. +#define GC_USER_LEAVE 8 // user requests to leave the session +#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol + // should take action, but MSN may want to terminate the session here) #define ME_GC_EVENT "GChat/OutgoingEvent" typedef struct { - GCDEST* pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered + GCDEST *pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered union { - char* pszText; // usage depends on type of event - TCHAR* ptszText; + char *pszText; // usage depends on type of event + TCHAR *ptszText; }; union { - char* pszUID; // unique identifier, usage depends on type of event - TCHAR* ptszUID; + char *pszUID; // unique identifier, usage depends on type of event + TCHAR *ptszUID; }; DWORD_PTR dwData; // user defined data, usage depends on type of event } @@ -619,43 +608,40 @@ typedef struct { * lParam=(LPARAM)(GCMENUITEM *)gcmi Returning nonzero from your hook will stop other hooks from being called. - */ // type of item to add to the popup menu -#define MENU_NEWPOPUP 1 // add submenu -#define MENU_POPUPITEM 2 // add item to current submenu -#define MENU_POPUPSEPARATOR 3 // add separator to current submenu -#define MENU_SEPARATOR 4 // add separator to menu -#define MENU_ITEM 5 // add item - -// Added in Miranda IM 0.8.0.6+ -#define MENU_POPUPCHECK 6 // add checked item to current submenu -#define MENU_CHECK 7 // add checked item -#define MENU_POPUPHMENU 8 // add custom submenu to current submenu, use dwID to specify HMENU -#define MENU_HMENU 9 // add custom submenu, use dwID to specify HMENU +#define MENU_NEWPOPUP 1 // add submenu +#define MENU_POPUPITEM 2 // add item to current submenu +#define MENU_POPUPSEPARATOR 3 // add separator to current submenu +#define MENU_SEPARATOR 4 // add separator to menu +#define MENU_ITEM 5 // add item +#define MENU_POPUPCHECK 6 // add checked item to current submenu +#define MENU_CHECK 7 // add checked item +#define MENU_POPUPHMENU 8 // add custom submenu to current submenu, use dwID to specify HMENU +#define MENU_HMENU 9 // add custom submenu, use dwID to specify HMENU // type of menu that is being requested -#define MENU_ON_LOG 1 // pop up menu on the message log -#define MENU_ON_NICKLIST 2 // pop up menu on the user list +#define MENU_ON_LOG 1 // pop up menu on the message log +#define MENU_ON_NICKLIST 2 // pop up menu on the user list // contains info on a menuitem to be added struct gc_item { - TCHAR* pszDesc; // Textual description of the menu item to add - DWORD dwID; // when/if the user selects this menu item this - // value will be returned via the above hook, GC_USER_LOGMENU - // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique. - int uType; // What kind of menu item is it? Use MENU_* flags above - BOOL bDisabled; // should the menu item be shown as disabled + TCHAR *pszDesc; // Textual description of the menu item to add + DWORD dwID; // when/if the user selects this menu item this + // value will be returned via the above hook, GC_USER_LOGMENU + // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique. + int uType; // What kind of menu item is it? Use MENU_* flags above + BOOL bDisabled; // should the menu item be shown as disabled }; typedef struct { - char * pszModule; // Contains the protocol name, do NOT change. - TCHAR* pszID; // The unique identifier of the session that triggered the hook, do NOT change. - TCHAR* pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change. - int Type; // Type of menu. MENU_ON_* flags used. do NOT change. - int nItems; // Set this to the number of menu items you want to add - struct gc_item* Item; // pointer to the first in the array of gc_item's + char *pszModule; // Contains the protocol name, do NOT change. + TCHAR *pszID; // The unique identifier of the session that triggered the hook, do NOT change. + TCHAR *pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change. + int Type; // Type of menu. MENU_ON_* flags used. do NOT change. + int nItems; // Set this to the number of menu items you want to add + gc_item *Item; // pointer to the first in the array of gc_item's } GCMENUITEMS; -- cgit v1.2.3