From 2265aef916e3b2d63d87faa68a2b51e7d747c54c Mon Sep 17 00:00:00 2001 From: Seline Date: Tue, 14 Oct 2008 11:57:03 -0500 Subject: [svn] * Merge Temp dev SVN with Assembla. * Changes include: - Implementation of w12x's Outdoor PvP and Game Event Systems. - Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed). - All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql). - Improved Config cleanup. - And many more changes. --HG-- branch : trunk --- src/game/IRCClient.cpp | 91 -------------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 src/game/IRCClient.cpp (limited to 'src/game/IRCClient.cpp') diff --git a/src/game/IRCClient.cpp b/src/game/IRCClient.cpp deleted file mode 100644 index 0cd6e7d5dcf..00000000000 --- a/src/game/IRCClient.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * MangChat By |Death| And Cybrax - * - * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms - * Of The GNU General Public License - * Written and Developed by Cybrax. cybraxvd@gmail.com - * |Death| , Lice , Dj_baby & Sanaell, Tase - * With Help And Support From The MaNGOS Project Community. - * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS. - */ -#include "IRCClient.h" -#include "World.h" -#include "ObjectMgr.h" -#include "MapManager.h" - -#include "Policies/SingletonImp.h" -INSTANTIATE_SINGLETON_1( IRCClient ); - -#ifdef WIN32 - #define Delay(x) Sleep(x) -#else - #define Delay(x) sleep(x / 1000) -#endif -// IRCClient Constructor -IRCClient::IRCClient() -{ - for(int i = 0;i > 5;i++) - sIRC.Script_Lock[i] = false; -} -// IRCClient Destructor -IRCClient::~IRCClient(){} - -// ZThread Entry This function is called when the thread is created in Master.cpp (mangosd) -void IRCClient::run() -{ - sIRC.iLog.WriteLog(" %s : IRC bot started.", sIRC.iLog.GetLogDateTimeStr().c_str()); - - // before we begin we wait a few - // mangos is still starting up. - ZThread::Thread::sleep(500); - int cCount = 0; - // Clean Up MySQL Tables - sLog.outString("Cleaning up IRC_Inchan table..."); - WorldDatabase.PExecute("DELETE FROM `IRC_Inchan`"); - sIRC._Max_Script_Inst = 0; - // Create a loop to keep the thread running untill active is set to false - while(sIRC.Active && !World::m_stopEvent) - { - // Initialize socket library - if(this->InitSock()) - { - // Connect To The IRC Server - sLog.outString("IRC: Connecting to %s Try # %d ******", sIRC._Host.c_str(), cCount); - if(this->Connect(sIRC._Host.c_str(), sIRC._Port)) - { - // On connection success reset the connection counter - cCount = 0; - sLog.outString("IRC connected and logging in"); - // Login to the IRC server - if(this->Login(sIRC._Nick, sIRC._User, sIRC._Pass)) - { - sLog.outString("IRC logged in and running"); - // While we are connected to the irc server keep listening for data on the socket - while(sIRC.Connected && !World::m_stopEvent){ sIRC.SockRecv(); } - } - sLog.outString("Connection to IRC server lost!"); - } - // When an error occures or connection lost cleanup - Disconnect(); - // Increase the connection counter - cCount++; - // if MAX_CONNECT_ATTEMPT is reached stop trying - if(sIRC._MCA != 0 && cCount == sIRC._MCA) - sIRC.Active = false; - // If we need to reattempt a connection wait WAIT_CONNECT_TIME milli seconds before we try again - if(sIRC.Active) - ZThread::Thread::sleep(sIRC._wct); - } - else - { - // Socket could not initialize cancel - sIRC.Active = false; - sLog.outError("IRC: Could not initialize socket"); - } - } - // we need to keep the thread alive or mangos will crash - // when sending chat or join/leave channels. - // even when we are not connected the functions must still - // be availlable where chat is sent to so we keep it running - while(!World::m_stopEvent){}; -} -- cgit v1.2.3