This files describes API changes in /message/ messaging system,
information provided here is intended especially for developers.

=== 3.8 ===

* The following methods have been deprecated and should not be used any more:
  - \core_message\api::get_individual_conversations_between_users()
  - \core_message\api::can_post_message()

=== 3.7 ===

* The message/index.php page used to support viewing another user's messages (if you had the right capabilities) by
  altering the URL and adding the parameters 'user1' and 'user2'. There were only some very rare occurrences where you
  could access a URL generated with these parameters (eg. log report). It was decided to stop supporting this
  functionality and remove all the legacy code (see MDL-63915).
  Note - It's still possible to view another user's messages if you have the right capabilities and are able to
  'log-in as' them.
* A new parameter 'mergeself' has been added to the methods \core_message\api::get_conversations() and
  core_message_external::get_conversations(), to decide whether the self-conversations should be included or not when the
  private ones are requested, to display them together.
* A new 'customdata' field for both messages and notifications has been added. This new field can store any custom data
  serialised using json_encode().
  This new field can be used for storing any data not fitting in the current message structure. For example, it will be used
  to store additional information for the "Mobile notifications" processor.
  Existing external functions: core_message_get_messages and message_popup_get_popup_notifications has been udated to return the
  new field.
* External function core_message_get_messages now returns the component and eventtype.

=== 3.6 ===

* The following functions have been finally deprecated and can not be used anymore:
  * message_get_course_contexts()
  * message_remove_url_params()
  * message_count_messages()
  * message_count_blocked_users()
  * message_contact_link()
  * message_history_link()
  * message_shorten_message()
  * message_get_fragment()
  * message_get_contact_add_remove_link()
  * message_get_contact_block_link()
  * message_mark_messages_read()
  * message_page_type_list()
  * message_can_post_message()
  * message_is_user_non_contact_blocked()
  * message_is_user_blocked()
* The following functions have been deprecated and should not be used any more:
  - message_add_contact()
  - message_remove_contact()
  - message_unblock_contact()
  - message_block_contact()
  - message_get_contact()
  Please see their declaration in lib/deprecatedlib.php to view their alternatives (if applicable).
* The following methods have been deprecated and should not be used any more:
  - \core_message\api::is_user_blocked()
  - \core_message\api::delete_conversation()
  - \core_message\api::is_user_non_contact_blocked()
  - \core_message\api::create_conversation_between_users()
* The method \core_message\api::can_delete_conversation() now expects a 'conversationid' to be passed
  as the second parameter.
* The following web services have been deprecated. Please do not call these any more.
  - core_message_external::block_contacts(), please use core_message_external::block_user() instead.
  - core_message_external::unblock_contacts(), please use core_message_external::unblock_user() instead.
  - core_message_external::create_contacts(), please use core_message_external::create_contact_request() instead.
  - core_message_external::delete_conversation(), please use core_message_external::delete_conversations_by_id() instead.
  - core_message_external::core_message_mark_all_messages_as_read(), please use
    core_message_external::core_message_mark_all_conversation_messages_as_read() instead.
  - core_message_external::data_for_messagearea_conversations(), please use core_message_external::get_conversations()
    instead
  - core_message_external::data_for_messagearea_search_users_in_course().
  - core_message_external::data_for_messagearea_search_users(),
    please use core_message_external::message_search_users() instead.
  - core_message_external::data_for_messagearea_contacts().
  - core_message_external::data_for_messagearea_messages().
  - core_message_external::data_for_messagearea_get_most_recent_message().
  - core_message_external::data_for_messagearea_get_profile().
  - core_message_external::get_contacts().
* The following function has been added for getting the privacy messaging preference:
  - get_user_privacy_messaging_preference()

=== 3.5 ===

* Changed the database structure so there are no longer two tables for messages, with the only
  difference being that one stores read messages. The 'message' and 'message_read' tables are
  still present in core but will no longer be populated by core APIs. The data will be
  transferred to the new database structure via an ad-hoc task. Please be patient. This can
  take time.
  The new database structure is as follows -
  'messages' - Stores the messages with a 'useridfrom' field specifying the user who sent the
               message and a 'conversationid' field specifying which conversation it is for.
  'message_conversations' - The list of conversations.
  'message_conversation_members' - The list of users in each conversation.
  'message_user_actions' - The list of user actions against a message, eg. read/deleted.
  'notifications' - This has a very similar structure to the old table 'message' and still
                    has a one-to-one relation between users.
  Due to these huge differences the events message_sent, message_deleted and message_viewed
  have changed quite a lot. Please, if you have any observers or are triggering these events
  in your code you will have to make some changes!
* The webservice external function 'core_message_mark_message_read' now only marks messages as
  read, and not notifications. A new external function 'core_message_mark_notification_read' was
  added to mark notifications as read.
* Deprecated the following functions.
  - message_move_userfrom_unread2read
  - message_get_blocked_users
  - message_get_contacts
  - message_mark_message_read
  - message_can_delete_message
  - message_delete_message
  - \core_message\api::mark_all_read_for_user
  Please see their declaration in lib/deprecatedlib.php to view their alternatives (if applicable).
* Final deprecation of the following functions.
  - message_get_recent_notifications
  - message_search
  - message_get_history
  - message_get_recent_conversations
* Added new events for when a notification is sent and viewed.
* Removed the database table 'message_working'. The 'message_working' table was introduced when
  the messaging system was first introduced in Moodle, so, a long time ago. It was never necessary.
* Replaced the usage of the table 'message_popup' to a new table 'message_popup_notifications'.

=== 3.2 ===

* Removed all message_print_* functions as well as the files search.html, search_advanced.html and
  send_form.php due to messaging UI rehaul.
* Deprecated the following functions as they are no longer used.
    - message_get_course_contexts
    - message_remove_url_params
    - message_count_messages
    - message_count_blocked_users
    - message_contact_link
    - message_get_recent_notifications
    - message_history_link
    - message_search
    - message_shorten_message
    - message_get_fragment
    - message_get_history
    - message_get_contact_add_remove_link
    - message_get_contact_block_link
    - message_mark_messages_read
    - message_page_type_list
    - message_can_post_message
    - message_is_user_non_contact_blocked
    - message_is_user_blocked

=== 3.1 ===
* get_message_processors accepts an addition parameter for testing, which will just reset processor and exit.
* Deprecated method message_current_user_is_involved() has been removed.

=== 2.9 ===
* Renderer method \core_message_renderer::manage_messagingoptions now accepts a user id parameter as well.

=== 2.6 ===
* Message processor extending message_output, should return true in can_send_to_any_users()
  if it supports message sending to internal (noreply/support) users.
* Message API has been changed to allow attachments. Message processors that can support
  attachments can now use additional parameter as a part of $eventdata. To send attachments,
  $eventdata should contain properties called "attachment" (must be stored_file) and
  "attachname" (string). Currently, email message processor is the only one to support
  attachments.

=== 2.2 ===

required changes:
* lib/messagelib.php message_send($eventdata)
  $eventdata->userto should contain a property called "emailstop", $eventdata->userto->emailstop
  If it is absent it will be retrieved from the user table causing an additional database query
