sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
291 stars 27 forks source link

Fetched backlog appears not to include server-time #152

Closed dgw closed 6 years ago

dgw commented 6 years ago

Recently, my bitlbee-discord was disconnected for a bit and fetched some messages that were sent while it was offline. I noticed that all of the messages were timestamped at the time of fetching, rather than when they were sent to Discord.

First, is this possible to implement? If so, then is it worth doing?

Alcaro commented 6 years ago

There are (to my knowledge) no timestamps in the IRC protocol, all clients timestamp everything to when they get the message. Backdating messages would require adding timestamp support to the IRC protocol and implementing it in the major clients (and in the bitlbee core), before we can even consider adding it here. Even if we can do that (which I doubt, we're a quite small project), it'd take several years before everything is sufficiently updated that it'll work for most people.

Though we could lamehack it and add an option for prefixing timestamps to the message body. It'd look pretty silly, but probably good enough for some usecases.

sm00th commented 6 years ago

Though we could lamehack it and add an option for prefixing timestamps to the message body. It'd look pretty silly, but probably good enough for some usecases.

Bitlbee already does that, see bee_irc_chat_msg and irc_format_timestamp, and bitlbee accepts a timestamp to imcb_chat_message. Discord provides a timestamp in message object. It shouldn't be hard to implement, as for "is it worth it" - I don't know, should be worth for some people at least.

dgw commented 6 years ago

There are (to my knowledge) no timestamps in the IRC protocol

It's time to update your knowledge, then. Timestamp message tags are supported by numerous IRC clients.

However, looking at BitlBee's own timestamp handling code, it doesn't look like BitlBee itself sends server-time tags at all when told the timestamp of a message. Rather, it just prefixes the message with a formatted timestamp, which isn't exactly what I was thinking. I agree that doing it that way is a lamehack.

server-time support in BitlBee itself has an open PR (bitlbee/bitlbee#98), at least… but who knows when/if it will land. I guess this request might as well be on hold until that's done, then, unless other people want to do the prefixing thing as a stopgap. Personally, I'm happy to wait until proper message tags are supported in BitlBee.

Alcaro commented 6 years ago

It's time to update your knowledge, then.

Understood, I haven't really paid attention to IRCv3. Maybe I should.

Bitlbee already does that

If the API exists, let's use it even if it doesn't really work yet. That's what we'll end up doing once bitlbee itself is fixed, anyways.

I'll take a look at implementing it at some point.

server-time support in BitlBee itself has an open PR

Could bump it I guess... anything year-old is probably forgotten.

dequis commented 6 years ago

Not forgotten, I just have plans to implement it differently and left it open intentionally in case anyone wants to try it (see my comments there)

dgw commented 6 years ago

I'd leave this open if the goal is ultimately to use server-time when BitlBee supports it.

If not, it's good enough. :smile_cat:

sm00th commented 6 years ago

I'd leave this open if the goal is ultimately to use server-time when BitlBee supports it.

Mu assumption is that the interface for plugins would stay the same and just the implementation on bitlbee's side would change.