Chat messaging structures

.html ››
Parent Previous Next

Chat messaging structures

This section describes common structures and Lua tables used to handle chat messaging jobs.


Entity table

The Entity table contains information about a user. It is a Lua table with the following fields:


Field

Type

Description

id

Integer

Contains the internal ID of the user.


login

String

Contains the username of the user. If the value is equal to "@Firecast", the entity is the Firecast server itself.


nick

String

(Optional) Contains the nickname of the user. If this field is missing, the value of the field login is assumed as nick.


gender

Enumerated/String:

  • "undefined"
  • "masculine"
  • "feminine"
  • "neuter"

(Optional) Defines the grammatical gender to be used when referring to the user.


  • "undefined" - Gender is not specified.
  • "masculine" - Masculine gender.
  • "feminine" - Feminine gender.
  • "neuter" - Neuter gender.


If this field is missing, the grammatical gender "undefined" is assumed.



Impersonation table

The Impersonation table is a Lua table utilized to specify how a message is impersonated. It contains the following fields:


Field

Type

Description

mode

Enumerated/String:

  • "none"
  • "narrator"
  • "character"


Indicates the mode of impersonation:

  • "none" - No impersonation is used.
  • "narrator" - Impersonates the narrator/GM.
  • "character" - Impersonates a character, perharps an NPC.


If this field is missing, the mode "none" is assumed.


avatar

String

(Optional) A URL string pointing to an image used as the avatar of the impersonation. This field is optional and applicable to "narrator" and "character" impersonation modes.


gender

Enumerated/String:

  • "undefined"
  • "masculine"
  • "feminine"
  • "neuter"


(Optional) Defines the grammatical gender to be used when referring to the impersonated entity.


  • "undefined" - Gender is not specified.
  • "masculine" - Masculine gender.
  • "feminine" - Feminine gender.
  • "neuter" - Neuter gender.


If this field is missing, the grammatical gender "undefined" is assumed.


name

String

(Optional) Defines the name and/or nickname of the character being impersonated. This field is optional and utilized with the "character" impersonation mode.



LogRec table

The LogRec table describes a message in a chat. It is a Lua table with the following fields:


Field

Type

Description

id

String


Identification of the message, generated by Firecast Client. The message is uniquely identified by combining the fields id and tid.


tid

String

Identification of the message, generated by Firecast Server. The message is uniquely identified by combining the fields id and tid.


The name tid stands for "timestamp id" because its value includes a server timestamp of when it was generated. Firecast uses tid to sort messages and perform sequential scans.


timestamp

Timestamp table


When the message was sent in UTC.


medium

Medium table

Identifies the chat in which the message was sent.


entity

Entity table

This field identifies who sent the message. In the case of a kick, this field contains the user who was kicked, and "msg.responsible" identifies who performed the kick.


msg

MsgContent table

The content of the message.


visibility

MsgVisibility table

Describes the visibility of the message.


updates

Array of MsgUpdate table

(Optional) An array containing the update history for this message, sorted in edition order. This message has not been updated if this field is missing or its length is zero.


isDeleted

Boolean

(Optional) Indicates if the message was deleted from the chat. If missing or nil, the message was not deleted.


deleter

Entity table

(Optional) Valid if isDeleted == true, identifies who deleted the message.


deletionTimestamp

Timestamp table

(Optional) Valid if isDeleted == true, contains the timestamp in UTC of when the message was deleted.


_visible

Boolean

An auxiliary flag, which is not part of the message itself. Indicates if this message can be visible to the user.


_storable

Boolean

An auxiliary flag, which is not part of the message itself. Indicates if this message can be both visible to the user and can be stored in the Firecast server log.




Medium table

The Medium table identifies a communication medium in Firecast. It is a Lua table with the following fields:


Field

Type

Description

kind

Enumerated/String:

  • "undefined"
  • "direct"
  • "room"
  • "pvtOnRoom"
  • "groupPvtOnRoom"
  • "roomChannel"


Defines the kind of the communication medium an can be one of the following values:


  • "undefined" - Should not be used.
  • "direct" - A contact list chat.
  • "room" - A room chat.
  • "pvtOnRoom" - A private chat whitin a room.
  • "groupPvtOnRoom" - A private group chat within a room.
  • "roomChannel" - A room channel chat (future implementation).


user1

user2

Integer

(Optional) These two fields are valid when kind is "direct" or "pvtOnRoom" and contain the internal identification of the users involved in the chat.


