Giter VIP home page Giter VIP logo

weechat-matrix-rs's Introduction

Build Status #weechat-matrix license

What is weechat-matrix?

Weechat is an extensible chat client.

Matrix is an open network for secure, decentralized communication.

weechat-matrix-rs is a Rust plugin for Weechat that lets Weechat communicate over the Matrix protocol. This is a Rust rewrite of the weechat-matrix Python script.

Project status

This project is a work in progress and doesn't do much yet. It can connect to a Matrix server and send messages.

If you are interested in helping out take a look at the issue tracker.

Build

After Rust is installed the plugin can be compiled with:

cargo build

On Linux this creates a libmatrix.so file in the target/debug/ folder, this file needs to be renamed to matrix.so and copied to your Weechat plugin directory. A plugin directory can be created in your $WEECHAT_HOME folder, by default .weechat/plugins/.

Alternatively, make install will build and install the plugin in your $WEECHAT_HOME as well.

weechat-matrix-rs's People

Contributors

austin-ray avatar badlandspray avatar dkasak avatar erdnaxeli avatar goulov avatar lanker avatar poljar avatar pvonmoradi avatar vbrandl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weechat-matrix-rs's Issues

Error: API mismatch for plugin

I'm getting this upon opening weechat 3.0.1:

Error: API mismatch for plugin "/home/ams/.weechat/plugins/matrix.so" (current API: "20201004-01", plugin API: "20200621-01"), failed to load
 If plugin "matrix" is old/obsolete, you can delete this file.

Plugin API Mismatch

Using Weechat (v3.0.1) from the DNF package manager on Fedora, I built and installed the plugin.

Upon opening Weechat, I received the following error message:
screenshot_14:45:10_2021-06-29

Which version of Weechat does the plugin currently work with?

Support for proxy (SOCKS5)

Wondering if it's possible to add a configuration option for a proxy (or even multiple proxies), specifically SOCKS5, but I would assume that adding support for others might not be a problem if they're prefixed correctly in the config

Community

Hi,

Is there a matrix room to discuss about this project?

Thanks.

The Matrix Space idea - Recognize which rooms are under a given Space

I am currently using the legacy (non-rust) version of the weechat-matrix, but I though I post this here, if that one is in the maintenance mode. Correct me if I am wrong but currently the weechat ties channels to servers. It would be nice to tie a room/channel to space(s) it is part of using the same hierarchical scheme the server and the channel use. Why? Because then one could use a plugin such as the collapse_channel.py https://weechat.org/scripts/source/collapse_channel.py.html/ to show only part of the channels on the buflist and keep it "tidy" that way. It would add convenience as you could group big number of rooms to any number of groups one wish for by using private Spaces.

If Matrix is to grow towards the direction of Discord, there will be Spaces with rooms for each subtopic in a Space, and eventually the number of rooms one is connected grows large. Being able to expand/collapse them in a more manual manner is not possible right now and this "simple" trick would solve these problems.

Can't login: forbidden

Hi,

I'm trying to connect to matrix, but I always get Forbidden. I'm sure my password is correct, and it was working with weechat-matrix classic. I'm not sure what I am doing wrong..

10:52:42 matrix_org =!= | matrix: Ruma error Failed to log in: Http(FromHttpResponse(Http(Known(Error { kind: Forbidden, message: "Invalid password", status_code: 403 }))))

My conf

[look]
busy_sign = "⏳"
encrypted_room_sign = "🔒"
local_echo = on
public_room_sign = "🌍"
redaction_style = strike-through
server_buffer = merge-with-core

[network]
debug_buffer = off

[input]
markdown_input = on

[server]
matrix_org.ssl_verify = on
matrix_org.proxy = ""
matrix_org.password = "${sec.data.matrix}"
matrix_org.autoconnect = off
matrix_org.homeserver = "https://matrix.org"
matrix_org.username = "primalmotion"

Allow building on a stable rust release

It seems that nightly is necessary due to one instance get_mut_unchecked. Would it be possible to avoid this so that we can build it using rust stable?

I know matrix-rs is not "ready" yet, but considering I cannot get the python version to coexist with other plugins, I'd rather go with something rather than nothing :).

I was considering trying weechat-matrix-rs and possibly create a debian package for it. To do that though it needs to build on the current debian's packaged version or rust, which is 1.48-~1.49 at the moment.

Failed to log in: invalid state

Hi,

I juste pulled the last version of the code and I get this error:

Ruma error Failed to log in: StateStore(Json(Error("expected value", line: 1, column: 1)))

Print out more event types.

The RoomBuffer struct receives all the incoming events. It currently only prints out and handles properly a couple of events.

The event formatting should probably go into a separate file and should consist of pure methods. Something in the spirit of the message_renderer file from the python script.

suggestion: why build only debug and not release?

hi,
a suggestion... could we please build the plugin as a "release"?

I am building for a shared user system so am concerned with size and performance for the users who do not need debug.

the different is the plugin is so much small with cargo build --release. (more then 300M!)

cargo build:

12:19:40 [email protected] ~/ la /home/creme/.weechat/plugins
.rw-r--r-- 338M creme envs 24 Jul 10:10 matrix.so

