]> git.mxchange.org Git - friendica.git/blob - src/Worker/Notifier.php
Code standards in api_get_user
[friendica.git] / src / Worker / Notifier.php
1 <?php
2 /**
3  * @file src/Worker/Notifier.php
4  */
5 namespace Friendica\Worker;
6
7 use Friendica\Core\Config;
8 use Friendica\Core\Worker;
9 use Friendica\Database\DBM;
10 use Friendica\Model\Contact;
11 use Friendica\Model\Group;
12 use Friendica\Network\Probe;
13 use Friendica\Protocol\Diaspora;
14 use Friendica\Protocol\OStatus;
15 use Friendica\Protocol\Salmon;
16 use dba;
17
18 require_once 'include/queue_fn.php';
19 require_once 'include/html2plain.php';
20 require_once 'include/datetime.php';
21 require_once 'include/items.php';
22 require_once 'include/bbcode.php';
23
24 /*
25  * This file was at one time responsible for doing all deliveries, but this caused
26  * big problems when the process was killed or stalled during the delivery process.
27  * It now invokes separate queues that are delivering via delivery.php and pubsubpublish.php.
28  */
29
30 /*
31  * The notifier is typically called with:
32  *
33  *              Worker::add(PRIORITY_HIGH, "Notifier", COMMAND, ITEM_ID);
34  *
35  * where COMMAND is one of the following:
36  *
37  *              activity                                (in diaspora.php, dfrn_confirm.php, profiles.php)
38  *              comment-import                  (in diaspora.php, items.php)
39  *              comment-new                             (in item.php)
40  *              drop                                    (in diaspora.php, items.php, photos.php)
41  *              edit_post                               (in item.php)
42  *              event                                   (in events.php)
43  *              expire                                  (in items.php)
44  *              like                                    (in like.php, poke.php)
45  *              mail                                    (in message.php)
46  *              suggest                                 (in fsuggest.php)
47  *              tag                                             (in photos.php, poke.php, tagger.php)
48  *              tgroup                                  (in items.php)
49  *              wall-new                                (in photos.php, item.php)
50  *              removeme                                (in Contact.php)
51  *              relocate                                (in uimport.php)
52  *
53  * and ITEM_ID is the id of the item in the database that needs to be sent to others.
54  */
55
56 class Notifier {
57         public static function execute($cmd, $item_id) {
58                 global $a;
59
60                 logger('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);
61
62                 $expire = false;
63                 $mail = false;
64                 $fsuggest = false;
65                 $relocate = false;
66                 $top_level = false;
67                 $recipients = array();
68                 $url_recipients = array();
69
70                 $normal_mode = true;
71
72                 if ($cmd === 'mail') {
73                         $normal_mode = false;
74                         $mail = true;
75                         $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
76                                         intval($item_id)
77                         );
78                         if (! count($message)) {
79                                 return;
80                         }
81                         $uid = $message[0]['uid'];
82                         $recipients[] = $message[0]['contact-id'];
83                         $item = $message[0];
84
85                 } elseif ($cmd === 'expire') {
86                         $normal_mode = false;
87                         $expire = true;
88                         $items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1
89                                 AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP() - INTERVAL 10 MINUTE",
90                                 intval($item_id)
91                         );
92                         $uid = $item_id;
93                         $item_id = 0;
94                         if (! count($items)) {
95                                 return;
96                         }
97                 } elseif ($cmd === 'suggest') {
98                         $normal_mode = false;
99                         $fsuggest = true;
100
101                         $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
102                                 intval($item_id)
103                         );
104                         if (! count($suggest)) {
105                                 return;
106                         }
107                         $uid = $suggest[0]['uid'];
108                         $recipients[] = $suggest[0]['cid'];
109                         $item = $suggest[0];
110                 } elseif ($cmd === 'removeme') {
111                         $r = q("SELECT `contact`.*, `user`.`prvkey` AS `uprvkey`,
112                                         `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
113                                         `user`.`page-flags`, `user`.`prvnets`, `user`.`account-type`, `user`.`guid`
114                                 FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
115                                         WHERE `contact`.`uid` = %d AND `contact`.`self` LIMIT 1",
116                                         intval($item_id));
117                         if (!$r)
118                                 return;
119
120                         $user = $r[0];
121
122                         $r = q("SELECT * FROM `contact` WHERE NOT `self` AND `uid` = %d", intval($item_id));
123                         if (!$r) {
124                                 return;
125                         }
126                         foreach ($r as $contact) {
127                                 Contact::terminateFriendship($user, $contact);
128                         }
129                         return;
130                 } elseif ($cmd === 'relocate') {
131                         $normal_mode = false;
132                         $relocate = true;
133                         $uid = $item_id;
134
135                         $recipients_relocate = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND `network` IN ('%s', '%s')",
136                                                 intval($uid), NETWORK_DFRN, NETWORK_DIASPORA);
137                 } else {
138                         // find ancestors
139                         $r = q("SELECT * FROM `item` WHERE `id` = %d AND visible = 1 AND moderated = 0 LIMIT 1",
140                                 intval($item_id)
141                         );
142
143                         if ((! DBM::is_result($r)) || (! intval($r[0]['parent']))) {
144                                 return;
145                         }
146
147                         $target_item = $r[0];
148                         $parent_id = intval($r[0]['parent']);
149                         $uid = $r[0]['uid'];
150                         $updated = $r[0]['edited'];
151
152                         $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
153                                 FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible = 1 AND moderated = 0 ORDER BY `id` ASC",
154                                 intval($parent_id)
155                         );
156
157                         if (! count($items)) {
158                                 return;
159                         }
160
161                         // avoid race condition with deleting entries
162
163                         if ($items[0]['deleted']) {
164                                 foreach ($items as $item) {
165                                         $item['deleted'] = 1;
166                                 }
167                         }
168
169                         if ((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) {
170                                 logger('notifier: top level post');
171                                 $top_level = true;
172                         }
173
174                 }
175
176                 $r = q("SELECT `contact`.*, `user`.`prvkey` AS `uprvkey`,
177                         `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
178                         `user`.`page-flags`, `user`.`prvnets`, `user`.`account-type`
179                         FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
180                         WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
181                         intval($uid)
182                 );
183
184                 if (! DBM::is_result($r)) {
185                         return;
186                 }
187
188                 $owner = $r[0];
189
190                 $walltowall = ((($top_level) && ($owner['id'] != $items[0]['contact-id'])) ? true : false);
191
192                 // Should the post be transmitted to Diaspora?
193                 $diaspora_delivery = true;
194
195                 // If this is a public conversation, notify the feed hub
196                 $public_message = true;
197
198                 // Do a PuSH
199                 $push_notify = false;
200
201                 // Deliver directly to a forum, don't PuSH
202                 $direct_forum_delivery = false;
203
204                 // fill this in with a single salmon slap if applicable
205                 $slap = '';
206
207                 if (! ($mail || $fsuggest || $relocate)) {
208
209                         $slap = OStatus::salmon($target_item, $owner);
210
211                         $parent = $items[0];
212
213                         $thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",
214                                 dbesc($target_item["thr-parent"]), intval($target_item["uid"]));
215
216                         logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent[0]['network'], LOGGER_DEBUG);
217
218                         // This is IMPORTANT!!!!
219
220                         // We will only send a "notify owner to relay" or followup message if the referenced post
221                         // originated on our system by virtue of having our hostname somewhere
222                         // in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
223
224                         // if $parent['wall'] == 1 we will already have the parent message in our array
225                         // and we will relay the whole lot.
226
227                         // expire sends an entire group of expire messages and cannot be forwarded.
228                         // However the conversation owner will be a part of the conversation and will
229                         // be notified during this run.
230                         // Other DFRN conversation members will be alerted during polled updates.
231
232
233
234                         // Diaspora members currently are not notified of expirations, and other networks have
235                         // either limited or no ability to process deletions. We should at least fix Diaspora
236                         // by stringing togther an array of retractions and sending them onward.
237
238
239                         $localhost = str_replace('www.','',$a->get_hostname());
240                         if (strpos($localhost,':')) {
241                                 $localhost = substr($localhost,0,strpos($localhost,':'));
242                         }
243                         /**
244                          *
245                          * Be VERY CAREFUL if you make any changes to the following several lines. Seemingly innocuous changes
246                          * have been known to cause runaway conditions which affected several servers, along with
247                          * permissions issues.
248                          *
249                          */
250
251                         $relay_to_owner = false;
252
253                         if (!$top_level && ($parent['wall'] == 0) && !$expire && (stristr($target_item['uri'],$localhost))) {
254                                 $relay_to_owner = true;
255                         }
256
257
258                         if (($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && !$top_level) {
259                                 $relay_to_owner = true;
260                         }
261
262                         // until the 'origin' flag has been in use for several months
263                         // we will just use it as a fallback test
264                         // later we will be able to use it as the primary test of whether or not to relay.
265
266                         if (! $target_item['origin']) {
267                                 $relay_to_owner = false;
268                         }
269                         if ($parent['origin']) {
270                                 $relay_to_owner = false;
271                         }
272
273                         // Special treatment for forum posts
274                         if (($target_item['author-link'] != $target_item['owner-link']) &&
275                                 ($owner['id'] != $target_item['contact-id']) &&
276                                 ($target_item['uri'] === $target_item['parent-uri'])) {
277
278                                 $fields = array('forum', 'prv');
279                                 $condition = array('id' => $target_item['contact-id']);
280                                 $contact = dba::select('contact', $fields, $condition, array('limit' => 1));
281                                 if (!DBM::is_result($contact)) {
282                                         // Should never happen
283                                         return false;
284                                 }
285
286                                 // Is the post from a forum?
287                                 if ($contact['forum'] || $contact['prv']) {
288                                         $relay_to_owner = true;
289                                         $direct_forum_delivery = true;
290                                 }
291                         }
292                         if ($relay_to_owner) {
293                                 logger('notifier: followup '.$target_item["guid"], LOGGER_DEBUG);
294                                 // local followup to remote post
295                                 $followup = true;
296                                 $public_message = false; // not public
297                                 $conversant_str = dbesc($parent['contact-id']);
298                                 $recipients = array($parent['contact-id']);
299                                 $recipients_followup  = array($parent['contact-id']);
300
301                                 //if (!$target_item['private'] && $target_item['wall'] &&
302                                 if (!$target_item['private'] &&
303                                         (strlen($target_item['allow_cid'].$target_item['allow_gid'].
304                                                 $target_item['deny_cid'].$target_item['deny_gid']) == 0))
305                                         $push_notify = true;
306
307                                 if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
308
309                                         $push_notify = true;
310
311                                         if ($parent["network"] == NETWORK_OSTATUS) {
312                                                 // Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
313                                                 // Currently it is work at progress
314                                                 $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
315                                                         intval($uid),
316                                                         dbesc(NETWORK_DFRN)
317                                                 );
318                                                 if (DBM::is_result($r)) {
319                                                         foreach ($r as $rr) {
320                                                                 $recipients_followup[] = $rr['id'];
321                                                         }
322                                                 }
323                                         }
324                                 }
325
326                                 if ($direct_forum_delivery) {
327                                         $push_notify = false;
328                                 }
329
330                                 logger("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), LOGGER_DEBUG);
331                         } else {
332                                 $followup = false;
333
334                                 logger('Distributing directly '.$target_item["guid"], LOGGER_DEBUG);
335
336                                 // don't send deletions onward for other people's stuff
337
338                                 if ($target_item['deleted'] && (! intval($target_item['wall']))) {
339                                         logger('notifier: ignoring delete notification for non-wall item');
340                                         return;
341                                 }
342
343                                 if ((strlen($parent['allow_cid']))
344                                         || (strlen($parent['allow_gid']))
345                                         || (strlen($parent['deny_cid']))
346                                         || (strlen($parent['deny_gid']))) {
347                                         $public_message = false; // private recipients, not public
348                                 }
349
350                                 $allow_people = expand_acl($parent['allow_cid']);
351                                 $allow_groups = Group::expand(expand_acl($parent['allow_gid']),true);
352                                 $deny_people  = expand_acl($parent['deny_cid']);
353                                 $deny_groups  = Group::expand(expand_acl($parent['deny_gid']));
354
355                                 // if our parent is a public forum (forum_mode == 1), uplink to the origional author causing
356                                 // a delivery fork. private groups (forum_mode == 2) do not uplink
357
358                                 if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
359                                         Worker::add($a->queue['priority'], 'Notifier', 'uplink', $item_id);
360                                 }
361
362                                 $conversants = array();
363
364                                 foreach ($items as $item) {
365                                         $recipients[] = $item['contact-id'];
366                                         $conversants[] = $item['contact-id'];
367                                         // pull out additional tagged people to notify (if public message)
368                                         if ($public_message && strlen($item['inform'])) {
369                                                 $people = explode(',',$item['inform']);
370                                                 foreach ($people as $person) {
371                                                         if (substr($person,0,4) === 'cid:') {
372                                                                 $recipients[] = intval(substr($person,4));
373                                                                 $conversants[] = intval(substr($person,4));
374                                                         } else {
375                                                                 $url_recipients[] = substr($person,4);
376                                                         }
377                                                 }
378                                         }
379                                 }
380
381                                 if (count($url_recipients))
382                                         logger('notifier: '.$target_item["guid"].' url_recipients ' . print_r($url_recipients,true));
383
384                                 $conversants = array_unique($conversants);
385
386
387                                 $recipients = array_unique(array_merge($recipients,$allow_people,$allow_groups));
388                                 $deny = array_unique(array_merge($deny_people,$deny_groups));
389                                 $recipients = array_diff($recipients,$deny);
390
391                                 $conversant_str = dbesc(implode(', ',$conversants));
392                         }
393
394                         // If the thread parent is OStatus then do some magic to distribute the messages.
395                         // We have not only to look at the parent, since it could be a Friendica thread.
396                         if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
397
398                                 $diaspora_delivery = false;
399
400                                 logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent[0]['author-link']." - Owner: ".$thr_parent[0]['owner-link'], LOGGER_DEBUG);
401
402                                 // Send a salmon to the parent author
403                                 $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
404                                         dbesc(normalise_link($thr_parent[0]['author-link'])),
405                                         intval($uid));
406                                 if (DBM::is_result($r)) {
407                                         $probed_contact = $r[0];
408                                 } else {
409                                         $probed_contact = Probe::uri($thr_parent[0]['author-link']);
410                                 }
411
412                                 if ($probed_contact["notify"] != "") {
413                                         logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
414                                         $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
415                                 }
416
417                                 // Send a salmon to the parent owner
418                                 $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
419                                         dbesc(normalise_link($thr_parent[0]['owner-link'])),
420                                         intval($uid));
421                                 if (DBM::is_result($r)) {
422                                         $probed_contact = $r[0];
423                                 } else {
424                                         $probed_contact = Probe::uri($thr_parent[0]['owner-link']);
425                                 }
426
427                                 if ($probed_contact["notify"] != "") {
428                                         logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
429                                         $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
430                                 }
431
432                                 // Send a salmon notification to every person we mentioned in the post
433                                 $arr = explode(',',$target_item['tag']);
434                                 foreach ($arr as $x) {
435                                         //logger('Checking tag '.$x, LOGGER_DEBUG);
436                                         $matches = null;
437                                         if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
438                                                         $probed_contact = Probe::uri($matches[1]);
439                                                 if ($probed_contact["notify"] != "") {
440                                                         logger('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]);
441                                                         $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
442                                                 }
443                                         }
444                                 }
445
446                                 // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
447                                 $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')";
448                         } else {
449                                 $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."')";
450                         }
451                 } else {
452                         $public_message = false;
453                 }
454
455                 // If this is a public message and pubmail is set on the parent, include all your email contacts
456
457                 $mail_disabled = ((function_exists('imap_open') && (!Config::get('system','imap_disabled'))) ? 0 : 1);
458
459                 if (! $mail_disabled) {
460                         if ((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid']))
461                                 && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid']))
462                                 && (intval($target_item['pubmail']))) {
463                                 $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
464                                         intval($uid),
465                                         dbesc(NETWORK_MAIL)
466                                 );
467                                 if (DBM::is_result($r)) {
468                                         foreach ($r as $rr) {
469                                                 $recipients[] = $rr['id'];
470                                         }
471                                 }
472                         }
473                 }
474
475                 if ($followup) {
476                         $recip_str = implode(', ', $recipients_followup);
477                 } else {
478                         $recip_str = implode(', ', $recipients);
479                 }
480                 if ($relocate) {
481                         $r = $recipients_relocate;
482                 } else {
483                         $r = q("SELECT `id`, `url`, `network`, `self` FROM `contact`
484                                 WHERE `id` IN (%s) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra,
485                                 dbesc($recip_str)
486                         );
487                 }
488
489                 // delivery loop
490
491                 if (DBM::is_result($r)) {
492                         foreach ($r as $contact) {
493                                 if ($contact['self']) {
494                                         continue;
495                                 }
496                                 logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
497
498                                 Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
499                                                 'Delivery', $cmd, $item_id, (int)$contact['id']);
500                         }
501                 }
502
503                 // send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
504                 // They are especially used for notifications to OStatus users that don't follow us.
505
506                 if ($slap && count($url_recipients) && ($public_message || $push_notify) && $normal_mode) {
507                         if (!Config::get('system', 'dfrn_only')) {
508                                 foreach ($url_recipients as $url) {
509                                         if ($url) {
510                                                 logger('notifier: urldelivery: ' . $url);
511                                                 $deliver_status = Salmon::slapper($owner, $url, $slap);
512                                                 /// @TODO Redeliver/queue these items on failure, though there is no contact record
513                                         }
514                                 }
515                         }
516                 }
517
518
519                 if ($public_message) {
520
521                         $r0 = array();
522                         $r1 = array();
523
524                         if ($diaspora_delivery) {
525                                 if (!$followup) {
526                                         $r0 = Diaspora::relayList();
527                                 }
528
529                                 $r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
530                                         FROM `contact` WHERE `network` = '%s' AND `batch` != ''
531                                         AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
532                                         dbesc(NETWORK_DIASPORA),
533                                         intval($owner['uid']),
534                                         intval(CONTACT_IS_SHARING)
535                                 );
536                         }
537
538                         $r2 = q("SELECT `id`, `name`,`network` FROM `contact`
539                                 WHERE `network` in ('%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
540                                 dbesc(NETWORK_DFRN),
541                                 intval($owner['uid']),
542                                 intval(CONTACT_IS_SHARING)
543                         );
544
545                         $r = array_merge($r2,$r1,$r0);
546
547                         if (DBM::is_result($r)) {
548                                 logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
549
550                                 foreach ($r as $rr) {
551
552                                         // except for Diaspora batch jobs
553                                         // Don't deliver to folks who have already been delivered to
554
555                                         if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'],$conversants))) {
556                                                 logger('notifier: already delivered id=' . $rr['id']);
557                                                 continue;
558                                         }
559
560                                         if ((! $mail) && (! $fsuggest) && (! $followup)) {
561                                                 logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
562                                                 Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
563                                                                 'Delivery', $cmd, $item_id, (int)$rr['id']);
564                                         }
565                                 }
566                         }
567
568                         $push_notify = true;
569
570                 }
571
572                 // Notify PuSH subscribers (Used for OStatus distribution of regular posts)
573                 if ($push_notify) {
574                         // Set push flag for PuSH subscribers to this topic,
575                         // they will be notified in queue.php
576                         q("UPDATE `push_subscriber` SET `push` = 1 ".
577                           "WHERE `nickname` = '%s' AND `push` = 0", dbesc($owner['nickname']));
578
579                         logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
580
581                         // Handling the pubsubhubbub requests
582                         Worker::add(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
583                                         'PubSubPublish');
584                 }
585
586                 logger('notifier: calling hooks', LOGGER_DEBUG);
587
588                 if ($normal_mode) {
589                         call_hooks('notifier_normal',$target_item);
590                 }
591
592                 call_hooks('notifier_end',$target_item);
593
594                 return;
595         }
596 }