Remarks:

  • The value stored in the field "user1" must be less than or equal to the value stored in the field "user2".


roomId

Integer

(Optional) Valid when kind is "room," "pvtOnRoom," "groupPvtOnRoom," or "roomChannel." Contains the internal identification of the room.


groupId

String

(Optional) Valid when kind is "groupPvtOnRoom" and contains the unique identification of the private group chat inside a room.


channelId

String

(Optional) Valid when kind is "roomChannel" and contains the unique identification of the channel inside a room (future implementation).



MsgContent table

The MsgContent table describes the content of a message. It is a Lua table with the following fields:


Field

Type

Description

msgType

String/Enumerated:

  • "standard"
  • "action"
  • "dice"
  • "laugh"
  • "file"
  • "startTypingStatus"
  • "stopTypingStatus"
  • "signal"
  • "sys_notification"
  • "sys_mediumCreation"
  • "sys_mediumDestruction"
  • "sys_mediumPropertyChange"
  • "sys_userJoin"
  • "sys_userLeave"
  • "sys_userPresencePropertyChange"
  • "sys_genericLogMessage"


dentifies the type of message and can be one of the following values:


  • "standard" - A standard chat message
  • "action" -  An action message, when the /me command is used
  • "dice" - A dice roll message.
  • "laugh" - A laugh message, when the /rir command is used
  • "file" - A file upload message.
  • "startTypingStatus" - A message used to signal when a user is typing (not persisted, not shown)
  • "stopTypingStatus" - A message used to signal when a user stops typing (not persisted, not shown).
  • "signal" - A custom signal message (not persisted, not shown).
  • "sys_notification" - A notification generated by the Server.
  • "sys_mediumCreation" - A message about when the chat medium was created in the server.
  • "sys_mediumDestruction" - A message about when the chat medium was destroyed in the server.
  • "sys_mediumPropertyChange" -  A message that describes a change made to a property of the chat medium.
  • "sys_userJoin" - A message informing that some user joined the chat medium.
  • "sys_userLeave" - A message informing that some user left the chat medium. 
  • "sys_userPresencePropertyChange" - A message that describes a change made to a user's presence in the chat medium.
  • "sys_genericLogMessage" - A client generic log message (not persisted and not sent to the server).


Remarks:

  • If this field is missing or empty, the message is not handled by the client because, probably, the Firecast client needs to be updated.


content

String

The string message content.


roll

Rollagem object


(Optional) Valid when msgType == "dice".

Describes the dice roll and its result.


impersonation

Impersonation table

Defines how this message is impersonated.


talemarkOptions

TalemarkOptions table

The TalemarkOptions of this message, describing how Firecast should color, format, and parse the message.


responsible

Entity table

(Optional) If present, this field identifies the responsible of the event, like who kicked a user, who invited a user to a PVT group chat, who changed a property in the chat, and so on.


propertyId

Any type

(Optional) Valid for msgType "sys_mediumPropertyChange" and "sys_userPresencePropertyChange".


Contains the identification of what property was changed.


Some of the known values of this field are listed below:

  • "modes" - User modes (gm, mute, voice, blind, player, juggernaut)
  • "nick" - User nick
  • "isModerated" - The moderation flag of the chat medium
  • "password" - The password required to join the chat medium.
  • "welcomeMsg" - The welcome message of the chat medium.
  • "name" - The name of the chat medium
  • "statusMsg" - A status string of the chat medium.
  • "tags" - The tags of the chat medium


oldValue

Any type

(Optional) Valid for msgType "sys_mediumPropertyChange" and "sys_userPresencePropertyChange".


Contains the previous value of the property before its change.


newValue

Any type

(Optional) Valid for msgType "sys_mediumPropertyChange" and "sys_userPresencePropertyChange".


Contains the new value of the property after its change.


fileName

String

(Optional) Valid when msgType == "file".

Contains the name of the file.


fileURL

String

(Optional) Valid when msgType == "file".

Contains the URL address to download the file.


fileMimeType

String

(Optional) Valid when msgType == "file".

Contains the Mime Type of the file, like 'image/png', 'text/html', 'video/mp4', and so on.


fileSize

Integer

(Optional) Valid when msgType == "file".

Contains the file size in byte count.


joinType

String/Enumerated:

  • "conscious"
  • "added"


(Optional) Valid when msgType == "sys_userJoin".


