mbox-mail.c revision 18565c69efcd7db003dbf27cf625ed822e889fb1
7cb128dc4cae2a03a742f63ba7afee23c78e3af0Phil Carmody/* Copyright (C) 2003 Timo Sirainen */
64510d2cc23a79d2142030bf5bade44baa490db3Timo Sirainenstatic int mbox_mail_seek(struct index_mail *mail)
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen mail->ibox->mbox_mail_lock_id = ibox->mbox_lock_id;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen ret = mail_index_lookup_extra(ibox->view, mail->mail.seq,
7e50cca6b1dab5a7e2a90a8949678c62f4a0958aTimo Sirainen if (istream_raw_mbox_seek(ibox->mbox_stream, offset) < 0) {
d9076f5939edf5d20a261494b1a861dcbb0d32e2Timo Sirainen "Cached message offset %s is invalid for mbox file %s",
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenstatic const struct mail_full_flags *mbox_mail_get_flags(struct mail *_mail)
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen /*FIXME:struct index_mail *mail = (struct index_mail *)_mail;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen struct index_mail_data *data = &mail->data;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen i_assert(_mail->seq <= mail->ibox->mbox_data_count);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen (void)index_mail_get_flags(_mail);
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen if ((mail->ibox->mbox_data[_mail->seq-1] & 1) != 0)
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen data->flags.flags |= MAIL_RECENT;
c69a255a68103a50fa3f04a527281a169075403fTimo Sirainen return &data->flags;*/
db24d60c306c9d477392ff5b61cb3fc95fef3bb7Timo Sirainenstatic time_t mbox_mail_get_received_date(struct mail *_mail)
0f66f12eb4cdbf47670975044c88d8f388bf92dfTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
7e50cca6b1dab5a7e2a90a8949678c62f4a0958aTimo Sirainen istream_raw_mbox_get_received_time(mail->ibox->mbox_stream);
7e50cca6b1dab5a7e2a90a8949678c62f4a0958aTimo Sirainen /* it's broken and conflicts with our "not found"
7e50cca6b1dab5a7e2a90a8949678c62f4a0958aTimo Sirainen return value. change it. */
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen index_mail_cache_add(mail, MAIL_CACHE_RECEIVED_DATE,
687d1dee0e92229232aa8be416897b640df67d07Timo Sirainenstatic const char *
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainenmbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field)
687d1dee0e92229232aa8be416897b640df67d07Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
87b426af6a2365c6840b14281a98c23e903bf28eTimo Sirainen return istream_raw_mbox_get_sender(mail->ibox->mbox_stream);
4e2d7dd2b201ae2083b6637d7ec0d37f49faca45Timo Sirainenstatic struct istream *mbox_mail_get_stream(struct mail *_mail,
4e2d7dd2b201ae2083b6637d7ec0d37f49faca45Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen // FIXME: need to hide the headers
dabb4cec4cf9bdb34013de682b08f1284cfb670fTimo Sirainen offset = istream_raw_mbox_get_header_offset(raw_stream);
687d1dee0e92229232aa8be416897b640df67d07Timo Sirainen raw_stream = i_stream_create_limit(default_pool, raw_stream,
050975ee630c761ab237fce7b8f84fe189bb02d2Timo Sirainen return index_mail_init_stream(mail, hdr_size, body_size);
dabb4cec4cf9bdb34013de682b08f1284cfb670fTimo Sirainen 0, 0, 0, 0, 0, 0,