Logo Search packages:      
Sourcecode: sbnc version File versions  Download package

void CCore::LogUser ( CUser User,
const char *  Format,
  ... 
)

LogUser

Logs something in the bouncer's main log and also sends it to a specific user.

Parameters:
User the user
Format a format string
... additional parameters which are used by the format string

Definition at line 964 of file Core.cpp.

References CUser::GetClientConnectionMultiplexer(), CVector< Type >::GetLength(), CUser::GetSystemNotices(), m_AdminUsers, m_Log, CClientConnection::Privmsg(), and CLog::WriteLine().

Referenced by CIRCConnection::AsyncBindIpDnsFinished(), CIRCConnection::AsyncDnsFinished(), CIRCConnection::Error(), CIRCConnection::ParseLineArgV(), CUser::Reconnect(), and CUser::SetIRCConnection().

                                                        {
      char *Out;
      int Ret;
      va_list marker;
      bool DoneUser = false;

      va_start(marker, Format);
      Ret = vasprintf(&Out, Format, marker);
      va_end(marker);

      CHECK_ALLOC_RESULT(Out, vasprintf) {
            return;
      } CHECK_ALLOC_RESULT_END;

      m_Log->WriteLine(NULL, "%s", Out);

      for (unsigned int i = 0; i < m_AdminUsers.GetLength(); i++) {
            CUser *ThisUser = m_AdminUsers[i];

            if (ThisUser->GetSystemNotices() && ThisUser->GetClientConnectionMultiplexer()) {
                  ThisUser->GetClientConnectionMultiplexer()->Privmsg(Out);

                  if (ThisUser == User) {
                        DoneUser = true;
                  }
            }
      }

      if (!DoneUser && User->GetClientConnectionMultiplexer() != NULL) {
            User->GetClientConnectionMultiplexer()->Privmsg(Out);
      }

      free(Out);
}


Generated by  Doxygen 1.6.0   Back to index