Defines how the user joined the chat medium and can be one of the following values:

  • "conscious" - The join was conscious; the user itself joined the chat medium.
  • "added" - he join occurred because someone added him/her/them to the medium chat.


leaveType

String/Enumerated:

  • "standard"
  • "kicked"


(Optional) Valid when msgType == "sys_userLeave".


Defines how the user left the chat medium and can be one of the following values:

  • "standard" - The user left the chat medium, or some disconnection happens.
  • "kicked" - The user left the chat because someone, identified by the field "responsible," has kicked him/her/them.


extra

A custom Lua table

(Optional) If defined, contains custom extra details of the message. Its content is not defined and can be anything. Used in msgType == "signal".




MsgUpdate table

The MsgUpdate table describes a single update made to the message. It is a Lua table with the following fields:


Field

Type

Description

timestamp

Timestamp table


The timestamp in UTC of when this update was made to the message.


updater

Entity table

This field identifies who changed the message.


contentChanged

Boolean

(Optional) Indicates if the message content was changed in this update. Assumes false If this field is missing or nil.


oldContent

String

(Optional) Valid when contentChanged == true, contains the message content string before the update.


impersonationChanged

Boolean

(Optional)  Indicates if the message impersonation was changed in this update. Assumes false If this field is missing or nil.


oldImpersonation

Impersonation table

(Optional) Valid when impersonationChanged == true, contains the message impersonation before the update.


talemarkOptionsChanged

Boolean

(Optional) Indicates if the message TalemarkOptions was changed in this update. Assumes false If this field is missing or nil.


oldTalemarkOptions

TalemarkOptions table

(Optional) Valid when talemarkOptionsChanged == true, contains the message TalemarkOptions before the update.



MsgVisibility table

The MsgVisibility table describes the visibility of a message. It is a Lua table with the following optional fields:


Field

Type

Description

mode

Enumerated/String:

  • "standard"
  • "recipients"


Defines the message visibility mode:


  • "standard" - The standard mode, where the message is visible to all.
  • "recipients" - Targeted mode, where the field "recipients" defines who should be able to view the message


If this field is missing, the mode "standard" is assumed.


recipients

Array of Integer

(Optional) A Lua array containing the internal IDs of Firecast users that defines the message recipients. 


When mode == "standard", this field is ignored when sending messages, but Firecast Server uses it to describe who was in the chat at the moment the message was sent and could see it.


When mode == "recipients", only those who are in this array can see the message.


Internal IDs can be obtained using:


blacklist

Array of Integer

(Optional) A Lua array containing the internal IDs of Firecast users who can't see the message. It can be used when mode == "standard".


Internal IDs can be obtained using:



QueryLogRecsParams table

The QueryLogRecsParams table is utilized to specify how to retrieve messages stored in the Firecast server. It is a Lua table with the following optional fields:


Field

Type

Description

audit

Boolean

(Optional) Indicates whether the server should include deleted messages in the response. If this field is missing, it assumes a default value of "false".


limit

Integer

(Optional) Specifies the number of messages to fetch. Valid values range from 1 to 50. If absent, the default value assumed is 50.


timestamp

Timestamp table

(Optional) If defined, queries for the latest messages with a timestamp less than or equal to this value.


Remarks:

  • It is not possible to use both "tid" and "timestamp" fields simultaneously.
  • If both the "tid" and "timestamp" fields are missing, the latest messages of the chat are fetched.


tid

String

(Optional) If defined, queries for the latest messages with tid less than this tid.


Remarks:

  • tid stands for timestamp id, representing a unique identifier for each message, used for sorting and sequential scanning of messages in the log.
  • The message with tid equal to this tid is not fetched; only the preceding ones.
  • It is not possible to use both "tid" and "timestamp" fields simultaneously.
  • If both the "tid" and "timestamp" fields are missing, the latest messages of the chat are fetched.



QueryLogRecsResponse table

The QueryLogRecsResponse table contains the response of a query for messages stored in the Firecast server. It is a Lua table with the following fields:


Field

Type

Description

bof

Boolean

This field indicates whether the query reached the beginning of the file. If true, no more messages exist with the same query parameters. If false, you can fetch more messages using the "tid" of the first message in the "logRecs" field.


Remarks:

  • The "logRecs" field may contain messages even when "bof == true". In this case, the messages in the "logRecs" field are the last messages that could be fetched with the same query parameters.


logRecs

Array of LogRec table

The messages fetched from the server, sorted by their tid (timestamp id).




SendMessageParameters table

