lib/vdomain/vdomain.h
changeset 0 6f7a81934006
child 2 b3afb9f1e801
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     1 #ifndef VMAILMGR__VDOMAIN__H__
       
     2 #define VMAILMGR__VDOMAIN__H__
       
     3 
       
     4 #include "mystring/mystring.h"
       
     5 #include "config/configrc.h"
       
     6 #include "misc/pwentry.h"
       
     7 #include "vpwtable/vpwtable.h"
       
     8 #include "misc/response.h"
       
     9 
       
    10 class vdomain
       
    11 {
       
    12 public:
       
    13   const mystring subdir;
       
    14   const mystring prefix;
       
    15   const configuration config;
       
    16 private:
       
    17   vpwtable* ptable;
       
    18 
       
    19   // Helper functions for chattr
       
    20   response chpass(vpwentry*, mystring);
       
    21   response chdest(vpwentry*, mystring);
       
    22 public:
       
    23   vdomain(const pwentry&);
       
    24   vdomain(const pwentry&, mystring, mystring, const configuration&);
       
    25   ~vdomain();
       
    26 
       
    27   vpwtable* table();
       
    28   
       
    29   mystring userdir(mystring username) const;
       
    30 
       
    31   // Virtual user manipulation functions
       
    32   vpwentry* lookup(mystring name, bool nodefault);
       
    33   bool exists(mystring name);
       
    34   
       
    35   response set(const vpwentry*, bool onlyadd, mystring maildir = "");
       
    36   response chattr(mystring user, unsigned attr, mystring newval);
       
    37   response chattr(const vpwentry*, unsigned attr, mystring newval);
       
    38   response deluser(mystring name, bool del_mailbox);
       
    39 
       
    40   // Virtual user validation functions
       
    41   response validate_forward(mystring);
       
    42   bool validate_username(mystring) const;
       
    43   bool validate_password(mystring) const;
       
    44 
       
    45   static const unsigned ATTR_PASS = 1;
       
    46   static const unsigned ATTR_DEST = 2;
       
    47   static const unsigned ATTR_HARDQUOTA = 3;
       
    48   static const unsigned ATTR_SOFTQUOTA = 4;
       
    49   static const unsigned ATTR_MSGSIZE = 5;
       
    50   static const unsigned ATTR_MSGCOUNT = 6;
       
    51   static const unsigned ATTR_EXPIRY = 7;
       
    52   static const unsigned ATTR_MAILBOX_ENABLED = 8;
       
    53   static const unsigned ATTR_PERSONAL = 9;
       
    54 };
       
    55 
       
    56 #endif // VMAILMGR__VDOMAIN__H__