Commit Graph

184 Commits

Author SHA1 Message Date
projectmoon 7e1abab66d Resync command now uses record_room_information.
continuous-integration/drone/push Build is passing Details
2020-11-29 21:18:41 +00:00
projectmoon 569ba4f2e0 Carry full room instance in context instead of just room id.
continuous-integration/drone/push Build is passing Details
2020-11-29 21:03:45 +00:00
projectmoon 118e4b00c7 Store room info when joining a room. 2020-11-29 17:06:04 +00:00
projectmoon c8c38ac1d4 Avoid nested map when retrieving room info from db.
continuous-integration/drone/push Build is passing Details
2020-11-29 16:55:23 +00:00
projectmoon 91cfc52e5b Change record_users_in_room to record_room_information.
continuous-integration/drone/push Build is passing Details
2020-11-29 14:02:40 +00:00
projectmoon 224f8cd0f1 Functions for storing RoomInfo in db. Refactor bot joins room event.
continuous-integration/drone/push Build is passing Details
Add get/insert functions for RoomInfo in the rooms db.

Move 'bot joins room' code to single method, so we can also record a
RoomInfo struct into the database.
2020-11-29 14:00:05 +00:00
projectmoon 68db038336 Properly avoid allocation for our_username in resync command.
continuous-integration/drone/push Build is passing Details
2020-11-23 19:54:20 +00:00
projectmoon 18352c8c19 Filter out our username when resyncing (with an allocation).
continuous-integration/drone/push Build was killed Details
2020-11-22 22:13:11 +00:00
projectmoon dda0d74f45 Implement resync command without filtering ourselves out.
continuous-integration/drone/push Build was killed Details
2020-11-22 21:30:24 +00:00
projectmoon f46b914239 Add matrix client to context. 2020-11-22 20:52:44 +00:00
projectmoon f352c90b6b Return error on unrecognized commands.
continuous-integration/drone/push Build is passing Details
2020-11-12 21:05:14 +00:00
projectmoon e251294b5f Only execute lines with commands.
continuous-integration/drone/push Build is passing Details
Fixes #45 and #46.
2020-11-12 20:22:09 +00:00
projectmoon 0e04e67f6e Log debug instead of trace for timestamp index inserts.
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
2020-11-10 20:37:14 +00:00
projectmoon 551f21a49a Fix minor typo in rooms db code. 2020-11-10 20:22:26 +00:00
projectmoon 9ed2a81dd3 Record all users in room when joining.
continuous-integration/drone/pr Build is failing Details
continuous-integration/drone/push Build is failing Details
2020-11-10 20:18:00 +00:00
projectmoon 0939feee84 Placeholder to record all user info when joining room
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-11-09 21:17:03 +00:00
projectmoon 9349dd5f00 Add event processing check to received messages.
Also rename the existing `should_process` function to be more clear,
given presence of another similarly named function:
should_process_message.
2020-11-09 21:16:20 +00:00
projectmoon 74d0b88e80 Add should process check to room member event 2020-11-09 21:16:07 +00:00
projectmoon fb24090952 Keep seen events in database, don't process already-seen events.
Adds a new function `should_process` to rooms impl that determines if
calling could should proceed with processing an event ID. Event IDs
are recorded (along with room ID) as a key pointing to the
system-local timestamp of when the event was received. If the key was
not originally present, we instruct calling code to process the event.

