From 39bb4331674cc77560a546f4f9b14b143603d4be Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Thu, 02 Feb 2006 23:07:50 +0000 Subject: - version bump to 2.7 - year bump to 2006 - ip-based access control - server switchable off - logging to file git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@144 fe716a7a-6dde-0310-88d9-d003556173a8 --- (limited to 'ACLTargetCombo.cpp') diff --git a/ACLTargetCombo.cpp b/ACLTargetCombo.cpp new file mode 100644 index 0000000..cdbd075 --- a/dev/null +++ b/ACLTargetCombo.cpp @@ -0,0 +1,85 @@ +// ACLTargetCombo.cpp : implementation file +// + +#include "stdafx.h" +#include "PumpKIN.h" +#include "PumpKINDlg.h" +#include "ACLTargetCombo.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CACLTargetCombo + +CACLTargetCombo::CACLTargetCombo() +: m_op(-1) +{ +} + +CACLTargetCombo::~CACLTargetCombo() +{ +} + + +BEGIN_MESSAGE_MAP(CACLTargetCombo, CComboBox) + //{{AFX_MSG_MAP(CACLTargetCombo) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CACLTargetCombo message handlers + +void CACLTargetCombo::SetOp(int op) +{ + m_op=op; + ResetContent(); + switch(op) { + case tftp::opRRQ: + m_tmap.RemoveAll(); + SetItemData(m_tmap[acl_rule::rrqNone]=AddString("fallback to global"),acl_rule::rrqNone); + SetItemData(m_tmap[acl_rule::rrqDeny]=AddString("deny access"),acl_rule::rrqDeny); + SetItemData(m_tmap[acl_rule::rrqPrompt]=AddString("prompt"),acl_rule::rrqPrompt); + SetItemData(m_tmap[acl_rule::rrqGrant]=AddString("grant access"),CPumpKINDlg::rrqGrant); + SetCurSel(0); + EnableWindow(TRUE); + break; + case tftp::opWRQ: + m_tmap.RemoveAll(); + SetItemData(m_tmap[acl_rule::wrqNone]=AddString("fallback to global"),acl_rule::wrqNone); + SetItemData(m_tmap[acl_rule::wrqDeny]=AddString("deny access"),acl_rule::wrqDeny); + SetItemData(m_tmap[acl_rule::wrqPrompt]=AddString("prompt"),acl_rule::wrqPrompt); + SetItemData(m_tmap[acl_rule::wrqPromptIfExists]=AddString("prompt if file exists"),acl_rule::wrqPromptIfExists); + SetItemData(m_tmap[acl_rule::wrqGrant]=AddString("grant access"),acl_rule::wrqGrant); + SetCurSel(0); + EnableWindow(TRUE); + break; + default: + EnableWindow(FALSE); + break; + } +} + +int CACLTargetCombo::GetTarget() +{ + int cs=GetCurSel(); + if(cs==CB_ERR) + return -1; + return GetItemData(cs); +} + +void CACLTargetCombo::SetTarget(int t,int op) +{ + if(op>=0) + SetOp(op); + ASSERT(m_op>=0); + int i; + if(m_tmap.Lookup(t,i)) + SetCurSel(i); + else + SetCurSel(0); +} -- cgit v0.9.0.2