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

(add_rec_time): Adjusted to the fact that the texts member of

	Conference is now a l2g.
(adjust_read): Likewise.
(mark_as_read): Likewise.
(check_membership): Likewise.
(set_unread): Likewise.
(set_last_read): Likewise.
parent 6645a66a
/*
* $Id: membership.c,v 0.33 1998/07/08 16:35:27 ceder Exp $
* $Id: membership.c,v 0.34 1998/07/26 16:45:50 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -32,7 +32,7 @@
#define DEBUG_MARK_AS_READ
static const char *
rcsid = "$Id: membership.c,v 0.33 1998/07/08 16:35:27 ceder Exp $";
rcsid = "$Id: membership.c,v 0.34 1998/07/26 16:45:50 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -66,6 +66,7 @@ USE(rcsid);
#include "minmax.h"
#include "kom-memory.h"
#include "param.h"
#include "local-to-global.h"
#ifdef DEBUG_MARK_AS_READ
# include "log.h"
......@@ -267,13 +268,7 @@ add_rec_time(Conference * conf_c,
Text_stat * t_stat;
int i;
if ( local_no >= conf_c->texts.first_local_no + conf_c->texts.no_of_texts
|| local_no < conf_c->texts.first_local_no )
{
return; /* No longer exists in conf. */
}
text_no = conf_c->texts.texts[ local_no - conf_c->texts.first_local_no ];
text_no = l2g_lookup(&conf_c->texts, local_no);
if ( text_no == 0 )
{
......@@ -355,9 +350,9 @@ adjust_read( Membership * m,
Local_text_no prev;
#endif
/* (conf_min <= x <= conf_max) if x is an existing local_text_no */
conf_max = conf->texts.first_local_no + conf->texts.no_of_texts - 1;
conf_min = conf->texts.first_local_no;
/* (conf_min <= x < conf_max) if x is an existing local_text_no */
conf_min = l2g_next_key(&conf->texts, 0);
conf_max = l2g_first_appendable_key(&conf->texts);
/* Flag all removed texts as read, if that is not already done. */
if (m->last_text_read < conf_min - 1)
......@@ -373,8 +368,8 @@ adjust_read( Membership * m,
/* This loops advances m->last_text_read as far as possible,
advancing handled along when appropriate. m->last_text_read
can be increased for one of two reasons:
The text is present in read_texts.
The text is deleted.
- The text is present in read_texts.
- The text is deleted.
This loop handles both cases. */
for ( ; ; )
{
......@@ -386,7 +381,7 @@ adjust_read( Membership * m,
handled++;
}
else if (m->last_text_read < conf_max
&& conf->texts.texts[m->last_text_read + 1 - conf_min] == 0)
&& l2g_lookup(&conf->texts, m->last_text_read) == 0)
{
/* This text is deleted. */
m->last_text_read++;
......@@ -950,8 +945,7 @@ check_membership(Pers_no pno,
int log_no=0;
/* Check read texts */
if ( mship->last_text_read >
conf->texts.first_local_no + conf->texts.no_of_texts - 1)
if (mship->last_text_read >= l2g_first_appendable_key(&conf->texts))
{
if ( log_no++ < 80 )
log("%s%d) Person %lu has read text %lu in conf %lu%s%lu texts.\n",
......@@ -961,8 +955,8 @@ check_membership(Pers_no pno,
(unsigned long)mship->last_text_read,
(unsigned long)mship->conf_no,
", which only has ",
(unsigned long)(conf->texts.first_local_no
+ conf->texts.no_of_texts - 1));
(unsigned long)(l2g_first_appendable_key(&conf->texts)
- 1));
errors++;
}
......@@ -1053,8 +1047,7 @@ mark_as_read (Conf_no conference,
for( i = no_of_texts; i > 0; i--, text_arr++ )
{
if ( *text_arr >= ( conf_c->texts.first_local_no
+ conf_c->texts.no_of_texts ))
if (*text_arr >= l2g_first_appendable_key(&conf_c->texts))
{
kom_errno = KOM_NO_SUCH_LOCAL_TEXT;
err_stat = no_of_texts - i;
......@@ -1380,7 +1373,7 @@ set_unread (Conf_no conf_no,
return FAILURE;
}
highest = conf_c->texts.first_local_no + conf_c->texts.no_of_texts - 1;
highest = l2g_first_appendable_key(&conf_c->texts) - 1;
mship->last_text_read = ((highest > no_of_unread)
? (highest - no_of_unread) : 0);
......@@ -1416,7 +1409,7 @@ set_last_read (Conf_no conf_no,
return FAILURE;
}
last = conf_c->texts.first_local_no + conf_c->texts.no_of_texts - 1;
last = l2g_first_appendable_key(&conf_c->texts) - 1;
mship->last_text_read = ((last_read <= last)
? last_read : last);
......
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