diff options
author | Paul Stevens <paul@nfg.nl> | 2007-10-24 08:48:33 +0000 |
---|---|---|
committer | Paul Stevens <paul@nfg.nl> | 2007-10-24 08:48:33 +0000 |
commit | 1be26df6160169f3d6b483b70f820c4fe629d41c (patch) | |
tree | ffd57d2d5b36d1da345ac1ca25588d6b9927aaf0 | |
parent | 1700e8f17580b7e2531a5eadf9a9ee8cb5561c91 (diff) |
rename msginfo_t to MessageInfo and mailbox_t to MailboxInfo
git-svn-id: https://svn.ic-s.nl/svn/dbmail/trunk/dbmail@2817 7b491191-dbf0-0310-aff6-d879d4d69008
-rw-r--r-- | acl.c | 6 | ||||
-rw-r--r-- | acl.h | 2 | ||||
-rw-r--r-- | check_dbmail_db.c | 10 | ||||
-rw-r--r-- | check_dbmail_imapd.c | 2 | ||||
-rw-r--r-- | db.c | 36 | ||||
-rw-r--r-- | db.h | 20 | ||||
-rw-r--r-- | dbmail-imapsession.c | 32 | ||||
-rw-r--r-- | dbmail-imapsession.h | 4 | ||||
-rw-r--r-- | dbmailtypes.h | 131 | ||||
-rw-r--r-- | imap4.c | 15 | ||||
-rw-r--r-- | imap4.h | 2 | ||||
-rw-r--r-- | imapcommands.c | 20 | ||||
-rw-r--r-- | misc.c | 2 | ||||
-rw-r--r-- | misc.h | 2 | ||||
-rw-r--r-- | sort.c | 2 |
15 files changed, 134 insertions, 152 deletions
@@ -52,7 +52,7 @@ static int acl_get_rightsstring(u64_t userid, u64_t mboxid, /*@out@*/ char *rightsstring); -int acl_has_right(mailbox_t *mailbox, u64_t userid, ACLRight_t right) +int acl_has_right(MailboxInfo *mailbox, u64_t userid, ACLRight_t right) { u64_t anyone_userid; int test; @@ -331,7 +331,7 @@ int acl_get_rightsstring(u64_t userid, u64_t mboxid, char *rightsstring) { int result; u64_t owner_idnr; - mailbox_t mailbox; + MailboxInfo mailbox; struct ACLMap map; assert(rightsstring); @@ -346,7 +346,7 @@ int acl_get_rightsstring(u64_t userid, u64_t mboxid, char *rightsstring) return 1; } - memset(&mailbox, '\0', sizeof(mailbox_t)); + memset(&mailbox, '\0', sizeof(MailboxInfo)); memset(&map, '\0', sizeof(struct ACLMap)); mailbox.uid = mboxid; @@ -44,7 +44,7 @@ * - 0 if no right * - 1 if user has this right */ -int acl_has_right(mailbox_t *mailbox, u64_t userid, ACLRight_t right); +int acl_has_right(MailboxInfo *mailbox, u64_t userid, ACLRight_t right); /** * \brief sets new rights to a mailbox for a user. diff --git a/check_dbmail_db.c b/check_dbmail_db.c index 2b127294..33b8ab3b 100644 --- a/check_dbmail_db.c +++ b/check_dbmail_db.c @@ -873,20 +873,20 @@ START_TEST(test_db_findmailbox_by_regex) END_TEST /** * \brief get info on a mailbox. Info is filled in in the - * mailbox_t struct. - * \param mb the mailbox_t to fill in. (mb->uid needs to be + * MailboxInfo struct. + * \param mb the MailboxInfo to fill in. (mb->uid needs to be * set already! * \return * - -1 on failure * - 0 on success */ -//int db_getmailbox(mailbox_t * mb); +//int db_getmailbox(MailboxInfo * mb); START_TEST(test_db_getmailbox) { int res; - mailbox_t mb; - memset(&mb,0,sizeof(mailbox_t)); + MailboxInfo mb; + memset(&mb,0,sizeof(MailboxInfo)); mb.uid = get_mailbox_id("INBOX"); diff --git a/check_dbmail_imapd.c b/check_dbmail_imapd.c index 8a4c6f52..b9cdb389 100644 --- a/check_dbmail_imapd.c +++ b/check_dbmail_imapd.c @@ -186,7 +186,7 @@ END_TEST //struct ImapSession * dbmail_imap_session_setTag(struct ImapSession * self, char * tag); //struct ImapSession * dbmail_imap_session_setCommand(struct ImapSession * self, char * command); //struct ImapSession * dbmail_imap_session_setArgs(struct ImapSession * self, char ** args); -//struct ImapSession * dbmail_imap_session_setMsginfo(struct ImapSession * self, msginfo_t * msginfo); +//struct ImapSession * dbmail_imap_session_setMsginfo(struct ImapSession * self, MessageInfo * msginfo); //struct ImapSession * dbmail_imap_session_resetFi(struct ImapSession * self); //void dbmail_imap_session_delete(struct ImapSession * self); //int dbmail_imap_session_readln(struct ImapSession * self, char * buffer); @@ -278,7 +278,7 @@ int db_rollback_transaction() int mailbox_is_writable(u64_t mailbox_idnr) { - mailbox_t mb; + MailboxInfo mb; memset(&mb,'\0', sizeof(mb)); mb.uid = mailbox_idnr; @@ -1765,9 +1765,9 @@ int db_set_isheader(GList *lost) while(slices) { snprintf(query, DEF_QUERYSIZE, "UPDATE %smessageblks" - " SET is_header = %u" + " SET is_header = 1" " WHERE messageblk_idnr IN (%s)", - DBPFX, HEAD_BLOCK, (gchar *)slices->data); + DBPFX, (gchar *)slices->data); if (db_query(query) == -1) { TRACE(TRACE_ERROR, "could not access messageblks table"); @@ -2921,7 +2921,7 @@ int db_findmailbox_by_regex(u64_t owner_idnr, const char *pattern, return DM_SUCCESS; } -int db_getmailbox_flags(mailbox_t *mb) +int db_getmailbox_flags(MailboxInfo *mb) { char query[DEF_QUERYSIZE]; memset(query,0,DEF_QUERYSIZE); @@ -2967,7 +2967,7 @@ int db_getmailbox_flags(mailbox_t *mb) return DM_SUCCESS; } -int db_getmailbox_count(mailbox_t *mb) +int db_getmailbox_count(MailboxInfo *mb) { unsigned exists = 0, seen = 0, recent = 0; char query[DEF_QUERYSIZE]; @@ -3027,7 +3027,7 @@ int db_getmailbox_count(mailbox_t *mb) return DM_SUCCESS; } -int db_getmailbox_keywords(mailbox_t *mb) +int db_getmailbox_keywords(MailboxInfo *mb) { int i, rows; const char *key; @@ -3065,7 +3065,7 @@ int db_getmailbox_keywords(mailbox_t *mb) return DM_SUCCESS; } -int db_getmailbox_mtime(mailbox_t * mb) +int db_getmailbox_mtime(MailboxInfo * mb) { char q[DEF_QUERYSIZE]; char t[DEF_FRAGSIZE]; @@ -3097,7 +3097,7 @@ int db_getmailbox_mtime(mailbox_t * mb) } -int db_getmailbox(mailbox_t * mb) +int db_getmailbox(MailboxInfo * mb) { int res; time_t oldmtime; @@ -3222,8 +3222,8 @@ int db_imap_split_mailbox(const char *mailbox, u64_t owner_idnr, } /* Prepend a mailbox struct onto the list. */ - mailbox_t *mbox; - mbox = g_new0(mailbox_t, 1); + MailboxInfo *mbox; + mbox = g_new0(MailboxInfo, 1); *mailboxes = g_list_prepend(*mailboxes, mbox); /* If the mboxid is 0, then we know @@ -3261,7 +3261,7 @@ egeneral: GList *tmp; tmp = g_list_first(*mailboxes); while (tmp) { - mailbox_t *mbox = (mailbox_t *)tmp->data; + MailboxInfo *mbox = (MailboxInfo *)tmp->data; if (mbox) { g_free(mbox->name); g_free(mbox); @@ -3328,7 +3328,7 @@ int db_mailbox_create_with_parents(const char * mailbox, mailbox_source_t source mailbox_item = g_list_first(mailbox_list); while (mailbox_item) { - mailbox_t *mbox = (mailbox_t *)mailbox_item->data; + MailboxInfo *mbox = (MailboxInfo *)mailbox_item->data; /* Needs to be created. */ if (mbox->uid == 0) { @@ -3420,7 +3420,7 @@ int db_mailbox_create_with_parents(const char * mailbox, mailbox_source_t source mailbox_item = g_list_first(mailbox_list); while (mailbox_item) { - mailbox_t *mbox = (mailbox_t *)mailbox_item->data; + MailboxInfo *mbox = (MailboxInfo *)mailbox_item->data; g_free(mbox->name); g_free(mbox); mailbox_item = g_list_next(mailbox_item); @@ -4215,7 +4215,7 @@ int db_get_msgflag(const char *flag_name, u64_t msg_idnr, return val; } -static int db_set_msgkeywords(u64_t msg_idnr, GList *keywords, int action_type, msginfo_t *msginfo) +static int db_set_msgkeywords(u64_t msg_idnr, GList *keywords, int action_type, MessageInfo *msginfo) { char *safe; char query[DEF_QUERYSIZE]; @@ -4292,7 +4292,7 @@ static int db_set_msgkeywords(u64_t msg_idnr, GList *keywords, int action_type, return DM_SUCCESS; } -int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, GList *keywords, int action_type, msginfo_t *msginfo) +int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, GList *keywords, int action_type, MessageInfo *msginfo) { size_t i, pos = 0; char query[DEF_QUERYSIZE]; @@ -4343,7 +4343,7 @@ int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, GList *keywor return DM_SUCCESS; } -int db_acl_has_right(mailbox_t *mailbox, u64_t userid, const char *right_flag) +int db_acl_has_right(MailboxInfo *mailbox, u64_t userid, const char *right_flag) { int result; char query[DEF_QUERYSIZE]; @@ -4415,7 +4415,7 @@ static int acl_query(u64_t mailbox_idnr, u64_t userid) return DM_SUCCESS; } -int db_acl_get_acl_map(mailbox_t *mailbox, u64_t userid, struct ACLMap *map) +int db_acl_get_acl_map(MailboxInfo *mailbox, u64_t userid, struct ACLMap *map) { int i, result, test; u64_t anyone; @@ -4743,7 +4743,7 @@ int user_idnr_is_delivery_user_idnr(u64_t user_idnr) return DM_SUCCESS; } -int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, mailbox_t * mb) +int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, MailboxInfo * mb) { /* query mailbox for LIST results */ char *mbxname, *name; @@ -937,17 +937,17 @@ int db_findmailbox_by_regex(u64_t owner_idnr, const char *pattern, int only_subscribed); /** * \brief get info on a mailbox. Info is filled in in the - * mailbox_t struct. - * \param mb the mailbox_t to fill in. (mb->uid needs to be + * MailboxInfo struct. + * \param mb the MailboxInfo to fill in. (mb->uid needs to be * set already! * \return * - -1 on failure * - 0 on success */ -int db_getmailbox_flags(mailbox_t * mb); -int db_getmailbox_count(mailbox_t * mb); -int db_getmailbox_mtime(mailbox_t * mb); -int db_getmailbox(mailbox_t * mb); +int db_getmailbox_flags(MailboxInfo * mb); +int db_getmailbox_count(MailboxInfo * mb); +int db_getmailbox_mtime(MailboxInfo * mb); +int db_getmailbox(MailboxInfo * mb); /** * \brief find owner of a mailbox @@ -1212,7 +1212,7 @@ int db_get_msgflag(const char *flag_name, * - 0 on success */ int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, - GList *keywords, int action_type, msginfo_t *msginfo); + GList *keywords, int action_type, MessageInfo *msginfo); /** * \brief check if a user has a certain right to a mailbox @@ -1224,7 +1224,7 @@ int db_set_msgflag(u64_t msg_idnr, u64_t mailbox_idnr, int *flags, * - 0 if no right * - 1 if user has the right */ -int db_acl_has_right(mailbox_t *mailbox, u64_t user_idnr, const char *right_flag); +int db_acl_has_right(MailboxInfo *mailbox, u64_t user_idnr, const char *right_flag); /** * \brief get all permissions on a mailbox for a user * \param mailbox @@ -1232,7 +1232,7 @@ int db_acl_has_right(mailbox_t *mailbox, u64_t user_idnr, const char *right_flag * \param map result * */ -int db_acl_get_acl_map(mailbox_t *mailbox, u64_t userid, struct ACLMap *map); +int db_acl_get_acl_map(MailboxInfo *mailbox, u64_t userid, struct ACLMap *map); /** * \brief set one right in an acl for a user @@ -1281,7 +1281,7 @@ int db_acl_get_identifier(u64_t mboxid, char *date2char_str(const char *column); -int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, mailbox_t * mb); +int db_getmailbox_list_result(u64_t mailbox_idnr, u64_t user_idnr, MailboxInfo * mb); /* * db-user accessors diff --git a/dbmail-imapsession.c b/dbmail-imapsession.c index 3ad1910f..89c2eca2 100644 --- a/dbmail-imapsession.c +++ b/dbmail-imapsession.c @@ -252,7 +252,7 @@ struct ImapSession * dbmail_imap_session_setCommand(struct ImapSession * self, c } -static void _mbxinfo_keywords_destroy(u64_t UNUSED *id, mailbox_t *mb, gpointer UNUSED x) +static void _mbxinfo_keywords_destroy(u64_t UNUSED *id, MailboxInfo *mb, gpointer UNUSED x) { if (mb->keywords) g_list_destroy(mb->keywords); @@ -727,7 +727,7 @@ GTree * dbmail_imap_session_get_msginfo(struct ImapSession *self, GTree *ids) unsigned nrows, i, j, k; const char *query_result, *keyword; char *to_char_str; - msginfo_t *result; + MessageInfo *result; GTree *msginfo; GList *l, *t; u64_t *uid, *lo, *hi; @@ -793,7 +793,7 @@ GTree * dbmail_imap_session_get_msginfo(struct ImapSession *self, GTree *ids) if (! g_tree_lookup(ids,&id)) continue; - result = g_new0(msginfo_t,1); + result = g_new0(MessageInfo,1); /* id */ result->id = id; @@ -859,7 +859,7 @@ GTree * dbmail_imap_session_get_msginfo(struct ImapSession *self, GTree *ids) else \ dbmail_imap_session_buff_append(self, " ") -static gboolean _get_mailbox(u64_t UNUSED *id, mailbox_t *mb, struct ImapSession *self) +static gboolean _get_mailbox(u64_t UNUSED *id, MailboxInfo *mb, struct ImapSession *self) { int result; imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; @@ -884,7 +884,7 @@ void dbmail_imap_session_get_mbxinfo(struct ImapSession *self) GTree *mbxinfo = NULL; int i, r; u64_t *id; - mailbox_t *mb; + MailboxInfo *mb; char q[DEF_QUERYSIZE]; memset(q,0,DEF_QUERYSIZE); imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; @@ -904,7 +904,7 @@ void dbmail_imap_session_get_mbxinfo(struct ImapSession *self) for (i=0;i<r;i++) { id = g_new0(u64_t,1); - mb = g_new0(mailbox_t,1); + mb = g_new0(MailboxInfo,1); *id = db_get_result_u64(i,0); mb->uid = *id; @@ -938,7 +938,7 @@ static int _fetch_get_items(struct ImapSession *self, u64_t *uid) u64_t actual_cnt, tmpdumpsize; gchar *s = NULL; - msginfo_t *msginfo = g_tree_lookup(self->msginfo, uid); + MessageInfo *msginfo = g_tree_lookup(self->msginfo, uid); g_return_val_if_fail(msginfo,-1); @@ -1848,7 +1848,7 @@ int dbmail_imap_session_mailbox_check_acl(struct ImapSession * self, u64_t idnr, { int access; imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; - mailbox_t *mailbox; + MailboxInfo *mailbox; mailbox = dbmail_imap_session_mbxinfo_lookup(self, idnr); @@ -1882,10 +1882,10 @@ int dbmail_imap_session_mailbox_get_selectable(struct ImapSession * self, u64_t return 0; } -static gboolean imap_msginfo_notify(u64_t *uid, msginfo_t *msginfo, struct ImapSession *self) +static gboolean imap_msginfo_notify(u64_t *uid, MessageInfo *msginfo, struct ImapSession *self) { u64_t *msn; - msginfo_t *newmsginfo; + MessageInfo *newmsginfo; char *s; int i; @@ -1922,7 +1922,7 @@ static gboolean imap_msginfo_notify(u64_t *uid, msginfo_t *msginfo, struct ImapS return FALSE; } -static gboolean imap_mbxinfo_notify(u64_t UNUSED *id, mailbox_t *mb, struct ImapSession *self) +static gboolean imap_mbxinfo_notify(u64_t UNUSED *id, MailboxInfo *mb, struct ImapSession *self) { time_t oldmtime = mb->mtime; unsigned oldexists = mb->exists; @@ -2153,17 +2153,17 @@ int dbmail_imap_session_mailbox_show_info(struct ImapSession * self) return 0; } -mailbox_t * dbmail_imap_session_mbxinfo_lookup(struct ImapSession *self, u64_t mailbox_idnr) +MailboxInfo * dbmail_imap_session_mbxinfo_lookup(struct ImapSession *self, u64_t mailbox_idnr) { - mailbox_t *mb = NULL; + MailboxInfo *mb = NULL; u64_t *id; if (! self->mbxinfo) dbmail_imap_session_get_mbxinfo(self); /* fetch the cached mailbox metadata */ - if ((mb = (mailbox_t *)g_tree_lookup(self->mbxinfo, &mailbox_idnr)) == NULL) { - mb = g_new0(mailbox_t,1); + if ((mb = (MailboxInfo *)g_tree_lookup(self->mbxinfo, &mailbox_idnr)) == NULL) { + mb = g_new0(MailboxInfo,1); id = g_new0(u64_t,1); *id = mailbox_idnr; @@ -2318,7 +2318,7 @@ static int imap_session_update_recent(struct ImapSession *self) GList *slices, *topslices, *recent; char query[DEF_QUERYSIZE]; memset(query,0,DEF_QUERYSIZE); - msginfo_t *msginfo = NULL; + MessageInfo *msginfo = NULL; gchar *uid = NULL; u64_t id = 0; diff --git a/dbmail-imapsession.h b/dbmail-imapsession.h index c3282c57..bab6bf3b 100644 --- a/dbmail-imapsession.h +++ b/dbmail-imapsession.h @@ -29,7 +29,7 @@ struct ImapSession { GTree *headers; GTree *envelopes; GTree *msginfo; // cache msginfo - GTree *mbxinfo; // cache mailbox_t + GTree *mbxinfo; // cache MailboxInfo GList *recent; GList *ids_list; gpointer cmd; // command structure @@ -83,7 +83,7 @@ int dbmail_imap_session_prompt(struct ImapSession * self, char * prompt, char * void dbmail_imap_session_get_mbxinfo(struct ImapSession *self); -mailbox_t * dbmail_imap_session_mbxinfo_lookup(struct ImapSession *self, u64_t mailbox_idnr); +MailboxInfo * dbmail_imap_session_mbxinfo_lookup(struct ImapSession *self, u64_t mailbox_idnr); u64_t dbmail_imap_session_mailbox_get_idnr(struct ImapSession * self, const char * mailbox); int dbmail_imap_session_mailbox_check_acl(struct ImapSession * self, u64_t idnr, ACLRight_t right); diff --git a/dbmailtypes.h b/dbmailtypes.h index d7623b02..25c924d3 100644 --- a/dbmailtypes.h +++ b/dbmailtypes.h @@ -129,11 +129,38 @@ typedef struct { int (*ClientHandler) (clientinfo_t *); } ChildInfo_t; +typedef struct { + int no_daemonize; + int log_verbose; + char *pidFile; + char *stateFile; + int startChildren; + int minSpareChildren; + int maxSpareChildren; + int maxChildren; + int childMaxConnect; + int timeout; + int login_timeout; + char **iplist; // Allocated memory. + int ipcount; + int *listenSockets; // Allocated memory. + int service_before_smtp; + int port; + int backlog; + int resolveIP; + field_t serverUser, serverGroup; + field_t socket; + field_t log, error_log; + field_t pid_dir; + field_t state_dir; + int (*ClientHandler) (clientinfo_t *); +} serverConfig_t; + -/* - * structures used by POP mechanism - * - */ + +/********************************************************************** + * POP3 +**********************************************************************/ /** all virtual_ definitions are session specific * when a RSET occurs all will be set to the real values */ @@ -171,33 +198,34 @@ typedef enum { * struct for a POP3 session. */ typedef struct { - int error_count;/**< number of errors that have occured */ - Pop3State_t state; /**< current POP state */ - int was_apop; /**< 1 if session was session was apop (no plaintext password) */ + Pop3State_t state; /**< current POP state */ - int SessionResult; /**< what happened during the session */ + int error_count; /**< number of errors that have occured */ + int was_apop; /**< 1 if session was session was apop (no plaintext password) */ + int SessionResult; /**< what happened during the session */ char *username; char *password; + char *apop_stamp; /**< timestamp for APOP */ - char *apop_stamp; /**< timestamp for APOP */ - - u64_t useridnr; /**< Used by timsieved */ - - u64_t totalsize;/**< total size of messages */ + u64_t useridnr; /**< Used by timsieved */ + u64_t totalsize; /**< total size of messages */ u64_t virtual_totalsize; - u64_t totalmessages; /**< number of messages */ + u64_t totalmessages; /**< number of messages */ u64_t virtual_totalmessages; - struct dm_list messagelst; /** list of messages */ + struct dm_list messagelst; /** list of messages */ } PopSession_t; +/********************************************************************** + * IMAP + *********************************************************************/ + /* * define some IMAP symbols */ -#define IMAP_NFLAGS 6 enum IMAP_COMMAND_TYPES { IMAP_COMM_NONE, @@ -258,6 +286,16 @@ enum IMAP4_FLAGS { IMAPFLAG_RECENT = 0x20 }; +typedef enum { + IMAP_FLAG_SEEN, + IMAP_FLAG_ANSWERED, + IMAP_FLAG_DELETED, + IMAP_FLAG_FLAGGED, + IMAP_FLAG_DRAFT, + IMAP_FLAG_RECENT +} imap_flag_t; + + enum IMAP4_PERMISSION { IMAPPERM_READ = 0x01, IMAPPERM_READWRITE = 0x02 @@ -295,34 +333,6 @@ enum BODY_FETCH_ITEM_TYPES { /* max length of number/dots part specifier */ #define IMAP_MAX_PARTSPEC_LEN 100 - -typedef struct { - int no_daemonize; - int log_verbose; - char *pidFile; - char *stateFile; - int startChildren; - int minSpareChildren; - int maxSpareChildren; - int maxChildren; - int childMaxConnect; - int timeout; - int login_timeout; - char **iplist; // Allocated memory. - int ipcount; - int *listenSockets; // Allocated memory. - int service_before_smtp; - int port; - int backlog; - int resolveIP; - field_t serverUser, serverGroup; - field_t socket; - field_t log, error_log; - field_t pid_dir; - field_t state_dir; - int (*ClientHandler) (clientinfo_t *); -} serverConfig_t; - /* * search data types */ @@ -412,26 +422,27 @@ typedef struct { gboolean is_inbox; // reference dbmail_keywords GList *keywords; -} mailbox_t; +} MailboxInfo; /* * cached message info */ +#define IMAP_NFLAGS 6 typedef struct { // map dbmail_messages - int flags[IMAP_NFLAGS]; - char internaldate[IMAP_INTERNALDATE_LEN]; u64_t id; u64_t mailbox_id; u64_t rfcsize; + int flags[IMAP_NFLAGS]; + char internaldate[IMAP_INTERNALDATE_LEN]; // reference dbmail_keywords GList *keywords; -} msginfo_t; - - -/************************************************************************/ +} MessageInfo; +/************************************************************************* +* SIEVE +*************************************************************************/ /* * A struct to hold info about a Sieve script @@ -440,13 +451,6 @@ typedef struct ssinfo { char *name; int active; } sievescript_info_t; - -/* messageblk types */ -typedef enum { - BODY_BLOCK = 0, - HEAD_BLOCK = 1 -} blocktype_t; - /* * A struct to say which Sieve allocations * will need an associated free. @@ -530,15 +534,4 @@ typedef enum { SQL_PARTIAL } sql_fragment_t; - -typedef enum { - IMAP_FLAG_SEEN, - IMAP_FLAG_ANSWERED, - IMAP_FLAG_DELETED, - IMAP_FLAG_FLAGGED, - IMAP_FLAG_DRAFT, - IMAP_FLAG_RECENT -} imap_flag_t; - - #endif @@ -62,14 +62,6 @@ const IMAP_COMMAND_HANDLER imap_handler_functions[] = { }; -imap_userdata_t * dbmail_imap_userdata_new(void) -{ - imap_userdata_t *ud; - ud = g_new0(imap_userdata_t,1); - ud->state = IMAPCS_NON_AUTHENTICATED; - return ud; -} - /* * Main handling procedure * @@ -80,17 +72,14 @@ int IMAPClientHandler(clientinfo_t * ci) char line[MAX_LINESIZE], *tag = NULL, *cpy, **args, *command; int done, result, readresult, nfaultyresponses, serr; size_t i; - imap_userdata_t *ud = NULL; struct ImapSession *session; session = dbmail_imap_session_new(); session->timeout = ci->login_timeout; dbmail_imap_session_setClientinfo(session,ci); - if (! (ud = dbmail_imap_userdata_new())) - return -1; - - session->ci->userData = ud; + session->ci->userData = g_new0(imap_userdata_t,1); + session->ci->userData->state = IMAPCS_NON_AUTHENTICATED; /* greet user */ field_t banner; @@ -87,7 +87,7 @@ typedef struct { typedef struct { int state; /* IMAP state of client */ u64_t userid; /* userID of client in dbase */ - mailbox_t *mailbox; /* currently selected mailbox */ + MailboxInfo *mailbox; /* currently selected mailbox */ } imap_userdata_t; imap_userdata_t * dbmail_imap_userdata_new(void); diff --git a/imapcommands.c b/imapcommands.c index 229d78dd..6d640f7d 100644 --- a/imapcommands.c +++ b/imapcommands.c @@ -696,7 +696,7 @@ int _ic_list(struct ImapSession *self) char *pattern; char *thisname = list_is_lsub ? "LSUB" : "LIST"; - mailbox_t *mb = NULL; + MailboxInfo *mb = NULL; GList * plist = NULL; gchar * pstring; @@ -743,7 +743,7 @@ int _ic_list(struct ImapSession *self) return 1; } - mb = g_new0(mailbox_t,1); + mb = g_new0(MailboxInfo,1); for (i = 0; i < nchildren; i++) { if ((db_getmailbox_list_result(children[i], ud->userid, mb) != 0)) @@ -804,7 +804,7 @@ int _ic_lsub(struct ImapSession *self) int _ic_status(struct ImapSession *self) { imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; - mailbox_t *mb; + MailboxInfo *mb; u64_t id; int i, endfound, result; GString *response; @@ -940,8 +940,8 @@ int _ic_append(struct ImapSession *self) int flaglist[IMAP_NFLAGS]; int flagcount = 0; GList *keywords = NULL; - mailbox_t *mailbox = NULL; - msginfo_t *msginfo = NULL; + MailboxInfo *mailbox = NULL; + MessageInfo *msginfo = NULL; memset(flaglist,0,sizeof(flaglist)); @@ -1507,7 +1507,7 @@ static gboolean _do_store(u64_t *id, gpointer UNUSED value, struct ImapSession * cmd_store_t *cmd = (cmd_store_t *)self->cmd; u64_t *msn; - msginfo_t *msginfo; + MessageInfo *msginfo; char *s; int i; @@ -1725,7 +1725,7 @@ int _ic_copy(struct ImapSession *self) imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; u64_t destmboxid; int result; - mailbox_t *destmbox; + MailboxInfo *destmbox; cmd_copy_t cmd; if (!check_state_and_args(self, "COPY", 2, 2, IMAPCS_SELECTED)) @@ -1960,7 +1960,7 @@ int _ic_setacl(struct ImapSession *self) int result; u64_t mboxid; u64_t targetuserid; - mailbox_t *mailbox; + MailboxInfo *mailbox; if (!check_state_and_args(self, "SETACL", 3, 3, IMAPCS_AUTHENTICATED)) return 1; @@ -2000,7 +2000,7 @@ int _ic_deleteacl(struct ImapSession *self) imap_userdata_t *ud = (imap_userdata_t *) self->ci->userData; u64_t mboxid; u64_t targetuserid; - mailbox_t *mailbox; + MailboxInfo *mailbox; if (!check_state_and_args(self, "DELETEACL", 2, 2, IMAPCS_AUTHENTICATED)) return 1; @@ -2069,7 +2069,7 @@ int _ic_listrights(struct ImapSession *self) u64_t mboxid; u64_t targetuserid; char *listrights_string; - mailbox_t *mailbox; + MailboxInfo *mailbox; if (!check_state_and_args(self, "LISTRIGHTS", 2, 2, IMAPCS_AUTHENTICATED)) return 1; @@ -2656,7 +2656,7 @@ char * imap_cleanup_address(const char *a) return r; } -char * imap_flags_as_string(msginfo_t *msginfo) +char * imap_flags_as_string(MessageInfo *msginfo) { GList *t, *sublist = NULL; int j; @@ -163,7 +163,7 @@ char * imap_get_logical_part(const GMimeObject *object, const char * specifier); char * imap_message_fetch_headers(u64_t physid, const GList *headers, gboolean not); -char * imap_flags_as_string(msginfo_t *msginfo); +char * imap_flags_as_string(MessageInfo *msginfo); char * imap_cleanup_address(const char *a); char * message_get_charset(GMimeMessage *self); @@ -150,7 +150,7 @@ dsn_class_t sort_deliver_to_mailbox(struct DbmailMessage *message, // we've looked up a #Public or a #Users mailbox. TRACE(TRACE_DEBUG, "Checking if we have the right to post incoming messages"); - mailbox_t mbox; + MailboxInfo mbox; memset(&mbox, '\0', sizeof(mbox)); mbox.uid = mboxidnr; |