| 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 */ |
| 14 |
|
|
| 15 |
#include "StdAfx.h" |
#include "StdAfx.h" |
| 16 |
#include ".\innd.h" |
#include ".\innd.h" |
| 17 |
#include ".\nntp_active.h" |
#include ".\base_active.h" |
| 18 |
#include ".\App_common.h" |
#include ".\App_common.h" |
| 19 |
|
|
| 20 |
using namespace std; |
using namespace std; |
| 40 |
this->s_send(out); |
this->s_send(out); |
| 41 |
while(!this->thread_terminate) |
while(!this->thread_terminate) |
| 42 |
{ |
{ |
| 43 |
|
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WAITING); |
| 44 |
|
|
| 45 |
if (this->s_receive(out) == 0) //Connection closed |
if (this->s_receive(out) == 0) //Connection closed |
| 46 |
break; |
break; |
| 47 |
out.Trim(); |
out.Trim(); |
| 48 |
|
|
| 49 |
|
this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WORKING); |
| 50 |
|
|
| 51 |
syslog << logfile::log_head << "Cmd: " << out << endl; |
syslog << logfile::log_head << "Cmd: " << out << endl; |
| 52 |
|
|
| 53 |
if (sscanf(out,"%20s",temp) ==1) |
if (sscanf(out,"%20s",temp) ==1) |
| 156 |
|
|
| 157 |
sql = "select * from innd_conf order by `group`"; |
sql = "select * from innd_conf order by `group`"; |
| 158 |
|
|
| 159 |
RS.Open(CRecordset::snapshot,sql,CRecordst::forwardOnly | CRecordset::readOnly); |
RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); |
| 160 |
while(!RS.IsEEOF()) |
while(!RS.IsEOF()) |
| 161 |
{ |
{ |
| 162 |
RS.GetFieldValue("group",dbVar,SQL_C_CHAR); |
RS.GetFieldValue("group",dbVar,SQL_C_CHAR); |
| 163 |
group = *(dbVr.m_pstring); |
group = *(dbVar.m_pstring); |
| 164 |
art_begin = 1; |
art_begin = 1; |
| 165 |
art_end = 0;; |
art_end = 0;; |
| 166 |
RS.GetFieldValue("in",dbVar,SQL_C_SSHORT); |
RS.GetFieldValue("in",dbVar,SQL_C_SSHORT); |
| 316 |
if (strcmp(cmd,"cancel")==0 && strcmp(cancel_msg_id,"")!=0) //Empty Message-ID |
if (strcmp(cmd,"cancel")==0 && strcmp(cancel_msg_id,"")!=0) //Empty Message-ID |
| 317 |
{ |
{ |
| 318 |
//Delete article |
//Delete article |
| 319 |
sql.Format("select AID from innd_logfile where msg_id='%s'" |
sql.Format("select AID from innd_log where msg_id='%s'" |
| 320 |
" and op='I' and cancel=0",base::addslashes(cancel_msg_id)); |
" and op='I' and cancel=0",base::addslashes(cancel_msg_id)); |
| 321 |
|
|
| 322 |
RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); |
RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); |
| 355 |
} |
} |
| 356 |
catch(CException* e) |
catch(CException* e) |
| 357 |
{ |
{ |
| 358 |
syslog << logfile::log_head << "Error in cmd_ihave()" << endl; |
char strErrMsg[256]; |
| 359 |
|
e->GetErrorMessage(strErrMsg,256); |
| 360 |
|
syslog << logfile::log_head << "Error in cmd_ihave() [" << strErrMsg << "]" << endl; |
| 361 |
e->Delete(); |
e->Delete(); |
| 362 |
return -1; |
return -1; |
| 363 |
} |
} |
| 367 |
|
|
| 368 |
int innd::Shutdown(void) |
int innd::Shutdown(void) |
| 369 |
{ |
{ |
| 370 |
nntp_active nntpClient; |
base_active nntpClient; |
| 371 |
|
|
| 372 |
if (this->thread_terminate) |
if (this->thread_terminate) |
| 373 |
return 1; |
return 1; |