private bool isPermitted(string user, Settings.AuthorizationLevel authorizationLevel) { if (authorizationLevel == Settings.AuthorizationLevel.ANYONE) { return true; } else if (authorizationLevel == Settings.AuthorizationLevel.NOBODY) { return false; } else if (authorizationLevel == Settings.AuthorizationLevel.SUBSCRIBERS) { WWW www = new WWW("https://api.twitch.tv/kraken/channels/" + settings.twitchChannelName.ToLower() + "/subscriptions/" + user, null, twitchApiHeaders); // FIXME ok this is a shitty thing to do, we really shouldn't block the main thread while (!www.isDone) { } if (www.error != null) { ircClient.LocalUser.SendMessage(ircChannel, user + ": You need to be subscribed to this channel to do this."); return false; } return true; } return false; }
private void drawAuthToggleGroup(ref Settings.AuthorizationLevel authLevel) { authLevel = GUILayout.Toggle(authLevel == Settings.AuthorizationLevel.NOBODY, "Nobody") ? Settings.AuthorizationLevel.NOBODY : authLevel; authLevel = GUILayout.Toggle(authLevel == Settings.AuthorizationLevel.SUBSCRIBERS, "Subscribers") ? Settings.AuthorizationLevel.SUBSCRIBERS : authLevel; authLevel = GUILayout.Toggle(authLevel == Settings.AuthorizationLevel.ANYONE, "Anyone") ? Settings.AuthorizationLevel.ANYONE : authLevel; }