| 1 |
/*******************************************************/ |
/*******************************************************/ |
| 2 |
/* */ |
/* */ |
| 3 |
/* LeafOK Innd */ |
/* LeafOK Innbbsd */ |
| 4 |
/* Copyright (C) LeafOK.com, 2003-2004 */ |
/* Copyright (C) LeafOK.com, 2003-2004 */ |
| 5 |
/* */ |
/* */ |
| 6 |
/* Programmed by Leaf */ |
/* Programmed by Leaf */ |
| 7 |
/* E-mail:leaf@leafok.com QQ:6049044 */ |
/* E-mail:leaflet@leafok.com QQ:6049044 */ |
| 8 |
/* */ |
/* */ |
| 9 |
/* http://bbs.leafok.com */ |
/* http://bbs.leafok.com */ |
| 10 |
/* http://bbs.leafok.net */ |
/* http://bbs.leafok.net */ |
| 35 |
CString out,cmd; |
CString out,cmd; |
| 36 |
char temp[256]; |
char temp[256]; |
| 37 |
int result; |
int result; |
|
HANDLE hThreadCurrent; |
|
| 38 |
|
|
| 39 |
try |
try |
| 40 |
{ |
{ |
|
hThreadCurrent = GetCurrentThread(); |
|
|
|
|
| 41 |
out.Format("200 %s ready.",App_common::GetVersion()); |
out.Format("200 %s ready.",App_common::GetVersion()); |
| 42 |
this->s_send(out); |
this->s_send(out); |
| 43 |
while(!this->thread_terminate) |
while(!this->thread_terminate) |
| 44 |
{ |
{ |
| 45 |
this->GetParentThread()->GetThreadPool()->SetThreadStatus(hThreadCurrent,thread_pool::S_WAITING); |
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WAITING); |
| 46 |
|
|
| 47 |
if (this->s_receive(out) == 0) //Connection closed |
if (this->s_receive(out) == 0) //Connection closed |
| 48 |
break; |
break; |
| 49 |
out.Trim(); |
out.Trim(); |
| 50 |
|
|
| 51 |
this->GetParentThread()->GetThreadPool()->SetThreadStatus(hThreadCurrent,thread_pool::S_WORKING); |
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WORKING); |
| 52 |
|
|
| 53 |
syslog << logfile::log_head << "Cmd: " << out << endl; |
syslog << logfile::log_head << "Cmd: " << out << endl; |
| 54 |
|
|
| 179 |
|
|
| 180 |
if (cmd == "ACTIVE") |
if (cmd == "ACTIVE") |
| 181 |
{ |
{ |
| 182 |
if (sscanf(out,"%*s %0s",temp) == 1) |
if (sscanf(out,"%*s %20s",temp) == 1) |
| 183 |
cmd = strupr(temp); |
cmd = strupr(temp); |
| 184 |
else |
else |
| 185 |
cmd = ""; |
cmd = ""; |
| 192 |
this->s_send("201 Entering native mode"); |
this->s_send("201 Entering native mode"); |
| 193 |
base_active nntpClient; |
base_active nntpClient; |
| 194 |
nntpClient.configure(this->innd_id,this->innd_name,this->innd_server,this->innd_uid,"",0,this->w_conn_str); |
nntpClient.configure(this->innd_id,this->innd_name,this->innd_server,this->innd_uid,"",0,this->w_conn_str); |
| 195 |
|
|
| 196 |
|
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WAITING); |
| 197 |
|
|
| 198 |
if (cmd == "POST") // Get & Post |
if (cmd == "POST") // Get & Post |
| 199 |
{ |
{ |
| 200 |
nntpClient.work(true,false); |
nntpClient.work(true,false); |
| 203 |
{ |
{ |
| 204 |
nntpClient.work(false,true); |
nntpClient.work(false,true); |
| 205 |
} |
} |
| 206 |
|
|
| 207 |
|
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WORKING); |
| 208 |
|
|
| 209 |
this->s_send("Entering passive mode\r\n."); |
this->s_send("Entering passive mode\r\n."); |
| 210 |
} |
} |
| 211 |
else |
else |