Difference between revisions of "TruxtonCommunication"

From truxwiki.com
Jump to navigation Jump to search
Line 1: Line 1:
 
This class lets you add to the communication items (email/sms/mms) to Truxton.
 
This class lets you add to the communication items (email/sms/mms) to Truxton.
This will populate the <code>Message</code>, <code>MessageAddress</code>, and other tables in the database.
+
This will populate the <code>[Message]</code>, <code>[MessageAddress]</code>, and other tables in the database.
 
=Attributes and Methods=
 
=Attributes and Methods=
 
==<code>addparticipant(account, role)</code>==
 
==<code>addparticipant(account, role)</code>==
Line 6: Line 6:
 
The <code>account</code> is the phone number or email address or account that participated in the message.
 
The <code>account</code> is the phone number or email address or account that participated in the message.
 
The <code>role</code> parameter is the <code>[[Message Participants|MESSAGE_PARTICIPANT]]</code> constants.
 
The <code>role</code> parameter is the <code>[[Message Participants|MESSAGE_PARTICIPANT]]</code> constants.
It should be a value that matches the <code>ID</code> column of the <code>MessageAddressType</code> table.
+
It should be a value that matches the <code>[ID]</code> column of the <code>[MessageAddressType]</code> table.
  
 
==<code>fileid</code>==
 
==<code>fileid</code>==
 
The [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the file this event came from.
 
The [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the file this event came from.
This corresponds to the <code>FileID</code> column of the <code>Message</code> table.
+
This corresponds to the <code>[FileID]</code> column of the <code>[Message]</code> table.
  
 
==<code>finished()</code>==
 
==<code>finished()</code>==
Line 21: Line 21:
 
==<code>mediaid</code>==
 
==<code>mediaid</code>==
 
This is the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the media this event came from.
 
This is the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the media this event came from.
This identifier corresponds to the <code>MediaID</code> of the <code>Message</code> table.
+
This identifier corresponds to the <code>[MediaID]</code> of the <code>[Message]</code> table.
  
 
==<code>received</code>==
 
==<code>received</code>==
 
When the message was received in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks.
 
When the message was received in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks.
This corresponds to the <code>Received</code> column of the <code>Message</code> table.
+
This corresponds to the <code>[Received]</code> column of the <code>[Message]</code> table.
  
 
==<code>save()</code>==
 
==<code>save()</code>==
This will commit the information to the <code>Event</code> table.
+
This will commit the information to the <code>[Message]</code> table.
  
 
==<code>sent</code>==
 
==<code>sent</code>==
 
When the message was sent in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks.
 
When the message was sent in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks.
This corresponds to the <code>Sent</code> column of the <code>Message</code> table.
+
This corresponds to the <code>[Sent]</code> column of the <code>[Message]</code> table.
  
 
==<code>subject</code>==
 
==<code>subject</code>==
 
The subject of the message.
 
The subject of the message.
 
If the message type is SMS or MMS, this is the text of the message.
 
If the message type is SMS or MMS, this is the text of the message.
This corresponds to the <code>Text</code> column of the <code>MessageSubject</code> table.
+
This corresponds to the <code>[Text]</code> column of the <code>[MessageSubject]</code> table.
  
 
==<code>tag(tag, reason, origin)</code>==
 
==<code>tag(tag, reason, origin)</code>==
 
This creates a tag associated with this event in Truxton.
 
This creates a tag associated with this event in Truxton.
 
The <code>tag</code> parameter is a short, one or two word, bit of text that will be displayed in the UI.
 
The <code>tag</code> parameter is a short, one or two word, bit of text that will be displayed in the UI.
The <code>reason</code> a sentence explaining why this event was tagged.
+
The <code>reason</code> is a sentence explaining why this event was tagged.
 
The <code>origin</code> is either <code>TAG_ORIGIN_AUTOMATIC</code> (1) or <code>TAG_ORIGIN_HUMAN</code> (2).
 
The <code>origin</code> is either <code>TAG_ORIGIN_AUTOMATIC</code> (1) or <code>TAG_ORIGIN_HUMAN</code> (2).
 
It will return  
 
It will return  
Line 50: Line 50:
 
The type of message.
 
The type of message.
 
It is one of the <code>[[Message Types | MESSAGE_TYPE]]</code> constants.
 
It is one of the <code>[[Message Types | MESSAGE_TYPE]]</code> constants.
This corresponds to the <code>MessageTypeID</code> column of the <code>Message</code> table and should be a value from the <code>ID</code> column of the <code>MessageType</code> table.
+
This corresponds to the <code>[MessageTypeID]</code> column of the <code>[Message]</code> table and should be a value from the <code>[ID]</code> column of the <code>[MessageType]</code> table.
  
 
=Sample=
 
=Sample=
 
+
<source lang="Python" line highlight="3-7,9-10,12">
<syntaxhighlight lang="Python" line highlight="3-7,9-10,12">
 
 
def add_message(parent_truxton_file):
 
def add_message(parent_truxton_file):
 
   communication = parent_file.newcommunication()
 
   communication = parent_file.newcommunication()
Line 67: Line 66:
  
 
   communication.finished()
 
   communication.finished()
</syntaxhighlight>
+
</source>

Revision as of 07:37, 8 December 2020

This class lets you add to the communication items (email/sms/mms) to Truxton. This will populate the [Message], [MessageAddress], and other tables in the database.

Attributes and Methods

addparticipant(account, role)

After save() has been called, you add the participants to the message. The account is the phone number or email address or account that participated in the message. The role parameter is the MESSAGE_PARTICIPANT constants. It should be a value that matches the [ID] column of the [MessageAddressType] table.

fileid

The GUID of the file this event came from. This corresponds to the [FileID] column of the [Message] table.

finished()

This should be called after you have finished adding pieces to this message.

id

This is the GUID of the event. It becomes non-zero after save() has been called.

mediaid

This is the GUID of the media this event came from. This identifier corresponds to the [MediaID] of the [Message] table.

received

When the message was received in FILETIME ticks. This corresponds to the [Received] column of the [Message] table.

save()

This will commit the information to the [Message] table.

sent

When the message was sent in FILETIME ticks. This corresponds to the [Sent] column of the [Message] table.

subject

The subject of the message. If the message type is SMS or MMS, this is the text of the message. This corresponds to the [Text] column of the [MessageSubject] table.

tag(tag, reason, origin)

This creates a tag associated with this event in Truxton. The tag parameter is a short, one or two word, bit of text that will be displayed in the UI. The reason is a sentence explaining why this event was tagged. The origin is either TAG_ORIGIN_AUTOMATIC (1) or TAG_ORIGIN_HUMAN (2). It will return True if the tag was associated with the file, False on failure.

type

The type of message. It is one of the MESSAGE_TYPE constants. This corresponds to the [MessageTypeID] column of the [Message] table and should be a value from the [ID] column of the [MessageType] table.

Sample

 1 def add_message(parent_truxton_file):
 2   communication = parent_file.newcommunication()
 3   communication.sent = ticks("2015-08-16T21:31:37-00:00");
 4   communication.received = communication.sent
 5   communication.subject = "Dinner at 8?"
 6   communication.type = truxton.MESSAGE_TYPE_SMS
 7   communication.save()
 8 
 9   communication.addparticipant("703.555.1212", truxton.MESSAGE_PARTICIPANT_FROM)
10   communication.addparticipant("202.555.1212", truxton.MESSAGE_PARTICIPANT_TO)
11 
12   communication.finished()