Commit 6952e7e1 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(find_next_conf_no): New function.

(find_previous_conf_no): New function.
parent 51e0d607
/*
* $Id: services.h,v 0.63 2003/08/12 22:32:51 ceder Exp $
* $Id: services.h,v 0.64 2003/08/13 10:28:23 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -409,6 +409,15 @@ set_keep_commented(Conf_no conf_no,
extern Success
first_unused_conf_no(Conf_no *result);
/*
* Return next/previous existing text-no.
*/
extern Success
find_next_conf_no(Conf_no start, Conf_no *result);
extern Success
find_previous_conf_no(Conf_no start, Conf_no *result);
/********************************
* Calls to handle marks *
......
/*
* $Id: conference.c,v 0.85 2003/08/12 22:32:37 ceder Exp $
* $Id: conference.c,v 0.86 2003/08/13 10:28:20 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -1536,3 +1536,50 @@ first_unused_conf_no(Conf_no *result)
*result = query_next_conf_no();
return OK;
}
Success
find_next_conf_no(Conf_no start,
Conf_no *result)
{
Conf_no highest = query_next_conf_no();
CHK_CONNECTION(FAILURE);
CHK_LOGIN(FAILURE);
err_stat = start;
while (++start < highest)
if (has_access(start, active_connection, read_protected))
{
*result = start;
return OK;
}
kom_errno = KOM_UNDEF_CONF;
return FAILURE;
}
extern Success
find_previous_conf_no(Conf_no start,
Conf_no *result)
{
Conf_no next_cno;
const Conf_no saved_start = start;
CHK_CONNECTION(FAILURE);
CHK_LOGIN(FAILURE);
if (start > (next_cno = query_next_conf_no()))
start = next_cno;
while (start-- > 0)
if (has_access(start, active_connection, read_protected))
{
*result = start;
return OK;
}
kom_errno = KOM_UNDEF_CONF;
err_stat = saved_start;
return FAILURE;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment