summaryrefslogtreecommitdiff
path: root/include/delphi/m_message.inc
blob: 662171f9ae55d9cd91a3a95bb03f9e432335ef11 (plain)
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
{
  Miranda IM: the free IM client for Microsoft  Windows

  Copyright 2000-2003 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}
{$DEFINE M_MESSAGE}
const
  {brings up the send message dialog for a contact
   wParam=(WPARAM)(HANDLE)hContact
   lParam=(LPARAM)(AnsiChar*)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+
   NB: Current versions of the convers plugin use the name
   "SRMsg/LaunchMessageWindow" instead. For compatibility you should call
   both names and the correct one will work. }
   MS_MSG_SENDMESSAGE :PAnsiChar = 'SRMsg/SendCommand';
   MS_MSG_SENDMESSAGEW:PAnsiChar = 'SRMsg/SendCommandW';

   ME_MSG_WINDOWEVENT:PAnsiChar = 'MessageAPI/WindowEvent';

   MS_MSG_CONVERS:PAnsiChar = 'SRMsg/LaunchMessageWindow';

  {wparam=0 }
  {lparam=(WPARAM)(MessageWindowEventData*)hWindowEvent; }
  {Event types }
  MSG_WINDOW_EVT_OPENING = 1; // window is about to be opened
  MSG_WINDOW_EVT_OPEN    = 2; // window has been opened
  MSG_WINDOW_EVT_CLOSING = 3; // window is about to be closed
  MSG_WINDOW_EVT_CLOSE   = 4; // window has been closed
  MSG_WINDOW_EVT_CUSTOM  = 5; // custom event for message plugins to use
                              // (custom uFlags may be used)
  MSG_WINDOW_UFLAG_MSG_FROM = $00000001;
  MSG_WINDOW_UFLAG_MSG_TO   = $00000002;
  MSG_WINDOW_UFLAG_MSG_BOTH = $00000004;

type
  PMessageWindowEventData = ^TMessageWindowEventData;
  TMessageWindowEventData = record
    cbSize    : int;
    hContact  : THANDLE;
    hwndWindow: HWND;    // top level window for the contact
    szModule  : PAnsiChar;   // used to get plugin type (which means you could use
                         // local if needed)
    uType     : uint;   // see event types above
    uFlags    : uint;   // used to indicate message direction for all event
                         // types except custom
    local     : pointer; // used to store pointer to custom data
    hwndInput : HWND;    // input area window for the contact (or NULL if there is none)
    hwndLog   : HWND;    // log area window for the contact (or NULL if there is none)
  end;

const
  { wparam=0
    lparam=0
    Returns a dword with the current message api version
    Current version is 0,0,0,4
  }
  MS_MSG_GETWINDOWAPI:PAnsiChar = 'MessageAPI/WindowAPI';

  { wparam=(AnsiChar*)szBuf
    lparam=(int)cbSize size of buffer
    Sets the window class name in wParam (ex. "SRMM" for srmm.dll)
  }
  MS_MSG_GETWINDOWCLASS:PAnsiChar = 'MessageAPI/WindowClass';

type
  PMessageWindowInputData = ^TMessageWindowInputData;
  TMessageWindowInputData = record
    cbSize  : int;
    hContact: THANDLE;
    uFlags  : int; // see uflags above
  end;

const
  MSG_WINDOW_STATE_EXISTS  = $00000001; // Window exists should always be true
                                        // if hwndWindow exists
  MSG_WINDOW_STATE_VISIBLE = $00000002;
  MSG_WINDOW_STATE_FOCUS   = $00000004;
  MSG_WINDOW_STATE_ICONIC  = $00000008;

type
  PMessageWindowOutputData = ^TMessageWindowOutputData;
  TMessageWindowOutputData = record
    cbSize    : int;
    hContact  : THANDLE;
    uFlags    : int;     // should be same as input data unless 0, then it
                         // will be the actual type
    hwndWindow: HWND;    // top level window for the contact or NULL if no window exists
    uState    : int;     // see window states
    local     : pointer; // used to store pointer to custom data
  end;
  PMessageWindowData = PMessageWindowOutputData;
  TMessageWindowData = TMessageWindowOutputData;

const
{ wparam=(MessageWindowInputData*)
  lparam=(MessageWindowOutputData*)
  returns 0 on success and returns non-zero (1) on error or if no window data
  exists for that hcontact
}
  MS_MSG_GETWINDOWDATA:PAnsiChar = 'MessageAPI/GetWindowData';

