kensanata / bitlbee-mastodon

A Mastodon plugin for Bitlbee
https://alexschroeder.ch/software/Bitlbee_Mastodon
GNU General Public License v2.0
30 stars 7 forks source link

Corrently mention fully qualified nicks in replies #29

Closed SoniEx2 closed 6 years ago

SoniEx2 commented 6 years ago

I'm trying to understand MASTODON_MAYBE_REPLY but I have no idea how it works?

kensanata commented 6 years ago

It tries to figure out whether the current message is a reply to somebody or not.

SoniEx2 commented 6 years ago

but how does it know the remote user's... account? or at least how does it insert it into the message? it seems to just shuffle some bytes around???

SoniEx2 commented 6 years ago

say I send a message fuz: whatever how does it know fuz means @fuz@whatever and how does it turn fuz: into @fuz@whatever?

I understand how it can turn fuz: into @fuz, because the length is the same and it's just shifting fuz up by one and then adding an @. but how does it add the rest?

SoniEx2 commented 6 years ago

I guess bitlbee does something with messages before handing them to us.

kensanata commented 6 years ago

You are right! This is a bug. Some background: the nick we reply to (fuz) is the IRC nick. So if fuz@mastodon.social and fuz@octodon.social are in your channel, one of them is called fuz and the other is called fuz_. So now we take this IRC nick (the handle) and look it up using bee_user_by_handle. This gives us mastodon_user_data. There, we should add the fully qualified name as a member and use that.

kensanata commented 6 years ago

When I just tried it:

09:12 <kensanata> kensanata_: test
09:12 <root> You: [22] @kensanata test
09:12 <kensanata> info 22
...
09:12 <root> content: @kensanata test
...
09:12 <root> mentions: [
09:12 <root>  {
09:12 <root>   id: 67176
09:12 <root>   username: kensanata
09:12 <root>   url: https://social.nasqueron.org/@kensanata
09:12 <root>   acct: kensanata@social.nasqueron.org
09:12 <root>  }
09:12 <root> ]

And when I look at it online, using the official web client, it looks good! How strange.

kensanata commented 6 years ago

So, now I wonder whether this is a bug or not...

SoniEx2 commented 6 years ago

Yeah, as I said it seems the mentions go out correctly. But I don't know why it works.

SoniEx2 commented 6 years ago

I'm gonna close this because it works.

It works by magic, but what matters is that it works.

Thaodan commented 2 years ago

Does this also apply to mentions in the control channel? something like hello foobar -> hello foobar@bar.de

kensanata commented 2 years ago

I'm not sure what the context for your question is. Are you reporting a new issue? This issue was a question we had and we didn't know how Mastodon works. Will don't know how it works, but … it seems unrelated to what you are saying? I don't know, I'm a bit confused.

Thaodan commented 2 years ago

I was just wondering if it also relates to mentioning user while sending out new toots. But it might be as well a new issue.