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
|
{Statistic}
unit Status;
{$include compilers.inc}
interface
{$Resource status.res}
implementation
uses
windows,messages,commctrl,
common,m_api,mirutils,mircontacts,protocols,dbsettings,wrapper,
global,wat_api,hlpdlg,CBEx,myRTF,Tmpl;
const
HKN_INSERT:PansiChar = 'WAT_Insert';
procedure reghotkey;
var
hkrec:THOTKEYDESC;
begin
// if DisablePlugin=dsPermanent then
// exit;
FillChar(hkrec,SizeOf(hkrec),0);
with hkrec do
begin
cbSize :=SizeOf(hkrec);
pszName :=HKN_INSERT;
pszDescription.a:='Global WATrack hotkey';
pszSection.a :=PluginName;
pszService :=MS_WAT_INSERT;
DefHotKey :=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F5;
// lParam :=0;
end;
CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec));
end;
{$include i_st_vars.inc}
{$include i_st_rc.inc}
{$include i_opt_status.inc}
{$include i_hotkey.inc}
{$include i_status.inc}
{$include i_opt_3.inc}
{$include i_opt_11.inc}
{$include i_opt_12.inc}
// ------------ base interface functions -------------
var
mStatus:twModule;
function InitProc(aGetStatus:boolean=false):integer;
begin
if aGetStatus then
begin
if GetModStatus=0 then
begin
result:=0;
exit;
end;
end
else
SetModStatus(1);
result:=1;
LoadOpt;
CreateProtoList;
CreateTemplates;
hINS:=CreateServiceFunction(MS_WAT_INSERT,@InsertProc);
reghotkey;
plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
// mStatus.ModuleStat:=1;
// if ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)<>0 then
// hLTo:=CreateServiceFunction(MS_LISTENINGTO_GETPARSEDTEXT,@ListenProc);
end;
procedure DeInitProc(aSetDisable:boolean);
var
j:integer;
begin
if aSetDisable then
SetModStatus(0);
for j:=1 to GetNumProto do
begin
if (SimpleMode<>BST_UNCHECKED) or ((GetProtoSetting(j) and psf_enabled)<>0) then
CallProtoService(GetProtoName(j),PS_SET_LISTENINGTO,0,0);
end;
// DestroyServiceFunction(hLTo);
DestroyServiceFunction(hINS);
UnhookEvent(plStatusHook);
FreeProtoList;
FreeTemplates;
// mStatus.ModuleStat:=0;
end;
function AddOptionsPage(var tmpl:pAnsiChar;var proc:pointer;var name:PAnsiChar):integer;
const
count:integer=2;
begin
if count=0 then
count:=2;
case count of
2: begin
tmpl:='COMMON';
proc:=@DlgProcOptions3;
name:='Status (common)';
end;
1: begin
if SimpleMode=BST_UNCHECKED then
begin
tmpl:='TEMPLATE11';
proc:=@DlgProcOptions11;
end
else
begin
tmpl:='TEMPLATE12';
proc:=@DlgProcOptions12;
end;
name:='Status (templates)';
end
end;
dec(count);
result:=count;
end;
procedure Init;
begin
mStatus.Next :=ModuleLink;
mStatus.Init :=@InitProc;
mStatus.DeInit :=@DeInitProc;
mStatus.AddOption :=@AddOptionsPage;
mStatus.Check :=nil;
mStatus.ModuleName:='Statuses';
// mStatus.ModuleStat:=0;
ModuleLink :=@mStatus;
end;
begin
Init;
end.
|