+/* Returns TRUE if the connection is registered. Unregistered connections
+ usually cannot send commands hence the check. */
+
+static int silc_server_is_registered(SilcServer server,
+ SilcPacketStream sock,
+ SilcServerCommandContext cmd,
+ SilcCommand command)
+{
+ SilcIDListData idata = silc_packet_get_context(sock);
+
+ if (!idata)
+ return FALSE;
+
+ if (idata->status & SILC_IDLIST_STATUS_REGISTERED)
+ return TRUE;
+
+ silc_server_command_send_status_reply(cmd, command,
+ SILC_STATUS_ERR_NOT_REGISTERED, 0);
+ return FALSE;
+}
+