{ wparam=0(unused)
  lparam=(pMessageWindowEvent) event written
  fired when SRMM writes an entered message into the database
}
  ME_MSG_WRITEEVENT:PAnsiChar = 'MessageAPI/OnWriteEvent';

{ wParam = 0
 lParam = (MessageWindowPopupData *)&MessageWindowPopupData;
 Fired to allow plugins to add itens 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.
}
  ME_MSG_WINDOWPOPUP:PAnsiChar = 'MessageAPI/WindowPopupRequested';

  MSG_WINDOWPOPUP_SHOWING  = 1;
  MSG_WINDOWPOPUP_SELECTED = 2;

  MSG_WINDOWPOPUP_INPUT = 1;
  MSG_WINDOWPOPUP_LOG   = 2;

type
  MessageWindowPopupData = record
    cbSize   :int;
    uType    :uint;    // see popup types above
    uFlags   :uint;    // used to indicate in which window the popup was requested
    hContact :THANDLE;
    hwnd     :HWND;    // window where the popup was requested
    hMenu    :HMENU;   // The handle to the menu
    pt       :TPOINT;  // The point, in screen coords
    selection:int;     // The menu control id or 0 if no one was selected
  end;

type
  pMessageWindowEvent = ^MessageWindowEvent;
  MessageWindowEvent = record
    cbSize   :int;
    seq      :int;     // number returned by PSS_MESSAGE
    hContact :THANDLE;
    hDbEvent :THANDLE; // database event written on the basis of message sent
  end;

// status icons
const
  MBF_DISABLED = 1;
  MBF_HIDDEN   = 2;
  MBF_UNICODE  = 4;

type
  pStatusIconData = ^tStatusIconData;
  tStatusIconData = record
    cbSize       :int;       // must be equal to sizeof(StatusIconData)
    szModule     :PAnsiChar; // used in combo with the dwId below to create a unique identifier
    dwId         :DWORD;     // uniquely defines a button inside a module
    hIcon,
    hIconDisabled:HICON;     // hIconDisabled is optional - if null, will use hIcon in the disabled state
    flags        :int;       // one of MBF_* above
    szTooltip    :TChar;     // controlled by MBF_UNICODE
  end;

const
  MBCF_RIGHTBUTTON = 1; // if this flag is specified, the click was a right button -
                        // otherwize it was a left click

type
  pStatusIconClickData = ^tStatusIconClickData;
  tStatusIconClickData = record
    cbSize       :int;
    clickLocation:TPOINT;    // click location, in screen coordinates
    szModule     :PAnsiChar;
    dwId         :DWORD;
    flags        :int;       // one of MBCF_* above
  end;

const
{
  wParam = hLangpack
  lParam = (StatusIconData *)&StatusIconData
}
  MS_MSG_ADDICON:PAnsiChar = 'MessageAPI/AddIcon';

{
  wParam = 0
  lParam = (StatusIconData *)&StatusIconData
  only szModule and szId are used
}
  MS_MSG_REMOVEICON:PAnsiChar = 'MessageAPI/RemoveIcon';

{
  wParam = (HANDLE)hContact
  lParam = (int)zero-based index of a visible icon
  returns (StatusIconData*)icon description filled for the required contact
  don't free this memory.
}
  MS_MSG_GETNTHICON:PAnsiChar = 'MessageAPI/GetNthIcon';

{
 wParam = (HANDLE)hContact
 lParam = (StatusIconData *)&StatusIconData
 if hContact is null, icon is modified for all contacts
 otherwise, only the flags field is valid
 if either hIcon, hIconDisabled or szTooltip is null, they will not be modified
}
  MS_MSG_MODIFYICON:PAnsiChar = 'MessageAPI/ModifyIcon';

{
 wParam = (HANDLE)hContact;
 lParam = (StatusIconClickData *)&StatusIconClickData;
 catch to show a popup menu, etc.
}
  ME_MSG_ICONPRESSED:PAnsiChar = 'MessageAPI/IconPressed';

{
  wParam = (HANDLE)hContact;
  lParam = (StatusIconkData*)pIcon
  catch to be notified about the icon list's change.
}
  ME_MSG_ICONSCHANGED:PAnsiChar = 'MessageAPI/IconsChanged';

{$ENDIF}