Events are also asychronously recorded by timestamp using a sled event
watcher that listens to inserts in the main tree (described above).
This secondary tree will allow easy cleanup of old events in the
future.
2020-11-09 21:16:07 +00:00
projectmoon d7aaed9e00 Implement room clearing, log to info for member updates. 2020-11-08 21:47:01 +00:00
projectmoon b5c78bcee5 Remove userandroom struct from rooms db 2020-11-08 21:47:01 +00:00
projectmoon 51ba3e3f42 Record user join/leaves in rooms. Move event emitter to its own file. 2020-11-08 21:47:01 +00:00
projectmoon 8e2f34819e Half implemented room state management foundations. 2020-11-08 21:47:01 +00:00
projectmoon 5ce79a3c05 Ignore emacs temp files.
continuous-integration/drone/push Build is passing Details
2020-11-08 21:44:37 +00:00
projectmoon a5dde18899 Update to the latest matrix SDK, and fix the Cargo.toml entry.
By using rev instead of branch, we were somehow stuck on a very old
version of the SDK. The dependency has now been switched to branch
instead of rev, and the SDK updates properly to latest master when
carg update is called.
2020-11-08 21:43:18 +00:00
projectmoon 09278a80b5 Disable docker image building on GitHub.
continuous-integration/drone/push Build is passing Details
2020-11-06 09:02:59 +00:00
projectmoon 0d63f7ebcb Fix docker registry domain in drone.
continuous-integration/drone/push Build is passing Details
2020-11-06 08:24:30 +00:00
projectmoon d2a4d76ab2 Revert "Change repository name for docker image."
This reverts commit ff34a93e40.
2020-11-06 08:23:52 +00:00
projectmoon ff34a93e40 Change repository name for docker image.
continuous-integration/drone/push Build is failing Details
2020-11-05 23:32:22 +00:00
projectmoon b3c258e279 Attempt to add docker image build to Drone.
continuous-integration/drone/push Build is failing Details
2020-11-05 23:22:26 +00:00
projectmoon fcec37afb2 Fix typo about config file in readme.
continuous-integration/drone/push Build is passing Details
2020-11-05 23:04:03 +00:00
projectmoon 472f02d153 Execute commands even when surrounded by weird whitespace.
continuous-integration/drone/push Build is passing Details
2020-11-05 23:03:22 +00:00
projectmoon 3154f36dca Add build badge
continuous-integration/drone/push Build is passing Details
2020-11-05 21:08:17 +00:00
projectmoon bc89088dd1 Fix GitHub link in readme.
continuous-integration/drone/push Build is passing Details
2020-11-05 20:48:09 +00:00
projectmoon 53840bff9f Add CoC mention to the readme
continuous-integration/drone/push Build is passing Details
2020-11-05 20:39:58 +00:00
projectmoon d456320e66 Update readme for repo mirroring. 2020-11-05 19:56:25 +00:00
projectmoon e7520f6206 Test mirroring to github 2020-11-05 19:47:02 +00:00
projectmoon cdc4254783 Note github moving. 2020-11-05 19:25:44 +00:00
projectmoon 6a93194cbb Add drone CI config. 2020-11-05 19:21:15 +00:00
projectmoon 66f9bc6013 Move original dice rolling code into its own 'basic' module.
This gives it parity with the other systems: cofd and cthulhu. More
refactoring and a rewrite later as we trend towards more
system-specific implementations.
2020-11-04 20:46:25 +00:00
projectmoon d2642d1fd3 Less verbose errors from internal dice parsing errors. 2020-11-04 20:33:30 +00:00
projectmoon 39e6eb9b46 Implement support for user variables in CoC dice rolling.
Also comes with reorganization of the dice rolling code to centralize
the variable -> dice amount logic, and changes the way the results of
those rolls are displayed.
2020-11-04 20:33:30 +00:00
projectmoon b142b87d65 Remove references to olm in dynamic mode. No longer necessary. 2020-11-03 21:55:13 +00:00
projectmoon bf4ce24b79 Better public API for user variables, avoid allocations in Context.
The database API for user variables has changed somewhat again, this
time closer to the proper vision. There are now two separate sled
Trees in the Variables struct, one for user-defined variables, and one
for counts. Keys have been changed to be username-first, then room ID.
The signatures of the functions now also use a strongly-typed struct,
UserAndRoom.

As part of this, the Context object now once again avoids allocating
new strings.

Other random changes included here:
 - Remove tempfile crate in favor of sled temporary db config.
 - Add bincode crate in anticipation of future (de)serializing.
2020-11-03 20:31:29 +00:00
projectmoon 8ec19c266f Slightly different way of installing tini. 2020-11-01 19:55:06 +00:00
projectmoon a15d3e0bac Fix cthulhu advancement rolls, add remaining dice tests. 2020-11-01 19:29:09 +00:00
projectmoon 7e15379c58 Migrate existing delineators to delimiter 0xfe. 2020-11-01 19:08:54 +00:00
projectmoon 3ccd60c173 Do not respond to or log ignored commands. 2020-11-01 12:20:45 +00:00
projectmoon 29ef21087f Remove dynamically linked olm from Dockerfile. 2020-10-31 21:33:52 +00:00
projectmoon f4417d4c1a Remove unnecessary Option from parse_command return type. 2020-10-31 21:03:17 +00:00