+ /* Notify application. */
+ NOTIFY(client, conn, type, id.type, entry, mode, client_entry2, channel);
+
+ out:
+ silc_client_unref_client(client, conn, client_entry2);
+ if (client_entry)
+ silc_client_unref_client(client, conn, client_entry);
+ if (server)
+ silc_client_unref_server(client, conn, server);
+ if (channel_entry)
+ silc_client_unref_channel(client, conn, channel_entry);
+ silc_client_unref_channel(client, conn, channel);
+
+ /** Notify processed */
+ silc_fsm_next(fsm, silc_client_notify_processed);
+ return SILC_FSM_CONTINUE;
+}
+
+/********************************* MOTD *************************************/
+
+/* Received Message of the day */
+
+SILC_FSM_STATE(silc_client_notify_motd)
+{
+ SilcClientConnection conn = fsm_context;
+ SilcClient client = conn->client;
+ SilcClientNotify notify = state_context;
+ SilcNotifyPayload payload = notify->payload;
+ SilcNotifyType type = silc_notify_get_type(payload);
+ SilcArgumentPayload args = silc_notify_get_args(payload);
+ unsigned char *tmp;
+ SilcUInt32 tmp_len;
+
+ SILC_LOG_DEBUG(("Notify: MOTD"));
+
+ /* Get motd */
+ tmp = silc_argument_get_arg_type(args, 1, &tmp_len);
+ if (!tmp)
+ goto out;
+
+ /* Notify application */
+ NOTIFY(client, conn, type, tmp);
+
+ out:
+ /** Notify processed */
+ silc_fsm_next(fsm, silc_client_notify_processed);
+ return SILC_FSM_CONTINUE;
+}
+
+/**************************** CHANNEL CHANGE ********************************/
+
+/* Router has enforced a new ID to a channel, change it */
+
+SILC_FSM_STATE(silc_client_notify_channel_change)
+{
+ SilcClientConnection conn = fsm_context;
+ SilcClient client = conn->client;
+ SilcClientNotify notify = state_context;
+ SilcNotifyPayload payload = notify->payload;
+ SilcNotifyType type = silc_notify_get_type(payload);
+ SilcArgumentPayload args = silc_notify_get_args(payload);
+ SilcChannelEntry channel = NULL;
+ SilcID id;
+
+ SILC_LOG_DEBUG(("Notify: CHANNEL_CHANGE"));
+
+ /* Get the old ID */
+ if (!silc_argument_get_decoded(args, 1, SILC_ARGUMENT_ID, &id, NULL))
+ goto out;
+
+ /* Get the channel entry */
+ channel = silc_client_get_channel_by_id(client, conn, &id.u.channel_id);
+ if (!channel)
+ goto out;
+
+ /* If channel is being resolved handle notify after resolving */
+ if (channel->internal.resolve_cmd_ident) {
+ silc_client_unref_channel(client, conn, channel);
+ SILC_FSM_CALL(silc_client_command_pending(
+ conn, SILC_COMMAND_NONE,
+ channel->internal.resolve_cmd_ident,
+ silc_client_notify_wait_continue,
+ notify));
+ /* NOT REACHED */
+ }
+
+ /* Get the new ID */
+ if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
+ goto out;
+
+ /* Replace the Channel ID */
+ if (!silc_client_replace_channel_id(client, conn, channel, &id.u.channel_id))
+ goto out;
+
+ /* Notify application */
+ NOTIFY(client, conn, type, channel, channel);
+
+ out:
+ /** Notify processed */
+ silc_client_unref_channel(client, conn, channel);
+ silc_fsm_next(fsm, silc_client_notify_processed);
+ return SILC_FSM_CONTINUE;
+}
+
+/******************************** KICKED ************************************/