Commit 7c3abfaa authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(do_add_recipient): New function, that is like do_add_recpt, but with

	an additional Info_type argument that specifies what kind of
	recipient to add.
(do_add_recpt): Function removed.
(do_add_cc_recpt): Function removed.
(do_add_bcc_recpt): Function removed.
(create_text_add_miscs): Use do_add_recipient.  Simplify code.
(add_recipient): Ditto. (Bug 190).
parent 60be7915
/*
* $Id: text.c,v 0.86 2001/11/04 14:19:14 ceder Exp $
* $Id: text.c,v 0.87 2001/11/04 18:08:08 ceder Exp $
* Copyright (C) 1991-2001 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -34,10 +34,11 @@
#endif
static const char *
rcsid = "$Id: text.c,v 0.86 2001/11/04 14:19:14 ceder Exp $";
rcsid = "$Id: text.c,v 0.87 2001/11/04 18:08:08 ceder Exp $";
#include "rcs.h"
USE(rcsid);
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <time.h>
......@@ -370,12 +371,17 @@ do_add_comment(Text_no comment,
* Say that RECEIVER is a recipient of TEXT.
*/
static Success
do_add_recpt(Text_no text,
Text_stat * text_s, /* May be NULL */
Conf_no receiver)
do_add_recipient(Text_no text,
Text_stat * text_s, /* May be NULL */
Conf_no receiver,
Info_type recv_type)
{
Conference *rece_c;
assert(recv_type == recpt
|| recv_type == cc_recpt
|| recv_type == bcc_recpt);
if (text_s == NULL)
{
GET_T_STAT(text_s, text, FAILURE);
......@@ -383,7 +389,7 @@ do_add_recpt(Text_no text,
GET_C_STAT(rece_c, receiver, FAILURE);
ADD_MISC(text_s, recpt, recipient, receiver);
ADD_MISC(text_s, recv_type, recipient, receiver);
ADD_MISC(text_s, loc_no, local_no, add_text_in_conf(rece_c, text));
mark_text_as_changed(text);
......@@ -391,50 +397,6 @@ do_add_recpt(Text_no text,
return OK;
}
static Success
do_add_bcc_recpt(Text_no new_text,
Text_stat *text_s, /* May be NULL */
Conf_no receiver)
{
Conference *rece_c;
if (text_s == NULL)
GET_T_STAT(text_s, new_text, FAILURE);
GET_C_STAT(rece_c, receiver, FAILURE);
ADD_MISC(text_s, bcc_recpt, recipient, receiver);
ADD_MISC(text_s, loc_no, local_no, add_text_in_conf(rece_c, new_text));
mark_text_as_changed( new_text );
mark_conference_as_changed( receiver );
return OK;
}
static Success
do_add_cc_recpt(Text_no new_text,
Text_stat *text_s, /* May be NULL */
Conf_no receiver)
{
Conference *rece_c;
if (text_s == NULL)
GET_T_STAT(text_s, new_text, FAILURE);
GET_C_STAT(rece_c, receiver, FAILURE);
ADD_MISC(text_s, cc_recpt, recipient, receiver);
ADD_MISC(text_s, loc_no, local_no, add_text_in_conf(rece_c, new_text));
mark_text_as_changed(new_text);
mark_conference_as_changed(receiver);
return OK;
}
......@@ -1955,23 +1917,10 @@ create_text_add_miscs(Text_no new_text,
break;
case recpt:
if (do_add_recpt(new_text, NULL, misc[i].datum.recipient) != OK)
return FAILURE;
GET_C_STAT(conf_c, misc[i].datum.recipient, FAILURE);
conf_c->last_written = current_time;
break;
case cc_recpt:
if (do_add_cc_recpt(new_text, NULL,
misc[i].datum.recipient) != OK)
return FAILURE;
GET_C_STAT(conf_c, misc[i].datum.recipient, FAILURE);
conf_c->last_written = current_time;
break;
case bcc_recpt:
if (do_add_bcc_recpt(new_text, NULL,
misc[i].datum.recipient) != OK)
if (do_add_recipient(new_text, NULL,
misc[i].datum.recipient, misc[i].type) != OK)
return FAILURE;
GET_C_STAT(conf_c, misc[i].datum.recipient, FAILURE);
conf_c->last_written = current_time;
......@@ -2691,17 +2640,9 @@ add_recipient(Text_no text_no,
switch (type)
{
case recpt:
if (do_add_recpt(text_no, t_stat, conf_no) != OK)
return FAILURE;
break;
case cc_recpt:
if (do_add_cc_recpt(text_no, t_stat, conf_no) != OK)
return FAILURE;
break;
case bcc_recpt:
if (do_add_bcc_recpt(text_no, t_stat, conf_no) != OK)
if (do_add_recipient(text_no, t_stat, conf_no, type) != OK)
return FAILURE;
break;
......
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