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

Feature request: Implement the content warning summary for posting #23

Closed Sophira closed 6 years ago

Sophira commented 6 years ago

Currently there's no way (so far as I can tell) to use the content warning summary in Mastodon when posting a toot from bitlbee-mastodon. This is a particular problem when replying to toots that have a content warning as the summary gets dropped in the reply and the reply is displayed to everyone.

I think the easiest way to use it would be to copy the syntax used when displaying a toot with a summary: Have the user put [CW: Summary text here] before sending a new tweet with the flag enabled.

It would also be good if the CW summary text was retained when replying to a toot by default, as on Mastodon itself. It should also be possible to modify the use of a CW when replying to a toot, too, in the same way: reply 56 [CW: Summary text here] Reply text here should be able to turn on (or change the summary text of, if already enabled) the content warning with the chosen text.

I'm not sure of a good UI method for turning the default off for a toot with CWs enabled though; using [CW: ] should probably be supported for user expectation purposes but it's kind of ugly. (I'm having a hard time thinking of a reason why you'd want to turn it off, but being able to do so is important.)

I may give this a go myself but I'm not sure. Maybe I should work on smaller issues first, heh.

kensanata commented 6 years ago

I agree! This is definitely necessary and reusing the syntax makes sense. If you are going to work on it, I'll provide all the help I can! Perhaps adding the CW for new posts would be a good first step.

  1. The starting point would be mastodon_post_message in mastodon.c. You need to parse message. Ideally, you'd have a cw pointer pointing at the beginning of the CW (at the address of "S" in "Summary text here"), then you'd overwrite the "]" with a null, and advance message to the "R" in "Reply text here".

  2. Next, you'd have to add cw to the parameters of mastodon_post_status and add it to the request using the spoiler_text attribute, according to the API.

  3. You probably need to experiment a bit when it comes to the sensitive attribute. Is required as well, and if so, what do you need to set it to?

Please work on this! :smile:

kensanata commented 6 years ago

I'm starting to think that if this works, we could use something similar for visibility: @kensanata: [direct] hello and then in the reply we would reuse the same visibility unless something else was specified.