From aa9d6c9c74675c54d1c4ec78ade565cb3df914b9 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sun, 8 Feb 2015 00:57:57 -0500 Subject: [PATCH] EMail and Browser integration now enabled upon login. --- .gitignore | 1 + loginScreens.cs | 7 ++ scripts/autoexec/t2csri_IRCfix.cs | 7 +- scripts/autoexec/t2csri_list.cs | 46 +++++++------ t2csri/authconnect.cs | 5 ++ t2csri/authinterface.cs | 33 ++++++++-- t2csri/clientSide.cs | 2 +- t2csri/clientSideClans.cs | 2 + t2csri/community/browser.cs | 11 +++- t2csri/community/browserUI.cs | 53 ++++++++++++++- t2csri/community/login.cs | 9 ++- t2csri/community/mail.cs | 34 ++++++++++ t2csri/community/mailUI.cs | 104 ++++++++++++++++++++++++------ t2csri/community/settings.cs | 2 +- t2csri/ipv4.cs | 10 +++ t2csri/postLogin.cs | 10 +-- t2csri/serverglue.cs | 23 ++++++- 17 files changed, 290 insertions(+), 69 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5b3847 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.dso \ No newline at end of file diff --git a/loginScreens.cs b/loginScreens.cs index 96bcbdb..5043e06 100644 --- a/loginScreens.cs +++ b/loginScreens.cs @@ -1122,6 +1122,13 @@ function t2csri_doLogin(%username, %password) if (getField($pref::Player[%i], 0) $= trim(%username)) $pref::Player::Current = %i; } + + // Perform post login + exec("t2csri/community/settings.cs"); + exec("t2csri/community/login.cs"); + + // log into the community server + tn_community_login_initiate(); } else if (%status $= "INVALID_PASSWORD") { diff --git a/scripts/autoexec/t2csri_IRCfix.cs b/scripts/autoexec/t2csri_IRCfix.cs index 15524b9..7041553 100644 --- a/scripts/autoexec/t2csri_IRCfix.cs +++ b/scripts/autoexec/t2csri_IRCfix.cs @@ -32,6 +32,11 @@ function IRCTCP::onDisconnect(%this) //IRCClient::notify(IDIRC_ERR_DROPPED); parent::onDisconnect(%this); } +function IRCClient::onVersion(%prefix,%params) +{ + nextToken(%prefix,prefix,"!"); + parent::onVersion(%prefix,%params); +} function IRCTCP::onConnected(%this) { IRCClient::newMessage("","IRCClient: Established TCP/IP connection"); @@ -136,7 +141,7 @@ function IRCClient::onMode(%prefix,%params) } function IRCClient::onJoinServer(%mission,%server,%address,%mayprequire,%prequire) { - if(strstr(strlwr($IRCClient::currentChannel.getName(),"tribes")) != -1) return; + if(strstr(strlwr($IRCClient::currentChannel.getName(),"tribes")) == -1) return; parent::onJoinServer(%mission,%server,%address,%mayprequire,%prequire); } function IRCClient::onNameReply(%prefix,%params) diff --git a/scripts/autoexec/t2csri_list.cs b/scripts/autoexec/t2csri_list.cs index b7ea344..4b9164b 100644 --- a/scripts/autoexec/t2csri_list.cs +++ b/scripts/autoexec/t2csri_list.cs @@ -332,6 +332,21 @@ function TNbite::onDisconnect(%this) { %this.delete(); } +function TNbite::get(%this, %server, %query) +{ + %this.server = %server; + %this.query = %query; + %this.connect(%server); +} + +function TNbite::onConnected(%this) +{ + if (%this.query !$= "") { + %query = "GET " @ %this.query @ " HTTP/1.1\r\nHost: " @ %this.server @ "\r\nUser-Agent: Tribes 2\r\nConnection: close\r\n\r\n"; + %this.send(%query); + } +} + function NewsGui::addLine( %this, %line ) { %this = NewsText; if (firstWord(%line) $= "") { @@ -366,31 +381,16 @@ function NewsHeadlines::onSelect( %this, %id, %text ) //================================================================ package t2csri_webs { -function TNbite::get(%this, %server, %query) -{ - if ($t2csri::isOfflineMode) - { - warn("TribesNext: Running in offline mode. Aborting query to the Master List Server."); - return; - } - %this.server = %server; - %this.query = %query; - %this.connect(%server); -} - -function TNbite::onConnected(%this) -{ - if (%this.query !$= "") { - %query = "GET " @ %this.query @ " HTTP/1.1\r\nHost: " @ %this.server @ "\r\nUser-Agent: Tribes 2\r\nConnection: close\r\n\r\n"; - %this.send(%query); - } +function CheckEmail( %bool ) { + if ($LaunchMode $= "Normal") return; // Do nothing for now + parent::CheckEmail( %bool ); } function LaunchTabView::addLaunchTab( %this, %text, %gui, %makeInactive ) { // disable currently unused tabs - //if (%text $= "EMAIL" || %text $= "BROWSER") parent::addLaunchTab( %this, %text, %gui, 1 ); - if (%text $= "BROWSER") parent::addLaunchTab( %this, %text, %gui, 1 ); - else parent::addLaunchTab( %this, %text, %gui, %makeInactive ); + if (%text $= "EMAIL" || %text $= "BROWSER") parent::addLaunchTab( %this, %text, %gui, 1 ); + else + parent::addLaunchTab( %this, %text, %gui, %makeInactive ); } function LaunchToolbarMenu::add(%this,%id,%text) { parent::add(%this,%id,%text); @@ -426,7 +426,7 @@ function ClientReceivedDataBlock(%index, %total) function CreateServer(%mission, %missionType) { parent::CreateServer(%mission, %missionType); - if (!isActivePackage(t2csri_server)) schedule(2000,0,"exec","t2csri/serverGlue.cs"); + if (!isActivePackage(t2csri_server)) exec("t2csri/serverGlue.cs"); } function StartHeartbeat() { @@ -455,5 +455,3 @@ function StopHeartbeat() { //================================================================ }; if (!isActivePackage(t2csri_webs)) activatepackage (t2csri_webs); - -exec("t2csri/postLogin.cs"); \ No newline at end of file diff --git a/t2csri/authconnect.cs b/t2csri/authconnect.cs index ee25430..e4291d6 100644 --- a/t2csri/authconnect.cs +++ b/t2csri/authconnect.cs @@ -7,6 +7,11 @@ function authConnect_findAuthServer() { + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting auth server lookup due to offline mode."); + return; + } if ($AuthServer::Address !$= "") return; echo("Looking up Authentication Server..."); diff --git a/t2csri/authinterface.cs b/t2csri/authinterface.cs index 8d456a0..fa886a0 100644 --- a/t2csri/authinterface.cs +++ b/t2csri/authinterface.cs @@ -1,9 +1,10 @@ // Tribes 2 Unofficial Authentication System // http://www.tribesnext.com/ -// Written by Electricutioner/Thyth -// Copyright 2008 by Electricutioner/Thyth and the Tribes 2 Community System Reengineering Intitiative +// Written by Thyth +// Copyright 2008-2011 by Thyth and the Tribes 2 Community System Reengineering Intitiative -// Authentication Server Interface Version 1.0: 12/29/2008 +// Authentication Server Interface Version 1.1: 2/13/2011 +// 1.0 -> 1.1: Added checks to abort any account server interaction if the game was launched in LAN mode. $Authentication::Mode::Available = 1; $Authentication::Mode::Name = 2; @@ -91,14 +92,17 @@ function Authentication_transactionComplete() { // this generic error happens if a malformed request is sent to the server error("Authentication: Unknown credential recovery status code returned from server."); + $Authentication::RecoveryError = "Malformed recovery request sent by client."; } else if (%buffer $= "NOTFOUND") { error("Authentication: No user with that name exists."); + $Authentication::RecoveryError = "No account exists with that username."; } else if (%buffer $= "INVALIDPASSWORD") { error("Authentication: Invalid password provided for that user."); + $Authentication::RecoveryError = "Invalid password for the specified account."; } else if (getWord(%buffer, 0) $= "CERT:") { @@ -112,7 +116,8 @@ function Authentication_transactionComplete() } else { - error("Authentication: Unknown recovery status code returned from server."); + error("Authentication: Unknown error occured when retrieving credentials."); + $Authentication::RecoveryError = "Unknown credential recovery error."; } } else if ($Authentication::Status::ActiveMode == $Authentication::Mode::Sign) @@ -156,6 +161,11 @@ function Authentication_transactionComplete() // determine if the server is available function Authentication_checkAvail() { + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting account server interaction due to offline mode."); + return; + } if ($Authentication::Status::ActiveMode != 0) { // already a request active, retry this one in 10 seconds @@ -177,6 +187,11 @@ function Authentication_checkAvail() // determine if the given name is acceptable/available function Authentication_checkName(%name) { + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting account server interaction due to offline mode."); + return; + } if ($Authentication::Status::ActiveMode != 0) { // already a request active, retry this one in 10 seconds @@ -198,6 +213,11 @@ function Authentication_checkName(%name) // request a certificate and encrypted exponent from the authentication server function Authentication_recoverAccount(%payload) { + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting account server interaction due to offline mode."); + return; + } if ($Authentication::Status::ActiveMode != 0) { // already a request active, retry this one in 10 seconds @@ -219,6 +239,11 @@ function Authentication_recoverAccount(%payload) // request a new account certificate function Authentication_registerAccount(%payload) { + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting account server interaction due to offline mode."); + return; + } if ($Authentication::Status::ActiveMode != 0) { // already a request active, retry this one in 10 seconds diff --git a/t2csri/clientSide.cs b/t2csri/clientSide.cs index 0bbb6fc..152157c 100644 --- a/t2csri/clientSide.cs +++ b/t2csri/clientSide.cs @@ -307,7 +307,7 @@ function t2csri_gameServerHexAddress() // client side interface to communicate with the game server function clientCmdt2csri_pokeClient(%version) { - echo("T2CSRI: Authenticating with connected game server."); + echo("T2CSRI: Authenticating with connected game server. Server version: " @ %version); // send the community certificate, assuming server is running later than 1.0 if (getWord(%version, 1) > 1.0) diff --git a/t2csri/clientSideClans.cs b/t2csri/clientSideClans.cs index 26a90e9..5c77196 100644 --- a/t2csri/clientSideClans.cs +++ b/t2csri/clientSideClans.cs @@ -27,6 +27,7 @@ function clientCmdt2csri_requestUnknownDCECert(%dceNum) { + echo("T2CSRI: Server requesting DCE cert " @ %dceNum @ ". Sending..."); %cert = $T2CSRI::ClientDCESupport::DCECert[%dceNum]; if (%cert $= "") return; // we don't have it, so we can't send it @@ -44,6 +45,7 @@ function t2csri_sendCommunityCert() %cert = $T2CSRI::CommunityCertificate; if (%cert $= "") return; // we don't have it, so we can't send it + echo("T2CSRI: Sending CEC..."); %len = strlen(%cert); for (%i = 0; %i < %len; %i += 200) diff --git a/t2csri/community/browser.cs b/t2csri/community/browser.cs index 0493b57..9ebe5bf 100644 --- a/t2csri/community/browser.cs +++ b/t2csri/community/browser.cs @@ -120,6 +120,14 @@ function CommunityBrowserInterface::onLine(%this, %line) { schedule(500, 0, MessageBoxOK, "ERROR", "Received expired certificate from community server. Is your computer's clock set correctly?"); } + + // DarkDragonDX: We seem to have received the community certificate, enable the browser and EMail UI's + for ( %i = 0; %i < LaunchTabView.tabCount(); %i++ ) + { + %guiName = LaunchTabView.gui[%i]; + if (isObject(%guiName) && (%guiName $="EmailGui" || %guiName $= "TribeandWarriorBrowserGui")) + LaunchTabView.setTabActive(%i, true); + } // data access methods @@ -1018,4 +1026,5 @@ function tn_community_browser_user_createClan(%tag, %append, %name, %info, %recr tn_community_browser_processRequest("", %header @ %payload); } -schedule(3000, 0, tn_community_Browser_request_cert); \ No newline at end of file +// DarkDragonDX: Removed this from being a schedule; it does it when it's ready now +// schedule(3000, 0, tn_community_Browser_request_cert); diff --git a/t2csri/community/browserUI.cs b/t2csri/community/browserUI.cs index 16e6137..5f87488 100644 --- a/t2csri/community/browserUI.cs +++ b/t2csri/community/browserUI.cs @@ -256,6 +256,10 @@ function TribeAndWarriorBrowserGui::onWake(%this) MemberList.Clear(); W_MemberList.clear(); Canvas.pushDialog(LaunchToolbarDlg); + + // DarkDragonDX: Set the BUDDYLIST and TRIBES profile + W_BuddyList.setProfile(ShellRedRadioProfile); + W_Tribes.setProfile(ShellRedRadioProfile); if (TWBTabView.tabCount() == 0) { @@ -383,13 +387,13 @@ function GuiMLTextCtrl::onURL(%this, %url) %i = 0; while((%fld[%i] = getField(%url, %i)) !$= "") %i++; - + %tribe = %fld[1]; %warrior = %fld[2]; switch$(%fld[0]) { case "player": - LinkBrowser( %fld[1] , "Warrior"); + LinkBrowser( %fld[2] , "Warrior"); case "clan": // used to be "tribe" in the Dynamix system -- it is this in TribesNext LaunchTabView.viewTab("BROWSER", TribeAndWarriorBrowserGui, 0); TWBTabView.view(%fld[1], "", "Tribe"); @@ -1940,4 +1944,47 @@ function CreateTribeProcess() // send the creation request tn_community_browser_user_createClan(%tag, %append, %name, %info, %recru); -} \ No newline at end of file +} + +// New ShellRadioProfile for TRIBES and BUDDYLIST +new GuiControlProfile(ShellRedRadioProfile) { + tab = "1"; + canKeyFocus = "1"; + modal = "1"; + opaque = "0"; + fillColor = "255 0 0 255"; + fillColorHL = "255 255 255 255"; + fillColorNA = "255 255 255 255"; + border = "0"; + borderColor = "0 0 0 255"; + borderColorHL = "0 0 0 255"; + borderColorNA = "0 0 0 255"; + fontType = "Univers Condensed"; + fontSize = "16"; + fontColors[0] = "255 0 0 255"; + fontColors[1] = "205 165 0 255"; + fontColors[2] = "5 5 5 255"; + fontColors[3] = "255 255 255 255"; + fontColors[4] = "255 255 255 255"; + fontColors[5] = "255 255 255 255"; + fontColors[6] = "255 255 255 255"; + fontColors[7] = "255 255 255 255"; + fontColors[8] = "255 255 255 255"; + fontColors[9] = "255 255 255 255"; + fontColor = "255 0 0 255"; + fontColorHL = "255 0 0 255"; + fontColorNA = "5 5 5 255"; + fontColorSEL = "255 255 255 255"; + justify = "center"; + textOffset = "0 0"; + autoSizeWidth = "0"; + autoSizeHeight = "0"; + returnTab = "0"; + numbersOnly = "0"; + cursorColor = "0 0 0 255"; + bitmap = "gui/shll_radio"; + soundButtonDown = "sButtonDown"; + soundButtonOver = "sButtonOver"; + + fixedExtent = "1"; +}; diff --git a/t2csri/community/login.cs b/t2csri/community/login.cs index 95dc2a8..8802803 100644 --- a/t2csri/community/login.cs +++ b/t2csri/community/login.cs @@ -48,6 +48,13 @@ function CommunitySessionInterface::onLine(%this, %line) cancel($TribesNext::Community::SessionSchedule); $TribesNext::Community::SessionSchedule = schedule($TribesNext::Community::SessionRefresh * 1000, 0, tn_community_login_initiate); + + // DarkDragonDX: Got a UUID, try for a community certificate + exec("t2csri/community/mail.cs"); + exec("t2csri/community/browser.cs"); + exec("t2csri/community/mailUI.cs"); + exec("t2csri/community/browserUI.cs"); + tn_community_Browser_request_cert(); } else if (getSubStr(%line, 0, 5) $= "ERR: ") { @@ -182,4 +189,4 @@ function tn_community_login_initiate() } CommunitySessionInterface.data = %payload; CommunitySessionInterface.connect($TribesNext::Community::Host @ ":" @ $TribesNext::Community::Port); -} \ No newline at end of file +} diff --git a/t2csri/community/mail.cs b/t2csri/community/mail.cs index 8727efc..f1aea32 100644 --- a/t2csri/community/mail.cs +++ b/t2csri/community/mail.cs @@ -51,6 +51,8 @@ function CommunityMailInterface::onLine(%this, %line) if (trim(%line) $= "") { %this.primed = 1; + + tn_community_mail_requestCompleted(); return; } if (!%this.primed) @@ -414,6 +416,9 @@ function tn_community_mail_request_send(%subject, %contents, %to, %cc) %payload = %payload @ "--" @ %boundary @ %rand @ "\r\n"; // cc + if (trim(%cc) $= "") + %cc = 0; // DarkDragonDX: No CC? + %payload = %payload @ %formelem @ "cc\"\r\n\r\n" @ %cc @ "\r\n"; %payload = %payload @ "--" @ %boundary @ %rand @ "\r\n"; @@ -447,3 +452,32 @@ function tn_community_isUserBlocked(%searchguid) { return tn_community_isOnList(%searchguid, "ignore"); } + +// DarkDragonDX: Hookable script callback for when a request with the mail system completes +function tn_community_mail_requestCompleted(){ } + +// DarkDragonDX: Helpers function to work with the JSON (somewhat) +function tn_community_mail_explodeJSONObject(%json) +{ + %json = trim(%json); + %json = stripChars(%json, "{}\"'"); + // The EMail contents of a tribal invite shouldn't contain spaces so this should be safe + %json = strReplace(%json, ",", " "); + + return %json; +} + +// %processed should have been processed with tn_community_mail_explodeJSONObject +function tn_community_mail_getJSONElement(%processed, %element) +{ + %element = strlwr(%element); + + for (%i = 0; %i < getWordCount(%processed); %i++) + { + %word = strReplace(getWord(%processed, %i), ":", " "); + if (strlwr(getWord(%word, 0)) $= %element) + return getWord(%word, 1); + } + + return -1; +} diff --git a/t2csri/community/mailUI.cs b/t2csri/community/mailUI.cs index 78384bc..2a984d8 100644 --- a/t2csri/community/mailUI.cs +++ b/t2csri/community/mailUI.cs @@ -376,14 +376,29 @@ function EmailGetTextDisplay(%text) %to = getLinkNameList(%toList); %ccList = getRecord(%text, 5); %ccLine = getLinkNameList(%ccList); + + // DarkDragonDX: Check if it's a tribal invite + %subjectLine = getRecord(%text, 6); + %emailContents = EmailGetBody(%text); + %senderName = getLinkName(getRecord(%text, 1), 0); + + if (getWords(%subjectLine, 0, 1) $= "Invitation to:") + { + %emailContents = tn_community_mail_explodeJSONObject(%emailContents); + %clanID = tn_community_mail_getJSONElement(%emailContents, "clanid"); + %expiration = tn_community_mail_getJSONElement(%emailContents, "expire"); + + %emailContents = %senderName SPC "of clan \"" @ trim(getWords(%subjectLine, 2)) @ "\" has invited you to join their clan." NL + "Accept or Reject the invitation? This invitation expires at " @ tn_community_mailui_epochToDate(%expiration) @ "."; + } - %from = getLinkName(getRecord(%text, 1), 0); + %from = %senderName; %msgtext = "From: " @ %from NL "To: " @ %to NL "CC: " @ %ccLine NL - "Subject: " @ getRecord(%text, 6) NL + "Subject: " @ %subjectLine NL "Date Sent: " @ getRecord(%text, 3) @ "\n\n" @ - EmailGetBody(%text); + %emailContents; return %prepend @ %msgtext; } @@ -624,23 +639,6 @@ function DoEmailDelete(%mid, %state) tn_community_mailui_clearCheckStatus(); } -// replacing function in webemail.cs, 1017 -function EmailGui::ButtonClick(%this,%ord) -{ - switch(%ord) - { - case 0: // wired to inbox button - $TribesNext::Community::MailUI::ActiveMailbox = "inbox"; - tn_community_mailui_clearCheckStatus(); - case 1: // wired to deleted items button - $TribesNext::Community::MailUI::ActiveMailbox = "deleted"; - tn_community_mailui_clearCheckStatus(); - case 2: // newly wired to sent items button which was present, but hidden - $TribesNext::Community::MailUI::ActiveMailbox = "sentbox"; - tn_community_mailui_clearCheckStatus(); - } -} - // replacing function in webemail.cs, 1229 function EmailGui::loadCache(%this) { } // replacing function in webemail.cs, 1274 @@ -931,6 +929,25 @@ function AddressDlg::onWake(%this) } } +function tn_community_mailui_selectedBox(%box) +{ + switch (%box) + { + case 0: // wired to inbox button + $TribesNext::Community::MailUI::ActiveMailbox = "inbox"; + tn_community_mailui_clearCheckStatus(); + tn_community_mailui_displayBox("inbox"); + case 1: // wired to deleted items button + $TribesNext::Community::MailUI::ActiveMailbox = "deleted"; + tn_community_mailui_clearCheckStatus(); + tn_community_mailui_displayBox("deleted"); + case 2: // newly wired to sent items button which was present, but hidden + $TribesNext::Community::MailUI::ActiveMailbox = "sentbox"; + tn_community_mailui_clearCheckStatus(); + tn_community_mailui_displayBox("sentbox"); + } +} + package tn_tmail { function EmailGui::onWake(%this) @@ -945,6 +962,11 @@ package tn_tmail EM_BlockBtn.setActive( false ); %selId = EM_Browser.getSelectedId(); Canvas.pushDialog(LaunchToolbarDlg); + + // DarkDragonDX: The mailUI override for selected buttons didn't work + rbInbox.command = "tn_community_mailui_selectedBox(0);"; + rbSendItems.command = "tn_community_mailui_selectedBox(2);"; + rbDeleted.command = "tn_community_mailui_selectedBox(1);"; if ( EM_Browser.rowCount() > 0 ) { @@ -966,6 +988,46 @@ package tn_tmail $TribesNext::Community::MailUI::Awake = 0; //error("EmailGui::onSleep: " @ %this); } + + // DarkDragonDX: Overwrite this function for the "GET MAIL" Button + function GetEmailBtnClick() + { + // We request the TMail and when the request completes, the callback + // tn_community_mail_requestCompleted is executed. + tn_community_mail_request_getNew($TribesNext::Community::MailUI::ActiveMailbox); + } + + function tn_community_mail_requestCompleted() + { + parent::tn_community_mail_requestCompleted(); + + // Add a small delay to make sure we have everything + schedule(200,0,"tn_community_mailui_displayBox", $TribesNext::Community::MailUI::ActiveMailbox); + } + + function GuiMLTextCtrl::onURL(%this, %url) + { + %payload = strReplace(%url, "-", " "); + %command = getWord(%payload, 0); + %identifier = getWord(%payload, 1); + + switch$(%command) + { + case "acceptinvite": + tn_community_browser_user_acceptInvite(%identifier); + EmailMessageDelete(); // This code shouldn't be executed unless we clicked on accept/reject in an invitations + messageBoxOK("ACCEPTED", "You have accepted the clan invitation."); + + case "rejectinvite": + tn_community_browser_user_rejectInvite(%identifier); + EmailMessageDelete(); + messageBoxOK("DECLINED", "You have rejected the clan invitation."); + + default: // Pass it on to anything else interested + parent::onURL(%this, %url); + } + } }; if (!isActivePackage(tn_tmail)) - activatePackage(tn_tmail); \ No newline at end of file + activatePackage(tn_tmail); + diff --git a/t2csri/community/settings.cs b/t2csri/community/settings.cs index 0a1abbe..aedd1e2 100644 --- a/t2csri/community/settings.cs +++ b/t2csri/community/settings.cs @@ -7,7 +7,7 @@ // This file contains the URL and server settings for the community system. -$TribesNext::Community::Host = "localhost"; +$TribesNext::Community::Host = "thyth.com"; $TribesNext::Community::Port = 80; $TribesNext::Community::BaseURL = "/tn/robot/"; diff --git a/t2csri/ipv4.cs b/t2csri/ipv4.cs index 184c47f..bd6145c 100644 --- a/t2csri/ipv4.cs +++ b/t2csri/ipv4.cs @@ -17,6 +17,11 @@ function ipv4_getInetAddress() { if ($IPv4::InetAddress !$= "") return; + if ($t2csri::isOfflineMode) + { + warn("TribesNext: Aborting routable IP address lookup due to game running in offline mode."); + return; + } if (isObject(IPv4Connection)) { @@ -65,6 +70,11 @@ function ipv4_reasonableConnection(%source, %destination) // Class A LAN, check if the client is also on the same network return (getSubStr(%source, 0, 2) $= "10"); } + else if (getSubStr(%destination, 0, 3) $= "127") + { + // loopback address check for servers hosted on the same system + return (getSubStr(%source, 0, 3) $= "127"); + } else if (getSubStr(%destination, 0, 3) $= "172" && getSubStr(%destination, 4, 2) > 15 && getSubStr(%destination, 4, 2) < 33) { // Class B LAN, check if the client is also on the same network diff --git a/t2csri/postLogin.cs b/t2csri/postLogin.cs index 5431e15..f4695d2 100644 --- a/t2csri/postLogin.cs +++ b/t2csri/postLogin.cs @@ -7,13 +7,5 @@ // load the community script components if (WONGetAuthInfo() !$= "") { - exec("t2csri/community/settings.cs"); - exec("t2csri/community/login.cs"); - exec("t2csri/community/mail.cs"); - exec("t2csri/community/browser.cs"); - schedule(32, 0, exec, "t2csri/community/mailUI.cs"); - schedule(64, 0, exec, "t2csri/community/browserUI.cs"); - // log into the community server - tn_community_login_initiate(); -} \ No newline at end of file +} diff --git a/t2csri/serverglue.cs b/t2csri/serverglue.cs index 5e7db08..46a548d 100644 --- a/t2csri/serverglue.cs +++ b/t2csri/serverglue.cs @@ -1,9 +1,26 @@ // Tribes 2 Unofficial Authentication System // http://www.tribesnext.com/ -// Written by Electricutioner/Thyth -// Copyright 2008 by Electricutioner/Thyth and the Tribes 2 Community System Reengineering Intitiative +// Written by Thyth +// Copyright 2008-2011 by Thyth and the Tribes 2 Community System Reengineering Intitiative -// Version 1.0 initialization and glue file (server side) +// Version 1.1 initialization and glue file (server side) + +// check to see if the game has been launched in offline mode +function t2csri_glue_initChecks() +{ + $t2csri::isOfflineMode = 0; + for (%i = 0; %i < $Game::argc; %i++) + { + %arg = $Game::argv[%i]; + if (%arg $= "-nologin") + $t2csri::isOfflineMode = 1; + } + if ($t2csri::isOfflineMode) + { + echo("Running TribesNext in offline mode. Not making connections to the Internet."); + } +} +t2csri_glue_initChecks(); if (isObject(ServerGroup)) {