diff options
| author | Charles Forsyth <charles.forsyth@gmail.com> | 2015-04-29 17:44:33 +0100 |
|---|---|---|
| committer | Charles Forsyth <charles.forsyth@gmail.com> | 2015-04-29 17:44:33 +0100 |
| commit | fbc1184c08d18d5ac0f8763a058e015e95353341 (patch) | |
| tree | f045cdfaaf13c35295d34cb0c2ffd7f4cf2ef30d /appl/lib/pop3.b | |
| parent | 83eae27259078c96c074211a51bf38c774490544 (diff) | |
switch to Dial module
Diffstat (limited to 'appl/lib/pop3.b')
| -rw-r--r-- | appl/lib/pop3.b | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/appl/lib/pop3.b b/appl/lib/pop3.b index 4081b279..ce297004 100644 --- a/appl/lib/pop3.b +++ b/appl/lib/pop3.b @@ -5,6 +5,8 @@ include "sys.m"; include "draw.m"; include "bufio.m"; bufio : Bufio; +include "dial.m"; + dial: Dial; include "pop3.m"; FD, Connection: import sys; @@ -26,14 +28,17 @@ open(user, password, server : string): (int, string) if (!inited) { sys = load Sys Sys->PATH; bufio = load Bufio Bufio->PATH; + dial = load Dial Dial->PATH; inited = 1; } if (conn) return (-1, "connection is already open"); if (server == nil) server = "$pop3"; - (ok, c) := sys->dial ("net!" + server + "!110", nil); - if (ok < 0) + else + server = dial->netmkaddr(server, "net", "110"); + c := dial->dial(server, nil); + if (c == nil) return (-1, "dialup failed"); ibuf = bufio->fopen(c.dfd, Bufio->OREAD); obuf = bufio->fopen(c.dfd, Bufio->OWRITE); @@ -42,6 +47,7 @@ open(user, password, server : string): (int, string) cread = chan of (int, string); spawn mreader(cread); (rpid, nil) = <- cread; + ok: int; (ok, s) = mread(); if (ok < 0) return (-1, s); |
