mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 16:39:21 +01:00
Dew it right
This commit is contained in:
@@ -55,7 +55,7 @@ namespace TGServerService
|
||||
|
||||
protected override ExitCode Run(IList<string> parameters)
|
||||
{
|
||||
var res = Instance.SendCommand(String.Format("{0};sender={1};custom={2}", Keyword, CommandInfo.Value.Speaker, String.Join(" ", parameters)));
|
||||
var res = Instance.SendCommand(String.Format("{0};sender={1};custom={2}", Keyword, CommandInfo.Value.Speaker, TGStationServer.SanitizeTopicString(String.Join(" ", parameters))));
|
||||
if (res != "SUCCESS" && !String.IsNullOrWhiteSpace(res))
|
||||
OutputProc(res);
|
||||
return ExitCode.Normal;
|
||||
|
||||
@@ -520,7 +520,7 @@ namespace TGServerService
|
||||
/// <inheritdoc />
|
||||
public string WorldAnnounce(string message)
|
||||
{
|
||||
var res = SendCommand(SCWorldAnnounce + ";message=" + message);
|
||||
var res = SendCommand(SCWorldAnnounce + ";message=" + SanitizeTopicString(message));
|
||||
if (res == "SUCCESS")
|
||||
return null;
|
||||
return res;
|
||||
|
||||
@@ -154,11 +154,15 @@ namespace TGServerService
|
||||
return !(GameAPIVersion == null || GameAPIVersion < MinAPIVersion || GameAPIVersion > MaxAPIVersion);
|
||||
}
|
||||
|
||||
public static string SanitizeTopicString(string input)
|
||||
{
|
||||
return input.Replace("%", "%25").Replace("=", "%3d").Replace(";", "%3b").Replace("&", "%26").Replace("+", "%2b");
|
||||
}
|
||||
|
||||
//Fuckery to diddle byond with the right packet to accept our girth
|
||||
string SendTopic(string topicdata, ushort port)
|
||||
{
|
||||
//santize the escape characters in accordance with http://www.byond.com/docs/ref/info.html#/proc/params2list
|
||||
topicdata = topicdata.Replace("%", "%25").Replace("=", "%3d").Replace(";", "%3b").Replace("&", "%26");
|
||||
lock (topicLock) {
|
||||
if (!CheckAPIVersionConstraints())
|
||||
return "Incompatible API!";
|
||||
|
||||
Reference in New Issue
Block a user