/* $Id: def_aliases.h,v 1.6 2006/04/09 07:37:30 hurtta Exp $ */

#include "headers.h"
#include "mboxlib.h"
#include "me.h"

#include "ndbz.h"

struct current_astorage {

    DBZ           *hash;        /* User or system hash */
    char          *filename;
    int           is_system;

    time_t        ctime;
    time_t        mtime;

    int            aliascount;

    int            max_aliases;	/* number of aliases allocated */
    struct alias_rec **aliases; /* for the alias menu */

};




#if ANSI_C
struct aliasclass;
#endif

#define ALIASVIEW_magic         0xF600
#define ALIASTYPE_magic         0xF601

typedef void                at_init_aliasclass P_((struct aliasclass *c));
typedef void                at_free_aliasclass P_((struct aliasclass *c));
typedef struct alias_rec  * at_aliasclass_give_alias P_((struct aliasclass *c,
							 int index));

typedef int                 at_update_aliasclass P_((struct aliasclass *c));
typedef int                 at_get_count_aliasclass P_((struct aliasclass *c));

extern struct alias_type {
    unsigned short            magic;      /* ALIASTYPE_magic */
    
    at_init_aliasclass                 * at_init_it;
    at_free_aliasclass                 * at_free_it;
    at_aliasclass_give_alias           * at_it_give_alias;
    at_update_aliasclass               * at_update_it;
    at_get_count_aliasclass            * at_get_count_it;

} at_astorage;

struct AliasView {
    unsigned short            magic;      /* ALIASVIEW_magic */
    
    
    int             aliasclasscount;
    struct aliasclass {
	struct alias_type  *atype;
	union {
	    void                       * dummy;
	    struct current_astorage    * astorage;
	} p;
    }               *aliasclass;      /* Array */
    
    struct alias_view      * view;
    int                      view_len;

    int                      normal_alias_len;


    /* Values set by caller */
    int        current;
    int        selected;



};


extern struct aliasclass * add_aliasclass P_((struct AliasView *x, 
				       struct alias_type *t));

extern int at_update_astorage P_((struct aliasclass *c));

extern void set_astorage_alias P_((struct current_astorage *astorage,
				   int index,
				   struct alias_rec * rec));
extern struct alias_rec  * at_astorage_give_alias P_((struct aliasclass *c,
						      int index));

/* src/aliases/ */

extern void reset_astorage P_((struct current_astorage *astorage));

extern void realloc_aliases P_((struct current_astorage *astorage,
				int current_count));

/*
 * Local Variables:
 *  mode:c
 *  c-basic-offset:4
 *  buffer-file-coding-system: iso-8859-1
 * End:
 */


syntax highlighted by Code2HTML, v. 0.9.1