Difference between revisions of "Truxton url set local filename"

From truxwiki.com
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
This corresponds to the <code>[LocalFilename]</code> column of the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table.
 
This corresponds to the <code>[LocalFilename]</code> column of the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table.
 
If the browser on the target media saved a copy of the retrieved web data, it will often associate a filename on the file system with the URL.
 
If the browser on the target media saved a copy of the retrieved web data, it will often associate a filename on the file system with the URL.
When the URL is retrieved again, the browser can simply retrieved the local file instead of having to reach out to internet for another copy.
+
When the URL is retrieved again, the browser can retrieve the local file instead of having to reach out to internet for another copy.
  
 
=Syntax=
 
=Syntax=
 
<source lang="C">
 
<source lang="C">
void truxton_url_set_local_filename( uint64_t url_handle, char * filename );
+
void truxton_url_set_local_filename( uint64_t url_handle, char const * filename );
 
</source>
 
</source>
  

Latest revision as of 13:45, 30 April 2023

This sets the name of the file on the media used to cache the contents of the URL visit. This corresponds to the [LocalFilename] column of the [WebsiteVisit] table. If the browser on the target media saved a copy of the retrieved web data, it will often associate a filename on the file system with the URL. When the URL is retrieved again, the browser can retrieve the local file instead of having to reach out to internet for another copy.

Syntax

void truxton_url_set_local_filename( uint64_t url_handle, char const * filename );

Parameters

url_handle

The handle to the URL created by calling truxton_url_create(), or truxton_file_create_url().

filename

The name of the file on the media where the contents of the URL visit.

Sample

void add_home_url( uint64_t truxton, uint64_t media, uint64_t child_file, char const * url_address, uint64_t when )
{
   char media_id[ 65 ];
   char file_id[ 65 ];
   
   truxton_media_get_id( media, media_id, sizeof( media_id ) );
   truxton_child_file_get_id( child_file, file_id, sizeof( file_id ) );

   uint64_t url = truxton_url_create( truxton );

   truxton_url_set_account( url, "admin" );
   truxton_url_set_account_offset( url, -1 );
   truxton_url_set_file_id( url, file_id );
   truxton_url_set_media_id( url, media_id );
   truxton_url_set_format( url, URL_FORMAT_ASCII );
   truxton_url_set_local_filename( url, "document.htm" );
   truxton_url_set_method( url, URL_METHOD_TYPE_USER_TYPED_IT_IN );
   truxton_url_set_type( url, URL_TYPE_CHROME_HISTORY );
   truxton_url_set_url( url, url_address );
   truxton_url_set_url_offset( url, -1 );
   truxton_url_set_when( url, when );

   // Commit the data to the database
   truxton_url_save( url );
   truxton_url_destroy( url );
}