theManager = sqlManager::getInstance(dbString);
/* Get our logfiles open */
-adminLog.open(adminLogFile.c_str());
+adminLog.open(adminLogFile.c_str(), std::ios::out | std::ios::app);
/* Register the commands we want to use */
RegisterCommand(new ADDFLAGCommand(this, "ADDFLAG",
xClient::OnAttach() ;
}
-
/**
* Thread class only used for score updates, updates on reload and shutdown are not threaded
*/
tidRotateDB = MyUplink->RegisterTimer(theTime, this, NULL);
}
else if (theTimer == tidUpdateDB) {
+ /* Prepare to synchronize the database in a thread */
prepareUpdate(true);
/* Refresh Timer */
/* Delete our sqlManager */
theManager->removeManager();
+/* Finally, close our admin log */
+if (adminLog.is_open())
+ adminLog.close();
+
xClient::OnDetach( reason ) ;
}
curStruct.day[i] = curOp->getDay(i);
}
- snapShot.insert(DBMapType::value_type(curChan,curStruct));
+ snapShot.insert(DBMapType::value_type(curChan, curStruct));
}
}
std::stringstream theLine;
int chanOpsProcessed = 0;
- for (sqlChanOpsType::iterator ptr = sqlChanOps.begin();
- ptr != sqlChanOps.end(); ptr++) {
- /* curChan = escapeSQLChars(ptr->first); */
- curChan = ptr->first;
- for (sqlChanOpsType::mapped_type::iterator chanOp = ptr->second.begin();
- chanOp != ptr->second.end(); chanOp++) {
- curOp = chanOp->second;
-
- /* Fill the structures and maps */
- tmpStruct.account = curOp->getAccount();
- tmpStruct.lastSeenAs = curOp->getLastSeenAs();
- tmpStruct.firstOpped = curOp->getTimeFirstOpped();
- tmpStruct.lastOpped = curOp->getTimeLastOpped();
-
- for (i = 0; i < DAYSAMPLES; i++) {
- tmpStruct.day[i] = curOp->getDay(i);
- }
-
- tmpSnapShot.insert(tmpDBMapType::value_type(curChan,tmpStruct));
-
- /*
- acct = escapeSQLChars (curOp->getAccount ()).c_str ();
- lsa = escapeSQLChars (curOp->getLastSeenAs ()).c_str ();
-
- theLine.str("");
- theLine << curChan << "\t"
- << acct << "\t"
- << lsa << "\t"
- << curOp->getTimeFirstOpped() << "\t"
- << curOp->getTimeLastOpped()
- ;
+ for (DBMapType::iterator ptr = snapShot.begin();
+ ptr != snapShot.end(); ptr++) {
+ curChan = escapeSQLChars(ptr->first);
- int i;
- for (i = 0; i < DAYSAMPLES; i++) {
- theLine << "\t" << curOp->getDay(i)
+ theLine.str("");
+ theLine << curChan << "\t"
+ << escapeSQLChars(ptr->second.account) << "\t"
+ << escapeSQLChars(ptr->second.lastSeenAs) << "\t"
+ << ptr->second.firstOpped << "\t"
+ << ptr->second.lastOpped
;
- }
- theLine << "\n"
+ int i;
+ for (i = 0; i < DAYSAMPLES; i++) {
+ theLine << "\t" << ptr->second.day[i]
;
+ }
- bytes += strlen (acct) + strlen (lsa)
- + (sizeof (short) * DAYSAMPLES)
- + (sizeof (time_t) * 2);
+ theLine << "\n"
+ ;
- cacheCon->PutLine(theLine.str().c_str());
- */
- chanOpsProcessed++;
- }
+ cacheCon->PutLine(theLine.str().c_str());
+ chanOpsProcessed++;
}
/* Send completion string for the end of the data. */
/**
* Interval between two consecutive checks for opless channels.
*/
-#define CHECK_CHANS_TIME 10
+#define CHECK_CHANS_TIME 600
/**
* Interval between two consecutive processing of the queues.
*/
-#define PROCESS_QUEUE_TIME 5
+#define PROCESS_QUEUE_TIME 300
/**
* Maximum score a client can obtain.
*/
#define MAXNOTECOUNT 50
-/**
- * The maximum number of automatic fixes to retain in history per
- * channel. (default: 10)
- * NOTE: Not used (yet).
- */
-#define MAXAUTOFIX 10
-
-/**
- * The maximum number of manual fixes to retain in history per channel.
- * (default: 10)
- * NOTE: Not used (yet).
- */
-#define MAXMANUALFIX 10
-
/**
* Do you want to remember (and never expire) old channel entries that
* have notes or flags associated with them?