#include "../MQ2Plugin.h"
PreSetup("MQ2AutoIRC");
/declare INI string outer "AutoIRC_${Me.Name}.ini"
/declare UseIRC bool outer ${Ini[${INI},General_Options,UseIRC]}
/declare IRCServer string outer ${Ini[${INI},IRC_Settings,IRCServer]}
/declare IRCPort int outer ${Ini[${INI},IRC_Settings,IRCPort]}
/declare IRCChannel string outer ${Ini[${INI},IRC_Settings,IRCChannel]}
VOID JoinIRC(PSPAWNINFO pChar, PCHAR szLine)
{
if (${IRCChannel.Left[1].NotEqual[#]}) {
/echo Channel name needs to start with a # }
else {
// Not Connected
if (${Irc}) {
if (${Irc.Server.NotEqual[${IRCServer}]} || ${Irc.Nick.NotEqual[${Me.Name}]}) {
/squelch /i quit
/squelch /iconnect ${IRCServer} ${IRCPort} ${IRCChannel} ${Me.Name}
} else {
// This is currently broken in the MQ2IRC plugin code, it will always re-join the channel
if (${IRC.Channel.NotEqual[${IRCChannel}]}) {
/squelch /i part
/i join ${IRCChannel}
}
}
} else {
/squelch /iconnect ${IRCServer} ${IRCPort} ${IRCChannel} ${Me.Name}
}
/delay 3s
}}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2AutoIrc");
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2AutoIrc");
}