* mailbox/wicket.c (_get_ticket): Reset the buffer.
* mailbox/mailbox.c (mailbox_get_stream): Get the stream for the mailbox object if it is null try the folder. (mailbox_set_stream): Always set it on the mailbox object.
Showing
2 changed files
with
18 additions
and
4 deletions
1 | 2001-11-14 Alain Magloire | 1 | 2001-11-14 Alain Magloire |
2 | 2 | ||
3 | * mailbox/wicket.c (_get_ticket): Reset the buffer. | 3 | * mailbox/wicket.c (_get_ticket): Reset the buffer. |
4 | * mailbox/mailbox.c (mailbox_get_stream): Get the stream | ||
5 | for the mailbox object if it is null try the folder. | ||
6 | (mailbox_set_stream): Always set it on the mailbox object. | ||
4 | 7 | ||
5 | 2001-11-14 Alain Magloire | 8 | 2001-11-14 Alain Magloire |
6 | 9 | ... | ... |
... | @@ -314,23 +314,34 @@ mailbox_set_stream (mailbox_t mbox, stream_t stream) | ... | @@ -314,23 +314,34 @@ mailbox_set_stream (mailbox_t mbox, stream_t stream) |
314 | { | 314 | { |
315 | if (mbox == NULL) | 315 | if (mbox == NULL) |
316 | return EINVAL; | 316 | return EINVAL; |
317 | /* The stream is set on the folder if exist, not the mailbox. */ | ||
318 | if (mbox->folder) | ||
319 | return folder_set_stream (mbox->folder, stream); | ||
320 | if (mbox->stream) | 317 | if (mbox->stream) |
321 | stream_destroy (&(mbox->stream), mbox); | 318 | stream_destroy (&(mbox->stream), mbox); |
322 | mbox->stream = stream; | 319 | mbox->stream = stream; |
323 | return 0; | 320 | return 0; |
324 | } | 321 | } |
325 | 322 | ||
323 | /* FIXME: This is a problem. We provide a mailbox_get_stream () | ||
324 | and this stream is special it should, in theory, represent | ||
325 | a "view" of a flow of messages. But providing this perspective | ||
326 | may make sense for local mailboxes but downright impossible | ||
327 | for a remote mailbox, short on downloading the entire mailbox | ||
328 | locally. | ||
329 | The question is : should this function be removed? | ||
330 | So far it as been used on local mailboxes to get offsets. */ | ||
326 | int | 331 | int |
327 | mailbox_get_stream (mailbox_t mbox, stream_t *pstream) | 332 | mailbox_get_stream (mailbox_t mbox, stream_t *pstream) |
328 | { | 333 | { |
329 | if (mbox == NULL || pstream == NULL) | 334 | if (mbox == NULL || pstream == NULL) |
330 | return EINVAL; | 335 | return EINVAL; |
331 | /* The stream is set on the folder if exist, not the mailbox. */ | 336 | |
337 | /* If null two cases: | ||
338 | - it is no open yet. | ||
339 | - it a remote stream and the socket stream is on the folder. */ | ||
340 | if (mbox->stream == NULL) | ||
341 | { | ||
332 | if (mbox->folder) | 342 | if (mbox->folder) |
333 | return folder_get_stream (mbox->folder, pstream); | 343 | return folder_get_stream (mbox->folder, pstream); |
344 | } | ||
334 | *pstream = mbox->stream; | 345 | *pstream = mbox->stream; |
335 | return 0; | 346 | return 0; |
336 | } | 347 | } | ... | ... |
-
Please register or sign in to post a comment