khyperia / weechat-discord

Unmaintained! And also apparently this is against their TOS so DON'T USE THIS -- Weechat plugin for Discord support - https://weechat.org/ https://discordapp.com/
MIT License
51 stars 24 forks source link

Load backlog from Discord. #12

Open flowbish opened 8 years ago

flowbish commented 8 years ago

On startup pull backlog from the server and disregard the log on disk.

calzoneman commented 7 years ago

Looks like this was commented out in https://github.com/khyperia/weechat-discord/commit/8800f812dac0c4f85828a17524fed24234b79c0c. Are there plans to support it again in the future?

khyperia commented 7 years ago

Yeah... might have to do significant refactoring, though. See here :(

calzoneman commented 7 years ago

I see; that's unfortunate. I'll follow that issue as well. If I knew Rust at all I'd offer to help out.

Aanok commented 7 years ago

I've actually been tinkering with this; at the moment I have some code that pulls on init the last N messages from each channel and prints them to the corresponding buffer with the correct timestamp. Further steps are mostly getting the last read message from each channel in order to pull the logs from there onward (it should be listed in the initial ReadyEvent, I think) and then moving everything to a separate thread. An option to toggle this behavior would also probably be in order.

Then it would be reasonable to implement issue #9 to have a complete synchronization mechanism, but that's going to be an adventure. To be honest it's already been an adventure, since I've just picked up Rust with this :p

Aanok commented 7 years ago

Rather, more than using a thread to load everything asynchronously at startup (which was my understanding of what you meant on the other thread, @khyperia ), it might be nice to load the backlog only when the corresponding buffer is actually accessed in WC by the user. It would cause a lag spike at that moment, sure, but it should be tolerable and would avoid issues of interleaving with new messages arriving while the backlogs are being pulled and printed.

Of course this requires more FFI wrappers to catch the corresponding WC signal, but that's also imho the biggest obstacle with issue #9 so it's something that needs to be done sooner or later. (assuming we want to solve issue #9 by only acknowledging messages seen by the user, of course. The lazy solution is clearly to just ACK everything)