<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://truxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Truxton_communication_save</id>
	<title>Truxton communication save - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://truxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Truxton_communication_save"/>
	<link rel="alternate" type="text/html" href="https://truxwiki.com/index.php?title=Truxton_communication_save&amp;action=history"/>
	<updated>2026-09-09T15:59:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://truxwiki.com/index.php?title=Truxton_communication_save&amp;diff=6290&amp;oldid=prev</id>
		<title>Sam: Created page with &quot;This will save a communication to the database.  =Syntax= &lt;source lang=&quot;C&quot;&gt; int truxton_communication_save( uint64_t communication_handle ); &lt;/source&gt;  =Parameters= ==&lt;code&gt;co...&quot;</title>
		<link rel="alternate" type="text/html" href="https://truxwiki.com/index.php?title=Truxton_communication_save&amp;diff=6290&amp;oldid=prev"/>
		<updated>2023-05-05T10:33:08Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This will save a communication to the database.  =Syntax= &amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt; int truxton_communication_save( uint64_t communication_handle ); &amp;lt;/source&amp;gt;  =Parameters= ==&amp;lt;code&amp;gt;co...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This will save a communication to the database.&lt;br /&gt;
&lt;br /&gt;
=Syntax=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int truxton_communication_save( uint64_t communication_handle );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Parameters=&lt;br /&gt;
==&amp;lt;code&amp;gt;communication_handle&amp;lt;/code&amp;gt;==&lt;br /&gt;
The handle returned by calling &amp;lt;code&amp;gt;[[truxton_communication_create]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=Return value=&lt;br /&gt;
A non-zero value on success, zero on failure.&lt;br /&gt;
&lt;br /&gt;
=Sample=&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot; highlight=&amp;quot;18&amp;quot;&amp;gt;&lt;br /&gt;
#define TAG_ORIGIN_AUTOMATIC (1)&lt;br /&gt;
#define TAG_ORIGIN_HUMAN     (2)&lt;br /&gt;
&lt;br /&gt;
void add_message( uint64_t truxton, uint64_t parent_file )&lt;br /&gt;
{&lt;br /&gt;
   char id[40];&lt;br /&gt;
   char sender_id[80];&lt;br /&gt;
&lt;br /&gt;
   uint64_t communication = truxton_communication_create( parent_file );&lt;br /&gt;
&lt;br /&gt;
   uint64_t message_time = truxton_parse_time( &amp;quot;2021-07-29 21:52:53 UTC&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   truxton_communication_set_received( communication, message_time );&lt;br /&gt;
   truxton_communication_set_sent( communication, message_time );&lt;br /&gt;
   truxton_communication_set_type( communication, MESSAGE_TYPE_MIME );&lt;br /&gt;
   truxton_communication_set_subject( communication, &amp;quot;Test Message&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_save( communication ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Failed to add communication to Truxton\n&amp;quot; );&lt;br /&gt;
      truxton_communication_destroy( communication );&lt;br /&gt;
      return;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   truxton_communication_get_id( parent_file, id, sizeof(id) );&lt;br /&gt;
   printf( &amp;quot;Saved as id %s\n&amp;quot;, id );&lt;br /&gt;
&lt;br /&gt;
   // Now that we have an id, we can add participants.&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_participant( communication, MESSAGE_PARTICIPANT_FROM, &amp;quot;sam@abc.xyz&amp;quot;, sender_id, sizeof(sender_id) ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not save FROM participant.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
   else&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Sender id is %s\n&amp;quot;, sender_id );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_participant( communication, MESSAGE_PARTICIPANT_TO, &amp;quot;laura@abc.xyz&amp;quot;, NULL, 0 ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not save TO participant.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   uint64_t message_body_1 = create_message_body_1( truxton );&lt;br /&gt;
   uint64_t message_body_2 = create_message_body_2( truxton );&lt;br /&gt;
   uint64_t attachment_1 = create_attachment_1( truxton );&lt;br /&gt;
   uint64_t attachment_2 = create_attachment_2( truxton );&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_piece( communication, message_body_1, ORIGIN_EMAIL_BODY, 1 ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not add first body to message.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_piece( communication, message_body_1, ORIGIN_EMAIL_BODY, 2 ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not add second body to message.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_piece( communication, attachment_1, ORIGIN_EMAIL_ATTACHMENT, 1 ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not add first attachment to message.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_add_piece( communication, attachment_2, ORIGIN_EMAIL_ATTACHMENT, 2 ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not add second attachment to message.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_finished( communication ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not complete message record.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   if ( truxton_communication_tag( communication, &amp;quot;Man Made&amp;quot;, &amp;quot;Testing the API&amp;quot;, TAG_ORIGIN_HUMAN ) == 0 )&lt;br /&gt;
   {&lt;br /&gt;
      printf( &amp;quot;Could not tag message.\n&amp;quot; );&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   truxton_communication_destroy( communication );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sam</name></author>
		
	</entry>
</feed>