What this does is set an intended_solely_for value to the ID of the user the message is being sent to, which is not counted towards post points when set.
This will cause caching to not count private topic posts towards a member's post count. That's the unfortunate consequence of this fudge, but at least it stops counting private topic posts towards points, especially when it comes to chat archive posts.
I noticed wherever in the Composr code exists a cns_force_update_member_post_count call with the second parameter specified ($member_post_count_dif), it is always within the condition that a forum ID exists. So it looks like the intention was not for private topic posts to count. However, cache counts them.
I tracked the code, and tested carefully, and I think the base assumption is wrong - I can't see the problem occurring.
I tested manually making a PT, doing an IM, and in both cases the post count remained the same. The point calculation was correct. I cleared the topic cache and same result.
As your final post pointed out, the post count is only calculated for non-private topics.
Found in sources/chat.php line 957.
POSSIBLE Fix (untested):
cns_make_post($topic_id, $is_starter ? do_lang('INSTANT_MESSAGING_CONVO') : '', $message, 0, $is_starter, 1, 0, null, null, null, get_member(), $members[0] === get_member() ? $members[1] : $members[0], null, null, false, true, null, false, '', 0, null, false, true);
What this does is set an intended_solely_for value to the ID of the user the message is being sent to, which is not counted towards post points when set.
___
EDIT: I was wrong. This does NOT work.
in the cns_force_update_member_post_count function of sources/cns_posts_action.php, find:
$map = array('p_poster' => $member_id, 'p_cache_forum_id' => null);
if (addon_installed('unvalidated')) {
$map['p_validated'] = 1;
}
$member_post_count += $GLOBALS['FORUM_DB']->query_select_value('f_posts', 'COUNT(*)', $map);
Comment out:
$member_post_count += $GLOBALS['FORUM_DB']->query_select_value('f_posts', 'COUNT(*)', $map);
This will cause caching to not count private topic posts towards a member's post count. That's the unfortunate consequence of this fudge, but at least it stops counting private topic posts towards points, especially when it comes to chat archive posts.
I could be wrong though.
I tested manually making a PT, doing an IM, and in both cases the post count remained the same. The point calculation was correct. I cleared the topic cache and same result.
As your final post pointed out, the post count is only calculated for non-private topics.