Logo Search packages:      
Sourcecode: kcmpureftpd version File versions  Download package


                         script.h  - manage a script
    begin                : Sun Jul 27 2003
    copyright            : (C) 2003 by Claudiu Costin
    email                : claudiuc@kde.org

 *                                                                         *
 *   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.                                   *
 *                                                                         *

#ifndef __SCRIPT_H__
#define __SCRIPT_H__

#include <config.h>

#include <qstring.h>
#include <qstringlist.h>
#include <qmap.h>

#include <kconfig.h>
#include <klistview.h>

class AuthMethod {
    QString method, path;

class GuiData {

  QString address, port, pidfile;
  int maxclients, clientsperip;
  QString pureftpd, pureftpwho, puremrtginfo,
          pureauthd, purequotacheck, pureuploadscript,
          purepw, purepwconvert, purestatsdecode;
  QValueList<AuthMethod> authlist;
  int authtype;
  bool anonlogin, allowmkdir, ftpuserdeny, denyupload,
       anonreaddotfiles, nonanonlogin, readdotfiles,
       writedotfiles, restrictedip;
  QString loginip;
  bool disablechmod, usechrootall, usechroot, useuidlogin;
  int chrootgid, uidlogin, idletime, maxfiles, maxdepth,
      filesumask, dirsumask, debug;
  bool usesyslog, logpid, usefilelog, resolve;
  int facility, logformat;
  QString pathlog;
  bool useportrange, usequota, usedisklimit, useloadlimit;
  int portlow, porthigh, quotamaxfiles, quotamaxsize,
      diskpercent, grpbandwidth, bandupload, banddownload,
      grpratio, ratioupload, ratiodownload;
  double systemload;
  bool onlyipv4, activeftp, usepassiveip, useuploadscript,
       allowresume, createhomedir, usefortunes,
       neveroverwrite, norename, customerproof, enableworkarounds,
       fxpeveryone, fxpnonanonym;
  QString passiveip, fortunesfile;

class ScriptItem {

    ScriptItem() : m_id(QString::null), m_title(QString::null), m_description(QString::null),
                   m_outputfile(QString::null), m_outputfilemode(0), m_scriptfile(QString::null),
                   m_changed(false), m_li(0L)
    ScriptItem(const ScriptItem &item) :
                   m_id(item.m_id), m_title(item.m_title), m_description(item.m_description),
                   m_outputfile(item.m_outputfile), m_outputfilemode(item.m_outputfilemode),
                   m_guidata(item.m_guidata), m_changed(item.m_changed),
    ScriptItem(const QString &id, const QString &title, const QString &description,
               const QString &outputfile, int outputfilemode, const QString &scriptfile,
               const QString &templateid,
               GuiData guidata, bool changed) :
               m_id(id), m_title(title), m_description(description),
               m_outputfile(outputfile), m_outputfilemode(outputfilemode),
               m_guidata(guidata), m_changed(changed)

    QString id();
    QString title();
    QString description();
    QString outputfile();
    int outputfilemode();
    QString scriptfile();
    QString templateid();
    bool isChanged();
    GuiData guidata();

    void setId(const QString &t);
    void setTitle(const QString &t);
    void setDescription(const QString &t);
    void setOutputFile(const QString &t);
    void setOutputFileMode(int t);
    void setScriptFile(const QString &t);
    void setTemplateId(const QString &t);
    void setChanged(bool t);
    void setGuiData(const GuiData t);
    KListViewItem *li();
    void setLi(KListViewItem *t);

    QString m_id, m_title, m_description, m_outputfile;
    int m_outputfilemode;
    QString m_scriptfile, m_templateid;
    GuiData m_guidata;
    bool m_changed;
    KListViewItem *m_li;

typedef QMap<QString,ScriptItem> ScriptItemMap;
typedef ScriptItemMap::Iterator ScriptItemIterator;

class Script {
    enum IOStatus {
        LoadOk,       // the script was successfully loaded in the m_map
        SaveOk,       // the script was successfully saved on disk
        ParseError,   // there was an error parsing XML script file
        OpenError,    // error while trying to open the script file
        ReadError,    // error during reading the script file
        WriteError,   // error during writing the script file
        DataError     // invalid data found in the XML script file
    enum AuthMethodOption {
      NoPath,         // the authentication method have no associated path
      WithPath        // the authentication method must have associated path with it

    ScriptItemMap& map();
    IOStatus load(ScriptItem &i, const QString &scriptfile, QString &readid);
    void loadAll();
    IOStatus save(ScriptItem &item);
    void saveAll();
    void clear();
    ScriptItemIterator begin();
    ScriptItemIterator end();
    int count();
    QMap<QString,AuthMethodOption> authMethods() const;

    ScriptItemMap m_map;
    QMap<QString,AuthMethodOption> m_authmethods;


Generated by  Doxygen 1.6.0   Back to index