2015-11-08 06:26:46 +01:00
|
|
|
#include "Library/IRC.hpp"
|
2015-10-30 14:14:13 +01:00
|
|
|
#include "Core.hpp"
|
2015-10-30 03:17:18 +01:00
|
|
|
#include "Register.hpp"
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
namespace IRC {
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static SQChar g_Buffer[512]{ /* ... */ };
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
irc_callbacks_t Session::s_Callbacks;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool Session::s_Initialized = false;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Session::Session()
|
2015-10-30 03:17:18 +01:00
|
|
|
: m_Session(irc_create_session(GetCallbacks()))
|
2015-11-07 11:17:39 +01:00
|
|
|
, m_Server(_SC(""))
|
|
|
|
, m_Passwd(_SC(""))
|
|
|
|
, m_Nick(_SC(""))
|
|
|
|
, m_User(_SC(""))
|
|
|
|
, m_Name(_SC(""))
|
|
|
|
, m_Port(6667)
|
|
|
|
, m_Tries(3)
|
|
|
|
, m_Wait(5.0f)
|
|
|
|
, m_LeftTries(0)
|
|
|
|
, m_NextTry(0.0f)
|
|
|
|
, m_SessionTime(0.0f)
|
|
|
|
, m_Reconnect(false)
|
|
|
|
, m_IPv6(false)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (!m_Session)
|
|
|
|
{
|
2015-11-11 13:19:45 +01:00
|
|
|
DbgErr("IRC.Session", "constructor", "Unable to create an IRC session");
|
2015-11-01 00:53:51 +01:00
|
|
|
// Explicitly make sure no further calls can be made to this session
|
2015-10-30 03:17:18 +01:00
|
|
|
m_Session = nullptr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-10-30 14:14:13 +01:00
|
|
|
// Associate this wrapper instance with the session structure
|
2015-10-30 03:17:18 +01:00
|
|
|
irc_set_ctx(m_Session, this);
|
2015-10-30 14:14:13 +01:00
|
|
|
// Connect to the on frame event so we can process callbacks
|
|
|
|
_Core->ServerFrame.Connect< Session, &Session::Process >(this);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
2015-11-01 00:53:51 +01:00
|
|
|
// Receive notification when the VM is about to be closed to release object references
|
|
|
|
_Core->VMClose.Connect< Session, &Session::VMClose >(this);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
Session::~Session()
|
|
|
|
{
|
2015-11-01 00:53:51 +01:00
|
|
|
// Make sure there's even a session to release
|
2015-10-30 03:17:18 +01:00
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
2015-10-30 14:14:13 +01:00
|
|
|
irc_set_ctx(m_Session, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
irc_destroy_session(m_Session);
|
2015-10-30 14:14:13 +01:00
|
|
|
m_Session = nullptr;
|
|
|
|
}
|
2015-10-31 20:25:40 +01:00
|
|
|
// Disconnect from the on frame event
|
2015-10-30 14:14:13 +01:00
|
|
|
_Core->ServerFrame.Disconnect< Session, &Session::Process >(this);
|
2015-11-01 00:53:51 +01:00
|
|
|
// Stop receiving notification when the VM is about to be closed
|
|
|
|
_Core->VMClose.Disconnect< Session, &Session::VMClose >(this);
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::Process(SQFloat delta)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
m_SessionTime += delta;
|
2015-10-30 14:14:13 +01:00
|
|
|
// Make sure that the IRC session is connected
|
|
|
|
if (!irc_is_connected(m_Session))
|
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
// Do we meet the condition to attempt to reconnect?
|
|
|
|
if (m_Reconnect && (m_LeftTries != 0) && (m_NextTry <= m_SessionTime))
|
|
|
|
{
|
|
|
|
// Take out one try
|
|
|
|
--m_LeftTries;
|
|
|
|
// Update the timepoint for the next try
|
|
|
|
m_NextTry = (m_SessionTime + m_Wait);
|
|
|
|
// Attempt to reconnect
|
|
|
|
if (m_IPv6)
|
|
|
|
{
|
|
|
|
irc_connect6(m_Session, m_Server.c_str(), m_Port,
|
|
|
|
m_Passwd.empty() ? NULL : m_Passwd.c_str(),
|
|
|
|
m_Nick.c_str(),
|
|
|
|
m_User.empty() ? NULL : m_User.c_str(),
|
|
|
|
m_Name.empty() ? NULL : m_Name.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
irc_connect(m_Session, m_Server.c_str(), m_Port,
|
|
|
|
m_Passwd.empty() ? NULL : m_Passwd.c_str(),
|
|
|
|
m_Nick.c_str(),
|
|
|
|
m_User.empty() ? NULL : m_User.c_str(),
|
|
|
|
m_Name.empty() ? NULL : m_Name.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// We're done for now
|
2015-10-30 14:14:13 +01:00
|
|
|
return;
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
2015-10-30 14:14:13 +01:00
|
|
|
// Create the structures for select()
|
|
|
|
struct timeval tv;
|
|
|
|
fd_set in_set, out_set;
|
|
|
|
int maxfd = 0;
|
2015-11-01 00:53:51 +01:00
|
|
|
// Wait 4 millisecond for events. Meaning each session instance adds 4ms to the frame delta
|
|
|
|
tv.tv_usec = 4000;
|
2015-10-30 14:14:13 +01:00
|
|
|
tv.tv_sec = 0;
|
|
|
|
// Initialize the sets
|
|
|
|
memset(&in_set, 0, sizeof(fd_set));
|
|
|
|
memset(&out_set, 0, sizeof(fd_set));
|
|
|
|
// Add the IRC session descriptors
|
|
|
|
irc_add_select_descriptors(m_Session, &in_set, &out_set, &maxfd);
|
|
|
|
// Call select()
|
|
|
|
if (select(maxfd + 1, &in_set, &out_set, 0, &tv) < 0)
|
|
|
|
{
|
|
|
|
// @TODO: Error
|
|
|
|
LogWrn("Unable to select() on session");
|
|
|
|
}
|
|
|
|
// Call irc_process_select_descriptors() for the session
|
|
|
|
if (irc_process_select_descriptors (m_Session, &in_set, &out_set))
|
|
|
|
{
|
|
|
|
// @TODO: The connection failed, or the server disconnected. Handle it
|
|
|
|
LogWrn("The connection failed, or the server disconnected.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::VMClose()
|
2015-11-01 00:53:51 +01:00
|
|
|
{
|
|
|
|
// Release the reference to the specified callback
|
|
|
|
m_OnConnect.Release2();
|
|
|
|
m_OnNick.Release2();
|
|
|
|
m_OnQuit.Release2();
|
|
|
|
m_OnJoin.Release2();
|
|
|
|
m_OnPart.Release2();
|
|
|
|
m_OnMode.Release2();
|
|
|
|
m_OnUmode.Release2();
|
|
|
|
m_OnTopic.Release2();
|
|
|
|
m_OnKick.Release2();
|
|
|
|
m_OnChannel.Release2();
|
|
|
|
m_OnPrivMSG.Release2();
|
|
|
|
m_OnNotice.Release2();
|
|
|
|
m_OnChannel_Notice.Release2();
|
|
|
|
m_OnInvite.Release2();
|
|
|
|
m_OnCTCP_Req.Release2();
|
|
|
|
m_OnCTCP_Rep.Release2();
|
|
|
|
m_OnCTCP_Action.Release2();
|
|
|
|
m_OnUnknown.Release2();
|
|
|
|
m_OnNumeric.Release2();
|
|
|
|
m_OnDcc_Chat_Req.Release2();
|
|
|
|
m_OnDcc_Send_Req.Release2();
|
|
|
|
// Release the reference to the specified user data
|
|
|
|
m_Data.Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
irc_callbacks_t * Session::GetCallbacks()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
// See if the callbacks structure was initialized before
|
|
|
|
if (!s_Initialized)
|
|
|
|
{
|
|
|
|
// Initialize the callbacks
|
|
|
|
s_Callbacks.event_connect = &OnConnect;
|
|
|
|
s_Callbacks.event_nick = &OnNick;
|
|
|
|
s_Callbacks.event_quit = &OnQuit;
|
|
|
|
s_Callbacks.event_join = &OnJoin;
|
|
|
|
s_Callbacks.event_part = &OnPart;
|
|
|
|
s_Callbacks.event_mode = &OnMode;
|
|
|
|
s_Callbacks.event_umode = &OnUmode;
|
|
|
|
s_Callbacks.event_topic = &OnTopic;
|
|
|
|
s_Callbacks.event_kick = &OnKick;
|
|
|
|
s_Callbacks.event_channel = &OnChannel;
|
|
|
|
s_Callbacks.event_privmsg = &OnPrivMSG;
|
|
|
|
s_Callbacks.event_notice = &OnNotice;
|
|
|
|
s_Callbacks.event_channel_notice = &OnChannel_Notice;
|
|
|
|
s_Callbacks.event_invite = &OnInvite;
|
|
|
|
s_Callbacks.event_ctcp_req = &OnCTCP_Req;
|
|
|
|
s_Callbacks.event_ctcp_rep = &OnCTCP_Rep;
|
|
|
|
s_Callbacks.event_ctcp_action = &OnCTCP_Action;
|
|
|
|
s_Callbacks.event_unknown = &OnUnknown;
|
|
|
|
s_Callbacks.event_numeric = &OnNumeric;
|
|
|
|
s_Callbacks.event_dcc_chat_req = &OnDcc_Chat_Req;
|
|
|
|
s_Callbacks.event_dcc_send_req = &OnDcc_Send_Req;
|
|
|
|
// Specify that the callbacks were initialized
|
|
|
|
s_Initialized = true;
|
|
|
|
}
|
|
|
|
// Return the callbacks structure
|
|
|
|
return &s_Callbacks;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-04 19:58:05 +01:00
|
|
|
void Session::ForwardEvent(Session * session, Function & listener, const char * event,
|
|
|
|
const char * origin, const char ** params, unsigned int count)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
// Is there anyone even listening to this event?
|
2015-10-30 03:17:18 +01:00
|
|
|
if (listener.IsNull())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-11-04 19:58:05 +01:00
|
|
|
// Each event must have an array of parameters (empty or not)
|
2015-10-30 03:17:18 +01:00
|
|
|
Array parameters(DefaultVM::Get(), count);
|
2015-11-04 19:58:05 +01:00
|
|
|
// Are the any parameters?
|
2015-10-30 03:17:18 +01:00
|
|
|
if (params && count > 0)
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
// Transofrm the parameters into a squirrel array
|
2015-10-30 03:17:18 +01:00
|
|
|
for (unsigned int i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
parameters.SetValue(i, params[i]);
|
|
|
|
}
|
|
|
|
}
|
2015-11-04 19:58:05 +01:00
|
|
|
// Obtain an object to this session instance without creating a new reference counter!
|
|
|
|
ClassType< Session >::PushInstance(DefaultVM::Get(), session);
|
|
|
|
// Obtain the pushed object from the stack
|
|
|
|
Var< Object > var(DefaultVM::Get(), -1);
|
|
|
|
// Call the event with the obtaine values
|
|
|
|
listener.Execute< Object &, const SQChar *, const SQChar *, Array >(var.value, event,
|
|
|
|
origin ? origin : _SC(""), parameters);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-04 19:58:05 +01:00
|
|
|
void Session::ForwardEvent(Session * session, Function & listener, unsigned int event,
|
|
|
|
const char * origin, const char ** params, unsigned int count)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
// Is there anyone even listening to this event?
|
2015-10-30 03:17:18 +01:00
|
|
|
if (listener.IsNull())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2015-11-04 19:58:05 +01:00
|
|
|
// Each event must have an array of parameters (empty or not)
|
2015-10-30 03:17:18 +01:00
|
|
|
Array parameters(DefaultVM::Get(), count);
|
2015-11-04 19:58:05 +01:00
|
|
|
// Are the any parameters?
|
2015-10-30 03:17:18 +01:00
|
|
|
if (params && count > 0)
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
// Transofrm the parameters into a squirrel array
|
2015-10-30 03:17:18 +01:00
|
|
|
for (unsigned int i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
parameters.SetValue(i, params[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-04 19:58:05 +01:00
|
|
|
// Obtain an object to this session instance without creating a new reference counter!
|
|
|
|
ClassType< Session >::PushInstance(DefaultVM::Get(), session);
|
|
|
|
// Obtain the pushed object from the stack
|
|
|
|
Var< Object > var(DefaultVM::Get(), -1);
|
|
|
|
// Call the event with the obtaine values
|
|
|
|
listener.Execute< Object &, unsigned int, const SQChar *, Array >(var.value, event,
|
|
|
|
origin ? origin : _SC(""), parameters);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-04 19:58:05 +01:00
|
|
|
void Session::ForwardEvent(Session * session, Function & listener, const char * nick,
|
|
|
|
const char * addr, irc_dcc_t dccid)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
SQMOD_UNUSED_VAR(session);
|
2015-11-01 04:36:03 +01:00
|
|
|
SQMOD_UNUSED_VAR(listener);
|
|
|
|
SQMOD_UNUSED_VAR(nick);
|
|
|
|
SQMOD_UNUSED_VAR(addr);
|
|
|
|
SQMOD_UNUSED_VAR(dccid);
|
2015-10-30 03:17:18 +01:00
|
|
|
/* @TODO: Implement! */
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-04 19:58:05 +01:00
|
|
|
void Session::ForwardEvent(Session * session, Function & listener, const char * nick, const char * addr,
|
|
|
|
const char * filename, unsigned long size, irc_dcc_t dccid)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
SQMOD_UNUSED_VAR(session);
|
2015-11-01 04:36:03 +01:00
|
|
|
SQMOD_UNUSED_VAR(listener);
|
|
|
|
SQMOD_UNUSED_VAR(nick);
|
|
|
|
SQMOD_UNUSED_VAR(addr);
|
|
|
|
SQMOD_UNUSED_VAR(filename);
|
|
|
|
SQMOD_UNUSED_VAR(size);
|
|
|
|
SQMOD_UNUSED_VAR(dccid);
|
2015-10-30 03:17:18 +01:00
|
|
|
/* @TODO: Implement! */
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::Cmp(const Session & o) const
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session == o.m_Session)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (m_Session > o.m_Session)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * Session::ToString() const
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return _SC("");
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * Session::GetTag() const
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_Tag.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetTag(const SQChar * tag)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_Tag.assign(tag);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SqObj & Session::GetData()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_Data;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetData(SqObj & data)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_Data = data;
|
|
|
|
}
|
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const SQChar * Session::GetServer() const
|
|
|
|
{
|
|
|
|
return m_Server.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetServer(const SQChar * server)
|
|
|
|
{
|
|
|
|
m_Server.assign(server);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const SQChar * Session::GetPassword() const
|
|
|
|
{
|
|
|
|
return m_Passwd.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetPassword(const SQChar * passwd)
|
|
|
|
{
|
|
|
|
m_Passwd.assign(passwd);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const SQChar * Session::GetNick() const
|
|
|
|
{
|
|
|
|
return m_Nick.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetNick(const SQChar * nick)
|
|
|
|
{
|
|
|
|
m_Nick.assign(nick);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const SQChar * Session::GetUser() const
|
|
|
|
{
|
|
|
|
return m_User.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetUser(const SQChar * user)
|
|
|
|
{
|
|
|
|
m_User.assign(user);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const SQChar * Session::GetName() const
|
|
|
|
{
|
|
|
|
return m_Name.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetName(const SQChar * name)
|
|
|
|
{
|
|
|
|
m_Name.assign(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQUint32 Session::GetPort() const
|
|
|
|
{
|
|
|
|
return m_Port;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetPort(SQUint32 port)
|
|
|
|
{
|
|
|
|
m_Port = port > _NLMAX(Uint16) ? _NLMAX(Uint16) : port;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQUint32 Session::GetTries() const
|
|
|
|
{
|
|
|
|
return m_Tries;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetTries(SQUint32 num)
|
|
|
|
{
|
|
|
|
if (m_Tries < num)
|
|
|
|
{
|
|
|
|
m_LeftTries += (num - m_Tries);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_LeftTries -= (m_Tries - num);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_Tries = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat Session::GetWait() const
|
|
|
|
{
|
|
|
|
return m_Wait;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetWait(SQFloat time)
|
|
|
|
{
|
|
|
|
m_Wait = time;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQUint32 Session::GetLeftTries() const
|
|
|
|
{
|
|
|
|
return m_LeftTries;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetLeftTries(SQUint32 num)
|
|
|
|
{
|
|
|
|
m_LeftTries = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat Session::GetNextTry() const
|
|
|
|
{
|
|
|
|
return m_NextTry;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::SetNextTry(SQFloat time)
|
|
|
|
{
|
|
|
|
m_NextTry = time;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat Session::GetSessionTime() const
|
|
|
|
{
|
|
|
|
return m_SessionTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool Session::GetReconnect() const
|
|
|
|
{
|
|
|
|
return m_Reconnect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
bool Session::GetIPv6() const
|
|
|
|
{
|
|
|
|
return m_IPv6;
|
|
|
|
}
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnConnect()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnConnect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnConnect(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnConnect = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnConnect_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnConnect = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnNick()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnNick;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNick(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnNick = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNick_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnNick = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnQuit()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnQuit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnQuit(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnQuit = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnQuit_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnQuit = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnJoin()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnJoin;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnJoin(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnJoin = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnJoin_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnJoin = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnPart()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnPart(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnPart = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnPart_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnPart = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnMode()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnMode(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnMode = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnMode_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnMode = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnUmode()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnUmode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnUmode(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnUmode = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnUmode_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnUmode = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnTopic()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnTopic;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnTopic(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnTopic = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnTopic_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnTopic = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnKick()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnKick;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnKick(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnKick = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnKick_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnKick = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnChannel()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnChannel(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnChannel = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnChannel_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnChannel = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnPrivMSG()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnPrivMSG;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnPrivMSG(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnPrivMSG = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnPrivMSG_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnPrivMSG = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnNotice()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnNotice;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNotice(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnNotice = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNotice_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnNotice = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnChannel_Notice()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnChannel_Notice;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnChannel_Notice(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnChannel_Notice = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnChannel_Notice_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnChannel_Notice = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnInvite()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnInvite;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnInvite(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnInvite = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnInvite_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnInvite = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnCTCP_Req()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnCTCP_Req;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Req(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Req = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Req_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Req = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnCTCP_Rep()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnCTCP_Rep;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Rep(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Rep = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Rep_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Rep = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnCTCP_Action()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnCTCP_Action;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Action(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Action = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnCTCP_Action_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnCTCP_Action = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnUnknown()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnUnknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnUnknown(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnUnknown = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnUnknown_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnUnknown = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnNumeric()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnNumeric;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNumeric(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnNumeric = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnNumeric_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnNumeric = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnDcc_Chat_Req()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnDcc_Chat_Req;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnDcc_Chat_Req(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnDcc_Chat_Req = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnDcc_Chat_Req_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnDcc_Chat_Req = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
Function Session::GetOnDcc_Send_Req()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return m_OnDcc_Send_Req;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnDcc_Send_Req(Function & func)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
m_OnDcc_Send_Req = func;
|
|
|
|
}
|
|
|
|
|
2015-10-30 14:14:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOnDcc_Send_Req_Env(SqObj & env, Function & func)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
m_OnDcc_Send_Req = Function(env.GetVM(), env, func.GetFunc());
|
|
|
|
}
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool Session::IsValid() const
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
return (m_Session != nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-07 11:17:39 +01:00
|
|
|
SQInt32 Session::Connect()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
if (m_Session != nullptr && !irc_is_connected(m_Session) && !m_Server.empty() && !m_Nick.empty())
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
// Enable the reconnection system
|
|
|
|
m_Reconnect = true;
|
|
|
|
m_LeftTries = m_Tries;
|
|
|
|
m_NextTry = (m_SessionTime + m_Wait);
|
|
|
|
// This is not an IPv6 connection
|
|
|
|
m_IPv6 = false;
|
|
|
|
// Attempt to connect
|
|
|
|
return irc_connect(m_Session, m_Server.c_str(), m_Port,
|
|
|
|
m_Passwd.empty() ? NULL : m_Passwd.c_str(),
|
|
|
|
m_Nick.c_str(),
|
|
|
|
m_User.empty() ? NULL : m_User.c_str(),
|
|
|
|
m_Name.empty() ? NULL : m_Name.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else if (irc_is_connected(m_Session))
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect", "connect to server", "while session is already connected");
|
2015-11-07 11:17:39 +01:00
|
|
|
}
|
|
|
|
else if (m_Server.empty())
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Error("connect", "connect to server", "without specifying a server");
|
2015-11-07 11:17:39 +01:00
|
|
|
}
|
|
|
|
else if (m_Nick.empty())
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Error("connect", "connect to server", "without specifying a nickname");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("connect", "connect to server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-07 11:17:39 +01:00
|
|
|
SQInt32 Session::Connect(const SQChar * server, SQUint32 port, const SQChar * nick)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return Connect(server, port, NULL, nick, NULL, NULL);
|
|
|
|
}
|
2015-10-30 03:17:18 +01:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd)
|
|
|
|
{
|
|
|
|
return Connect(server, port, passwd, nick, NULL, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd,
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * username)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return Connect(server, port, passwd, nick, username, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd,
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * username, const SQChar * realname)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
if (m_Session != nullptr && !irc_is_connected(m_Session))
|
|
|
|
{
|
|
|
|
// Save information
|
|
|
|
SetServer(server == NULL ? _SC("") : server);
|
|
|
|
SetPort(port);
|
|
|
|
SetPassword(passwd == NULL ? _SC("") : passwd);
|
|
|
|
SetNick(nick == NULL ? _SC("") : nick);
|
|
|
|
SetUser(username == NULL ? _SC("") : username);
|
|
|
|
SetName(realname == NULL ? _SC("") : realname);
|
|
|
|
// Enable the reconnection system
|
|
|
|
m_Reconnect = true;
|
|
|
|
m_LeftTries = m_Tries;
|
|
|
|
m_NextTry = (m_SessionTime + m_Wait);
|
|
|
|
// This is not an IPv6 connection
|
|
|
|
m_IPv6 = false;
|
|
|
|
// Attempt to connect
|
|
|
|
return irc_connect(m_Session, server, m_Port, passwd, nick, username, realname);
|
|
|
|
}
|
|
|
|
else if (irc_is_connected(m_Session))
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect", "connect to server", "while session is already connected");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("connect", "connect to server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-07 11:17:39 +01:00
|
|
|
SQInt32 Session::Connect6()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
if (m_Session != nullptr && !irc_is_connected(m_Session) && !m_Server.empty() && !m_Nick.empty())
|
|
|
|
{
|
|
|
|
// Enable the reconnection system
|
|
|
|
m_Reconnect = true;
|
|
|
|
m_LeftTries = m_Tries;
|
|
|
|
m_NextTry = (m_SessionTime + m_Wait);
|
|
|
|
// This is an IPv6 connection
|
|
|
|
m_IPv6 = true;
|
|
|
|
// Attempt to connect
|
|
|
|
return irc_connect6(m_Session, m_Server.c_str(), m_Port,
|
|
|
|
m_Passwd.empty() ? NULL : m_Passwd.c_str(),
|
|
|
|
m_Nick.c_str(),
|
|
|
|
m_User.empty() ? NULL : m_User.c_str(),
|
|
|
|
m_Name.empty() ? NULL : m_Name.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else if (irc_is_connected(m_Session))
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect6", "connect to server", "while session is already connected");
|
2015-11-07 11:17:39 +01:00
|
|
|
}
|
|
|
|
else if (m_Server.empty())
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect6", "connect to server", "without specifying a server");
|
2015-11-07 11:17:39 +01:00
|
|
|
}
|
|
|
|
else if (m_Nick.empty())
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect6", "connect to server", "without specifying a nickname");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("connect6", "connect to server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-07 11:17:39 +01:00
|
|
|
SQInt32 Session::Connect6(const SQChar * server, SQUint32 port, const SQChar * nick)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return Connect6(server, port, NULL, nick, NULL, NULL);
|
|
|
|
}
|
2015-10-30 03:17:18 +01:00
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect6(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd)
|
|
|
|
{
|
|
|
|
return Connect6(server, port, passwd, nick, NULL, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect6(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd,
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * username)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return Connect6(server, port, passwd, nick, username, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 Session::Connect6(const SQChar * server, SQUint32 port, const SQChar * nick, const SQChar * passwd,
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * username, const SQChar * realname)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
if (m_Session != nullptr && !irc_is_connected(m_Session))
|
|
|
|
{
|
|
|
|
// Save infomation
|
|
|
|
SetServer(server == NULL ? _SC("") : server);
|
|
|
|
SetPort(port);
|
|
|
|
SetPassword(passwd == NULL ? _SC("") : passwd);
|
|
|
|
SetNick(nick == NULL ? _SC("") : nick);
|
|
|
|
SetUser(username == NULL ? _SC("") : username);
|
|
|
|
SetName(realname == NULL ? _SC("") : realname);
|
|
|
|
// Enable the reconnection system
|
|
|
|
m_Reconnect = true;
|
|
|
|
m_LeftTries = m_Tries;
|
|
|
|
m_NextTry = (m_SessionTime + m_Wait);
|
|
|
|
// This is an IPv6 connection
|
|
|
|
m_IPv6 = true;
|
|
|
|
// Attempt to connect
|
|
|
|
return irc_connect6(m_Session, server, m_Port, passwd, nick, username, realname);
|
|
|
|
}
|
|
|
|
else if (irc_is_connected(m_Session))
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Issue("connect6", "connect to server", "while session is already connected");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("connect6", "connect to server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::Disconnect()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
// Disable the reconnection system
|
|
|
|
m_Reconnect = false;
|
|
|
|
// Attempt to disconnect
|
2015-10-30 03:17:18 +01:00
|
|
|
irc_disconnect(m_Session);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("disconnect", "disconnect from server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
bool Session::IsConnected()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return (irc_is_connected(m_Session) > 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("@connected", "see whether is connected");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdJoin(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdJoin(channel, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdJoin(const SQChar * channel, const SQChar * key)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_join(m_Session, channel, key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_join", "join channel");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdPart(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_part(m_Session, channel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_part", "part channel");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdInvite(const SQChar * nick, const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_invite(m_Session, nick, channel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_invite", "invite onto channel");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdNames(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_names(m_Session, channel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_names", "get channel names list");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdList()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdList(NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdList(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_list(m_Session, channel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_list", "get active channel list");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdTopic(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return (channel, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdTopic(const SQChar * channel, const SQChar * topic)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_topic(m_Session, channel, topic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_topic", "set channel topic");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdChannelMode(const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdChannelMode(channel, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdChannelMode(const SQChar * channel, const SQChar * mode)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_channel_mode(m_Session, channel, mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_channel_mode", "set channel mode");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdUserMode()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdUserMode(NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdUserMode(const SQChar * mode)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_user_mode(m_Session, mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_user_mode", "set user mode");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdKick(const SQChar * nick, const SQChar * channel)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdKick(nick, channel, NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdKick(const SQChar * nick, const SQChar * channel, const SQChar * reason)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_kick(m_Session, nick, channel, reason);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_kick", "kick from channel");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdMsg(const SQChar * nch, const SQChar * text)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_msg(m_Session, nch, text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_msg", "send message");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdMe(const SQChar * nch, const SQChar * text)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_me(m_Session, nch, text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_me", "send me message");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdNotice(const SQChar * nch, const SQChar * text)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_notice(m_Session, nch, text);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_notice", "send notice message");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdCtcpRequest(const SQChar * nick, const SQChar * request)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_notice(m_Session, nick, request);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_ctcp_request", "send ctcp request");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdCtcpReply(const SQChar * nick, const SQChar * reply)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_ctcp_reply(m_Session, nick, reply);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_ctcp_reply", "send ctcp reply");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdNick(const SQChar * nick)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_nick(m_Session, nick);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_nick", "change nick");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdWhois(const SQChar * nick)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_whois(m_Session, nick);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_whois", "request whois");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdQuit()
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
|
2015-11-07 11:17:39 +01:00
|
|
|
return CmdQuit(NULL);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::CmdQuit(const SQChar * reason)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_cmd_quit(m_Session, reason);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("cmd_quit", "quit server");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::SendRaw(const SQChar * str)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_send_raw(m_Session, str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("send_raw", "send raw data");
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2015-10-30 14:14:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::DestroyDcc(SQUint32 dccid)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_dcc_destroy(m_Session, dccid);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("destroy_dcc", "destroy dcc");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetCtcpVersion(const SQChar * version)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
irc_set_ctcp_version(m_Session, version);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("set_ctcp_version", "set ctcp version");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
SQInt32 Session::GetErrNo()
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_errno(m_Session);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("@err_no", "get error number");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * Session::GetErrStr()
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_strerror(irc_errno(m_Session));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("@err_str", "get error string");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
return _SC("");
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::SetOption(SQUint32 option)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_option_set(m_Session, option);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("set_option", "set option");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
void Session::ResetOption(SQUint32 option)
|
2015-10-30 14:14:13 +01:00
|
|
|
{
|
|
|
|
if (m_Session != nullptr)
|
|
|
|
{
|
|
|
|
return irc_option_set(m_Session, option);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-12 19:16:07 +01:00
|
|
|
_Handle("reset_option", "reset option");
|
2015-10-30 14:14:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnConnect(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-07 11:17:39 +01:00
|
|
|
// Prevent any attempts to reconnect now
|
|
|
|
inst->m_Reconnect = false;
|
|
|
|
// Now forward event
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnConnect, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnNick(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnNick, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnQuit(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnQuit, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnJoin(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnJoin, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnPart(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnPart, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnMode(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnMode, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnUmode(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnUmode, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnTopic(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnTopic, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnKick(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnKick, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnChannel(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnChannel, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnPrivMSG(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnPrivMSG, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnNotice(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnNotice, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnChannel_Notice(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnChannel_Notice, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnInvite(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnInvite, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnCTCP_Req(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnCTCP_Req, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnCTCP_Rep(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnCTCP_Rep, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnCTCP_Action(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnCTCP_Action, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnUnknown(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnUnknown, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnNumeric(irc_session_t * session, unsigned int event, const char * origin, const char ** params, unsigned int count)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnNumeric, event, origin, params, count);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnDcc_Chat_Req(irc_session_t * session, const char * nick, const char * addr, irc_dcc_t dccid)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnDcc_Chat_Req, nick, addr, dccid);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void Session::OnDcc_Send_Req(irc_session_t * session, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid)
|
|
|
|
{
|
|
|
|
Session * inst = reinterpret_cast< Session * >(irc_get_ctx(session));
|
|
|
|
|
|
|
|
if (!inst)
|
|
|
|
{
|
|
|
|
LogErr("Cannot forward IRC event without a session container");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-04 19:58:05 +01:00
|
|
|
ForwardEvent(inst, inst->m_OnDcc_Send_Req, nick, addr, filename, size, dccid);
|
2015-10-30 03:17:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * GetNick(const SQChar * origin)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the nickname
|
2015-11-07 11:17:39 +01:00
|
|
|
irc_target_get_nick(origin, g_Buffer, sizeof(g_Buffer));
|
2015-10-30 03:17:18 +01:00
|
|
|
// Return the nickname that could be retrieved
|
|
|
|
return g_Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-11-01 04:48:01 +01:00
|
|
|
const SQChar * GetHost(const SQChar * target)
|
2015-10-30 03:17:18 +01:00
|
|
|
{
|
|
|
|
// Attempt to retrieve the nickname
|
2015-11-07 11:17:39 +01:00
|
|
|
irc_target_get_host(target, g_Buffer, sizeof(g_Buffer));
|
2015-10-30 03:17:18 +01:00
|
|
|
// Return the nickname that could be retrieved
|
|
|
|
return g_Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // Namespace:: IRC
|
|
|
|
|
|
|
|
// ================================================================================================
|
|
|
|
bool Register_IRC(HSQUIRRELVM vm)
|
|
|
|
{
|
|
|
|
using namespace IRC;
|
2015-11-03 03:20:53 +01:00
|
|
|
|
|
|
|
// // Attempt to create the IRC namespace
|
|
|
|
Sqrat::Table ircns(vm);
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// Output debugging information
|
2015-10-30 14:14:13 +01:00
|
|
|
LogDbg("Beginning registration of <IRC Session> type");
|
2015-10-30 03:17:18 +01:00
|
|
|
// Attempt to register the specified type
|
2015-11-03 03:20:53 +01:00
|
|
|
ircns.Bind(_SC("Session"), Sqrat::Class< Session, NoCopy< Session > >(vm, _SC("Session"))
|
2015-10-30 03:17:18 +01:00
|
|
|
/* Constructors */
|
2015-11-03 03:20:53 +01:00
|
|
|
.Ctor()
|
2015-10-30 03:17:18 +01:00
|
|
|
/* Metamethods */
|
|
|
|
.Func(_SC("_cmp"), &Session::Cmp)
|
|
|
|
.Func(_SC("_tostring"), &Session::ToString)
|
|
|
|
/* Properties */
|
|
|
|
.Prop(_SC("ltag"), &Session::GetTag, &Session::SetTag)
|
|
|
|
.Prop(_SC("ldata"), &Session::GetData, &Session::SetData)
|
2015-11-07 11:17:39 +01:00
|
|
|
.Prop(_SC("server"), &Session::GetData, &Session::SetData)
|
|
|
|
.Prop(_SC("server"), &Session::GetServer, &Session::SetServer)
|
|
|
|
.Prop(_SC("passwd"), &Session::GetPassword, &Session::SetPassword)
|
|
|
|
.Prop(_SC("nick"), &Session::GetNick, &Session::SetNick)
|
|
|
|
.Prop(_SC("user"), &Session::GetUser, &Session::SetUser)
|
|
|
|
.Prop(_SC("name"), &Session::GetName, &Session::SetName)
|
|
|
|
.Prop(_SC("port"), &Session::GetPort, &Session::SetPort)
|
|
|
|
.Prop(_SC("tries"), &Session::GetTries, &Session::SetTries)
|
|
|
|
.Prop(_SC("wait"), &Session::GetWait, &Session::SetWait)
|
|
|
|
.Prop(_SC("left_tries"), &Session::GetLeftTries, &Session::SetLeftTries)
|
|
|
|
.Prop(_SC("next_try"), &Session::GetNextTry, &Session::SetNextTry)
|
|
|
|
.Prop(_SC("session_time"), &Session::GetSessionTime)
|
|
|
|
.Prop(_SC("reconnect"), &Session::GetReconnect)
|
|
|
|
.Prop(_SC("ipv6"), &Session::GetIPv6)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Prop(_SC("on_connect"), &Session::GetOnConnect, &Session::SetOnConnect)
|
|
|
|
.Prop(_SC("on_nick"), &Session::GetOnNick, &Session::SetOnNick)
|
|
|
|
.Prop(_SC("on_quit"), &Session::GetOnQuit, &Session::SetOnQuit)
|
|
|
|
.Prop(_SC("on_join"), &Session::GetOnJoin, &Session::SetOnJoin)
|
|
|
|
.Prop(_SC("on_part"), &Session::GetOnPart, &Session::SetOnPart)
|
|
|
|
.Prop(_SC("on_mode"), &Session::GetOnMode, &Session::SetOnMode)
|
|
|
|
.Prop(_SC("on_umode"), &Session::GetOnUmode, &Session::SetOnUmode)
|
|
|
|
.Prop(_SC("on_topic"), &Session::GetOnTopic, &Session::SetOnTopic)
|
|
|
|
.Prop(_SC("on_kick"), &Session::GetOnKick, &Session::SetOnKick)
|
|
|
|
.Prop(_SC("on_channel"), &Session::GetOnChannel, &Session::SetOnChannel)
|
|
|
|
.Prop(_SC("on_priv_msg"), &Session::GetOnPrivMSG, &Session::SetOnPrivMSG)
|
|
|
|
.Prop(_SC("on_notice"), &Session::GetOnNotice, &Session::SetOnNotice)
|
|
|
|
.Prop(_SC("on_channel_notice"), &Session::GetOnChannel_Notice, &Session::SetOnChannel_Notice)
|
|
|
|
.Prop(_SC("on_invite"), &Session::GetOnInvite, &Session::SetOnInvite)
|
|
|
|
.Prop(_SC("on_ctcp_req"), &Session::GetOnCTCP_Req, &Session::SetOnCTCP_Req)
|
|
|
|
.Prop(_SC("on_ctcp_rep"), &Session::GetOnCTCP_Rep, &Session::SetOnCTCP_Rep)
|
|
|
|
.Prop(_SC("on_ctcp_action"), &Session::GetOnCTCP_Action, &Session::SetOnCTCP_Action)
|
|
|
|
.Prop(_SC("on_unknown"), &Session::GetOnUnknown, &Session::SetOnUnknown)
|
|
|
|
.Prop(_SC("on_numeric"), &Session::GetOnNumeric, &Session::SetOnNumeric)
|
|
|
|
.Prop(_SC("on_dcc_chat_req"), &Session::GetOnDcc_Chat_Req, &Session::SetOnDcc_Chat_Req)
|
|
|
|
.Prop(_SC("on_dcc_send_req"), &Session::GetOnDcc_Send_Req, &Session::SetOnDcc_Send_Req)
|
|
|
|
.Prop(_SC("connected"), &Session::IsConnected)
|
2015-10-30 14:14:13 +01:00
|
|
|
.Prop(_SC("err_no"), &Session::GetErrNo)
|
|
|
|
.Prop(_SC("err_str"), &Session::GetErrStr)
|
|
|
|
.Prop(_SC("ctcp_version"), &Session::SetCtcpVersion)
|
2015-10-30 03:17:18 +01:00
|
|
|
/* Functions */
|
2015-10-30 14:14:13 +01:00
|
|
|
.Func(_SC("get_on_connect"), &Session::GetOnConnect)
|
|
|
|
.Func(_SC("get_on_nick"), &Session::GetOnNick)
|
|
|
|
.Func(_SC("get_on_quit"), &Session::GetOnQuit)
|
|
|
|
.Func(_SC("get_on_join"), &Session::GetOnJoin)
|
|
|
|
.Func(_SC("get_on_part"), &Session::GetOnPart)
|
|
|
|
.Func(_SC("get_on_mode"), &Session::GetOnMode)
|
|
|
|
.Func(_SC("get_on_umode"), &Session::GetOnUmode)
|
|
|
|
.Func(_SC("get_on_topic"), &Session::GetOnTopic)
|
|
|
|
.Func(_SC("get_on_kick"), &Session::GetOnKick)
|
|
|
|
.Func(_SC("get_on_channel"), &Session::GetOnChannel)
|
|
|
|
.Func(_SC("get_on_priv_msg"), &Session::GetOnPrivMSG)
|
|
|
|
.Func(_SC("get_on_notice"), &Session::GetOnNotice)
|
|
|
|
.Func(_SC("get_on_channel_notice"), &Session::GetOnChannel_Notice)
|
|
|
|
.Func(_SC("get_on_invite"), &Session::GetOnInvite)
|
|
|
|
.Func(_SC("get_on_ctcp_req"), &Session::GetOnCTCP_Req)
|
|
|
|
.Func(_SC("get_on_ctcp_rep"), &Session::GetOnCTCP_Rep)
|
|
|
|
.Func(_SC("get_on_ctcp_action"), &Session::GetOnCTCP_Action)
|
|
|
|
.Func(_SC("get_on_unknown"), &Session::GetOnUnknown)
|
|
|
|
.Func(_SC("get_on_numeric"), &Session::GetOnNumeric)
|
|
|
|
.Func(_SC("get_on_dcc_chat_req"), &Session::GetOnDcc_Chat_Req)
|
|
|
|
.Func(_SC("get_on_dcc_send_req"), &Session::GetOnDcc_Send_Req)
|
|
|
|
.Func(_SC("set_on_connect"), &Session::SetOnConnect_Env)
|
|
|
|
.Func(_SC("set_on_nick"), &Session::SetOnNick_Env)
|
|
|
|
.Func(_SC("set_on_quit"), &Session::SetOnQuit_Env)
|
|
|
|
.Func(_SC("set_on_join"), &Session::SetOnJoin_Env)
|
|
|
|
.Func(_SC("set_on_part"), &Session::SetOnPart_Env)
|
|
|
|
.Func(_SC("set_on_mode"), &Session::SetOnMode_Env)
|
|
|
|
.Func(_SC("set_on_umode"), &Session::SetOnUmode_Env)
|
|
|
|
.Func(_SC("set_on_topic"), &Session::SetOnTopic_Env)
|
|
|
|
.Func(_SC("set_on_kick"), &Session::SetOnKick_Env)
|
|
|
|
.Func(_SC("set_on_channel"), &Session::SetOnChannel_Env)
|
|
|
|
.Func(_SC("set_on_priv_msg"), &Session::SetOnPrivMSG_Env)
|
|
|
|
.Func(_SC("set_on_notice"), &Session::SetOnNotice_Env)
|
|
|
|
.Func(_SC("set_on_channel_notice"), &Session::SetOnChannel_Notice_Env)
|
|
|
|
.Func(_SC("set_on_invite"), &Session::SetOnInvite_Env)
|
|
|
|
.Func(_SC("set_on_ctcp_req"), &Session::SetOnCTCP_Req_Env)
|
|
|
|
.Func(_SC("set_on_ctcp_rep"), &Session::SetOnCTCP_Rep_Env)
|
|
|
|
.Func(_SC("set_on_ctcp_action"), &Session::SetOnCTCP_Action_Env)
|
|
|
|
.Func(_SC("set_on_unknown"), &Session::SetOnUnknown_Env)
|
|
|
|
.Func(_SC("set_on_numeric"), &Session::SetOnNumeric_Env)
|
|
|
|
.Func(_SC("set_on_dcc_chat_req"), &Session::SetOnDcc_Chat_Req_Env)
|
|
|
|
.Func(_SC("set_on_dcc_send_req"), &Session::SetOnDcc_Send_Req_Env)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Func(_SC("disconnect"), &Session::Disconnect)
|
|
|
|
.Func(_SC("cmd_part"), &Session::CmdPart)
|
|
|
|
.Func(_SC("cmd_invite"), &Session::CmdInvite)
|
|
|
|
.Func(_SC("cmd_names"), &Session::CmdNames)
|
|
|
|
.Func(_SC("cmd_msg"), &Session::CmdMsg)
|
|
|
|
.Func(_SC("cmd_me"), &Session::CmdMe)
|
|
|
|
.Func(_SC("cmd_notice"), &Session::CmdNotice)
|
|
|
|
.Func(_SC("cmd_ctcp_request"), &Session::CmdCtcpRequest)
|
|
|
|
.Func(_SC("cmd_ctcp_reply"), &Session::CmdCtcpReply)
|
|
|
|
.Func(_SC("cmd_nick"), &Session::CmdNick)
|
|
|
|
.Func(_SC("cmd_whois"), &Session::CmdWhois)
|
2015-11-11 13:19:45 +01:00
|
|
|
.Func(_SC("send_raw"), &Session::SendRaw)
|
2015-10-30 14:14:13 +01:00
|
|
|
.Func(_SC("destroy_dcc"), &Session::DestroyDcc)
|
|
|
|
.Func(_SC("set_ctcp_version"), &Session::SetCtcpVersion)
|
|
|
|
.Func(_SC("set_option"), &Session::SetOption)
|
|
|
|
.Func(_SC("reset_option"), &Session::ResetOption)
|
2015-10-30 03:17:18 +01:00
|
|
|
/* Overloads */
|
2015-11-07 11:17:39 +01:00
|
|
|
.Overload< SQInt32 (Session::*)(void) >
|
|
|
|
(_SC("connect"), &Session::Connect)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *) >
|
|
|
|
(_SC("connect"), &Session::Connect)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect"), &Session::Connect)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect"), &Session::Connect)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect"), &Session::Connect)
|
2015-11-07 11:17:39 +01:00
|
|
|
.Overload< SQInt32 (Session::*)(void) >
|
|
|
|
(_SC("connect6"), &Session::Connect6)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *) >
|
|
|
|
(_SC("connect6"), &Session::Connect6)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect6"), &Session::Connect6)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect6"), &Session::Connect6)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, SQUint32, const SQChar *, const SQChar *, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("connect6"), &Session::Connect6)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
|
|
|
(_SC("cmd_join"), &Session::CmdJoin)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, const SQChar *) >
|
|
|
|
(_SC("cmd_join"), &Session::CmdJoin)
|
|
|
|
.Overload< SQInt32 (Session::*)(void) >
|
|
|
|
(_SC("cmd_list"), &Session::CmdList)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
|
|
|
(_SC("cmd_list"), &Session::CmdList)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
|
|
|
(_SC("cmd_topic"), &Session::CmdTopic)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, const SQChar *) >
|
|
|
|
(_SC("cmd_topic"), &Session::CmdTopic)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
|
|
|
(_SC("cmd_channel_mode"), &Session::CmdChannelMode)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, const SQChar *) >
|
|
|
|
(_SC("cmd_channel_mode"), &Session::CmdChannelMode)
|
|
|
|
.Overload< SQInt32 (Session::*)(void) >
|
|
|
|
(_SC("cmd_user_mode"), &Session::CmdUserMode)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
|
|
|
(_SC("cmd_user_mode"), &Session::CmdUserMode)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, const SQChar *) >
|
|
|
|
(_SC("cmd_kick"), &Session::CmdKick)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *, const SQChar *, const SQChar *) >
|
|
|
|
(_SC("cmd_kick"), &Session::CmdKick)
|
|
|
|
.Overload< SQInt32 (Session::*)(void) >
|
|
|
|
(_SC("cmd_quit"), &Session::CmdQuit)
|
|
|
|
.Overload< SQInt32 (Session::*)(const SQChar *) >
|
2015-11-03 03:20:53 +01:00
|
|
|
(_SC("cmd_quit"), &Session::CmdQuit)
|
|
|
|
);
|
2015-11-07 11:17:39 +01:00
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// Output debugging information
|
2015-11-03 03:20:53 +01:00
|
|
|
LogDbg("Registration of <IRC Session> type was successful");
|
|
|
|
|
2015-10-30 03:17:18 +01:00
|
|
|
// Output debugging information
|
2015-11-11 13:19:45 +01:00
|
|
|
LogDbg("Beginning registration of <IRC> functions");
|
2015-10-30 14:14:13 +01:00
|
|
|
// Attempt to register the free functions
|
|
|
|
ircns.Func(_SC("GetNick"), &GetNick);
|
|
|
|
ircns.Func(_SC("GetHost"), &GetHost);
|
|
|
|
ircns.Func(_SC("GetErrStr"), &irc_strerror);
|
|
|
|
// Output debugging information
|
2015-11-11 13:19:45 +01:00
|
|
|
LogDbg("Registration of <IRC> functions was successful");
|
2015-11-03 03:20:53 +01:00
|
|
|
|
|
|
|
// Attempt to bind the namespace to the root table
|
2015-10-30 14:14:13 +01:00
|
|
|
Sqrat::RootTable(vm).Bind(_SC("IRC"), ircns);
|
2015-11-03 03:20:53 +01:00
|
|
|
|
2015-10-30 14:14:13 +01:00
|
|
|
// Output debugging information
|
2015-11-11 13:19:45 +01:00
|
|
|
LogDbg("Beginning registration of <IRC> constants");
|
2015-10-30 03:17:18 +01:00
|
|
|
// Attempt to register the error codes enumeration
|
|
|
|
Sqrat::ConstTable(vm).Enum(_SC("EIRCERR"), Sqrat::Enumeration(vm)
|
|
|
|
.Const(_SC("OK"), LIBIRC_ERR_OK)
|
|
|
|
.Const(_SC("INVAL"), LIBIRC_ERR_INVAL)
|
|
|
|
.Const(_SC("RESOLV"), LIBIRC_ERR_RESOLV)
|
|
|
|
.Const(_SC("SOCKET"), LIBIRC_ERR_SOCKET)
|
|
|
|
.Const(_SC("CONNECT"), LIBIRC_ERR_CONNECT)
|
|
|
|
.Const(_SC("CLOSED"), LIBIRC_ERR_CLOSED)
|
|
|
|
.Const(_SC("NOMEM"), LIBIRC_ERR_NOMEM)
|
|
|
|
.Const(_SC("ACCEPT"), LIBIRC_ERR_ACCEPT)
|
|
|
|
.Const(_SC("NODCCSEND"), LIBIRC_ERR_NODCCSEND)
|
|
|
|
.Const(_SC("READ"), LIBIRC_ERR_READ)
|
|
|
|
.Const(_SC("WRITE"), LIBIRC_ERR_WRITE)
|
|
|
|
.Const(_SC("STATE"), LIBIRC_ERR_STATE)
|
|
|
|
.Const(_SC("TIMEOUT"), LIBIRC_ERR_TIMEOUT)
|
|
|
|
.Const(_SC("OPENFILE"), LIBIRC_ERR_OPENFILE)
|
|
|
|
.Const(_SC("TERMINATED"), LIBIRC_ERR_TERMINATED)
|
|
|
|
.Const(_SC("NOIPV6"), LIBIRC_ERR_NOIPV6)
|
|
|
|
.Const(_SC("SSL_NOT_SUPPORTED"), LIBIRC_ERR_SSL_NOT_SUPPORTED)
|
|
|
|
.Const(_SC("SSL_INIT_FAILED"), LIBIRC_ERR_SSL_INIT_FAILED)
|
|
|
|
.Const(_SC("CONNECT_SSL_FAILED"), LIBIRC_ERR_CONNECT_SSL_FAILED)
|
|
|
|
.Const(_SC("SSL_CERT_VERIFY_FAILED"), LIBIRC_ERR_SSL_CERT_VERIFY_FAILED)
|
|
|
|
.Const(_SC("MAX"), LIBIRC_ERR_MAX)
|
|
|
|
);
|
|
|
|
// Attempt to register the options enumeration
|
|
|
|
Sqrat::ConstTable(vm).Enum(_SC("EIRCOPT"), Sqrat::Enumeration(vm)
|
|
|
|
.Const(_SC("DEBUG"), LIBIRC_OPTION_DEBUG)
|
|
|
|
.Const(_SC("STRIPNICKS"), LIBIRC_OPTION_STRIPNICKS)
|
|
|
|
.Const(_SC("SSL_NO_VERIFY"), LIBIRC_OPTION_SSL_NO_VERIFY)
|
|
|
|
);
|
|
|
|
// Attempt to register the irc rfc enumeration
|
|
|
|
Sqrat::ConstTable(vm).Enum(_SC("EIRCRFC"), Sqrat::Enumeration(vm)
|
|
|
|
.Const(_SC("RPL_WELCOME"), LIBIRC_RFC_RPL_WELCOME)
|
|
|
|
.Const(_SC("RPL_YOURHOST"), LIBIRC_RFC_RPL_YOURHOST)
|
|
|
|
.Const(_SC("RPL_CREATED"), LIBIRC_RFC_RPL_CREATED)
|
|
|
|
.Const(_SC("RPL_MYINFO"), LIBIRC_RFC_RPL_MYINFO)
|
|
|
|
.Const(_SC("RPL_BOUNCE"), LIBIRC_RFC_RPL_BOUNCE)
|
2015-11-01 17:38:05 +01:00
|
|
|
.Const(_SC("RPL_NONE"), LIBIRC_RFC_RPL_NONE)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Const(_SC("RPL_USERHOST"), LIBIRC_RFC_RPL_USERHOST)
|
|
|
|
.Const(_SC("RPL_ISON"), LIBIRC_RFC_RPL_ISON)
|
|
|
|
.Const(_SC("RPL_AWAY"), LIBIRC_RFC_RPL_AWAY)
|
|
|
|
.Const(_SC("RPL_UNAWAY"), LIBIRC_RFC_RPL_UNAWAY)
|
|
|
|
.Const(_SC("RPL_NOWAWAY"), LIBIRC_RFC_RPL_NOWAWAY)
|
|
|
|
.Const(_SC("RPL_WHOISUSER"), LIBIRC_RFC_RPL_WHOISUSER)
|
|
|
|
.Const(_SC("RPL_WHOISSERVER"), LIBIRC_RFC_RPL_WHOISSERVER)
|
|
|
|
.Const(_SC("RPL_WHOISOPERATOR"), LIBIRC_RFC_RPL_WHOISOPERATOR)
|
|
|
|
.Const(_SC("RPL_WHOISIDLE"), LIBIRC_RFC_RPL_WHOISIDLE)
|
|
|
|
.Const(_SC("RPL_ENDOFWHOIS"), LIBIRC_RFC_RPL_ENDOFWHOIS)
|
|
|
|
.Const(_SC("RPL_WHOISCHANNELS"), LIBIRC_RFC_RPL_WHOISCHANNELS)
|
|
|
|
.Const(_SC("RPL_WHOWASUSER"), LIBIRC_RFC_RPL_WHOWASUSER)
|
|
|
|
.Const(_SC("RPL_ENDOFWHOWAS"), LIBIRC_RFC_RPL_ENDOFWHOWAS)
|
2015-11-01 17:38:05 +01:00
|
|
|
.Const(_SC("RPL_LISTSTART"), LIBIRC_RFC_RPL_LISTSTART)
|
2015-10-30 03:17:18 +01:00
|
|
|
.Const(_SC("RPL_LIST"), LIBIRC_RFC_RPL_LIST)
|
|
|
|
.Const(_SC("RPL_LISTEND"), LIBIRC_RFC_RPL_LISTEND)
|
|
|
|
.Const(_SC("RPL_UNIQOPIS"), LIBIRC_RFC_RPL_UNIQOPIS)
|
|
|
|
.Const(_SC("RPL_CHANNELMODEIS"), LIBIRC_RFC_RPL_CHANNELMODEIS)
|
|
|
|
.Const(_SC("RPL_NOTOPIC"), LIBIRC_RFC_RPL_NOTOPIC)
|
|
|
|
.Const(_SC("RPL_TOPIC"), LIBIRC_RFC_RPL_TOPIC)
|
|
|
|
.Const(_SC("RPL_INVITING"), LIBIRC_RFC_RPL_INVITING)
|
|
|
|
.Const(_SC("RPL_SUMMONING"), LIBIRC_RFC_RPL_SUMMONING)
|
|
|
|
.Const(_SC("RPL_INVITELIST"), LIBIRC_RFC_RPL_INVITELIST)
|
|
|
|
.Const(_SC("RPL_ENDOFINVITELIST"), LIBIRC_RFC_RPL_ENDOFINVITELIST)
|
|
|
|
.Const(_SC("RPL_EXCEPTLIST"), LIBIRC_RFC_RPL_EXCEPTLIST)
|
|
|
|
.Const(_SC("RPL_ENDOFEXCEPTLIST"), LIBIRC_RFC_RPL_ENDOFEXCEPTLIST)
|
|
|
|
.Const(_SC("RPL_VERSION"), LIBIRC_RFC_RPL_VERSION)
|
|
|
|
.Const(_SC("RPL_WHOREPLY"), LIBIRC_RFC_RPL_WHOREPLY)
|
|
|
|
.Const(_SC("RPL_ENDOFWHO"), LIBIRC_RFC_RPL_ENDOFWHO)
|
|
|
|
.Const(_SC("RPL_NAMREPLY"), LIBIRC_RFC_RPL_NAMREPLY)
|
|
|
|
.Const(_SC("RPL_ENDOFNAMES"), LIBIRC_RFC_RPL_ENDOFNAMES)
|
|
|
|
.Const(_SC("RPL_LINKS"), LIBIRC_RFC_RPL_LINKS)
|
|
|
|
.Const(_SC("RPL_ENDOFLINKS"), LIBIRC_RFC_RPL_ENDOFLINKS)
|
|
|
|
.Const(_SC("RPL_BANLIST"), LIBIRC_RFC_RPL_BANLIST)
|
|
|
|
.Const(_SC("RPL_ENDOFBANLIST"), LIBIRC_RFC_RPL_ENDOFBANLIST)
|
|
|
|
.Const(_SC("RPL_INFO"), LIBIRC_RFC_RPL_INFO)
|
|
|
|
.Const(_SC("RPL_ENDOFINFO"), LIBIRC_RFC_RPL_ENDOFINFO)
|
|
|
|
.Const(_SC("RPL_MOTDSTART"), LIBIRC_RFC_RPL_MOTDSTART)
|
|
|
|
.Const(_SC("RPL_MOTD"), LIBIRC_RFC_RPL_MOTD)
|
|
|
|
.Const(_SC("RPL_ENDOFMOTD"), LIBIRC_RFC_RPL_ENDOFMOTD)
|
|
|
|
.Const(_SC("RPL_YOUREOPER"), LIBIRC_RFC_RPL_YOUREOPER)
|
|
|
|
.Const(_SC("RPL_REHASHING"), LIBIRC_RFC_RPL_REHASHING)
|
|
|
|
.Const(_SC("RPL_YOURESERVICE"), LIBIRC_RFC_RPL_YOURESERVICE)
|
|
|
|
.Const(_SC("RPL_TIME"), LIBIRC_RFC_RPL_TIME)
|
|
|
|
.Const(_SC("RPL_USERSSTART"), LIBIRC_RFC_RPL_USERSSTART)
|
|
|
|
.Const(_SC("RPL_USERS"), LIBIRC_RFC_RPL_USERS)
|
|
|
|
.Const(_SC("RPL_ENDOFUSERS"), LIBIRC_RFC_RPL_ENDOFUSERS)
|
|
|
|
.Const(_SC("RPL_NOUSERS"), LIBIRC_RFC_RPL_NOUSERS)
|
|
|
|
.Const(_SC("RPL_TRACELINK"), LIBIRC_RFC_RPL_TRACELINK)
|
|
|
|
.Const(_SC("RPL_TRACECONNECTING"), LIBIRC_RFC_RPL_TRACECONNECTING)
|
|
|
|
.Const(_SC("RPL_TRACEHANDSHAKE"), LIBIRC_RFC_RPL_TRACEHANDSHAKE)
|
|
|
|
.Const(_SC("RPL_TRACEUNKNOWN"), LIBIRC_RFC_RPL_TRACEUNKNOWN)
|
|
|
|
.Const(_SC("RPL_TRACEOPERATOR"), LIBIRC_RFC_RPL_TRACEOPERATOR)
|
|
|
|
.Const(_SC("RPL_TRACEUSER"), LIBIRC_RFC_RPL_TRACEUSER)
|
|
|
|
.Const(_SC("RPL_TRACESERVER"), LIBIRC_RFC_RPL_TRACESERVER)
|
|
|
|
.Const(_SC("RPL_TRACESERVICE"), LIBIRC_RFC_RPL_TRACESERVICE)
|
|
|
|
.Const(_SC("RPL_TRACENEWTYPE"), LIBIRC_RFC_RPL_TRACENEWTYPE)
|
|
|
|
.Const(_SC("RPL_TRACECLASS"), LIBIRC_RFC_RPL_TRACECLASS)
|
|
|
|
.Const(_SC("RPL_TRACELOG"), LIBIRC_RFC_RPL_TRACELOG)
|
|
|
|
.Const(_SC("RPL_TRACEEND"), LIBIRC_RFC_RPL_TRACEEND)
|
|
|
|
.Const(_SC("RPL_STATSLINKINFO"), LIBIRC_RFC_RPL_STATSLINKINFO)
|
|
|
|
.Const(_SC("RPL_STATSCOMMANDS"), LIBIRC_RFC_RPL_STATSCOMMANDS)
|
|
|
|
.Const(_SC("RPL_ENDOFSTATS"), LIBIRC_RFC_RPL_ENDOFSTATS)
|
|
|
|
.Const(_SC("RPL_STATSUPTIME"), LIBIRC_RFC_RPL_STATSUPTIME)
|
|
|
|
.Const(_SC("RPL_STATSOLINE"), LIBIRC_RFC_RPL_STATSOLINE)
|
|
|
|
.Const(_SC("RPL_UMODEIS"), LIBIRC_RFC_RPL_UMODEIS)
|
|
|
|
.Const(_SC("RPL_SERVLIST"), LIBIRC_RFC_RPL_SERVLIST)
|
|
|
|
.Const(_SC("RPL_SERVLISTEND"), LIBIRC_RFC_RPL_SERVLISTEND)
|
|
|
|
.Const(_SC("RPL_LUSERCLIENT"), LIBIRC_RFC_RPL_LUSERCLIENT)
|
|
|
|
.Const(_SC("RPL_LUSEROP"), LIBIRC_RFC_RPL_LUSEROP)
|
|
|
|
.Const(_SC("RPL_LUSERUNKNOWN"), LIBIRC_RFC_RPL_LUSERUNKNOWN)
|
|
|
|
.Const(_SC("RPL_LUSERCHANNELS"), LIBIRC_RFC_RPL_LUSERCHANNELS)
|
|
|
|
.Const(_SC("RPL_LUSERME"), LIBIRC_RFC_RPL_LUSERME)
|
|
|
|
.Const(_SC("RPL_ADMINME"), LIBIRC_RFC_RPL_ADMINME)
|
|
|
|
.Const(_SC("RPL_ADMINLOC1"), LIBIRC_RFC_RPL_ADMINLOC1)
|
|
|
|
.Const(_SC("RPL_ADMINLOC2"), LIBIRC_RFC_RPL_ADMINLOC2)
|
|
|
|
.Const(_SC("RPL_ADMINEMAIL"), LIBIRC_RFC_RPL_ADMINEMAIL)
|
|
|
|
.Const(_SC("RPL_TRYAGAIN"), LIBIRC_RFC_RPL_TRYAGAIN)
|
|
|
|
.Const(_SC("ERR_NOSUCHNICK"), LIBIRC_RFC_ERR_NOSUCHNICK)
|
|
|
|
.Const(_SC("ERR_NOSUCHSERVER"), LIBIRC_RFC_ERR_NOSUCHSERVER)
|
|
|
|
.Const(_SC("ERR_NOSUCHCHANNEL"), LIBIRC_RFC_ERR_NOSUCHCHANNEL)
|
|
|
|
.Const(_SC("ERR_CANNOTSENDTOCHAN"), LIBIRC_RFC_ERR_CANNOTSENDTOCHAN)
|
|
|
|
.Const(_SC("ERR_TOOMANYCHANNELS"), LIBIRC_RFC_ERR_TOOMANYCHANNELS)
|
|
|
|
.Const(_SC("ERR_WASNOSUCHNICK"), LIBIRC_RFC_ERR_WASNOSUCHNICK)
|
|
|
|
.Const(_SC("ERR_TOOMANYTARGETS"), LIBIRC_RFC_ERR_TOOMANYTARGETS)
|
|
|
|
.Const(_SC("ERR_NOSUCHSERVICE"), LIBIRC_RFC_ERR_NOSUCHSERVICE)
|
|
|
|
.Const(_SC("ERR_NOORIGIN"), LIBIRC_RFC_ERR_NOORIGIN)
|
|
|
|
.Const(_SC("ERR_NORECIPIENT"), LIBIRC_RFC_ERR_NORECIPIENT)
|
|
|
|
.Const(_SC("ERR_NOTEXTTOSEND"), LIBIRC_RFC_ERR_NOTEXTTOSEND)
|
|
|
|
.Const(_SC("ERR_NOTOPLEVEL"), LIBIRC_RFC_ERR_NOTOPLEVEL)
|
|
|
|
.Const(_SC("ERR_WILDTOPLEVEL"), LIBIRC_RFC_ERR_WILDTOPLEVEL)
|
|
|
|
.Const(_SC("ERR_BADMASK"), LIBIRC_RFC_ERR_BADMASK)
|
|
|
|
.Const(_SC("ERR_UNKNOWNCOMMAND"), LIBIRC_RFC_ERR_UNKNOWNCOMMAND)
|
|
|
|
.Const(_SC("ERR_NOMOTD"), LIBIRC_RFC_ERR_NOMOTD)
|
|
|
|
.Const(_SC("ERR_NOADMININFO"), LIBIRC_RFC_ERR_NOADMININFO)
|
|
|
|
.Const(_SC("ERR_FILEERROR"), LIBIRC_RFC_ERR_FILEERROR)
|
|
|
|
.Const(_SC("ERR_NONICKNAMEGIVEN"), LIBIRC_RFC_ERR_NONICKNAMEGIVEN)
|
|
|
|
.Const(_SC("ERR_ERRONEUSNICKNAME"), LIBIRC_RFC_ERR_ERRONEUSNICKNAME)
|
|
|
|
.Const(_SC("ERR_NICKNAMEINUSE"), LIBIRC_RFC_ERR_NICKNAMEINUSE)
|
|
|
|
.Const(_SC("ERR_NICKCOLLISION"), LIBIRC_RFC_ERR_NICKCOLLISION)
|
|
|
|
.Const(_SC("ERR_UNAVAILRESOURCE"), LIBIRC_RFC_ERR_UNAVAILRESOURCE)
|
|
|
|
.Const(_SC("ERR_USERNOTINCHANNEL"), LIBIRC_RFC_ERR_USERNOTINCHANNEL)
|
|
|
|
.Const(_SC("ERR_NOTONCHANNEL"), LIBIRC_RFC_ERR_NOTONCHANNEL)
|
|
|
|
.Const(_SC("ERR_USERONCHANNEL"), LIBIRC_RFC_ERR_USERONCHANNEL)
|
|
|
|
.Const(_SC("ERR_NOLOGIN"), LIBIRC_RFC_ERR_NOLOGIN)
|
|
|
|
.Const(_SC("ERR_SUMMONDISABLED"), LIBIRC_RFC_ERR_SUMMONDISABLED)
|
|
|
|
.Const(_SC("ERR_USERSDISABLED"), LIBIRC_RFC_ERR_USERSDISABLED)
|
|
|
|
.Const(_SC("ERR_NOTREGISTERED"), LIBIRC_RFC_ERR_NOTREGISTERED)
|
|
|
|
.Const(_SC("ERR_NEEDMOREPARAMS"), LIBIRC_RFC_ERR_NEEDMOREPARAMS)
|
|
|
|
.Const(_SC("ERR_ALREADYREGISTRED"), LIBIRC_RFC_ERR_ALREADYREGISTRED)
|
|
|
|
.Const(_SC("ERR_NOPERMFORHOST"), LIBIRC_RFC_ERR_NOPERMFORHOST)
|
|
|
|
.Const(_SC("ERR_PASSWDMISMATCH"), LIBIRC_RFC_ERR_PASSWDMISMATCH)
|
|
|
|
.Const(_SC("ERR_YOUREBANNEDCREEP"), LIBIRC_RFC_ERR_YOUREBANNEDCREEP)
|
|
|
|
.Const(_SC("ERR_YOUWILLBEBANNED"), LIBIRC_RFC_ERR_YOUWILLBEBANNED)
|
|
|
|
.Const(_SC("ERR_KEYSET"), LIBIRC_RFC_ERR_KEYSET)
|
|
|
|
.Const(_SC("ERR_CHANNELISFULL"), LIBIRC_RFC_ERR_CHANNELISFULL)
|
|
|
|
.Const(_SC("ERR_UNKNOWNMODE"), LIBIRC_RFC_ERR_UNKNOWNMODE)
|
|
|
|
.Const(_SC("ERR_INVITEONLYCHAN"), LIBIRC_RFC_ERR_INVITEONLYCHAN)
|
|
|
|
.Const(_SC("ERR_BANNEDFROMCHAN"), LIBIRC_RFC_ERR_BANNEDFROMCHAN)
|
|
|
|
.Const(_SC("ERR_BADCHANNELKEY"), LIBIRC_RFC_ERR_BADCHANNELKEY)
|
|
|
|
.Const(_SC("ERR_BADCHANMASK"), LIBIRC_RFC_ERR_BADCHANMASK)
|
|
|
|
.Const(_SC("ERR_NOCHANMODES"), LIBIRC_RFC_ERR_NOCHANMODES)
|
|
|
|
.Const(_SC("ERR_BANLISTFULL"), LIBIRC_RFC_ERR_BANLISTFULL)
|
|
|
|
.Const(_SC("ERR_NOPRIVILEGES"), LIBIRC_RFC_ERR_NOPRIVILEGES)
|
|
|
|
.Const(_SC("ERR_CHANOPRIVSNEEDED"), LIBIRC_RFC_ERR_CHANOPRIVSNEEDED)
|
|
|
|
.Const(_SC("ERR_CANTKILLSERVER"), LIBIRC_RFC_ERR_CANTKILLSERVER)
|
|
|
|
.Const(_SC("ERR_RESTRICTED"), LIBIRC_RFC_ERR_RESTRICTED)
|
|
|
|
.Const(_SC("ERR_UNIQOPPRIVSNEEDED"), LIBIRC_RFC_ERR_UNIQOPPRIVSNEEDED)
|
|
|
|
.Const(_SC("ERR_NOOPERHOST"), LIBIRC_RFC_ERR_NOOPERHOST)
|
|
|
|
.Const(_SC("ERR_UMODEUNKNOWNFLAG"), LIBIRC_RFC_ERR_UMODEUNKNOWNFLAG)
|
|
|
|
.Const(_SC("ERR_USERSDONTMATCH"), LIBIRC_RFC_ERR_USERSDONTMATCH)
|
|
|
|
);
|
|
|
|
// Output debugging information
|
2015-11-11 13:19:45 +01:00
|
|
|
LogDbg("Registration of <IRC> constants was successful");
|
2015-10-30 03:17:18 +01:00
|
|
|
// Registration succeeded
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|