Maintainer: | Sebastian Kippe seba@kip .pe stian |
Version: | 0.6.0 |
This module stores chat messages in daily archive files.
Chat Messages | |
Schemas | |
chat-messages/ | Represents one day of chat messages |
DailyArchive | A daily archive stores IRC messages by day. |
Properties | |
server | Contains information about the chat server/network |
channelName | Name of the IRC channel (e.g. |
date | Date of the archive’s content |
isPublic | `true` for public archives, `false` for private ones |
parsedDate | Object containing padded year, month and day of date |
dateId | Date string in the form of YYYY/MM/DD |
path | Document path of the archive file |
client | Public or private BaseClient, depending on isPublic |
previous | Date of previous log file as YYYY/MM/DD |
next | Date of next log file as YYYY/MM/DD |
Functions | |
addMessage | |
addMessages | Like addMessage, but for multiple messages at once. |
remove | Deletes the entire archive document from storage |
_updateDocument | Updates and writes an existing archive document |
_createDocument | Creates and writes a new archive document |
_buildArchiveObject | Builds the object to be stored in remote storage |
_updatePreviousArchive | Finds the previous archive document and updates its today.next value |
_findPreviousArchive | Returns the previous archive document |
_sync | Write archive document |
Represents one day of chat messages
{ "@context": "https://kosmos.org/ns/v1", "@id": "chat-messages/freenode/channels/kosmos/", "@type": "ChatChannel", "name": "#kosmos", "ircURI": "irc://irc.freenode.net/kosmos", "today": { "@id": "2015/01/01", "@type": "ChatLog", "messageType": "InstantMessage", "previous": "2014/12/31", "next": "2015/01/02", "messages": [ { "date": "2015-06-05T17:35:28.454Z", "user": "hal8000", "text": "knock knock" }, { "date": "2015-06-05T17:37:42.123Z", "user": "raucao", "text": "who's there?" }, { "date": "2015-06-05T17:55:01.235Z", "user": "hal8000", "text": "HAL" } ] } }
A daily archive stores IRC messages by day.
server | Chat server info (see DailyArchive.server) |
channelName | Name of room/channel |
date | Date of archive day |
isPublic | Store logs in public folder (defaults to false) |
previous | Date of previous log file as YYYY/MM/DD; looked up automatically when not given |
next | Date of next log file as YYYY/MM/DD; looked up automatically when not given |
var archive = new chatMessages.DailyArchive({ server: { type: 'irc', name: 'freenode', ircURI: 'irc://irc.freenode.net' }, channelName: '#kosmos', date: new Date(), isPublic: true });
var archive = new chatMessages.DailyArchive({ server: { type: 'xmpp', name: '5apps', xmppMUC: 'muc.5apps.com' }, channelName: 'watercooler', date: new Date(), isPublic: false });
Properties | |
server | Contains information about the chat server/network |
channelName | Name of the IRC channel (e.g. |
date | Date of the archive’s content |
isPublic | `true` for public archives, `false` for private ones |
parsedDate | Object containing padded year, month and day of date |
dateId | Date string in the form of YYYY/MM/DD |
path | Document path of the archive file |
client | Public or private BaseClient, depending on isPublic |
previous | Date of previous log file as YYYY/MM/DD |
next | Date of next log file as YYYY/MM/DD |
Functions | |
addMessage | |
addMessages | Like addMessage, but for multiple messages at once. |
remove | Deletes the entire archive document from storage |
_updateDocument | Updates and writes an existing archive document |
_createDocument | Creates and writes a new archive document |
_buildArchiveObject | Builds the object to be stored in remote storage |
_updatePreviousArchive | Finds the previous archive document and updates its today.next value |
_findPreviousArchive | Returns the previous archive document |
_sync | Write archive document |
Contains information about the chat server/network
type | Type of server/protocol (e.g. “irc”, “xmpp”, “campfire”, “slack”) |
name | Shortname/id/alias of network/server (e.g. “freenode”, “mycompanyname”) |
ircURI | (optional) IRC URI of network (e.g. “irc://irc.freenode.net/”) |
xmppMUC | (optional) XMPP MUC service host (e.g. “conference.jabber.org”) |
addMessages: function addMessage( messages, overwrite )
Like addMessage, but for multiple messages at once. Useful for bulk imports of messages.
messages | Array of message objects (see params for addMessage) |
overwrite | If true, creates a new archive file and overwrites the old one. Defaults to false. |
addMessage: function addMessage( message )
Like addMessage, but for multiple messages at once.
addMessages: function addMessage( messages, overwrite )
Deletes the entire archive document from storage
remove: function()
Updates and writes an existing archive document
_updateDocument: function( archive, messages )
Creates and writes a new archive document
_createDocument: function( messages )
Builds the object to be stored in remote storage
_buildArchiveObject: function()
Finds the previous archive document and updates its today.next value
_updatePreviousArchive: function()
Returns the previous archive document
_findPreviousArchive: function()
Write archive document
_sync: function( obj )