7.3 KiB
7.3 KiB
Weechat Matrix Scrip
TODO
- [O] Handle disconnects seamlessly
- Handle send errors
- Handle receive errors
- Handle the disconnect properly
- Reconnect if there is stuff to do and we're disconnected
- Message queue timer.
- [O] Server buffer
- Create server buffer
- Merge with the core buffer if configured to do so
- Informational messages
- Debugging
- Profiling
- [O] Matrix
- Login
- Logout
- Sync
- Send sync request after login
- Parse sync response and store important data
- Create Buffers for rooms
- Populate nicklist
- Print out received messages
- [O] Message Error handling
- Login
- Send messages
- Sync
- Redact
- Kick
- Redact
- Topic
- Join
- Part
- Invite
- Backlog messages
- Try again
- [o] Send messages
- Text
- [o] Html
- Attributes
- Color
- [o] Parsing html to formated text
- Attributes
- Color
- Lists
- Quotes
- Code
- Topic
- Print sent messages without waiting for a sync
- Old message sync (rooms/{roomid}/messages)
- Handle calculation of room display names
- Handle invited users that haven't yet joined
- treat them as semi-joined
- keep them in the nicklist (but appropriately stylized)
- take them into account when calculating room display names
- Redactions
- Power levels
- Invite
- Join room
- Leave room
- Upload
- Presence
- Presence sending
- Presence setting
- Read marker
- Setting
- Sending
- Typing notifications
- Input change callback
- Sending out the notification
- Timer for the notification reset
- Sending out the reset of the notification
- Process the HTTP messages and put them into a queue
- Parse the json response
- [O] Configuration
- Create default configuration
- Read configuration from file
- Save configuration
- Server address
- Auto connect
- SSL verify on/off
- Presence sending
- Sync max backlog
- Encrypt by default
- Typing notification enable/disable
- Device name
- Default matrix.org server config
- Per server config
- Look - merge server buffer with core
- Global options
- [O] Core
- Don't use sendall in the send() function
- Create a default server if there doesn't exist one
- matrix help command
- Server add command
- Server list command
- Server listfull command
- Server delete command
- Server completion
- Create server classes based from the config
- Refactor out connection functions for multiple server support
- Refactor the server command function
- Nicklist groups
- Smart filters
- Clear message queue on disconnect
- Fix Reconnect handling
- Fetch messages if we scroll to the top (hook_signal window_scroll)
- Status bar element if we're fetching old messages
- Prevent self-highlighting when mentioning yourself from another client.
- [O] Color and attributes.
- Parsing the input line
- Converting the input to weechat output
- [o] Converting the input to html
- Attributes
- Colors
- [.] Commands
- Topic
- Redact
- [o] Join
- Join public rooms
- Join private rooms
- Create rooms if they don't exist
- Completion
- Kick
- Completion
- Query
- Completion
- Part
- Completion
- Invite
- Completion
- Whois
- Completion
- OP
- Voice
- Password
- Room
- Rename
- Info
- Join rules
- [O] Refactoring
- Server
- API
- Message handling
- Colors
- Separate weechat IO from message handling/parsing
- [o] Input sanitization
- Rooms ID
- Room aliases
- Event ID
- User ID
- Age
- Display names
- Messages
- Topics
- Tests
- Commands
- Message handling
- Utils
OLM
-
Encrypted messaging
- Generate keys
- Store keys
- Load keys
- Upload keys
- Rotate keys
- Encrypt messages
- Decrypt messages
- Group message encryption
- Device ID storing
- Device ID loading
-
Olm command
- info
- verify
-
Keys should be transparently encrypted with your login password. (The lib already does that for us.)
-
More info here.
-
Keys are bound to a user and a device.
-
Ids to store:
- user name (same as login user) -> weechat stores this for us
- device_id -> store it in a separate data file
- server-name -> folder
-
OLM things to store:
- Account info (holds the Identity keypair)
- Session info
- Group session info
Olm weechat data format
-
Create a matrix folder under the weechat home folder
-
Create a server folder in the matrix folder
-
Filenames in this folder should have the form of user_device.extension
-
Store the device id in .device_id
-
Example: .weechat └── matrix └── matrix.org ├── poljar.device_id ├── poljar_<device_id>.account ├── poljar_<device_id>.session ├── poljar_<device_id>.group_session └── poljar_<device_id>.known_devices
-
File formats:
- .device_id -> single line containing the device id
- .account -> pickle with the olm lib, encrypt using the user password
- .session -> pickle with the olm lib, encrypt using the user password
- .group_session -> pickle with the olm lib, encrypt using the user password
- .known_devices -> pickle using the pickle module or json, a dict containing a user_id and a device_id
DONE Color sending and recieving
DONE Message Redaction
- Store the event id somewhere with the message (the slack plugin replaces the date_printed variable for the message hdata, we can use a custom tag while printing lines)
- If we get a redaction event use hdata_pointer to get a list of all printed messages
- Strike through or completely delete the message
DONE Old message fetching
- We can fetch old messages if we have less lines than max buffer lines or lines only younger than max buffer minutes
- To print out the messages we need to sort the line_data by date (see hdata)
Room command
- Create room
- Set room join rules
- Room power levels
- Alias
- Encrypt room