Back to index

webcit  8.12-dfsg
messages.h
Go to the documentation of this file.
00001 
00002 extern HashList *MsgHeaderHandler;
00003 extern HashList *MimeRenderHandler;
00004 extern HashList *ReadLoopHandler;
00005 typedef struct wc_mime_attachment wc_mime_attachment;
00006 typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset);
00007 typedef struct _RenderMimeFuncStruct {
00008        RenderMimeFunc f;
00009 } RenderMimeFuncStruct;
00010 
00011 struct wc_mime_attachment {
00012        int level;
00013        StrBuf *Name;
00014        StrBuf *FileName;
00015        StrBuf *PartNum;
00016        StrBuf *Disposition;
00017        StrBuf *ContentType;
00018        StrBuf *Charset;
00019        StrBuf *Data;
00020        size_t length;              /* length of the mimeattachment */
00021        long size_known;
00022        long lvalue;         /* if we put a long... */
00023        long msgnum;         /* the message number on the citadel server derived from message_summary */
00024        const RenderMimeFuncStruct *Renderer;
00025 };
00026 void DestroyMime(void *vMime);
00027 
00028 #define MSGFLAG_READ (1<<0)
00029 
00030 typedef struct _message_summary {
00031        long msgnum;         /* the message number on the citadel server */
00032        int Flags;
00033 
00034        time_t date;         /* its creation date */
00035        int nhdr;
00036        int format_type;
00037        StrBuf *euid;
00038        StrBuf *from;        /* the author */
00039        StrBuf *to;          /* the recipient */
00040        StrBuf *subj;        /* the title / subject */
00041        StrBuf *reply_inreplyto;
00042        StrBuf *reply_references;
00043        StrBuf *cccc;
00044        StrBuf *hnod;
00045        StrBuf *AllRcpt;
00046        StrBuf *Room;
00047        StrBuf *Rfca;
00048        StrBuf *OtherNode;
00049        const StrBuf *PartNum;
00050 
00051        HashList *Attachments;  /* list of attachments */
00052        HashList *Submessages;
00053        HashList *AttachLinks;
00054 
00055        HashList *AllAttach;
00056 
00057        int hasattachments;
00058 
00059 
00060        /* The mime part of the message */
00061        wc_mime_attachment *MsgBody;
00062 } message_summary;
00063 void DestroyMessageSummary(void *vMsg);
00064 
00065 
00066 
00067 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
00068 {
00069        const char *Key;
00070        long HKLen;
00071        void *vMsg;
00072 
00073        if (Summ == NULL)
00074               return NULL;
00075        GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
00076        return (message_summary*) vMsg;
00077 }
00078 
00079 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
00080 
00081 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
00082 
00083 
00084 typedef enum _eCustomRoomRenderer {
00085        eUseDefault = VIEW_JOURNAL + 100, 
00086        eReadEUIDS
00087 }eCustomRoomRenderer;
00088 
00089 enum {
00090        do_search,
00091        headers,
00092        readfwd,
00093        readnew,
00094        readold,
00095        readgt,
00096        readlt
00097 };
00098 
00106 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line, 
00107                                        const char **pos, 
00108                                        message_summary *Msg, 
00109                                        StrBuf *ConversionBuffer);
00110 
00111 typedef void (*readloop_servcmd)(char *buf, long bufsize);
00112 
00113 typedef struct _readloopstruct {
00114        ConstStr name;
00115        readloop_servcmd cmd;
00116 } readloop_struct;
00117 
00118 extern readloop_struct rlid[];
00119 
00120 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
00121 int read_message(StrBuf *Target, 
00122                const char *tmpl, long tmpllen, 
00123                long msgnum, 
00124                const StrBuf *section, 
00125                const StrBuf **OutMime);
00126 int load_message(message_summary *Msg, 
00127                StrBuf *FoundCharset,
00128                StrBuf **Error);
00129 
00130 
00131 
00132 
00133 typedef struct _SharedMessageStatus {
00134        long load_seen;        /* should read information be loaded */
00135        long sortit;           /* should we sort it using the standard sort API? */
00136        long defaultsortorder; /* if we should sort it, which direction should be the default? */
00137 
00138        long maxload;          /* how many headers should we accept from the server? defaults to 10k */
00139        long maxmsgs;          /* how many message bodies do you want to load at most?*/
00140 
00141        long startmsg;         /* which is the start message? */
00142        long nummsgs;          /* How many messages are available to your view? */
00143        long num_displayed;    /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
00144 
00145        long lowest_found;     /* smallest Message ID found;  */
00146        long highest_found;    /* highest Message ID found;  */
00147 
00148 } SharedMessageStatus;
00149 
00150 int load_msg_ptrs(const char *servcmd,
00151                 const char *filter,
00152                 SharedMessageStatus *Stat, 
00153                 load_msg_ptrs_detailheaders LH);
00154 
00155 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat, 
00156                                       void **ViewSpecific, 
00157                                       long oper, 
00158                                       char *cmd, 
00159                                       long len,
00160                                       char *filter,
00161                                       long flen);
00162 
00163 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
00164 
00165 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat, 
00166                                   void **ViewSpecific, 
00167                                   message_summary* Msg, 
00168                                   int is_new, 
00169                                   int i);
00170 
00171 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat, 
00172                                    void **ViewSpecific, 
00173                                    long oper);
00174 typedef int (*View_Cleanup_func)(void **ViewSpecific);
00175 
00176 void RegisterReadLoopHandlerset(
00180        int RoomType,
00181 
00192        GetParamsGetServerCall_func GetParamsGetServerCall,
00193 
00199        PrintViewHeader_func PrintPageHeader,
00200 
00206        PrintViewHeader_func PrintViewHeader,
00207 
00212        load_msg_ptrs_detailheaders LH,
00213 
00223        LoadMsgFromServer_func LoadMsgFromServer,
00224 
00231        RenderView_or_Tail_func RenderView_or_Tail,
00232 
00238        View_Cleanup_func ViewCleanup
00239        );
00240 /*
00241 GetParamsGetServerCall
00242 
00243 PrintViewHeader
00244 
00245 LoadMsgFromServer
00246 
00247 RenderView_or_Tail
00248 */
00249 
00250 
00251 int ParseMessageListHeaders_Detail(StrBuf *Line, 
00252                                const char **pos, 
00253                                message_summary *Msg, 
00254                                StrBuf *ConversionBuffer);
00255 
00256 
00257 
00265 void RegisterMimeRenderer(const char *HeaderName, long HdrNLen, 
00266                        RenderMimeFunc MimeRenderer,
00267                        int InlineRenderable,
00268                        int Priority);