Skip to content

a... feature request... I think? #9

@AeSix

Description

@AeSix

Ok, so, I'm using BungeeMail in an unusual manner.
I have two BungeeCord servers. One is production, the other is for testing/demo.

I accidentally found out today that with BungeeMail on each proxy, pointing to the same database, it is possible for players to send mail between the two networks. Pretty awesome!

The problem, and I understand why it is such, is that BungeeMail, not being a network application per`se, does not send notification of new mail to the backend server and instead just handles it internally. This is great, but for my use, there is no notification of new mail to the recipient, because that instance of BungeeMail is separate from the instance which sent the mail. Like I said, I completely understand it being like this.

Several solutions I came up with:
So, I thought about having a single "Push Notification" table, row or even single field on the MySQL server, and have BungeeMail periodically check that to see if it has new mail from another instance elsewhere. Then, I thought about how much data that could be, and the potential bugs, if there is a lot of mail sent from each instance - which instance set the field, which instance unsets it, etc. So, maybe something like that could work, but it'd be more than a "simple" enhancement.

Then, I thought about instance-to-instance socket communications. That'd work, but a lot of overhead, annnnd then yet more ports to open/forward, etc. This solution could work, but would really turn it into a network application... and probably more than it's worth.

Another solution, would be for BungeeMail to just periodically check for new mail for each online player. I'm not certain how notifications are currently handled, but I believe BungeeMail keeps track of who has new mail internally. If I'm right, then the db would need to be modified to have a new entry for that. But, if I'm wrong, and notifications are stored in the DB, then it should be pretty simple to add a (configurable) update time for checking mails.

The last solution I came up with, which I think is the most elegant, but would take a bit more work.
First, if the recipient is on the same proxy as the sender, then the internal notification system (as currently implimented) would be used. No point in doing anything else. However, if the user is not on the same proxy, then, the instance of BungeeMail could use the MySQL DB to send out a "Hey! Is Name online?" This could be done with a table which is updated when ever new mail does not have a local receiver. BungeeMail would then be set to look for these entries in the DB by name. So, each instance would be required to have it's own name set in the config. When the receiving instance sees that there's an entry from one of it's configured look-for servers, it reads it and attempts to notify the user.

The simplest method, would be to use MySQL Triggers - if that's possible. I'm not sure it's something a plugin can do, and may need to be done by the DB admin. I'm neither a programmer nor a DBA. I found this: https://www.techonthenet.com/mysql/triggers/after_insert.php

TL;DR:
I'd like for both instances of BungeeMail to be able to notify users of new mail when received from the other instance. Web sockets, periodic checks of online users, periodic checks of database, or possible db trigger push notifications to the BungeeMail instance. I'm not sure there's any other solution.

I'd love for this to be implemented, in one way or another. I was unable to confirm where/how new mail notifications are stored, and so one of those solutions may be really simple to do, or they may not be easy at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions