bool HandlesChatClick(int mouseX, int mouseY) { string text = normalChat.GetSelected(mouseX, mouseY); if (text == null) { return(false); } string url = Utils.StripColours(text); if (Utils.IsUrlPrefix(url, 0)) { WarningScreen warning = new WarningScreen(game, false, false); warning.Metadata = url; warning.SetHandlers(OpenUrl, AppendUrl, null); warning.SetTextData( "&eAre you sure you want to open this link?", url, "Be careful - links from strangers may be websites that", " have viruses, or things you may not want to open/see."); game.Gui.ShowWarning(warning); } else if (game.ClickableChat) { input.Append(text); } return(true); }
void AppendUrl(WarningScreen screen, bool always) { if (!game.ClickableChat) { return; } input.Append((string)screen.Metadata); }
void OpenUrl(WarningScreen screen, bool always) { try { Process.Start((string)screen.Metadata); } catch (Exception ex) { ErrorHandler.LogError("ChatScreen.OpenUrl", ex); } }
void AppendUrl(WarningScreen screen) { if (!game.ClickableChat) { return; } textInput.AppendText((string)screen.Metadata); }