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

(backdate_comment_link): New debug request.

parent 533117df
/*
* $Id: services.h,v 0.60 2003/07/24 22:05:26 ceder Exp $
* $Id: services.h,v 0.61 2003/08/11 18:51:11 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -692,6 +692,12 @@ extern Success
backdate_text(Text_no text_no,
unsigned long seconds);
/* Modify the "sent_at" item. It must already exist. */
extern Success
backdate_comment_link(Text_no parent,
Text_no child,
unsigned long seconds);
extern Success
start_garb(void);
......
/*
* $Id: debug.c,v 1.8 2003/07/15 22:48:25 ceder Exp $
* $Id: debug.c,v 1.9 2003/08/11 18:51:08 ceder Exp $
* Copyright (C) 1991, 1993-1996, 1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -49,7 +49,8 @@
#include "connections.h"
#include "services.h"
#include "manipulate.h"
#include "log.h"
#include "lyskomd.h"
#ifdef DEBUG_CALLS
......@@ -119,6 +120,83 @@ backdate_text(Text_no text_no,
return OK;
}
extern Success
backdate_comment_link(Text_no parent,
Text_no child,
unsigned long seconds)
{
Text_stat *child_s;
unsigned short nmisc;
Misc_info *misc;
Bool in_comm_group = FALSE;
Bool link_found = FALSE;
CHK_LOGIN(FAILURE);
GET_T_STAT(child_s, child, FAILURE);
for (nmisc = child_s->no_of_misc, misc = child_s->misc_items;
nmisc > 0;
--nmisc, ++misc)
{
switch (misc->type)
{
case recpt:
case cc_recpt:
case bcc_recpt:
case comm_in:
case footn_in:
in_comm_group = FALSE;
break;
case comm_to:
case footn_to:
in_comm_group = (misc->datum.text_link == parent);
if (in_comm_group)
link_found = TRUE;
break;
case loc_no:
case rec_time:
case sent_by:
break;
case sent_at:
if (in_comm_group)
{
misc->datum.sent_at -= seconds;
mark_text_as_changed(child);
return OK;
}
break;
#ifndef COMPILE_CHECKS
default:
#endif
case unknown_info:
restart_kom("backdate_comment_link(): Illegal misc-item.\n");
}
}
if (link_found)
{
kom_errno = KOM_INDEX_OUT_OF_RANGE;
kom_log("backdate_comment_link(): Test suite error:"
" no sent_at found for parent=%ld, child=%ld\n",
(unsigned long)parent,
(unsigned long)child);
}
else
{
kom_errno = KOM_NOT_COMMENT;
kom_log("backdate_comment_link(): Test suite error:"
" %ld is neither comment nor footnote to %ld.\n",
(unsigned long)child,
(unsigned long)parent);
}
return FAILURE;
}
/* start_garb is in text-garb.c since it needs access to static variables */
#endif
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