23 |
|
|
24 |
|
# default settings |
25 |
|
my($mailinfo_mode) = "mi_guess"; |
26 |
< |
my($mailinfo_name) = getlogin; |
26 |
> |
my($mailinfo_name) = ""; |
27 |
|
my($mailinfo_quick) = 0; |
28 |
|
|
29 |
|
# work out the switches |
57 |
|
&usage; |
58 |
|
} |
59 |
|
else { |
60 |
< |
$mailinfo_name = $opt; |
60 |
> |
$mailinfo_name .= " $opt"; |
61 |
|
} |
62 |
|
} |
63 |
|
|
64 |
+ |
if($mailinfo_name eq "") { $mailinfo_name = getlogin; } |
65 |
+ |
|
66 |
|
# run mailinfo |
67 |
|
&mailinfo($mailinfo_server, $mailinfo_port, $mailinfo_mode, $mailinfo_name, $mailinfo_quick); |
68 |
|
|
87 |
|
PeerAddr => $server, |
88 |
|
PeerPort => $port, |
89 |
|
Proto => 'tcp' |
90 |
< |
) or die "Cannot connect!"; |
90 |
> |
) or die "Connection to server broken\n"; |
91 |
|
|
92 |
|
if(!defined $sock) { |
93 |
< |
print "unable to connect to mailinfo server: $server:$port"; |
93 |
> |
print "Connection to server broken\n"; |
94 |
|
exit(1); |
95 |
|
} |
96 |
|
|
97 |
< |
my($response); |
97 |
> |
my($response) = ""; |
98 |
|
|
99 |
|
# set the sensible option if we want quick mode |
100 |
|
if($quick) { |
99 |
– |
print "DEBUG sensible on\n"; |
101 |
|
print $sock "sensible on\n"; |
102 |
|
$response = <$sock>; |
103 |
|
while($response ne ".\n") { |
103 |
– |
#print "$response"; |
104 |
|
$response = <$sock>; |
105 |
|
} |
106 |
|
} |
107 |
|
|
108 |
|
# send the query |
109 |
|
print $sock "$mode $name\n"; |
110 |
+ |
$response = ""; |
111 |
|
|
112 |
< |
# read and print the response |
112 |
< |
$response = <$sock>; |
112 |
> |
# read and print the response |
113 |
|
while($response ne ".\n") { |
114 |
– |
print "$response"; |
114 |
|
$response = <$sock>; |
115 |
+ |
if($response =~ s/^\?/mailinfo: /) { |
116 |
+ |
print $response; |
117 |
+ |
} |
118 |
+ |
else { |
119 |
+ |
print $response unless $response eq ".\n"; |
120 |
+ |
} |
121 |
|
} |
122 |
|
|
123 |
|
# quit and close |