"Fossies" - the Fresh Open Source Software Archive

Member "citadel/msgbase.h" (5 Jun 2021, 8713 Bytes) of package /linux/www/citadel.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "msgbase.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 9.01_vs_902.

    1 
    2 #ifndef MSGBASE_H
    3 #define MSGBASE_H
    4 
    5 enum {
    6     MSGS_ALL,
    7     MSGS_OLD,
    8     MSGS_NEW,
    9     MSGS_FIRST,
   10     MSGS_LAST,
   11     MSGS_GT,
   12     MSGS_EQ,
   13     MSGS_SEARCH,
   14     MSGS_LT
   15 };
   16 
   17 enum {
   18     MSG_HDRS_BRIEF = 0,
   19     MSG_HDRS_ALL = 1,
   20     MSG_HDRS_EUID = 4,
   21     MSG_HDRS_BRIEFFILTER = 8,
   22     MSG_HDRS_THREADS = 9
   23 };
   24 
   25 /*
   26  * Possible return codes from CtdlOutputMsg()
   27  */
   28 enum {
   29     om_ok,
   30     om_not_logged_in,
   31     om_no_such_msg,
   32     om_mime_error,
   33     om_access_denied
   34 };
   35 
   36 /*
   37  * Values of "headers_only" when calling message output routines
   38  */
   39 #define HEADERS_ALL 0   /* Headers and body */
   40 #define HEADERS_ONLY    1   /* Headers only */
   41 #define HEADERS_NONE    2   /* Body only */
   42 #define HEADERS_FAST    3   /* Headers only with no MIME info */
   43 
   44 
   45 struct ma_info {
   46     int is_ma;      /* Set to 1 if we are using this stuff */
   47     int freeze;     /* Freeze the replacement chain because we're
   48                  * digging through a subsection */
   49     int did_print;      /* One alternative has been displayed */
   50     char chosen_part[128];  /* Which part of a m/a did we choose? */
   51     int chosen_pref;    /* Chosen part preference level (lower is better) */
   52     int use_fo_hooks;   /* Use fixed output hooks */
   53     int dont_decode;        /* should we call the decoder or not? */
   54 };
   55 
   56 
   57 struct repl {           /* Info for replication checking */
   58     char exclusive_id[SIZ];
   59     time_t highest;
   60 };
   61 
   62 
   63 /*
   64  * This is a list of "harvested" email addresses that we might want to
   65  * stick into someone's address book.  But we defer this operaiton so
   66  * it can be done asynchronously.
   67  */
   68 struct addresses_to_be_filed {
   69     struct addresses_to_be_filed *next;
   70     char *roomname;
   71     char *collected_addresses;
   72 };
   73 
   74 extern struct addresses_to_be_filed *atbf;
   75 
   76 int GetFieldFromMnemonic(eMsgField *f, const char* c);
   77 void memfmout (char *mptr, const char *nl);
   78 void output_mime_parts(char *);
   79 long send_message (struct CtdlMessage *);
   80 void loadtroom (void);
   81 long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, const char *);
   82 long quickie_message(const char *from, const char *fromaddr, const char *to, char *room, const char *text, int format_type, const char *subject);
   83 void GetMetaData(struct MetaData *, long);
   84 void PutMetaData(struct MetaData *);
   85 void AdjRefCount(long, int);
   86 void TDAP_AdjRefCount(long, int);
   87 int TDAP_ProcessAdjRefCountQueue(void);
   88 void simple_listing(long, void *);
   89 int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template);
   90 typedef void (*ForEachMsgCallback)(long MsgNumber, void *UserData);
   91 int CtdlForEachMessage(int mode,
   92             long ref,
   93             char *searchstring,
   94             char *content_type,
   95             struct CtdlMessage *compare,
   96                         ForEachMsgCallback CallBack,
   97             void *userdata);
   98 int CtdlDeleteMessages(const char *, long *, int, char *);
   99 void CtdlWriteObject(char *req_room,            /* Room to stuff it in */
  100             char *content_type,     /* MIME type of this object */
  101             char *raw_message,      /* Data to be written */
  102             off_t raw_length,       /* Size of raw_message */
  103             struct ctdluser *is_mailbox,    /* Mailbox room? */
  104             int is_binary,          /* Is encoding necessary? */
  105             int is_unique,          /* Del others of this type? */
  106             unsigned int flags      /* Internal save flags */
  107 );
  108 struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body);
  109 struct CtdlMessage * CM_Duplicate
  110                        (struct CtdlMessage *OrgMsg);
  111 int  CM_IsEmpty        (struct CtdlMessage *Msg, eMsgField which);
  112 void CM_SetField       (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
  113 void CM_SetFieldLONG   (struct CtdlMessage *Msg, eMsgField which, long lvalue);
  114 void CM_CopyField      (struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy);
  115 void CM_CutFieldAt     (struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen);
  116 void CM_FlushField     (struct CtdlMessage *Msg, eMsgField which);
  117 void CM_Flush          (struct CtdlMessage *Msg);
  118 void CM_SetAsField     (struct CtdlMessage *Msg, eMsgField which, char **buf, long length);
  119 void CM_SetAsFieldSB   (struct CtdlMessage *Msg, eMsgField which, StrBuf **buf);
  120 void CM_GetAsField     (struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen);
  121 void CM_PrependToField (struct CtdlMessage *Msg, eMsgField which, const char *buf, long length);
  122 
  123 void CM_Free           (struct CtdlMessage *msg);
  124 void CM_FreeContents   (struct CtdlMessage *msg);
  125 int  CM_IsValidMsg     (struct CtdlMessage *msg);
  126 
  127 #define CM_KEY(Message, Which) Message->cm_fields[Which], Message->cm_lengths[Which]
  128 #define CM_RANGE(Message, Which) Message->cm_fields[Which], \
  129         Message->cm_fields[Which] + Message->cm_lengths[Which]
  130 
  131 void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *);
  132 struct CtdlMessage *CtdlDeserializeMessage(long msgnum, int with_body, const char *Buffer, long Length);
  133 void ReplicationChecks(struct CtdlMessage *);
  134 int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newmsgs,
  135                   int do_repl_check, struct CtdlMessage *supplied_msg, int suppress_refcount_adj
  136 );
  137 int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
  138 long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid, int Reply);
  139 char *CtdlReadMessageBody(char *terminator, long tlen, size_t maxlen, StrBuf *exist, int crlf);
  140 StrBuf *CtdlReadMessageBodyBuf(
  141         char *terminator,   /* token signalling EOT */
  142         long tlen,
  143         size_t maxlen,      /* maximum message length */
  144         StrBuf *exist,      /* if non-null, append to it; exist is ALWAYS freed  */
  145         int crlf        /* CRLF newlines instead of LF */
  146 );
  147 
  148 int CtdlOutputMsg(long msg_num,     /* message number (local) to fetch */
  149         int mode,       /* how would you like that message? */
  150         int headers_only,   /* eschew the message body? */
  151         int do_proto,       /* do Citadel protocol responses? */
  152         int crlf,       /* 0=LF, 1=CRLF */
  153         char *section,      /* output a message/rfc822 section */
  154         int flags,      /* should the bessage be exported clean? */
  155         char **Author,      /* if you want to know the author of the message... */
  156         char **Address,     /* if you want to know the sender address of the message... */
  157         char **MessageID    /* if you want to know the Message-ID of the message... */
  158 );
  159 
  160 /* Flags which may be passed to CtdlOutputMsg() and CtdlOutputPreLoadedMsg() */
  161 #define QP_EADDR    (1<<0)      /* quoted-printable encode email addresses */
  162 #define CRLF        (1<<1)
  163 #define ESC_DOT     (1<<2)      /* output a line containing only "." as ".." instead */
  164 #define SUPPRESS_ENV_TO (1<<3)      /* suppress Envelope-to: header (warning: destructive!) */
  165 
  166 int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
  167                int mode,        /* how would you like that message? */
  168                int headers_only,    /* eschew the message body? */
  169                int do_proto,    /* do Citadel protocol responses? */
  170                int crlf,        /* 0=LF, 1=CRLF */
  171                int flags        /* should the bessage be exported clean? */
  172 );
  173 
  174 
  175 /* values for which_set */
  176 enum {
  177     ctdlsetseen_seen,
  178     ctdlsetseen_answered
  179 };
  180 
  181 void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
  182     int target_setting, int which_set,
  183     struct ctdluser *which_user, struct ctdlroom *which_room
  184 );
  185 
  186 void CtdlGetSeen(char *buf, int which_set);
  187 
  188 
  189 struct CtdlMessage *CtdlMakeMessage(
  190         struct ctdluser *author,        /* author's user structure */
  191         char *recipient,                /* NULL if it's not mail */
  192         char *recp_cc,                  /* NULL if it's not mail */
  193         char *room,                     /* room where it's going */
  194         int type,                       /* see MES_ types in header file */
  195         int format_type,                /* variformat, plain text, MIME... */
  196         char *fake_name,                /* who we're masquerading as */
  197     char *my_email,         /* which of my email addresses to use (empty is ok) */
  198         char *subject,                  /* Subject (optional) */
  199     char *supplied_euid,        /* ...or NULL if this is irrelevant */
  200         char *preformatted_text,        /* ...or NULL to read text from client */
  201     char *references        /* Thread references */
  202 );
  203 
  204 struct CtdlMessage *CtdlMakeMessageLen(
  205     struct ctdluser *author,    /* author's user structure */
  206     char *recipient,        /* NULL if it's not mail */
  207     long rcplen,
  208     char *recp_cc,          /* NULL if it's not mail */
  209     long cclen,
  210     char *room,         /* room where it's going */
  211     long roomlen,
  212     int type,           /* see MES_ types in header file */
  213     int format_type,        /* variformat, plain text, MIME... */
  214     char *fake_name,        /* who we're masquerading as */
  215     long fnlen,
  216     char *my_email,         /* which of my email addresses to use (empty is ok) */
  217     long myelen,
  218     char *subject,          /* Subject (optional) */
  219     long subjlen,
  220     char *supplied_euid,        /* ...or NULL if this is irrelevant */
  221     long euidlen,
  222     char *preformatted_text,    /* ...or NULL to read text from client */
  223     long textlen,
  224     char *references,       /* Thread references */
  225     long reflen
  226 );
  227 
  228 void AdjRefCountList(long *msgnum, long nmsg, int incr);
  229 
  230 #endif /* MSGBASE_H */