• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->
Resource icon

Plugin - MQ2Telnet (1 Viewer)

Joined
Sep 20, 2005
RedCents
1,703¢
I added the ability for mq2telnet to listen on multiple ports. This allows it to be loaded on multiple characters on the same pc, each on a different port. Login usernames are shared across ports. Tested on 6 accounts on same computer, 6 different ports.

None of the other required .cpp/.h files were changed for this so I did not post them (but I can if needed).

mq2telnet.ini format:

Rich (BB code):
;**********************************************************************
; for use with the telnet server plugin -- mq2telnet
;**********************************************************************
[Users]
;username=password

[servername_charname]
; port = 0 off, else put the port number here
Port=0
; localonly boolean -- supposedly does a get peer name to compare address
; but you must use the hostname not 127.0.0.1 or localhost when connecting
LocalOnly=0
Welcome=Successful login.  Welcome to my undergroud lair.
LoginPrompt=login: 
PasswordPrompt=password: 


[servername_otherchar]
; port = 0 off, else put a different port number here
Port=0
; localonly boolean -- supposedly does a get peer name to compare address
; but you must use the hostname not 127.0.0.1 or localhost when connecting
LocalOnly=0
Welcome=Successful login.  Welcome to my undergroud lair.
LoginPrompt=login: 
PasswordPrompt=password:


Rich (BB code):
// mq2telnet.cpp
// Updated 2/1/2012 by Sym - Added multiple ports option in same mq2telnet.ini

//#define DEBUG_TRY
#include "../MQ2Plugin.h"
#include "WinTelnet.h"
#include "TelnetServer.h"

PreSetup("MQ2Telnet");

CTelnetServer *server=0;
bool needsInit = true;
DWORD TelnetPort=0;

PLUGIN_API VOID SetGameState(DWORD GameState)
{

   if (GameState==GAMESTATE_INGAME && needsInit)
   {
	    CHAR SectionName[MAX_STRING] = {0};
		CHAR szTemp[MAX_STRING] = {0};
		needsInit = false;
		sprintf(SectionName, "%s_%s", EQADDR_SERVERNAME, ((PCHARINFO)pCharData)->Name);
		TelnetPort = GetPrivateProfileInt(SectionName,"Port",0,INIFileName);
		if (TelnetPort)
		{
			// ANSI not currently implemented
			//TelnetPort = GetPrivateProfileInt(SectionName,"ANSI",1,INIFileName);
			LocalOnly = GetPrivateProfileInt(SectionName,"LocalOnly",1,INIFileName);
			GetPrivateProfileString(SectionName,"LoginPrompt","login: ",TelnetLoginPrompt,MAX_STRING,INIFileName);
			GetPrivateProfileString(SectionName,"PassPrompt","password: ",TelnetPasswordPrompt,MAX_STRING,INIFileName);
			GetPrivateProfileString(SectionName,"Welcome","Successful login.",TelnetWelcome,MAX_STRING,INIFileName);

			server=new CTelnetServer();
			server->Listen(TelnetPort);
			sprintf(szTemp, "MQ2Telnet is listening on port %i", TelnetPort);
			WriteChatColor(szTemp, CONCOLOR_LIGHTBLUE);
		} else {
			DebugSpewAlways("SetupServer: Port 0 specified, disabling mq2telnet");
			WriteChatColor("MQ2Telnet has no port defined. Set your port in mq2telnet.ini and reload the plugin.",CONCOLOR_RED);
		}
	}
}

PLUGIN_API VOID InitializePlugin(VOID)
{
    DebugSpewAlways("Initializing mq2telnet");

}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
    DebugSpewAlways("Shutting down mq2telnet");
    CTelnetServer *pServer=server;
    server=0;
    if (pServer)
    {
        DebugTry(delete pServer);
    }
}

PLUGIN_API VOID OnPulse(VOID)
{
    if (server)
        server->ProcessIncoming();
}

PLUGIN_API DWORD OnWriteChatColor(PCHAR Line, DWORD Color, DWORD Filter)
{
    CHAR Stripped[MAX_STRING];
    //if (gFilterMacro == FILTERMACRO_NONE) return 0;
    if (server)
    {
        // ANSI not currently implemented
        //if (ANSI)
        //    MQToANSI(Line,Stripped);
        //else
        StripMQChat(Line,Stripped);
        server->Broadcast(Stripped);
    }

    return 0;
}

PLUGIN_API DWORD OnIncomingChat(PCHAR Line, DWORD Color)
{
    CHAR Stripped[MAX_STRING];
    if (server)
    {
        // ANSI not currently implemented
        //if (ANSI)
        //    MQToANSI(Line,Stripped);
        //else
        StripMQChat(Line,Stripped);
        server->Broadcast(Stripped);
    }
    return 0;
}
 
Last edited:
MQ2Telnet - This plugin adds a telnet server, which can be used to access your EQ session remotely.

INI File

Rich (BB code):
;**********************************************************************
; for use with the telnet server plugin -- mq2telnet
;**********************************************************************
[Telnet Server]
; port = 0 off, else put the port number here
Port=0
; localonly boolean -- supposedly does a get peer name to compare address
; but you must use the hostname not 127.0.0.1 or localhost when connecting
LocalOnly=0
Welcome=Successful login.  Welcome to my undergroud lair.
LoginPrompt=login: 
PasswordPrompt=password: 

[Users]
;username=password

By default, the telnet server is disabled. If you want to use it, you will need to edit the mq2telnet.ini file and do the following:

  • Define a port number that the server will run on:
Port=6669
  • Add some users and passwords under the [Users] section: [Users] wassup=ubahmanualguy

  • It is recommended that you change the Welcome message.
  • The following setting will limit the connection to just one user. Setting it to 0 and defining usernames and passwords will allow multiple users to connect. - LocalOnly=1

Using the Telnet server


  • Use a real telnet client to connect (Putty works well).
  • After entering your username and password, you will be presented with your Welcome message.
  • From now, and commands you enter in the telnet session will work the same as typing them into your EQ console.
  • Any chat output will be sent to your telnet session.
To disconnect from the server, just close your telnet client. The plugin will notice when the connection is no longer active and will clean up.

Commands
  • /telnet - this command lists all the remote IP addresses that are connected to your telnet server.
 
Plugin - MQ2Telnet

Users who are viewing this thread

Back
Top