Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications for Matrix chats #3

Closed
tobanw opened this issue Sep 16, 2016 · 9 comments
Closed

Notifications for Matrix chats #3

tobanw opened this issue Sep 16, 2016 · 9 comments
Assignees

Comments

@tobanw
Copy link

tobanw commented Sep 16, 2016

This plugin works great for IRC, nice work! I'm using the Matrix plugin (Matrix is a different chat protocol than IRC), but my Matrix chats don't generate notifications. This could be because Matrix uses chat rooms, so there's no notion of private messages.

Any ideas on how to get notifications from Matrix chat rooms?

@s3rvac
Copy link
Owner

s3rvac commented Sep 17, 2016

Hi Toban,

I don't use the Matrix protocol myself, but let me show you what I have found. My plugin relies on WeeChat to correctly recognize private messages or highlights. Based on your description of the protocol, there seems to be no concept of private messages in Matrix (more on that later). This leaves us with highlights. On the weechat-matrix-protocol-script repo, there seems to be an opened issue to improve the plugin by adding support for highlighting in WeeChat. Such added support could enable my plugin to send notifications on highlights. However, I may be wrong (I don't know the Matrix protocol).

As a side note, there is the BitlBee project, which provides an IM-to-IRC gateway. It supports many different chat protocols. For example, I use it as a Jabber/XMPP-to-IRC gateway so I can use WeeChat for both IRC and Jabber/XMPP messaging. Since it is an IM-to-IRC gateway, my plugin is able to show Jabber/XMPP notifications, just like IRC notifications. However, BitlBee does not support the Matrix protocol. There is an opened issue for that, though.

Now, lets talk about "private-message notifications" for Matrix. You said that there are only chat rooms, which I think may be considered as channels on IRC. About which messages you would like to be notified? About all messages that happen in a chat room? There may be a lot of them. Only for some of them? Which ones?

@s3rvac s3rvac self-assigned this Sep 17, 2016
@tobanw
Copy link
Author

tobanw commented Sep 17, 2016

In Matrix, everything is a chatroom -- public rooms are equivalent to IRC channels, while private rooms are used for one-to-one or group chats. Ideally, it would be nice if this plugin could set notifications per-buffer, which would be agnostic about which protocol is being used. This way, I could just pick which Matrix chats should trigger notifications.

It might be easier to implement highlights, as the Matrix plugin already highlights messages that mention my name (i.e., it colors the sender name and shows the count of highlighted messages in the status bar) -- I'm not sure what that issue you referenced is about. However, the Matrix highlights don't trigger notifications as IRC highlights do -- any idea why that is?

I'm not interested in using an IRC gateway, as the Matrix protocol supports end-to-end encryption and I ultimately want to be using it.

@s3rvac
Copy link
Owner

s3rvac commented Sep 18, 2016

I'm not interested in using an IRC gateway, as the Matrix protocol supports end-to-end encryption and I ultimately want to be using it.

Fair enough.

However, the Matrix highlights don't trigger notifications as IRC highlights do -- any idea why that is?

I will have to take a look into that.

Ideally, it would be nice if this plugin could set notifications per-buffer, which would be agnostic about which protocol is being used.

OK, that sounds reasonable. I will add support for this, probably during the next weekend.

@s3rvac
Copy link
Owner

s3rvac commented Sep 25, 2016

However, the Matrix highlights don't trigger notifications as IRC highlights do -- any idea why that is?

In commit 38507a2, I have added interception of all messages by the plugin, not only those tagged with irc_privmsg. I believe this was the reason why Matrix highlights did not trigger notifications.

Ideally, it would be nice if this plugin could set notifications per-buffer, which would be agnostic about which protocol is being used.

In commit 7532c7f, I have added a new option to the plugin: notify_on_all_messages_in_buffers. It is a comma-separated list of buffers for which you want to receive notifications on all messages that appear in them. You can use either short names (#buffer) or full names (network.#buffer). This list is empty by default.

Would you be so kind as to check whether the plugin in its current form in the master branch works for you?

@tobanw
Copy link
Author

tobanw commented Sep 25, 2016

Thanks, it's working now!! In Matrix rooms, I now get notifications for each message in a one-on-one room and not for group chat rooms (and I can get those by enabling per-buffer notifications). Highlights trigger notifications in all rooms.

However, my Matrix messages trigger notifications too (whenever notifications are enabled). I guess the function i_am_author_of_message() isn't catching the Matrix nick. I'd be happy to help out with testing.

@s3rvac
Copy link
Owner

s3rvac commented Sep 25, 2016

In commit 0ce4ff9, I have improved the removal of modes from the beginning of nicks. Originally, only @ (op on IRC) and + (voice on IRC) were removed. Now, any character from the following list is removed: ~&@%+-. This should hopefully fix the detection in i_am_author_of_message(). I found out that Matrix uses the modes to reflect power level.

Could you please verify whether this indeed fixes the problem for you?

@tobanw
Copy link
Author

tobanw commented Sep 25, 2016

Now I'm really confused: in one buffer (a one-on-one chat room) my messages don't trigger notifications, but in all the others (including both one-on-one and group chat rooms), they do. I even rebooted to be sure. I can't figure out what's special about that one buffer...

@s3rvac
Copy link
Owner

s3rvac commented Sep 26, 2016

In commits b4b2059 and a778e56, I have tried to improve detection of nicks and authorship of messages. Could I ask you to check whether you still get notifications for your messages? If the problem persists, I will keep digging :).

@tobanw
Copy link
Author

tobanw commented Sep 26, 2016

Excellent! It's working perfectly now. Thanks so much for solving this issue!!

@tobanw tobanw closed this as completed Sep 26, 2016
s3rvac added a commit that referenced this issue Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants