]> git.mxchange.org Git - friendica.git/blob - include/notifier.php
Merge pull request #163 from fabrixxm/master
[friendica.git] / include / notifier.php
1 <?php
2
3 require_once("boot.php");
4
5 function notifier_run($argv, $argc){
6         global $a, $db;
7
8         if(is_null($a)){
9                 $a = new App;
10         }
11   
12         if(is_null($db)) {
13                 @include(".htconfig.php");
14                 require_once("dba.php");
15                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
16                         unset($db_host, $db_user, $db_pass, $db_data);
17         }
18
19         require_once("session.php");
20         require_once("datetime.php");
21         require_once('include/items.php');
22         require_once('include/bbcode.php');
23
24         load_config('config');
25         load_config('system');
26
27         load_hooks();
28
29         if($argc < 3)
30                 return;
31
32         $a->set_baseurl(get_config('system','url'));
33
34         logger('notifier: invoked: ' . print_r($argv,true));
35
36         $cmd = $argv[1];
37
38         switch($cmd) {
39                 case 'mail':
40                 default:
41                         $item_id = intval($argv[2]);
42                         if(! $item_id){
43                                 return;
44                         }
45                         break;
46         }
47
48         $expire = false;
49         $mail = false;
50         $fsuggest = false;
51         $top_level = false;
52         $recipients = array();
53         $url_recipients = array();
54
55         $normal_mode = true;
56
57         if($cmd === 'mail') {
58                 $normal_mode = false;
59                 $mail = true;
60                 $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
61                                 intval($item_id)
62                 );
63                 if(! count($message)){
64                         return;
65                 }
66                 $uid = $message[0]['uid'];
67                 $recipients[] = $message[0]['contact-id'];
68                 $item = $message[0];
69
70         }
71         elseif($cmd === 'expire') {
72                 $normal_mode = false;
73                 $expire = true;
74                 $items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1 
75                         AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP - INTERVAL 10 MINUTE",
76                         intval($item_id)
77                 );
78                 $uid = $item_id;
79                 $item_id = 0;
80                 if(! count($items))
81                         return;
82         }
83         elseif($cmd === 'suggest') {
84                 $normal_mode = false;
85                 $fsuggest = true;
86
87                 $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
88                         intval($item_id)
89                 );
90                 if(! count($suggest))
91                         return;
92                 $uid = $suggest[0]['uid'];
93                 $recipients[] = $suggest[0]['cid'];
94                 $item = $suggest[0];
95         }
96         else {
97
98                 // find ancestors
99                 $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
100                         intval($item_id)
101                 );
102
103                 if((! count($r)) || (! intval($r[0]['parent']))) {
104                         return;
105                 }
106
107                 $target_item = $r[0];
108                 $parent_id = intval($r[0]['parent']);
109                 $uid = $r[0]['uid'];
110                 $updated = $r[0]['edited'];
111
112                 $items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id` ASC",
113                         intval($parent_id)
114                 );
115
116                 if(! count($items)) {
117                         return;
118                 }
119
120                 // avoid race condition with deleting entries
121
122                 if($items[0]['deleted']) {
123                         foreach($items as $item)
124                                 $item['deleted'] = 1;
125                 }
126
127                 if(count($items) == 1 && $items[0]['uri'] === $items[0]['parent-uri'])
128                         $top_level = true;
129         }
130
131         $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, 
132                 `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, 
133                 `user`.`page-flags`, `user`.`prvnets`
134                 FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` 
135                 WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
136                 intval($uid)
137         );
138
139         if(! count($r))
140                 return;
141
142         $owner = $r[0];
143
144         $hub = get_config('system','huburl');
145
146         // If this is a public conversation, notify the feed hub
147         $public_message = true;
148
149         // fill this in with a single salmon slap if applicable
150         $slap = '';
151
152         if(! ($mail || $fsuggest)) {
153
154                 require_once('include/group.php');
155
156                 $parent = $items[0];
157
158                 // This is IMPORTANT!!!!
159
160                 // We will only send a "notify owner to relay" or followup message if the referenced post
161                 // originated on our system by virtue of having our hostname somewhere
162                 // in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
163                 // if $parent['wall'] == 1 we will already have the parent message in our array
164                 // and we will relay the whole lot.
165  
166                 // expire sends an entire group of expire messages and cannot be forwarded.
167                 // However the conversation owner will be a part of the conversation and will 
168                 // be notified during this run.
169                 // Other DFRN conversation members will be alerted during polled updates.
170
171                 // Diaspora members currently are not notified of expirations, and other networks have
172                 // either limited or no ability to process deletions. We should at least fix Diaspora 
173                 // by stringing togther an array of retractions and sending them onward.
174                  
175         
176                 $localhost = $a->get_hostname();
177                 if(strpos($localhost,':'))
178                         $localhost = substr($localhost,0,strpos($localhost,':'));
179
180                 /**
181                  *
182                  * Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes 
183                  * have been known to cause runaway conditions which affected several servers, along with 
184                  * permissions issues. 
185                  *
186                  */
187  
188                 if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
189                         // local followup to remote post
190                         $followup = true;
191                         $public_message = false; // not public
192                         $conversant_str = dbesc($parent['contact-id']);
193                 }
194                 else {
195                         $followup = false;
196
197                         if((strlen($parent['allow_cid'])) 
198                                 || (strlen($parent['allow_gid'])) 
199                                 || (strlen($parent['deny_cid'])) 
200                                 || (strlen($parent['deny_gid']))) {
201                                 $public_message = false; // private recipients, not public
202                         }
203
204                         $allow_people = expand_acl($parent['allow_cid']);
205                         $allow_groups = expand_groups(expand_acl($parent['allow_gid']));
206                         $deny_people  = expand_acl($parent['deny_cid']);
207                         $deny_groups  = expand_groups(expand_acl($parent['deny_gid']));
208
209                         $conversants = array();
210
211                         foreach($items as $item) {
212                                 $recipients[] = $item['contact-id'];
213                                 $conversants[] = $item['contact-id'];
214                                 // pull out additional tagged people to notify (if public message)
215                                 if($public_message && strlen($item['inform'])) {
216                                         $people = explode(',',$item['inform']);
217                                         foreach($people as $person) {
218                                                 if(substr($person,0,4) === 'cid:') {
219                                                         $recipients[] = intval(substr($person,4));
220                                                         $conversants[] = intval(substr($person,4));
221                                                 }
222                                                 else {
223                                                         $url_recipients[] = substr($person,4);
224                                                 }
225                                         }
226                                 }
227                         }
228
229                         logger('notifier: url_recipients' . print_r($url_recipients,true));
230
231                         $conversants = array_unique($conversants);
232
233
234                         $recipients = array_unique(array_merge($recipients,$allow_people,$allow_groups));
235                         $deny = array_unique(array_merge($deny_people,$deny_groups));
236                         $recipients = array_diff($recipients,$deny);
237
238                         $conversant_str = dbesc(implode(', ',$conversants));
239                 }
240
241                 $r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0");
242
243                 if(count($r))
244                         $contacts = $r;
245         }
246
247         $feed_template = get_markup_template('atom_feed.tpl');
248         $mail_template = get_markup_template('atom_mail.tpl');
249
250         $atom = '';
251         $slaps = array();
252
253         $hubxml = feed_hublinks();
254
255         $birthday = feed_birthday($owner['uid'],$owner['timezone']);
256
257         if(strlen($birthday))
258                 $birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
259
260         $atom .= replace_macros($feed_template, array(
261                         '$version'      => xmlify(FRIENDIKA_VERSION),
262                         '$feed_id'      => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ),
263                         '$feed_title'   => xmlify($owner['name']),
264                         '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
265                         '$hub'          => $hubxml,
266                         '$salmon'       => '',  // private feed, we don't use salmon here
267                         '$name'         => xmlify($owner['name']),
268                         '$profile_page' => xmlify($owner['url']),
269                         '$photo'        => xmlify($owner['photo']),
270                         '$thumb'        => xmlify($owner['thumb']),
271                         '$picdate'      => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
272                         '$uridate'      => xmlify(datetime_convert('UTC','UTC',$owner['uri-date']    . '+00:00' , ATOM_TIME)) ,
273                         '$namdate'      => xmlify(datetime_convert('UTC','UTC',$owner['name-date']   . '+00:00' , ATOM_TIME)) ,
274                         '$birthday'     => $birthday
275         ));
276
277         if($mail) {
278                 $public_message = false;  // mail is  not public
279
280                 $body = fix_private_photos($item['body'],$owner['uid']);
281
282                 $atom .= replace_macros($mail_template, array(
283                         '$name'         => xmlify($owner['name']),
284                         '$profile_page' => xmlify($owner['url']),
285                         '$thumb'        => xmlify($owner['thumb']),
286                         '$item_id'      => xmlify($item['uri']),
287                         '$subject'      => xmlify($item['title']),
288                         '$created'      => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
289                         '$content'      => xmlify($body),
290                         '$parent_id'    => xmlify($item['parent-uri'])
291                 ));
292         }
293         elseif($fsuggest) {
294                 $public_message = false;  // suggestions are not public
295
296                 $sugg_template = get_markup_template('atom_suggest.tpl');
297
298                 $atom .= replace_macros($sugg_template, array(
299                         '$name'         => xmlify($item['name']),
300                         '$url'          => xmlify($item['url']),
301                         '$photo'        => xmlify($item['photo']),
302                         '$request'      => xmlify($item['request']),
303                         '$note'         => xmlify($item['note'])
304                 ));
305
306                 // We don't need this any more
307
308                 q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1",
309                         intval($item['id'])
310                 );
311
312         }
313         else {
314                 if($followup) {
315                         foreach($items as $item) {  // there is only one item
316                                 if(! $item['parent'])
317                                         continue;
318                                 if($item['id'] == $item_id) {
319                                         logger('notifier: followup: item: ' . print_r($item,true), LOGGER_DATA);
320                                         $slap  = atom_entry($item,'html',$owner,$owner,false);
321                                         $atom .= atom_entry($item,'text',$owner,$owner,false);
322                                 }
323                         }
324                 }
325                 else {
326                         foreach($items as $item) {
327
328                                 if(! $item['parent'])
329                                         continue;
330
331                                 // private emails may be in included in public conversations. Filter them.
332
333                                 if(($public_message) && $item['private'])
334                                         continue;
335
336                                 $contact = get_item_contact($item,$contacts);
337                                 if(! $contact)
338                                         continue;
339
340                                 $atom .= atom_entry($item,'text',$contact,$owner,true);
341
342                                 if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire)) 
343                                         $slaps[] = atom_entry($item,'html',$contact,$owner,true);
344                         }
345                 }
346         }
347         $atom .= '</feed>' . "\r\n";
348
349         logger('notifier: ' . $atom, LOGGER_DATA);
350
351         logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
352
353         // If this is a public message and pubmail is set on the parent, include all your email contacts
354
355         $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
356
357         if(! $mail_disabled) {
358                 if((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid'])) 
359                         && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid'])) 
360                         && (intval($target_item['pubmail']))) {
361                         $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
362                                 intval($uid),
363                                 dbesc(NETWORK_MAIL)
364                         );
365                         if(count($r)) {
366                                 foreach($r as $rr)
367                                         $recipients[] = $rr['id'];
368                         }
369                 }
370         }
371
372         if($followup)
373                 $recip_str = $parent['contact-id'];
374         else
375                 $recip_str = implode(', ', $recipients);
376
377         $r = q("SELECT * FROM `contact` WHERE `id` IN ( %s ) AND `blocked` = 0 AND `pending` = 0 ",
378                 dbesc($recip_str)
379         );
380
381         // delivery loop
382
383         require_once('include/salmon.php');
384
385         if(count($r)) {
386                 foreach($r as $contact) {
387                         if($contact['self'])
388                                 continue;
389
390                         // potentially more than one recipient. Start a new process and space them out a bit.
391                         // we will deliver single recipient types of message and email receipients here. 
392
393                         if((! $mail) && (! $fsuggest) && (! $followup)) {
394                                 $interval = intval(get_config('system','delivery_interval'));
395                                 if(! $interval)
396                                         $interval = 2;
397
398                                 proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
399                                 sleep($interval);
400                                 continue;
401                         }
402
403                         $deliver_status = 0;
404
405                         logger("main delivery by notifier: followup=$followup mail=$mail fsuggest=$fsuggest");
406
407                         switch($contact['network']) {
408                                 case NETWORK_DFRN:
409                                         logger('notifier: dfrndelivery: ' . $contact['name']);
410                                         $deliver_status = dfrn_deliver($owner,$contact,$atom);
411
412                                         logger('notifier: dfrn_delivery returns ' . $deliver_status);
413         
414                                         if($deliver_status == (-1)) {
415                                                 logger('notifier: delivery failed: queuing message');
416                                                 // queue message for redelivery
417                                                 q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
418                                                         VALUES ( %d, '%s', '%s', '%s') ",
419                                                         intval($contact['id']),
420                                                         dbesc(datetime_convert()),
421                                                         dbesc(datetime_convert()),
422                                                         dbesc($atom)
423                                                 );
424                                         }
425                                         break;
426                                 case NETWORK_OSTATUS:
427
428                                         // Do not send to otatus if we are not configured to send to public networks
429                                         if($owner['prvnets'])
430                                                 break;
431                                         if(get_config('system','ostatus_disabled') || get_config('system','dfrn_only'))
432                                                 break;
433
434                                         if($followup && $contact['notify']) {
435                                                 logger('notifier: slapdelivery: ' . $contact['name']);
436                                                 $deliver_status = slapper($owner,$contact['notify'],$slap);
437
438                                                 if($deliver_status == (-1)) {
439                                                         // queue message for redelivery
440                                                         q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
441                                                                 VALUES ( %d, '%s', '%s', '%s') ",
442                                                                 intval($contact['id']),
443                                                                 dbesc(datetime_convert()),
444                                                                 dbesc(datetime_convert()),
445                                                                 dbesc($slap)
446                                                         );
447
448                                                 }
449                                         }
450                                         else {
451
452                                                 // only send salmon if public - e.g. if it's ok to notify
453                                                 // a public hub, it's ok to send a salmon
454
455                                                 if((count($slaps)) && ($public_message) && (! $expire)) {
456                                                         logger('notifier: slapdelivery: ' . $contact['name']);
457                                                         foreach($slaps as $slappy) {
458                                                                 if($contact['notify']) {
459                                                                         $deliver_status = slapper($owner,$contact['notify'],$slappy);
460                                                                         if($deliver_status == (-1)) {
461                                                                                 // queue message for redelivery
462                                                                                 q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
463                                                                                         VALUES ( %d, '%s', '%s', '%s') ",
464                                                                                         intval($contact['id']),
465                                                                                         dbesc(datetime_convert()),
466                                                                                         dbesc(datetime_convert()),
467                                                                                         dbesc($slappy)
468                                                                                 );                                                              
469                                                                         }
470                                                                 }
471                                                         }
472                                                 }
473                                         }
474                                         break;
475
476                                 case NETWORK_MAIL:
477                                                 
478                                         if(get_config('system','dfrn_only'))
479                                                 break;
480
481                                         // WARNING: does not currently convert to RFC2047 header encodings, etc.
482
483                                         $addr = $contact['addr'];
484                                         if(! strlen($addr))
485                                                 break;
486
487                                         if($cmd === 'wall-new' || $cmd === 'comment-new') {
488
489                                                 $it = null;
490                                                 if($cmd === 'wall-new') 
491                                                         $it = $items[0];
492                                                 else {
493                                                         $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", 
494                                                                 intval($argv[2]),
495                                                                 intval($uid)
496                                                         );
497                                                         if(count($r))
498                                                                 $it = $r[0];
499                                                 }
500                                                 if(! $it)
501                                                         break;
502                                                 
503
504
505                                                 $local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
506                                                         intval($uid)
507                                                 );
508                                                 if(! count($local_user))
509                                                         break;
510                                                 
511                                                 $reply_to = '';
512                                                 $r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
513                                                         intval($uid)
514                                                 );
515                                                 if($r1 && $r1[0]['reply_to'])
516                                                         $reply_to = $r1[0]['reply_to'];
517         
518                                                 $subject  = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
519                                                 $headers  = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
520
521                                                 if($reply_to)
522                                                         $headers .= 'Reply-to: ' . $reply_to . "\n";
523
524                                                 $headers .= 'Message-id: <' . $it['uri'] . '>' . "\n";
525
526                                                 if($it['uri'] !== $it['parent-uri']) {
527                                                         $header .= 'References: <' . $it['parent-uri'] . '>' . "\n";
528                                                         if(! strlen($it['title'])) {
529                                                                 $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
530                                                                         dbesc($it['parent-uri'])
531                                                                 );
532                                                                 if(count($r)) {
533                                                                         $subtitle = $r[0]['title'];
534                                                                         if($subtitle) {
535                                                                                 if(strncasecmp($subtitle,'RE:',3))
536                                                                                         $subject = $subtitle;
537                                                                                 else
538                                                                                         $subject = 'Re: ' . $subtitle;
539                                                                         }
540                                                                 }
541                                                         }
542                                                 }
543
544                                                 $headers .= 'MIME-Version: 1.0' . "\n";
545                                                 $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
546                                                 $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
547                                                 $html    = prepare_body($it);
548                                                 $message = '<html><body>' . $html . '</body></html>';
549                                                 logger('notifier: email delivery to ' . $addr);
550                                                 mail($addr, $subject, $message, $headers);
551                                         }
552                                         break;
553                                 case NETWORK_DIASPORA:
554                                         require_once('include/diaspora.php');
555                                         if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')) || (! $normal_mode))
556                                                 break;
557
558                                         if(! $contact['pubkey'])
559                                                 break;
560                                         
561                                         if($target_item['verb'] === ACTIVITY_DISLIKE) {
562                                                 // unsupported
563                                                 break;
564                                         }
565                                         elseif(($target_item['deleted']) && ($target_item['verb'] !== ACTIVITY_LIKE)) {
566                                                 // diaspora delete, 
567                                                 diaspora_send_retraction($target_item,$owner,$contact);
568                                                 break;
569                                         }
570                                         elseif($followup) {
571                                                 // send comments, likes and retractions of likes to owner to relay
572                                                 diaspora_send_followup($target_item,$owner,$contact);
573                                                 break;
574                                         }
575                                         elseif($target_item['parent'] != $target_item['id']) {
576                                                 // we are the relay - send comments, likes and unlikes to our conversants
577                                                 diaspora_send_relay($target_item,$owner,$contact);
578                                                 break;
579                                         }               
580                                         elseif($top_level) {
581                                                 diaspora_send_status($target_item,$owner,$contact);
582                                                 break;
583                                         }
584
585                                         break;
586
587                                 case NETWORK_FEED:
588                                 case NETWORK_FACEBOOK:
589                                         if(get_config('system','dfrn_only'))
590                                                 break;
591                                 default:
592                                         break;
593                         }
594                 }
595         }
596                 
597         // send additional slaps to mentioned remote tags (@foo@example.com)
598
599         if($slap && count($url_recipients) && ($followup || $top_level) && $public_message && (! $expire)) {
600                 if(! get_config('system','dfrn_only')) {
601                         foreach($url_recipients as $url) {
602                                 if($url) {
603                                         logger('notifier: urldelivery: ' . $url);
604                                         $deliver_status = slapper($owner,$url,$slap);
605                                         // TODO: redeliver/queue these items on failure, though there is no contact record
606                                 }
607                         }
608                 }
609         }
610
611
612         if($public_message) {
613
614                 $r = q("SELECT `id`, `name` FROM `contact` 
615                         WHERE `network` in ('%s','%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0
616                         AND `rel` != %d order by rand() ",
617                         dbesc(NETWORK_DFRN),
618                         dbesc(NETWORK_DIASPORA),
619                         intval($owner['uid']),
620                         intval(CONTACT_IS_SHARING)
621                 );
622
623                 if(count($r)) {
624                         logger('pubdeliver: ' . print_r($r,true));
625
626                         foreach($r as $rr) {
627
628                                 /* Don't deliver to folks who have already been delivered to */
629
630                                 if(in_array($rr['id'],$conversants)) {
631                                         logger('notifier: already delivered id=' . $rr['id']);
632                                         continue;
633                                 }
634
635                                 if((! $mail) && (! $fsuggest) && (! $followup)) {
636                                         $interval = intval(get_config('system','delivery_interval'));
637                                         if(! $interval)
638                                                 $interval = 2;
639
640                                         proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
641                                         sleep($interval);
642                                         continue;
643                                 }
644                         }
645                 }
646
647
648                 if(strlen($hub)) {
649                         $hubs = explode(',', $hub);
650                         if(count($hubs)) {
651                                 foreach($hubs as $h) {
652                                         $h = trim($h);
653                                         if(! strlen($h))
654                                                 continue;
655                                         $params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
656                                         post_url($h,$params);
657                                         logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
658                                         if(count($hubs) > 1)
659                                                 sleep(7);                               // try and avoid multiple hubs responding at precisely the same time
660                                 }
661                         }
662                 }
663
664         }
665
666         return;
667 }
668
669 if (array_search(__file__,get_included_files())===0){
670   notifier_run($argv,$argc);
671   killme();
672 }