Commit 0d368562 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Added create_anonymous_text.

parent 930a0c46
Mon Nov 11 01:08:09 1991 Per Cederqvist (ceder at ruben)
* fncdef.txt, prot-a.c, text.c: Added create_anonymous_text.
Tue Oct 29 15:48:15 1991 Linus Tolke Y (linus at ruben)
* prot-a-output.c, prot-a-parse.c, ram-output.c, ram-parse.c
......
#
# $Id: fncdef.txt,v 0.6 1991/11/10 19:02:35 linus Exp $
# $Id: fncdef.txt,v 0.7 1991/11/11 00:27:41 ceder Exp $
# Copyright (C) 1991 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,7 +22,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: fncdef.txt,v 0.6 1991/11/10 19:02:35 linus Exp $
# $Id: fncdef.txt,v 0.7 1991/11/11 00:27:41 ceder Exp $
#
# This file is used to describe the functions in services.c. All
# functions that are reachable from the clients are listed here, together
......@@ -94,3 +94,4 @@ success disconnect num
success who_am_i : session_no
success set_user_area num num
success get_last_text time_date : text_no
number create_anonymous_text c_string (TEXT_LEN) num c_misc_info_p
/*
* $Id: prot-a.c,v 0.9 1991/11/10 19:02:18 linus Exp $
* $Id: prot-a.c,v 0.10 1991/11/11 00:27:32 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -26,7 +26,7 @@
* Protocol A.
*/
static char *rcsid = "$Id: prot-a.c,v 0.9 1991/11/10 19:02:18 linus Exp $";
static char *rcsid = "$Id: prot-a.c,v 0.10 1991/11/11 00:27:32 ceder Exp $";
#include <stdio.h>
......@@ -291,6 +291,7 @@ prot_a_is_legal_fnc(Call_header fnc)
case call_fnc_who_am_i:
case call_fnc_set_user_area:
case call_fnc_get_last_text:
case call_fnc_create_anonymous_text:
return TRUE;
default:
......
/*
* $Id: text.c,v 0.9 1991/11/10 19:02:05 linus Exp $
* $Id: text.c,v 0.10 1991/11/11 00:27:17 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* All atomic calls that deals with texts.
*/
static char *rcsid = "$Id: text.c,v 0.9 1991/11/10 19:02:05 linus Exp $";
static char *rcsid = "$Id: text.c,v 0.10 1991/11/11 00:27:17 ceder Exp $";
#include <time.h>
#include <stdlib.h>
......@@ -1705,6 +1705,72 @@ create_text(String message,
return text;
}
/*
* Create an anonymous text.
*
* This is just like create_text, but the author of the text is set to
* Pers_no 0, to guarantee that the author is anonymous.
*
* (This should really be called create_ftp_text (in analogy with
* change-conference which was truncated to CC, which was transmuted
* into pepsi) but public demand said NO!)
*
* Returns text_no of the created text, or 0 if there was an error.
*/
extern Text_no
create_anonymous_text(String message,
u_short no_of_misc,
Misc_info * misc )
{
Text_no text;
Text_stat * t_stat;
extern int errno;
CHK_LOGIN(0);
/* Check the length of the text. */
if ( s_strlen (message) >= TEXT_LEN )
{
kom_errno = KOM_LONG_STR;
return 0;
}
/* Check all misc-items */
if ( create_text_check_misc(&no_of_misc, misc) != OK
|| (text = cached_create_text( message )) == 0)
{
return 0;
}
if ( (t_stat = cached_get_text_stat( text )) == NULL )
{
restart_kom("create_anonymous_text: can't get text-stat of "
"newly created text.\n"
"Text == %d, kom_errno == %d, errno == %d\n",
text, kom_errno, errno);
}
t_stat->author = 0;
t_stat->creation_time = time(NULL);
t_stat->no_of_lines = count_lines( message );
t_stat->no_of_chars = s_strlen( message );
if ( create_text_add_miscs(text, no_of_misc, misc) != OK )
{
log("ERROR: create_text(): can't add miscs.\n");
return 0;
}
mark_text_as_changed( text );
/* Don't add this person to create - we want true anonymity! */
async_new_text( text, t_stat ); /* Send asynchronous message. */
return text;
}
/*
* Delete a text.
*
......
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