}
}
+const char *
+master_service_connection_get_type(const struct master_service_connection *conn)
+{
+ i_assert(conn->type != NULL);
+ if (*conn->type != '\0')
+ return conn->type;
+
+ const char *name, *suffix;
+
+ name = strrchr(conn->name, '/');
+ if (name == NULL)
+ name = conn->name;
+ else
+ name++;
+
+ suffix = strrchr(name, '-');
+ if (suffix == NULL)
+ suffix = name;
+ else
+ suffix++;
+
+ return suffix;
+}
+
static void master_service_set_login_state(struct master_service *service,
enum master_login_state state)
{
void master_service_client_connection_created(struct master_service *service);
/* Call whenever a client connection is destroyed. */
void master_service_client_connection_destroyed(struct master_service *service);
+/* Returns the listener type for this connection. If the type is unassigned, the
+ connection name is parsed for a "-suffix" which is returned instead to easily
+ implement backwards compatibility for custom listeners that are still
+ configured without an explicit type. */
+const char *
+master_service_connection_get_type(
+ const struct master_service_connection *conn);
/* Deinitialize the service. */
void master_service_deinit(struct master_service **service);