and
cargo build --release:

15:24:14 [email protected] ~/ la /home/creme/.weechat/plugins
.rw-r--r-- 25M creme envs 24 Jul 13:24 matrix.so

add a type localvar to matrix buffers

the buflist plugin indent buffer when they have a type localvar with a value of private or channel

weechat-matrix (the python version) set that localvar on private and channel but not the matrix version

Highlights don't work

A highlight doesn't get triggered if someone mentions your nick, a localvar probably needs to be set for this to work correctly though i can't remember which one it was.

No cargo.lock

Please could you commit a cargo.lock! Trying to package this will be a pain without one.

Smart filter support.

The Python script somewhat supports smart filtering like the IRC plugin does, it is a bit flaky but often times it works well enough to hide massive amounts of joins/leaves.

To support this we should track the activity of members, e.g. every time we fetch a member to render an event that is send by that member we should save a timestamp of their last activity. Then based on that timestamp add a smart filter tag when we render membership events.

Error: API mismatch for plugin

Hello guys,

Error: API mismatch for plugin "/home/whatever/.weechat/plugins/matrix.so" (current API: "20200301-03", plugin API:"20200621-01"), failed to load

I've installed weechat using lazy apt install with Ubuntu 20.04. I'm using nightly cargo and the compilation was fine. No errors.

This is my first try with weechat, what probable I've missed here?

Build error: use of unstable library feature 'atomic_min_max'

Anything you can do on the codebase to avoid this ?

error[E0658]: use of unstable library feature 'atomic_min_max': easier and faster min/max than writing manual CAS loop
   --> /home/strk/.cargo/registry/src/github.com-1ecc6299db9ec823/atomic-0.5.0/src/ops.rs:263:51   
    |
263 |         mem::transmute_copy(&(*(dst as *const A)).fetch_min(mem::transmute_copy(&val), order),),
    |                                                   ^^^^^^^^^
    |
    = note: see issue #48655 <https://github.com/rust-lang/rust/issues/48655> for more information

Can't login: missing field room_type

Hi,

I just updated my plugin and I can't login anymore. I got the following error

matrix: Ruma error Failed to log in: MatrixError(StateStore(Json(Error("missing field `room_type`", line: 1, column: 353))))

How to get this running?

Hi,

My apologies for probably wasting you're time. So the documentation of this project is very small for this project, which is ok ofc.
First I would just write for the people, that have never used rust like me, that you need to install the llvm Tool set to compile. Took me a while to figure it out, but whatever.

The part I am stuck at is using this. Unlike in https://github.com/poljar/weechat-matrix there are no commands in the documentation of how to include which script. It would be nice if you helped me out there. Also if I manage to make a pull request (never did one before) I will update the documentation to include clearer installing instructions if thats ok with you.

Anyways.. thank you so much for your time and this amazing project.
Best regards.

Support emoji verification.

While the script supports only to-device emoji verification we should probably support in-room verification as well.

Mark a room as read

Like the title says, this would ease the use of other clients.

If I look at how it is done in the python script, a read marker is sent for the last event if:

  • we switch to a room buffer and the last message was not already read
  • when we send a message, we mark it as read when receiving it back

Sending send receipt or not should be configurable, with default to sending them.

I will try to propose a PR.

How do I use this plugin?

I've followed the README instructions and the plugin is now loaded into Weechat -- I see "matrix" in the "Plugins loaded" message at startup.

I've tried a few ways to use /connect and /server, but nothing seems to work -- Weechat tries to connect over IRC, not Matrix. I also tried to manually edit ~/.weechat/matrix-rust.conf (when Weechat wasn't running) but that didn't seem to do anything -- server isn't listed when I do /server list.

How can I use this plugin?

Missing dependency

Hi,

I cannot build this project anymore, I got this:

$ cargo build
    Updating crates.io index
error: failed to select a version for the requirement `matrix-sdk = "=0.6.0"`
candidate versions found which didn't match: 0.4.1, 0.4.0, 0.3.0, ...
location searched: crates.io index
required by package `weechat-matrix v0.1.0 (/home/erdnaxeli/codaz/weechat-matrix-rs)`

Parsing of the custom Matrix HTML subset.

Some event types can have a formatted body, this body contains a HTML formatted message.

The formatting includes colors, quotes, links, code snippets, etc...

To properly handle this we need to implement a parser and formatter.

Care should be taken when implementing this so that advanced features like hiding/showing of code snippets is possible.

The buffer name should be calculated correctly.

Currently buffer names are room ids. This is extremely user unfriendly, the buffer should use the same name as other clients display.

For this the Room struct in the rust-sdk would need to be enhanced to handle events that change the room name as well as provide a method to calculate room display names.

Nio and the python script can be used as a guideline for this.

matrix-qrcode-0.2.0/src/lib.rs, error[E0658]: arbitrary expressions in key-value attributes are unstable

Hi!
I tried browsing the issues, but didn't find something similar.
I got this error trying to do cargo build just now:

   Compiling matrix-qrcode v0.2.0
