2016-02-27 10:57:10 +01:00
|
|
|
#ifndef _SQIRC_COMMON_HPP_
|
|
|
|
#define _SQIRC_COMMON_HPP_
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
#include "Base/Utility.hpp"
|
2016-02-27 10:57:10 +01:00
|
|
|
|
2016-04-02 11:49:32 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
#include <libircclient.h>
|
|
|
|
#include <libirc_rfcnumeric.h>
|
2016-04-02 11:49:32 +02:00
|
|
|
|
2016-02-27 10:57:10 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* SOFTWARE INFORMATION
|
|
|
|
*/
|
|
|
|
#define SQIRC_NAME "Squirrel IRC Module"
|
|
|
|
#define SQIRC_AUTHOR "Sandu Liviu Catalin (S.L.C)"
|
2017-02-22 17:26:12 +01:00
|
|
|
#define SQIRC_COPYRIGHT "Copyright (C) 2017 Sandu Liviu Catalin"
|
2016-02-27 10:57:10 +01:00
|
|
|
#define SQIRC_HOST_NAME "SqModIRCHost"
|
|
|
|
#define SQIRC_VERSION 001
|
|
|
|
#define SQIRC_VERSION_STR "0.0.1"
|
|
|
|
#define SQIRC_VERSION_MAJOR 0
|
|
|
|
#define SQIRC_VERSION_MINOR 0
|
|
|
|
#define SQIRC_VERSION_PATCH 1
|
|
|
|
|
2016-05-24 20:36:02 +02:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* Types of events that the session emits.
|
|
|
|
*/
|
|
|
|
enum SessionEvent
|
|
|
|
{
|
|
|
|
SET_CONNECT = 0,
|
|
|
|
SET_NICK,
|
|
|
|
SET_QUIT,
|
|
|
|
SET_JOIN,
|
|
|
|
SET_PART,
|
|
|
|
SET_MODE,
|
|
|
|
SET_UMODE,
|
|
|
|
SET_TOPIC,
|
|
|
|
SET_KICK,
|
|
|
|
SET_CHANNEL,
|
|
|
|
SET_PRIVMSG,
|
|
|
|
SET_NOTICE,
|
|
|
|
SET_CHANNELNOTICE,
|
|
|
|
SET_INVITE,
|
|
|
|
SET_CTCPREQ,
|
|
|
|
SET_CTCPREP,
|
|
|
|
SET_CTCPACTION,
|
|
|
|
SET_UNKNOWN,
|
|
|
|
SET_NUMERIC,
|
|
|
|
SET_DCCCHATREQ,
|
|
|
|
SET_DCCSENDREQ,
|
|
|
|
SET_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Forward declarations.
|
2016-05-24 20:36:02 +02:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
class Session;
|
2016-05-24 20:36:02 +02:00
|
|
|
|
2016-08-16 20:38:04 +02:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* Used by IRC as proxy to allocate memory if the requested size is larger than the common buffer.
|
|
|
|
*/
|
|
|
|
void * IrcAllocMem(size_t n);
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
|
|
|
* Release memory previously allocated with IrcAllocMem, only if necessary. Nasty but we'll try.
|
|
|
|
*/
|
|
|
|
void IrcFreeMem(void * p);
|
|
|
|
|
2016-05-24 20:36:02 +02:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Extract the name from the specified origin.
|
2016-05-24 20:36:02 +02:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
SQInteger GetNick(HSQUIRRELVM vm);
|
2016-05-24 20:36:02 +02:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Extract the host from the specified origin.
|
2016-05-24 20:36:02 +02:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
SQInteger GetHost(HSQUIRRELVM vm);
|
2016-05-24 20:36:02 +02:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Returns a new plain text message with stripped mIRC color codes.
|
2016-05-24 20:36:02 +02:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
SQInteger StripColorFromMIRC(HSQUIRRELVM vm);
|
2016-05-24 20:36:02 +02:00
|
|
|
|
2016-02-27 10:57:10 +01:00
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Returns a new message with converted mIRC color codes and format options.
|
2016-02-27 10:57:10 +01:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
SQInteger ConvertColorFromMIRC(HSQUIRRELVM vm);
|
2016-02-27 10:57:10 +01:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------
|
2016-06-03 20:27:53 +02:00
|
|
|
* Returns a new message with converted color codes and format options.
|
2016-02-27 10:57:10 +01:00
|
|
|
*/
|
2016-06-03 20:27:53 +02:00
|
|
|
SQInteger ConvertColorToMIRC(HSQUIRRELVM vm);
|
2016-02-27 10:57:10 +01:00
|
|
|
|
|
|
|
} // Namespace:: SqMod
|
|
|
|
|
|
|
|
#endif // _SQIRC_COMMON_HPP_
|