pool_t pool, const char *key,
const char **value_r, const char **error_r)
{
- struct event *event = dict_event_create(dict, set);
const char *const *values;
+ int ret = dict_lookup_values(dict, set, pool, key, &values, error_r);
+ if (ret > 0)
+ *value_r = values[0];
+ else if (ret == 0)
+ *value_r = NULL;
+ return ret;
+}
+
+int dict_lookup_values(struct dict *dict, const struct dict_op_settings *set,
+ pool_t pool, const char *key,
+ const char *const **values_r, const char **error_r)
+{
+ struct event *event = dict_event_create(dict, set);
int ret;
i_assert(dict_key_prefix_is_valid(key, set->username));
e_debug(event, "Looking up '%s'", key);
event_add_str(event, "key", key);
- ret = dict->v.lookup(dict, set, pool, key, &values, error_r);
- if (ret > 0)
- *value_r = values[0];
- else if (ret == 0)
- *value_r = NULL;
+ ret = dict->v.lookup(dict, set, pool, key, values_r, error_r);
+ if (ret == 0)
+ *values_r = NULL;
dict_lookup_finished(event, ret, *error_r);
event_unref(&event);
return ret;
be waited on. */
bool dict_switch_ioloop(struct dict *dict) ATTR_NOWARN_UNUSED_RESULT;
-/* Lookup value for key. Set it to NULL if it's not found.
+/* Lookup the first value for the key. Set it to NULL if it's not found.
Returns 1 if found, 0 if not found and -1 if lookup failed. */
int dict_lookup(struct dict *dict, const struct dict_op_settings *set, pool_t pool,
const char *key, const char **value_r, const char **error_r);
+/* Lookup all the values for the key. Set it to NULL if it's not found.
+ Returns 1 if found, 0 if not found and -1 if lookup failed. */
+int dict_lookup_values(struct dict *dict, const struct dict_op_settings *set,
+ pool_t pool, const char *key,
+ const char *const **values_r, const char **error_r);
+/* Asynchronously lookup values for the key. */
void dict_lookup_async(struct dict *dict, const struct dict_op_settings *set,
const char *key, dict_lookup_callback_t *callback,
void *context);