Give mbox folders a null authentication object, mailbox_get_authority()
will now return one instead of suceeding, but not returning an object.
Showing
1 changed file
with
24 additions
and
0 deletions
... | @@ -102,6 +102,9 @@ static int folder_mbox_lsub __P ((folder_t, const char *, const char *, | ... | @@ -102,6 +102,9 @@ static int folder_mbox_lsub __P ((folder_t, const char *, const char *, |
102 | 102 | ||
103 | static char *get_pathname __P ((const char *, const char *)); | 103 | static char *get_pathname __P ((const char *, const char *)); |
104 | 104 | ||
105 | static int folder_mbox_get_authority __P ((folder_t folder, | ||
106 | authority_t * pauth)); | ||
107 | |||
105 | struct _fmbox | 108 | struct _fmbox |
106 | { | 109 | { |
107 | char *dirname; | 110 | char *dirname; |
... | @@ -116,6 +119,13 @@ _folder_mbox_init (folder_t folder) | ... | @@ -116,6 +119,13 @@ _folder_mbox_init (folder_t folder) |
116 | { | 119 | { |
117 | fmbox_t dfolder; | 120 | fmbox_t dfolder; |
118 | size_t name_len = 0; | 121 | size_t name_len = 0; |
122 | int status = 0; | ||
123 | |||
124 | /* We create an authority so the API is uniform across the mailbox | ||
125 | types. */ | ||
126 | status = folder_mbox_get_authority (folder, NULL); | ||
127 | if (status != 0) | ||
128 | return status; | ||
119 | 129 | ||
120 | dfolder = folder->data = calloc (1, sizeof (*dfolder)); | 130 | dfolder = folder->data = calloc (1, sizeof (*dfolder)); |
121 | if (dfolder == NULL) | 131 | if (dfolder == NULL) |
... | @@ -397,3 +407,17 @@ get_pathname (const char *dirname, const char *basename) | ... | @@ -397,3 +407,17 @@ get_pathname (const char *dirname, const char *basename) |
397 | } | 407 | } |
398 | return pathname; | 408 | return pathname; |
399 | } | 409 | } |
410 | |||
411 | static int | ||
412 | folder_mbox_get_authority (folder_t folder, authority_t *pauth) | ||
413 | { | ||
414 | int status = 0; | ||
415 | if (folder->authority == NULL) | ||
416 | { | ||
417 | status = authority_create_null (&folder->authority, folder); | ||
418 | } | ||
419 | if (!status && pauth) | ||
420 | *pauth = folder->authority; | ||
421 | return status; | ||
422 | } | ||
423 | ... | ... |
-
Please register or sign in to post a comment