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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
|
unit sr_global;
interface
uses windows,messages,commctrl,m_api,dbsettings,mirutils,awkservices;
const
QS_QS :PAnsiChar = 'QS_QS';
QS_NEW :PAnsiChar = 'QS_New';
QS_ITEM :PAnsiChar = 'QS_Item';
QS_UP :PAnsiChar = 'QS_Up';
QS_DOWN :PAnsiChar = 'QS_Down';
QS_DELETE :PAnsiChar = 'QS_Delete';
QS_DEFAULT:PAnsiChar = 'QS_Default';
QS_RELOAD :PAnsiChar = 'QS_Reload';
QS_MALE :PAnsiChar = 'QS_Male';
QS_FEMALE :PAnsiChar = 'QS_Female';
const
qs_module :PAnsiChar = 'QuickSearch';
qs_name :PAnsiChar = 'Quick Search';
QS_SHOWSERVICE:PAnsiChar = 'QuickSearch_PLUGIN/Show';
const
StatusSort = 1000;
const //types
QSTS_BYTE = 0;
QSTS_WORD = 1;
QSTS_DWORD = 2;
QSTS_STRING = 3;
QSTS_IP = 4;
QSTS_TIMESTAMP = 5;
QSTS_SIGNED = 6;
QSTS_HEXNUM = 7;
// must be non-zero for empty-column checking
QST_SETTING = 100;
QST_SCRIPT = 1;
QST_SERVICE = 2;
QST_CONTACTINFO = 3;
QST_OTHER = 200;
QSTO_LASTSEEN = 0;
QSTO_LASTEVENT = 1;
QSTO_METACONTACT = 2;
QSTO_EVENTCOUNT = 3;
const
COL_ON = $0001; // Show column
COL_FILTER = $0004; // Filter column by pattern
// QS window runtime flags
COL_INIT = $0002; // No need to update
COL_XSTATUS = $0100;
COL_GENDER = $0200;
COL_CLIENT = $0400;
COL_GROUP = $0800;
COL_CNTNR = $1000;
COL_REFRESH = $FF02; // mask
const
QSO_SORTBYSTATUS = $00000001; // Sort by status
QSO_DRAWGRID = $00000002; // Draw listview grid
QSO_TOOLSTYLE = $00000004; // QS window tool style
QSO_SAVEPATTERN = $00000008; // Save filter pattern
QSO_AUTOCLOSE = $00000010; // Close QS window after action
QSO_CLIENTICONS = $00000020; // Show client icons (fingerprint)
QSO_MAINOPTIONS = $0000FFFF; // mask for common options
// QS window options
QSO_STAYONTOP = $00010000; // Stay QS window on top
QSO_SHOWOFFLINE = $00020000; // Show offline contacts
QSO_COLORIZE = $00040000; // Colorize lines
QSO_SORTASC = $00080000; // Sort column ascending
{$include resource.inc}
type
pcolumnitem = ^tcolumnitem;
tcolumnitem = record
title :PWideChar;
setting_type :word; // QST_* constants
flags :word; // COL_* constants
width :word;
case integer of
// db setting
0: (
datatype:word; // QSTS_* constants
module :pAnsiChar;
setting :pAnsiChar;
);
// script
1: (script:pWideChar);
// service
2: (service:tServiceValue);
// contact info
3: (cnftype:word); // CNF_* constants
// other
4: (other:word); // QSTO_* constants
end;
tcolumnarray = array of tcolumnitem;
const
MaxColumnAmount = 64;
type
tqsopt = record
grrect :TRECT; // QS window rect
columns :array [0..MaxColumnAmount-1] of tcolumnitem;
numcolumns:integer; // columns array size (really, needs just for db reading)
columnsort:integer; // sorted column number
flags :dword; // QSO_* options
end;
procedure reghotkeys;
procedure unreghotkeys;
procedure saveopt_wnd;
procedure loadopt_wnd;
function savecolumn(num:integer; const column:tcolumnitem):boolean;
procedure saveopt_db;
function loadopt_db(var columns:array of tcolumnitem):integer;
function loaddefaultcolumns(var columns:array of tcolumnitem):integer;
function CloneColumns(var dst: array of tcolumnitem; const src:array of tcolumnitem):integer;
function CloneColumn (var dst:tcolumnitem; const src:tcolumnitem):boolean;
procedure clear_columns(var columns:array of tcolumnitem);
procedure clear_column (var column:tcolumnitem);
function new_column(var columns:array of tcolumnitem):integer;
procedure AddRemoveMenuItemToMainMenu;
procedure addtotoolbar;
procedure removetoolbar;
var
qsopt:tqsopt;
const
MainMenuItem:integer=0;
hTTBButton :THANDLE=0;
implementation
uses common;
const
HKN_GLOBAL:PAnsiChar = 'QS_Global';
const
so_mbottom :PAnsiChar = 'mbottom';
so_mright :PAnsiChar = 'mright';
so_mtop :PAnsiChar = 'mtop';
so_mleft :PAnsiChar = 'mleft';
so_columnsort :PAnsiChar = 'columnsort';
so_flags :PAnsiChar = 'flags';
so_numcolumns :PAnsiChar = 'numcolumns';
so_item :PAnsiChar = 'item';
so__title :PAnsiChar = '_title';
so__width :PAnsiChar = '_width';
so__flags :PAnsiChar = '_flags';
so__setting_type :PAnsiChar = '_setting_type';
so__cnftype :PAnsiChar = '_cnftype';
so__datatype :PAnsiChar = '_datatype';
so__module :PAnsiChar = '_module';
so__setting :PAnsiChar = '_setting';
so__script :PAnsiChar = '_script';
so__service :PAnsiChar = '_service';
so__restype :PAnsiChar = '_restype';
so__wparam_type :PAnsiChar = '_wparam_type';
so__lparam_type :PAnsiChar = '_lparam_type';
so__wparam :PAnsiChar = '_wparam';
so__lparam :PAnsiChar = '_lparam';
so__other :PAnsiChar = '_other';
procedure reghotkeys;
var
hkrec:THOTKEYDESC;
begin
FillChar(hkrec,SizeOf(hkrec),0);
with hkrec do
begin
cbSize :=SizeOf(hkrec);
pszName :=HKN_GLOBAL;
pszDescription.a:='QuickSearch window hotkey';
pszSection.a :=qs_name;
pszService :=QS_SHOWSERVICE;
DefHotKey :=(HOTKEYF_ALT shl 8) or VK_F3;
end;
CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
end;
procedure unreghotkeys;
begin
CallService(MS_HOTKEY_UNREGISTER,0,lparam(HKN_GLOBAL));
end;
procedure removetoolbar;
begin
if hTTBButton<>0 then
begin
if ServiceExists(MS_TTB_REMOVEBUTTON)>0 then
begin
CallService(MS_TTB_REMOVEBUTTON,WPARAM(hTTBButton),0);
hTTBButton:=0;
end;
end;
end;
procedure addtotoolbar;
var
ttbopt:TTBButton;
begin
removetoolbar;
if ServiceExists(MS_TTB_ADDBUTTON)>0 then
begin
ZeroMemory(@ttbopt,sizeof(ttbopt));
ttbopt.pszService:=QS_SHOWSERVICE;
ttbopt.hIconUp :=IcoLib_GetIcon(QS_QS,0);
ttbopt.hIconDn :=ttbopt.hIconUp;
ttbopt.dwFlags :=TTBBF_VISIBLE;
ttbopt.name :=qs_module;
hTTBButton:=TopToolbar_AddButton(@ttbopt);
if hTTBButton=THANDLE(-1) then
hTTBButton:=0;
end;
end;
procedure AddRemoveMenuItemToMainMenu;
var
mi:TMO_MenuItem;
begin
if MainMenuItem<>0 then exit;
ZeroMemory(@mi,sizeof(mi));
mi.szName.a :=qs_name;
mi.position :=500050000;
mi.pszService :=QS_SHOWSERVICE;
mi.hIcon :=IcoLib_GetIcon(QS_QS,0);
MainMenuItem :=Menu_AddMainMenuItem(@mi);
end;
// -------- column functions ---------
function CloneColumn(var dst:tcolumnitem; const src:tcolumnitem):boolean;
begin
if src.setting_type=0 then
begin
result:=false;
exit;
end;
move(src,dst,SizeOf(tcolumnitem));
StrDupW(dst.title,dst.title);
case dst.setting_type of
QST_SETTING: begin
StrDup(dst.module,dst.module);
StrDup(dst.setting,dst.setting);
end;
QST_SCRIPT: begin
StrDupW(dst.script,dst.script);
end;
QST_SERVICE: begin
CopyServiceValue(dst.service,src.service);
end;
end;
result:=true;
end;
function CloneColumns(var dst: array of tcolumnitem; const src:array of tcolumnitem):integer;
var
i,cnt:integer;
begin
cnt:=0;
for i:=0 to MaxColumnAmount-1 do
begin
if CloneColumn(dst[cnt],src[i]) then
inc(cnt);
end;
result:=cnt;
end;
procedure clear_column(var column:tcolumnitem);
begin
if column.setting_type=0 then // empty already
exit;
mFreeMem(column.title);
case column.setting_type of
QST_SETTING: begin
mFreeMem(column.module);
mFreeMem(column.setting);
end;
QST_SCRIPT: begin
mFreeMem(column.script);
end;
QST_SERVICE: begin
ClearServiceValue(column.service);
end;
QST_CONTACTINFO: begin
end;
QST_OTHER: begin
end;
end;
column.setting_type:=0; // mark as unused
end;
procedure clear_columns(var columns:array of tcolumnitem);
var
i:integer;
begin
for i:=0 to MaxColumnAmount-1 do
clear_column(columns[i]);
end;
function new_column(var columns:array of tcolumnitem):integer;
var
i:integer;
begin
result:=MaxColumnAmount-1;
for i:=0 to MaxColumnAmount-1 do
begin
if columns[i].setting_type=0 then // "empty" condition
begin
with columns[i] do
begin
StrDupW(title,'New column');
width:=64;
flags:=COL_ON;
setting_type:=QST_SETTING;
end;
result:=i;
break;
end;
end;
end;
function loaddefaultcolumns(var columns:array of tcolumnitem):integer;
var
i:integer;
begin
clear_columns(columns);
// lazy to renumber if changes
i:=0;
// account
with columns[i] do
begin
StrDupW(title,TranslateW('Account'));
width :=82;
flags :=COL_ON;
setting_type :=QST_SERVICE;
StrDup (service.service,'Proto/GetContactBaseAccount');
service.flags :=ACF_TYPE_STRING;
service.w_flags:=ACF_TYPE_PARAM;
service.l_flags:=ACF_TYPE_NUMBER;
service.lparam :=nil;
end;
inc(i);
// gender
with columns[i] do
begin
StrDupW(title,TranslateW('Gender'));
width :=20;
flags :=COL_ON;
setting_type :=QST_CONTACTINFO;
cnftype :=CNF_GENDER;
end;
inc(i);
// uin
with columns[i] do
begin
StrDupW(title,TranslateW('UserID'));
width :=80;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_CONTACTINFO;
cnftype :=CNF_UNIQUEID;
end;
inc(i);
// username(displayname)
with columns[i] do
begin
StrDupW(title,TranslateW('Nickname'));
width :=76;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_SERVICE;
StrDup(service.service,MS_CLIST_GETCONTACTDISPLAYNAME);
service.flags :=ACF_TYPE_UNICODE;
service.w_flags:=ACF_TYPE_PARAM;
service.l_flags:=ACF_TYPE_NUMBER;
StrDupW(pWideChar(service.lparam),'2'); // 0 for ANSI
end;
inc(i);
// firstname
with columns[i] do
begin
StrDupW(title,TranslateW('First name'));
width :=68;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_CONTACTINFO;
cnftype :=CNF_FIRSTNAME;
end;
inc(i);
// lastname
with columns[i] do
begin
StrDupW(title,TranslateW('Last name'));
width :=66;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_CONTACTINFO;
cnftype :=CNF_LASTNAME;
end;
inc(i);
// group
with columns[i] do
begin
StrDupW(title,TranslateW('Group'));
width :=80;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_SETTING;
datatype :=QSTS_STRING;
StrDup(module ,'CList');
StrDup(setting,'Group');
end;
inc(i);
// TabSRMM container
with columns[i] do
begin
StrDupW(title,TranslateW('Container'));
width :=80;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_SETTING;
datatype :=QSTS_STRING;
StrDup(module ,'Tab_SRMsg');
StrDup(setting,'containerW');
end;
inc(i);
// email
with columns[i] do
begin
StrDupW(title,TranslateW('E-mail'));
width :=116;
flags :=COL_ON+COL_FILTER;
setting_type :=QST_CONTACTINFO;
cnftype :=CNF_EMAIL;
end;
inc(i);
// miranda version
with columns[i] do
begin
StrDupW(title,TranslateW('Client ID'));
width :=60;
flags :=COL_ON;
setting_type:=QST_SETTING;
datatype :=QSTS_STRING;
StrDup(setting,'MirVer');
end;
inc(i);
// IP version
with columns[i] do
begin
StrDupW(title,TranslateW('Ext IP'));
width :=100;
flags :=0;
setting_type:=QST_SETTING;
datatype :=QSTS_IP;
StrDup(module ,'ICQ');
StrDup(setting,'IP');
end;
inc(i);
// LastSeen
with columns[i] do
begin
StrDupW(title,TranslateW('LastSeen'));
width :=116;
flags :=0;
setting_type:=QST_OTHER;
other :=QSTO_LASTSEEN;
end;
inc(i);
// last event
with columns[i] do
begin
StrDupW(title,TranslateW('Last Event'));
width :=100;
flags :=0;
setting_type:=QST_OTHER;
other :=QSTO_LASTEVENT;
end;
inc(i);
// online since
with columns[i] do
begin
StrDupW(title,TranslateW('Online since'));
width :=100;
flags :=0;
setting_type:=QST_SETTING;
datatype :=QSTS_TIMESTAMP;
StrDup(module ,'ICQ');
StrDup(setting,'LogonTS');
end;
inc(i);
// metacontacts
with columns[i] do
begin
StrDupW(title,TranslateW('Metacontact'));
width :=50;
flags :=0;
setting_type:=QST_OTHER;
other :=QSTO_METACONTACT;
end;
inc(i);
// events
with columns[i] do
begin
StrDupW(title,TranslateW('Event count'));
width :=50;
flags :=0;
setting_type:=QST_OTHER;
other :=QSTO_EVENTCOUNT;
end;
inc(i);
// Contact add time
with columns[i] do
begin
StrDupW(title,TranslateW('Contact add time'));
width :=80;
flags :=COL_ON;
setting_type :=QST_SETTING;
datatype :=QSTS_TIMESTAMP;
StrDup(module ,'UserInfo');
StrDup(setting,'ContactAddTime');
end;
inc(i);
result:=i;
end;
// -------- save/load settings ---------
procedure WriteInt(setting:PAnsiChar;value:int);
begin
DBWriteDword(0,qs_module,setting,value)
end;
procedure WriteWord(setting:PAnsiChar;value:word);
begin
DBWriteWord(0,qs_module,setting,value)
end;
procedure WriteStr(setting:PAnsiChar;value:PAnsiChar);
begin
DBWriteString(0,qs_module,setting,value)
end;
procedure WriteUnicode(setting:PAnsiChar;value:PWideChar);
begin
DBWriteUnicode(0,qs_module,setting,value)
end;
procedure saveopt_wnd;
begin
WriteInt(so_mbottom ,qsopt.grrect.bottom);
WriteInt(so_mright ,qsopt.grrect.right);
WriteInt(so_mtop ,qsopt.grrect.top);
WriteInt(so_mleft ,qsopt.grrect.left);
WriteInt(so_flags ,qsopt.flags);
WriteInt(so_columnsort ,qsopt.columnsort);
end;
function savecolumn(num:integer; const column:tcolumnitem):boolean;
var
buf:array [0..127] of AnsiChar;
p,pp:PAnsiChar;
begin
if column.setting_type=0 then
begin
result:=false;
exit;
end;
result:=true;
pp:=StrCopyE(buf,so_item);
p:=StrEnd(IntToStr(pp,num));
with column do
begin
StrCopy(p,so__title); WriteUnicode(buf,title);
StrCopy(p,so__setting_type); WriteWord(buf,setting_type);
StrCopy(p,so__flags); WriteWord(buf,flags and not COL_REFRESH);
StrCopy(p,so__width); WriteWord(buf,width);
case setting_type of
QST_SETTING: begin
StrCopy(p,so__datatype); WriteWord(buf,datatype);
StrCopy(p,so__module ); WriteStr (buf,module);
StrCopy(p,so__setting ); WriteStr (buf,setting);
end;
QST_SCRIPT: begin
StrCopy(p,so__script); WriteUnicode(buf,script);
end;
QST_CONTACTINFO: begin
StrCopy(p,so__cnftype); WriteWord(buf,cnftype);
end;
QST_SERVICE: begin
p^:=#0;
SaveServiceValue(service,qs_module,buf);
end;
QST_OTHER: begin
StrCopy(p,so__other); WriteWord(buf,other);
end;
end;
end;
end;
procedure saveopt_db;
var
i,cnt:integer;
begin
DBDeleteGroup(0,qs_module,'item*');
WriteInt(so_flags,qsopt.flags);
cnt:=0;
for i:=0 to MaxColumnAmount-1 do
begin
if savecolumn(cnt,qsopt.columns[i]) then
inc(cnt);
end;
WriteWord(so_numcolumns,cnt);
end;
function GetInt(setting:PAnsiChar;default:integer):integer;
begin
result:=DBReadDWord(0,qs_module,setting,default);
end;
function GetWord(setting:PAnsiChar;default:word):word;
begin
result:=DBReadWord(0,qs_module,setting,default);
end;
function GetStr(setting:PAnsiChar):PAnsiChar;
begin
result:=DBReadString(0,qs_module,setting,nil);
end;
function GetUnicode(setting:PAnsiChar):PWideChar;
begin
result:=DBReadUnicode(0,qs_module,setting,nil);
end;
{
if "fast"writing enabled
fill columns accordingly comumn order array
}
procedure loadopt_wnd;
begin
qsopt.grrect.bottom:=GetInt(so_mbottom,240);
qsopt.grrect.right :=GetInt(so_mright ,550);
qsopt.grrect.top :=GetInt(so_mtop ,0);
qsopt.grrect.left :=GetInt(so_mleft ,0);
qsopt.columnsort :=GetInt(so_columnsort,StatusSort);
qsopt.flags :=GetInt(so_flags,QSO_SORTBYSTATUS+QSO_DRAWGRID+QSO_CLIENTICONS+
QSO_COLORIZE+QSO_SORTASC);
end;
const
ACF_OLD_NUMBER = 1;
ACF_OLD_STRING = 0;
ACF_OLD_UNICODE = 2;
ACF_OLD_PARTYPE = $FF;
function loadopt_db(var columns:array of tcolumnitem):integer;
var
buf:array [0..127] of AnsiChar;
buf1:array [0..31] of WideChar;
p,pp:PAnsiChar;
tmp:PAnsiChar;
i:integer;
begin
if DBGetSettingType(0,qs_module,so_flags)=DBVT_DELETED then
begin
DBDeleteModule(0,qs_module);
qsopt.flags:=
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
QSO_SORTASC;
result:=0;
end
else
begin
qsopt.flags:=GetInt(so_flags,
QSO_SORTBYSTATUS or QSO_DRAWGRID or
QSO_CLIENTICONS or QSO_COLORIZE or
QSO_SORTASC);
result:=GetWord(so_numcolumns,0);
end;
if result=0 then
begin
result:=loaddefaultcolumns(columns);
saveopt_db;
end
else
begin
clear_columns(columns);
pp:=StrCopyE(buf,so_item);
//?? FillChar(qsopt.columns[0],SizeOf(qsopt.columns),0);
for i:=0 to result-1 do
begin
p:=StrEnd(IntToStr(pp,i));
with columns[i] do
begin
StrCopy(p,so__setting_type); setting_type:=GetWord(buf,0);
StrCopy(p,so__title); title:=GetUnicode(buf);
StrCopy(p,so__width); width:=GetWord(buf,20);
StrCopy(p,so__flags); flags:=GetWord(buf,COL_ON) and not COL_REFRESH;
case setting_type of
QST_SETTING: begin
StrCopy(p,so__datatype); datatype:=GetWord(buf,0);
StrCopy(p,so__module ); module :=GetStr (buf);
StrCopy(p,so__setting ); setting :=GetStr (buf);
end;
QST_SCRIPT: begin
StrCopy(p,so__script); script:=GetUnicode(buf);
end;
QST_CONTACTINFO: begin
StrCopy(p,so__cnftype); cnftype:=GetWord(buf,0);
end;
QST_SERVICE: begin //!!!!
// check for old settings
StrCopy(p,so__service); service.service:=GetStr(buf);
// new format
if service.service=nil then
begin
p^:=#0;
LoadServiceValue(service,qs_module,buf);
end
//----- old format -----
else
begin
StrCopy(p,so__restype ); service.flags :=ConvertResultFlags(GetInt(buf,0));
StrCopy(p,so__wparam_type); service.w_flags:=ConvertParamFlags (GetInt(buf,0));
StrCopy(p,so__lparam_type); service.l_flags:=ConvertParamFlags (GetInt(buf,0));
//----- WPARAM -----
StrCopy(p,so__wparam);
case service.w_flags and ACF_TYPE_MASK of
// cheat
ACF_TYPE_CURRENT: begin
service.w_flags:=(service.w_flags and not ACF_TYPE_CURRENT) or ACF_TYPE_PARAM;
end;
ACF_TYPE_NUMBER : begin
if DBGetSettingType(0,qs_module,buf) in [DBVT_WORD,DBVT_DWORD] then
StrDupW(PWideChar(service.wparam),IntToStr(buf1,GetInt(buf,0)))
else
service.wparam:=pointer(GetUnicode(buf));
end;
// ansi convert to unicode
ACF_TYPE_STRING : begin
tmp:=GetStr(buf);
AnsiToWide(tmp,PWideChar(service.wparam),MirandaCP);
mFreeMem(tmp);
end;
ACF_TYPE_UNICODE: service.wparam:=pointer(GetUnicode(buf));
end;
//----- LPARAM -----
StrCopy(p,so__lparam);
case service.l_flags and ACF_TYPE_MASK of
// cheat
ACF_TYPE_CURRENT: begin
service.l_flags:=(service.l_flags and not ACF_TYPE_CURRENT) or ACF_TYPE_PARAM;
end;
ACF_TYPE_NUMBER : begin
if DBGetSettingType(0,qs_module,buf) in [DBVT_WORD,DBVT_DWORD] then
StrDupW(PWideChar(service.lparam),IntToStr(buf1,GetInt(buf,0)))
else
service.lparam:=pointer(GetUnicode(buf));
end;
// ansi convert to unicode
ACF_TYPE_STRING : begin
tmp:=GetStr(buf);
AnsiToWide(tmp,PWideChar(service.lparam),MirandaCP);
mFreeMem(tmp);
end;
ACF_TYPE_UNICODE: service.lparam:=pointer(GetUnicode(buf));
end;
end;
end;
QST_OTHER: begin
StrCopy(p,so__other); other:=GetWord(buf,0);
end;
end;
end;
end;
end;
end;
end.
|