1#!/usr/bin/perl
2#
3use Curses;
4#
5# Idee  : 11.11.1998 (beim Schreiben des x-ten shell Scriptes fuer ifcico)
6# Beginn: 13.11.1998
7#
8# 27.11.98 v0.01b   (03:42)
9# 30.11.98 v0.02b   (20:23)     Announce in der LINUX.DEVELOP.GER
10# 02.01.99 v0.03b   (09:35)
11#
12# Bugs / Tips / Anregungen / Vorschlaege an:
13# Thomas Koch@2:2437/530 oder
14# no-return@gmx.net
15#
16###############################################################################
17# Spezielle Variablen. Vorsichtig!! Nicht veraendern!! DON'T CHANGE IT!!      #
18#                                                                             #
19$logfilerl = "1"; $lcalls = "300"; $debugmode  = "noe"; $fehler=0; $dley=3;   #                                                                             #
20#                                                                             #
21###############################################################################
22###############################################################################
23
24$version="0.03b";
25$rdatum="02.01.1999";
26
27#
28
29###############################################################################
30# Pruefe, wer sich ewig bindet....
31
32sub schaumamal {
33
34if($_[0] ne "") {
35
36  if($_[1] =~ /r/) {
37    if( -r "$_[0]") { $ok=1; }
38      else {
39      print "$_[0] ist nicht lesbar!\n";
40      $fehler="1";
41    }
42  }
43
44  if($_[1] =~ /x/) {
45    if( -x "$_[0]") { $ok=1; }
46      else {
47      print "$_[0] ist nicht ausfuehrbar!\n";
48      $fehler="1";
49    }
50  }
51
52  if($_[1] =~ /d/) {
53    if( -d "$_[0]") { $ok=1; }
54      else {
55      print "Das Verzeichnis $_[0] ist nicht vorhanden!\n";
56      $fehler="1";
57    }
58  }
59
60  if($_[1] =~ /w/) {
61    if( -w "$_[0]") { $ok=1; }
62      else {
63      print "$_[0] ist nicht schreibbar!\n";
64      $fehler="1";
65    }
66  }
67} else {
68  print "leer\n";
69  $fehler=1;
70}
71
72
73
74}
75
76
77sub fcaw {
78
79local($desc,$tmp,$tmp1,$tmp2,$tmp3,$tmp4,$muell);
80
81if(/^$_[1]/i) {
82  ($tmp, $muell) = split(/\n/, $_[0]);
83  ($desc,$tmp1,$tmp2,$tmp3,$tmp4) = split(/ +|\t+/, $tmp);
84  if($tmp1 ne "") {
85    if($tmp2 ne "") {
86      if($tmp3 ne "") {
87        if($tmp4 ne "") {
88          $_[2]="$tmp1 $tmp2 $tmp3 $tmp4";
89        } else {
90          $_[2]="$tmp1 $tmp2 $tmp3";
91        }
92      } else {
93        $_[2]="$tmp1 $tmp2";
94      }
95    } else {
96        $_[2]="$tmp1";
97    }
98  }
99}
100
101}
102
103
104
105
106sub config_auslesen {
107
108schaumamal($config, "r");
109
110if($fehler eq "1") {
111  print "Exit.\n";
112  exit(100);
113}
114
115local($location);
116
117open(CF, $config) || die "Konnte $config nicht oeffnen\n!";
118while(<CF>) {
119
120     /#/ && next;
121     fcaw($_, "systemname ", $boxname);
122     fcaw($_, "ftnaddress 2\:", $ftnaddress);
123     fcaw($_, "ftninbound", $ftninbound);
124     fcaw($_, "ftnoutbound", $ftnoutbound);
125     fcaw($_, "systemart ", $systemart);
126     fcaw($_, "ftnaddress ", $ftnaddress);
127     fcaw($_, "ftnuplink ", $ftnuplink);
128     if($_ =~ /^ftnuplink/i) {
129       local($node,$desc,$desc1,$desc2,$desc3,$desc4)=split(/ +/,$ftnuplink);
130       push(@ftnuplinks, "$node $desc $desc1 $desc2 $desc3 $desc4");
131     }
132     fcaw($_, "sysopaddress ", $sysopaddress);
133     fcaw($_, "useautotoss ", $useautotoss);
134     fcaw($_, "tosscommand ", $tosscommand);
135     fcaw($_, "mailreader ", $mailreader);
136     fcaw($_, "biglogs ", $biglogs);
137     fcaw($_, "ifconfig ", $ifconfig);
138     fcaw($_, "ifcico ", $ifcicocmd);
139     fcaw($_, "iflog ", $iflog);
140     fcaw($_, "ifstat ", $ifstat);
141     fcaw($_, "tmpvz ", $tmpvz);
142
143}
144
145close(CF);
146
147
148
149schaumamal($ftninbound, "rd");
150schaumamal($mailreader, "rx");
151schaumamal($ifconfig, "r");
152schaumamal($ifcicocmd, "rx");
153schaumamal($iflog, "r");
154schaumamal($tosscommand, "rx");
155
156
157if($fehler eq "1") {
158  print "Exit.\n";
159  exit(100);
160}
161
162}
163
164
165# Bildaufbau
166sub machma {
167
168initscr();
169
170&color_pairs;
171
172local($dtext) = "#  Fido  Hilfe    (F10 = Menu)";
173
174
175attron(COLOR_PAIR(1));
176
177for($i=0; $i < $COLS; $i++) {
178   addstr(stdscr, $LINES - 1, $i, " ");
179   addstr(stdscr, 0, $i, " ");
180}
181
182addstr(stdscr, 0, 1, "$boxname ($ftnaddress)");
183addstr(stdscr, $LINES - 1, 1, "$dtext");
184
185$logwin = newwin($LINES - 8, $COLS, 7, 0);
186#$logwin = newwin(17, 80, 7, 0);
187
188attron(COLOR_PAIR(4));
189move(6, 0);
190if($systemart eq 0) {
191  $lcallwin = newwin(5, $COLS / 2 - 2, 1, 0);
192  $licallwin = newwin(5, $COLS / 2 - 1, 1, $COLS / 2 - 1);
193  for($i=0; $i < $COLS / 2 - 2; $i++) { addch(ACS_HLINE); }
194  addch(ACS_BTEE);
195  for($i=$COLS / 2 - 1; $i < $COLS - 1; $i++) { addch(ACS_HLINE); }
196  for($i=1; $i < 6; $i++) { addch($i, $COLS / 2 - 2, ACS_VLINE); }
197} elsif($systemart eq 1) {
198  for($i=0; $i < $COLS - 1; $i++) { addch(ACS_HLINE); }
199  $lcallwin = newwin(5, $COLS -1, 1, 0);
200}
201
202
203attron(COLOR_PAIR(1));
204refresh();
205
206}
207
208
209sub color_pairs {
210
211start_color();
212
213if($bw ne 1) {
214  init_pair(1, COLOR_WHITE, COLOR_BLUE);
215  init_pair(2, COLOR_WHITE, COLOR_BLACK);
216  init_pair(3, COLOR_CYAN, COLOR_BLACK);
217  init_pair(4, COLOR_MAGENTA, COLOR_BLACK);
218  init_pair(5, COLOR_GREEN, COLOR_BLACK);
219  init_pair(6, COLOR_WHITE, COLOR_BLUE);
220  init_pair(7, COLOR_BLUE, COLOR_WHITE);
221  init_pair(8, COLOR_BLACK, COLOR_WHITE);
222  init_pair(9, COLOR_WHITE, COLOR_BLUE);
223  init_pair(10, COLOR_GREEN, COLOR_WHITE);
224  init_pair(11, COLOR_BLUE, COLOR_WHITE);
225} else {
226  init_pair(1, COLOR_BLACK, COLOR_GREEN);
227  init_pair(2, COLOR_WHITE, COLOR_BLACK);
228  init_pair(3, COLOR_CYAN, COLOR_BLACK);
229  init_pair(4, COLOR_WHITE, COLOR_BLACK);
230  init_pair(5, COLOR_GREEN, COLOR_BLACK);
231  init_pair(6, COLOR_WHITE, COLOR_BLUE);
232  init_pair(7, COLOR_BLUE, COLOR_WHITE);
233  init_pair(8, COLOR_BLACK, COLOR_WHITE);
234  init_pair(9, COLOR_WHITE, COLOR_BLACK);
235  init_pair(10, COLOR_GREEN, COLOR_WHITE);
236  init_pair(11, COLOR_BLUE, COLOR_WHITE);
237}
238
239}
240
241
242# hline
243sub hline {
244
245move($_[0], $_[2], 0);
246addch($_[0], ACS_LTEE);
247
248for($i=0; $i < $_[1]; $i++) {
249   addch($_[0], ACS_HLINE);
250}
251
252addch($_[0], ACS_RTEE);
253
254}
255
256
257# Scrollbalken
258sub sbalk {
259
260if($_[4] eq 1 || $_[4] eq -1) {
261  attron($_[0], COLOR_PAIR(9));
262}
263
264$xlaenge=$_[1];
265
266while(length($xlaenge) < $_[6]) {
267  $xlaenge=$xlaenge . " ";
268}
269
270addstr($_[0], $_[2], $_[3], "$xlaenge");
271
272attron($_[0], COLOR_PAIR(7));
273
274$ylaenge=$_[5];
275
276while(length($ylaenge) < $_[6]) {
277     $ylaenge=$ylaenge . " ";
278}
279
280if($_[5] ne "0" && $_[4] eq 1) {
281  $u=$_[2] - 1;
282  addstr($_[0], $u, $_[3], "$ylaenge");
283} else {
284  $u=$_[2] + 1;
285  addstr($_[0], $u, $_[3], "$ylaenge");
286}
287
288}
289
290
291# Fido Window
292sub mfwin {
293
294$nach_rechts=0; $nach_links=0; $aktion="";
295
296$fwin=newwin(9, 23, $LINES - 10, 3);
297
298attron($fwin, COLOR_PAIR(7));
299addstr($fwin, "                                                                                                                                                                                          ");
300
301$mfwin[1]="Files requesten...";
302$mfwin[2]="Outbound Manager...";
303$mfwin[3]="Mailreader starten";
304$mfwin[4]="Logfile scrollen";
305$mfwin[5]="Boss anrufen";
306$mfwin[6]="Direktanruf...";
307$mfwin[7]="Tosser starten";
308
309sbalk($fwin, $mfwin[1], 1, 1, 1, 0, 21);
310sbalk($fwin, $mfwin[2], 2, 1, 0, 0, 21);
311sbalk($fwin, $mfwin[3], 3, 1, 0, 0, 21);
312sbalk($fwin, $mfwin[4], 4, 1, 0, 0, 21);
313sbalk($fwin, $mfwin[5], 5, 1, 0, 0, 21);
314sbalk($fwin, $mfwin[6], 6, 1, 0, 0, 21);
315sbalk($fwin, $mfwin[7], 7, 1, 0, 0, 21);
316
317
318attron($fwin, COLOR_PAIR(8));
319
320box($fwin, 0, 0);
321refresh($fwin);
322
323$z=1;
324for($i=0; $i = 1; $ii++) {
325
326   $ch = getch();
327
328   if($ch == KEY_DOWN || $ch == KEY_UP || $ch == KEY_LEFT || $ch == KEY_RIGHT) {
329     if($ch == KEY_DOWN) {
330       if($z ne 7) {
331         $z++;
332       }
333       $n=$z - 1;
334       sbalk($fwin, $mfwin[$z], $z, 1, 1, $mfwin[$n], 21);
335     }
336
337     if($ch == KEY_UP) {
338       if($z ne 1) {
339          $z--;
340       }
341       $n=$z + 1;
342       sbalk($fwin, $mfwin[$z], $z, 1, -1, $mfwin[$n], 21);
343     }
344
345     if($ch == KEY_LEFT) {
346       $window=0;
347       last;
348     }
349
350     if($ch == KEY_RIGHT) {
351       $window=2;
352       last;
353     }
354   } else {
355
356     $zn = unpack("C", $ch);
357
358     if($zn eq 27) {
359       $raushier=1;
360       last;
361     }
362
363     if($zn eq 10) {
364       $aktion=$mfwin[$z];
365       $raushier=1;
366       last;
367     }
368   }
369
370if($ch eq -1) {
371  &akzeit;
372} else {
373  refresh($fwin);
374}
375
376
377}
378
379}
380
381
382# rauten Window
383sub mrwin {
384
385$nach_rechts=0; $nach_links=0; $aktion="";
386
387$rwin=newwin(5, 24, $LINES - 6, 0);
388
389attron($rwin, COLOR_PAIR(7));
390addstr($rwin, "                                                                                                                                                                                          ");
391
392$mrwin[1]="Ueber...";
393$mrwin[2]="Desktop neu zeichnen";
394$mrwin[3]="Beenden";
395
396sbalk($rwin, $mrwin[1], 1, 1, 1, 0, 22);
397sbalk($rwin, $mrwin[2], 2, 1, 0, 0, 22);
398sbalk($rwin, $mrwin[3], 3, 1, 0, 0, 22);
399
400attron($rwin, COLOR_PAIR(8));
401
402box($rwin, 0, 0);
403refresh($rwin);
404
405$z=1;
406for($i=0; $i = 1; $ii++) {
407
408   $ch = getch();
409
410   if($ch == KEY_DOWN || $ch == KEY_UP || $ch == KEY_LEFT || $ch == KEY_RIGHT) {
411     if($ch == KEY_DOWN) {
412       if($z ne 3) {
413         $z++;
414       }
415       $n=$z - 1;
416       sbalk($rwin, $mrwin[$z], $z, 1, 1, $mrwin[$n], 22);
417     }
418
419     if($ch == KEY_UP) {
420       if($z ne 1) {
421          $z--;
422       }
423       $n=$z + 1;
424       sbalk($rwin, $mrwin[$z], $z, 1, -1, $mrwin[$n], 22);
425     }
426
427     if($ch == KEY_LEFT) {
428       $window=0;
429     }
430
431     if($ch == KEY_RIGHT) {
432       $window=1;
433       last;
434     }
435   } else {
436
437     $zn = unpack("C", $ch);
438
439     if($zn eq 27) {
440       $raushier=1;
441       last;
442     }
443
444     if($zn eq 10) {
445       $aktion=$mrwin[$z];
446       $raushier=1;
447       last;
448     }
449   }
450
451if($ch eq -1) {
452  &akzeit;
453} else {
454  refresh($rwin);
455}
456
457}
458
459}
460
461
462sub mhwin {
463
464$hwin=newwin(3, 22, $LINES - 4, 9);
465
466attron($hwin, COLOR_PAIR(7));
467addstr($hwin, "                                                                                                                                                                                          ");
468
469$mhwin[1]="Hilfe";
470
471sbalk($hwin, $mhwin[1], 1, 1, 1, 0, 20);
472
473attron($hwin, COLOR_PAIR(8));
474
475box($hwin, 0, 0);
476refresh($hwin);
477
478$z=1;
479for($i=0; $i = 1; $ii++) {
480
481   $ch = getch();
482
483   if($ch == KEY_DOWN || $ch == KEY_UP || $ch == KEY_LEFT || $ch == KEY_RIGHT) {
484   if($ch == KEY_DOWN) {
485     if($z ne 1) {
486       $z++;
487     }
488     $n=$z - 1;
489     sbalk($hwin, $mhwin[$z], $z, 1, 1, $mhwin[$n], 20);
490   }
491
492   if($ch == KEY_UP) {
493     if($z ne 1) {
494        $z--;
495     }
496     $n=$z + 1;
497     sbalk($hwin, $mhwin[$z], $z, 1, -1, $mhwin[$n], 20);
498   }
499
500     if($ch == KEY_LEFT) {
501       $window=1;
502       last;
503     }
504
505     if($ch == KEY_RIGHT) {
506       $nach_rechts=0;
507#      last;
508     }
509   } else {
510
511     $zn = unpack("C", $ch);
512
513     if($zn eq 27) {
514       $raushier=1;
515       last;
516     }
517
518     if($zn eq 10) {
519       $aktion=$mhwin[$z];
520       $raushier=1;
521       last;
522     }
523   }
524
525if($ch eq -1) {
526  &akzeit;
527} else {
528  refresh($hwin);
529}
530
531}
532
533}
534
535
536sub menu {
537
538$raushier=0;
539mrwin;
540
541while($raushier ne 1) {
542
543     if($window eq 0) {
544       touchwin($logwin);
545       refresh($logwin);
546       mrwin;
547       next;
548     }
549
550     if($window eq 1) {
551       touchwin($logwin);
552       refresh($logwin);
553       mfwin;
554       next;
555     }
556
557     if($window eq 2) {
558       touchwin($logwin);
559       refresh($logwin);
560       mhwin;
561       next;
562     }
563}
564
565# #
566if($aktion eq "Beenden") { &ausgang }
567if($aktion eq "Desktop neu zeichnen") { &touchall("r") }
568if($aktion eq "Ueber...") { &uebergff }
569
570# Fido
571if($aktion eq "Files requesten...") { &request }
572if($aktion eq "Outbound Manager...") { &outbm }
573if($aktion eq "Mailreader starten") { &mailreader_go }
574if($aktion eq "Logfile scrollen") { &iflogfile_scrollen }
575if($aktion eq "Boss anrufen") { &poll_uplink }
576if($aktion eq "Direktanruf...") { &call_node }
577if($aktion eq "Tosser starten") { &autotoss }
578
579# Hilfe
580if($aktion eq "Hilfe") { &hilfe }
581
582
583touchwin($logwin);
584refresh($logwin);
585
586}
587
588
589sub uebergff {
590
591
592$win = newwin(10, 40, $LINES / 3, ($COLS - 40) / 2);
593
594attron($win, COLOR_PAIR(7));
595addstr($win, "                                                                                                                                                                                                                                                                                                                                                                                                                   ");
596attron($win, COLOR_PAIR(8));
597box($win, 0, 0);
598attron($win, COLOR_PAIR(11));
599addstr($win, 0, 3, " gff v$version ($rdatum) ");
600attron($win, COLOR_PAIR(8));
601addstr($win, 2, 2, "Graphisches Fido Frontend fuer Linux");
602addstr($win, 4, 12, "geschrieben von");
603addstr($win, 6, 10, "Thomas Koch 1998/99");
604&mcnru;
605refresh($win);
606nocbreak;
607getch();
608
609}
610
611
612sub mcnru {
613
614move($LINES - 1, $COLS - 1);
615
616}
617
618
619# automatisches Tossen
620sub autotoss {
621
622$toss_mich=0;
623
624@PKT=""; @pkt=""; @MO0=""; @mo0=""; @TU0=""; @tu0=""; @WE0=""; @we0="";
625@TH0=""; @th0=""; @FR0=""; @fr0=""; @SA0=""; @sa0=""; @SU0=""; @su0="";
626
627@PKT=glob(<$ftninbound/*.PKT>); if($PKT[0] ne "") { $toss_mich=1; }
628@pkt=glob(<$ftninbound/*.pkt>); if($pkt[0] ne "") { $toss_mich=1; }
629@MO0=glob(<$ftninbound/*.MO*>); if($MO0[0] ne "") { $toss_mich=1; }
630@mo0=glob(<$ftninbound/*.mo*>); if($mo0[0] ne "") { $toss_mich=1; }
631@TU0=glob(<$ftninbound/*.TU*>); if($TU0[0] ne "") { $toss_mich=1; }
632@tu0=glob(<$ftninbound/*.tu*>); if($tu0[0] ne "") { $toss_mich=1; }
633@WE0=glob(<$ftninbound/*.WE*>); if($WE0[0] ne "") { $toss_mich=1; }
634@we0=glob(<$ftninbound/*.we*>); if($we0[0] ne "") { $toss_mich=1; }
635@TH0=glob(<$ftninbound/*.TH*>); if($TH0[0] ne "") { $toss_mich=1; }
636@th0=glob(<$ftninbound/*.th*>); if($th0[0] ne "") { $toss_mich=1; }
637@FR0=glob(<$ftninbound/*.FR*>); if($FR0[0] ne "") { $toss_mich=1; }
638@fr0=glob(<$ftninbound/*.fr*>); if($fr0[0] ne "") { $toss_mich=1; }
639@SA0=glob(<$ftninbound/*.SA*>); if($SA0[0] ne "") { $toss_mich=1; }
640@sa0=glob(<$ftninbound/*.sa*>); if($sa0[0] ne "") { $toss_mich=1; }
641@SU0=glob(<$ftninbound/*.SU*>); if($SU0[0] ne "") { $toss_mich=1; }
642@su0=glob(<$ftninbound/*.su*>); if($su0[0] ne "") { $toss_mich=1; }
643
644
645if($toss_mich eq 1) {
646  if(-e "$tmpvz/gff.bsy") {
647    $nulliger=0;
648  } else {
649    logger("Tosse...");
650    $tosswin = newwin(3, 12, 8, ($COLS - 12) / 2);
651
652    attron($tosswin, COLOR_PAIR(1));
653    box($tosswin, 0, 0);
654    addstr($tosswin, 1, 1, " Tosse... ");
655
656    refresh($tosswin);
657    system("$tosscommand >/dev/null 2>/dev/null");
658    touchwin($logwin);
659    refresh($logwin);
660  }
661}
662
663}
664
665
666# Ist ein Flowfile fuer den Sysop vorhanden, wird ein 'M' rechts unten
667# eingeblendet.
668sub sysop_mail {
669
670local($datei,$req,$outbound_ext);
671
672local($zone,$netnodepoint) = split(/:/, $sysopaddress);
673local($netnode,$point) = split(/\./, $netnodepoint);
674
675$req = sprintf("%04x%04x", split(/\//, $netnode));
676$point = sprintf("%08x", $point);
677
678if($zone eq 2) {
679  $datei="$ftnoutbound/outbound/$req.pnt/$point.hlo";
680} else {
681  $outbound_ext = sprintf("%03x", $zone);
682  $datei="$ftnoutbound/outbound.$outbound_ext/$req.pnt/$point.hlo";
683}
684
685if(-e $datei) {
686  addstr($LINES - 1, $COLS - 3, "M");
687} else {
688  addstr($LINES - 1, $COLS - 3, " ");
689}
690
691refresh();
692
693}
694
695
696
697# Request files...
698sub reqfile {
699
700if($_[0] =~ /\d+:\d+\/\d+/) {
701  ($zone, $address) = split(/:/, $_[0]);
702  $req = sprintf("%04x%04x", split(/\//, $address));
703  if($zone eq 2) {
704    $reqfile="$ftnoutbound/outbound/$req.req";
705  } else {
706    $ooutbound = sprintf("%03x", $zone);
707    $reqfile="$ftnoutbound/outbound.$ooutbound/$req.req";
708  }
709}
710
711if( -e "$reqfile") {
712  open(REQFILE, ">>$reqfile");
713  print REQFILE "$_[1]\n";
714  close(REQFILE);
715} else {
716  open(REQFILE, ">$reqfile");
717  print REQFILE "$_[1]\n";
718  close(REQFILE);
719}
720
721}
722
723
724sub hex2dec {
725
726$net=hex(substr($_[0], 0, 4));
727$node=hex(substr($_[0], 4, 4));
728
729$_[1]="$net/$node";
730
731}
732
733
734sub additem {
735
736$fragwin=newwin(6, 20, 4, 4);
737attron($fragwin, COLOR_PAIR(8));
738addstr($fragwin, "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ");
739
740}
741
742
743sub outbm {
744
745local(@files, @flowfiles, @pntvz, @pntfiles);
746
747eval { keypad(1) };
748
749@files=glob("$ftnoutbound/outbound/*.*");
750
751for $file (@files) {
752   ($name, $ext) = split(/\./, $file);
753   if($ext =~ /flo|clo|dlo|ilo|hlo|req/i) {
754     ($pfad, $name)=split(/$ftnoutbound\/outbound/, $file); $name =~ s/\///;
755     push(@flowfiles, $name);
756   }
757   if($ext =~ /pnt/i) { push(@pnt, $file); }
758}
759
760$zone=2;
761
762for(@flowfiles) {
763   ($name, $ext) = split(/\./, $_);
764   hex2dec($name, $dname);
765   if($ext =~ /flo/i) { push(@outbound, "....N $zone:$dname"); }
766   if($ext =~ /clo/i) { push(@outbound, "...C. $zone:$dname"); }
767   if($ext =~ /hlo/i) { push(@outbound, "..H.. $zone:$dname"); }
768   if($ext =~ /dlo/i) { push(@outbound, ".D... $zone:$dname"); }
769   if($ext =~ /ilo/i) { push(@outbound, "I.... $zone:$dname"); }
770   if($ext =~ /req/i) { push(@outbound, "....R $zone:$dname"); }
771}
772
773
774for $pntvz (@pnt) {
775   @s=split(/\//, $pntvz);
776   for(@s) {
777      if($_ =~ /\.pnt/i) {
778        $_=~ s/\.pnt//i;
779	hex2dec($_, $dnode);
780      }
781   }
782   @pntfiles=glob("$pntvz/*.*");
783   for(@pntfiles) {
784      ($pfad, $name)=split(/$pntvz/, $_); $name =~ s/\///;
785      ($name, $ext)=split(/\./, $name);
786      $pointnr=hex($name);
787      if($ext =~ /flo/i) { push(@pv, "....N $zone:$dnode.$pointnr"); }
788      if($ext =~ /clo/i) { push(@pv, "...C. $zone:$dnode.$pointnr"); }
789      if($ext =~ /hlo/i) { push(@pv, "..H.. $zone:$dnode.$pointnr"); }
790      if($ext =~ /dlo/i) { push(@pv, ".D... $zone:$dnode.$pointnr"); }
791      if($ext =~ /ilo/i) { push(@pv, "I.... $zone:$dnode.$pointnr"); }
792      if($ext =~ /req/i) { push(@pv, "....R $zone:$dnode.$pointnr"); }
793   }
794}
795
796$outbm = newwin(18, 40, 3, ($COLS - 40) / 2);
797attron($outbm, COLOR_PAIR(8));
798addstr($outbm, "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ");
799box($outbm, 0, 0);
800addstr($outbm, 0, 11, " Outbound Manager ");
801#refresh($outbm);
802
803$laenge=@outbound;
804
805$outbmwin[1]=".."; $z=2;
806for($i=0; $i < $laenge; $i++) {
807   $outbmwin[$z] = "$outbound[$i]"; $z++;
808}
809
810$laenge=@outbmwin;
811
812sbalk($outbm, $outbmwin[1], 1, 1, 1, 0, 38);
813
814for($i=2; $i < $laenge; $i++) {
815   sbalk($outbm, $outbmwin[$i], $i, 1, 0, 0, 38);
816}
817
818refresh($outbm);
819
820$z=1;
821for($iii=0; $iii = 1; $ii++) {
822   $ch = getch();
823   if($ch == KEY_DOWN || $ch == KEY_UP || $ch == KEY_LEFT || $ch == KEY_RIGHT) {
824   if($ch == KEY_DOWN) {
825     if($z ne $laenge-1) {
826       $z++;
827     }
828     $n=$z - 1;
829     sbalk($outbm, $outbmwin[$z], $z, 1, 1, $outbmwin[$n], 38);
830   }
831
832   if($ch == KEY_UP) {
833     if($z ne 1) {
834        $z--;
835     }
836     $n=$z + 1;
837     sbalk($outbm, $outbmwin[$z], $z, 1, -1, $outbmwin[$n], 38);
838   }
839
840   if($ch == KEY_LEFT) {
841     $iii=1;
842   }
843
844   if($ch == KEY_RIGHT) {
845     $iii=1;
846   }
847
848   if($ch eq 331) {
849     additem;
850   }
851
852   } else {
853
854   $zn = unpack("C", $ch);
855
856   if($zn eq 27) {
857     last;
858   }
859
860   if($zn eq 10) {
861     $aktion=$outbmwin[$z];
862     $iii=1;
863     last;
864   }
865 }
866refresh($outbm);
867}
868
869
870
871
872}
873
874
875sub logger {
876
877system("logger -p local0.info $_[0]");
878
879}
880
881
882# Zeit holen
883sub zeit_holen {
884
885
886$zeit  = time();
887$zeit  = localtime($zeit);
888@Datum = split(/ +/, $zeit);
889
890$gestern=$Datum[2] - 1;
891
892if(length($Datum[2]) eq 1) {
893  $grr="hmpf";
894  $Datum[2]=" $Datum[2]";
895}
896
897$akdat = "$Datum[1] $Datum[2]";
898$akdatg= "$Datum[1] $gestern";
899
900&translatemonth;
901
902@Uhr = split(/ +/,$zeit);
903@Uhrzeit = split(/:/,$Uhr[3]);
904
905#$akdat = "$Uhr[0], der $Uhr[2] $Uhr[1] $Uhr[4] $Uhrzeit[0]:$Uhrzeit[1]";
906
907$akzeitd = "$Uhrzeit[0]:$Uhrzeit[1]:$Uhrzeit[2]";
908$akzeit = "$Uhrzeit[0]:$Uhrzeit[1]";
909
910}
911
912
913# Spielerei
914sub ringeldich {
915
916$uhu++;
917if($uhu == 0) { addstr(stdscr, 24, 71, "\/"); }
918if($uhu == 1) { addstr(stdscr, 24, 71, "\-"); }
919if($uhu == 2) { addstr(stdscr, 24, 71, "\\"); }
920if($uhu == 3) { $uhu=0; addstr(stdscr, 24, 71, "|"); }
921refresh();
922
923}
924
925
926sub l_up {
927
928if($lineup != -$laenge) { $lineup--;
929  if($s[$lineup] ne "") {
930     move($logwin, 0, 0);
931     insdelln($logwin, 1);
932     addstr($logwin, 0, 0, "$s[$lineup]");
933  } else { beep; }
934}
935if($lineup != -$laenge) { $line--; }
936
937}
938
939
940sub l_down {
941
942if($s[$line] ne "") {
943  move($logwin, 0, 0);
944  deleteln($logwin);
945  move($logwin, $_[0], 0);
946  addstr($logwin, "$s[$line]");
947} else { beep; }
948
949if($line < $laenge) { $line++; $lineup++; }
950
951}
952
953
954sub iflogfile_scrollen {
955
956
957local(@s, @v, @splitt, @splitte, $tmp);
958
959#@s=""; @v=""; @splitt=""; @splitte=""; $tmp="";
960
961open(IFLOG, "$iflog") || die "Konnte $iflog nicht oeffnen!\n";
962
963addstr(stdscr, $LINES - 1, $COLS - 3, "l");
964
965refresh();
966
967while (<IFLOG>) {
968      if($biglogs eq 1) {
969          if(/$akdat|$akdatg/) {
970          if(/errno=5 : I\/O error/) { next; }
971          if(/send_str error/)       { next; }
972          if(/tcsetattr/)            { next; }
973          if(/ got SIGHUP/)          { next; }
974          if(/calls, maxrc/)         { next; }
975          if(/zmodem send rc=0/)     { next; }
976          if(/zmodem receive rc=0/)  { next; }
977          if(/ remote tag: /)        { next; }
978	  if(/ remote timezone: /)   { next; }
979	  if(/ remote     time: /)   { next; }
980          if(/ options: Call /)      { next; }
981          @v=split(/\x0A/, $_);
982          @t=split(/ +/, $v[0]);
983          if (/ zmodem send /) {
984             @splitt=split(/\x0A/, $_);
985     	     @splitte=split(/ +/, $splitt[0]);
986   	     $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11]";
987	     $tmp =~ s/   //g;
988	     push(@s, "$tmp\n");
989             next;
990          }
991          if (/ remote     uses:/) {
992             @splitt=split(/\x0A/, $_);
993             @splitte=split(/ +/, $splitt[0]);
994	     $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11] $splitte[12]";
995	     $tmp =~ s/  //g;
996	     push(@s, "$tmp\n");
997             next;
998          }
999          if (/\@fidonet/)            { $_ =~ s/\@fidonet//; }
1000          if (/ bytes dated /) {
1001             @splitt=split(/ bytes dated /, $_);
1002             @splitte=split(/ +/, $splitt[0]);
1003   	     $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] bytes";
1004	     $tmp =~ s/\x0A//g;
1005             if ($i=length($tmp) > $COLS - 1) {
1006	        while ($i=length($tmp) > $COLS - 1) {
1007	              chop($tmp);
1008	        }
1009	     }
1010	     push(@s, "$tmp\n");
1011          }
1012          else {
1013               @splitt=split(/\x0A/, $_);
1014	       @splitte=split(/ +/, $splitt[0]);
1015  	       $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] $splitte[9] $splitte[10] $splitte[11] $splitte[12] $splitte[13] $splitte[14] $splitte[15] $splitte[16] $splitte[17] $splitte[18] $splitte[19] $splitte[20] $splitte[21] $splitte[22] $splitte[23] $splitte[24] $splitte[25]";
1016               $tmp =~ s/\x0A//g;
1017   	       $tmp =~ s/   //g;
1018	       $tmp =~ s/\(update \(null\), password "\(null\)"\)//g;
1019               if ($i=length($tmp) > $COLS - 1) {
1020                  while ($i=length($tmp) > $COLS - 1) {
1021	                chop($tmp);
1022    	          }
1023               }
1024	       push(@s, "$tmp\n");
1025  	       }
1026        }
1027      } else {
1028        if(/errno=5 : I\/O error/) { next; }
1029        if(/send_str error/)       { next; }
1030        if(/tcsetattr/)            { next; }
1031        if(/ got SIGHUP/)          { next; }
1032        if(/calls, maxrc/)         { next; }
1033        if(/zmodem send rc=0/)     { next; }
1034        if(/zmodem receive rc=0/)  { next; }
1035        if(/ remote tag: /)        { next; }
1036        if(/ remote timezone: /)   { next; }
1037        if(/ remote     time: /)   { next; }
1038        if(/ options: Call /)      { next; }
1039        @v=split(/\x0A/, $_);
1040        @t=split(/ +/, $v[0]);
1041        if (/ zmodem send /) {
1042           @splitt=split(/\x0A/, $_);
1043     	   @splitte=split(/ +/, $splitt[0]);
1044   	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11]";
1045	   $tmp =~ s/   //g;
1046	   push(@s, "$tmp\n");
1047           next;
1048        }
1049        if (/ remote     uses:/) {
1050           @splitt=split(/\x0A/, $_);
1051           @splitte=split(/ +/, $splitt[0]);
1052	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11] $splitte[12]";
1053	   $tmp =~ s/  //g;
1054	   push(@s, "$tmp\n");
1055           next;
1056        }
1057        if (/\@fidonet/)            { $_ =~ s/\@fidonet//; }
1058        if (/ bytes dated /) {
1059           @splitt=split(/ bytes dated /, $_);
1060           @splitte=split(/ +/, $splitt[0]);
1061   	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] bytes";
1062	   $tmp =~ s/\x0A//g;
1063           if ($i=length($tmp) > $COLS - 1) {
1064	      while ($i=length($tmp) > $COLS - 1)  {
1065	            chop($tmp);
1066	      }
1067	   }
1068	   push(@s, "$tmp\n");
1069        }
1070        else {
1071           @splitt=split(/\x0A/, $_);
1072	   @splitte=split(/ +/, $splitt[0]);
1073  	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] $splitte[9] $splitte[10] $splitte[11] $splitte[12] $splitte[13] $splitte[14] $splitte[15] $splitte[16] $splitte[17] $splitte[18] $splitte[19] $splitte[20] $splitte[21] $splitte[22] $splitte[23] $splitte[24] $splitte[25]";
1074           $tmp =~ s/\x0A//g;
1075   	   $tmp =~ s/   //g;
1076	   $tmp =~ s/\(update \(null\), password "\(null\)"\)//g;
1077           if ($i=length($tmp) > $COLS - 1) {
1078              while ($i=length($tmp) > $COLS - 1) {
1079	            chop($tmp);
1080    	      }
1081           }
1082	   push(@s, "$tmp\n");
1083  	   }
1084    }
1085
1086}
1087
1088$laenge=@s;
1089$z=0;
1090
1091$sz=$LINES - 8;
1092for($line=$laenge - $sz; $line < $laenge; $line++) {
1093   addstr($logwin, $z, 0, "$s[$line]"); $z++;
1094}
1095addstr(stdscr, $LINES - 1, $COLS - 3, " ");
1096$lineup=$line - ($LINES - 8);
1097
1098
1099refresh();
1100refresh($logwin);
1101
1102cbreak();
1103eval { keypad(1) };
1104
1105
1106
1107for($ii=0; $ii = 1; $v=1)  {
1108
1109   $ch = getch();
1110
1111   if($ch == KEY_DOWN) {
1112     l_down($LINES - 9);
1113   }
1114   if($ch == KEY_UP) { l_up; }
1115
1116   # ESC
1117   if($ch == KEY_ABORT) { last; }
1118
1119   # PUp
1120   if($ch eq "339") {
1121     for($iu=0; $iu < $LINES - 9; $iu++) {
1122        l_up;
1123     }
1124   }
1125
1126   # PDown
1127   if($ch eq "338") {
1128     for($iu=0; $iu < 16; $iu++) {
1129        l_down($LINES - 9);
1130     }
1131   }
1132   touchwin($logwin);
1133   refresh($logwin);
1134}
1135
1136
1137$z=0;
1138
1139$sz=$LINES - 8;
1140for($line=$laenge - $sz; $line < $laenge; $line++) {
1141   addstr($logwin, $z, 0, "$s[$line]"); $z++;
1142}
1143
1144
1145
1146touchwin($logwin);
1147refresh($logwin);
1148
1149neuaufbau;
1150
1151}
1152
1153
1154sub request {
1155
1156$files=""; $requestnow=0;
1157
1158echo;
1159
1160$reqwin = newwin(14, 40, 6, ($COLS - 40) / 2);
1161attron($reqwin, COLOR_PAIR(1));
1162addstr($reqwin, "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ");
1163box($reqwin, 0, 0);
1164addstr($reqwin, 0, 15, " Request ");
1165addstr($reqwin, 1, 1, "Node: ");
1166hline($reqwin, 38, 2);
1167move(7, ($COLS - 40) / 2 + 7);
1168refresh($reqwin);
1169cbreak();
1170getstr($node);
1171
1172if($node ne "" && $node =~ /\d+:\d+\/\d+/) {
1173  move(8, 21);
1174  refresh($reqwin);
1175
1176  $z=3; $zz=9;
1177  for($nix=1; $iii = 2; $nix++) {
1178     addstr($reqwin, $z, 1, "$nix: ");
1179     move($zz, ($COLS - 40) / 2 + 4);
1180     refresh($reqwin);
1181     getstr($file);
1182     $z++; $zz++;
1183     if($file eq "") { last; }
1184     push(@files, "$file\r");
1185  }
1186
1187  clear($reqwin);
1188
1189  $reqwin = newwin(5, 27, 9, ($COLS - 27) / 2);
1190  attron($reqwin, COLOR_PAIR(4));
1191  box($reqwin, 0, 0);
1192  hline($reqwin, 25, 2);
1193
1194  attron($reqwin, COLOR_PAIR(2));
1195  addstr($reqwin, 1, 1, " Request sofort starten? ");
1196  addstr($reqwin, 3, 1, "                         ");
1197  attron($reqwin, COLOR_PAIR(6));
1198  addstr($reqwin, 3, 3, "< jau >");
1199  attron($reqwin, COLOR_PAIR(2));
1200  addstr($reqwin, 3, 17, "< noe >");
1201  refresh($reqwin);
1202  $requestnow=1;
1203
1204  eval { keypad(1) };
1205  noecho();
1206
1207  for($iii=0; $iii = 1; $zz++) {
1208
1209     $ch=getch();
1210
1211     if($ch == KEY_LEFT) {
1212       attron($reqwin, COLOR_PAIR(6));
1213       addstr($reqwin, 3, 3, "< jau >");
1214       attron($reqwin, COLOR_PAIR(2));
1215       addstr($reqwin, 3, 17, "< noe >");
1216       $requestnow=1;
1217     }
1218
1219     if($ch == KEY_RIGHT) {
1220       attron($reqwin, COLOR_PAIR(2));
1221       addstr($reqwin, 3, 3, "< jau >");
1222       attron($reqwin, COLOR_PAIR(6));
1223       addstr($reqwin, 3, 17, "< noe >");
1224       $requestnow=0;
1225     }
1226
1227     if($ch == KEY_RETURN) { last; }
1228
1229     refresh($reqwin);
1230
1231  }
1232  for(@files) {
1233     &reqfile($node, $_);
1234  }
1235
1236}
1237
1238if($requestnow == 1) {
1239  &convftn($node, $ftnnode);
1240  system("echo > $tmpvz/gff.bsy && $ifcicocmd -I$ifconfig -r 1 $ftnnode && rm -f $tmpvz/gff.bsy &");
1241}
1242
1243#&neuaufbau;
1244&touchall("r");
1245noecho();
1246
1247}
1248
1249
1250sub touchall {
1251
1252if($_[0] eq "r") {
1253  touchwin(stdscr);
1254}
1255
1256refresh(stdscr);
1257
1258touchwin($logwin);
1259refresh($logwin);
1260
1261touchwin($lcallwin);
1262refresh($lcallwin);
1263
1264if($systemart eq 0) {
1265  touchwin($licallwin);
1266  refresh($licallwin);
1267}
1268
1269}
1270
1271
1272# Bild-Neuaufbau
1273sub neuaufbau {
1274
1275attron(COLOR_PAIR(4));
1276move(6, 0);
1277if($systemart eq 0) {
1278  $lcallwin = newwin(5, $COLS / 2 - 2, 1, 0);
1279  $licallwin = newwin(5, $COLS / 2 - 1, 1, $COLS / 2 - 1);
1280  for($i=0; $i < $COLS / 2 - 2; $i++) { addch(ACS_HLINE); }
1281  addch(ACS_BTEE);
1282  for($i=$COLS / 2 - 1; $i < $COLS - 1; $i++) { addch(ACS_HLINE); }
1283  for($i=1; $i < 6; $i++) { addch($i, $COLS / 2 - 2, ACS_VLINE); }
1284} elsif($systemart eq 1) {
1285  for($i=0; $i < $COLS - 1; $i++) { addch(ACS_HLINE); }
1286  $lcallwin = newwin(5, $COLS -1, 1, 0);
1287}
1288
1289&touchall;
1290
1291}
1292
1293
1294# hilfe!
1295sub hilfe {
1296
1297local(@helptext, $z);
1298
1299$helptext[0]="c  Call Node";
1300$helptext[1]="h  Hilfefenster";
1301$helptext[2]="l  iflog-file blaettern";
1302$helptext[3]="m  Mailreader starten";
1303$helptext[4]="n  Desktop neu zeichnen";
1304$helptext[5]="p  Poll Uplink";
1305$helptext[6]="r  Request files";
1306$helptext[7]="s  Outbound anzeigen";
1307$helptext[8]="x  Quit";
1308$helptext[9]="F10  Menu";
1309
1310
1311$helpwin = newwin(21, 60, $LINES - ($LINES - 2), ($COLS - 60) / 2);
1312
1313attron($helpwin, COLOR_PAIR(2));
1314addstr($helpwin, "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ");
1315attron($helpwin, COLOR_PAIR(4));
1316box($helpwin, 0, 0);
1317hline($helpwin, 58, 2);
1318attron($helpwin, COLOR_PAIR(5));
1319addstr($helpwin, 0, 26, " Hilfe ");
1320attron($helpwin, COLOR_PAIR(3));
1321
1322local($z)=4;
1323
1324for(@helptext) {
1325   addstr($helpwin, $z, 2, "$_"); $z++;
1326}
1327refresh($helpwin);
1328&mcnru;
1329refresh();
1330
1331nocbreak();
1332getch;
1333cbreak();
1334
1335clear($helpwin);
1336refresh($helpwin);
1337
1338&touchall("r");
1339
1340}
1341
1342
1343# exit
1344sub ausgang {
1345
1346clear();
1347refresh();
1348endwin();
1349exit(0);
1350
1351}
1352
1353
1354# startup
1355sub hello {
1356
1357print "gff $version Graphisches Fido Frontend fuer Linux\n";
1358print "Written by Thomas Koch\n";
1359sleep (1);
1360
1361}
1362
1363
1364# call node
1365sub call_node {
1366
1367echo;
1368nocbreak;
1369$callwin = newwin(3, 20, 10, 28);
1370box($callwin, 0, 0);
1371addstr($callwin, 0, 5, " Addresse? ");
1372addstr($callwin, 1, 1, "                  ");
1373move($callwin, 1, 2);
1374move(11, 30);
1375refresh($callwin);
1376getstr($eingabe);
1377touchwin($logwin); refresh($logwin);
1378
1379if($eingabe =~ /\d+:\d+\/\d+/) {
1380  &convftn($eingabe, $ausgabe);
1381  system("echo > $tmpvz/gff.bsy && $ifcicocmd -I$ifconfig -r 1 $ausgabe && rm -f $tmpvz/gff.bys &");
1382}
1383
1384
1385noecho;
1386
1387}
1388
1389
1390# logfiles (puh)
1391sub iflogfile_aufbereiten {
1392
1393local(@iflines, @splitt, @splitte, $tmp);
1394
1395$filenew=(-s "$iflog");
1396
1397if($filenew ne $fileold || $_[0] eq "r") {
1398
1399  open (IFLOG, "tail --lines=80 $iflog |") || die "Konnte tail nicht korrekt ausfuehren";
1400
1401  while (<IFLOG>) {
1402        if (/errno=5 : I\/O error/) { next; }
1403        if (/send_str error/)       { next; }
1404        if (/tcsetattr/)            { next; }
1405        if (/ got SIGHUP/)          { next; }
1406        if (/calls, maxrc/)         { next; }
1407        if (/zmodem send rc=0/)     { next; }
1408        if (/zmodem receive rc=0/)  { next; }
1409        if(/ remote tag: /)         { next; }
1410        if(/ remote timezone: /)    { next; }
1411        if(/ remote     time: /)    { next; }
1412        if (/ options: Call /)      { next; }
1413        if (/ zmodem send /) {
1414           @splitt=split(/\x0A/, $_);
1415  	   @splitte=split(/ +/, $splitt[0]);
1416	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11]";
1417	   $tmp =~ s/   //g;
1418	   push(@iflines, "$tmp\n");
1419           next;
1420        }
1421        if (/ remote     uses:/) {
1422           @splitt=split(/\x0A/, $_);
1423           @splitte=split(/ +/, $splitt[0]);
1424	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[9] $splitte[10] $splitte[11] $splitte[12]";
1425	   $tmp =~ s/  //g;
1426	   push(@iflines, "$tmp\n");
1427           next;
1428        }
1429        if (/\@fidonet/)            { $_ =~ s/\@fidonet//; }
1430        if (/ bytes dated /) {
1431           @splitt=split(/ bytes dated /, $_);
1432           @splitte=split(/ +/, $splitt[0]);
1433	   $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] bytes";
1434	   $tmp =~ s/\x0A//g;
1435           if ($i=length($tmp) > $COLS - 1) {
1436	      while ($i=length($tmp) > $COLS - 1) {
1437	            chop($tmp);
1438	      }
1439	   }
1440	   push(@iflines, "$tmp\n"); }
1441        else {
1442             @splitt=split(/\x0A/, $_);
1443	     @splitte=split(/ +/, $splitt[0]);
1444 	     $tmp="$splitte[0] $splitte[1] $splitte[2] $splitte[5] $splitte[6] $splitte[7] $splitte[8] $splitte[9] $splitte[10] $splitte[11] $splitte[12] $splitte[13] $splitte[14] $splitte[15] $splitte[16] $splitte[17] $splitte[18] $splitte[19] $splitte[20] $splitte[21] $splitte[22] $splitte[23] $splitte[24] $splitte[25]";
1445             $tmp =~ s/\x0A//g;
1446	     $tmp =~ s/   //g;
1447	     $tmp =~ s/\(update \(null\), password "\(null\)"\)//g;
1448             if ($i=length($tmp) > $COLS - 1) {
1449                while ($i=length($tmp) > $COLS - 1) {
1450	              chop($tmp);
1451    	        }
1452             }
1453	     push(@iflines, "$tmp\n");
1454  	     }
1455
1456        }
1457
1458  $laenge = @iflines;
1459  $z=$laenge - 2;
1460
1461  $oo=0;
1462
1463
1464  for ($i=$laenge - ($LINES - 8); $i < $laenge; $i++) {
1465      addstr($logwin, $oo, 0, "$iflines[$i]");
1466      $oo++;
1467  }
1468
1469  touchwin($logwin);
1470  refresh($logwin);
1471  close(IFLOG);
1472
1473}
1474
1475
1476$fileold=(-s "$iflog");
1477
1478
1479}
1480
1481
1482# Die schwachsinnige Internetschreibweise von fido Addressen (die ifcico
1483# benutzt) aendern
1484sub convftn {
1485
1486@tmp=split(/:/, $_[0]);
1487@tmp1=split(/\//, $tmp[1]);
1488
1489$_[1]="f$tmp1[1].n$tmp1[0].z$tmp[0].fidonet.org";
1490
1491if($_[1] !~ /z2./) {
1492  $_[1] =~ s/.fidonet.org//;
1493}
1494
1495}
1496
1497
1498# show outbound
1499sub show_outbound {
1500
1501local(@outbound, $laenge);
1502
1503open (IFSTAT, "$ifstat -I$ifconfig |") || die "Kann $ifstat nicht ausfuehren!";
1504while (<IFSTAT>) {
1505      push(@outbound, $_);
1506}
1507$laenge = @outbound;
1508
1509$outbwin = newwin(21, 60, 2, ($COLS - 60) / 2);
1510move($outbwin, 1, 1);
1511attron($outbwin, COLOR_PAIR(3));
1512addstr($outbwin, "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ");
1513for ($i=1; $i < $laenge; $i++) {
1514    move($outbwin, $i, 1);
1515    addstr($outbwin, $outbound[$i]);
1516}
1517
1518attron($outbwin, COLOR_PAIR(4));
1519box($outbwin, 0, 0);
1520attron($outbwin, COLOR_PAIR(5));
1521addstr($outbwin, 0, 25, " Outbound ");
1522attron($outbwin, COLOR_PAIR(4));
1523&mcnru;
1524refresh($outbwin);
1525
1526getch();
1527
1528clear($outbwin);
1529refresh($outbwin);
1530
1531&touchall("r");
1532
1533}
1534
1535
1536# Uplinks Anrufen
1537sub poll_uplink {
1538
1539local($laenge,@win,$i,$ii,$iii,$x);
1540
1541$laenge = @ftnuplinks;
1542if($laenge > 1) {
1543
1544  $nach_rechts=0; $nach_links=0; $aktion="";
1545
1546  $x=$laenge + 2; $b=38;
1547  $win=newwin($x, 40, 8, ($COLS - 41) / 2);
1548
1549  attron($win, COLOR_PAIR(7));
1550  addstr($win, "                                                                                                                                                                                          ");
1551
1552  $ii=1;
1553  for($i=0; $i < @ftnuplinks; $i++) {
1554     $win[$ii] = $ftnuplinks[$i]; $ii++;
1555  }
1556
1557  sbalk($win, $win[1], 1, 1, 1, 0, $b);
1558
1559  $ii=2;
1560  for($i=0; $i < @ftnuplinks; $i++) {
1561  sbalk($win, $win[$ii], $ii, 1, 0, 0, $b); $ii++;
1562  }
1563
1564  attron($win, COLOR_PAIR(8));
1565
1566  box($win, 0, 0);
1567  refresh($win);
1568
1569  $z=1;
1570  for($i=0; $i = 1; $ii++) {
1571
1572     $ch = getch();
1573     if($ch == KEY_DOWN || $ch == KEY_UP || $ch == KEY_LEFT || $ch == KEY_RIGHT) {
1574       if($ch == KEY_DOWN) {
1575         if($z ne $laenge) {
1576           $z++;
1577         }
1578         $n=$z - 1;
1579         sbalk($win, $win[$z], $z, 1, 1, $win[$n], $b);
1580       }
1581
1582       if($ch == KEY_UP) {
1583         if($z ne 1) {
1584            $z--;
1585         }
1586         $n=$z + 1;
1587         sbalk($win, $win[$z], $z, 1, -1, $win[$n], $b);
1588       }
1589
1590     } else {
1591
1592       $zn = unpack("C", $ch);
1593
1594       if($zn eq 27) {
1595         $raushier=1;
1596         last;
1597       }
1598
1599       if($zn eq 10) {
1600         $aktion=$win[$z];
1601         $raushier=1;
1602         last;
1603       }
1604     }
1605  if($ch eq -1) {
1606    &akzeit;
1607  } else {
1608    refresh($win);
1609  }
1610
1611  }
1612} else {
1613  $aktion=$ftnuplinks[0];
1614}
1615
1616touchwin($logwin);
1617refresh($logwin);
1618
1619if($aktion ne "") {
1620  local($aktion,$muell)=split(/ +/, $aktion);
1621  &convftn($aktion, $uplink);
1622  system("echo > $tmpvz/gff.bsy && $ifcicocmd -I$ifconfig -r 1 $uplink && rm -f $tmpvz/gff.bsy &");
1623}
1624
1625}
1626
1627
1628# letzte (ausgehende) Anrufe einblenden
1629sub letzte_anrufe {
1630
1631&zeit_holen;
1632
1633local(@s, @iflogentrys, @sf, @r);
1634
1635open (IFLOGFILE, "$iflog") || die "Kann $iflog nicht oeffnen!";
1636while (<IFLOGFILE>) {
1637      if (/$akdat/) {
1638          if (/ calling /) {
1639             @s=split(/ +/, $_);
1640	     $s[6] =~ s/\@fidonet//;
1641	     $s[6] =~ s/\@linuxnet//;
1642	     @sf=split(/,/, "$s[7] $s[8] $s[9] $s[10] $s[11] $s[12] $s[13]");
1643	     $sf[0] =~ s/\(//;
1644	     @r=split(/:/, $s[2]);
1645	     $tmp="$r[0]:$r[1] $s[6] ($sf[0])\n";
1646             push(@iflogentrys, $tmp);
1647          }
1648      }
1649}
1650
1651move($lcallwin, 1, 1);
1652$laenge = @iflogentrys; $z=0;
1653attron($lcallwin, COLOR_PAIR(2));
1654
1655if($laenge > 11) {
1656  for($i=$laenge - 11; $i < $laenge; $i++) {
1657  addstr($lcallwin, $z, 0, "$iflogentrys[$i]");
1658  $z++;
1659  }
1660} else {
1661  for($i=0; $i < 11; $i++) {
1662  addstr($lcallwin, $z, 0, "$iflogentrys[$i]");
1663  $z++;
1664  }
1665}
1666
1667
1668attron($lcallwin, COLOR_PAIR(4));
1669touchwin($lcallwin);
1670refresh($lcallwin);
1671
1672}
1673
1674
1675# letzte Anrufe (eingehend) einblenden
1676sub letzte_i_anrufe {
1677
1678local(@s, @pids, @t, @u, @v, @r, @iclogins, $found);
1679
1680zeit_holen;
1681
1682open(IFLOGFILE, "$iflog") || die "Konnte $iflog nicht oeffnen!\n";
1683while(<IFLOGFILE>) {
1684     if(/$akdat/) {
1685       push(@s, $_);
1686     }
1687}
1688
1689
1690for(@s) {
1691   if($found eq 1) {
1692     @t=split(/\[/, $_);
1693     @u=split(/\]/, $t[1]);
1694     push(@pids, $u[0]);
1695     $found=0;
1696   }
1697   if(/Eingehender Anruf.../) {
1698     $found=1;
1699   }
1700}
1701
1702
1703$x=0; $icname="";
1704
1705for $pid (@pids) {
1706    for $i (@s) {
1707        if($i =~ /\[$pid\]/) {
1708             if($i =~ /remote  address: 2:24/) {
1709	       if($grr eq "hmpf") {
1710                 @t=split(/ /, $i);
1711	         $t[9] =~ s/\@fidonet|\@Fidonet//;
1712	         @u=split(/\x0A/, $t[9]);
1713	         @v=split(/:/, $t[3]);
1714	         $address="$v[0]:$v[1]";
1715	       } else {
1716   	         @t=split(/ +/, $i);
1717 		 if($grr eq "hmpf") {
1718 		   $t[8] =~ s/\@fidonet|\@Fidonet//;
1719	           @u=split(/\x0A/, $t[8]);
1720		 } else {
1721 		   $t[7] =~ s/\@fidonet|\@Fidonet//;
1722	           @u=split(/\x0A/, $t[7]);
1723		 }
1724   	         @v=split(/:/, $t[2]);
1725	         $address="$v[0]:$v[1]";
1726	       }
1727	     }
1728             if($i =~ /remote operator/) {
1729	       @r=split(/ +/, $i);
1730	       @t=""; @t=split(/\x0A/, $r[8]);
1731	       $icname="$address $r[7] $t[0] ($u[0])";
1732	     }
1733        }
1734    }
1735$iclogins[$x]=$icname; $x++;
1736}
1737
1738
1739#$muell=shift(@iclogins);
1740
1741$y=0; $laenge=@iclogins; $x=0; $w=0;
1742
1743
1744if($laenge > 11) {
1745  for($x=$laenge - 11; $x < $laenge; $x++) {
1746     addstr($licallwin, $w, 0, "$iclogins[$x]    ");
1747     $w++;
1748  }
1749} else {
1750  for($x=0; $x < 11; $x++) {
1751     addstr($licallwin, $w, 0, "$iclogins[$x]    ");
1752     $w++;
1753  }
1754}
1755
1756touchwin($licallwin);
1757refresh($licallwin);
1758
1759close(IFLOGFILE);
1760
1761}
1762
1763
1764# Mailreader Starten
1765sub mailreader_go {
1766
1767endwin();
1768
1769system("$mailreader");
1770
1771neuaufbau;
1772
1773}
1774
1775
1776# Monate  Englisch -=> Deutsch
1777sub translatemonth {
1778
1779$zeit =~ s/Mon/Montag/;
1780$zeit =~ s/Tue/Dienstag/;
1781$zeit =~ s/Wed/Mittwoch/;
1782$zeit =~ s/Thu/Donnerstag/;
1783$zeit =~ s/Fri/Freitag/;
1784$zeit =~ s/Sat/Samstag/;
1785$zeit =~ s/Sun/Sonntag/;
1786$zeit =~ s/Jan/Januar/;
1787$zeit =~ s/Feb/Februar/;
1788$zeit =~ s/Mar/Maerz/;
1789$zeit =~ s/Apr/April/;
1790$zeit =~ s/May/Mai/;
1791$zeit =~ s/Jun/Juni/;
1792$zeit =~ s/Jul/Juli/;
1793$zeit =~ s/Aug/August/;
1794$zeit =~ s/Sep/September/;
1795$zeit =~ s/Oct/Oktober/;
1796$zeit =~ s/Nov/November/;
1797$zeit =~ s/Dec/Dezember/;
1798
1799}
1800
1801
1802# Uhrzeit aktualisieren
1803sub akzeit {
1804
1805&zeit_holen;
1806
1807attron(COLOR_PAIR(1));
1808
1809if ($debugmode eq "jup") {
1810   addstr(stdscr, 0, $COLS - 9, "$akzeitd"); }
1811   else { addstr(stdscr, 0, $COLS - 6, "$akzeit"); }
1812
1813&mcnru;
1814
1815}
1816
1817
1818# Hilfe
1819sub help {
1820
1821print "Folgende Parameter sind moeglich:\n";
1822print "-c    Pfad der Konfigurationsdatei\n";
1823print "-bw   Schwarz-Weis modus\n";
1824print "-h    Hilfe\n\n";
1825
1826}
1827
1828
1829#Signal Handling
1830sub sighdnl {
1831
1832local($sig) = @_;
1833$sigtermed = $sig;
1834
1835}
1836
1837
1838# -=> Hauptprogramm <=- #######################################################
1839
1840local($i,$z);
1841
1842for($i=0; $i < @ARGV; $i++) {
1843   if($ARGV[$i] =~ /--help|-h/) {
1844     &help;
1845     exit(0);
1846   }
1847   if($ARGV[$i] =~ /-c/) {
1848     $z=$i + 1;
1849     $config=$ARGV[$z];
1850   }
1851   if($ARGV[$i] =~ /-bw|--bw/) {
1852     $bw=1;
1853   } else {
1854     $bw=0;
1855   }
1856}
1857
1858
1859if($config eq "") {
1860  $config = $ENV{'GFFCFG'};
1861}
1862
1863if($config eq "") {
1864  print "\nKann die Konfigurationsdatei nicht finden.\n";
1865  &help;
1866  print "Exit.\n";
1867  exit(100);
1868}
1869
1870
1871#&hello;
1872
1873$SIG{INT} = \&sighdnl;
1874$SIG{TERM} = \&sighdnl;
1875$SIG{WINCH} = \&sighdnl;
1876
1877config_auslesen;
1878
1879
1880#system("setterm -cursor off");
1881
1882machma;
1883
1884
1885if($systemart eq 0) {
1886  letzte_anrufe;
1887  letzte_i_anrufe;
1888} elsif($systemart eq 1) {
1889  letzte_anrufe("p");
1890}
1891
1892sysop_mail;
1893
1894halfdelay(1);
1895noecho();
1896eval { keypad(1) };
1897
1898$ende=0; $zmi=0;
1899
1900
1901while($ende ne 1) {
1902
1903     $eingabe=getch();
1904
1905     if($eingabe ne -1) {
1906       if($eingabe eq 265 || $eingabe eq "h") { &hilfe; halfdelay(1); }
1907       if($eingabe eq "r") { nocbreak(); &request; cbreak(); halfdelay(1); }
1908       if($eingabe eq "q" || $eingabe eq "x") { &ausgang }
1909       if($eingabe eq "c") { nocbreak(); &call_node; cbreak(); halfdelay(1); }
1910       if($eingabe eq "p") { &poll_uplink }
1911       if($eingabe eq "s") { nocbreak(); &show_outbound; cbreak(); halfdelay(1); }
1912       if($eingabe eq "n") { &neuaufbau }
1913       if($eingabe eq "m") { &mailreader_go }
1914       if($eingabe eq "l") { nocbreak(); &iflogfile_scrollen; cbreak(); halfdelay(1); }
1915       if($eingabe eq "274") { &menu; cbreak(); halfdelay(1); }
1916       }
1917
1918     $zmi++; $cpuz++; $cpul++;
1919
1920     if($zmi eq $dley) {
1921       &akzeit;
1922       $zmi=0;
1923       iflogfile_aufbereiten;
1924     }
1925
1926     if($cpul eq $lcalls) {
1927       if($useautotoss eq 1) {
1928         autotoss;
1929       }
1930       &sysop_mail;
1931       if($systemart eq 0) {
1932         letzte_anrufe;
1933         letzte_i_anrufe;
1934       } elsif($systemart eq 1) {
1935         letzte_anrufe("p");
1936       }
1937       $cpul=0;
1938       if($akzeit eq "00:00") {
1939         if($systemart eq 0) {
1940           clear($licallwin);
1941           refresh($licallwin);
1942           clear($lcallwin);
1943           refresh($lcallwin);
1944         } elsif($systemart eq 1) {
1945           clear($letzte_anrufe);
1946           refresh($letzte_anrufe);
1947         }
1948       }
1949    }
1950    if($sigtermed) {
1951      last;
1952    }
1953}
1954
1955endwin();
1956
1957print "\naborting. SIG$sigtermed!\n" if $sigtermed;
1958
1959
1960#system("setterm -cursor on");
1961
1962#
1963
1964
1965__END__
1966
1967ToDo:
1968
1969-outbound manager
1970