--- innwebd/base_active.cpp 2004/07/03 05:21:57 1.1 +++ innwebd/base_active.cpp 2008/04/11 17:14:49 1.9 @@ -1,14 +1,10 @@ /*******************************************************/ /* */ -/* 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 */ /* */ /*******************************************************/ @@ -269,7 +265,9 @@ int base_active::get_article(const char* } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in get_article()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in get_article() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -476,7 +474,7 @@ int base_active::get_cancel(const char* if (i >= step || cur_art_id >= art_end || rec_count >= step*10) { //Delete article - sql.Format("select AID from innd_logfile where msg_id in (%s" + sql.Format("select AID from innd_log where msg_id in (%s" ") and op='I' and cancel=0",msg_id_list); RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); @@ -510,7 +508,9 @@ int base_active::get_cancel(const char* } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in get_article()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in get_article() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -533,11 +533,10 @@ int base_active::post_article(const char { //Begin post sql.Format("select bbs.*,innd_conf.group,innd_todo.ID,innd_todo.SID as doSID," - "user_list.username,subdate(bbs.sub_dt, interval '8' hour)" + "subdate(bbs.sub_dt, interval '8' hour)" " as sub_gmt from innd_todo inner join innd_conf on" " innd_todo.server=innd_conf.server and innd_todo.SID=innd_conf.SID left join bbs on" - " innd_todo.AID=bbs.AID inner join user_list on" - " bbs.UID=user_list.UID where innd_conf.out=1 and" + " innd_todo.AID=bbs.AID where innd_conf.out=1 and" " innd_conf.passive_mode=0 and innd_conf.server='%s' and" " bbs.visible and innd_todo.op='P' order by bbs.AID",news_server); @@ -574,7 +573,7 @@ int base_active::post_article(const char sql.Format("delete from innd_todo where ID=%ld",id); this->Db.ExecuteSQL(sql); - syslog << logfile::log_head << "[" << news_server << "] Post failed " << msg_id << endl; + syslog << logfile::log_head << "[" << news_server << "] Post failed " << msg_id << " [" << out << "]" << endl; RS.MoveNext(); continue; @@ -617,7 +616,7 @@ int base_active::post_article(const char if (out.Left(3) == "240") // Post successfully { - sql.Format("insert delayed into innd_logfile (AID,art_id,msg_id,op) " + sql.Format("insert delayed into innd_log (AID,art_id,msg_id,op) " "values(%ld,0,'%s','O')",aid,msg_id); this->Db.ExecuteSQL(sql); @@ -632,7 +631,9 @@ int base_active::post_article(const char } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in post_article()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in post_article() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -652,16 +653,15 @@ int base_active::post_cancel(const char* try { //Begin post - sql.Format("select bbs.nickname,innd_todo.ID,innd_conf.group,innd_todo.SID as doSID," - "user_list.username,innd_todo.AID," + sql.Format("select bbs.username,bbs.nickname,innd_todo.ID,innd_conf.group," + "innd_todo.SID as doSID,innd_todo.AID," "subdate(innd_todo.dt,interval '8' hour) as dt," - "innd_logfile.msg_id from innd_todo inner join innd_conf on" + "innd_log.msg_id from innd_todo inner join innd_conf on" " innd_todo.server=innd_conf.server and innd_todo.SID=innd_conf.SID left join bbs on" - " innd_todo.AID=bbs.AID inner join user_list on" - " bbs.UID=user_list.UID inner join innd_logfile on" - " innd_todo.AID=innd_logfile.AID where innd_conf.out=1 and" + " innd_todo.AID=bbs.AID inner join innd_log on" + " innd_todo.AID=innd_log.AID where innd_conf.out=1 and" " innd_conf.passive_mode=0 and innd_conf.server='%s' and" - " innd_todo.op='C' and innd_logfile.cancel=0 order by innd_todo.AID",news_server); + " innd_todo.op='C' and innd_log.cancel=0 order by innd_todo.AID",news_server); RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); @@ -692,7 +692,7 @@ int base_active::post_cancel(const char* sql.Format("delete from innd_todo where ID=%ld",id); this->Db.ExecuteSQL(sql); - syslog << logfile::log_head << "[" << news_server << "] Post failed " << msg_id << endl; + syslog << logfile::log_head << "[" << news_server << "] Post failed " << msg_id << " [" << out << "]" << endl; RS.MoveNext(); continue; @@ -720,7 +720,7 @@ int base_active::post_cancel(const char* if (out.Left(3) == "240") // Post successfully { - sql.Format("update innd_logfile set cancel=1 where msg_id='%s'",cancel_msg_id); + sql.Format("update innd_log set cancel=1 where msg_id='%s'",cancel_msg_id); this->Db.ExecuteSQL(sql); sql.Format("delete from innd_todo where ID=%ld",id); @@ -734,7 +734,9 @@ int base_active::post_cancel(const char* } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in post_cancel()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in post_cancel() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -829,7 +831,9 @@ int base_active::get(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in get()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in get() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -896,7 +900,9 @@ int base_active::post(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in post()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in post() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -919,11 +925,10 @@ int base_active::ihave_article(const cha { //Begin ihave sql.Format("select bbs.*,innd_todo.ID,innd_conf.group,innd_todo.SID as doSID," - "user_list.username,subdate(bbs.sub_dt, interval '8' hour)" + "subdate(bbs.sub_dt, interval '8' hour)" " as sub_gmt from innd_todo inner join innd_conf on" " innd_todo.server=innd_conf.server and innd_todo.SID=innd_conf.SID left join bbs on" - " innd_todo.AID=bbs.AID inner join user_list on" - " bbs.UID=user_list.UID where innd_conf.out=1 and" + " innd_todo.AID=bbs.AID where innd_conf.out=1 and" " innd_conf.passive_mode=1 and innd_conf.server='%s' and" " bbs.visible and innd_todo.op='P' order by bbs.AID",news_server); @@ -957,10 +962,13 @@ int base_active::ihave_article(const cha if (out.Left(3) != "335") { - sql.Format("delete from innd_todo where ID=%ld",id); - this->Db.ExecuteSQL(sql); + if (out.Left(3) == "435") + { + sql.Format("delete from innd_todo where ID=%ld",id); + this->Db.ExecuteSQL(sql); + } - syslog << logfile::log_head << "[" << news_server << "] Ihave failed " << msg_id << endl; + syslog << logfile::log_head << "[" << news_server << "] Ihave failed " << msg_id << " [" << out << "]" << endl; RS.MoveNext(); continue; @@ -1003,7 +1011,7 @@ int base_active::ihave_article(const cha if (out.Left(3) == "235") // Ihave successfully { - sql.Format("insert delayed into innd_logfile (AID,art_id,msg_id,op) " + sql.Format("insert delayed into innd_log (AID,art_id,msg_id,op) " "values(%ld,0,'%s','O')",aid,msg_id); this->Db.ExecuteSQL(sql); @@ -1025,7 +1033,9 @@ int base_active::ihave_article(const cha } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in ihave_article()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in ihave_article() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -1045,16 +1055,15 @@ int base_active::ihave_cancel(const char try { //Begin ihave - sql.Format("select bbs.nickname,innd_todo.ID,innd_conf.group,innd_todo.SID as doSID," - "user_list.username,innd_todo.AID," + sql.Format("select bbs.username,bbs.nickname,innd_todo.ID,innd_conf.group," + "innd_todo.SID as doSID,innd_todo.AID," "subdate(innd_todo.dt,interval '8' hour) as dt," - "innd_logfile.msg_id from innd_todo inner join innd_conf on" + "innd_log.msg_id from innd_todo inner join innd_conf on" " innd_todo.server=innd_conf.server and innd_todo.SID=innd_conf.SID left join bbs on" - " innd_todo.AID=bbs.AID inner join user_list on" - " bbs.UID=user_list.UID inner join innd_logfile on" - " innd_todo.AID=innd_logfile.AID where innd_conf.out=1 and" + " innd_todo.AID=bbs.AID inner join innd_log on" + " innd_todo.AID=innd_log.AID where innd_conf.out=1 and" " innd_conf.passive_mode=1 and innd_conf.server='%s' and" - " innd_todo.op='C' and innd_logfile.cancel=0 order by innd_todo.AID",news_server); + " innd_todo.op='C' and innd_log.cancel=0 order by innd_todo.AID",news_server); RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); @@ -1082,10 +1091,13 @@ int base_active::ihave_cancel(const char if (out.Left(3) != "335") { - sql.Format("delete from innd_todo where ID=%ld",id); - this->Db.ExecuteSQL(sql); + if (out.Left(3) == "435") + { + sql.Format("delete from innd_todo where ID=%ld",id); + this->Db.ExecuteSQL(sql); + } - syslog << logfile::log_head << "[" << news_server << "] Ihave failed " << msg_id << endl; + syslog << logfile::log_head << "[" << news_server << "] Ihave failed " << msg_id << " [" << out << "]" <Db.ExecuteSQL(sql); sql.Format("delete from innd_todo where ID=%ld",id); @@ -1134,7 +1146,9 @@ int base_active::ihave_cancel(const char } catch(CException* e) { - syslog << logfile::log_head << "[" << news_server << "] Getting article error in ihave_cancel()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "[" << news_server << "] Getting article error in ihave_cancel() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -1200,7 +1214,9 @@ int base_active::ihave(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in ihave()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in ihave() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -1217,7 +1233,7 @@ bool base_active::check_todo_list(void) try { - syslog << logfile::log_head << "Searching article to send ..." << endl; +// syslog << logfile::log_head << "Searching article to send ..." << endl; sql = "select count(*) as cc from innd_todo"; @@ -1237,7 +1253,9 @@ bool base_active::check_todo_list(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in check_todo_list()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in check_todo_list() [" << strErrMsg << "]" << endl; e->Delete(); return false; } @@ -1275,14 +1293,16 @@ DWORD base_active::SendThread(LPVOID pPa delete(p); base_active::uThreadCount--; - syslog << logfile::log_head << "Delete send thread ... OK" << endl; +// syslog << logfile::log_head << "Delete send thread ... OK" << endl; } catch(CException* e) { - syslog << logfile::log_head << "Error in SendThread()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in SendThread() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } return 0; -} \ No newline at end of file +}