forked from Pistolebob/spotweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpotNntp.php
61 lines (49 loc) · 1.54 KB
/
SpotNntp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require_once "Net/NNTP/Client.php";
class SpotNntp {
private $_server;
private $_user;
private $_pass;
private $_serverenc;
private $_serverport;
private $_error;
private $_nntp;
function __construct($server, $serverenc, $serverport, $user, $pass) {
$error = '';
$this->_server = $server;
$this->_serverenc = $serverenc;
$this->_serverport = $serverport;
$this->_user = $user;
$this->_pass = $pass;
# Set pear error handling to be used by exceptions
PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
$this->_nntp = new Net_NNTP_Client();
} # ctor
function selectGroup($group) {
return $this->_nntp->selectGroup($group);
} # selectGroup()
function getOverview($first, $last) {
$hdrList = $this->_nntp->getOverview($first . '-' . $last);
$hdrList = array_reverse($hdrList);
return $hdrList;
} # getOverview()
function quit() {
try {
$this->_nntp->quit();
} catch(Exception $x) {
// dummy, we dont care about exceptions during quitting time
}
} # quit()
function getHeader($msgid) {
return $this->_nntp->getHeader($msgid);
} # getHeader()
function getBody($msgid) {
return $this->_nntp->getBody($msgid);
} # getBody ()
function connect() {
$ret = $this->_nntp->connect($this->_server, $this->_serverenc, $this->_serverport);
if (!empty($this->_user)) {
$authed = $this->_nntp->authenticate($this->_user, $this->_pass);
} # if
} # connect()
} # class SpotNntp