TogetherChatRoom - TogetherGames/Public-Corona-Lua GitHub Wiki
Together::TogetherChatRoom
The ChatRoom class represents a ChatRoom and manages a list internally of ChatRoomUsers and ChatMessages
number ChatRoomID
The ID of the ChatRoom.
number RoomID
The ID of the Room the ChatRoom is in.
number CreatorUserID
The ID of the User that created the ChatRoom.
string CreatorUsername
The username of the User that created the ChatRoom.
number SecondsSinceCreated
The number of seconds since the ChatRoom was created.
number SecondsSinceModified
The number of seconds since the ChatRoom was last modified.
string Name
The name of the ChatRoom.
string Description
A textual description for the ChatRoom.
PropertyCollection Properties
A property collection containing all custom properties for the ChatRoom.
table ChatRoomUsers
Contains all the ChatRoomUsers that are in the ChatRoom.
table ChatMessages
Contains all the ChatMessages belonging to the ChatRoom.
Adds a ChatRoomUser to the internally managed list without persistence.
Note
This method is deprecated
Returns void
TogetherChatRoom:AddChatRoomUser( chatRoomUser )
TogetherChatRoomUser chatRoomUser
Instance of the ChatRoomUser to add internally
--------------------------------------------------------------------------------Finds the ChatRoomUser with the specified UserID if it exists, otherwise returns nil.
Returns TogetherChatRoomUser
TogetherChatRoom:FindChatRoomUserByUserID( userID )
number userID
The ID of the User to find
--------------------------------------------------------------------------------Finds the ChatRoomUser with the specified ChatRoomUserID if it exists, otherwise returns nil.
Returns TogetherChatRoomUser
TogetherChatRoom:FindChatRoomUserByChatRoomUserID( chatRoomUserID )
number chatRoomUserID
The ID of the ChatRoomUser to find
--------------------------------------------------------------------------------Gets the number of ChatRoomUsers currently managed internally.
Returns number
TogetherChatRoom:GetChatRoomUserCount( )
Gets the ChatRoomUser at the specified index if it exists, otherwise returns nil.
Returns TogetherChatRoomUser
TogetherChatRoom:GetChatRoomUser( index )
number index
The index of the ChatRoomUser to retrieve internally
--------------------------------------------------------------------------------Returns the index of the specified ChatRoomUser if it exists internally, otherwise returns nil.
Returns number
TogetherChatRoom:IndexOfChatRoomUser( chatRoomUser )
TogetherChatRoomUser chatRoomUser
Instance of the chatRoomUser to find the index of
--------------------------------------------------------------------------------Returns the index of the ChatRoomUser with the specified UserID if it exists, otherwise returns -1.
Returns number
TogetherChatRoom:IndexOfChatRoomUserByUserID( userID )
number userID
The ID of the User to find the index of
--------------------------------------------------------------------------------Returns the index of the ChatRoomUser with the specified ChatRoomUserID if it exists, otherwise returns -1.
Returns number
TogetherChatRoom:IndexOfChatRoomUserByChatRoomUserID( chatRoomUserID )
number chatRoomUserID
The ID of the ChatRoomUser to find the index of
--------------------------------------------------------------------------------Removes a ChatRoomUser from the internal list without persistence.
Note
This method is deprecated
Returns void
TogetherChatRoom:RemoveChatRoomUser( index )
number index
The index of the ChatRoomUser to remove
--------------------------------------------------------------------------------Adds a ChatMessage to the internal list without persistence.
Note
This method is deprecated
Returns void
TogetherChatRoom:AddChatMessage( chatMessage )
TogetherChatMessage chatMessage
Instance of a ChatMessage to add internally
--------------------------------------------------------------------------------Returns the ChatMessage with the specified ChatMessageID if it exists internally, otherwise returns nil.
Returns TogetherChatMessage
TogetherChatRoom:FindChatMessageByChatMessageID( chatMessageID )
number chatMessageID
The ID of the ChatMessage to find
--------------------------------------------------------------------------------Gets the number of ChatMessages currently managed in the internal list.
Returns number
TogetherChatRoom:GetChatMessageCount( )
Gets the ChatMessage at the specified index if it exists, otherwise returns nil.
Returns TogetherChatMessage
TogetherChatRoom:GetChatMessage( index )
number index
The index of the ChatMessage to find
--------------------------------------------------------------------------------Returns the index of the specified ChatMessage if it exists, otherwise returns nil.
Returns number
TogetherChatRoom:IndexOfChatMessage( chatMessage )
TogetherChatMessage chatMessage
Instance of the ChatMessage to retrieve the index of
--------------------------------------------------------------------------------Returns the index of the ChatMessage with the specified ChatMessageID if it exists, otherwise returns -1.
Returns number
TogetherChatRoom:IndexOfChatMessageByChatMessageID( chatMessageID )
number chatMessageID
The ID of the ChatMessage to find the index of
--------------------------------------------------------------------------------Removes a ChatMessage from the internal list without persistence.
Note
This method is deprecated
Returns void
TogetherChatRoom:RemoveChatMessage( index )
number index
The index of the ChatMessage to remove
--------------------------------------------------------------------------------Gets the details on a ChatRoom.
Returns void
TogetherChatRoom:GetDetails( chatRoomID, startWithChatMessageID, callbackFunc )
number chatRoomID
The ID of the ChatRoom to get details on.
[number](#) startWithChatMessageIDID of the ChatMessage to start with when the server retrieves chat messages.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Joins the current session and user to this ChatRoom. Upon success, this will automatically update the internal list.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to join.
Returns void
TogetherChatRoom:Join( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Disconnects the current session and user from this ChatRoom.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to leave.
Returns void
TogetherChatRoom:Leave( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Creates a new ChatMessage and adds it to this ChatRoom. Upon success, this will automatically update the internal list.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to join.
Returns void
TogetherChatRoom:CreateMessage( parentChatMessageID, message, callbackFunc )
number parentChatMessageID
The ID of the ChatMessage that is to be the parent of the newly created ChatMessage. Pass in 0 if the ChatMessage is not to have a parent.
[string](#) messageThe message to assign to the ChatMessage.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Deletes a ChatMessage from the ChatRoom. Upon success, this will automatically update the internal list.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to delete.
Returns void
TogetherChatRoom:DeleteMessage( chatMessageID, callbackFunc )
number chatMessageID
The ID of the ChatMessage to delete
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Marks a Message as Read. Upon success, this will automatically update the ChatMessage internally.
Returns void
TogetherChatRoom:MarkMessageAsRead( chatMessageID, callbackFunc )
number chatMessageID
The ID of the ChatMessage to mark as read
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Modifies the ChatRoom. Upon success, this will automatically update the ChatRoom internally. With this method, you can modify the following parameters of the ChatRoom: RoomID, Name, Description, ChatRoomProps.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to modify.
Returns void
TogetherChatRoom:Modify( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Invites a User to this ChatRoom. You must either specify a valid inviteeUserID or valid inviteeSocialType and inviteeSocialID. For Facebook, pass in "FB" for inviteeSocialType and the friend's FacebookID for inviteeSocialID.
Note
Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish the User to be invited to.
Returns void
TogetherChatRoom:InviteUser( inviteeUserID, inviteeSocialType, inviteeSocialID, notificationMessage, callbackFunc )
number inviteeUserID
The ID of the User to invite. Pass in 0 if not specified.
[string](#) inviteeSocialTypeThe type of social network. Pass in "" if not specified. "FB" for Facebook.
[string](#) inviteeSocialIDThe ID of the social friend. Pass in "" if not specified. Friends's FacebookID otherwise.
[string](#) notificationMessageThe message to use when creating a UserNotification for the User being invite. Pass in "" if no notification is to be sent.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------