[inherit('sys$library:starlet','lib$spawn','smgdefs','smg$repaint_line',
'BB.PEN')]
module update_topic_info;

[global] 
procedure update_topic_info;

{This procedure does the following :
	1)After user requests to leave current topic, last date accessed 
          info is changed in newuserfile and topic_list^.last_date_accessed.
        2)All unread NEW message are now considered SKIPPED messages.
          NEW message count is added to SKIPPED message count. NEW message 
          count is set to zero.
        3)The counters are recalculated.}

var
  message_date : timetype; 		{Store current date and time.}
  temp_record : bbrec;			{Store info from user's info file.}

begin 
  $gettim(message_date);		
  topic_list^.last_date_accessed := invert(message_date);

  {Form record used to update the user's file for last date accessed.}
  temp_record.date := topic_list^.last_date_accessed;
  temp_record.topic := current_topic;
  temp_record.poster := '';
  temp_record.subject := '';
  temp_record.data := '';
  temp_record.continuation := false;
  temp_record.date_posted := topic_list^.last_date_accessed;

  update_last_access(temp_record);     {Update user's info file.}

  {Recalculate counters.}
  topic_list^.message_counters.skipped_message := 
                                topic_list^.message_counters.skipped_message + 
                                topic_list^.message_counters.new_message;
  topic_list^.message_counters.new_message := 0;
  topic_list^.message_counters.total_message := 
                                topic_list^.message_counters.new_message + 
                                topic_list^.message_counters.read_message + 
                                topic_list^.message_counters.skipped_message;
end;
  
end.
