+/* Resets the channel entry's resolve_cmd_ident after whatever-thing
+ was resolved is completed. */
+
+static void silc_client_channel_cond(void *context, void *context2)
+{
+ SilcClientNotifyResolve res = (SilcClientNotifyResolve)context;
+ SilcClient client = res->context;
+ SilcClientConnection conn = res->sock->user_data;
+ SilcChannelID *channel_id = res->packet;
+ SilcChannelEntry channel;
+ channel = silc_client_get_channel_by_id(client, conn, channel_id);
+ if (channel)
+ channel->resolve_cmd_ident = 0;
+ silc_free(channel_id);
+ silc_socket_free(res->sock);
+ silc_free(res);
+}
+
+/* Function that starts waiting for the `cmd_ident' to arrive and
+ marks the channel info being resolved. */
+
+static void silc_client_channel_set_wait(SilcClient client,
+ SilcClientConnection conn,
+ SilcChannelEntry channel,
+ SilcUInt16 cmd_ident)
+{
+ SilcClientNotifyResolve res;
+
+ if (!channel->resolve_cmd_ident) {
+ res = silc_calloc(1, sizeof(*res));
+ res->context = client;
+ res->sock = silc_socket_dup(conn->sock);
+ res->packet = silc_id_dup(channel->id, SILC_ID_CHANNEL);
+ silc_client_command_pending(conn, SILC_COMMAND_NONE, cmd_ident,
+ silc_client_channel_cond, res);
+ channel->resolve_cmd_ident = cmd_ident;
+ }
+}
+
+/* Attaches to the channel's resolving cmd ident and calls the
+ notify handling with `packet' after it's received. */
+
+static void silc_client_channel_wait(SilcClient client,
+ SilcClientConnection conn,
+ SilcChannelEntry channel,
+ SilcPacketContext *packet)
+{
+ SilcClientNotifyResolve res;
+
+ if (!channel->resolve_cmd_ident)
+ return;
+
+ res = silc_calloc(1, sizeof(*res));
+ res->packet = silc_packet_context_dup(packet);
+ res->context = client;
+ res->sock = silc_socket_dup(conn->sock);
+
+ silc_client_command_pending(conn, SILC_COMMAND_NONE,
+ channel->resolve_cmd_ident,
+ silc_client_notify_by_server_pending, res);
+}
+