Correct me if I'm wrong: Using Kareha, if I delete a post, the default behavior is to remove the post invisibly. There's also a way to leave a 'deleted by' message, maybe.
That's great, but the post still seems to be there, just empty and not shown. They still count towards a thread's post count for displaying replies, for example. I'm thinking of a situation in which these invisible posts result in no replies being shown for the threads.
Can this be worked around? Either by changing the script not to count the invisible, deleted posts; or by modifying the deletion process to tracelessly remove posts?
Apologies in advance if this makes no sense, or is completely wrong.
What message or lack of message is left behind depends on the template. The futaba-style template silently removes posts, the 2ch-style one leaves a message.
It might be possible to work around the empty posts when counting how many posts to show, but it's sort of hairy to do and I don't see it as a big enough problem in practice to put in the effort to work around it. If anyone else wants to fix it for me, go ahead.
Okay, well, I'm going to see if I can do it. I'll take a look, but one question, first:
Does one of those methods seem immediately easier or better?
I'm not a rock-star, and getting acquainted with the code will probably take me even longer than hacking in one or the other. If it were you, which would you try for?
Okay. So, it might make sense to add a 'REALLY_DELETE_POST' setting in config.pl. Although, at least in the case that the deleted template is simply blank, I do consider the current behavior to be sort of a bug.
Anyways, yeah. Then in delete_post, at the end in the conditional unless ($fileonly), have an extra 'if (REALLY_DELETE_POST) {write_thread_with_skip($thread, $postnum);}
My plan is to have a new write_thread() that will skip a specific post, and thus essentially delete it. The name of the function could reflect that, maybe... Huh.
Anyways, write_thread_with_skip($$) will be just like write_thread($), but for one section. The line "push @page,map { get_post_text($thread,$_) } 1..$$thread{postcount};" should be broken up into two parts, one for all the threads before the thread we want to delete, and one for after.
I can't figure that stuff out, though, so I put it in a for loop. Frown. It's almost working, or else I'd just post my code. I thought if a competent person looked at this, they'd either know how to do it right or know what I'm doing wrong. Perl seems like some good stuff, but it's a little confusing at first.
And, uh, then I guess you'd still have to fix the post #'s and post count, too. Baby steps.
That's the main problem, because the post number appears in several places, and there's no way to know where exactly since there might be just about any template in use. It's a side effect of keeping everything pre-rendered in flat files...
I don't think actually removing posts is going to get you anywhere, it's probably better to try and fix the abbreviation code to ignore empty posts, if it really bothers you.