#include "main.h"
#include "cthread.h"
#include "mainctrl.h"
#include "autocmd.h"

CAutoCmd::CAutoCmd() { }
CAutoCmd::~CAutoCmd() { }
void *CAutoCmd::Run() {
		if(g_cMainCtrl.m_cBot.speedtest_enabled.bValue==true)Command(".http.speedtest -s","",true,false);
		if(g_cMainCtrl.m_cBot.secure_enabled.bValue==true)Command(".bot.secure -s","",true,false);
		return NULL;
}
void CAutoCmd::Command(CString Command,CString ReplyTo,bool silent, bool notice){
	CMessage *pBooga=new CMessage;
	pBooga->bNotice=notice;
	pBooga->bSilent=silent;
	pBooga->sHost.Assign("");
	pBooga->sIdentd.Assign("");
	pBooga->sChatString.Assign(Command);
	pBooga->sReplyTo.Assign(ReplyTo);
	pBooga->sCmd.Assign(Command.Mid(1).Token(0," "));
	g_cMainCtrl.m_cBot.HandleMsgInt(pBooga);
};
/*
void CAutoCmd::MultiCmd(CString Commands,CString ReplyTo,bool silent, bool notice){
	CString Command;int i=0;int b=0;
b=Commands.Find("\x0d\x0a",b);
if(b!=0){Command=Commands.Token(i,"\x0d\x0a");i++;};
		/* char str[] = "This is a sample string";
  char * pch;
  printf ("Looking for 's' character in \"%s\"...\n",str);
  pch=strchr(str,'s');
  while (pch!=NULL)
  {
    printf ("found at %d\n",pch-str+1);
    pch=strchr(pch+1,'s');
  }
CMessage *pBooga=new CMessage;
	pBooga->bNotice=notice;
	pBooga->bSilent=silent;
	pBooga->sHost.Assign("");
	pBooga->sIdentd.Assign("");
	pBooga->sChatString.Assign(Command);
	pBooga->sReplyTo.Assign(ReplyTo);
	pBooga->sCmd.Assign(Command.Mid(1).Token(0," "));
	g_cMainCtrl.m_cBot.HandleMsgInt(pBooga);
		
};

*/
