/**********************************************************************
 * luc_reset_mtg.c -- uncache transaction info if necessary
 *
 * $Author: brlewis $
 * $Source: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_reset_mtg.c,v $
 * $Header: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_reset_mtg.c,v 1.1 91/08/01 14:32:34 brlewis Exp Locker: brlewis $
 *
 * Copyright 1991 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 **********************************************************************/
#include <mit-copyright.h>

#ifndef lint
static char rcsid_luc_reset_mtg_c[] = "$Header: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_reset_mtg.c,v 1.1 91/08/01 14:32:34 brlewis Exp Locker: brlewis $";
#endif /* lint */

#include <stdio.h>
#include <strings.h>
#include "lucy/lucy.h"

/**********************************************************************
 * luc_reset_mtg(lmeeting *mp)
 *	caller sets mp (usually luv_curmtgp) to specify meeting
 *
 * - checks to see if meeting has been modified
 * - if modified, cached ltrns are freed
 * - returns error code
 **********************************************************************/

long
luc_reset_mtg(mp)
     LMEETING *mp;
{
  long code;
  date_times mod;
  int i;

  /* Check to see if meeting has been modified */
  mod = mp->info.date_modified;
  dsc_destroy_mtg_info(&(mp->info));
  dsc_get_mtg_info(&(mp->nb), &(mp->info), &code);
  if (code) {
    sprintf(luv_context, "getting info on %s:%s",
	    mp->nb.hostname, mp->nb.pathname);
    return(code);
  }
  if (mod == mp->info.date_modified) return(0L);

  /* Free cached transaction info */
  for(i=0; i < mp->ntrn; i++)
    dsc_destroy_trn_info3(mp->trn[i]);
  if (mp->trn) free(mp->trn);
  mp->trn = NULL;
  mp->ntrn = 0;
  return(0L);
}