The SendMessageParameters table is employed to define additional parameters when sending messages to chats. It is a Lua table with the following optional fields:



Field

Type

Description

impersonation

Impersonation table

(Optional) Describes how to impersonate the message. If missing, the message will not be impersonated.


talemarkOptions

TalemarkOptions table

(Optional) Describes how to color, format, and parse the message. If missing, the user's current talemark options will be used.


visibility

MsgVisibility table

(Optional) Describes who will receive the message. If missing, the standard visibility will be used.




TalemarkBlockStyle table

The TalemarkBlockStyle table specifies the text style of a message block. It is a Lua table with the following optional fields


Field

Type

Description

color

String

(Optional) A color string or a number with the pallete index defining the text font color. If missing, a default color will be assumed.


bkgColor

String

(Optional) A color string or a number with the pallete index defining the text background color. If missing, a default background color will be assumed.


bold

Boolean

(Optional) Should the text use bold style? Default: false


italic

Boolean

(Optional) Should the text use italic style? Default: false


strikeout

Boolean

(Optional) Should the text be struck out? Default: false


underline

Boolean

(Optional) Should the text be underlined?? Default: false




TalemarkOptions table

The TalemarkOptions table specifies how Firecast should color, format, and parse a message. It is a Lua table with the following optional fields:


Field

Type

Description

defaultTextStyle

TalemarkBlockStyle table

(Optional) Describes the default text style. If missing, a default style will be assumed.


charActionTextStyle

TalemarkBlockStyle table

(Optional) Describes the text block style for character actions. If missing, a default style will be assumed.


charEmDashSpeechTextStyle

TalemarkBlockStyle table

(Optional) Describes the text block style for character speeches marked by "--". If missing, a default style will be assumed.


charQuotedSpeechTextStyle

TalemarkBlockStyle table

(Optional) Describes the text block style for character speeches marked by quotes. If missing, a default style will be assumed.


outOfCharTextStyle

TalemarkBlockStyle table

(Optional) Describes the text block style for out-of-character interlocutions. If missing, a default style will be assumed.


parseCharActions

Boolean

(Optional) Should parse character actions marked with * * delimiters?

Default: true


parseCharEmDashSpeech

Boolean

(Optional) Should parse character speeches marked with -- delimiters?

Default: true


parseCharQuotedSpeech

Boolean

(Optional) Should parse character speeches marked by quotes?

Default: true


parseCommonMarkStrongEmphasis

Boolean

(Optional) Should parse strong/bold emphasis marked by ** ** and/or __ __ delimiters?

Default: true


parseHeadings

Boolean

(Optional) Should parse headings marked by #, ===, and/or ---- delimiters?
Default: true


parseHorzLines

Boolean

(Optional) Should parse horizontal lines marked by ----- and/or ****?
Default: true


parseInitialCaps

Boolean

(Optional) Should parse initial caps marked by {} delimiters?
Default: true


parseOutOfChar

Boolean

(Optional) Should parse out-of-character interlocution marked by (( )) delimiters?

Default: true


parseSmileys

Boolean

(Optional) Should parse smileys and memes?

Default: true


parseURL

Boolean

(Optional) Should parse URLs and links?

Default: true


trimTexts

Boolean

(Optional) Should excess spaces in the text be trimmed?

Default: true


       

TalemarkTag table

The TalemarkTag table contains a single parsed tag of a talemark markup text. It is a Lua table that forms a tree structure with the following optional fields:


Field

Type

Description

type

String/Enumerated:

  • "root"
  • "paragraph"
  • "heading"
  • "horzLine"
  • "quotedSpeech"
  • "emDashSpeech"
  • "charAction"
  • "outOfChar"
  • "initialCaps"
  • "emphasis"
  • "strong"
  • "fontStyle"
  • "fontColor"
  • "bkgColor"
  • "text"
  • "breakline"
  • "url"
  • "image"
  • "smiley"