error[E0658]: arbitrary expressions in key-value attributes are unstable
  --> /home/myuser/.cargo/registry/src/github.com-1ecc6299db9ec823/matrix-qrcode-0.2.0/src/lib.rs:15:10
   |
15 | #![doc = include_str!("../README.md")]
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: could not compile `matrix-qrcode`

To learn more, run the command again with --verbose.

Trying to read those suggested links, it looks like it's using a newer/experimental rust version?
(Should I try that? Seems I'm currently running rustc 1.53.0 (53cb7b09b 2021-06-17))

Markdown input parser

Most clients in the Matrix ecosystem support markdown at their input line to send HTML formatted events.

The Python script has a custom input line parser that combines standard Weechat IRC input and some markdown. Supporting markdown properly and ignoring the Weechat IRC input for now would probably be the way to go.

A config option that can be toggled to enable/disable the markdown parsing should be added as well.

Allow export of subsets of room encryption keys based on a predicate

The most important feature would be to export room encryption keys per room. This would allow, for instance, an old member of an E2E encrypted room to supply keys to a newer member so they can read history prior to their join.

The function export_keys from the Rust SDK could be used for the implementation.

Note that there is already a /keys export command which exports all keys. The implementation of the current /keys export command is here. As a first pass, the use case in this issue could be satisfied by implementing /keys export --room-id ROOM_ID.

Steps to start using this after moving the file matrix.dylib to ~/.weechat/plugins/

What are the steps to start using this after moving the file matrix.dylib (renamed from libmatrix.dylib) to ~/.weechat/plugins/.

❯ neofetch
                    'c.          [email protected]
                 ,xNMM.          ----------------------------
               .OMMMMo           OS: macOS 11.6 20G165 arm64
               OMMM0,            Host: Macmini9,1
     .;loddo:' loolloddol;.      Kernel: 20.6.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 3 hours, 8 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 1 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 3840x2160
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Light)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: tmux
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M1
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 2093MiB / 16384MiB
       .cooc,.    .,coo:.



Using matrix-rs generate a lot of disk-I/O

When i load the plugin and it takes a while with high CPU-load, then goes online and weechat starts grinding disk like i've never seen. I get constant 600kB-1M/s disk access for days and days. As soon as i unload the plugin the activity stops. This happens every time.... What's this about?

Support login with SSO.

The Python script supports SSO login by starting a local HTTP server that waits for the loginToken. The helper for the Python script can be found over here.

We'll likely want an in-process server instead.

Panic on startup

Panic in the main Weechat thread: panicked at 'called `Result::unwrap()` on an `Err` value: MatrixError(StateStore(Sled(Corruption { at: None, bt: () })))', src/server.rs:758:72

Restarting doesn't fix it. Using master build c4d0f1e

Build Eror: 'stddef.h' file not found

There appears to be some implicit assumptions being made about the build environment.

Although it's somewhat obvious, the docs don't mention a hard dependency on weechat-dev or similar packages. However, with that installed, stddef.h (required by weechat-plugin.h) is not being found.

I'm not exactly sure what it's referring to:

xxx@professorx:~/Development/community/weechat-matrix-rs$ fdfind stddef.h /|grep -vE 'flatpak|media'
/usr/include/linux/stddef.h
/usr/src/linux-headers-4.19.0-11-common/include/linux/stddef.h
/usr/src/linux-headers-4.19.0-12-common/include/linux/stddef.h
/usr/lib/gcc/x86_64-linux-gnu/6/include/stddef.h
/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h
/usr/lib/gcc/avr/5.4.0/include/stddef.h
/usr/lib/llvm-7/include/c++/v1/stddef.h
/usr/src/linux-headers-4.19.0-11-common/include/uapi/linux/stddef.h
/usr/src/linux-headers-4.19.0-12-common/include/uapi/linux/stddef.h

It might be worth making mention of non-rust build dependencies in the README.

History of chat is not fetched

Upon re-connection, previous session's chat log is not shown. I think there is no need to "save" any logs upon exit since Matrix protocol saves the logs in server-side.

Thanks for this project 😊

fail to load plugin on weechat v3.2-1

API mismatch for plugin "/home/creme/.weechat/plugins/matrix.so" (current API: "20210601-01", plugin API: "20200621-01"), failed to load
If plugin "matrix" is old/obsolete, you can delete this file.

is the plugin to old for weechat?

Implement the /redact command.

The Python script supports redacting events, though the command is a bit clunky with the syntax so we might want to figure out a better syntax for the command as well.

Panic in the main Weechat thread

Hi,

I just got this error

Panic in the main Weechat thread: panicked at 'not yet implemented: We don't handle redacted state yet', src/room/members.rs:306:17

And I think after that receiving any message from matrix is broken (sending a message still work).

Users in the nicklist should use display names.

Currently the users in the nicklist are using the full mxid.

For this the Room struct in the rust-sdk would need to be enhanced to all the member changing events and provide a way to calculate the current display name of a user.

Implement the /join command.

The Python script supports joining rooms but it's a bit bare bones. Since the rust-sdk keeps track of invited rooms we can at least complete rooms we have been invited to.

Implement the /topic command

The topic command should allow users to set or remove the topic. It should work similarly to the IRC /topic command

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.