Commit d877e3f0 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(do_query_read_texts): New arguments: want_read_ranges and max_ranges.

	All callers updated.  Call adjust_read() if want_read_ranges
	is true.
(query_read_texts): New function.
parent 2d32079e
/*
* $Id: person.c,v 0.71 2002/11/12 17:41:41 ceder Exp $
* $Id: person.c,v 0.72 2002/11/13 00:40:59 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -1008,7 +1008,9 @@ set_passwd (Pers_no person,
static Success
do_query_read_texts(Pers_no victim,
Conf_no conf_no,
Membership * result)
Bool want_read_ranges,
unsigned long max_ranges,
Membership *result)
{
Person * victim_p;
Membership * membp;
......@@ -1040,6 +1042,23 @@ do_query_read_texts(Pers_no victim,
return FAILURE;
}
if (want_read_ranges == TRUE)
{
const Conference *conf_c;
if ((conf_c = cached_get_conf_stat(conf_no)) == NULL)
{
kom_log("do_query_read_texts: %lu is a member of %lu, but "
"that conference doesn't exist\n",
(unsigned long)victim,
(unsigned long)conf_no);
return FAILURE;
}
if (adjust_read(membp, conf_c) == TRUE)
mark_person_as_changed(victim);
}
*result = *membp;
if (vis == mv_censor_unread)
......@@ -1049,10 +1068,35 @@ do_query_read_texts(Pers_no victim,
result->read_ranges = NULL;
}
if (want_read_ranges)
{
if (max_ranges != 0 && result->no_of_read_ranges > max_ranges)
result->no_of_read_ranges = max_ranges;
}
else
{
result->read_ranges = NULL;
}
return OK;
}
extern Success
query_read_texts(Pers_no pers_no,
Conf_no conf_no,
Bool want_read_ranges,
unsigned long max_ranges,
Membership *result)
{
/* CHK_CONNECTION in do_query_read_texts */
return do_query_read_texts(pers_no,
conf_no,
want_read_ranges,
max_ranges,
result);
}
extern Success
query_read_texts_10(Pers_no victim,
Conf_no conf_no,
......@@ -1061,6 +1105,8 @@ query_read_texts_10(Pers_no victim,
/* CHK_CONNECTION in do_query_read_texts */
return do_query_read_texts(victim,
conf_no,
TRUE,
0,
result);
}
......@@ -1071,7 +1117,7 @@ query_read_texts_old(Pers_no victim,
Membership *result)
{
/* CHK_CONNECTION in do_query_read_texts */
return do_query_read_texts(victim, conf_no, result);
return do_query_read_texts(victim, conf_no, TRUE, 0, result);
}
......
Markdown is supported
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