Ok, i have been working on this for a while now, but im working on IRC Relay 2.0
It will be more modular, so meaning people can make plugins much easier for it, and bug stuff will be easier to fix
This version will focus more on the API section, so people can write 'modules' for it, and not need to know ANYTHING about the IRC protocol.
Here is a little sneak peek at the include file so-far:
Code:
/*********************************************************
* Called when the bot is fully connected, and ready to
* send commands and stuff to the server.
*
* @noreturn
*********************************************************/
forward OnIrcConnected();
/*********************************************************
* Called when someone runs a command on the relay
*
* @param String:name[] The name of the person who executed the command
* @param String:host[] the host of the executer
* @param String:destination[] The place the message was sent
* @param String:command[] The command that was called
* @param argc The amount of arguments sent
*
* @noreturn
*********************************************************/
forward RelayCmd:OnRelayCommand(const String:name[], const String:host[], const String:destination[], const String:command[], const argc);
/*********************************************************
* Allows you to register your module, this will be used for getting info
* about the plugin, for re-loading etc, and listing
*
* @param Handle:module The handle of the module plugin
* @param String:name[] The real name of the module,
* * Spaces will be removed *
* @noreturn
*********************************************************/
native IRC_RegisterModule(Handle:module, const String:name[]);
/*********************************************************
* Allows you to register your own irc command, and have
* it callback to a function in your plugin when it gets called
*
* @param String:name[] The name of the command to register
* @param function The callback function in your plugin
* @noreturn
*********************************************************/
functag IRC_Tag_CommandCallback public();
native IRC_RegisterCommand(const String:name[], IRC_Tag_CommandCallback:function);
/*********************************************************
* This native will allow external plugins to send RAW
* data to the server
*
* @param String:command[] The raw data to
* send to the IRC
* server.
* @param size The length of the
* raw data.
* @noreturn
*********************************************************/
native IRC_SendRaw(const String:data[], size);
/*********************************************************
* This will send a simple message to a user (pm) or
* to a channel
*
* @param String:destination[] Can either be a channel name (#olly)
* Or a nickname to send a PM
* @param String:message[] The message to send out.
* @noreturn
*********************************************************/
native IRC_PrivMsg(const String:destination[], const String:message[]);
/*********************************************************
* This will check if the core is correctly connected, and ready
*
* @param bool True if the core is connected, and ready for commands
*********************************************************/
native IRC_IsReady();
/*********************************************************
* Count the arguments sent along with our message
*
* @return count of arguments
*********************************************************/
native IRC_GetCmdArgc();
/*********************************************************
* Get the argument number specified
*
* @param num The arguemnt number to store
* @param String:arg The buffer to save the argument in
* @param size The size of the buffer
* @noreturn
*********************************************************/
native IRC_GetCmdArgv(num, String:arg[], size);
/*********************************************************
* Will concatonate arguments starting at the specified argument
* and create a string. This is usefull for lazy people who
* dont put stuff in " "'s
*
* @param num The arguemnt number to store
* @param String:arg The buffer to save the argument in
* @param size The size of the buffer
* @noreturn
*********************************************************/
native IRC_MakeArgString(num, String:output[], size);
// Yarr
And one of the first simple modules that will be included
Code:
/*==================================================\
* IRC relay, Authentication module,
* AUTHS with:
* AuthServe
* NickServ
* Q
*
* Web: www.steamfiends.com
* Author: Olly
* License: GPL
\==================================================*/
#pragma semicolon 1
#include <sourcemod>
#include <irc-relay>
#define BUILDD __DATE__
#define BUILDT __TIME__
// CVAR Handles
new Handle:g_Cvar_authString = INVALID_HANDLE;
new Handle:g_Cvar_authUsername = INVALID_HANDLE;
new Handle:g_Cvar_authPassword = INVALID_HANDLE;
// Global CVAR Values
new String:g_authString[128];
new String:g_authUsername[128];
new String:g_authPassword[128];
public Plugin:myinfo =
{
name = "IRC Relay - Auth Module",
author = "Olly",
description = "IRC Relay - Authentication Module",
version = IRC_VERSION,
url = "http://www.steamfriends.com/"
};
/*****************************************************************
* OnPluginStart
*
* @breif This function is called when the plugin starts up
* @noreturn
*****************************************************************/
public OnPluginStart()
{
// Setup our cvars
g_Cvar_authString = CreateConVar("irc_auth_string","","The string used to auth with the services",FCVAR_PLUGIN);
g_Cvar_authUsername = CreateConVar("irc_auth_username", "","The username to auth with ",FCVAR_PLUGIN);
g_Cvar_authPassword = CreateConVar("irc_auth_password","","The password to auth with.",FCVAR_PLUGIN);
}
/*****************************************************************
* OnConfigsExecuted
*
* @breif Called when all config files have been executed
* @noreturn
*****************************************************************/
public OnConfigsExecuted()
{
// Get the connection settings
GetConVarString(g_Cvar_authString, g_authString, sizeof(g_authString));
GetConVarString(g_Cvar_authUsername, g_authUsername, sizeof(g_authUsername));
GetConVarString(g_Cvar_authPassword, g_authPassword, sizeof(g_authPassword));
IRC_RegisterModule(GetMyHandle(), "IRCAuth");
}
/*****************************************************************
* OnIrcConnected
*
* @breif Called when we are connected to the IRC server
* @noreturn
*****************************************************************/
public OnIrcConnected()
{
decl String:authCommand[512];
Format(authCommand, sizeof(authCommand), g_authString, g_authUsername, g_authPassword);
IRC_SendRaw(authCommand, strlen(authCommand)+1);
}
//Yarr!
And for all of you wondering, yes there will be a sockets extension update to go along with this
I R PIRATE
__________________