-
Notifications
You must be signed in to change notification settings - Fork 0
/
vk_search.pas
562 lines (486 loc) · 21.3 KB
/
vk_search.pas
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
(*
VKontakte plugin for Miranda IM: the free IM client for Microsoft Windows
Copyright (c) 2010 Andrey Lukyanov
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
*)
{-----------------------------------------------------------------------------
vk_search.pas
[ Description ]
Module to support search functionality
[ Known Issues ]
See the code
Contributors: LA
-----------------------------------------------------------------------------}
unit vk_search;
interface
uses
m_globaldefs,
m_api,
vk_popup,
uLkJSON,
Classes;
type
PPROTOSEARCHRESULT_VK = ^TPROTOSEARCHRESULT_VK;
TPROTOSEARCHRESULT_VK = record
cbSize: int;
nick: PWideChar;
firstName: PWideChar;
lastName: PWideChar;
email: PWideChar;
reserved: array [0..15] of byte;
// protocol-specific fields
id: integer; // contains unique contact's id
SecureID: PChar; // id, which is required to add contact on the server
Status: integer; // status of contact found
end;
type
CUSTOMSEARCHRESULTS_VK = record
nSize: size_t;
nFieldCount: int;
szFields: ^TCHAR;
psr: TPROTOSEARCHRESULT_VK;
end;
procedure SearchInit();
procedure SearchDestroy();
implementation
uses
vk_global, // module with global variables and constant used
vk_core, // module with core functions
vk_common, // module with common functions
vk_http, // module to connect with the site
htmlparse, // module to simplify html parsing
Messages,
Windows,
SysUtils;
function SearchAdv(wnd: HWnd): DWord; forward;
function SearchName(lParam: lParam): DWord; forward;
function SearchBasic(wParam: wParam; lParam: lParam): integer; cdecl; forward;
function SearchID(ContactID: PChar): DWord; forward;
const
SearchHandle = 230;
var
vk_hSearchBasic, vk_hSearchByName, vk_hCreateAdvSearchUI, vk_hSearchByAdvanced, vk_hAddToList: THandle;
// =============================================================================
// function to add found contact to the list
// -----------------------------------------------------------------------------
function AddToList(wParam: wParam; lParam: lParam): integer; cdecl;
var
psre: TPROTOSEARCHRESULT_VK;
psreNick: string;
psreStatus: integer;
begin
if lParam <> 0 then
begin
psre := PPROTOSEARCHRESULT_VK(lParam)^;
// values below will be required for authorization request
psreID := psre.id;
psreSecureID := psre.SecureID;
psreNick := psre.firstName;
psreStatus := psre.Status;
Result := vk_AddFriend(psreID, psreNick, psreStatus, 0);
// add the contact temporarily and invisibly, just to get user info or something
if wParam = PALF_TEMPORARY then
begin
DBWriteContactSettingByte(Result, 'CList', 'NotOnList', 1);
DBWriteContactSettingByte(Result, 'CList', 'Hidden', 1);
end;
end
else
Result := 0; // failure
end;
// =============================================================================
// function allows to search contacts by id
// -----------------------------------------------------------------------------
function SearchBasic(wParam: wParam; lParam: lParam): integer; cdecl;
var
res: DWord;
ContactID: PChar;
begin
if lParam = 0 then
Result := 0
else
begin
// search when online is possible only
if (vk_Status <> ID_STATUS_ONLINE) and (vk_Status <> ID_STATUS_INVISIBLE) then
begin
Result := 0;
end
else
begin
Result := SearchHandle;
ContactID := StrNew(PChar(lParam));
CloseHandle(BeginThread(nil, 0, @SearchID, ContactID, 0, res));
end;
end;
end;
// =============================================================================
// function allows to search contacts by name and surname
// -----------------------------------------------------------------------------
function SearchByName(wParam: wParam; lParam: lParam): integer; cdecl;
var
res: DWord;
begin
if lParam = 0 then
Result := 0
else
begin
// search when online is possible only
if (vk_Status <> ID_STATUS_ONLINE) and (vk_Status <> ID_STATUS_INVISIBLE) then
begin
Result := 0;
end
else
begin
Result := SearchHandle;
CloseHandle(BeginThread(nil, 0, @SearchName, pointer(lParam), 0, res));
end;
end;
end;
// =============================================================================
// function allows to search contact by all details
// -----------------------------------------------------------------------------
function SearchByAdvanced(wParam: wParam; lParam: lParam): integer; cdecl;
var
res: DWord;
begin
if lParam = 0 then
Result := 0
else
begin
// search when online is possible only
if (vk_Status <> ID_STATUS_ONLINE) and (vk_Status <> ID_STATUS_INVISIBLE) then
begin
// don't display message here - miranda does it
// MessageBox(0, PChar(StringReplace(Translate(err_search_noconnection), '%s', piShortName, [rfReplaceAll])), Translate(err_search_title), MB_OK or MB_ICONERROR);
Result := 0;
end
else
begin
Result := SearchHandle;
CloseHandle(BeginThread(nil, 0, @SearchAdv, pointer(lParam), 0, res));
end;
end;
end;
// =============================================================================
// function to work with Advanced Search dialog
// -----------------------------------------------------------------------------
function AdvancedSearchDlgProc(Dialog: HWnd; Message, wParam, lParam: DWord): boolean; cdecl;
begin
Result := False;
case message of
// code is executed, when options are initialized
WM_INITDIALOG:
begin
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_GENDER), GenderField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_MARITALSTATUS), MaritalStatusField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_POLITICALVIEWS), PoliticalViewsField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_DOB), DOBField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_MOB), MOBField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_YOB), YearsField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_COUNTRY), CountryField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_GRADYEAR), YearsField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_ED_STATUS), EdStatusField);
InitComboBox(GetDlgItem(Dialog, VK_ADVSRCH_CITY), CitiesField);
// translate all dialog texts
TranslateDialogDefault(Dialog);
Result := True;
end;
WM_COMMAND:
begin
case loword(wParam) of
idOk:
begin
SendMessage(GetParent(Dialog), WM_COMMAND, idOk + (BN_CLICKED) shl 16, GetDlgItem(GetParent(Dialog), idOk));
Result := True;
end;
idCancel:
begin
Result := True;
end;
end;
end;
end;
end;
// =============================================================================
// function to display advanced search dialog
// -----------------------------------------------------------------------------
function CreateAdvSearchUI(wParam: wParam; lParam: lParam): integer; cdecl;
begin
if (lParam <> 0) and (hInstance <> 0) then
Result := CreateDialogW(hInstance, MAKEINTRESOURCEW(WideString('VK_SEARCHADVANCED')), lParam, @AdvancedSearchDlgProc)
else
Result := 0; // failure
end;
// =============================================================================
// procedure to find contacts by name, surname and other details
// find first 20 contacts
// -----------------------------------------------------------------------------
procedure vk_SearchFriends(SearchURL: WideString; SearchID: integer; SearchPages: integer);
var
HTML: WideString;
i: byte;
TempInteger: integer;
FriendDetails_temp: WideString;
FoundCount: integer;
csr: CUSTOMSEARCHRESULTS_VK; // variables for customer search results
columns: array [0..3] of TChar;
FriendStatus: string;
FriendID, FriendFullName, FriendGraduated, FriendFaculty: WideString;
begin
// HTML := HTTP_NL_Post('http://vkontakte.ru/gsearch.php?section=people&q=%E0%ED%E4%F0%E5%E9%20%EB%F3%EA%FC%FF%ED%EE%E2&name=1&ajax=1', '', 'multipart/form-data', '');
SearchURL := SearchURL + vk_url_search_suffix;
HTML := HTTP_NL_Get(Format(SearchURL, [0]));
if SearchPages > 1 then
begin
if not TryStrToInt(TextBetween(HTML, 'Íàéäåíî ', ' ÷åëîâåê'), FoundCount) then
FoundCount := 10;
for i := 1 to SearchPages - 1 do
if FoundCount > i * 10 then // get next 10 found contacts
HTML := HTML + HTTP_NL_Get(Format(SearchURL, [i * 10]));
end;
if Trim(HTML) <> '' then
begin
// for unicode should use columns[0].W, see mRadio Mod for example
columns[0].w := 'ID';
columns[1].w := 'Nick';
columns[2].w := 'Graduated';
columns[3].w := 'Faculty';
csr.nSize := SizeOf(csr);
csr.nFieldCount := 4;
csr.szFields := @columns;
csr.psr.cbSize := 0; // sending just column names
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, SearchID, DWord(@csr));
while Pos('<div class="result clearFix">', HTML) > 0 do
begin
FriendDetails_temp := TextBetweenTagsAttrInc(HTML, 'div', 'class', 'result clearFix');
Delete(HTML, 1, Pos('<div class="result clearFix">', HTML) + 10);
FriendID := TextBetween(FriendDetails_temp, 'friend.php?id=', '">');
FriendDetails_temp := TextBetweenInc(FriendDetails_temp, 'div class="info"', '</li>');
FriendFullName := Trim(TextBetween(FriendDetails_temp, '<dt>Èìÿ:', '<dt>'));
FriendFullName := HTMLDecodeW(Trim(FriendFullName));
FriendFullName := Trim(HTMLRemoveTags(FriendFullName));
if FriendFullName = '' then
FriendFullName := HTMLRemoveTags(Trim(TextBetween(FriendDetails_temp, '<dt>Èìÿ:', '</dd>')));
FriendGraduated := TextBetween(FriendDetails_temp, '<dt>Âûïóñê:', '<dt>');
FriendGraduated := Trim(HTMLRemoveTags(HTMLDecodeW(FriendGraduated)));
if Pos(' ', FriendDetails_temp) > 0 then
FriendFaculty := TextBetween(FriendDetails_temp, '<dt>Ôàêóëüòåò:', ' ')
else
FriendFaculty := TextBetween(FriendDetails_temp, '<dt>Ôàêóëüòåò:', '</dd>');
FriendFaculty := Trim(HTMLRemoveTags(HTMLDecodeW(FriendFaculty)));
FriendStatus := TextBetween(FriendDetails_temp, '<span class=''bbb''>', '</span>');
if TryStrToInt(FriendID, TempInteger) and (FriendID <> '') and (FriendFullName <> '') then
begin
FillChar(csr, sizeof(csr), 0);
csr.psr.cbSize := sizeOf(csr.psr);
csr.psr.nick := PWideChar(FriendID);
csr.psr.firstName := PWideChar(FriendFullName);
csr.psr.lastName := PWideChar(FriendGraduated);
csr.psr.email := PWideChar(FriendFaculty);
csr.psr.id := TempInteger;
if FriendStatus = 'Online' then
csr.psr.Status := ID_STATUS_ONLINE
else
csr.psr.Status := ID_STATUS_OFFLINE;
columns[0].w := PWideChar(WideString(FriendID));
columns[1].w := PWideChar(FriendFullName);
columns[2].w := PWideChar(FriendGraduated);
columns[3].w := PWideChar(FriendFaculty);
csr.nSize := SizeOf(csr);
csr.nFieldCount := 4;
csr.szFields := @columns;
// add contacts to search results
// ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_DATA, SearchID, lParam(@csr.hdr.psr)); // this line is for miranda older than 0.7.0.0
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, SearchID, DWord(@csr));
end;
end;
// search finished successfully
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, SearchID, 0);
end
else // search failed, but we say that it is OK, since miranda doesn't support search failure - ACKRESULT_FAILED
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, SearchID, 0);
end;
// =============================================================================
// procedure to find contact by id
// vkontakte api
// -----------------------------------------------------------------------------
procedure vk_SearchFriendID(ID: integer; SearchID: integer; SearchPages: integer);
var
sHTML: WideString;
jsoFeed: TlkJSONobject;
FriendGraduated: WideString;
csr: CUSTOMSEARCHRESULTS_VK; // variables for customer search results
columns: array [0..3] of TChar;
wsFriendID,
wsFriendFirstName,
wsFriendLastName,
wsFriendNick,
wsFriendFullName,
wsFriendGraduated,
wsFriendFaculty: WideString;
begin
if vk_session_id <> '' then
begin
sHTML := HTTP_NL_Get(GenerateApiUrl(Format(vk_url_api_search_id, [ID, 'first_name,last_name,nickname,education,online'])));
if (Trim(sHTML) <> '') and (sHTML <> '{"response":{}}') and (Pos('error', sHTML) = 0) then
begin
// for unicode should use columns[0].W, see mRadio Mod for example
columns[0].w := 'ID';
columns[1].w := 'Nick';
columns[2].w := 'Graduated';
columns[3].w := 'Faculty';
csr.nSize := SizeOf(csr);
csr.nFieldCount := 4;
csr.szFields := @columns;
csr.psr.cbSize := 0; // sending just column names
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, SearchID, DWord(@csr));
jsoFeed := TlkJSON.ParseText(sHTML) as TlkJSONobject;
try
FillChar(csr, sizeof(csr), 0);
csr.psr.cbSize := sizeOf(csr.psr);
wsFriendID := WideString(IntToStr(ID));
csr.psr.nick := PWideChar(wsFriendID);
wsFriendFirstName := WideString(jsoFeed.Field['response'].Child[0].Field['first_name'].Value);
wsFriendLastName := WideString(jsoFeed.Field['response'].Child[0].Field['last_name'].Value);
wsFriendNick := WideString(jsoFeed.Field['response'].Child[0].Field['nickname'].Value);
wsFriendFullName := wsFriendFirstName + ' ' + wsFriendNick + ' ' + wsFriendLastName;
wsFriendFullName := HTMLDecodeW(wsFriendFullName);
csr.psr.firstName := PWideChar(wsFriendFullName);
if Pos('university_name', sHTML) > 0 then
begin
wsFriendGraduated := WideString(jsoFeed.Field['response'].Child[0].Field['university_name'].Value);
wsFriendGraduated := HTMLDecodeW(wsFriendGraduated);
end;
csr.psr.lastName := PWideChar(FriendGraduated);
if Pos('faculty_name', sHTML) > 0 then
begin
wsFriendFaculty := WideString(jsoFeed.Field['response'].Child[0].Field['faculty_name'].Value);
wsFriendFaculty := HTMLDecodeW(wsFriendFaculty);
end;
csr.psr.email := PWideChar(wsFriendFaculty); // PWideChar(FriendFaculty);
csr.psr.id := ID;
csr.psr.Status := ID_STATUS_OFFLINE;
// contact status is not returned now by api, hence the code below is disabled
// if FeedInfo.Field['response'].Child[0].Field['online'].Value = 1 then
// csr.psr.Status := ID_STATUS_ONLINE;
columns[0].w := PWideChar(wsFriendID);
columns[1].w := PWideChar(wsFriendFullName);
columns[2].w := PWideChar(wsFriendGraduated);
columns[3].w := PWideChar(wsFriendFaculty);
csr.nSize := SizeOf(csr);
csr.nFieldCount := 4;
csr.szFields := @columns;
// add contacts to search results
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, SearchID, DWord(@csr));
finally
jsoFeed.Free;
end;
end;
end
else
begin
ShowPopupMsg(0, err_session_nodetail_profile_search, 2);
// search failed, but we say that it is OK, since miranda doesn't support search failure - ACKRESULT_FAILED
end;
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, SearchID, 0);
end;
// =============================================================================
// procedure to initiate search support functionality
// -----------------------------------------------------------------------------
procedure SearchInit();
begin
vk_hSearchBasic := CreateProtoServiceFunction(piShortName, PS_BASICSEARCH, @SearchBasic);
vk_hSearchByName := CreateProtoServiceFunction(piShortName, PS_SEARCHBYNAME, @SearchByName);
vk_hCreateAdvSearchUI := CreateProtoServiceFunction(piShortName, PS_CREATEADVSEARCHUI, @CreateAdvSearchUI);
vk_hSearchByAdvanced := CreateProtoServiceFunction(piShortName, PS_SEARCHBYADVANCED, @SearchByAdvanced);
vk_hAddToList := CreateProtoServiceFunction(piShortName, PS_ADDTOLIST, @AddToList);
end;
// =============================================================================
// procedure to destroy search support functionality
// -----------------------------------------------------------------------------
procedure SearchDestroy();
begin
pluginLink^.DestroyServiceFunction(vk_hSearchBasic);
pluginLink^.DestroyServiceFunction(vk_hSearchByName);
pluginLink^.DestroyServiceFunction(vk_hCreateAdvSearchUI);
pluginLink^.DestroyServiceFunction(vk_hSearchByAdvanced);
pluginLink^.DestroyServiceFunction(vk_hAddToList);
end;
// =============================================================================
// advanced search functionality - runs in a separate thread
// -----------------------------------------------------------------------------
function SearchAdv(wnd: HWnd): DWord;
var
SearchURL: WideString;
srchFirstName, srchLastName: WideString;
srchSex, srchStatus, srchPolitical, srchBDDay, srchBDMonth, srchBDYear, srchUCountry, srchUCity, srchUniversity, srchUFaculty, srchUChair, srchUGraduation, srchUEduForm, srchOnline: integer;
begin
srchFirstName := GetDlgUnicode(wnd, VK_ADVSRCH_FIRSTNAME);
srchLastName := GetDlgUnicode(wnd, VK_ADVSRCH_LASTNAME);
srchSex := GetDlgComboBoxItem(wnd, VK_ADVSRCH_GENDER);
srchStatus := GetDlgComboBoxItem(wnd, VK_ADVSRCH_MARITALSTATUS);
srchPolitical := GetDlgComboBoxItem(wnd, VK_ADVSRCH_POLITICALVIEWS);
srchBDDay := GetDlgComboBoxItem(wnd, VK_ADVSRCH_DOB);
srchBDMonth := GetDlgComboBoxItem(wnd, VK_ADVSRCH_MOB);
srchBDYear := GetDlgComboBoxItem(wnd, VK_ADVSRCH_YOB);
srchUCountry := GetDlgComboBoxItem(wnd, VK_ADVSRCH_COUNTRY);
srchUCity := GetDlgComboBoxItem(wnd, VK_ADVSRCH_CITY);
srchUniversity := 0; // GetDlgComboBoxItem(wnd, VK_ADVSRCH_COLLEGE);
srchUFaculty := 0; // GetDlgComboBoxItem(wnd, VK_ADVSRCH_FACULTY);
srchUChair := 0; // GetDlgComboBoxItem(wnd, VK_ADVSRCH_DEPARTMENT);
srchUGraduation := GetDlgComboBoxItem(wnd, VK_ADVSRCH_GRADYEAR);
srchUEduForm := GetDlgComboBoxItem(wnd, VK_ADVSRCH_ED_STATUS);
srchOnline := byte(IsDlgButtonChecked(wnd, VK_ADVSRCH_ONLINEONLY));
SearchURL := Format(vk_url + vk_url_search, [srchFirstName + ' ' + srchLastName, srchSex, srchStatus, srchPolitical, srchBDDay, srchBDMonth, srchBDYear,
srchUCountry, srchUCity, srchUniversity, srchUFaculty, srchUChair, srchUGraduation, srchUEduForm, srchOnline]);
// for debug - SetDlgItemText(wnd, VK_ADVSRCH_FIRSTNAME, PChar(SearchURL));
vk_SearchFriends(SearchURL, SearchHandle, 2);
Result := 0;
end;
// =============================================================================
// search by ID functionality - runs in a separate thread
// -----------------------------------------------------------------------------
function SearchID(ContactID: PChar): DWord;
var
srchID: string;
srchIDInt: integer;
begin
srchID := string(ContactID);
StrDispose(ContactID);
if TryStrToInt(srchID, srchIDInt) then // id provided should be numeric
begin
vk_SearchFriendID(srchIDInt, SearchHandle, 1);
end
else
ProtoBroadcastAck(piShortName, 0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, SearchHandle, 0);
Result := 0;
end;
// =============================================================================
// search by name functionality - runs in a separate thread
// -----------------------------------------------------------------------------
function SearchName(lParam: lParam): DWord;
var
sbn: TPROTOSEARCHBYNAME;
SearchURL: WideString;
srchFirstName, srchLastName: string;
begin
sbn := PPROTOSEARCHBYNAME(lParam)^;
srchFirstName := sbn.pszFirstName;
srchLastName := sbn.pszLastName;
{SearchURL := Format(vk_url + vk_url_search, [srchFirstName, srchLastName, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0]);}
vk_SearchFriends(SearchURL, SearchHandle, 2);
Result := 0;
end;
begin
end.