Difference between revisions of "TruxtonChildFileIO newcommunication"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This create new communication object from a file in Truxton. It automatically associates the parent file and media identifiers used in the <code>Messa...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
This create new [[TruxtonCommunication|communication]] object from a file in Truxton.
 
This create new [[TruxtonCommunication|communication]] object from a file in Truxton.
It automatically associates the parent file and media identifiers used in the <code>Message</code> table.
+
It automatically associates the parent file and media identifiers used in the <code>[Message]</code> table.
  
 
=Syntax=
 
=Syntax=
Line 12: Line 12:
 
=Sample=
 
=Sample=
  
<syntaxhighlight lang="Python" line highlight="5">
+
<syntaxhighlight lang="Python" highlight="5">
 
def main():
 
def main():
 
   t = truxton.create()
 
   t = truxton.create()
Line 31: Line 31:
  
 
if __name__ == "__main__":
 
if __name__ == "__main__":
   main()
+
   sys.exit(main())
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:03, 3 February 2024

This create new communication object from a file in Truxton. It automatically associates the parent file and media identifiers used in the [Message] table.

Syntax

object newcommunication();

Return value

An communication object

Sample

def main():
  t = truxton.create()
  file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")

  communication = file.newcommunication()

  communication.sent = ticks("2015-08-16T21:31:37-00:00");
  communication.received = communication.sent
  communication.subject = "Dinner at 8?"
  communication.type = truxton.MESSAGE_TYPE_SMS
  communication.save()

  communication.addparticipant("703.555.1212", truxton.MESSAGE_PARTICIPANT_FROM)
  communication.addparticipant("202.555.1212", truxton.MESSAGE_PARTICIPANT_TO)

  communication.finished()

if __name__ == "__main__":
  sys.exit(main())