From: minima Date: Sat, 28 Apr 2001 20:29:06 +0000 (+0000) Subject: add another java client X-Git-Tag: R_1_47~5 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=f319bf06d72d135e7ec14ff8b27627187f5e2595 add another java client fix a problem with 'sorry connected to another ...' --- diff --git a/Changes b/Changes index b33f106c..a32d1bed 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +28Apr01======================================================================= +1. fix an occasional problem with 'sorry connected to' messages 23Apr01======================================================================= 1. fix very long standing bug in storing and transmitting spots. The decimal point was left off :-( diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 6e588b3e..e3360fdb 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -27,7 +27,7 @@ sub dequeue { my $conn = shift; - if ($conn->{msg} =~ /\n/) { + if ($conn && $conn->{msg} =~ /\n/) { my @lines = split /\r?\n/, $conn->{msg}; if ($conn->{msg} =~ /\n$/) { delete $conn->{msg}; @@ -41,7 +41,7 @@ sub dequeue } else { $_ = ''; } - &{$conn->{rproc}}($conn, $_); + &{$conn->{rproc}}($conn, $_) if exists $conn->{rproc}; } } } diff --git a/perl/yesterday b/perl/yesterday new file mode 100755 index 00000000..050f1948 --- /dev/null +++ b/perl/yesterday @@ -0,0 +1,41 @@ +#!/usr/bin/perl +# +# find files that were last modified 'yesterday' +# + +use strict; +my $debug = shift if $ARGV[0] eq '-x'; +my $dir = shift or die "yesterday: [-x] []"; +my $days = shift or 1; +opendir D, $dir or die "cannot open directory '$dir' $!"; +my @fn = map {[(stat("$dir/$_"))[9], "$dir/$_"]} readdir D; +closedir D; + +++$days; +my $t = time; +my $low = (int($t / 86400) - $days) * 86400; +my $high = (int($t / 86400) - ($days - 1)) * 86400; +my $clow = gmtime $low; +my $chigh = gmtime $high; +print "lowest: $clow highest: $chigh\n" if $debug; +for (sort {$a->[0] <=> $b->[0]} @fn) { + if (-f $_->[1]) { + if ($debug) { + my $cmtime = gmtime $_->[0]; + if ($_->[0] < $low) { + printf "%-30s LOW $cmtime < $clow\n", $_->[1]; + } elsif ($_->[0] >= $high) { + printf "%-30s HIGH $cmtime >= $chigh\n", $_->[1]; + } else { + printf "%-30s OK $cmtime\n", $_->[1]; + } + } elsif ($_->[0] >= $low && $_->[0] < $high) { + print "$_->[1]\n"; + } elsif ($_->[0] >= $high) { + last; + } + } +} + + +exit 0; diff --git a/spider-web/Format.class b/spider-web/Format.class new file mode 100644 index 00000000..4f8de429 Binary files /dev/null and b/spider-web/Format.class differ diff --git a/spider-web/Format.java b/spider-web/Format.java new file mode 100755 index 00000000..f751817f --- /dev/null +++ b/spider-web/Format.java @@ -0,0 +1,550 @@ +/* + * Gary Cornell and Cay S. Horstmann, Core Java (Book/CD-ROM) + * Published By SunSoft Press/Prentice-Hall + * Copyright (C) 1996 Sun Microsystems Inc. + * All Rights Reserved. ISBN 0-13-565755-5 + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for NON-COMMERCIAL purposes + * and without fee is hereby granted provided that this + * copyright notice appears in all copies. + * + * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR + * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS + * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED + * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + */ + +/** + * A class for formatting numbers that follows printf conventions. + * Also implements C-like atoi and atof functions + * @version 1.01 15 Feb 1996 + * @author Cay Horstmann + */ + + + +import java.io.*; + +public class Format + +{ /** + * Formats the number following printf conventions. + * Main limitation: Can only handle one format parameter at a time + * Use multiple Format objects to format more than one number + * @param s the format string following printf conventions + * The string has a prefix, a format code and a suffix. The prefix and suffix + * become part of the formatted output. The format code directs the + * formatting of the (single) parameter to be formatted. The code has the + * following structure + *
    + *
  • a % (required) + *
  • a modifier (optional) + *
    + *
    +
    forces display of + for positive numbers + *
    0
    show leading zeroes + *
    -
    align left in the field + *
    space
    prepend a space in front of positive numbers + *
    #
    use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format. + *
    + *
  • an integer denoting field width (optional) + *
  • a period followed by an integer denoting precision (optional) + *
  • a format descriptor (required) + *
    + *
    f
    floating point number in fixed format + *
    e, E
    floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e. + *
    g, G
    floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e. + *
    d, i
    integer in decimal + *
    x
    integer in hexadecimal + *
    o
    integer in octal + *
    s
    string + *
    c
    character + *
    + *
+ * @exception IllegalArgumentException if bad format + */ + + public Format(String s) + { width = 0; + precision = -1; + pre = ""; + post = ""; + leading_zeroes = false; + show_plus = false; + alternate = false; + show_space = false; + left_align = false; + fmt = ' '; + + int state = 0; + int length = s.length(); + int parse_state = 0; + // 0 = prefix, 1 = flags, 2 = width, 3 = precision, + // 4 = format, 5 = end + int i = 0; + + while (parse_state == 0) + { if (i >= length) parse_state = 5; + else if (s.charAt(i) == '%') + { if (i < length - 1) + { if (s.charAt(i + 1) == '%') + { pre = pre + '%'; + i++; + } + else + parse_state = 1; + } + else throw new java.lang.IllegalArgumentException(); + } + else + pre = pre + s.charAt(i); + i++; + } + while (parse_state == 1) + { if (i >= length) parse_state = 5; + else if (s.charAt(i) == ' ') show_space = true; + else if (s.charAt(i) == '-') left_align = true; + else if (s.charAt(i) == '+') show_plus = true; + else if (s.charAt(i) == '0') leading_zeroes = true; + else if (s.charAt(i) == '#') alternate = true; + + + else { parse_state = 2; i--; } + i++; + } + while (parse_state == 2) + { if (i >= length) parse_state = 5; + else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') + { width = width * 10 + s.charAt(i) - '0'; + i++; + } + else if (s.charAt(i) == '.') + { parse_state = 3; + precision = 0; + i++; + } + else + parse_state = 4; + } + while (parse_state == 3) + { if (i >= length) parse_state = 5; + else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') + { precision = precision * 10 + s.charAt(i) - '0'; + i++; + } + else + parse_state = 4; + } + if (parse_state == 4) + { if (i >= length) parse_state = 5; + else fmt = s.charAt(i); + i++; + } + if (i < length) + post = s.substring(i, length); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the double to print + */ + + public static void print(java.io.PrintStream s, String fmt, double x) + { s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the long to print + */ + public static void print(java.io.PrintStream s, String fmt, long x) + { s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream + * @param fmt the format string + * @param x the character to + */ + + public static void print(java.io.PrintStream s, String fmt, char x) + { s.print(new Format(fmt).form(x)); + } + + /** + * prints a formatted number following printf conventions + * @param s a PrintStream, fmt the format string + * @param x a string that represents the digits to print + */ + + public static void print(java.io.PrintStream s, String fmt, String x) + { s.print(new Format(fmt).form(x)); + } + + /** + * Converts a string of digits (decimal, octal or hex) to an integer + * @param s a string + * @return the numeric value of the prefix of s representing a base 10 integer + */ + + public static int atoi(String s) + { return (int)atol(s); + } + + /** + * Converts a string of digits (decimal, octal or hex) to a long integer + * @param s a string + * @return the numeric value of the prefix of s representing a base 10 integer + */ + + public static long atol(String s) + { int i = 0; + + while (i < s.length() && Character.isSpace(s.charAt(i))) i++; + if (i < s.length() && s.charAt(i) == '0') + { if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) + return parseLong(s.substring(i + 2), 16); + else return parseLong(s, 8); + } + else return parseLong(s, 10); + } + + private static long parseLong(String s, int base) + { int i = 0; + int sign = 1; + long r = 0; + + while (i < s.length() && Character.isSpace(s.charAt(i))) i++; + if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } + else if (i < s.length() && s.charAt(i) == '+') { i++; } + while (i < s.length()) + { char ch = s.charAt(i); + if ('0' <= ch && ch < '0' + base) + r = r * base + ch - '0'; + else if ('A' <= ch && ch < 'A' + base - 10) + r = r * base + ch - 'A' + 10 ; + else if ('a' <= ch && ch < 'a' + base - 10) + r = r * base + ch - 'a' + 10 ; + else + return r * sign; + i++; + } + return r * sign; + } + + /** + * Converts a string of digits to an double + * @param s a string + */ + + public static double atof(String s) + { int i = 0; + int sign = 1; + double r = 0; // integer part + double f = 0; // fractional part + double p = 1; // exponent of fractional part + int state = 0; // 0 = int part, 1 = frac part + + while (i < s.length() && Character.isSpace(s.charAt(i))) i++; + if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } + else if (i < s.length() && s.charAt(i) == '+') { i++; } + while (i < s.length()) + { char ch = s.charAt(i); + if ('0' <= ch && ch <= '9') + { if (state == 0) + r = r * 10 + ch - '0'; + else if (state == 1) + { p = p / 10; + r = r + p * (ch - '0'); + } + } + else if (ch == '.') + { if (state == 0) state = 1; + else return sign * r; + } + else if (ch == 'e' || ch == 'E') + { long e = (int)parseLong(s.substring(i + 1), 10); + return sign * r * Math.pow(10, e); + } + else return sign * r; + i++; + } + return sign * r; + } + + /** + * Formats a double into a string (like sprintf in C) + * @param x the number to format + * @return the formatted string + * @exception IllegalArgumentException if bad argument + */ + + public String form(double x) + { String r; + if (precision < 0) precision = 6; + int s = 1; + if (x < 0) { x = -x; s = -1; } + if (fmt == 'f') + r = fixed_format(x); + else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') + r = exp_format(x); + else throw new java.lang.IllegalArgumentException(); + + return pad(sign(s, r)); + } + + /** + * Formats a long integer into a string (like sprintf in C) + * @param x the number to format + * @return the formatted string + */ + + public String form(long x) + { String r; + int s = 0; + if (fmt == 'd' || fmt == 'i') + { s = 1; + if (x < 0) { x = -x; s = -1; } + r = "" + x; + } + else if (fmt == 'o') + r = convert(x, 3, 7, "01234567"); + else if (fmt == 'x') + r = convert(x, 4, 15, "0123456789abcdef"); + else if (fmt == 'X') + r = convert(x, 4, 15, "0123456789ABCDEF"); + else throw new java.lang.IllegalArgumentException(); + + return pad(sign(s, r)); + } + + /** + * Formats a character into a string (like sprintf in C) + * @param x the value to format + * @return the formatted string + */ + + public String form(char c) + { if (fmt != 'c') + throw new java.lang.IllegalArgumentException(); + + String r = "" + c; + return pad(r); + } + + /** + * Formats a string into a larger string (like sprintf in C) + * @param x the value to format + * @return the formatted string + */ + + public String form(String s) + { if (fmt != 's') + throw new java.lang.IllegalArgumentException(); + if (precision >= 0) s = s.substring(0, precision); + return pad(s); + } + + + /** + * a test stub for the format class + */ + + public static void main(String[] a) + { double x = 1.23456789012; + double y = 123; + double z = 1.2345e30; + double w = 1.02; + double u = 1.234e-5; + int d = 0xCAFE; + Format.print(System.out, "x = |%f|\n", x); + Format.print(System.out, "u = |%20f|\n", u); + Format.print(System.out, "x = |% .5f|\n", x); + Format.print(System.out, "w = |%20.5f|\n", w); + Format.print(System.out, "x = |%020.5f|\n", x); + Format.print(System.out, "x = |%+20.5f|\n", x); + Format.print(System.out, "x = |%+020.5f|\n", x); + Format.print(System.out, "x = |% 020.5f|\n", x); + Format.print(System.out, "y = |%#+20.5f|\n", y); + Format.print(System.out, "y = |%-+20.5f|\n", y); + Format.print(System.out, "z = |%20.5f|\n", z); + + Format.print(System.out, "x = |%e|\n", x); + Format.print(System.out, "u = |%20e|\n", u); + Format.print(System.out, "x = |% .5e|\n", x); + Format.print(System.out, "w = |%20.5e|\n", w); + Format.print(System.out, "x = |%020.5e|\n", x); + Format.print(System.out, "x = |%+20.5e|\n", x); + Format.print(System.out, "x = |%+020.5e|\n", x); + Format.print(System.out, "x = |% 020.5e|\n", x); + Format.print(System.out, "y = |%#+20.5e|\n", y); + Format.print(System.out, "y = |%-+20.5e|\n", y); + + Format.print(System.out, "x = |%g|\n", x); + Format.print(System.out, "z = |%g|\n", z); + Format.print(System.out, "w = |%g|\n", w); + Format.print(System.out, "u = |%g|\n", u); + Format.print(System.out, "y = |%.2g|\n", y); + Format.print(System.out, "y = |%#.2g|\n", y); + + Format.print(System.out, "d = |%d|\n", d); + Format.print(System.out, "d = |%20d|\n", d); + Format.print(System.out, "d = |%020d|\n", d); + Format.print(System.out, "d = |%+20d|\n", d); + Format.print(System.out, "d = |% 020d|\n", d); + Format.print(System.out, "d = |%-20d|\n", d); + Format.print(System.out, "d = |%20.8d|\n", d); + Format.print(System.out, "d = |%x|\n", d); + Format.print(System.out, "d = |%20X|\n", d); + Format.print(System.out, "d = |%#20x|\n", d); + Format.print(System.out, "d = |%020X|\n", d); + Format.print(System.out, "d = |%20.8x|\n", d); + Format.print(System.out, "d = |%o|\n", d); + Format.print(System.out, "d = |%020o|\n", d); + Format.print(System.out, "d = |%#20o|\n", d); + Format.print(System.out, "d = |%#020o|\n", d); + Format.print(System.out, "d = |%20.12o|\n", d); + + Format.print(System.out, "s = |%-20s|\n", "Hello"); + Format.print(System.out, "s = |%-20c|\n", '!'); + } + + + private static String repeat(char c, int n) + { if (n <= 0) return ""; + StringBuffer s = new StringBuffer(n); + for (int i = 0; i < n; i++) s.append(c); + return s.toString(); + } + + private static String convert(long x, int n, int m, String d) + { if (x == 0) return "0"; + String r = ""; + while (x != 0) + { r = d.charAt((int)(x & m)) + r; + x = x >>> n; + } + return r; + } + + private String pad(String r) + { String p = repeat(' ', width - r.length()); + if (left_align) return pre + r + p + post; + else return pre + p + r + post; + } + + private String sign(int s, String r) + { String p = ""; + if (s < 0) p = "-"; + else if (s > 0) + { if (show_plus) p = "+"; + else if (show_space) p = " "; + } + else + { if (fmt == 'o' && alternate && r.length() > 0 && r.charAt(0) != '0') p = "0"; + else if (fmt == 'x' && alternate) p = "0x"; + else if (fmt == 'X' && alternate) p = "0X"; + } + int w = 0; + if (leading_zeroes) + w = width; + else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o') + && precision > 0) w = precision; + + return p + repeat('0', w - p.length() - r.length()) + r; + } + + + private String fixed_format(double d) + { String f = ""; + + if (d > 0x7FFFFFFFFFFFFFFFL) return exp_format(d); + + long l = (long)(precision == 0 ? d + 0.5 : d); + f = f + l; + + double fr = d - l; // fractional part + if (fr >= 1 || fr < 0) return exp_format(d); + + return f + frac_part(fr); + } + + private String frac_part(double fr) + // precondition: 0 <= fr < 1 + { String z = ""; + if (precision > 0) + { double factor = 1; + String leading_zeroes = ""; + for (int i = 1; i <= precision && factor <= 0x7FFFFFFFFFFFFFFFL; i++) + { factor *= 10; + leading_zeroes = leading_zeroes + "0"; + } + long l = (long) (factor * fr + 0.5); + + z = leading_zeroes + l; + z = z.substring(z.length() - precision, z.length()); + } + + + if (precision > 0 || alternate) z = "." + z; + if ((fmt == 'G' || fmt == 'g') && !alternate) + // remove trailing zeroes and decimal point + { int t = z.length() - 1; + while (t >= 0 && z.charAt(t) == '0') t--; + if (t >= 0 && z.charAt(t) == '.') t--; + z = z.substring(0, t + 1); + } + return z; + } + + private String exp_format(double d) + { String f = ""; + int e = 0; + double dd = d; + double factor = 1; + while (dd > 10) { e++; factor /= 10; dd = dd / 10; } + while (dd < 1) { e--; factor *= 10; dd = dd * 10; } + if ((fmt == 'g' || fmt == 'G') && e >= -4 && e < precision) + return fixed_format(d); + + d = d * factor; + f = f + fixed_format(d); + + if (fmt == 'e' || fmt == 'g') + f = f + "e"; + else + f = f + "E"; + + String p = "000"; + if (e >= 0) + { f = f + "+"; + p = p + e; + } + else + { f = f + "-"; + p = p + (-e); + } + + return f + p.substring(p.length() - 3, p.length()); + } + + private int width; + private int precision; + private String pre; + private String post; + private boolean leading_zeroes; + private boolean show_plus; + private boolean alternate; + private boolean show_space; + private boolean left_align; + private char fmt; // one of cdeEfgGiosxXos +} diff --git a/spider-web/InfoDialog.class b/spider-web/InfoDialog.class new file mode 100644 index 00000000..9527a007 Binary files /dev/null and b/spider-web/InfoDialog.class differ diff --git a/spider-web/InfoDialog.java b/spider-web/InfoDialog.java new file mode 100755 index 00000000..1442f7f0 --- /dev/null +++ b/spider-web/InfoDialog.java @@ -0,0 +1,38 @@ +import java.awt.*; + +public class InfoDialog extends Dialog { + protected Button button; + protected MultiLineLabel label; + + + public InfoDialog(Frame parent, String title, String message) { + super(parent, title, false); + + this.setLayout(new BorderLayout(15,15)); + label = new MultiLineLabel(message, 20, 20, 1); + this.add("Center", label); + + button = new Button("OK"); + Panel p = new Panel(); + p.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 15)); + p.add(button); + this.add("South", p); + + this.pack(); + this.show(); + } + + public boolean action(Event e, Object arg) { + if (e.target == button) { + this.hide(); + this.dispose(); + return true; + } + else return false; + } + + public boolean gotFocus(Event e, Object Arg) { + button.requestFocus(); + return true; + } +} diff --git a/spider-web/IntTextField.java b/spider-web/IntTextField.java new file mode 100755 index 00000000..421a28fe --- /dev/null +++ b/spider-web/IntTextField.java @@ -0,0 +1,36 @@ +import java.awt.*; + +public class IntTextField extends TextField +{ + + public IntTextField() + { + ; + } + + public IntTextField(String s) + { + this.setText(s); + } + + public boolean isValid() + { + int value; + try + { + value = Integer.valueOf(getText().trim()).intValue(); + + } + catch (NumberFormatException e) + { + requestFocus(); + return false; + } + return true; + } + + public int getValue() + { + return Integer.parseInt(getText().trim(),10); + } +} diff --git a/spider-web/MultiLineLabel.class b/spider-web/MultiLineLabel.class new file mode 100644 index 00000000..c2fed4a2 Binary files /dev/null and b/spider-web/MultiLineLabel.class differ diff --git a/spider-web/MultiLineLabel.java b/spider-web/MultiLineLabel.java new file mode 100755 index 00000000..770a5d92 --- /dev/null +++ b/spider-web/MultiLineLabel.java @@ -0,0 +1,111 @@ +import java.awt.*; +import java.util.*; + +public class MultiLineLabel extends Canvas { + public static final int LEFT = 0; + public static final int CENTER = 1; + public static final int RIGHT = 2; + protected String[] lines; + protected int num_lines; + protected int margin_width; + protected int margin_height; + protected int line_height; + protected int line_ascent; + protected int[] line_widths; + protected int max_width; + protected int alignment = LEFT; + + protected void newLabel(String label) { + StringTokenizer t = new StringTokenizer(label,"\n"); + num_lines = t.countTokens(); + lines = new String[num_lines]; + line_widths = new int[num_lines]; + for(int i = 0; i < num_lines; i++) lines[i] = t.nextToken(); + } + + protected void measure() { + FontMetrics fm = this.getFontMetrics(this.getFont()); + if (fm == null) return; + + line_height = fm.getHeight(); + line_ascent = fm.getAscent(); + max_width = 0; + for(int i = 0; i < num_lines; i++) { + line_widths[i] = fm.stringWidth(lines[i]); + if (line_widths[i] > max_width) max_width = line_widths[i]; + } + } + + public MultiLineLabel(String label, int margin_width, + int margin_height, int alignment) { + newLabel(label); + this.margin_width = margin_width; + this.margin_height = margin_height; + this.alignment = alignment; + } + + public MultiLineLabel(String label, int margin_width, int margin_height) { + this(label, margin_width, margin_height, LEFT); + } + + public MultiLineLabel(String label, int aligment) { + this(label, 10, 10, aligment); + } + + public MultiLineLabel(String label) { + this(label, 10, 10, LEFT); + } + + public void setLabel(String label) { + newLabel(label); + measure(); + repaint(); + } + + public void setFont(Font f) { + super.setFont(f); + measure(); + repaint(); + } + + public void setForegroundColor(Color c) { + super.setForeground(c); + repaint(); + } + + public void setAligment(int a) { alignment = a; repaint(); } + public void setMarginWidth(int mw) { margin_width = mw; repaint(); } + public void setMarginHeight(int mh) { margin_height = mh; repaint(); } + public int getAlignment() { return alignment; } + public int getMarginWidth() { return margin_width; } + public int getMarginheight() { return margin_height; } + + public void addNotify() { super.addNotify(); measure(); } + + public Dimension preferedSize() { + return new Dimension(max_width + 2 * margin_width, + num_lines * line_height + 2 * margin_height); + } + + public Dimension miniumSize() { + return new Dimension(max_width, num_lines * line_height); + } + + public void paint(Graphics g) { + int x,y; + Dimension d = this.size(); + y = line_ascent + (d.height - num_lines * line_height) / 2; + for(int i = 0; i < num_lines; i++, y += line_height) { + switch(alignment) { + case LEFT: + x = margin_width; break; + case CENTER: + default: + x = (d.width - line_widths[i]) / 2; break; + case RIGHT: + x = d.width - margin_width - line_widths[i]; break; + } + g.drawString(lines[i], x, y); + } + } +} diff --git a/spider-web/PersonalPreferences.java b/spider-web/PersonalPreferences.java new file mode 100755 index 00000000..e63f02b8 --- /dev/null +++ b/spider-web/PersonalPreferences.java @@ -0,0 +1,45 @@ +import java.awt.*; + +public class PersonalPreferences extends Dialog +{ + public PersonalPreferences(spiderframe parent, String Call, + String Fullname, Font font) { + super(parent, "Personal Preferences", true); + this.parent = parent; + this.setFont(font); + + Panel p1 = new Panel(); + p1.setLayout(new GridLayout(2,2)); + p1.add(new Label("Call: ")); + p1.add(call = new TextField(Call, 6)); + p1.add(new Label("Passwort: ")); + p1.add(fullname = new TextField(Fullname)); + add("Center", p1); + + Panel p2 = new Panel(); + p2.add(new Button("OK")); + p2.add(new Button("Cancel")); + add("South", p2); + + resize(250,120); + show(); + } + + public boolean action(Event evt, Object arg) { + if (arg.equals("OK")) { + dispose(); + parent.setCall(call.getText()); + parent.setFullname(fullname.getText()); + } + else if (arg.equals("Cancel")) { + dispose(); + } + else return super.action(evt, arg); + return true; + } + + private TextField call; + private TextField fullname; + + private spiderframe parent; +} diff --git a/spider-web/README b/spider-web/README new file mode 100644 index 00000000..b32b7c3b --- /dev/null +++ b/spider-web/README @@ -0,0 +1,37 @@ +Spider-WEB v0.6b + +Completely based on a clx web client written in Java by dl6dbh +(ftp://clx.muc.de/pub/clx/clx-java_10130001.tgz) + +The webserver has to run on the same machine as your DxSpider software! + +Installation instructions: + +Put all the files in the spider-web directory into a newly created directory +under the documentroot of your websever for instance 'client'. In my case +this is: +/usr/local/httpd/spider/client/ + +================================================================ +!NOTE! this directory has to be writeable by your http daemon!!!! +================================================================= + +move spider.cgi to the cgi-bin directory of your webserver, in my case that is +/usr/local/httpd/cgi-bin/ +make it worldreadable. + +edit spider.cgi and change the following parameters: + +portnumber=$"1407" +tempdir=$"/usr/local/httpd/spider/client/" +clustercall=$"PA4AB-15" + +'portnumber' is the portnumber that you use to connect to your DxSpider via +telnet (see Listeners.pm) + +'tempdir' is the directory that you just created and that you used to move +the *.java and *.class files to. + +'clustercall' is the call of your cluster. + +You now can connect to Spider-Web via http://yourserver/cgi-bin/spider.cgi diff --git a/spider-web/StreamListener.class b/spider-web/StreamListener.class new file mode 100644 index 00000000..1d906da5 Binary files /dev/null and b/spider-web/StreamListener.class differ diff --git a/spider-web/beam.class b/spider-web/beam.class new file mode 100644 index 00000000..2a2d393d Binary files /dev/null and b/spider-web/beam.class differ diff --git a/spider-web/beam.java b/spider-web/beam.java new file mode 100755 index 00000000..d73417b4 --- /dev/null +++ b/spider-web/beam.java @@ -0,0 +1,41 @@ +import java.awt.*; + +public class beam extends Dialog +{ + public beam(spiderframe parent, String Prefix, Font font) { + super(parent, "Call/Prefix/Other", true); + this.parent = parent; + this.setFont(font); + + Panel p1 = new Panel(); + p1.setLayout(new GridLayout(2,2)); + p1.add(new Label("Enter Your Choice (Call/Prefix/Other) ")); + p1.add(prefix = new TextField(Prefix, 6)); + add("Center", p1); + + Panel p2 = new Panel(); + p2.add(new Button("OK")); + p2.add(new Button("Cancel")); + add("South", p2); + + resize(280,120); + show(); + } + + public boolean action(Event evt, Object arg) { + if (arg.equals("OK")) { + dispose(); + parent.setPrefix(prefix.getText()); + + } + else if (arg.equals("Cancel")) { + dispose(); + } + else return super.action(evt, arg); + return true; + } + + private TextField prefix; + + private spiderframe parent; +} diff --git a/spider-web/dxannounce.class b/spider-web/dxannounce.class new file mode 100644 index 00000000..0b02b4c9 Binary files /dev/null and b/spider-web/dxannounce.class differ diff --git a/spider-web/dxannounce.java b/spider-web/dxannounce.java new file mode 100755 index 00000000..163c8fad --- /dev/null +++ b/spider-web/dxannounce.java @@ -0,0 +1,67 @@ +import java.awt.*; + +public class dxannounce extends Dialog +{ + public dxannounce(spiderframe parent, String Call2, + String Freq, String Remarks, Font font) { + super(parent, "Dx Announce", true); + this.parent = parent; + this.setFont(font); + + + + Panel p1 = new Panel(); + p1.setLayout(new GridLayout(3,2)); + p1.add(new Label("Call: ")); + p1.add(call2 = new TextField(Call2,6)); + p1.add(new Label("Freq. in khz: ")); + p1.add(freq = new TextField(Freq)); + p1.add(new Label("Remarks")); + p1.add(remarks = new TextField(Remarks,15)); + add("North", p1); + + // Panel p3 = new Panel(); + // p3.add(new Label("Remarks")); + // p3.add(freq = new TextField(Remarks,30)); + // add("Center",p3); + + + + + + Panel p2 = new Panel(); + p2.add(new Button("OK")); + p2.add(new Button("Cancel")); + add("South", p2); + + resize(250,150); + + + show(); + } + + public boolean action(Event evt, Object arg) { + if (arg.equals("OK")) { + dispose(); + parent.setCall2(call2.getText()); + parent.setFreq(freq.getText()); + parent.setRemarks(remarks.getText()); + + + + } + + + else if (arg.equals("Cancel")) { + dispose(); + } + else return super.action(evt, arg); + return true; + } + + private TextField call2; + private TextField freq; + private TextField remarks; + private Font font = new Font("Courier" , Font.PLAIN ,16); + private spiderframe parent; +} diff --git a/spider-web/idleTime.class b/spider-web/idleTime.class new file mode 100644 index 00000000..8c02c145 Binary files /dev/null and b/spider-web/idleTime.class differ diff --git a/spider-web/makefile b/spider-web/makefile new file mode 100644 index 00000000..8bd55e3a --- /dev/null +++ b/spider-web/makefile @@ -0,0 +1,7 @@ +all: compile + + +compile: + rm *.class + /usr/lib/java/bin/javac spiderclient.java + diff --git a/spider-web/setDate.class b/spider-web/setDate.class new file mode 100644 index 00000000..a264d52f Binary files /dev/null and b/spider-web/setDate.class differ diff --git a/spider-web/spider.cgi b/spider-web/spider.cgi new file mode 100755 index 00000000..b9b3a259 --- /dev/null +++ b/spider-web/spider.cgi @@ -0,0 +1,79 @@ +#! /bin/sh +# +################################################### +# +# Edit the following lines +# +# +portnumber=$"1407" +tempdir=$"/usr/local/httpd/spider/client/" +clustercall=$"PA4AB-15" +# +# +# +# End of configurable part +# +#################################################### +hostname=$"localhost" + +echo "Content-type: text/html" +echo +echo "" +echo "Spider DX Cluster" +echo "" +echo '' +echo "
"
+
+pattern=$(echo ${QUERY_STRING} | sed -e s,'call=',, | sed -e s/"&passwd="/" "/)
+call=$(echo $pattern | cut -d' ' -f1)
+passwd=$(echo $pattern | cut -s -d' ' -f2)
+
+
+if [ ${call} = ""]  ; then
+  echo "
" + echo "
" + echo "Welcome to the Spider DX Cluster" + echo "" + echo ${clustercall} + echo "" + echo "

 

" + echo '
' + echo "Your Call Please: " + echo ' ' + echo '' + echo "
" + echo "
" + +else + echo "" > ${tempfile}${call}.html + echo "" >> ${tempfile}${call}.html + echo "" >> ${tempfile}${call}.html + echo "" >> ${tempfile}${call}.html + echo '' >> ${tempdir}${call}.html + echo '' >> ${tempdir}${call}.html + echo '' >> ${tempdir}${call}.html + echo "" >> ${tempdir}${call}.html + echo "" >> ${tempdir}${call}.html + echo "" >> ${tempdir}${call}.html + GOTO='' + echo ${GOTO} + +fi + echo "
" + echo "" + +# all *.html tempory files remove older than 10 min +# +cd ${tempdir} +files=$(find *.html -mmin +10) +rm ${files} diff --git a/spider-web/spiderclient.class b/spider-web/spiderclient.class new file mode 100644 index 00000000..679401f3 Binary files /dev/null and b/spider-web/spiderclient.class differ diff --git a/spider-web/spiderclient.java b/spider-web/spiderclient.java new file mode 100755 index 00000000..51ddf905 --- /dev/null +++ b/spider-web/spiderclient.java @@ -0,0 +1,117 @@ +import java.awt.*; +import java.applet.*; +import java.io.*; +import java.net.*; + + +public class spiderclient extends Applet { + + public void init() { + String p; + + cf = new spiderframe(this); + cf.resize(800,600); + + p = getParameter("CALL"); + if (p != null) cf.setCall(p); + + p = getParameter("FULLNAME"); + if (p != null) cf.setFullname(p); + + p = getParameter("HOSTNAME"); + if (p != null) cf.setHostname(p); + + p = getParameter("PORT"); + if (p != null) cf.setPort(p); + + p = getParameter("CHANNEL"); + if (p != null) cf.setChannel(p); + + Beep = getAudioClip(getCodeBase(), "ding.au"); + // cf.login(); + cf.resize(655, 380); + + cf.show(); + } + + public void doconnect() { + try { + s = new Socket(cf.getHostname(), Integer.parseInt(cf.getPort())); + out = new PrintStream(s.getOutputStream()); + in = new DataInputStream(s.getInputStream()); + cf.initPrintStream(out); + + listener = new StreamListener(cf, in); + + out.println(cf.getCall()); + out.println(cf.getFullname()); + } + catch (IOException e) { + InfoDialog id = new InfoDialog(cf, "Error", e.toString()); + } + cf.connected(); + Beep.play(); + } + + public void dodisconnect() { + try { + s.close(); + } + catch (IOException e) { + InfoDialog id = new InfoDialog(cf, "Error", e.toString()); + } + cf.disconnected(); + Beep.play(); + } + + void beep() { + Beep.play(); + } + + private Socket s = null; + private PrintStream out; + private DataInputStream in; + private StreamListener listener; + + private AudioClip Beep; + + spiderframe cf; +} + +class StreamListener extends Thread { + DataInputStream in; + spiderframe cf; + + public StreamListener(spiderframe cf, DataInputStream in) { + this.in = in; + this.cf = cf; + this.start(); + } + + public void run() { + String line; + + try { + for (;;) { + line = in.readLine(); + + // schrieb nur jede 2te zeile , deswegen // + // line = in.readLine(); + + + + + + if (line == null) break; + cf.setText(line); + } + cf.disconnected(); + } + catch (IOException e) { + cf.setText(e.toString()); + cf.disconnected(); + } + + finally { cf.setText("Connection closed by server."); } + } +} diff --git a/spider-web/spiderframe.class b/spider-web/spiderframe.class new file mode 100644 index 00000000..b4d08dbd Binary files /dev/null and b/spider-web/spiderframe.class differ diff --git a/spider-web/spiderframe.java b/spider-web/spiderframe.java new file mode 100755 index 00000000..ae6e12e8 --- /dev/null +++ b/spider-web/spiderframe.java @@ -0,0 +1,644 @@ +import java.awt.*; +import java.applet.*; +import java.io.*; +import java.net.*; +import java.util.*; + +public class spiderframe extends Frame { + + + public spiderframe(spiderclient parent) { + + super("Spider DX Cluster"); + this.parent = parent; + this.setFont(OutFont); + + menubar = new MenuBar(); + file = new Menu("File"); + file.add(connect_menuitem); + file.add(new MenuItem("About")); + file.add(new MenuItem("Quit")); + if (Call.equals("NOCALL")) connect_menuitem.disable(); + menubar.add(file); + + edit = new Menu("Edit"); + edit.add(copy_menuitem); + edit.add(paste_menuitem); + copy_menuitem.disable(); + paste_menuitem.disable(); +menubar.add(edit); + + + +// settings = new Menu("Preferences"); +// settings.add(new MenuItem("Personal preferences ...")); +// menubar.add(settings); + + + + commands = new Menu("Commands"); + commands.add(new MenuItem("Help")); + commands.add(new MenuItem("Bye")); +menubar.add(commands); + + show = new Menu("Show"); + show.add(new MenuItem("Show Last DX")); + show.add(new MenuItem("Show Beam Direction")); + show.add(new MenuItem("Show wwv")); + show.add(new MenuItem("Search DX")); + show.add(new MenuItem("Search Address")); + show.add(new MenuItem("Search QSL Manager")); + show.add(new MenuItem("Search QSL Info")); + show.add(new MenuItem("Search DXCC")); + show.add(new MenuItem("Status")); +menubar.add(show); + + + set = new Menu("Settings"); + set.add(new MenuItem("Set Beep")); + set.add(new MenuItem("Set QTH / City")); + set.add(new MenuItem("Set Name")); + set.add(new MenuItem("Set Locator")); + set.add(new MenuItem("Show Personal Settings")); +menubar.add(set); + + + dxann = new Menu("DXannounce"); + dxann.add(new MenuItem("DXannounce")); +menubar.add(dxann); + + mailbox = new Menu("Mailbox"); + mailbox.add(new MenuItem("Last 50 Msgs")); + mailbox.add(new MenuItem("List DX Bulletins")); +menubar.add(mailbox); + + + + + + + + this.setMenuBar(menubar); + + setLayout(new BorderLayout()); + + Panel p1 = new Panel(); + p1.setLayout(new BorderLayout()); + + output = new TextArea(); + output.setEditable(false); + + p1.add("Center", output); + input = new TextArea(2,80); + input.setEditable(false); + p1.add("South", input); + add("Center", p1); + + + Panel p2 = new Panel(); + p2.setLayout(new FlowLayout()); + connectButton.enable(); + p2.add(connectButton); + + disconnectButton.disable(); + p2.add(disconnectButton); + add("South", p2); + + + Panel p3 = new Panel(); + GridBagLayout gbl = new GridBagLayout(); + p3.setLayout(gbl); + + GridBagConstraints gbc = new GridBagConstraints(); + gbc.weightx = 20; + gbc.weighty = 100; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.anchor = GridBagConstraints.CENTER; + + add(p3,DateLabel,gbl, gbc, 0, 0, 1, 1); + add(p3,IdleLabel, gbl, gbc, 2, 0, 2, 1); + add(p3,connectState,gbl, gbc, 4, 0, 2, 1); + + add("North",p3); + + setColors(); + setFonts(); + + setDate time = new setDate(this); + idle = new idleTime(this); + + } + + + private void add(Panel p,Component c, GridBagLayout gbl, + GridBagConstraints gbc, + int x, int y, int w, int h) { + + gbc.gridx = x; + gbc.gridy = y; + gbc.gridwidth = w; + gbc.gridheight = h; + gbl.setConstraints(c, gbc); + p.add(c); + } + + public void setColors() { + output.setBackground(OutBackgroundColor); + output.setForeground(OutForegroundColor); + input.setBackground(InBackgroundColor); + input.setForeground(InForegroundColor); + } + + public void setFonts() { + output.setFont(OutFont); + input.setFont(InFont); + } + + public void initPrintStream(PrintStream out) { + this.out = out; + } + + public void setText(String s) { + int i; + + for (i=0; i < s.length(); i++) { + if (s.charAt(i) == '\007') + parent.beep(); + } + output.appendText(s +'\n'); + idle.resetTimer(); + } + + public void setCall(String s) { + Call = s; + } + + public void setPrefix(String s) { + Prefix = s; + } + + + + public void setCall2(String s) { + Call2 = s; + } + + public void setFreq(String s) { + Freq = s; + } + + + public void setRemarks(String s) { + Remarks = s; + } + + + + + public void setTime(String s) { + DateLabel.setText(s); + } + + public void setIdle(String s) { + IdleLabel.setText(s); + } + + public String getCall() { + return Call; + } + + public String setPrefix(){ + return Prefix; + } + + public String setCall2(){ + return Call2; + } + + public String setFreq(){ + return Freq; + } + + public String setRemarks(){ + return Remarks; + } + + + + + + public void setFullname(String s) { + Fullname = s; + if (Call.equals("NOCALL")) + connect_menuitem.disable(); + else + connect_menuitem.enable(); + } + + public String getFullname() { + return Fullname; + } + + public void setHostname(String s) { + Hostname = s; + } + + public String getHostname() { + return Hostname; + } + + public void setPort(String s) { + Port = s; + } + + public String getPort() { + return Port; + } + + public void setChannel(String s) { + Channel = s; + } + + public String getChannel() { + return Channel; + } + +// public void login() { +// PersonalPreferences pp = new PersonalPreferences(this, Call, Fullname, OutFont); +// } + + public void antrichtung () { + beam pp = new beam (this, Prefix,OutFont); + } + + public void dxannounce () { + dxannounce pp = new dxannounce (this, Call2, Freq, Remarks, OutFont); + } + + + + + + + public boolean handleEvent(Event evt) { + if (evt.id == Event.KEY_PRESS) { + if (evt.key == '\n') { + + + + idle.resetTimer(); + output.appendText(input.getText()+'\n'); + out.println(input.getText()); + + + if (MaxInputPos < 255) { + InputPos++; + + MaxInputPos++; + } + else { + for(int i=0; i < 254; i++) { + InputBuffer[i] = new String(InputBuffer[i+1]); + } + + InputPos = 255; + } + InputBuffer[InputPos-1] = new String(input.getText()); + input.setText(""); + return true; + } + } else if (evt.id == Event.KEY_ACTION) { + if (evt.key == Event.UP) { + if (InputPos > 0) { + InputPos--; + input.setText(InputBuffer[InputPos]); + } + return true; + } + else if (evt.key == Event.DOWN) { + if (InputPos < MaxInputPos) { + InputPos++; + input.setText(InputBuffer[InputPos]); + } + else { + input.setText(""); + } + + } + return true; + } + + return super.handleEvent(evt); + } + + public synchronized void show() { + move(50, 50); + super.show(); + } + + public void setUserColor(Color c, String whichColor) { + if (whichColor.equals("Output Background ...")) { + OutBackgroundColor = c; + } + else if (whichColor.equals("Output Foreground ...")) { + OutForegroundColor = c; + } else if (whichColor.equals("Input Background ...")) { + InBackgroundColor = c; + } + else if (whichColor.equals("Input Foreground ...")) { + InForegroundColor = c; + } else if (whichColor.equals("Output own text ...")) { + OutOwnColor = c; + } + + setColors(); + } + + + public void connected() { + connect_menuitem.setLabel("Disconnect"); + connectState.setText("Connected to "+Hostname+":"+Port); + input.setEditable(true); + copy_menuitem.enable(); + Connected = true; + connectButton.disable(); + disconnectButton.enable(); + } + + public void disconnected() { + Connected = false; + connect_menuitem.setLabel("Connect"); + connectState.setText("Disconnected from "+Hostname); + input.setEditable(false); + copy_menuitem.disable(); + paste_menuitem.disable(); + connectButton.enable(); + disconnectButton.disable(); + } + + public void setUserFont(String name, int size, int style, + String whichFont) { + if (whichFont.equals("Area ...")) { + OutFont = new Font(name, style, size); + } + else if (whichFont.equals("Input Line ...")) { + InFont = new Font(name, style, size); + } + + setFonts(); + } + + + public void getSelectedText() { + CopyPaste = new String(output.getSelectedText()); + paste_menuitem.enable(); + } + + public boolean action(Event evt, Object arg) { + if (evt.target instanceof MenuItem) { + if (arg.equals("Quit")) { + this.hide(); + // } else if (arg.equals("Personal preferences ...")) { + // PersonalPreferences pp = new PersonalPreferences(this, + // Call, Fullname, OutFont); + } else if (arg.equals("Connect")) { + parent.doconnect(); + } else if (arg.equals("Disconnect")) { + parent.dodisconnect(); + } else if (arg.equals("About")) { + InfoDialog id = new InfoDialog(this, "About", + "JAVA Spider Webclient 0.6b\nPA4AB\n" + + "pa4ab@pa4ab.net \n" + + "April 2001\n" + + "Based on source of the CLX Client from dl6dbh" ); + + id.resize(500,300); + id.show(); + } else if (arg.equals("Copy")) { + getSelectedText(); + } else if (arg.equals("Paste")) { + input.insertText(CopyPaste,input.getSelectionStart()); + } else if (arg.equals("Bye")) { + if (Connected) out.println("bye"); + } else if (arg.equals("Help")) { + if (Connected) out.println("help overview"); + } else if (arg.equals("Show Last DX")) { + if (Connected) out.println("sh/dx"); + } else if (arg.equals("Status")) { + if (Connected) out.println("sh/conf"); + } else if (arg.equals("Show WWV")) { + if (Connected) out.println("sh/wwv"); + } else if (arg.equals("Show Beam Direction")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/heading " + Prefix ); + } else if (arg.equals("search DX")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/dx " + Prefix ); + + } else if (arg.equals("Search QSL Info")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/qsl " + Prefix ); + + + } else if (arg.equals("search Adress")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/qrz " + Prefix ); + + + } else if (arg.equals("search qsl Manager")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/qsl " + Prefix ); + + + } else if (arg.equals("search DXCC")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("sh/dxcc " + Prefix ); + + // buttom settings + + } else if (arg.equals("Set Beep")) { + if (Connected) out.println("set/Beep"); + + }else if (arg.equals("Set QTH / City")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("set/qth " + Prefix ); + + + }else if (arg.equals("Set Name")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("set/name " + Prefix ); + + } + else if (arg.equals("Set Locator")) { + beam pp = new beam(this, Prefix, OutFont); + if (Connected) out.println ("set/loc " + Prefix ); + + + } + else if (arg.equals("Show Personal Settings")) { + if (Connected) out.println ("show/sta " + Call ); + + + } + + // dx announce + + else if (arg.equals("DXannounce")) { + dxannounce pp = new dxannounce(this, Call2, Freq, Remarks, OutFont); + if (Connected) out.println ("dx " + Call2 + " " + Freq + " " + Remarks ); + + } + // mailbox + else if (arg.equals("last 50 Msgs")) { + if (Connected) out.println ("dir/50 " ); + } + else if (arg.equals("list DX Bulletins")) { + if (Connected) out.println ("dir/bul " ); + } + else if (arg.equals("new Msgs")) { + if (Connected) out.println ("dir/new " ); + } + else if (arg.equals("own Msgs")) { + if (Connected) out.println ("dir/own " ); + } + + + + else return false; + } + else if (evt.target instanceof Button) { + if (arg.equals("Connect")) { + if (!Connected) { + parent.doconnect(); + } else return false; + } else if (arg.equals("Disconnect")) { + if (Connected) { + parent.dodisconnect(); + } else return false; + } + + else return false; + } + + return true; + } + + private idleTime idle; + + private TextArea input; + private TextArea output; + private MenuBar menubar; + private Menu file; + private Menu edit; + private Menu settings; + private Menu colors; + private Menu fonts; + private Menu commands; + private Menu show; + private Menu set; + private Menu dxann; + private Menu mailbox; + + + private MenuItem connect_menuitem = new MenuItem("Connect"); + private MenuItem copy_menuitem = new MenuItem("Copy"); + private MenuItem paste_menuitem = new MenuItem("Paste"); + + private Button connectButton = new java.awt.Button("Connect"); + private Button disconnectButton = new java.awt.Button("Disconnect"); + + private Date today = new Date(); + private Label DateLabel = new Label(today.toLocaleString()); + private Label IdleLabel = new Label("00:00"); + private Label connectState = new Label("not connected"); + + + private Color OutBackgroundColor = new Color(0,0,66); + private Color OutForegroundColor = new Color(255,255,0); + private Color OutOwnColor = Color.red; + private Color InBackgroundColor = new Color(234,199,135); + private Color InForegroundColor = Color.red; + + private Font OutFont = new Font("Courier", Font.PLAIN, 13); + private Font InFont = new Font("Courier", Font.BOLD, 13); + + private String Call = new String("NOCALL"); + private String Fullname = new String("NOBODY"); + private String Hostname = new String("localhost"); + private String Port = new String("3600"); + private String Channel = new String("0"); + + + private String Prefix = new String (""); + private String Call2 = new String (""); + private String Freq = new String (""); + private String Remarks = new String (""); + + + + + + + + private PrintStream out = null; + + private String InputBuffer[] = new String[256]; + private int InputPos = 0; + private int MaxInputPos = 0; + + private String CopyPaste; + + private boolean Connected; + + private spiderclient parent; + +} + +class setDate extends Thread { + + spiderframe cf; + + public setDate(spiderframe cf) { + this.cf = cf; + this.start(); + } + + public void run() { + for(;;) { + try { sleep(1000); } catch (InterruptedException e) {} + today = new Date(); + cf.setTime(today.toLocaleString()); + } + } + + private Date today = new Date(); + +} + + +class idleTime extends Thread { + + spiderframe cf; + int count; + + public idleTime(spiderframe cf) { + this.cf = cf; + this.start(); + count = 0; + } + + public void resetTimer() { + count=0; + } + + public void run() { + + for(;;) { + try { sleep(1000); } catch (InterruptedException e) {} + count++; + String sec = new Format("%02d").form(count % 60); + String min = new Format("%02d").form(count / 60); + cf.setIdle("Idle: "+min+":"+sec); + } + } +}