* Converted UserMailer stuff to return a Status object instead of true-or-WikiError
[lhc/web/wiklou.git] / includes / UserMailer.php
1 <?php
2 /**
3 * Classes used to send e-mails
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @author <brion@pobox.com>
22 * @author <mail@tgries.de>
23 * @author Tim Starling
24 */
25
26
27 /**
28 * Stores a single person's name and email address.
29 * These are passed in via the constructor, and will be returned in SMTP
30 * header format when requested.
31 */
32 class MailAddress {
33 /**
34 * @param $address Mixed: string with an email address, or a User object
35 * @param $name String: human-readable name if a string address is given
36 * @param $realName String: human-readable real name if a string address is given
37 */
38 function __construct( $address, $name = null, $realName = null ) {
39 if( is_object( $address ) && $address instanceof User ) {
40 $this->address = $address->getEmail();
41 $this->name = $address->getName();
42 $this->realName = $address->getRealName();
43 } else {
44 $this->address = strval( $address );
45 $this->name = strval( $name );
46 $this->realName = strval( $realName );
47 }
48 }
49
50 /**
51 * Return formatted and quoted address to insert into SMTP headers
52 * @return string
53 */
54 function toString() {
55 # PHP's mail() implementation under Windows is somewhat shite, and
56 # can't handle "Joe Bloggs <joe@bloggs.com>" format email addresses,
57 # so don't bother generating them
58 if( $this->name != '' && !wfIsWindows() ) {
59 global $wgEnotifUseRealName;
60 $name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name;
61 $quoted = wfQuotedPrintable( $name );
62 if( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) {
63 $quoted = '"' . $quoted . '"';
64 }
65 return "$quoted <{$this->address}>";
66 } else {
67 return $this->address;
68 }
69 }
70
71 function __toString() {
72 return $this->toString();
73 }
74 }
75
76
77 /**
78 * Collection of static functions for sending mail
79 */
80 class UserMailer {
81 static $mErrorString;
82
83 /**
84 * Send mail using a PEAR mailer
85 */
86 protected static function sendWithPear($mailer, $dest, $headers, $body)
87 {
88 $mailResult = $mailer->send($dest, $headers, $body);
89
90 # Based on the result return an error string,
91 if( PEAR::isError( $mailResult ) ) {
92 wfDebug( "PEAR::Mail failed: " . $mailResult->getMessage() . "\n" );
93 return Status::newFatal( 'pear-mail-error', $mailResult->getMessage() );
94 } else {
95 return Status::newGood();
96 }
97 }
98
99 /**
100 * This function will perform a direct (authenticated) login to
101 * a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
102 * array of parameters. It requires PEAR:Mail to do that.
103 * Otherwise it just uses the standard PHP 'mail' function.
104 *
105 * @param $to MailAddress: recipient's email (or an array of them)
106 * @param $from MailAddress: sender's email
107 * @param $subject String: email's subject.
108 * @param $body String: email's text.
109 * @param $replyto MailAddress: optional reply-to email (default: null).
110 * @param $contentType String: optional custom Content-Type
111 * @return Status object
112 */
113 static function send( $to, $from, $subject, $body, $replyto=null, $contentType=null ) {
114 global $wgSMTP, $wgOutputEncoding, $wgEnotifImpersonal;
115 global $wgEnotifMaxRecips, $wgAdditionalMailParams;
116
117 if ( is_array( $to ) ) {
118 // This wouldn't be necessary if implode() worked on arrays of
119 // objects using __toString(). http://bugs.php.net/bug.php?id=36612
120 foreach( $to as $t ) {
121 $emails .= $t->toString() . ",";
122 }
123 $emails = rtrim( $emails, ',' );
124 wfDebug( __METHOD__.': sending mail to ' . $emails . "\n" );
125 } else {
126 wfDebug( __METHOD__.': sending mail to ' . implode( ',', array( $to->toString() ) ) . "\n" );
127 }
128
129 if (is_array( $wgSMTP )) {
130 $found = false;
131 $pathArray = explode( PATH_SEPARATOR, get_include_path() );
132 foreach ( $pathArray as $path ) {
133 if ( file_exists( $path . DIRECTORY_SEPARATOR . 'Mail.php' ) ) {
134 $found = true;
135 break;
136 }
137 }
138 if ( !$found ) {
139 throw new MWException( 'PEAR mail package is not installed' );
140 }
141 require_once( 'Mail.php' );
142
143 $msgid = str_replace(" ", "_", microtime());
144 if (function_exists('posix_getpid'))
145 $msgid .= '.' . posix_getpid();
146
147 if (is_array($to)) {
148 $dest = array();
149 foreach ($to as $u)
150 $dest[] = $u->address;
151 } else
152 $dest = $to->address;
153
154 $headers['From'] = $from->toString();
155
156 if ($wgEnotifImpersonal) {
157 $headers['To'] = 'undisclosed-recipients:;';
158 }
159 else {
160 $headers['To'] = implode( ", ", (array )$dest );
161 }
162
163 if ( $replyto ) {
164 $headers['Reply-To'] = $replyto->toString();
165 }
166 $headers['Subject'] = wfQuotedPrintable( $subject );
167 $headers['Date'] = date( 'r' );
168 $headers['MIME-Version'] = '1.0';
169 $headers['Content-type'] = (is_null($contentType) ?
170 'text/plain; charset='.$wgOutputEncoding : $contentType);
171 $headers['Content-transfer-encoding'] = '8bit';
172 $headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>'; // FIXME
173 $headers['X-Mailer'] = 'MediaWiki mailer';
174
175 wfSuppressWarnings();
176
177 // Create the mail object using the Mail::factory method
178 $mail_object =& Mail::factory('smtp', $wgSMTP);
179 if( PEAR::isError( $mail_object ) ) {
180 wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() . "\n" );
181 wfRestoreWarnings();
182 return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() );
183 }
184
185 wfDebug( "Sending mail via PEAR::Mail to $dest\n" );
186 $chunks = array_chunk( (array)$dest, $wgEnotifMaxRecips );
187 foreach ($chunks as $chunk) {
188 $status = self::sendWithPear($mail_object, $chunk, $headers, $body);
189 if( !$status->isOK() ) {
190 wfRestoreWarnings();
191 return $status;
192 }
193 }
194 wfRestoreWarnings();
195 return Status::newGood();
196 } else {
197 # In the following $headers = expression we removed "Reply-To: {$from}\r\n" , because it is treated differently
198 # (fifth parameter of the PHP mail function, see some lines below)
199
200 # Line endings need to be different on Unix and Windows due to
201 # the bug described at http://trac.wordpress.org/ticket/2603
202 if ( wfIsWindows() ) {
203 $body = str_replace( "\n", "\r\n", $body );
204 $endl = "\r\n";
205 } else {
206 $endl = "\n";
207 }
208 $ctype = (is_null($contentType) ?
209 'text/plain; charset='.$wgOutputEncoding : $contentType);
210 $headers =
211 "MIME-Version: 1.0$endl" .
212 "Content-type: $ctype$endl" .
213 "Content-Transfer-Encoding: 8bit$endl" .
214 "X-Mailer: MediaWiki mailer$endl".
215 'From: ' . $from->toString();
216 if ($replyto) {
217 $headers .= "{$endl}Reply-To: " . $replyto->toString();
218 }
219
220 wfDebug( "Sending mail via internal mail() function\n" );
221
222 self::$mErrorString = '';
223 $html_errors = ini_get( 'html_errors' );
224 ini_set( 'html_errors', '0' );
225 set_error_handler( array( 'UserMailer', 'errorHandler' ) );
226
227 if (is_array($to)) {
228 foreach ($to as $recip) {
229 $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
230 }
231 } else {
232 $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
233 }
234
235 restore_error_handler();
236 ini_set( 'html_errors', $html_errors );
237
238 if ( self::$mErrorString ) {
239 wfDebug( "Error sending mail: " . self::$mErrorString . "\n" );
240 return Status::newFatal( 'php-mail-error', self::$mErrorString );
241 } elseif (! $sent ) {
242 //mail function only tells if there's an error
243 wfDebug( "Error sending mail\n" );
244 return Status::newFatal( 'php-mail-error-unknown' );
245 } else {
246 return Status::newGood();
247 }
248 }
249 }
250
251 /**
252 * Set the mail error message in self::$mErrorString
253 *
254 * @param $code Integer: error number
255 * @param $string String: error message
256 */
257 static function errorHandler( $code, $string ) {
258 self::$mErrorString = preg_replace( '/^mail\(\)(\s*\[.*?\])?: /', '', $string );
259 }
260
261 /**
262 * Converts a string into a valid RFC 822 "phrase", such as is used for the sender name
263 */
264 static function rfc822Phrase( $phrase ) {
265 $phrase = strtr( $phrase, array( "\r" => '', "\n" => '', '"' => '' ) );
266 return '"' . $phrase . '"';
267 }
268 }
269
270 /**
271 * This module processes the email notifications when the current page is
272 * changed. It looks up the table watchlist to find out which users are watching
273 * that page.
274 *
275 * The current implementation sends independent emails to each watching user for
276 * the following reason:
277 *
278 * - Each watching user will be notified about the page edit time expressed in
279 * his/her local time (UTC is shown additionally). To achieve this, we need to
280 * find the individual timeoffset of each watching user from the preferences..
281 *
282 * Suggested improvement to slack down the number of sent emails: We could think
283 * of sending out bulk mails (bcc:user1,user2...) for all these users having the
284 * same timeoffset in their preferences.
285 *
286 * Visit the documentation pages under http://meta.wikipedia.com/Enotif
287 *
288 *
289 */
290 class EmailNotification {
291 protected $to, $subject, $body, $replyto, $from;
292 protected $user, $title, $timestamp, $summary, $minorEdit, $oldid, $composed_common, $editor;
293 protected $mailTargets = array();
294
295 /**
296 * Send emails corresponding to the user $editor editing the page $title.
297 * Also updates wl_notificationtimestamp.
298 *
299 * May be deferred via the job queue.
300 *
301 * @param $editor User object
302 * @param $title Title object
303 * @param $timestamp
304 * @param $summary
305 * @param $minorEdit
306 * @param $oldid (default: false)
307 */
308 function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false) {
309 global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker;
310
311 if ($title->getNamespace() < 0)
312 return;
313
314 // Build a list of users to notfiy
315 $watchers = array();
316 if ($wgEnotifWatchlist || $wgShowUpdatedMarker) {
317 $dbw = wfGetDB( DB_MASTER );
318 $res = $dbw->select( array( 'watchlist' ),
319 array( 'wl_user' ),
320 array(
321 'wl_title' => $title->getDBkey(),
322 'wl_namespace' => $title->getNamespace(),
323 'wl_user != ' . intval( $editor->getID() ),
324 'wl_notificationtimestamp IS NULL',
325 ), __METHOD__
326 );
327 foreach ( $res as $row ) {
328 $watchers[] = intval( $row->wl_user );
329 }
330 if ($watchers) {
331 // Update wl_notificationtimestamp for all watching users except
332 // the editor
333 $dbw->begin();
334 $dbw->update( 'watchlist',
335 array( /* SET */
336 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
337 ), array( /* WHERE */
338 'wl_title' => $title->getDBkey(),
339 'wl_namespace' => $title->getNamespace(),
340 'wl_user' => $watchers
341 ), __METHOD__
342 );
343 $dbw->commit();
344 }
345 }
346
347 if ($wgEnotifUseJobQ) {
348 $params = array(
349 "editor" => $editor->getName(),
350 "editorID" => $editor->getID(),
351 "timestamp" => $timestamp,
352 "summary" => $summary,
353 "minorEdit" => $minorEdit,
354 "oldid" => $oldid,
355 "watchers" => $watchers);
356 $job = new EnotifNotifyJob( $title, $params );
357 $job->insert();
358 } else {
359 $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers );
360 }
361
362 }
363
364 /*
365 * Immediate version of notifyOnPageChange().
366 *
367 * Send emails corresponding to the user $editor editing the page $title.
368 * Also updates wl_notificationtimestamp.
369 *
370 * @param $editor User object
371 * @param $title Title object
372 * @param $timestamp string Edit timestamp
373 * @param $summary string Edit summary
374 * @param $minorEdit bool
375 * @param $oldid int Revision ID
376 * @param $watchers array of user IDs
377 */
378 function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers) {
379 # we use $wgPasswordSender as sender's address
380 global $wgEnotifWatchlist;
381 global $wgEnotifMinorEdits, $wgEnotifUserTalk;
382
383 wfProfileIn( __METHOD__ );
384
385 # The following code is only run, if several conditions are met:
386 # 1. EmailNotification for pages (other than user_talk pages) must be enabled
387 # 2. minor edits (changes) are only regarded if the global flag indicates so
388
389 $isUserTalkPage = ($title->getNamespace() == NS_USER_TALK);
390
391 $this->title = $title;
392 $this->timestamp = $timestamp;
393 $this->summary = $summary;
394 $this->minorEdit = $minorEdit;
395 $this->oldid = $oldid;
396 $this->editor = $editor;
397 $this->composed_common = false;
398
399 $userTalkId = false;
400
401 if ( !$minorEdit || ($wgEnotifMinorEdits && !$editor->isAllowed('nominornewtalk') ) ) {
402 if ( $wgEnotifUserTalk && $isUserTalkPage ) {
403 $targetUser = User::newFromName( $title->getText() );
404 if ( !$targetUser || $targetUser->isAnon() ) {
405 wfDebug( __METHOD__.": user talk page edited, but user does not exist\n" );
406 } elseif ( $targetUser->getId() == $editor->getId() ) {
407 wfDebug( __METHOD__.": user edited their own talk page, no notification sent\n" );
408 } elseif( $targetUser->getOption( 'enotifusertalkpages' ) ) {
409 if( $targetUser->isEmailConfirmed() ) {
410 wfDebug( __METHOD__.": sending talk page update notification\n" );
411 $this->compose( $targetUser );
412 $userTalkId = $targetUser->getId();
413 } else {
414 wfDebug( __METHOD__.": talk page owner doesn't have validated email\n" );
415 }
416 } else {
417 wfDebug( __METHOD__.": talk page owner doesn't want notifications\n" );
418 }
419 }
420
421 if ( $wgEnotifWatchlist ) {
422 // Send updates to watchers other than the current editor
423 $userArray = UserArray::newFromIDs( $watchers );
424 foreach ( $userArray as $watchingUser ) {
425 if ( $watchingUser->getOption( 'enotifwatchlistpages' ) &&
426 ( !$minorEdit || $watchingUser->getOption('enotifminoredits') ) &&
427 $watchingUser->isEmailConfirmed() &&
428 $watchingUser->getID() != $userTalkId )
429 {
430 $this->compose( $watchingUser );
431 }
432 }
433 }
434 }
435
436 global $wgUsersNotifiedOnAllChanges;
437 foreach ( $wgUsersNotifiedOnAllChanges as $name ) {
438 $user = User::newFromName( $name );
439 $this->compose( $user );
440 }
441
442 $this->sendMails();
443 wfProfileOut( __METHOD__ );
444 }
445
446 /**
447 * @private
448 */
449 function composeCommonMailtext() {
450 global $wgPasswordSender, $wgPasswordSenderName, $wgNoReplyAddress;
451 global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
452 global $wgEnotifImpersonal, $wgEnotifUseRealName;
453
454 $this->composed_common = true;
455
456 $summary = ($this->summary == '') ? ' - ' : $this->summary;
457 $medit = ($this->minorEdit) ? wfMsgForContent( 'minoredit' ) : '';
458
459 # You as the WikiAdmin and Sysops can make use of plenty of
460 # named variables when composing your notification emails while
461 # simply editing the Meta pages
462
463 $subject = wfMsgForContent( 'enotif_subject' );
464 $body = wfMsgForContent( 'enotif_body' );
465 $from = ''; /* fail safe */
466 $replyto = ''; /* fail safe */
467 $keys = array();
468
469 if( $this->oldid ) {
470 $difflink = $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid );
471 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
472 $keys['$OLDID'] = $this->oldid;
473 $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
474 } else {
475 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' );
476 # clear $OLDID placeholder in the message template
477 $keys['$OLDID'] = '';
478 $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'created' );
479 }
480
481 if ($wgEnotifImpersonal && $this->oldid) {
482 /*
483 * For impersonal mail, show a diff link to the last
484 * revision.
485 */
486 $keys['$NEWPAGE'] = wfMsgForContent('enotif_lastdiff',
487 $this->title->getFullURL("oldid={$this->oldid}&diff=next"));
488 }
489
490 $body = strtr( $body, $keys );
491 $pagetitle = $this->title->getPrefixedText();
492 $keys['$PAGETITLE'] = $pagetitle;
493 $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
494
495 $keys['$PAGEMINOREDIT'] = $medit;
496 $keys['$PAGESUMMARY'] = $summary;
497 $keys['$UNWATCHURL'] = $this->title->getFullUrl( 'action=unwatch' );
498
499 $subject = strtr( $subject, $keys );
500
501 # Reveal the page editor's address as REPLY-TO address only if
502 # the user has not opted-out and the option is enabled at the
503 # global configuration level.
504 $editor = $this->editor;
505 $name = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName();
506 $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
507 $editorAddress = new MailAddress( $editor );
508 if( $wgEnotifRevealEditorAddress
509 && ( $editor->getEmail() != '' )
510 && $editor->getOption( 'enotifrevealaddr' ) ) {
511 if( $wgEnotifFromEditor ) {
512 $from = $editorAddress;
513 } else {
514 $from = $adminAddress;
515 $replyto = $editorAddress;
516 }
517 } else {
518 $from = $adminAddress;
519 $replyto = new MailAddress( $wgNoReplyAddress );
520 }
521
522 if( $editor->isIP( $name ) ) {
523 #real anon (user:xxx.xxx.xxx.xxx)
524 $utext = wfMsgForContent('enotif_anon_editor', $name);
525 $subject = str_replace('$PAGEEDITOR', $utext, $subject);
526 $keys['$PAGEEDITOR'] = $utext;
527 $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' );
528 } else {
529 $subject = str_replace('$PAGEEDITOR', $name, $subject);
530 $keys['$PAGEEDITOR'] = $name;
531 $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name );
532 $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
533 }
534 $userPage = $editor->getUserPage();
535 $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
536 $body = strtr( $body, $keys );
537 $body = wordwrap( $body, 72 );
538
539 # now save this as the constant user-independent part of the message
540 $this->from = $from;
541 $this->replyto = $replyto;
542 $this->subject = $subject;
543 $this->body = $body;
544 }
545
546 /**
547 * Compose a mail to a given user and either queue it for sending, or send it now,
548 * depending on settings.
549 *
550 * Call sendMails() to send any mails that were queued.
551 */
552 function compose( $user ) {
553 global $wgEnotifImpersonal;
554
555 if ( !$this->composed_common )
556 $this->composeCommonMailtext();
557
558 if ( $wgEnotifImpersonal ) {
559 $this->mailTargets[] = new MailAddress( $user );
560 } else {
561 $this->sendPersonalised( $user );
562 }
563 }
564
565 /**
566 * Send any queued mails
567 */
568 function sendMails() {
569 global $wgEnotifImpersonal;
570 if ( $wgEnotifImpersonal ) {
571 $this->sendImpersonal( $this->mailTargets );
572 }
573 }
574
575 /**
576 * Does the per-user customizations to a notification e-mail (name,
577 * timestamp in proper timezone, etc) and sends it out.
578 * Returns true if the mail was sent successfully.
579 *
580 * @param $watchingUser User object
581 * @return Boolean
582 * @private
583 */
584 function sendPersonalised( $watchingUser ) {
585 global $wgContLang, $wgEnotifUseRealName;
586 // From the PHP manual:
587 // Note: The to parameter cannot be an address in the form of "Something <someone@example.com>".
588 // The mail command will not parse this properly while talking with the MTA.
589 $to = new MailAddress( $watchingUser );
590 $name = $wgEnotifUseRealName ? $watchingUser->getRealName() : $watchingUser->getName();
591 $body = str_replace( '$WATCHINGUSERNAME', $name , $this->body );
592
593 $timecorrection = $watchingUser->getOption( 'timecorrection' );
594
595 # $PAGEEDITDATE is the time and date of the page change
596 # expressed in terms of individual local time of the notification
597 # recipient, i.e. watching user
598 $body = str_replace(
599 array( '$PAGEEDITDATEANDTIME',
600 '$PAGEEDITDATE',
601 '$PAGEEDITTIME' ),
602 array( $wgContLang->timeanddate( $this->timestamp, true, false, $timecorrection ),
603 $wgContLang->date( $this->timestamp, true, false, $timecorrection ),
604 $wgContLang->time( $this->timestamp, true, false, $timecorrection ) ),
605 $body);
606
607 return UserMailer::send($to, $this->from, $this->subject, $body, $this->replyto);
608 }
609
610 /**
611 * Same as sendPersonalised but does impersonal mail suitable for bulk
612 * mailing. Takes an array of MailAddress objects.
613 */
614 function sendImpersonal( $addresses ) {
615 global $wgContLang;
616
617 if (empty($addresses))
618 return;
619
620 $body = str_replace(
621 array( '$WATCHINGUSERNAME',
622 '$PAGEEDITDATE'),
623 array( wfMsgForContent('enotif_impersonal_salutation'),
624 $wgContLang->timeanddate($this->timestamp, true, false, false)),
625 $this->body);
626
627 return UserMailer::send($addresses, $this->from, $this->subject, $body, $this->replyto);
628 }
629
630 } # end of class EmailNotification
631
632 /**@{
633 * Backwards compatibility functions
634 *
635 * @deprecated Use UserMailer methods; will be removed in 1.19
636 */
637 function wfRFC822Phrase( $s ) {
638 wfDeprecated( __FUNCTION__ );
639 return UserMailer::rfc822Phrase( $s );
640 }
641
642 function userMailer( $to, $from, $subject, $body, $replyto=null ) {
643 wfDeprecated( __FUNCTION__ );
644 return UserMailer::send( $to, $from, $subject, $body, $replyto );
645 }
646 /**@}*/