anchor.diff:      { atomic, _ } ->
         ok
     end.
  +
  +
  +
  +% Continue searching through the archived files for a channel.
  +
  +search_archive_files(ResultList, First, Created, Channel, RowsBack, SearchString) when length(ResultList) < RowsBack, First > Created ->
  +  ArchiveName = get_archive_file_name(Channel, First),
  +  error_logger:info_msg("DEBUG: Search continues in archive: ~p~n", [ ArchiveName ]),
  +  { Ms, Sc, Us } = First,
  +  NewVal = ((Ms * 1000000000000) + (Sc * 1000000) + Us) - 86400000000,
  +  NewMs = NewVal div 1000000000000,
  +  NewSc = (NewVal - (NewMs * 1000000000000)) div 1000000,
  +  NewUs = NewVal - (NewMs * 1000000000000) - (NewSc * 1000000),
  +  NewFst = { NewMs, NewSc, NewUs },
  +  search_archive_files(ResultList, NewFst, Created, Channel, RowsBack, SearchString)
  +  ;
  +search_archive_files(ResultList, First, Created, _, RowsBack, _) ->
  +  error_logger:info_msg("DEBUG: Search complete: ~p ~p ~p ~p~n", [ First, Created, length(ResultList), RowsBack ]),
  +  ResultList.
  
positive.code: 
  
  
  % Append a row to an archive file.
  
  write_row_to_file(Channel, Now, User, Text) ->
    { { Yr, Mo, Dy }, _ } = calendar:now_to_local_time(Now),
    Filename = "archive/" ++ integer_to_list(Yr) ++ pad(integer_to_list(Mo)) ++ pad(integer_to_list(Dy)) ++ "/" ++ Channel,
    case filelib:ensure_dir(Filename) of
      ok ->
        case file:open(Filename, [ append ]) of
  
negative.code:       ;
      [] ->
        no_such_channel
    end.
  
  
  
  
  get_a_row(Result, Channel, CurrentRow, FirstRow, RowsBack) ->
    if
      CurrentRow == FirstRow ->
        Result
        ;
      length(Result) >= RowsBack ->
        Result
        ;
      true ->
        case mnesia:read({ rows, { node(), Channel, CurrentRow } }) of
          [ { _, _, R } ] ->
            get_a_row([ R ] ++ Result, Channel, CurrentRow - 1, FirstRow, RowsBack)
            ;
          _ ->
            Result
        end
    end.
  
  
  