Exemple #1
0
void CLogMod::OnIRCDisconnected()
{
    PutLog("Disconnected from IRC (" + GetServer() + ")");
}
Exemple #2
0
CModule::EModRet CLogMod::OnBroadcast(CString& sMessage)
{
    PutLog("Broadcast: " + sMessage);
    return CONTINUE;
}
Exemple #3
0
//------------------------------------------------------------------
bool AVEngine::Start()
{	 
	RPC_STATUS status;
	unsigned int   nMinCalls           = DEFAULT_MIN_CALLS ;
	unsigned int   nMaxCalls           = DEFAULT_MAX_CALLS ;
	wchar_t   *pszProtocolSequence     = DEFAULT_PROTOCOL_SEQUENCE ; // for "RpcServerUseProtseqEp" proper work, we change it's declaration from " unsigned char *" to "wchar_t   *" 
	wchar_t   *pszEndpoint             = DEFAULT_ENDPOINT ;

	//tells the RPC run-time library to use the specified protocol sequence combined with the specified endpoint for receiving remote procedure calls.
	status = RpcServerUseProtseqEp((RPC_WSTR)pszProtocolSequence,nMaxCalls,(RPC_WSTR)pszEndpoint,NULL);
	if (status != RPC_S_OK)
	{
		PutLog(RPCSERVERUSEPROTSEQEP_FAILD);
		return false ;
	}
	status = RpcServerRegisterIf2(AVEngine_AsyncRPC_v1_0_s_ifspec, // interface to register
		NULL,   // MgrTypeUuid
		NULL,// MgrEpv; null means use default
		RPC_IF_ALLOW_LOCAL_ONLY, //the RPC runtime rejects calls made by remote clients. All local calls using ncadg_* and ncacn_* protocol sequences are also rejected, with the exception of ncacn_np.
		nMaxCalls,//Maximum number of concurrent remote procedure call requests the server can accept on an auto-listen interface.
		NULL,//Maximum size of incoming data blocks, in bytes. * This parameter has no effect on calls made over the ncalrpc protocol.
		NULL);//Security-callback function, or NULL for no callback.
	// Create new thread for listen to client requests 
	if (status != RPC_S_OK)
	{
		PutLog(RPCSERVERREGISTERIF2_FAILD);
		return false ;
	}

	PutLog(CALLING_RPCSERVERLISTEN);
	//signals the RPC run-time library to listen for remote procedure calls.
	status = RpcServerListen(nMinCalls, //Hint to the RPC run time that specifies the minimum number of call threads that should be created and maintained in the given server. 
		nMaxCalls, //Recommended maximum number of concurrent remote procedure calls the server can execute.
		1  //A value of nonzero indicates that RpcServerListen should return immediately after completing function processing. 
		);

	if (status != RPC_S_OK)
	{
		RpcServerUnregisterIf(AVEngine_AsyncRPC_v1_0_s_ifspec, NULL, FALSE);
		PutLog(RPCSERVERLISTEN_FAILD);
		return false ;
	}
	PutLog(CALLING_RPCSERVERLISTEN);
	hThread = CreateThread(
		NULL,              // default security attributes
		0,                 // use default stack size  
		SetupRPCServer,          // thread function 
		NULL,             // argument to thread function 
		0,                 // use default creation flags 
		&dwThreadId
		);   // returns the thread identifier 

	
	
	// Check the return value for success.
	if (hThread == NULL) 
	{	
		PutLog(CREATELISTENTHREAD_FAILD);
		return false;
	}
	return true;	
}
Exemple #4
0
void CLogMod::OnIRCConnected()
{
    PutLog("Connected to IRC (" + GetServer() + ")");
}
Exemple #5
0
extern void __Message(int level, char *file, int line, char *msg) {
  char buff[SIZE_LOG];
  char *f, *p, *s;
  Bool fOut, fDot;
  struct timeval tv;
  struct tm Now;

#ifdef USE_SYSLOG
  syslog(SyslogLevel(level), "%s", msg);
#endif

  if (fpLog != NULL) {
    gettimeofday(&tv, NULL);
    localtime_r((time_t *)&tv.tv_sec, &Now);
    p = buff;
    fOut = TRUE;
    for (f = Format; *f != 0; f++) {
      if (*f == '%') {
        f++;
        switch (*f) {
        case 'Y':
          p += sprintf(p, "%04d", Now.tm_year + 1900);
          break;
        case 'M':
          p += sprintf(p, "%02d", Now.tm_mon + 1);
          break;
        case 'D':
          p += sprintf(p, "%02d", Now.tm_mday);
          break;
        case 'h':
          p += sprintf(p, "%02d", Now.tm_hour);
          break;
        case 'm':
          p += sprintf(p, "%02d", Now.tm_min);
          break;
        case 's':
          p += sprintf(p, "%02d", Now.tm_sec);
          break;
        case 'p':
          p += sprintf(p, "%03d", (int)(tv.tv_usec / 1000));
          break;
        case 'F':
          fDot = FALSE;
          if (*(f + 1) == '(') {
            f += 2;
            fOut = FALSE;
            while (*f != ')') {
              if (*f == *FlagChar[level]) {
                fOut = TRUE;
              }
              if (*f == '.') {
                fDot = TRUE;
              }
              f++;
            }
          }
          if (!fDot) {
            p += sprintf(p, "%s", FlagChar[level]);
          }
          break;
        case 'i':
          p += sprintf(p, "%s", Processid);
          break;
        case 'f':
          p += sprintf(p, "%s", file);
          break;
        case 'L':
          p += sprintf(p, "%d", line);
          break;
        case 'B':
          for (s = msg; *s != 0; s++) {
            switch (*s) {
            case '\\':
              p += sprintf(p, "\\\\");
              break;
            case '\n':
              break;
            default:
              *p++ = *s;
              break;
            }
          }
          break;
        default:
          *p++ = *f;
          break;
        }
      } else {
        *p++ = *f;
      }
    }
    *p = 0;
    if (fOut) {
      PutLog(buff);
    }
  }
}
Exemple #6
0
void CLogMod::PutLog(const CString& sLine, const CNick& Nick)
{
	PutLog(sLine, Nick.GetNick());
}
Exemple #7
0
CModule::EModRet CLogMod::OnPrivMsg(CNick& Nick, CString& sMessage)
{
	PutLog("<" + Nick.GetNick() + "> " + sMessage, Nick);
	return CONTINUE;
}
Exemple #8
0
void CLogMod::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans)
{
    for (std::vector<CChan*>::const_iterator pChan = vChans.begin(); pChan != vChans.end(); ++pChan)
        PutLog("*** Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", **pChan);
}
Exemple #9
0
CModule::EModRet CLogMod::OnPrivAction(CNick& Nick, CString& sMessage)
{
	PutLog("* " + Nick.GetNick() + " " + sMessage, Nick);
	return CONTINUE;
}
Exemple #10
0
/* msgs */
CModule::EModRet CLogMod::OnUserMsg(CString& sTarget, CString& sMessage)
{
	PutLog("<" + GetUser()->GetCurNick() + "> " + sMessage, sTarget);
	return CONTINUE;
}
Exemple #11
0
CModule::EModRet CLogMod::OnTopic(CNick& Nick, CChan& Channel, CString& sTopic)
{
	PutLog("*** " + Nick.GetNick() + " changes topic to '" + sTopic + "'", Channel);
	return CONTINUE;
}
Exemple #12
0
void CLogMod::OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans)
{
	for (std::vector<CChan*>::const_iterator pChan = vChans.begin(); pChan != vChans.end(); ++pChan)
		PutLog("*** " + OldNick.GetNick() + " is now known as " + sNewNick, **pChan);
}
Exemple #13
0
void CLogMod::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage)
{
	PutLog("*** Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", Channel);
}
Exemple #14
0
void CLogMod::OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs)
{
    PutLog("*** " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs, Channel);
}
Exemple #15
0
CModule::EModRet CLogMod::OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage)
{
	PutLog("<" + Nick.GetNick() + "> " + sMessage, Channel);
	return CONTINUE;
}
Exemple #16
0
void CLogMod::OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage)
{
    PutLog("*** " + sKickedNick + " was kicked by " + OpNick.GetNick() + " (" + sMessage + ")", Channel);
}
Exemple #17
0
void CLogMod::PutLog(const CString& sLine, const CChan& Channel)
{
	PutLog(sLine, Channel.GetName());
}
Exemple #18
0
void CLogMod::OnJoin(const CNick& Nick, CChan& Channel)
{
    PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ")", Channel);
}
CModule::EModRet CRawLogMod::OnUserRaw(CString& sMessage)
{
	PutLog(sMessage);
	return CONTINUE;
}