Present in all tags, contains the identification of what tag is this, and can be one of the following values:


  • "root" - The root tag, used to group all other tags inside.
  • "paragraph" - A standard paragraph.
  • "heading" - A heading paragraph.
  • "horzLine" - A horizontal line paragraph.


  • "quotedSpeech" - A span to delimit quoted speech.
  • "emDashSpeech" - A span to delimit em-dash speech.
  • "charAction" - A span to delimit character action.
  • "outOfChar" - A span to delimit out-of-character interlocution.


  • "initialCaps" - A style-span whose content must be presented as an initial capital letter.
  • "emphasis" -  A style-span whose content is emphasized, usually in italic.
  • "strong" - A style-span whose content is strongly emphasized, usually in bold.
  • "fontStyle" - A style-span whose content must be presented according to the "style" field.
  • "fontColor" - A style-span whose text must be presented with the font color defined by the fields "mode" and "color".
  • "bkgColor" - A style-span whose text must be presented with the background color defined by the fields "mode" and "color".

  • "text" - A text element whose content is stored in the field called "text".
  • "breakline" - A break-line element.
  • "url" - A link text element whose content is stored in the field "text" and the URL address stored in the "url" field.
  • "image" - An image element, whose URL is stored in the "url" field.
  • "smiley" - A smiley element identified by the "id" field.


children

Array of TalemarkTag table

(Optional) As TalemarkTag tables represent a tree structure, this field contains the children nodes and/or leaves of this tag.


Remarks:

  • If this field is missing or nil, the tag does not contain children tags. Always test if this field is missing or nil.


altText

String

(Optional) Valid when type == "smiley".


If present, contains a Unicode string/emoji that can be used as an alternative way to present the smiley.


aspect

String/Enumerated:

  • "stretch"
  • "proportional"
  • "autoFit"


(Optional) Valid when type == "image".


Determines how the image should be presented, regarding its aspect ratio:


  • "stretch" - The image should be resized so that it occupies all the space, being able to flatten or lengthen.

  • "proportional" - The image must be resized proportionally to the available size, without the need to occupy all the available space.


  • "autoFit" - The image must be displayed in such a way that it always occupies all the available space in the most appropriate way, that is, enlarging/decreasing the image, centering it, and cropping excesses.


color

String or Integer

(Optional) Valid for types "fontColor" and "bkgColor":


Contains the color identification. The meaning of this value is stored in the field "mode".


descent

Number

(Optional) Valid when type == "image".


If present, contains how much, in logical pixels, the image should descend the text baseline when presenting it.


float

String/Enumerated:

  • "left"
  • "right"


(Optional) Valid when type == "image".


If present, indicates how the image should float in the text:


  • "left" - The image should float on the left, and the text should surround it on the right.
  • "right" - The image should float on the right, and the text should surround it on the left.


height

Number

(Optional) Valid when type == "image".


If present, contains the height, in logical pixels, in which the image should be presented.


id

String

(Optional) Valid when type == "smiley".


Contains the identification of what smiley is this.


isATX

Boolean

(Optional) Valid when type == "heading".


Indicates if the heading was marked up in the text as an ATX-Style. False means the text was marked up as Setext-Style.


ATX-Style example:

## My Heading Text Example


Setext-Style example:

My Heading Text Example

=======


level

Integer

(Optional) Valid when type == "heading".


Contains the depth level of the heading. Starts with the value 1.


mode

String/Enumerated:

  • "default"
  • "palette"
  • "rgb"


(Optional) Valid for types "fontColor" and "bkgColor":


  • "default" - A default color. The field "color" does not contain any information.


  • "pallete" - A color indexed by the standard palette. The field "color" contains an integer with the palette index.


  • "rgb" - A custom specific color defined as a Color String in the the field "color".


shortcut

String


(Optional) Valid when type == "smiley".


Contains the text in the parsed text that generated this smiley.


style

String/Enumerated:

  • "bold"
  • "underline"
  • "italic"
  • "strikeOut"


(Optional) Valid when type == "fontStyle".


Contains which font style the span should be presented with.

text

String

(Optional) Valid for types "text" and "url".


The string text content of the tag.


url

String

(Optional) Valid for types "url" and "image".


The URL address of the link or image.


width

Number

(Optional) Valid when type == "image".


If present, it contains the width, in logical pixels, in which the image should be presented.



Timestamp table

The Timestamp table specifies a date and time. It is a Lua table with the following fields:


Field

Type

Description

year

Integer

The year component


month

Integer

The month component, with values in the range from 1 to 12.


day

Integer

The day component, with values in the range from 1 to 31.


hour

Integer

(Optional) The hour component, with values in the range from 0 to 23.


min

Integer

(Optional) The minute component, with values in the range from 0 to 59.


sec

Integer

(Optional) The seconds component, with values in the range from 0 to 59.


msec


Integer

(Optional) The milliseconds component, with values in the range from 0 to 999.

Created with the Personal Edition of HelpNDoc: Achieve Professional Documentation Results with a Help Authoring Tool