Skip to content

Commit

Permalink
identfile: Improve the debug messages
Browse files Browse the repository at this point in the history
The new debug messages allow us to see when the identfile is unlocked
  • Loading branch information
kylef committed Oct 7, 2011
1 parent 3c0e209 commit edaa20e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions modules/identfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ class CIdentFileModule : public CModule {
sData.Replace("%", m_pUser->GetIdent());
}

DEBUG("Writing [" + sData + "] to ident spoof file [" + m_pISpoofLockFile->GetLongName() + "] for user [" + m_pUser->GetUserName() + "]");
DEBUG("Writing [" + sData + "] to ident spoof file [" + m_pISpoofLockFile->GetLongName() + "] for user/network [" + m_pUser->GetUserName() + "/" + m_pNetwork->GetName() + "]");

m_pISpoofLockFile->Write(sData + "\n");

return true;
}

void ReleaseISpoof() {
DEBUG("Releasing ident spoof for user/network [" + m_pUser->GetUserName() + "/" + m_pNetwork->GetName() + "]");

m_pIRCSock = NULL;

if (m_pISpoofLockFile != NULL) {
if (m_pISpoofLockFile->Seek(0) && m_pISpoofLockFile->Truncate()) {
m_pISpoofLockFile->Write(m_sOrigISpoof);
Expand Down Expand Up @@ -127,7 +131,7 @@ class CIdentFileModule : public CModule {
virtual EModRet OnIRCConnecting(CIRCSock *pIRCSock) {
if (m_pISpoofLockFile != NULL) {
DEBUG("Aborting connection, ident spoof lock file exists");
PutModule("Aborting connection, another user is currently connecting and using the ident spoof file");
PutModule("Aborting connection, another user or network is currently connecting and using the ident spoof file");
return HALTCORE;
}

Expand All @@ -143,21 +147,18 @@ class CIdentFileModule : public CModule {

virtual void OnIRCConnected() {
if (m_pIRCSock == m_pNetwork->GetIRCSock()) {
m_pIRCSock = NULL;
ReleaseISpoof();
}
}

virtual void OnIRCConnectionError(CIRCSock *pIRCSock) {
if (m_pIRCSock == pIRCSock) {
m_pIRCSock = NULL;
ReleaseISpoof();
}
}

virtual void OnIRCDisconnected() {
if (m_pIRCSock == m_pNetwork->GetIRCSock()) {
m_pIRCSock = NULL;
ReleaseISpoof();
}
}
Expand Down

0 comments on commit edaa20e

Please sign in to comment.