class PrivateParlorXT::CachedHistory
- PrivateParlorXT::CachedHistory
- PrivateParlorXT::History
- Reference
- Object
Overview
An implementation of History
storing the messages in RAM as a Hash
Defined in:
private-parlor-xt/history/cached_history.crInstance Method Summary
-
#add_rating(message : MessageID, user : UserID) : Bool
Adds a rating entry to the database with the given data
-
#add_to_history(origin : MessageID, receiver : MessageID, receiver_id : UserID) : Nil
Add a receiver message to the
History
-
#add_warning(message : MessageID) : Nil
Adds a warning to the given message
-
#close
Cleanup when finished with
History
-
#delete_message_group(message : MessageID) : MessageID | Nil
Delete a message group from the
History
-
#expire : Nil
Deletes old messages from the
History
-
#message_map : Hash(MessageID, MessageGroup)
A hash of
MessageID
toMessageGroup
-
#messages_from_user(user : UserID) : Set(MessageID)
Get all message IDs sent by a given user for purging messages
-
#new_message(sender_id : UserID, origin : MessageID) : MessageID
Create a new message group and add it to the
History
-
#origin_message(message : MessageID) : MessageID | Nil
Get the message ID of the original message associated with the given message ID
-
#purge_receivers(messages : Set(MessageID)) : Hash(UserID, Array(MessageID))
Get a hash containing an array of message IDs to delete associated with the users who received a message in the given set.
-
#receiver_message(message : MessageID, receiver : UserID) : MessageID | Nil
Get the original message ID associated with the given message ID and receiver ID
-
#receivers(message : MessageID) : Hash(UserID, MessageID)
Get a hash of all users and receiver message IDs associated with the given message ID
-
#sender(message : MessageID) : UserID | Nil
Get the sender of the original message referenced by the given message ID
-
#warned?(message : MessageID) : Bool | Nil
Returns
true
if the given message was already warned;false
or nil otherwise
Instance methods inherited from class PrivateParlorXT::History
add_rating(message : MessageID, user : UserID) : Bool
add_rating,
add_to_history(origin : MessageID, receiver : MessageID, receiver_id : UserID) : Nil
add_to_history,
add_warning(message : MessageID) : Nil
add_warning,
close
close,
delete_message_group(message : MessageID) : MessageID | Nil
delete_message_group,
expire : Nil
expire,
lifespan : Time::Span
lifespan,
messages_from_user(user : UserID) : Set(MessageID)
messages_from_user,
new_message(sender_id : UserID, origin : MessageID) : MessageID
new_message,
origin_message(message : MessageID) : MessageID | Nil
origin_message,
purge_receivers(messages : Set(MessageID)) : Hash(UserID, Array(MessageID))
purge_receivers,
receiver_message(message : MessageID, receiver : UserID) : MessageID | Nil
receiver_message,
receivers(message : MessageID) : Hash(UserID, MessageID)
receivers,
sender(message : MessageID) : UserID | Nil
sender,
warned?(message : MessageID) : Bool | Nil
warned?
Constructor methods inherited from class PrivateParlorXT::History
new(lifespan : Time::Span)
new
Instance Method Detail
Adds a rating entry to the database with the given data
Returns true
if the user's rating was successfully added; false
if the user's rating already exists.
Add a receiver message to the History
Cleanup when finished with History
Mainly applicable for implementations using a database
Delete a message group from the History
Get all message IDs sent by a given user for purging messages
Create a new message group and add it to the History
Get the message ID of the original message associated with the given message ID
Get a hash containing an array of message IDs to delete associated with the users who received a message in the given set.
Used for the PurgeCommand
NOTE The returned array of message IDs should be sorted in descending order (most recent messages first)
Get the original message ID associated with the given message ID and receiver ID
Get a hash of all users and receiver message IDs associated with the given message ID
Get the sender of the original message referenced by the given message ID
Returns true
if the given message was already warned; false
or nil otherwise