Messages: Introduces meta table and related cache functions.

This commit alters the messages DB schema to add a meta table, which will
allow plugin developers to record information about a message.

The new message meta functions in bp-messages-functions.php mirrors those
in other BP components (activity, groups, etc.).

The DB version is also bumped to 9181.

See #3083.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9182 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Prefetch message meta when in a message loop.

This reduces overhead when querying for message meta in the context of a
bp_thread_has_messages() loop.

Also introduces an 'update_meta_cache' parameter to the bp_has_thread_messages()
stack, so the message meta cache prefetch can be disabled by developers.

See #3083.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9183 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Grab all message IDs before deleting a message thread.

In BP_Messages_Thread::delete(), we need to grab all message IDs before
a message thread is outright deleted.  This is done by using
$wpdb->get_col() instead of $wpdb->get_var().

This commit also:

* Deletes the message meta attached to the message (see #3083)
* Reinstates the 'messages_thread_deleted_hook' action that was improperly removed in r9165
* Adds $message_ids as an extra parameter to the 'bp_messages_thread_after_delete' action

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9184 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Introduce 'bp_messages_thread_before_mark_delete' action.

This commit renames the 'bp_messages_thread_before_delete' action added in
r9165 to 'bp_messages_thread_before_mark_delete' and moves the
'bp_messages_thread_before_delete' hook where the message thread is
actually deleted.

The phpDoc for BP_Messages_Thread::delete() is also updated to accurately
outline what is happening in the class method.

See #5193.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9185 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Add unit test cases for message meta.

See #3083.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9186 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Fix oEmbed in private messages.

oEmbed caching for private messages will be in the next commit.

See #5990.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9187 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Messages: Add oEmbed caching.

With the introduction of the messages meta table (#3083), we are now able
to cache oEmbed responses.  On subsequent fetches, we will now reference
the message cache instead of pinging the oEmbed provider.

This mirrors our functionality with BP's activity implementation of oEmbed.

See #5990.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9188 cdf35c40-ae34-48e0-9cc9-0c9da1808c22