summaryrefslogtreecommitdiffabout
path: root/LogPatternUnix.cpp
Unidiff
Diffstat (limited to 'LogPatternUnix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--LogPatternUnix.cpp320
1 files changed, 320 insertions, 0 deletions
diff --git a/LogPatternUnix.cpp b/LogPatternUnix.cpp
new file mode 100644
index 0000000..2a76e1f
--- a/dev/null
+++ b/LogPatternUnix.cpp
@@ -0,0 +1,320 @@
1// LogPatternUnix.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "LogPatternUnix.h"
7
8#include "SyslogSocket.h"
9#include "LogPattern.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CLogPatternUnix property page
19
20 #definePFROM CSyslogSocket::facKernel
21 #define PTO CSyslogSocket::facAuthPriv
22
23IMPLEMENT_DYNCREATE(CLogPatternUnix, CPropertyPage)
24
25CLogPatternUnix::CLogPatternUnix(CLogPattern* daddy) : CPropertyPage(CLogPatternUnix::IDD), m_Daddy(daddy)
26{
27 //{{AFX_DATA_INIT(CLogPatternUnix)
28 //}}AFX_DATA_INIT
29}
30
31CLogPatternUnix::~CLogPatternUnix()
32{
33}
34
35void CLogPatternUnix::DoDataExchange(CDataExchange* pDX)
36{
37 CPropertyPage::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(CLogPatternUnix)
39 //}}AFX_DATA_MAP
40 m_Daddy->ExchangeData(pDX,PFROM,PTO);
41}
42
43
44BEGIN_MESSAGE_MAP(CLogPatternUnix, CPropertyPage)
45 //{{AFX_MSG_MAP(CLogPatternUnix)
46 ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn)
47 ON_BN_CLICKED(IDC_AUTH_ON, OnAuthOn)
48 ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor)
49 ON_BN_CLICKED(IDC_AUTH_XOR, OnAuthXor)
50 ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn)
51 ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor)
52 ON_BN_CLICKED(IDC_CRON_ON, OnCronOn)
53 ON_BN_CLICKED(IDC_CRON_XOR, OnCronXor)
54 ON_BN_CLICKED(IDC_DAEMON_ON, OnDaemonOn)
55 ON_BN_CLICKED(IDC_DAEMON_XOR, OnDaemonXor)
56 ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn)
57 ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor)
58 ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn)
59 ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor)
60 ON_BN_CLICKED(IDC_ERR_ON, OnErrOn)
61 ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor)
62 ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn)
63 ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor)
64 ON_BN_CLICKED(IDC_KERNEL_ON, OnKernelOn)
65 ON_BN_CLICKED(IDC_KERNEL_XOR, OnKernelXor)
66 ON_BN_CLICKED(IDC_LPR_ON, OnLprOn)
67 ON_BN_CLICKED(IDC_LPR_XOR, OnLprXor)
68 ON_BN_CLICKED(IDC_MAIL_ON, OnMailOn)
69 ON_BN_CLICKED(IDC_MAIL_XOR, OnMailXor)
70 ON_BN_CLICKED(IDC_NEWS_ON, OnNewsOn)
71 ON_BN_CLICKED(IDC_NEWS_XOR, OnNewsXor)
72 ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn)
73 ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor)
74 ON_BN_CLICKED(IDC_SYSLOG_ON, OnSyslogOn)
75 ON_BN_CLICKED(IDC_SYSLOG_XOR, OnSyslogXor)
76 ON_BN_CLICKED(IDC_USER_ON, OnUserOn)
77 ON_BN_CLICKED(IDC_USER_XOR, OnUserXor)
78 ON_BN_CLICKED(IDC_UUCP_ON, OnUucpOn)
79 ON_BN_CLICKED(IDC_UUCP_XOR, OnUucpXor)
80 ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn)
81 ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor)
82 ON_BN_CLICKED(IDC_AUTHPRIV_ON, OnAuthprivOn)
83 ON_BN_CLICKED(IDC_AUTHPRIV_XOR, OnAuthprivXor)
84 //}}AFX_MSG_MAP
85END_MESSAGE_MAP()
86
87/////////////////////////////////////////////////////////////////////////////
88// CLogPatternUnix message handlers
89
90void CLogPatternUnix::OnAlertOn()
91{
92 m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO);
93}
94void CLogPatternUnix::OnAlertXor()
95{
96 m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO);
97}
98
99void CLogPatternUnix::OnAuthOn()
100{
101 m_Daddy->FacilityOn(this,CSyslogSocket::facAuth);
102}
103void CLogPatternUnix::OnAuthXor()
104{
105 m_Daddy->FacilityXor(this,CSyslogSocket::facAuth);
106}
107
108void CLogPatternUnix::OnCritOn()
109{
110 m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO);
111}
112void CLogPatternUnix::OnCritXor()
113{
114m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO);
115}
116
117void CLogPatternUnix::OnCronOn()
118{
119 m_Daddy->FacilityOn(this,CSyslogSocket::facCron);
120}
121void CLogPatternUnix::OnCronXor()
122{
123 m_Daddy->FacilityXor(this,CSyslogSocket::facCron);
124}
125
126void CLogPatternUnix::OnDaemonOn()
127{
128 m_Daddy->FacilityOn(this,CSyslogSocket::facDaemon);
129}
130void CLogPatternUnix::OnDaemonXor()
131{
132 m_Daddy->FacilityXor(this,CSyslogSocket::facDaemon);
133}
134
135void CLogPatternUnix::OnDebugOn()
136{
137 m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO);
138}
139void CLogPatternUnix::OnDebugXor()
140{
141 m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO);
142}
143
144void CLogPatternUnix::OnEmergOn()
145{
146 m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO);
147}
148void CLogPatternUnix::OnEmergXor()
149{
150 m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO);
151}
152
153void CLogPatternUnix::OnErrOn()
154{
155 m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO);
156}
157void CLogPatternUnix::OnErrXor()
158{
159 m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO);
160}
161
162void CLogPatternUnix::OnInfoOn()
163{
164 m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO);
165}
166void CLogPatternUnix::OnInfoXor()
167{
168 m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO);
169}
170
171void CLogPatternUnix::OnKernelOn()
172{
173 m_Daddy->FacilityOn(this,CSyslogSocket::facKernel);
174}
175void CLogPatternUnix::OnKernelXor()
176{
177 m_Daddy->FacilityXor(this,CSyslogSocket::facKernel);
178}
179
180void CLogPatternUnix::OnLprOn()
181{
182 m_Daddy->FacilityOn(this,CSyslogSocket::facLPR);
183}
184void CLogPatternUnix::OnLprXor()
185{
186 m_Daddy->FacilityXor(this,CSyslogSocket::facLPR);
187}
188
189void CLogPatternUnix::OnMailOn()
190{
191 m_Daddy->FacilityOn(this,CSyslogSocket::facMail);
192}
193void CLogPatternUnix::OnMailXor()
194{
195 m_Daddy->FacilityXor(this,CSyslogSocket::facMail);
196}
197
198void CLogPatternUnix::OnNewsOn()
199{
200 m_Daddy->FacilityOn(this,CSyslogSocket::facNews);
201}
202void CLogPatternUnix::OnNewsXor()
203{
204 m_Daddy->FacilityXor(this,CSyslogSocket::facNews);
205}
206
207void CLogPatternUnix::OnNoticeOn()
208{
209 m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO);
210}
211void CLogPatternUnix::OnNoticeXor()
212{
213 m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO);
214}
215
216void CLogPatternUnix::OnSyslogOn()
217{
218 m_Daddy->FacilityOn(this,CSyslogSocket::facSyslog);
219}
220void CLogPatternUnix::OnSyslogXor()
221{
222 m_Daddy->FacilityXor(this,CSyslogSocket::facSyslog);
223}
224
225void CLogPatternUnix::OnUserOn()
226{
227 m_Daddy->FacilityOn(this,CSyslogSocket::facUser);
228}
229void CLogPatternUnix::OnUserXor()
230{
231 m_Daddy->FacilityXor(this,CSyslogSocket::facUser);
232}
233
234void CLogPatternUnix::OnUucpOn()
235{
236 m_Daddy->FacilityOn(this,CSyslogSocket::facUUCP);
237}
238void CLogPatternUnix::OnUucpXor()
239{
240 m_Daddy->FacilityXor(this,CSyslogSocket::facUUCP);
241}
242
243void CLogPatternUnix::OnWarnOn()
244{
245 m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO);
246}
247void CLogPatternUnix::OnWarnXor()
248{
249 m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO);
250}
251
252void CLogPatternUnix::OnAuthprivOn()
253{
254 m_Daddy->FacilityOn(this,CSyslogSocket::facAuthPriv);
255}
256void CLogPatternUnix::OnAuthprivXor()
257{
258 m_Daddy->FacilityXor(this,CSyslogSocket::facAuthPriv);
259}
260
261BOOL CLogPatternUnix::OnInitDialog()
262{
263 CPropertyPage::OnInitDialog();
264
265 m_tooltip.Create(this);
266 m_tooltip.Activate(TRUE);
267 m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_ON),IDS_TIP_FACILITY_ON);
268 m_tooltip.AddTool(GetDlgItem(IDC_USER_ON),IDS_TIP_FACILITY_ON);
269 m_tooltip.AddTool(GetDlgItem(IDC_MAIL_ON),IDS_TIP_FACILITY_ON);
270 m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_ON),IDS_TIP_FACILITY_ON);
271 m_tooltip.AddTool(GetDlgItem(IDC_AUTH_ON),IDS_TIP_FACILITY_ON);
272 m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_ON),IDS_TIP_FACILITY_ON);
273 m_tooltip.AddTool(GetDlgItem(IDC_LPR_ON),IDS_TIP_FACILITY_ON);
274 m_tooltip.AddTool(GetDlgItem(IDC_NEWS_ON),IDS_TIP_FACILITY_ON);
275 m_tooltip.AddTool(GetDlgItem(IDC_UUCP_ON),IDS_TIP_FACILITY_ON);
276 m_tooltip.AddTool(GetDlgItem(IDC_CRON_ON),IDS_TIP_FACILITY_ON);
277 m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_ON),IDS_TIP_FACILITY_ON);
278
279 m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_XOR),IDS_TIP_FACILITY_XOR);
280 m_tooltip.AddTool(GetDlgItem(IDC_USER_XOR),IDS_TIP_FACILITY_XOR);
281 m_tooltip.AddTool(GetDlgItem(IDC_MAIL_XOR),IDS_TIP_FACILITY_XOR);
282 m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_XOR),IDS_TIP_FACILITY_XOR);
283 m_tooltip.AddTool(GetDlgItem(IDC_AUTH_XOR),IDS_TIP_FACILITY_XOR);
284 m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_XOR),IDS_TIP_FACILITY_XOR);
285 m_tooltip.AddTool(GetDlgItem(IDC_LPR_XOR),IDS_TIP_FACILITY_XOR);
286 m_tooltip.AddTool(GetDlgItem(IDC_NEWS_XOR),IDS_TIP_FACILITY_XOR);
287 m_tooltip.AddTool(GetDlgItem(IDC_UUCP_XOR),IDS_TIP_FACILITY_XOR);
288 m_tooltip.AddTool(GetDlgItem(IDC_CRON_XOR),IDS_TIP_FACILITY_XOR);
289 m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_XOR),IDS_TIP_FACILITY_XOR);
290
291 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON);
292 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON);
293 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON);
294 m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON);
295 m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON);
296 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON);
297 m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON);
298 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON);
299
300 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR);
301 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR);
302 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR);
303 m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR);
304 m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR);
305 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR);
306 m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR);
307 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR);
308
309 m_Daddy->AddTips(m_tooltip,this,PFROM,PTO);
310
311 return TRUE; // return TRUE unless you set the focus to a control
312 // EXCEPTION: OCX Property Pages should return FALSE
313}
314
315BOOL CLogPatternUnix::PreTranslateMessage(MSG* pMsg)
316{
317 m_tooltip.RelayEvent(pMsg);
318
319 return CPropertyPage::PreTranslateMessage(pMsg);
320}