<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AMessaging_2.0</id>
	<title>Development:Messaging 2.0 - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AMessaging_2.0"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Messaging_2.0&amp;action=history"/>
	<updated>2026-05-06T20:46:43Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Messaging_2.0&amp;diff=11358&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Messaging_2.0&amp;diff=11358&amp;oldid=prev"/>
		<updated>2024-10-21T08:51:27Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:51, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Messaging_2.0&amp;diff=11357&amp;oldid=prev</id>
		<title>1&gt;Andyjdavis: /* Providers (input) */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Messaging_2.0&amp;diff=11357&amp;oldid=prev"/>
		<updated>2010-11-09T06:59:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Providers (input)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The messaging system in 2.0 has been revamped significantly.  It is now event-driven, and allows users to control exactly what messages they receive and how.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to enable it==&lt;br /&gt;
&lt;br /&gt;
Admin &amp;gt; Optional subsystems &amp;gt; Enable messaging system = Yes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==How to configure it==&lt;br /&gt;
&lt;br /&gt;
Visit your own profile page (you need &amp;#039;&amp;#039;&amp;#039;moodle/user:editownmessageprofile&amp;#039;&amp;#039;&amp;#039; permission). Note that the types of messages listed in the &amp;quot;Configure destinations for incoming messages&amp;quot; box is determined by the contents of the message_providers table.&lt;br /&gt;
&lt;br /&gt;
[[Image:Messagingconfig.png]]&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
===Providers (input)===&lt;br /&gt;
We have [[Development:Events|Events]] called &amp;quot;message_send&amp;quot; that look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$eventdata = new object();&lt;br /&gt;
$eventdata-&amp;gt;component         = &amp;#039;mod_forum&amp;#039;;    // the component sending the message. Along with name this must exist in the table message_providers&lt;br /&gt;
$eventdata-&amp;gt;name              = &amp;#039;posts&amp;#039;;        // type of message from that module (as module defines it). Along with component this must exist in the table message_providers&lt;br /&gt;
$eventdata-&amp;gt;userfrom          = $userfrom;      // user object&lt;br /&gt;
$eventdata-&amp;gt;userto            = $userto;        // user object&lt;br /&gt;
$eventdata-&amp;gt;subject           = $postsubject;   // very short one-line subject&lt;br /&gt;
$eventdata-&amp;gt;fullmessage       = $posttext;      // raw text&lt;br /&gt;
$eventdata-&amp;gt;fullmessageformat = FORMAT_PLAIN;   // text format&lt;br /&gt;
$eventdata-&amp;gt;fullmessagehtml   = $posthtml;      // html rendered version&lt;br /&gt;
$eventdata-&amp;gt;smallmessage      = &amp;#039;&amp;#039;;             // useful for plugins like sms or twitter&lt;br /&gt;
&lt;br /&gt;
events_trigger(&amp;#039;message_send&amp;#039;, $eventdata);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name of each provider is a string with a name like messageprovider:$name from the component lang file (in this case, forum.php is derived automatically from mod/forum):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&amp;#039;messageprovider:posts&amp;#039;] = &amp;#039;Subscribed forum posts&amp;#039;;&lt;br /&gt;
$string[&amp;#039;messageprovider:digests&amp;#039;] = &amp;#039;Subscribed forum digests&amp;#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More providers can be added throughout Moodle as necessary, it&amp;#039;s quite easy.  See the [[Development:Events|Events API]] for info.&lt;br /&gt;
&lt;br /&gt;
===Processors (output)===&lt;br /&gt;
&lt;br /&gt;
In [http://cvs.moodle.org/moodle/message/output /message/output] there are full Moodle plugins for each type of output.  &lt;br /&gt;
&lt;br /&gt;
Currently we have support for email, jabber and web-based popups.  Could add twitter and SMS quite easily.&lt;br /&gt;
&lt;br /&gt;
Each plugin simply extends a class called &amp;quot;message_output&amp;quot; in [http://cvs.moodle.org/moodle/message/output/lib.php /message/output/lib.php] with methods such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function send_message($message) {&lt;br /&gt;
   // Given a message object and user info, this actually sends it.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function config_form($preferences) {&lt;br /&gt;
   // This defines the little form fragment on the config page&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function process_form($form, &amp;amp;$preferences) {&lt;br /&gt;
   // This processes the data from the config form fragment&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function load_data(&amp;amp;$preferences, $userid) {&lt;br /&gt;
   // This loads up prefs for this plugin&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should also provide a messageprocessor_xxxxx.php language file (where xxxxx is the name) and inside is an xxxxx string with the name of the processor, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$string[&amp;#039;jabber&amp;#039;] = &amp;#039;Jabber message&amp;#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, there should be a &amp;#039;&amp;#039;&amp;#039;lib.php file&amp;#039;&amp;#039;&amp;#039; containing an install routine to install itself as a message processor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function jabber_install(){&lt;br /&gt;
    global $DB;&lt;br /&gt;
&lt;br /&gt;
    $result = true;&lt;br /&gt;
&lt;br /&gt;
    $provider = new object();&lt;br /&gt;
    $provider-&amp;gt;name  = &amp;#039;jabber&amp;#039;;&lt;br /&gt;
    if (!$DB-&amp;gt;insert_record(&amp;#039;message_processors&amp;#039;, $provider)) {&lt;br /&gt;
        $result = false;&lt;br /&gt;
    }&lt;br /&gt;
    return $result;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And a &amp;#039;&amp;#039;&amp;#039;version.php&amp;#039;&amp;#039;&amp;#039; file:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$plugin-&amp;gt;version  = 2008090900;&lt;br /&gt;
$plugin-&amp;gt;requires = 2008091500;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[GSOC/2008]]&lt;br /&gt;
* [[Student projects/Messaging improvements|Messaging improvements]], a GSOC 2007 project&lt;br /&gt;
* [[Development:Events|Events API]]&lt;br /&gt;
* MDL-10107&lt;br /&gt;
&lt;br /&gt;
[[Category:Messaging]]&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>1&gt;Andyjdavis</name></author>
	</entry>
</feed>