Commit 88b662a4 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(send_async_text_aux_changed): New function.

(modify_text_info): Call it.
parent e988c28a
/* /*
* $Id: text.c,v 0.110 2003/08/16 11:28:54 ceder Exp $ * $Id: text.c,v 0.111 2003/08/16 15:32:33 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association. * Copyright (C) 1991-2002 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -3248,14 +3248,49 @@ local_to_global(Conf_no conf_no, ...@@ -3248,14 +3248,49 @@ local_to_global(Conf_no conf_no,
return OK; return OK;
} }
static void
send_async_text_aux_changed(Text_no text_no,
Text_stat *text_s,
unsigned long highest_aux)
{
Connection *cptr;
Session_no i = 0;
Aux_item_list copy;
while ((i = traverse_connections(i)) != 0)
{
cptr = get_conn_by_number(i);
/* Check the want_async and handshake_ok here to avoid the
expensive calls to access_perm and filter_aux_item_list. */
if (cptr->want_async[ay_text_aux_changed] == FALSE)
continue;
if (!handshake_ok(cptr, 0))
continue;
if (!interested_party(cptr, text_no, text_s))
continue;
if (!text_read_access(cptr, text_no, text_s))
continue;
filter_aux_item_list(&text_s->aux_item_list, &copy, cptr);
async_text_aux_changed(cptr, text_no, &copy, highest_aux);
}
}
extern Success extern Success
modify_text_info(Text_no text, modify_text_info(Text_no text,
Number_list *items_to_delete, Number_list *items_to_delete,
Aux_item_list *aux) Aux_item_list *aux)
{ {
Text_stat *text_s; Text_stat *text_s;
unsigned long highest_aux;
CHK_CONNECTION(FAILURE); CHK_CONNECTION(FAILURE);
CHK_LOGIN(FAILURE); CHK_LOGIN(FAILURE);
...@@ -3281,6 +3316,10 @@ modify_text_info(Text_no text, ...@@ -3281,6 +3316,10 @@ modify_text_info(Text_no text,
return FAILURE; return FAILURE;
} }
/* Store the number of the oldest existing aux-item, so that we
can send an async message about the new items. */
highest_aux = text_s->highest_aux;
/* Check if we may delete and add the items */ /* Check if we may delete and add the items */
prepare_aux_item_list(aux, ACTPERS); prepare_aux_item_list(aux, ACTPERS);
...@@ -3305,9 +3344,9 @@ modify_text_info(Text_no text, ...@@ -3305,9 +3344,9 @@ modify_text_info(Text_no text,
} }
text_stat_add_aux_item_list(text_s, text, aux, ACTPERS); text_stat_add_aux_item_list(text_s, text, aux, ACTPERS);
send_async_text_aux_changed(text, text_s, highest_aux);
commit_aux_item_list(&text_s->aux_item_list); commit_aux_item_list(&text_s->aux_item_list);
/* FIXME (bug 910): async_text_changed(text, text_s); */
mark_text_as_changed(text); mark_text_as_changed(text);
return OK; return OK;
......
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