--- innwebd/innd.cpp 2004/07/02 11:32:20 1.3 +++ innwebd/innd.cpp 2008/04/11 17:14:49 1.13 @@ -1,20 +1,16 @@ /*******************************************************/ /* */ -/* LeafOK Innd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ +/* LeafOK Innbbsd */ /* */ -/* Programmed by Leaf */ -/* E-mail:leaf@leafok.com QQ:6049044 */ +/* Copyright (C) LeafOK.com, 2003-2008 */ /* */ -/* http://bbs.leafok.com */ -/* http://bbs.leafok.net */ -/* http://bbs.fenglin.info */ +/* http://www.leafok.com */ /* */ /*******************************************************/ #include "StdAfx.h" #include ".\innd.h" -#include ".\nntp_active.h" +#include ".\base_active.h" #include ".\App_common.h" using namespace std; @@ -40,10 +36,14 @@ int innd::Accept(void) this->s_send(out); while(!this->thread_terminate) { + this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WAITING); + if (this->s_receive(out) == 0) //Connection closed break; out.Trim(); + this->GetParentThread()->GetThreadPool()->SetThreadStatus(GetCurrentThreadId(),thread_pool::S_WORKING); + syslog << logfile::log_head << "Cmd: " << out << endl; if (sscanf(out,"%20s",temp) ==1) @@ -120,7 +120,9 @@ int innd::Accept(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in accept()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in accept() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -152,11 +154,11 @@ int innd::cmd_list(void) sql = "select * from innd_conf order by `group`"; - RS.Open(CRecordset::snapshot,sql,CRecordst::forwardOnly | CRecordset::readOnly); - while(!RS.IsEEOF()) + RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); + while(!RS.IsEOF()) { RS.GetFieldValue("group",dbVar,SQL_C_CHAR); - group = *(dbVr.m_pstring); + group = *(dbVar.m_pstring); art_begin = 1; art_end = 0;; RS.GetFieldValue("in",dbVar,SQL_C_SSHORT); @@ -171,7 +173,9 @@ int innd::cmd_list(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in cmd_list()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in cmd_list() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -312,7 +316,7 @@ int innd::cmd_ihave(const char* msg_id) if (strcmp(cmd,"cancel")==0 && strcmp(cancel_msg_id,"")!=0) //Empty Message-ID { //Delete article - sql.Format("select AID from innd_logfile where msg_id='%s'" + sql.Format("select AID from innd_log where msg_id='%s'" " and op='I' and cancel=0",base::addslashes(cancel_msg_id)); RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); @@ -351,7 +355,9 @@ int innd::cmd_ihave(const char* msg_id) } catch(CException* e) { - syslog << logfile::log_head << "Error in cmd_ihave()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in cmd_ihave() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -361,7 +367,7 @@ int innd::cmd_ihave(const char* msg_id) int innd::Shutdown(void) { - nntp_active nntpClient; + base_active nntpClient; if (this->thread_terminate) return 1; @@ -392,3 +398,8 @@ int innd::db_env_init(void) } return 0; } + +bool innd::check_priv(void) +{ + return this->access.get; +}