Truxton message participant get type

From truxwiki.com
Jump to navigation Jump to search

This retrieves the role this participant took in the message.

Syntax

uint64_t truxton_message_participant_get_type( uint64_t participant_handle );

Parameters

participant_handle

This handle comes from calling truxton_message_participant_create().

Return value

The role of the participant.

Sample

void dump(uint64_t participant_handle)
{
   char string_value[512];

   uint64_t integer = 0;

   truxton_message_participant_get_id( participant_handle, string_value, sizeof(string_value) );
   printf( "ID: %s\n", string_value );

   integer_value = truxton_message_participant_get_combined_id( participant_handle );
   printf( "Combined ID: %" PRIu64 "\n", integer_value );

   truxton_message_participant_get_combined_guid( participant_handle, string_value, sizeof(string_value) );
   printf( "Combined GUID: %s\n", string_value );

   truxton_message_participant_get_account( participant_handle, string_value, sizeof(string_value) );
   printf( "Account: %s\n", string_value );

   truxton_message_participant_get_file_id( participant_handle, string_value, sizeof(string_value) );
   printf( "File ID: %s\n", string_value );

   truxton_message_participant_get_media_id( participant_handle, string_value, sizeof(string_value) );
   printf( "Media ID: %s\n", string_value );

   truxton_message_participant_get_message_address_id( participant_handle, string_value, sizeof(string_value) );
   printf( "Message Address ID: %s\n", string_value );

   truxton_message_participant_get_message_id( participant_handle, string_value, sizeof(string_value) );
   printf( "Message ID: %s\n", string_value );

   truxton_message_participant_get_server( participant_handle, string_value, sizeof(string_value) );
   printf( "Server: %s\n", string_value );

   truxton_message_participant_get_name( participant_handle, string_value, sizeof(string_value) );
   printf( "Name: %s\n", string_value );

   integer_value = truxton_message_participant_get_type( participant_handle );
   printf( "Type: %" PRIu64 "\n", integer_value );
}

The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned integer in C. Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.