Commit c9977805 c9977805b513f0fc12a050911e2b5056bd6502f7 by Sergey Poznyakoff

(_is_scheme, registrar_lookup): Take three arguments. All callers updated.

Raised path_record priority to 1000.
1 parent ad2da232
......@@ -36,8 +36,8 @@ struct _record
int (*_folder) __PMT ((folder_t));
void *data; /* back pointer. */
/* Stub functions to override. The defaut is to return the fields. */
int (*_is_scheme) __PMT ((record_t, const char *));
/* Stub functions to override. The default is to return the fields. */
int (*_is_scheme) __PMT ((record_t, const char *, int));
int (*_get_url) __PMT ((record_t, int (*(*_url)) __PMT ((url_t))));
int (*_get_mailbox) __PMT ((record_t, int (*(*_mailbox)) __PMT ((mailbox_t))));
int (*_get_mailer) __PMT ((record_t, int (*(*_mailer)) __PMT ((mailer_t))));
......@@ -48,15 +48,16 @@ struct _record
extern int registrar_get_iterator __P ((iterator_t *));
extern int registrar_get_list __P ((list_t *)) __attribute__ ((deprecated));
extern int registrar_lookup __P ((const char *name, record_t *precord));
extern int registrar_lookup __P ((const char *name, record_t *precord,
int flags));
extern int registrar_record __P ((record_t));
extern int unregistrar_record __P ((record_t));
/* Scheme. */
extern int record_is_scheme __P ((record_t, const char *));
extern int record_is_scheme __P ((record_t, const char *, int flags));
extern int record_set_scheme __P ((record_t, const char *));
extern int record_set_is_scheme __P ((record_t, int (*_is_scheme)
__PMT ((record_t, const char *))));
__PMT ((record_t, const char *, int))));
/* Url. */
extern int record_get_url __P ((record_t, int (*(*)) __PMT ((url_t))));
......@@ -110,7 +111,7 @@ extern record_t maildir_record;
#define MU_MH_PRIO 400
#define MU_MAILDIR_PRIO 500
#define MU_NNTP_PRIO 600
#define MU_PATH_PRIO 0
#define MU_PATH_PRIO 1000
#define MU_SMTP_PRIO 10000
#define MU_SENDMAIL_PRIO 10000
......
......@@ -89,23 +89,21 @@ registrar_get_iterator (iterator_t *pitr)
}
int
registrar_lookup (const char *name, record_t *precord)
registrar_lookup (const char *name, record_t *precord, int flags)
{
iterator_t iterator;
int status = registrar_get_iterator (&iterator);
if (status != 0)
return status;
status = MU_ERR_NOENT;
for (iterator_first (iterator); status != 0 && !iterator_is_done (iterator);
status = 0;
for (iterator_first (iterator); status == 0 && !iterator_is_done (iterator);
iterator_next (iterator))
{
record_t record;
iterator_current (iterator, (void **)&record);
if (record_is_scheme (record, name))
{
status = 0;
*precord = record;
}
status = record_is_scheme (record, name, flags);
if (status)
*precord = record;
}
iterator_destroy (&iterator);
return status;
......@@ -148,19 +146,19 @@ unregistrar_record (record_t record)
}
int
record_is_scheme (record_t record, const char *scheme)
record_is_scheme (record_t record, const char *scheme, int flags)
{
if (record == NULL)
return 0;
/* Overload. */
if (record->_is_scheme)
return record->_is_scheme (record, scheme);
return record->_is_scheme (record, scheme, flags);
if (scheme
&& record->scheme
&& strncasecmp (record->scheme, scheme, strlen (record->scheme)) == 0)
return 1;
return MU_FOLDER_ATTRIBUTE_ALL;
return 0;
}
......@@ -176,7 +174,7 @@ record_set_scheme (record_t record, const char *scheme)
int
record_set_is_scheme (record_t record, int (*_is_scheme)
__P ((record_t, const char *)))
__P ((record_t, const char *, int)))
{
if (record == NULL)
return EINVAL;
......