ChatRoom - TogetherGames/Public-Unity-CSharp GitHub Wiki
Together::ChatRoom
The ChatRoom class represents a ChatRoom and manages a list internally of ChatRoomUsers and ChatMessages
long ChatRoomID
The ID of the ChatRoom.
long RoomID
The ID of the Room the ChatRoom is in.
long CreatorUserID
The ID of the User that created the ChatRoom.
string CreatorUsername
The username of the User that created the ChatRoom.
int SecondsSinceCreated
The number of seconds since the ChatRoom was created.
int 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.
List<ChatRoomUser> ChatRoomUsers
Contains all the ChatRoomUsers managed by the ChatRoom internally
List<ChatMessage> ChatMessages
Contains all the ChatMessages managed by the ChatRoom internally
Adds a ChatRoomUser to the internally managed list.
Returns void
ChatRoom.AddChatRoomUser( chatRoomUser )
ChatRoomUser chatRoomUser
Instance of the ChatRoomUser to add internally
--------------------------------------------------------------------------------Finds the ChatRoomUser with the specified UserID if it exists, otherwise returns null.
Returns ChatRoomUser
ChatRoom.FindChatRoomUserByUserID( userID )
long userID
The ID of the User to find
--------------------------------------------------------------------------------Finds the ChatRoomUser with the specified ChatRoomUserID if it exists, otherwise returns null.
Returns ChatRoomUser
ChatRoom.FindChatRoomUserByChatRoomUserID( chatRoomUserID )
long chatRoomUserID
The ID of the ChatRoomUser to find
--------------------------------------------------------------------------------Gets the number of ChatRoomUsers currently managed internally.
Returns int
ChatRoom.GetChatRoomUserCount( )
Gets the ChatRoomUser at the specified index if it exists, otherwise returns null.
Returns ChatRoomUser
ChatRoom.GetChatRoomUser( index )
int index
The index of the ChatRoomUser to retrieve internally
--------------------------------------------------------------------------------Returns the index of the specified ChatRoomUser if it exists internally, otherwise returns -1.
Returns int
ChatRoom.IndexOfChatRoomUser( chatRoomUser )
ChatRoomUser 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 int
ChatRoom.IndexOfChatRoomUserByUserID( userID )
long 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 int
ChatRoom.IndexOfChatRoomUserByChatRoomUserID( chatRoomUserID )
long chatRoomUserID
The ID of the ChatRoomUser to find the index of
--------------------------------------------------------------------------------Removes a ChatRoomUser from the internal list.
Returns void
ChatRoom.RemoveChatRoomUser( index )
int index
The index of the ChatRoomUser to remove
--------------------------------------------------------------------------------Adds a ChatMessage to the internal list.
Returns void
ChatRoom.AddChatMessage( chatMessage )
ChatMessage chatMessage
Instance of the ChatMessage to add
--------------------------------------------------------------------------------Returns the ChatMessage with the specified ChatMessageID if it exists internally, otherwise returns null.
Returns ChatMessage
ChatRoom.FindChatMessageByChatMessageID( chatMessageID )
long chatMessageID
The ID of the ChatMessage to find
--------------------------------------------------------------------------------Gets the number of ChatMessages currently managed in the internal list.
Returns int
ChatRoom.GetChatMessageCount( )
Gets the ChatMessage at the specified index if it exists, otherwise returns null.
Returns ChatMessage
ChatRoom.GetChatMessage( index )
int index
The index of the ChatMessage to retrieve
--------------------------------------------------------------------------------Returns the index of the specified ChatMessage if it exists, otherwise returns -1.
Returns int
ChatRoom.IndexOfChatMessage( chatMessage )
ChatMessage 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 int
ChatRoom.IndexOfChatMessageByChatMessageID( chatMessageID )
long chatMessageID
The ID of the ChatMessage to find
--------------------------------------------------------------------------------Removes a ChatMessage from the internal list.
Returns void
ChatRoom.RemoveChatMessage( index )
int index
The index of the ChatMessage to remove
--------------------------------------------------------------------------------Post processes the ChatRoomUser's and ChatMessage's usernames. If a User is registered, its Name member will be assigned the name from their social network account. Otherwise, the Name member will be set to the User's Username.
Returns void
ChatRoom.PostProcessUsernames( )
Gets the details on a ChatRoom.
Returns void
ChatRoom.GetDetails( chatRoomID, startWithChatMessageID, callbackFunc )
long chatRoomID
The ID of the ChatRoom to get details on.
[long](#) startWithChatMessageIDID of the ChatMessage to start with when the server retrieves chat messages.
[OnCompleteHandler](./oncompletehandler) 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
ChatRoom.Join( callbackFunc )
OnCompleteHandler 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
ChatRoom.Leave( callbackFunc )
OnCompleteHandler 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
ChatRoom.CreateMessage( parentChatMessageID, message, callbackFunc )
long 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.
[OnCompleteHandler](./oncompletehandler) 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
ChatRoom.DeleteMessage( chatMessageID, callbackFunc )
long chatMessageID
The ID of the ChatMessage to delete.
[OnCompleteHandler](./oncompletehandler) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Marks a Message as Read. Upon success, this will automatically update the ChatMessage internally. Be sure to set the class's ChatRoomID member to the ID of the ChatRoom you wish to join.
Returns void
ChatRoom.MarkMessageAsRead( chatMessageID, callbackFunc )
long chatMessageID
The ID of the ChatMessage to mark as read.
[OnCompleteHandler](./oncompletehandler) 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
ChatRoom.Modify( callbackFunc )
OnCompleteHandler 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
ChatRoom.InviteUser( inviteeUserID, inviteeSocialType, inviteeSocialID, notificationMessage, callbackFunc )
long 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 "" if no notification is to be sent.
[OnCompleteHandler](./oncompletehandler) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------