/*
 * Copyright (C) 2023-2025 Hasl Developers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

#ifndef HASL_SASLNAME_H
#define HASL_SASLNAME_H

#include <glib.h>

#include <hasl/haslversion.h>

G_BEGIN_DECLS

/**
 * hasl_saslname_encode:
 * @saslname: the name to encode
 *
 * Encodes the given saslname.
 *
 * Encoding replaces `,`'s with `=2C` and `=`'s with `=3D`.
 *
 * Returns: (transfer full): The encoded string.
 *
 * Since: 0.5
 */
HASL_AVAILABLE_IN_0_5
char *hasl_saslname_encode(const char *saslname);

/**
 * hasl_saslname_decode:
 * @saslname: the name to decode
 *
 * Decodes the given saslname.
 *
 * Decoding replaces '=2C' with `,` and `=3D` with `=`.
 *
 * RFC 5801 and RFC 5802 aren't very clear on how to handle `=`'s that aren't
 * escape sequences so we just drop all unescaped `=`'s and `,`'s.
 *
 * Returns: (transfer full): The decoded string.
 *
 * Since: 0.5
 */
HASL_AVAILABLE_IN_0_5
char *hasl_saslname_decode(const char *saslname);

G_END_DECLS

#endif /* HASL_SASLNAME_H */
