// ****************************************************************** //
// *			 mIRC On-The-Fly Version Modifier v2.05 			* //
// *																* //
// *			Copyright ©2000 danielson@centurytel.net			* //
// *				    All Rights Reserved							* //
// ****************************************************************** //

#define WIN32_LEAN_AND_MEAN

///////////
//Structs//
///////////


//Holds Version info
struct VINFO {
	char VERSION[513]; //Storage of Version
	int length; //Length of Version (for quicker sending)
};

//Version Request crapola
struct VREQUEST {
	//Holds Nick who requested version
	char Nick[61];

	//Time when request occured
	time_t time;
};


///////////
//Defines//
///////////

//String Version info
#define VERSIONINFO "2.05"

//Author info string
#define AUTHORINFO "mIRC On-The-Fly Version Changer v" VERSIONINFO " - Copyright ©2000-2001 danielson, danielson@olynet.com"

//How many seconds it takes to expire
#define mOTFv_EXPIRE_TIME 2

//OKs
#define mOTFv_GENERAL_OK "OK"

//Already loaded
#define mOTFv_ERROR_1 "ERROR 1 mOTFv Already Loaded!"

//Not Loaded
#define mOTFv_ERROR_2 "ERROR 2 mOTFv Not Loaded!"

//Not Marked
#define mOTFv_ERROR_3 "ERROR 3 mOTFv Not Marked!"

//Marked!
#define mOTFv_ERROR_4 "ERROR 4 mOTFv Already Marked!"

//Date Rape Errors//

#define mOTFv_ERROR_100 "ERROR 100 mOTFv Unable to create Session"

#define mOTFv_ERROR_101 "ERROR 101 mOTFv Hooking of one or more functions failed"

////////
//Code//
////////

//Our Dll's Entry Point
int WINAPI DllMain(HINSTANCE hInstance,DWORD dwReason,LPVOID Reserved);

//Our stayloaded function
void StayLoaded();

//Loads the dll
int __stdcall Load(HWND mWnd,HWND aWnd,char *data,char *parms,BOOL Who,BOOL Cares);

//Unloads the dll
int __stdcall Unload(HWND mWnd,HWND aWnd,char *data,char *parms,BOOL Who,BOOL Cares);

//This is how the user will set their version reply
int __stdcall SetVersion(HWND mWnd,HWND aWnd,char *data,char *parms,BOOL Who,BOOL Cares);

//Returns author information
int __stdcall DLLInfo(HWND mWnd,HWND aWnd,char *data,char *parms,BOOL Who,BOOL Cares);

///////////////////
//Clone Functions//
///////////////////

//recv clone
int __stdcall recv_clone(SOCKET s,char FAR *buf,int len, int flags);

//send clone
int __stdcall send_clone(SOCKET s,const char FAR *buf,int len, int flags);

//////////////////////////////
//Node Deallocation Routines//
//////////////////////////////

void MOTFV_REQUEST(PDATA pData);


/////////////////////////
//Text Parsing Routines//
/////////////////////////

//Token Parser//

void Gettok(char *string,char *outstring,char sepchar,int whichTok,int maxlen);

//Robust Line Parser//
bool GetLine(char *string,char *outstring,int whichline);