1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
/*
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (C) 2012-21 Miranda NG team (https://miranda-ng.org)
Copyright (c) 2000-08 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef M_MESSAGE_H__
#define M_MESSAGE_H__ 1
#include <m_database.h>
#include <m_langpack.h>
/////////////////////////////////////////////////////////////////////////////////////////
// brings up the send message dialog for a contact
// wParam = (MCONTACT)hContact
// lParam = (LPARAM)(char*)szText
// returns 0 on success or nonzero on failure
// returns immediately, just after the dialog is shown
// szText is the text to put in the edit box of the window (but not send)
// szText = NULL will not use any text
// szText != NULL is only supported on v0.1.2.0+
#define MS_MSG_SENDMESSAGE "SRMsg/SendCommand"
#define MS_MSG_SENDMESSAGEW "SRMsg/SendCommandW"
/////////////////////////////////////////////////////////////////////////////////////////
// reads a message from contact list event structure
// wParam = 0 (unused)
// lParam = (CLISTEVT*)pEvent
// always returns 0
#define MS_MSG_READMESSAGE "SRMsg/ReadMessage"
#define MS_MSG_TYPINGMESSAGE "SRMsg/TypingMessage"
/////////////////////////////////////////////////////////////////////////////////////////
// gets fired when a message window appears/disappears
// wparam = 0
// lparam = (WPARAM)(MessageWindowEventData*)hWindowEvent;
#define MSG_WINDOW_EVT_OPENING 1 // window is about to be opened
#define MSG_WINDOW_EVT_OPEN 2 // window has been opened
#define MSG_WINDOW_EVT_CLOSING 3 // window is about to be closed
#define MSG_WINDOW_EVT_CLOSE 4 // window has been closed
#define MSG_WINDOW_UFLAG_MSG_FROM 0x00000001
#define MSG_WINDOW_UFLAG_MSG_TO 0x00000002
#define MSG_WINDOW_UFLAG_MSG_BOTH 0x00000004
struct MessageWindowEventData
{
MCONTACT hContact;
HWND hwndWindow; // top level window for the contact
uint32_t uType; // see event types above
uint32_t uFlags; // used to indicate message direction for all event types except custom
HWND hwndInput; // input area window for the contact (or NULL if there is none)
HWND hwndLog; // log area window for the contact (or NULL if there is none)
};
#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
/////////////////////////////////////////////////////////////////////////////////////////
// retrieves some particular info about a SRMM window by contact
// returns 0 if a window was found or an error code otherwise
#define MSG_WINDOW_STATE_EXISTS 0x00000001 // Window exists should always be true if hwndWindow exists
#define MSG_WINDOW_STATE_VISIBLE 0x00000002
#define MSG_WINDOW_STATE_FOCUS 0x00000004
#define MSG_WINDOW_STATE_ICONIC 0x00000008
struct MessageWindowData
{
HWND hwndWindow; //top level window for the contact or NULL if no window exists
int uState; // see window states
class CSrmmBaseDialog *pDlg; // window class object
};
EXTERN_C MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd);
/////////////////////////////////////////////////////////////////////////////////////////
// sets the status text & icon in a window associated with hContact
EXTERN_C MIR_APP_DLL(void) Srmm_SetStatusText(MCONTACT hContact, const wchar_t *wszText, HICON hIcon = nullptr);
/////////////////////////////////////////////////////////////////////////////////////////
// wparam = 0 (unused)
// lparam = (MessageWindowEvent*)
// fired before SRMM writes an entered message into the database
#define ME_MSG_PRECREATEEVENT "MessageAPI/PreCreateEvent"
struct MessageWindowEvent
{
int seq; // number returned by PSS_MESSAGE
MCONTACT hContact;
DBEVENTINFO *dbei; // database event written on the basis of message sent
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SRMM popup menu
// wParam = 0
// lParam = (MessageWindowPopupData *)&MessageWindowPopupData;
// Fired to allow plugins to add items to the msg window popup menu
// Always fired twice: once with MSG_WINDOWPOPUP_SHOWING and once with MSG_WINDOWPOPUP_SELECTED.
// This is done to allow cleaning of resources.
#define ME_MSG_WINDOWPOPUP "MessageAPI/WindowPopupRequested"
#define MSG_WINDOWPOPUP_SHOWING 1
#define MSG_WINDOWPOPUP_SELECTED 2
#define MSG_WINDOWPOPUP_INPUT 1
#define MSG_WINDOWPOPUP_LOG 2
struct MessageWindowPopupData
{
unsigned int uType; // see popup types above
unsigned int uFlags; // used to indicate in which window the popup was requested
MCONTACT hContact;
HWND hwnd; // window where the popup was requested
HMENU hMenu; // The handle to the menu
POINT pt; // The point, in screen coords
int selection; // The menu control id or 0 if no one was selected
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// status icons
#define MBF_DISABLED 0x01
#define MBF_HIDDEN 0x02
#define MBF_UNICODE 0x04
struct StatusIconData
{
const char *szModule; // used in combo with the dwId below to create a unique identifier
DWORD dwId; // uniquely defines a button inside a module
HICON hIcon, hIconDisabled; // hIconDisabled is optional - if null, will use hIcon in the disabled state
int flags; // bitwize OR of MBF_* flags above
MAllCStrings szTooltip; // controlled by MBF_UNICODE
};
#define MBCF_RIGHTBUTTON 0x01 // if this flag is specified, the click was a right button - otherwize it was a left click
// adds an icon
EXTERN_C MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, HPLUGIN pPlugin);
// removes an icon
EXTERN_C MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId);
// if hContact is null, icon is modified for all contacts
// if either hIcon or pwszTooltip is null, they will not be modified
EXTERN_C MIR_APP_DLL(void) Srmm_ModifyIcon(MCONTACT hContact, const char *szModule, DWORD iconId, HICON hIcon, const wchar_t *pwszToolTip);
// if hContact is null, flags are modified for all contacts
EXTERN_C MIR_APP_DLL(void) Srmm_SetIconFlags(MCONTACT hContact, const char *szModule, DWORD iconId, int flags);
// idx is zero-based index of a visible icon
// returns (StatusIconData*)icon description filled for the required contact or NULL if there're no more icons
// don't free this memory.
EXTERN_C MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int idx);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// status icons click notification
struct StatusIconClickData
{
POINT clickLocation; // click location, in screen coordinates
const char *szModule;
DWORD dwId;
int flags; // bitwize OR of MBCF_* flags above
};
// wParam = (HANDLE)hContact;
// lParam = (StatusIconClickData *)&StatusIconClickData;
// catch to show a popup menu, etc.
#define ME_MSG_ICONPRESSED "MessageAPI/IconPressed"
// wParam = (HANDLE)hContact;
// lParam = (StatusIconkData*)pIcon
// catch to be notified about the icon list's change.
#define ME_MSG_ICONSCHANGED "MessageAPI/IconsChanged"
// emulates click on a status bar icon
EXTERN_C MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusIconClickData *sid);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// srmm toolbar icons' support
// default section for all SRMM toolbar hotkeys
#define BB_HK_SECTION LPGEN("Message window toolbar")
// button state flags
#define BBSF_HIDDEN (1<<0)
#define BBSF_DISABLED (1<<1)
#define BBSF_PUSHED (1<<2)
#define BBSF_RELEASED (1<<3)
// button flags
#define BBBF_DISABLED (1<<0)
#define BBBF_HIDDEN (1<<1)
#define BBBF_ISPUSHBUTTON (1<<2)
#define BBBF_ISARROWBUTTON (1<<3)
#define BBBF_ISCHATBUTTON (1<<4)
#define BBBF_ISIMBUTTON (1<<5)
#define BBBF_ISRSIDEBUTTON (1<<7)
#define BBBF_CANBEHIDDEN (1<<8)
#define BBBF_ISSEPARATOR (1<<9)
#define BBBF_CANTBEHIDDEN (1<<10)
#define BBBF_CREATEBYID (1<<11) // only for the internal use
struct BBButton
{
const char *pszModuleName; // module name without spaces and underline symbols (e.g. "tabsrmm")
int dwButtonID; // your button ID, will be combined with pszModuleName for storing settings, etc...
const wchar_t *pwszText; // button's text, might be NULL
const wchar_t *pwszTooltip; // button's tooltip, might be NULL
DWORD dwDefPos; // default order pos of button, counted from window edge (left or right)
// use value >100, because internal buttons using 10,20,30... 80, etc
DWORD bbbFlags; // combine of BBBF_ flags above
HANDLE hIcon; // Handle to icolib registered icon
const char *pszHotkey; // name of the registered hotkey or NULL
};
// adds a new toolbar button
// returns button's handle on success or NULL otherwise
EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN);
// modifies the existing toolbar button
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi);
// removes a toolbar button identified by a structure
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi);
// retrieves data from a toolbar button to a structure
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(int) Srmm_GetButtonState(HWND hwndDlg, BBButton *bbdi);
// applies a new data to a toolbar button
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(int) Srmm_SetButtonState(MCONTACT hContact, BBButton *bbdi);
// resets toolbar settings to these default values
// returns 0 on success and nonzero value otherwise
EXTERN_C MIR_APP_DLL(void) Srmm_ResetToolbar();
// updates all toolbar icons in a message dialog
EXTERN_C MIR_APP_DLL(void) Srmm_UpdateToolbarIcons(HWND hdlg);
// draws all toolbar icons in a message dialog
EXTERN_C MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg);
// ToolBar loaded event
// This event will be send after module loaded and after each toolbar reset
// You should add your buttons on this event
// NOTE: this event is temporary, you need to hook it using HookTemporaryEvent
#define ME_MSG_TOOLBARLOADED "SRMM/ButtonsBar/ModuleLoaded"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// toolbar button clicked event
// wParam = (HANDLE)hContact;
// lParam = (CustomButtonClickData*) pointer to the click data;
// catch to show a popup menu, etc.
#define ME_MSG_BUTTONPRESSED "SRMM/ButtonsBar/ButtonPressed"
// event flags
#define BBCF_RIGHTBUTTON (1<<0)
#define BBCF_SHIFTPRESSED (1<<1)
#define BBCF_CONTROLPRESSED (1<<2)
#define BBCF_ARROWCLICKED (1<<3)
struct CustomButtonClickData
{
char *pszModule; // button owners name
POINT pt; // screen coordinates for menus
DWORD dwButtonId; // registered button ID
HWND hwndFrom; // button parents HWND
MCONTACT hContact;
DWORD flags; // BBCF_ flags
};
/////////////////////////////////////////////////////////////////////////////////////////
// color table for embedded color chooser
EXTERN_C MIR_APP_DLL(COLORREF*) Srmm_GetColorTable(int *pTableSize = nullptr);
#endif // M_MESSAGE_H__
|